forked from publiclab/mapknitter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·40 lines (31 loc) · 1.03 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/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
yarn
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