Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # update.sh
- #
- # OPTIONS
- # -b Skip bundle and restarting process
- # -f Skip yarn and webpacker
- # -g Skip git pull
- # -m Skip post deployment migrate
- GIT="TRUE"
- FRONT="TRUE"
- BACK="TRUE"
- MIGRATE="TRUE"
- while getopts bfgm OPT
- do
- case $OPT in
- "b" ) BACK="FALSE" ;;
- "f" ) FRONT="FALSE" ;;
- "g" ) GIT="FALSE" ;;
- "m" ) MIGRATE="FALSE" ;;
- * ) echo "Invalid option detected." 1>&2
- exit 1 ;;
- esac
- done
- cd /home/mastodon/live
- if [ "$GIT" = "TRUE" ]; then
- git pull origin master
- fi
- if [ "$FRONT" = "TRUE" ]; then
- yarn install --pure-lockfile
- RAILS_ENV=production bundle exec rails assets:precompile
- fi
- if [ "$BACK" = "TRUE" ]; then
- gem install bundler
- bundle install --deployment --without development test
- if [ "$MIGRATE" = "TRUE" ]; then
- RAILS_ENV=production bundle exec rails db:migrate
- else
- SKIP_POST_DEPLOYMENT_MIGRATIONS=true RAILS_ENV=production bundle exec rails db:migrate
- fi
- fi
- exit
Add Comment
Please, Sign In to add comment