Created
October 19, 2015 17:50
-
-
Save philchristensen/8cd9ac2f155c1622e491 to your computer and use it in GitHub Desktop.
Execute docker commands for particular containers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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