#!/bin/bash target_branch="INSERT_YOUR_BRANCH_HERE" # e.g., "mission/car-2000-1234" cd /opt/andes_root/andes echo "######################### Sync repository with '$target_branch' branch of remote repository (origin)" git reset --hard HEAD git fetch origin --prune git checkout $target_branch git reset --hard origin/$target_branch chown -R www-data:www-data . chmod -R 771 . echo "######################### activating the virtual environment" source ../venv/bin/activate echo "######################### updating python dependencies" chown -R www-data:www-data ../venv pip install -r requirements.txt chown -R www-data:www-data ../venv echo "######################### migrate, collect static, compile messages" rm -r ./staticfiles # just safest to delete all the staticfiles and reimport # newer branches have a precompiles versions in the repo, no need to compile the messages. # python manage.py compilemessages python manage.py collectstatic --no-input python manage.py migrate echo "######################### restart services" sudo service mysql restart sudo systemctl restart nav_depth_listener.service scanmar_listener.service celeryd.service apache2.service echo "######################### clear out the message log for redis" sudo redis-cli flushall deactivate echo "######################### clean up" cd ~