I have a Python2/Django application running on AWS Beanstalk. I use Dockerfile for deployment. Everything was working fine until I added firebase-admin==3.2.1
dependency to my requirements.txt
. What happens is that the Docker image build time took longer than usual and Beanstalk build process started to fail. With more analysis, I noticed that a sub-dependency is what takes long time to install, grpcio==1.31.0
. It is used by Firebase lib to communicate with Google APIs.
I tried to increase the Command Timeout setting to 20 min and more but nothing changed. EB deployment process consumes the whole time interval and eventually fails. I tried to get into the EC2 instance itself to find anything useful that I can tweak but found nothing.
This is a sample of the eb-engine.log
that, I believe, explains the error part.
Stored in directory: /root/.cache/pip/wheels/6f/8e/a7/c5ce8f1742b7d2b9e07cd1064cf201293d157c3c4e1021a74a
Running setup.py bdist_wheel for psutil: started
Running setup.py bdist_wheel for psutil: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/39/a0/f5/c4fa280463e29aea07797acb5312358fefb067c1f4f98e11b1
Running setup.py bdist_wheel for Pyphen: started
Running setup.py bdist_wheel for Pyphen: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/78/e3/76/42853bf2f7573a72fb5fe377a8406c979a5479ad6930506cde
Running setup.py bdist_wheel for cairocffi: started
Running setup.py bdist_wheel for cairocffi: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/3a/2e/92/89e9dcce600a1a78bebe571fdd096669cba354b29c5e1140b9
Running setup.py bdist_wheel for CairoSVG: started
Running setup.py bdist_wheel for CairoSVG: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/b0/f0/12/0c41649d33dbc95ce0188188feefc8f90aa877363322fd3ace
Running setup.py bdist_wheel for gevent: started
Running setup.py bdist_wheel for gevent: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/66/89/6a/7438b05445edc27023a9d8935801d4e70ed962e02541e57fbd
Running setup.py bdist_wheel for httplib2: started
Running setup.py bdist_wheel for httplib2: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/9a/a8/c3/72684de9397a5633e21ba89911174fbc9eb0b1fb9005c6eaf0
Running setup.py bdist_wheel for grpcio: started
Running setup.py bdist_wheel for grpcio: still running...
Running setup.py bdist_wheel for grpcio: still running...
Running setup.py bdist_wheel for grpcio: still running...
2020/11/05 16:12:14.123278 [ERROR] An error occurred during execution of command [app-deploy] - [Docker Specific Build Application]. Stop running the command. Error: failed to build docker image: Command /bin/sh -c docker build -t aws_beanstalk/staging-app /var/app/staging/ failed with error Command timed out after 300 seconds
2020/11/05 16:12:14.123302 [INFO] Executing cleanup logic
2020/11/05 16:12:14.131856 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment failed to build the Docker image. The deployment failed.","timestamp":1604592734,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1604592734,"severity":"ERROR"}]}]}
2020/11/05 16:12:14.133315 [INFO] Platform Engine finished execution on command: app-deploy
As you will notice in the previous sample that the Docker build process fails after exactly 300 seconds regardless of the Command Timeout setting value.
Stop running the command. Error: failed to build docker image: Command /bin/sh -c docker build -t aws_beanstalk/staging-app /var/app/staging/ failed with error Command timed out after 300 seconds