Dokku plugin to execute scripts on dokku host after a deploy
- dokku 0.4.0+
# on 0.4.x
dokku plugin:install https://github.com/baikunz/dokku-post-deploy-script.git post-deploy-script
This plugin provides hooks:
post-deploy
: Execute script on dokku host after deploy
This plugin allows you to execute on your host a script which reside in the $DOKKU_ROOT/$APP/
after a deploy.
The file must be named POST_DEPLOY_SCRIPT
.
Two dokku apps need to communicate with each other. In order to do so we have to create a common network and attach both of our apps that common network.
However, after every deploy, the newly created container won't be reattached automatically, and you'll have to do that manually, or using this plugin you can create in both of those apps a POST_DEPLOY_SCRIPT
that will do that for you.
In $DOKKU_ROOT/firstapp/POST_DEPLOY_SCRIPT
for the first app
#!/bin/bash
NETWORK_NAME='common-network'
# Create network if it does not exists
NETWORK=$(docker network ls -q -f name="$NETWORK_NAME")
[[ -z "$NETWORK" ]] && docker network create "$NETWORK_NAME"
# Connect to the network
docker network connect "$NETWORK_NAME" firstapp.web.1
In $DOKKU_ROOT/secondapp/POST_DEPLOY_SCRIPT
for the second app
#!/bin/bash
NETWORK_NAME='common-network'
# Create network if it does not exists
NETWORK=$(docker network ls -q -f name="$NETWORK_NAME")
[[ -z "$NETWORK" ]] && docker network create "$NETWORK_NAME"
# Connect to the network
docker network connect "$NETWORK_NAME" secondapp.web.1