Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.