I recently pushed a few big code changes to my staging environment that I attempted to deploy to my ElasticBeanstalk environment, but it failed and I am stuck on what could be causing the error, because it was due to a timeout in the deployment. I tried to run deploy with a 20 minute timeout and still faced the same issue, which makes me believe that something is wrong beyond the deployment needed more time to run.
This is the first time I have hit this issue and I can't seem to access logs from the user interface because the deployment leaves a potentially corrupted version from its attempt and when I run pull logs it hits a timeout. The code changes run without issue on my localhost, but there are a few migration scripts that need to run.
There are two areas that I might speculate could be related to a timeout issue, but I don't have evidence to support it, just the knowledge that these could impact the server.
1) Has my memory exceeded the storage for this environment?
EC2 Instance Type: t2.micro
2) Could an ebextension be a factor in causing the timeout or if there was an error would it stop the server and render and error log?
Here are my ebextensions:
00_nginx_https_rw.config:
files:
"/tmp/45_nginx_https_rw.sh":
owner: root
group: root
mode: "000644"
content: |
#! /bin/bash
CONFIGURED=`grep -c "return 301 https" /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf`
if [ $CONFIGURED = 0 ]
then
sed -i '/listen 8080;/a \ if ($http_x_forwarded_proto = "http") { return 301 https://$host$request_uri; }\n' /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf
logger -t nginx_rw "https rewrite rules added"
exit 0
else
logger -t nginx_rw "https rewrite rules already set"
exit 0
fi
container_commands:
00_appdeploy_rewrite_hook:
command: cp -v /tmp/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/appdeploy/enact
01_configdeploy_rewrite_hook:
command: cp -v /tmp/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/configdeploy/enact
02_rewrite_hook_perms:
command: chmod 755 /opt/elasticbeanstalk/hooks/appdeploy/enact/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/configdeploy/enact/45_nginx_https_rw.sh
03_rewrite_hook_ownership:
command: chown root:users /opt/elasticbeanstalk/hooks/appdeploy/enact/45_nginx_https_rw.sh /opt/elasticbeanstalk/hooks/configdeploy/enact/45_nginx_https_rw.sh
01_sequelize_db_migration.config:
container_commands:
00_node_binary:
command: "sudo ln -sf `ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin/node /bin/node"
00_npm_binary:
command: "sudo ln -sf `ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin/npm /bin/npm"
50_migrations:
command: "./node_modules/.bin/sequelize db:migrate"
leader_only: true