Open jamesst20 opened 5 years ago
This is a very good idea, and actually a pretty common request. App Engine doesn't provide any deploy hooks, but we could provide a rake task that does this (i.e. the rake task just does a gcloud deploy
followed by a rake appengine:exec
). Although you could also just write yourself a shell script.
To solve this situation I use this entrypoint in app.yaml
:
entrypoint: bin/rails_with_migrations.sh server -u puma --port $PORT
and the following script in bin
with +x
property:
#!/bin/bash
bundle exec rake db:migrate
if [ $? -eq 0 ]
then
bundle exec rails $@
else
echo "Failure: migrations failed, please check application logs for more details." >&2
exit 1
fi
Hi,
Sorry in advance if it isn't the right place to ask.
I was wondering if it was possible to automatically run migrations on every deploy ? Currently I must run
bundle exec rake appengine:exec -- bundle exec rake db:migrate
after each deploy manually.Thank you