Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
The correct way to run rails db migration on AWS Beanstalk (Docker Container Environment)
# .ebextensions/scripts/
. /opt/elasticbeanstalk/hooks/
EB_SUPPORT_FILES=$(/opt/elasticbeanstalk/bin/get-config container -k support_files_dir)
while read -r ENV_VAR; do
done < <($EB_SUPPORT_FILES/generate_env)
echo "Running migrations for aws_beanstalk/staging-app"
docker run --rm "${EB_CONFIG_DOCKER_ENV_ARGS[@]}" -t aws_beanstalk/staging-app bundle exec rake db:migrate || echo "The Migrations failed to run."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment