I tried to host docker container in my EC2, just for UAT (for production, we will fargate). My concern is I want to host my container in EC2 and run all test cases, after successfully will be deployed to fargate.
Here is appspec.yml
version: 0.0
os: linux
files:
- source: /
destination: /root/MY-BACKEND
overwrite: true
hooks:
BeforeInstall:
- location: ./scripts/before_install.sh
timeout: 300
runas: root
AfterInstall:
- location: ./scripts/after_install.sh
timeout: 300
runas: root
ApplicationStart:
- location: ./scripts/app_start.sh
timeout: 300
runas: root
ApplicationStop:
- location: ./scripts/app_stop.sh
timeout: 300
runas: root
ValidateService:
- location: ./scripts/validate_server.sh
timeout: 300
runas: root
and after_install.sh
cd /root/MY-BACKEND
docker build -t my-backend .
and app_start.sh
cd /root/MY-BACKEND
docker run -d -p 80:2019 --name my-docker my-backend
and validate_server.sh
curl -m 5 http://0.0.0.0
After that, I've encountered following error message from Validate Server [stderr]curl: (52) Empty reply from server
And when changed to curl -m 5 http://localhost
, encountered following error message [stderr]curl: (56) Recv failure: Connection reset by peer
But when I open browser, my app is working either tried curl
from my local and remote server, both are working. Please let me know which I missed to add some validation.