I'm creating my first app on AWS App Runner. I have a simple nginx Docker image that works locally by serving html on localhost:8080.
When I try to deploy it, the result is "Create Failed". Upon digging into the CloudWatch logs, I see that the health check failed. The health check is configured to ping the root of the service "/" at port 8080.
I was able to resolve this by deleting my App Runner app (this is currently the only way to change the configuration-- see this issue), then creating a new one and specifying the health check to ping port 80.
Are you getting this error:
10-21-2021 02:13:32 PM [AppRunner] Health check on port '80' failed. Service is rolling back. Check your configured port number. For more information, read the application logs.
10-21-2021 02:07:40 PM [AppRunner] Performing health check on port '80'.
10-21-2021 02:07:30 PM [AppRunner] Provisioning instances and deploying image.
10-21-2021 02:07:20 PM [AppRunner] Successfully pulled image from ECR.
10-21-2021 02:04:58 PM [AppRunner] Service status is set to OPERATION_IN_PROGRESS.
10-21-2021 02:04:57 PM [AppRunner] Service creation started.
If you are building on an M1 mac by chance? If so that's probably the reason. The image that's being built is of the ARM architecture, and App Runner or Fargate is an x86 runtime.
Aws is working on fixing this issue here: #1949
In the meantime, there's a workaround, you can prefix copilot commands with the DOCKER_DEFAULT_PLATFORM=linux/amd64
For example:
DOCKER_DEFAULT_PLATFORM=linux/amd64 copilot deploy
So basically when you build your docker image just use:
You can use buildx (mobi) which suipport cli for platform.
docker build --platform linux/amd64 -t your-docker-image-name .
Hope that helps, and sorry for the trouble 🙏
Related
So I setup a aws ecs cluster to run a docker image of Valhalla service almost as-is.
Issue : target group seems to be not able to check for cluster health, like if the health request was reaching the cluster, but container is not "forwarding" the request to Valhalla.
Description :
I created a repository on AWS ECR, and pushed a docker image of gisops/valhalla with only the valhalla.json file changed.
Here is the valhalla configuration I used.
Note that I changed the default listening port from 8002 to 80.
I created a ECS Fargate cluster, and a service that uses this task definition to launch a container that runs Valhalla.
The service receives traffic from an application load balancer via port 80.
The target group is checking /status path on port 80.
All set, the task is then creating, and task logs shows that Valhalla is initializing perfectly and running.
However the target group is not able to check for health status : the request seems to timeout.
If the request was reaching valhalla, the task logs would have at least show it (because valhalla logs every incoming request by default), but it doesn't.
Therefore fargate kills the task (Task failed ELB health checks in (target-group {my-target-group-uri})) (showing that the health request was reaching the cluster service indeed)
I don't think the issue is with the valhalla configuration, because I can run the same docker image locally, and it works perfectly, using :
docker run -dt -p 3000:80 -v /local/path/to/valhalla-files:/custom_files/ --name valhalla gisops/valhalla:latest
And then checking localhost:3000/status
Anyone has an idea of what could be the issue ?
Already spent a lot of time on this, and I'm out of ideas. Thanks for your help !
The app runner is successfully created and works fine, but any attempt to change the configuration gets an error. It seems that the healthcheck does not work, although after creation everything works fine.
[AppRunner] Service status is set to RUNNING.
[AppRunner] Service update failed. For details, see service logs.
[AppRunner] Performing health check on path '/healthz' and port '8080'.
[AppRunner] Provisioning instances and deploying image.
[AppRunner] Service status is set to OPERATION_IN_PROGRESS.
[AppRunner] Service update started.
[AppRunner] Service status is set to RUNNING.
[AppRunner] Service creation completed successfully.
[AppRunner] Successfully routed incoming traffic to application.
[AppRunner] Health check is successful. Routing traffic to application.
[AppRunner] Performing health check on path '/healthz' and port '8080'.
[AppRunner] Provisioning instances and deploying image.
[AppRunner] Successfully pulled image from ECR.
[AppRunner] Service status is set to OPERATION_IN_PROGRESS.
[AppRunner] Service creation started.
This happens with any change. For example, here I just changed the healthcheck interval from the default 10 seconds to the maximum 20.
At the same time, it is impossible to find any logs explaining what went wrong. Cloudwatch just duplicates the message Service update failed. For details, see service logs.
If it matters, I'm running the application inside a VPC, with NAT configured. There is also a private db instance with access only from the VPC. Healthcheck /healthz checks access to the internet and to the database, there are no problems with this.
Any ideas what I'm doing wrong or where I can find useful logs would be helpful.
I got a task to deploy a static website on an AWS Ubuntu Server, I was given the username and the SSH key for it. Using PuTTy I got access to the server, setup django, postgres nginx and gunicorn. However now I need to check the progress and whichever tutorial I looked up, I found them checking their deployment progress with a dns address, but since I have connected to the server remotely, I do not have that. So please help me check my deployment status. I am attaching some screenshots of the PuTTy terminal below
Image of the final Gunicorn command to finish the deployment
My AWS App Runner application is running normally,
12-19-2021 05:28:15 PM [AppRunner] Service status is set to RUNNING.
12-19-2021 05:28:15 PM [AppRunner] Service creation completed successfully.
12-19-2021 05:28:14 PM [AppRunner] Successfully routed incoming traffic to application.
12-19-2021 05:27:48 PM [AppRunner] Health check is successful. Routing traffic to application.
12-19-2021 05:26:39 PM [AppRunner] Performing health check on path '/ping' and port '8081'.
12-19-2021 05:26:29 PM [AppRunner] Provisioning instances and deploying image.
12-19-2021 05:26:18 PM [AppRunner] Successfully pulled image from ECR.
12-19-2021 05:24:17 PM [AppRunner] Service status is set to OPERATION_IN_PROGRESS.
12-19-2021 05:24:16 PM [AppRunner] Service creation started.
It's an express/ws application, and it works just fine in Docker locally. I am able to reach the myapplication.com/ WebSocket endpoint when it's running locally. However, I am seemingly unable to reach the WebSocket domain when the app is running on AWS App Runner. The application runs at port 8081 internally, but of course App Runner will port that over to port 80/443 to the outside.
I can confirm that the application is running at-least partially in App Runner, since I can reach the myapplication.com/ping endpoint.
I have tried manually with JavaScript in the console to connect to the WebSocket endpoint with every combination of ws://myapplication.com/, wss://myapplication.com/, wss://myapplication.com:8081/, ws://myapplication.com:8081/ and nothing has worked.
My question is - Does App Runner even support WebSockets? I read this on the documentation of App Runner:
Stateless apps – App Runner doesn't guarantee state persistence beyond the duration of processing a single incoming web request.
This, of course, means that having a long term WebSocket client running on AWS App Runner isn't a great idea, but does it also mean that WebSockets are impossible?
Unfortunately, AWS App Runner doesn't support WebSockets as well as sticky sessions.
I'm making local cloud run services with the Cloud Code plugin to Intellij (PyCharm) but the locally deployed service cannot connect to the redis instance running in Docker:
redis.exceptions.ConnectionError: Error 111 connecting to 127.0.0.1:6379. Connection refused.
I can connect to the locally running redis instance from a python shell, it's just the cloud run service running in minikube/docker that cannot seem to connect to it.
Any ideas?
Edit since people are suggesting completely unrelated posts - The locally running Cloud Run instance makes use of Docker and Minikube to run, and is automatically configured by Cloud Code for Intellij. I suspect that Cloud Code for intellij puts Cloud Run instances into an environment that cannot access services running on MacOS localhost (but can access the Internet), which is why I tagged those specific items in the post. Please limit suggestions to ones that takes these items into account.
If you check Docker network using:
docker network list
You'll see a network called cloud-run-dev-internal. You need to connect your Redis container to that network. To do that, run this command (This instruction assumes that your container name is some-redis):
docker network connect cloud-run-dev-internal some-redis
Double check that your container is connected to the network:
docker network inspect cloud-run-dev-internal
Then connect to Redis Host using the container name:
import redis
...
redis_host = os.environ.get('REDISHOST', 'some-redis')
redis_port = int(os.environ.get('REDISPORT', 6379))
redis_client = redis.StrictRedis(host=redis_host, port=redis_port)