Last active
February 27, 2022 15:50
-
-
Save adam187/ae36813f0742ba0d0f9ee26757c3fbd7 to your computer and use it in GitHub Desktop.
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 | |
# Fail on first error | |
set -e | |
APP=${1?dokku app name required} | |
MAILCATCHER_APP=mailcatcher-${APP} | |
MAILCATCHER_APP_DOCKER_NAME=${MAILCATCHER_APP}.web.1 | |
MAILCATCHER_HOST=${MAILCATCHER_APP} | |
MAILCATCHER_SMTP_PORT=1025 | |
MAILCATCHER_SMTP_URL=smtp://${MAILCATCHER_HOST}:${MAILCATCHER_SMTP_PORT} | |
echo "Pulling mailcatcher image from docker registry" | |
docker pull schickling/mailcatcher | |
echo "Ensure that app exists" | |
dokku apps:report ${APP} | |
echo "Crete dokku app for mailcatcher" | |
dokku apps:create ${MAILCATCHER_APP} | |
echo "Tagging docker image with mailcatcher app tag" | |
docker tag schickling/mailcatcher:latest dokku/${MAILCATCHER_APP}:latest | |
echo "Configure mailcatcher port map" | |
dokku config:set ${MAILCATCHER_APP} DOKKU_PROXY_PORT_MAP="http:80:1080" | |
echo "Deploying mailcatcher app" | |
dokku tags:deploy ${MAILCATCHER_APP} latest | |
echo "Link app container with mailcatcher container" | |
dokku docker-options:add ${APP} deploy "--link ${MAILCATCHER_APP_DOCKER_NAME}:${MAILCATCHER_HOST}" | |
dokku docker-options:add ${APP} run "--link ${MAILCATCHER_APP_DOCKER_NAME}:${MAILCATCHER_HOST}" | |
echo "Setting SMTP_URL environment variable" | |
dokku config:set ${APP} SMTP_URL=${MAILCATCHER_SMTP_URL} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this!
I think the proxy port map is incorrect though. The mailcatcher dockerfile exposes port 1080.
So the
Configure mailcatcher port map
line should actually be:dokku config:set ${MAILCATCHER_APP} DOKKU_PROXY_PORT_MAP="http:1080:1080"