Skip to content

Instantly share code, notes, and snippets.

@lucasm-iRonin
Forked from egerlach/update-dokku-stack.sh
Created April 27, 2016 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucasm-iRonin/924957ac556a59189c9610bbf989144e to your computer and use it in GitHub Desktop.
Save lucasm-iRonin/924957ac556a59189c9610bbf989144e to your computer and use it in GitHub Desktop.
Update stack underlying apps running on dokku
#!/bin/bash
# before you can use this, you need to run (as root):
# git clone https://github.com/tt/stack-images.git /root/stack-images
# git clone https://github.com/gliderlabs/herokuish.git /root/herokuish
# First, we need to get our base ubuntu images up to date
docker pull ubuntu-debootstrap:14.04
docker pull ubuntu:trusty # for postgresql
# First update all our dokku plugins from their origins
pushd /var/lib/dokku/plugins
for d in *;
do
pushd $f
if git status -s; then
git pull
fi
popd $f
done
# And force them all to rebuild!
dokku plugin:install
# Next, rebuild the heroku cedar stack to get any security updates
pushd /root/stack-images
git pull origin
docker build -t heroku/cedar:14 ./
popd
# build a new herokuish stack on our now-secure cedar stack
pushd /root/herokuish
git pull origin
docker build -t gliderlabs/herokuish:latest ./
popd
# Rebuild all our apps on the new base image
dokku ps:rebuildall
sleep 120 # Sleep to allow old processes to exit
# Now clean up old containers and old images
docker ps -a --no-trunc | grep 'Exit' | awk '{print $1}' | xargs -L 1 -r docker rm
docker rmi $(docker images -f "dangling=true" -q)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment