This repository has been archived on 2021-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
greenlight/bin/start

23 lines
547 B
Plaintext
Raw Normal View History

2018-06-20 15:24:39 -04:00
#!/bin/bash
2018-07-30 15:42:45 -04:00
2018-07-11 13:19:20 -04:00
if [ "$RAILS_ENV" = "production" ] && [ "$DB_ADAPTER" = "postgresql" ]; then
2018-07-30 15:42:45 -04:00
while ! curl http://$DB_HOST:${DB_PORT:-5432}/ 2>&1 | grep '52'
do
echo "Waiting for postgres to start up ..."
sleep 1
done
2018-07-09 13:17:23 -04:00
fi
2018-06-20 15:24:39 -04:00
db_create="$(RAILS_ENV=$RAILS_ENV bundle exec rake db:create 2>&1)"
2019-10-15 12:15:45 -04:00
echo $db_create
if [[ $db_create == *"already exists"* ]]; then
2019-10-15 12:15:45 -04:00
echo ">>> Database migration"
bundle exec rake db:migrate
else
echo ">>> Database initialization"
2019-10-15 12:58:11 -04:00
bundle exec rake db:schema:load
2018-07-05 17:25:59 -04:00
fi
2018-06-20 15:24:39 -04:00
exec bundle exec puma -C config/puma.rb