I'm running a Rails 4.2 app on Elastic Beanstalk, and need to set log permissions and create the /tmp/uploads folder (plus permissions) after deploy.
I was running two ebextensions scripts to do this, but on some occasions they would fail because the folder /var/app/current/ didn't yet exist.
I'm presuming this is because the permissions and/or folders should be created on /app/ondeck/ first so that EB can copy the contents over to /var/app/current/, but I'm interested to see if there's a recommended and more foolproof approach to doing this?
For reference, my two ebextension scripts were:
command: "chmod 755 /var/app/current/log/*"
command: "mkdir -p /var/app/current/tmp/uploads/"
command: "chmod 755 /var/app/current/tmp/uploads/"
you should probably use files tag and not command:
commands: create_post_dir: command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post" ignoreErrors: true files: "/opt/elasticbeanstalk/hooks/appdeploy/post/99_make_changes.sh": mode: "000777" content: | #!/bin/bash mkdir -p /var/app/current/tmp/uploads/ chmod 755 /var/app/current/tmp/uploads/
it will be triggered after app deploy finished