Last active
December 22, 2022 03:24
-
-
Save egerlach/97217e644057afe433b2 to your computer and use it in GitHub Desktop.
Update stack underlying apps running on dokku
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 | |
# 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