Skip to content

Instantly share code, notes, and snippets.

@prichey
Last active January 18, 2018 05:49
Show Gist options
  • Save prichey/eb291c86c7bb3e97e75e72177ecf28cf to your computer and use it in GitHub Desktop.
Save prichey/eb291c86c7bb3e97e75e72177ecf28cf to your computer and use it in GitHub Desktop.

Downgrade

root@prichey:~# sudo apt-get install dokku=0.10.5
Reading package lists... Done
Building dependency tree
Reading state information... Done
dokku is already the newest version (0.10.5).

Remove Env Var

root@prichey:~# dokku config:unset appname --no-restart
-----> Unsetting appname
Reinitializing monit daemon

Get Config

root@prichey:~# dokku config appname
=====> appname config vars
DOKKU_APP_RESTORE:    1
DOKKU_NGINX_PORT:     80
DOKKU_NGINX_SSL_PORT: 443
DOKKU_PROXY_PORT_MAP: http:80:5000 https:443:5000

Upgrade

root@prichey:~# sudo apt-get install dokku
Reading package lists... Done
Building dependency tree
Reading state information... Done
[ omitting stuff]
(Reading database ... 665141 files and directories currently installed.)
Preparing to unpack .../dokku_0.11.3_amd64.deb ...
Processing upgrade
-----> Cleaning up...
Unpacking dokku (0.11.3) over (0.10.5) ...
[ install is successful ]

Get Config

root@prichey:~# dokku config appname
=====> appname env vars
MONIT_ENABLED:         true
DOKKU_NGINX_PORT:      80
DOKKU_NGINX_SSL_PORT:  443
DOKKU_PROXY_PORT_MAP:  http:80:5000 https:443:5000
DOKKU_APP_TYPE:        herokuish
--no-restart:          --no-restart
DOKKU_APP_RESTORE:     1
MONIT_ALERT:           myemail

(Interestingly, the monit config, which I installed via sudo apt-get install monit && sudo dokku plugin:install https://github.com/mbreit/dokku-monit.git isn't present for downgraded version but is for upgraded.)

Rebuild With Trace

root@prichey:~# dokku --trace ps:rebuild appname
+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=gliderlabs/herokuish
+ DOKKU_IMAGE=gliderlabs/herokuish
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins
+ export PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ export PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ export PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ export PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ export PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ export DOKKU_API_VERSION=1
+ DOKKU_API_VERSION=1
+ export DOKKU_NOT_IMPLEMENTED_EXIT=10
+ DOKKU_NOT_IMPLEMENTED_EXIT=10
+ export DOKKU_VALID_EXIT=0
+ DOKKU_VALID_EXIT=0
+ export DOKKU_LOGS_DIR=/var/log/dokku
+ DOKKU_LOGS_DIR=/var/log/dokku
+ export DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ export DOKKU_CONTAINER_LABEL=dokku
+ DOKKU_CONTAINER_LABEL=dokku
+ export DOKKU_GLOBAL_RUN_ARGS=--label=dokku
+ DOKKU_GLOBAL_RUN_ARGS=--label=dokku
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ parse_args ps:rebuild appname
+ declare 'desc=top-level cli arg parser'
+ local next_index=1
+ local skip=false
+ args=("$@")
+ local args
+ for arg in '"$@"'
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ next_index=2
+ for arg in '"$@"'
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ next_index=3
+ return 0
+ args=("$@")
+ skip_arg=false
+ [[ ps:rebuild =~ ^--.* ]]
+ has_tty
+ declare 'desc=return 0 if we have a tty'
++ /usr/bin/tty
+ [[ /dev/pts/0 == \n\o\t\ \a\ \t\t\y ]]
+ return 0
++ id -un
+ [[ dokku != \d\o\k\k\u ]]
+ [[ ps:rebuild =~ ^plugin:.* ]]
+ [[ ps:rebuild == \s\s\h\-\k\e\y\s\:\a\d\d ]]
+ [[ -n '' ]]
+ dokku_auth ps:rebuild appname
+ declare 'desc=calls user-auth plugin trigger'
+ export SSH_USER=root
+ SSH_USER=root
+ export SSH_NAME=default
+ SSH_NAME=default
+ plugn trigger user-auth root default ps:rebuild appname
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n '' ]]
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ps:rebuild =~ (ssh-keys:add|ssh-keys:remove) ]]
+ return 0
+ case "$1" in
+ execute_dokku_cmd ps:rebuild appname
+ declare 'desc=executes dokku sub-commands'
+ local PLUGIN_NAME=ps:rebuild
+ local PLUGIN_CMD=ps:rebuild
+ local implemented=0
+ local script
+ argv=("$@")
+ local argv
+ case "$PLUGIN_NAME" in
++ readlink -f /var/lib/dokku/plugins/enabled/ps
+ [[ /var/lib/dokku/core-plugins/available/ps == *core-plugins* ]]
+ [[ ps:rebuild == \p\s\:\r\e\b\u\i\l\d ]]
+ shift 1
+ [[ ! -z '' ]]
+ set -- ps:rebuild appname
+ [[ -x /var/lib/dokku/plugins/enabled/ps:rebuild/subcommands/default ]]
+ [[ -x /var/lib/dokku/plugins/enabled/ps:rebuild/subcommands/ps:rebuild ]]
+ [[ -x /var/lib/dokku/plugins/enabled/ps/subcommands/rebuild ]]
+ [[ -n rebuild ]]
+ /var/lib/dokku/plugins/enabled/ps/subcommands/rebuild ps:rebuild appname
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ source /var/lib/dokku/plugins/available/ps/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++ source /var/lib/dokku/core-plugins/available/common/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
++ source /var/lib/dokku/plugins/available/config/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
+ ps_rebuild_cmd ps:rebuild appname
+ declare 'desc=rebuilds an app from source'
+ local cmd=ps:rebuild
+ [[ -z appname ]]
+ ps_rebuild appname
+ declare 'desc=rebuilds app from base image'
+ local APP=appname
+ verify_app_name appname
+ declare 'desc=verify app name format and app existence'
+ local APP=appname
+ is_valid_app_name appname
+ declare 'desc=verify app name format'
+ local APP=appname
+ [[ ! -n appname ]]
+ [[ ! appname =~ ^[a-z].* ]]
+ return 0
+ [[ ! -d /home/dokku/appname ]]
+ return 0
+ plugn trigger receive-app appname
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n '' ]]
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ source /var/lib/dokku/plugins/available/git/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++ source /var/lib/dokku/core-plugins/available/common/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
++ source /var/lib/dokku/plugins/available/apps/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
+++ source /var/lib/dokku/plugins/available/config/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
++++ source /var/lib/dokku/core-plugins/available/common/functions
+++++ set -eo pipefail
+++++ [[ -n 1 ]]
+++++ set -x
++ source /var/lib/dokku/plugins/available/config/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+++ source /var/lib/dokku/core-plugins/available/common/functions
++++ set -eo pipefail
++++ [[ -n 1 ]]
++++ set -x
+ git_receive_app appname
+ declare 'desc=git receive-app plugin trigger'
+ local trigger=git_receive_app
+ local APP=appname
+ local REV=
+ [[ ! -d /home/dokku/appname/refs ]]
+ acquire_app_deploy_lock appname exclusive
+ declare 'desc=acquire advisory lock for use in git/tar deploys'
+ local APP=appname
+ verify_app_name appname
+ declare 'desc=verify app name format and app existence'
+ local APP=appname
+ is_valid_app_name appname
+ declare 'desc=verify app name format'
+ local APP=appname
+ [[ ! -n appname ]]
+ [[ ! appname =~ ^[a-z].* ]]
+ return 0
+ [[ ! -d /home/dokku/appname ]]
+ return 0
+ local LOCK_TYPE=exclusive
+ local APP_DEPLOY_LOCK_FD=200
+ local APP_DEPLOY_LOCK_FILE=/home/dokku/appname/.deploy.lock
+ local 'LOCK_WAITING_MSG=appname is currently being deployed. Waiting...'
+ local 'LOCK_FAILED_MSG=appname is currently being deployed. Exiting...'
+ local SHOW_MSG=true
+ eval 'exec 200>/home/dokku/appname/.deploy.lock'
++ exec
+ [[ exclusive == \w\a\i\t\i\n\g ]]
+ flock -n 200
+ git_build appname
+ declare 'desc=setup and call git_build_app_repo'
+ local APP=appname
+ local DOKKU_DEPLOY_BRANCH REF
+ [[ 1 -ge 2 ]]
++ git_deploy_branch appname
++ declare 'desc=retrieve the deploy branch for a given application'
++ local cmd=git-hook
++ local APP=appname
+++ config_get appname DOKKU_DEPLOY_BRANCH
+++ declare 'desc=get value of given config var'
+++ config_sub get appname DOKKU_DEPLOY_BRANCH
+++ declare 'desc=executes a config subcommand'
+++ local name=get
+++ shift
+++ /var/lib/dokku/plugins/available/config/subcommands/get config:get appname DOKKU_DEPLOY_BRANCH
+++ true
++ local DOKKU_DEPLOY_BRANCH=
+++ config_get --global DOKKU_DEPLOY_BRANCH
+++ declare 'desc=get value of given config var'
+++ config_sub get --global DOKKU_DEPLOY_BRANCH
+++ declare 'desc=executes a config subcommand'
+++ local name=get
+++ shift
+++ /var/lib/dokku/plugins/available/config/subcommands/get config:get --global DOKKU_DEPLOY_BRANCH
+++ true
++ local DOKKU_GLOBAL_DEPLOY_BRANCH=
++ [[ -n '' ]]
++ [[ -n '' ]]
++ echo master
+ DOKKU_DEPLOY_BRANCH=master
+ REF=2e95669c03d42286a6c00f99cf6706e3a0a77c61
+ git_build_app_repo appname 2e95669c03d42286a6c00f99cf6706e3a0a77c61
+ declare 'desc=builds local git app repo for app'
+ verify_app_name appname
+ declare 'desc=verify app name format and app existence'
+ local APP=appname
+ is_valid_app_name appname
+ declare 'desc=verify app name format'
+ local APP=appname
+ [[ ! -n appname ]]
+ [[ ! appname =~ ^[a-z].* ]]
+ return 0
+ [[ ! -d /home/dokku/appname ]]
+ return 0
+ local APP=appname
+ local REV=2e95669c03d42286a6c00f99cf6706e3a0a77c61
++ mktemp -d /tmp/dokku_git.XXXX
+ local GIT_BUILD_APP_REPO_TMP_WORK_DIR=/tmp/dokku_git.xEmv
+ trap 'rm -rf "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" > /dev/null' RETURN INT TERM EXIT
+ local TMP_TAG=dokku/2e95669c03d42286a6c00f99cf6706e3a0a77c61
+ chmod 755 /tmp/dokku_git.xEmv
+ unset GIT_DIR GIT_WORK_TREE
+ [[ ! -d /home/dokku/appname ]]
+ use_git_worktree
+ declare 'desc=detects whether to use git worktree'
+ local GIT_VERSION MAJOR_VERSION MINOR_VERSION
++ awk '{split($0,a," "); print a[3]}'
++ git --version
+ GIT_VERSION=2.7.4
++ awk '{split($0,a,"."); print a[1]}'
++ echo 2.7.4
+ MAJOR_VERSION=2
++ awk '{split($0,a,"."); print a[2]}'
++ echo 2.7.4
+ MINOR_VERSION=7
+ [[ 2 -ge 3 ]]
+ [[ 2 -eq 2 ]]
+ [[ 7 -ge 11 ]]
+ return 1
+ pushd /tmp/dokku_git.xEmv
+ GIT_DIR=/home/dokku/appname
+ git tag -d dokku/2e95669c03d42286a6c00f99cf6706e3a0a77c61
+ true
+ GIT_DIR=/home/dokku/appname
+ git tag dokku/2e95669c03d42286a6c00f99cf6706e3a0a77c61 2e95669c03d42286a6c00f99cf6706e3a0a77c61
+ git init
+ git config advice.detachedHead false
+ git remote add origin /home/dokku/appname
+ git fetch --depth=1 origin refs/tags/dokku/2e95669c03d42286a6c00f99cf6706e3a0a77c61
+ git reset --hard FETCH_HEAD
+ GIT_DIR=/home/dokku/appname
+ git tag -d dokku/2e95669c03d42286a6c00f99cf6706e3a0a77c61
+ suppress_output git submodule update --init --recursive
+ declare 'desc=suppress all output from a given command unless there is an error'
+ local TMP_COMMAND_OUTPUT
++ mktemp /tmp/suppress_output.XXXX
+ TMP_COMMAND_OUTPUT=/tmp/suppress_output.Bt5n
+ trap 'rm -rf "$TMP_COMMAND_OUTPUT" > /dev/null' RETURN INT TERM EXIT
+ git submodule update --init --recursive
+ return 0
++ rm -rf /tmp/suppress_output.Bt5n
+ find . -name .git -prune -exec rm -rf '{}' ';'
/'sed -u 's/^/
+ plugn trigger post-extract appname /tmp/dokku_git.xEmv 2e95669c03d42286a6c00f99cf6706e3a0a77c61
+ [[ -f Dockerfile ]]
+ plugn trigger pre-receive-app appname herokuish /tmp/dokku_git.xEmv 2e95669c03d42286a6c00f99cf6706e3a0a77c61
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ [[ ! -n '' ]]
/'sed -u 's/^/
+ dokku_receive appname herokuish /tmp/dokku_git.xEmv
+ declare 'desc=receives an app kicks off deploy process'
+ source /var/lib/dokku/plugins/available/config/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++ source /var/lib/dokku/core-plugins/available/common/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+ local APP=appname
++ get_app_image_name appname
++ declare 'desc=return image identifier for a given app, tag tuple. validate if tag is presented'
++ local APP=appname
++ local IMAGE_TAG=
++ IMAGE_REPO=
++ is_valid_app_name appname
++ declare 'desc=verify app name format'
++ local APP=appname
++ [[ ! -n appname ]]
++ [[ ! appname =~ ^[a-z].* ]]
++ return 0
++ [[ -z '' ]]
+++ get_app_image_repo appname
+++ declare 'desc=central definition of image repo pattern'
+++ local APP=appname
+++ local IMAGE_REPO=dokku/appname
+++ is_valid_app_name appname
+++ declare 'desc=verify app name format'
+++ local APP=appname
+++ [[ ! -n appname ]]
+++ [[ ! appname =~ ^[a-z].* ]]
+++ return 0
+++ echo dokku/appname
++ IMAGE_REPO=dokku/appname
++ [[ -n '' ]]
++ local IMAGE=dokku/appname:latest
++ echo dokku/appname:latest
+ local IMAGE=dokku/appname:latest
+ local IMAGE_SOURCE_TYPE=herokuish
+ local TMP_WORK_DIR=/tmp/dokku_git.xEmv
++ config_get appname DOKKU_SKIP_CLEANUP
++ declare 'desc=get value of given config var'
++ config_sub get appname DOKKU_SKIP_CLEANUP
++ declare 'desc=executes a config subcommand'
++ local name=get
++ shift
++ /var/lib/dokku/plugins/available/config/subcommands/get config:get appname DOKKU_SKIP_CLEANUP
++ true
+ local DOKKU_SKIP_CLEANUP=
+ docker_cleanup appname
+ declare 'desc=cleans up all exited/dead containers and removes all dangling images'
+ declare APP=appname FORCE_CLEANUP=
+ local DOKKU_APP_SKIP_CLEANUP
+ [[ '' != \t\r\u\e ]]
+ [[ -z appname ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ dokku_log_info1 'Cleaning up...'
+ declare 'desc=log info1 formatter'
+ echo '-----> Cleaning up...'
-----> Cleaning up...
++ docker ps -a -f status=exited -f label=dokku -q
+ docker rm
+ true
++ docker ps -a -f status=dead -f label=dokku -q
+ docker rm
+ true
+ dokku_log_info1 'Building appname from herokuish...'
+ declare 'desc=log info1 formatter'
+ echo '-----> Building appname from herokuish...'
+ config_set --no-restart appname DOKKU_APP_TYPE=herokuish
-----> Building appname from herokuish...
++ docker images -f dangling=true -q
+ docker rmi 3b940496144f 02055e49c64e 375571d87bc0 4f5eda8249ef 1b492bc3cf2e 61805a222189 f8144a5aeb3c b762b9f9f1db afa54a8edb83 88e05769d18a c99ce30f1901
+ dokku_build appname herokuish /tmp/dokku_git.xEmv
+ declare 'desc=build phase'
+ source /var/lib/dokku/plugins/available/config/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
++ source /var/lib/dokku/core-plugins/available/common/functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
+ local APP=appname
+ local IMAGE_SOURCE_TYPE=herokuish
+ local TMP_WORK_DIR=/tmp/dokku_git.xEmv
++ get_app_image_name appname
++ declare 'desc=return image identifier for a given app, tag tuple. validate if tag is presented'
++ local APP=appname
++ local IMAGE_TAG=
++ IMAGE_REPO=
++ is_valid_app_name appname
++ declare 'desc=verify app name format'
++ local APP=appname
++ [[ ! -n appname ]]
++ [[ ! appname =~ ^[a-z].* ]]
++ return 0
++ [[ -z '' ]]
+++ get_app_image_repo appname
+++ declare 'desc=central definition of image repo pattern'
+++ local APP=appname
+++ local IMAGE_REPO=dokku/appname
+++ is_valid_app_name appname
+++ declare 'desc=verify app name format'
+++ local APP=appname
+++ [[ ! -n appname ]]
+++ [[ ! appname =~ ^[a-z].* ]]
+++ return 0
+++ echo dokku/appname
++ IMAGE_REPO=dokku/appname
++ [[ -n '' ]]
++ local IMAGE=dokku/appname:latest
++ echo dokku/appname:latest
+ local IMAGE=dokku/appname:latest
+ local cid
+ verify_app_name appname
+ declare 'desc=verify app name format and app existence'
+ local APP=appname
+ is_valid_app_name appname
+ declare 'desc=verify app name format'
+ local APP=appname
+ [[ ! -n appname ]]
+ [[ ! appname =~ ^[a-z].* ]]
+ return 0
+ [[ ! -d /home/dokku/appname ]]
+ return 0
+ local DOKKU_APP_CACHE_DIR=/home/dokku/appname/cache
++ config_export app appname
++ declare 'desc=returns export command for config variable of specified type (app/global)'
++ local CONFIG_TYPE=app
++ shift
++ local APP=appname
++ [[ app == \g\l\o\b\a\l ]]
++ shift
++ config_sub export appname
++ declare 'desc=executes a config subcommand'
++ local name=export
++ shift
++ /var/lib/dokku/plugins/available/config/subcommands/export config:export appname
++ return 0
+ eval 'export --no-restart='\''--no-restart'\''
export DOKKU_APP_RESTORE='\''1'\''
export DOKKU_APP_TYPE='\''herokuish'\''
export DOKKU_NGINX_PORT='\''80'\''
export DOKKU_NGINX_SSL_PORT='\''443'\''
export DOKKU_PROXY_PORT_MAP='\''http:80:5000 https:443:5000'\''
export MONIT_ALERT='\''prestonleerichey@gmail.com'\''
export MONIT_ENABLED='\''true'\''
++ export --no-restart=--no-restart
/var/lib/dokku/core-plugins/available/common/functions: line 448: export: --: invalid option
export: usage: export [-fn] [name[=value] ...] or export -p
+ rm -rf ''

Get Config

root@prichey:~# dokku config appname
=====> appname env vars
DOKKU_APP_RESTORE:     1
MONIT_ALERT:           prestonleerichey@gmail.com
DOKKU_NGINX_PORT:      80
DOKKU_NGINX_SSL_PORT:  443
MONIT_ENABLED:         true
DOKKU_APP_TYPE:        herokuish
--no-restart:          --no-restart
DOKKU_PROXY_PORT_MAP:  http:80:5000 https:443:5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment