App runner is not working

0

Hi,

I am trying to deploy my go application via App runner. In my application I am connecting to the SQL DB which is AWS deployed and it has public access for now. And it is connecting to firebase also. My dockerfile looks like this


FROM golang:1.24.0-alpine AS build

WORKDIR /app

COPY . .

RUN go mod download

RUN go build -o app .

FROM alpine:latest
WORKDIR /home/appuser/

RUN apk add --no-cache ca-certificates && \
    adduser -D appuser && \
    mkdir -p /home/appuser/ && \
    chown appuser:appuser /home/appuser/

COPY --from=build /app/app /home/appuser/app
COPY --chown=appuser:appuser firebase/serviceAccountKey.json /home/appuser/serviceAccountKey.json

RUN chmod +x /home/appuser/app

RUN ls -la /home/appuser/
USER appuser

EXPOSE 8080
ENTRYPOINT ["./app"]

To debug also I am also not able to see any application logs. It's hard to debug because I am not sure what's going wrong. If anything I am missing please let me know

asked 13 days ago33 views
2 Answers
0

It seems you're encountering issues deploying your Go application to AWS App Runner. There are a few things to consider:

  1. Application Logs: Not being able to see application logs is a common issue. To view logs in App Runner, check the Logs tab on your service page in the AWS console. If you're not seeing any logs, it might indicate that your application isn't starting correctly.

  2. Database Connection: Ensure that the security group associated with your RDS instance allows incoming traffic from App Runner. Even though your database has public access, there might be network restrictions preventing the connection.

  3. Firebase Configuration: Make sure the serviceAccountKey.json file is correctly copied and accessible in the container. Your Dockerfile seems to handle this, but double-check the file permissions and location.

  4. Port Configuration: App Runner typically expects your application to listen on port 8080 by default. Ensure your Go application is configured to listen on this port.

  5. Environment Variables: If your application requires environment variables for database connection strings or Firebase configuration, make sure these are properly set in your App Runner configuration.

  6. Health Checks: App Runner performs health checks to ensure your application is running. Make sure your application has a health check endpoint that responds correctly.

  7. Build Process: Your Dockerfile looks correct, but ensure that all necessary dependencies are included and that the build process completes successfully.

To troubleshoot further:

  1. Try deploying a simple "Hello World" Go application to isolate whether the issue is with your application or the App Runner configuration.

  2. Use the App Runner configuration file (apprunner.yaml) to specify your build and run commands explicitly.

  3. Check the full deployment logs in the App Runner console for any error messages or unexpected behavior.

  4. Verify that your Go application runs correctly in a local Docker container before deploying to App Runner.

If you're still encountering issues, you may need to review your application code to ensure it's compatible with the App Runner environment. Consider starting with a very simple Go application that just returns a basic HTTP response to isolate whether the problem is with your application or the App Runner configuration.

Sources
AWS App Runner not passing health check for a simple python application | AWS re:Post
App Runner - Failed to deploy your application image | AWS re:Post
TypeScript error when deploying code to AppRunner container. | AWS re:Post

profile picture
answered 13 days ago
profile picture
EXPERT
reviewed 13 days ago
0

Hello.

Can't you check the logs during deployment in the AppRunner console?
There should be an item called "Deployment Log" in the AppRunner console, so try checking the log there.
If there is any problem during the build, an error will be output to the deploy log.
a

profile picture
EXPERT
answered 13 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions