Skip to content

Instantly share code, notes, and snippets.

@philchristensen
Created October 19, 2015 17:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save philchristensen/8cd9ac2f155c1622e491 to your computer and use it in GitHub Desktop.
Save philchristensen/8cd9ac2f155c1622e491 to your computer and use it in GitHub Desktop.
Execute docker commands for particular containers
#!/bin/bash -x
WEBAPPS=$(docker ps | grep "philchristensen/insite:latest" | awk '{print $1}')
WORKERS=$(docker ps | grep "philchristensen/insite:worker" | awk '{print $1}')
BEATER=$(docker ps | grep "philchristensen/insite:beat" | awk '{print $1}')
find /opt/insite-web -name '*.pyc' -delete
echo "$WEBAPPS" | xargs -I ID docker exec ID pip install -r requirements.txt
date > /opt/insite-web/reload
echo "$WORKERS" | xargs -I ID docker exec ID pip install -r requirements.txt
echo "$WORKERS" | xargs -I ID docker exec ID supervisorctl restart celeryd
# There should only ever be one beater, so this is a nice way to do per-deploy stuff
echo "$BEATER" | xargs -I ID docker exec ID pip install -r requirements.txt
echo "$BEATER" | xargs -I ID docker exec ID supervisorctl restart celerybeat
echo "$BEATER" | xargs -I ID docker exec ID python manage.py migrate --noinput
echo "$BEATER" | xargs -I ID docker exec ID python manage.py collectstatic --noinput
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment