Last active
September 20, 2017 17:27
-
-
Save aleclarson/380a05ff5e10d3b106d78795e3f85c39 to your computer and use it in GitHub Desktop.
Dokku redeploy fix
This file contains hidden or 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
description "Dokku app redeploy fix service" | |
start on started dokku-reploy | |
exec start-stop-daemon --start -c dokku --exec /usr/bin/dokku-redeploy-fix |
This file contains hidden or 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
[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 |
This file contains hidden or 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 | |
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