Files
mapknitter/start.sh
Sebastian Silva 9b79fb9735 Remove forego and start passenger directly (#1545)
* Properly link to dockerfile

* Remove forego and start passenger directly

* Remove Procfile

* Attempt to upgrade bundler

* Run thru bundler
2021-10-26 15:35:28 -07:00

40 lines
1.0 KiB
Bash
Executable File

#!/bin/bash -l
pidfile=/app/tmp/pids/server.pid
cp config/database.yml.example config/database.yml
cp config/config.yml.example config/config.yml
cp config/initializers/recaptcha.rb.example config/initializers/recaptcha.rb
cp db/schema.rb.example db/schema.rb
mkdir -p tmp/pids
rm -rf tmp/cache/bootsnap*
if [ ! -f "./config/initializers/recaptcha.rb" ]; then
echo -e "\e[33mWARNING\e[0m: You haven't configured recaptcha!"
echo -e "\e[94mRead More\e[0m: https://github.com/publiclab/mapknitter#installation-steps"
fi
bump_database(){
bundle exec rails db:schema:load || bundle exec rails db:migrate
}
bundle check || bundle install
if bundle exec rails db:exists; then
>&2 echo "Database exists, only migrating it..."
bundle exec rails db:migrate
else
>&2 echo "Database doesn't exist, creating and migrating it..."
bundle exec rails db:create
bump_database
fi
rake assets:precompile
if [ -f $pidfile ] ; then
>&2 echo 'Server PID file already exists. Removing it...';
rm $pidfile;
fi
bundle exec passenger start --port $PORT