Skip to content

Commit

Permalink
Fix ansible update.sh.j2 template
Browse files Browse the repository at this point in the history
  • Loading branch information
neoformit committed Oct 3, 2024
1 parent 3eff631 commit 61b4261
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions deploy/ansible/roles/galaxy_media_site/templates/update.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@

set -e

# Make sure this isn't being run as root
if [[ $EUID = 0 ]]; then
echo "Don't run this as root - ubuntu is fine!"
# Ensure run as root
if [[ $EUID != 0 ]]; then
echo "Must be run as root - use sudo"
exit 0
fi

# Source virtual environment and git pull
cd galaxy-content-site
cd {{ project_root }}
source '{{ venv_root }}/bin/activate'
git pull
python -m pip install -r requirements.txt
cd webapp
cd {{ django_root }}

# Collect any new static files for Nginx if neccessary
python manage.py collectstatic --noinput

# Migrate the database (if necessary)
python manage.py migrate
sudo -u www-data python manage.py migrate

# Update file ownership to allow www-data to write logs/media
sudo chown -R www-data:www-data webapp/logs
sudo chown -R www-data:www-data webapp/media
chown -R www-data:www-data webapp/logs
chown -R www-data:www-data webapp/media

# Restart the GMS web service
sudo service gms restart
service gms restart

echo ""
echo "~~~ Restarted Galaxy Media Site ~~~"
Expand Down

0 comments on commit 61b4261

Please sign in to comment.