Skip to content

Instantly share code, notes, and snippets.

@aleclarson
Last active September 20, 2017 17:27
Show Gist options
  • Save aleclarson/380a05ff5e10d3b106d78795e3f85c39 to your computer and use it in GitHub Desktop.
Save aleclarson/380a05ff5e10d3b106d78795e3f85c39 to your computer and use it in GitHub Desktop.
Dokku redeploy fix
description "Dokku app redeploy fix service"
start on started dokku-reploy
exec start-stop-daemon --start -c dokku --exec /usr/bin/dokku-redeploy-fix
[Unit]
Description=Dokku app redeploy fix service
Requires=dokku-redeploy.service
After=dokku-redeploy.service
[Service]
Type=simple
User=dokku
ExecStart=/usr/bin/dokku-redeploy-fix
[Install]
WantedBy=multi-user.target
#!/bin/bash
for APP_DIR in /home/dokku/*/; do
APP=$(basename $APP_DIR)
for CONTAINER_FILE in /home/dokku/$APP/CONTAINER.web.*; do
if [ -f "$CONTAINER_FILE" ]; then
INDEX=$(awk -F '.' '{ print $3 }' <<< $CONTAINER_FILE)
CONTAINER_ID=$(< $CONTAINER_FILE)
CONTAINER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CONTAINER_ID)
if [ ! -z $CONTAINER_IP ]; then
echo " ---> $APP.web.$INDEX: $CONTAINER_IP"
echo $CONTAINER_IP > /home/dokku/$APP/IP.web.$INDEX
dokku nginx:build-config $APP
fi
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment