From 8200348f3c3f17aa75504a883e169b7ac9048414 Mon Sep 17 00:00:00 2001 From: knjcode Date: Fri, 19 Aug 2016 13:36:45 +0900 Subject: [PATCH 001/295] Skip container finish processing when zero downtime is disabled --- plugins/common/functions | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/common/functions b/plugins/common/functions index 3e587d8ec..e3cd605c2 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -549,6 +549,8 @@ dokku_deploy_cmd() { dokku_log_info2 "stopping $APP.$PROC_TYPE ($cid)" # shellcheck disable=SC2086 docker stop $DOCKER_STOP_TIME_ARG "$cid" &> /dev/null + # remove cid from oldids to skip the old container finish processing + oldids="$(remove_val_from_list "$cid" "$oldids" " ")" done fi From 67705afe3c6ca986e1fdbf2d971f45e6ad7f6383 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 4 Sep 2016 19:26:00 -0400 Subject: [PATCH 002/295] Use apps_create method when renaming an application. Closes #2252 Since they are separate resources, triggering the normal app creation flow makes the most sense. We still remove the cache directory because we want the correct cache permissions for the new application. --- plugins/apps/subcommands/rename | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/apps/subcommands/rename b/plugins/apps/subcommands/rename index 7ad59b08d..34da3df31 100755 --- a/plugins/apps/subcommands/rename +++ b/plugins/apps/subcommands/rename @@ -13,11 +13,11 @@ apps_rename_cmd() { local NEW_APP="$3" local OLD_CACHE_DIR="$DOKKU_ROOT/$OLD_APP/cache" - mkdir -p "$DOKKU_ROOT/$NEW_APP" if [[ -d "$OLD_CACHE_DIR" ]] && ! rmdir "$OLD_CACHE_DIR"; then docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$OLD_CACHE_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache fi rm -rf "$OLD_CACHE_DIR" + apps_create "$NEW_APP" cp -a "$DOKKU_ROOT/$OLD_APP/." "$DOKKU_ROOT/$NEW_APP" DOKKU_APPS_FORCE_DELETE=1 apps_destroy "$OLD_APP" [[ -f "$DOKKU_ROOT/$NEW_APP/URLS" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/URLS" From 2fc3a09b413bc47547ebbb74fc66c1f70455f012 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 5 Sep 2016 00:04:06 -0400 Subject: [PATCH 003/295] Move post-deploy trigger to core-post-deploy. Refs #2367 This avoids issues where community plugins may break core commands because of issues in the command output. --- docs/development/plugin-triggers.md | 22 ++++++++++++++++++- .../{post-deploy => core-post-deploy} | 4 ++-- plugins/20_events/core-post-deploy | 1 + plugins/common/functions | 1 + .../{post-deploy => core-post-deploy} | 6 ++--- .../{post-deploy => core-post-deploy} | 8 +++---- plugins/ps/{post-deploy => core-post-deploy} | 8 +++---- 7 files changed, 36 insertions(+), 14 deletions(-) rename plugins/00_dokku-standard/{post-deploy => core-post-deploy} (92%) create mode 120000 plugins/20_events/core-post-deploy rename plugins/named-containers/{post-deploy => core-post-deploy} (92%) rename plugins/nginx-vhosts/{post-deploy => core-post-deploy} (81%) rename plugins/ps/{post-deploy => core-post-deploy} (69%) diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index 7ca54dc06..5223ee2f1 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -134,6 +134,24 @@ help_content esac ``` +### `core-post-deploy` + +> To avoid issues with community plugins, this plugin trigger should be used *only* for core plugins. Please avoid using this trigger in your own plugins. + +- Description: Allows running of commands after an application's processes have been scaled up, but before old containers are torn down. Dokku core currently uses this to switch traffic on nginx. +- Invoked by: `dokku deploy` +- Arguments: `$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS $IMAGE_TAG` +- Example: + +```shell +#!/usr/bin/env bash +# Notify an external service that a successful deploy has occurred. + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +curl "http://httpstat.us/200" +``` + ### `dependencies` - Description: Used to install system-level dependencies. Invoked by `plugin:install-dependencies`. @@ -430,7 +448,9 @@ dokku postgres:destroy $APP ### `post-deploy` -- Description: Allows running of commands after an application's processes have been scaled up, but before old containers are torn down. Dokku core currently uses this to switch traffic on nginx. +> Please see [core-post-deploy](#core-post-deploy) if contributing a core plugin with the `post-deploy` hook. + +- Description: Allows running of commands after an application's processes have been scaled up, but before old containers are torn down. Dokku calls this _after_ `core-post-deploy`. - Invoked by: `dokku deploy` - Arguments: `$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS $IMAGE_TAG` - Example: diff --git a/plugins/00_dokku-standard/post-deploy b/plugins/00_dokku-standard/core-post-deploy similarity index 92% rename from plugins/00_dokku-standard/post-deploy rename to plugins/00_dokku-standard/core-post-deploy index 7c765c3b3..a020a1efe 100755 --- a/plugins/00_dokku-standard/post-deploy +++ b/plugins/00_dokku-standard/core-post-deploy @@ -5,7 +5,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/00_dokku-standard/exec-app-json-scripts" exec_app_json_scripts() { declare desc="core app.json scripts execution" - local trigger="pre-deploy app_json_scripts" + local trigger="core-post-deploy app_json_scripts" local APP="$1"; local IMAGE_TAG="$4"; local PHASE_SCRIPT_KEY="postdeploy" dokku_log_info1 "Attempting to run scripts.dokku.$PHASE_SCRIPT_KEY from app.json (if defined)" @@ -14,7 +14,7 @@ exec_app_json_scripts() { cleanup_container_state() { declare desc="core post-deploy state cleanup" - local trigger="post-deploy cleanup_container_state" + local trigger="core-post-deploy cleanup_container_state" local APP="$1"; local PROCTYPES="$(egrep -v "^#" "$DOKKU_ROOT/$APP/DOKKU_SCALE" | awk -F '=' '{ print $1 }' | xargs)" local CONTAINER_FILES="$(find "$DOKKU_ROOT/$APP" -maxdepth 1 -name "CONTAINER.*" -printf "%f\n" 2>/dev/null | sort -t . -k 3 -n | xargs)" diff --git a/plugins/20_events/core-post-deploy b/plugins/20_events/core-post-deploy new file mode 120000 index 000000000..5178a749f --- /dev/null +++ b/plugins/20_events/core-post-deploy @@ -0,0 +1 @@ +hook \ No newline at end of file diff --git a/plugins/common/functions b/plugins/common/functions index 3e587d8ec..dc5c75b22 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -646,6 +646,7 @@ dokku_deploy_cmd() { done < "$DOKKU_SCALE_FILE" dokku_log_info1 "Running post-deploy" + plugn trigger core-post-deploy "$APP" "$port" "$ipaddr" "$IMAGE_TAG" plugn trigger post-deploy "$APP" "$port" "$ipaddr" "$IMAGE_TAG" # kill the old container diff --git a/plugins/named-containers/post-deploy b/plugins/named-containers/core-post-deploy similarity index 92% rename from plugins/named-containers/post-deploy rename to plugins/named-containers/core-post-deploy index 2489b71ce..2d84b28c3 100755 --- a/plugins/named-containers/post-deploy +++ b/plugins/named-containers/core-post-deploy @@ -2,9 +2,9 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -named_containers_post_deploy() { +named_containers_core_post_deploy() { declare desc="names deployed app container is consistent manner" - local trigger="named_containers_post_deploy" + local trigger="named_containers_core_post_deploy" local APP="$1"; local APP_ROOT="$DOKKU_ROOT/$APP" local container @@ -38,4 +38,4 @@ named_containers_post_deploy() { shopt -u nullglob } -named_containers_post_deploy "$@" +named_containers_core_post_deploy "$@" diff --git a/plugins/nginx-vhosts/post-deploy b/plugins/nginx-vhosts/core-post-deploy similarity index 81% rename from plugins/nginx-vhosts/post-deploy rename to plugins/nginx-vhosts/core-post-deploy index f716b0715..7bb7db877 100755 --- a/plugins/nginx-vhosts/post-deploy +++ b/plugins/nginx-vhosts/core-post-deploy @@ -5,9 +5,9 @@ source "$PLUGIN_AVAILABLE_PATH/domains/functions" source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" -nginx_post_deploy() { - declare desc="nginx-vhosts post-deploy plugin trigger" - local trigger="nginx_post_deploy" +nginx_core_post_deploy() { + declare desc="nginx-vhosts core-post-deploy plugin trigger" + local trigger="nginx_core_post_deploy" local APP="$1" if [[ -f "$DOKKU_ROOT/$APP/IP.web.1" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]]; then if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then @@ -21,5 +21,5 @@ nginx_post_deploy() { } if [[ "$(get_app_proxy_type "$1")" == "nginx" ]]; then - nginx_post_deploy "$@" + nginx_core_post_deploy "$@" fi diff --git a/plugins/ps/post-deploy b/plugins/ps/core-post-deploy similarity index 69% rename from plugins/ps/post-deploy rename to plugins/ps/core-post-deploy index f66170f6f..1fc2e2b6b 100755 --- a/plugins/ps/post-deploy +++ b/plugins/ps/core-post-deploy @@ -4,13 +4,13 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" -ps_post_deploy() { - declare desc="ps post-deploy plugin trigger" - local trigger="ps_post_deploy" +ps_core_post_deploy() { + declare desc="ps core-post-deploy plugin trigger" + local trigger="ps_core_post_deploy" local APP="$1" remove_procfile "$APP" config_set --no-restart "$APP" DOKKU_APP_RESTORE=1 } -ps_post_deploy "$@" +ps_core_post_deploy "$@" From d433614f17c0f5f8cce011cac45b5dc947482e3d Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 5 Sep 2016 00:15:39 -0400 Subject: [PATCH 004/295] Move deployment tasks to post-deploy hook As deployment tasks can fail due to non-dokku related issues, moving them to post-deploy will ensure that dokku does not accidentally orphan applications. Closes #2367 --- docs/advanced-usage/deployment-tasks.md | 3 ++- docs/development/plugin-triggers.md | 2 +- plugins/00_dokku-standard/core-post-deploy | 11 ----------- plugins/00_dokku-standard/post-deploy | 15 +++++++++++++++ 4 files changed, 18 insertions(+), 13 deletions(-) create mode 100755 plugins/00_dokku-standard/post-deploy diff --git a/docs/advanced-usage/deployment-tasks.md b/docs/advanced-usage/deployment-tasks.md index a4e28366f..ce70d4953 100644 --- a/docs/advanced-usage/deployment-tasks.md +++ b/docs/advanced-usage/deployment-tasks.md @@ -15,7 +15,8 @@ Dokku accomplishes this by using an `app.json` file. The format in use is simila However, Dokku currently only supports the nodes `scripts.dokku.predeploy` and `scripts.dokku.postdeploy`. For buildpack apps, simply place an `app.json` file in the root of your repository. For dockerfile apps, place `app.json` in the configured `WORKDIR` directory; otherwise Dokku defaults to the buildpack app behavior of looking in `/app`. ->NOTE: postdeploy changes are *NOT* committed to the app image. + +> NOTE: postdeploy changes are *NOT* committed to the app image. ### Example app.json diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index 5223ee2f1..846c6fecd 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -450,7 +450,7 @@ dokku postgres:destroy $APP > Please see [core-post-deploy](#core-post-deploy) if contributing a core plugin with the `post-deploy` hook. -- Description: Allows running of commands after an application's processes have been scaled up, but before old containers are torn down. Dokku calls this _after_ `core-post-deploy`. +- Description: Allows running of commands after an application's processes have been scaled up, but before old containers are torn down. Dokku calls this _after_ `core-post-deploy`. Deployment Tasks are also invoked by this plugin trigger. - Invoked by: `dokku deploy` - Arguments: `$APP $INTERNAL_PORT $INTERNAL_IP_ADDRESS $IMAGE_TAG` - Example: diff --git a/plugins/00_dokku-standard/core-post-deploy b/plugins/00_dokku-standard/core-post-deploy index a020a1efe..7b21978cb 100755 --- a/plugins/00_dokku-standard/core-post-deploy +++ b/plugins/00_dokku-standard/core-post-deploy @@ -1,16 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/00_dokku-standard/exec-app-json-scripts" - -exec_app_json_scripts() { - declare desc="core app.json scripts execution" - local trigger="core-post-deploy app_json_scripts" - local APP="$1"; local IMAGE_TAG="$4"; local PHASE_SCRIPT_KEY="postdeploy" - - dokku_log_info1 "Attempting to run scripts.dokku.$PHASE_SCRIPT_KEY from app.json (if defined)" - execute_script "$APP" "$IMAGE_TAG" "$PHASE_SCRIPT_KEY" -} cleanup_container_state() { declare desc="core post-deploy state cleanup" @@ -30,5 +20,4 @@ cleanup_container_state() { done } -exec_app_json_scripts "$@" cleanup_container_state "$@" diff --git a/plugins/00_dokku-standard/post-deploy b/plugins/00_dokku-standard/post-deploy new file mode 100755 index 000000000..50603555e --- /dev/null +++ b/plugins/00_dokku-standard/post-deploy @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/00_dokku-standard/exec-app-json-scripts" + +exec_app_json_scripts() { + declare desc="core app.json scripts execution" + local trigger="post-deploy app_json_scripts" + local APP="$1"; local IMAGE_TAG="$4"; local PHASE_SCRIPT_KEY="postdeploy" + + dokku_log_info1 "Attempting to run scripts.dokku.$PHASE_SCRIPT_KEY from app.json (if defined)" + execute_script "$APP" "$IMAGE_TAG" "$PHASE_SCRIPT_KEY" +} + +exec_app_json_scripts "$@" From 0004dd53e172a6851f68601f4eef5ba694e3a044 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Mon, 19 Sep 2016 06:42:24 +0300 Subject: [PATCH 005/295] Initial support for CentOS 7 --- .gitignore | 1 + Makefile | 7 +- Vagrantfile | 2 +- docs/development/release-process.md | 4 +- dokku | 3 + plugins/20_events/install | 4 +- plugins/nginx-vhosts/functions | 4 +- plugins/nginx-vhosts/install | 9 +- rpm.mk | 171 ++++++++++++++++++++++++++++ rpm/dokku.postinst | 71 ++++++++++++ rpm/herokuish.postinst | 16 +++ 11 files changed, 281 insertions(+), 11 deletions(-) create mode 100644 rpm.mk create mode 100644 rpm/dokku.postinst create mode 100644 rpm/herokuish.postinst diff --git a/.gitignore b/.gitignore index 033d317f2..2794757ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.deb +*.rpm .DS_Store .ruby-version .vagrant diff --git a/Makefile b/Makefile index fb4beee80..fb703f02b 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,7 @@ endif include tests.mk include deb.mk +include rpm.mk include arch.mk all: @@ -34,13 +35,17 @@ all: install: dependencies version copyfiles plugin-dependencies plugins -release: deb-all package_cloud packer +release: deb-all rpm-all package_cloud packer package_cloud: package_cloud push dokku/dokku/ubuntu/trusty herokuish*.deb package_cloud push dokku/dokku/ubuntu/trusty sshcommand*.deb package_cloud push dokku/dokku/ubuntu/trusty plugn*.deb package_cloud push dokku/dokku/ubuntu/trusty dokku*.deb + package_cloud push dokku/dokku/el/7 herokuish*.rpm + package_cloud push dokku/dokku/el/7 sshcommand*.rpm + package_cloud push dokku/dokku/el/7 plugn*.rpm + package_cloud push dokku/dokku/el/7 dokku*.rpm packer: packer build contrib/packer.json diff --git a/Vagrantfile b/Vagrantfile index 4f3fc6c60..f21dd62f7 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -82,7 +82,7 @@ Vagrant::configure("2") do |config| vm.vm.hostname = "#{DOKKU_DOMAIN}" vm.vm.network :private_network, ip: DOKKU_IP vm.vm.provision :shell, :inline => "export DEBIAN_FRONTEND=noninteractive && apt-get update > /dev/null && apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}" - vm.vm.provision :shell, :inline => "export IS_RELEASE=true && cd /root/dokku && make deb-all" + vm.vm.provision :shell, :inline => "export IS_RELEASE=true && cd /root/dokku && make deb-all rpm-all" end config.vm.define "build-arch", autostart: false do |vm| diff --git a/docs/development/release-process.md b/docs/development/release-process.md index f69948dd0..131887146 100644 --- a/docs/development/release-process.md +++ b/docs/development/release-process.md @@ -20,7 +20,7 @@ To propose a release, the following tasks need to be performed: - The versioned links should be updated or added to the `docs/assets/versions.json` file. - A list of changes must be made in the `HISTORY.md`. - A tag must be created locally with your release version -- Debian packages *must* be created via `vagrant up build` +- Debian and RPM packages *must* be created via `vagrant up build` - The packages should be uploaded to packagecloud.io - All changes are pushed to master and the tag should be turned into a release which will contain the changelog. - ArchLinux package description *must* be updated via `vagrant up build-arch` (needs to be done after the tag is pushed to GitHub, because it is based on that) @@ -37,7 +37,7 @@ git tag v0.9.9 At the moment, tags need not be signed, though that may change in the future. -## Debian Packages +## Debian and RPM packages The `build` target in the Dokku `Vagrantfile` creates debian packages for Dokku at a point in time. The version will be based upon the latest local tag - you may create your own, internal tags/releases if that is so desired. diff --git a/dokku b/dokku index 15a65e353..1ce6e59a7 100755 --- a/dokku +++ b/dokku @@ -14,6 +14,9 @@ case "$(lsb_release -si)" in Debian) export DOKKU_DISTRO=${DOKKU_DISTRO:="debian"} ;; + CentOS) + export DOKKU_DISTRO=${DOKKU_DISTRO:="centos"} + ;; *) export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"} ;; diff --git a/plugins/20_events/install b/plugins/20_events/install index 99be9dc24..6d070eb8f 100755 --- a/plugins/20_events/install +++ b/plugins/20_events/install @@ -12,7 +12,7 @@ flag_rsyslog_needs_restart=n # exits gracefully if the path already exists mkdir -m 775 -p "$DOKKU_LOGS_DIR" case "$DOKKU_DISTRO" in - arch|debian) + arch|debian|centos) chgrp dokku "$DOKKU_LOGS_DIR" ;; *) @@ -23,7 +23,7 @@ esac if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then touch "$DOKKU_EVENTS_LOGFILE" case "$DOKKU_DISTRO" in - arch|debian) + arch|debian|centos) chgrp dokku "$DOKKU_EVENTS_LOGFILE" ;; *) diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 044c2d0dd..2b6f6bc4b 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -39,9 +39,9 @@ restart_nginx() { sudo /sbin/service nginx reload > /dev/null ;; - arch) + arch|centos) sudo /usr/bin/systemctl reload nginx - ;; + ;; esac } diff --git a/plugins/nginx-vhosts/install b/plugins/nginx-vhosts/install index e08840d2d..8b4d53217 100755 --- a/plugins/nginx-vhosts/install +++ b/plugins/nginx-vhosts/install @@ -17,6 +17,11 @@ case "$DOKKU_DISTRO" in arch) echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl reload nginx, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx ;; + + centos) + echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl reload nginx, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx + echo "Defaults:dokku !requiretty" >> /etc/sudoers.d/dokku-nginx + ;; esac chmod 0440 /etc/sudoers.d/dokku-nginx @@ -66,10 +71,8 @@ case "$DOKKU_DISTRO" in "$NGINX_INIT" nginx start || "$NGINX_INIT" nginx reload ;; - arch) + arch|centos) NGINX_INIT="/usr/bin/systemctl" "$NGINX_INIT" start nginx || "$NGINX_INIT" reload nginx ;; esac - - diff --git a/rpm.mk b/rpm.mk new file mode 100644 index 000000000..4232cf041 --- /dev/null +++ b/rpm.mk @@ -0,0 +1,171 @@ +RPM_ARCHITECTURE = x86_64 +HEROKUISH_RPM_PACKAGE_NAME = herokuish-$(HEROKUISH_VERSION)-1.$(RPM_ARCHITECTURE).rpm +PLUGN_RPM_PACKAGE_NAME = plugn-$(PLUGN_VERSION)-1.$(RPM_ARCHITECTURE).rpm +SSHCOMMAND_RPM_PACKAGE_NAME = sshcommand-$(SSHCOMMAND_VERSION)-1.$(RPM_ARCHITECTURE).rpm +SIGIL_RPM_PACKAGE_NAME = gliderlabs-sigil-$(SIGIL_VERSION)-1.$(RPM_ARCHITECTURE).rpm + +.PHONY: rpm-all + +rpm-all: rpm-setup rpm-herokuish rpm-dokku rpm-plugn rpm-sshcommand rpm-sigil + mv /tmp/*.rpm . + @echo "Done" + +rpm-setup: + @echo "-> Installing rpm build requirements" + @sudo apt-get update -qq > /dev/null + @sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -qq -y gcc git build-essential wget ruby-dev ruby1.9.1 rpm > /dev/null 2>&1 + @command -v fpm > /dev/null || sudo gem install fpm --no-ri --no-rdoc + @ssh -o StrictHostKeyChecking=no git@github.com || true + +rpm-herokuish: + rm -rf /tmp/tmp /tmp/build $(HEROKUISH_RPM_PACKAGE_NAME) + mkdir -p /tmp/tmp /tmp/build + + @echo "-> Cloning repository" + git clone -q "https://github.com/$(HEROKUISH_REPO_NAME).git" \ + --branch "v$(HEROKUISH_VERSION)" /tmp/tmp/herokuish > /dev/null + rm -rf /tmp/tmp/herokuish/.git /tmp/tmp/herokuish/.gitignore + + @echo "-> Copying files into place" + mkdir -p "/tmp/build/var/lib" + cp -rf /tmp/tmp/herokuish /tmp/build/var/lib/herokuish + + @echo "-> Creating $(HEROKUISH_RPM_PACKAGE_NAME)" + sudo fpm -t rpm -s dir -C /tmp/build -n herokuish \ + -v $(HEROKUISH_VERSION) \ + -a $(RPM_ARCHITECTURE) \ + -p $(HEROKUISH_RPM_PACKAGE_NAME) \ + --depends 'docker-engine >= 1.9.1' \ + --depends 'sudo' \ + --after-install rpm/herokuish.postinst \ + --url "https://github.com/$(HEROKUISH_REPO_NAME)" \ + --description $(HEROKUISH_DESCRIPTION) \ + --license 'MIT License' \ + . + mv *.rpm /tmp + +rpm-dokku: + rm -rf /tmp/tmp /tmp/build dokku_*_$(RPM_ARCHITECTURE).rpm + mkdir -p /tmp/tmp /tmp/build + + mkdir -p /tmp/build/usr/bin + mkdir -p /tmp/build/usr/share/doc/dokku + mkdir -p /tmp/build/usr/share/dokku/contrib + mkdir -p /tmp/build/usr/share/lintian/overrides + mkdir -p /tmp/build/usr/share/man/man1 + mkdir -p /tmp/build/var/lib/dokku/core-plugins/available + + cp dokku /tmp/build/usr/bin + cp LICENSE /tmp/build/usr/share/doc/dokku/copyright + find . -name ".DS_Store" -depth -exec rm {} \; + cp -r plugins/* /tmp/build/var/lib/dokku/core-plugins/available + find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do touch /tmp/build/var/lib/dokku/core-plugins/available/$$plugin/.core; done + $(MAKE) help2man + $(MAKE) addman + cp /usr/local/share/man/man1/dokku.1 /tmp/build/usr/share/man/man1/dokku.1 + gzip -9 /tmp/build/usr/share/man/man1/dokku.1 + cp contrib/dokku-installer.py /tmp/build/usr/share/dokku/contrib + git describe --tags > /tmp/build/var/lib/dokku/VERSION + cat /tmp/build/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build/var/lib/dokku/STABLE_VERSION +ifneq (,$(findstring false,$(IS_RELEASE))) + sed -i.bak -e "s/^/`date +%s`:/" /tmp/build/var/lib/dokku/STABLE_VERSION && rm /tmp/build/var/lib/dokku/STABLE_VERSION.bak +endif + git rev-parse HEAD > /tmp/build/var/lib/dokku/GIT_REV + + @echo "-> Creating rpm package" + VERSION=$$(cat /tmp/build/var/lib/dokku/STABLE_VERSION); \ + sudo fpm -t rpm -s dir -C /tmp/build -n dokku \ + -v "$$VERSION" \ + -a $(RPM_ARCHITECTURE) \ + -p "dokku-$$VERSION-1.x86_64.rpm" \ + --depends 'git' \ + --depends 'make' \ + --depends 'curl' \ + --depends 'gcc' \ + --depends 'man-db' \ + --depends 'sshcommand' \ + --depends 'gliderlabs-sigil' \ + --depends 'docker-engine >= 1.9.1' \ + --depends 'bind-utils' \ + --depends 'nginx' \ + --depends 'plugn' \ + --depends 'sudo' \ + --depends 'python' \ + --depends 'nc' \ + --depends 'redhat-lsb-core' \ + --after-install rpm/dokku.postinst \ + --url "https://github.com/$(DOKKU_REPO_NAME)" \ + --description $(DOKKU_DESCRIPTION) \ + --license 'MIT License' \ + . + mv *.rpm /tmp + +rpm-plugn: + rm -rf /tmp/tmp /tmp/build $(PLUGN_RPM_PACKAGE_NAME) + mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/bin + + @echo "-> Downloading package" + wget -q -O /tmp/tmp/plugn-$(PLUGN_VERSION).tgz $(PLUGN_URL) + cd /tmp/tmp/ && tar zxf /tmp/tmp/plugn-$(PLUGN_VERSION).tgz + + @echo "-> Copying files into place" + cp /tmp/tmp/plugn /tmp/build/usr/bin/plugn && chmod +x /tmp/build/usr/bin/plugn + + @echo "-> Creating $(PLUGN_RPM_PACKAGE_NAME)" + sudo fpm -t rpm -s dir -C /tmp/build -n plugn \ + --version $(PLUGN_VERSION) \ + -a $(RPM_ARCHITECTURE) \ + --package $(PLUGN_RPM_PACKAGE_NAME) \ + --url "https://github.com/$(PLUGN_REPO_NAME)" \ + --category utils \ + --description "$$PLUGN_DESCRIPTION" \ + --license 'MIT License' \ + . + mv *.rpm /tmp + +rpm-sshcommand: + rm -rf /tmp/tmp /tmp/build $(SSHCOMMAND_RPM_PACKAGE_NAME) + mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/local/bin + + @echo "-> Downloading package" + wget -q -O /tmp/tmp/sshcommand-$(SSHCOMMAND_VERSION) $(SSHCOMMAND_URL) + + @echo "-> Copying files into place" + mkdir -p "/tmp/build/usr/local/bin" + cp /tmp/tmp/sshcommand-$(SSHCOMMAND_VERSION) /tmp/build/usr/local/bin/sshcommand + chmod +x /tmp/build/usr/local/bin/sshcommand + + @echo "-> Creating $(SSHCOMMAND_RPM_PACKAGE_NAME)" + sudo fpm -t rpm -s dir -C /tmp/build -n sshcommand \ + --version $(SSHCOMMAND_VERSION) \ + -a $(RPM_ARCHITECTURE) \ + --package $(SSHCOMMAND_RPM_PACKAGE_NAME) \ + --url "https://github.com/$(SSHCOMMAND_REPO_NAME)" \ + --category admin \ + --description "$$SSHCOMMAND_DESCRIPTION" \ + --license 'MIT License' \ + . + mv *.rpm /tmp + +rpm-sigil: + rm -rf /tmp/tmp /tmp/build $(SIGIL_PACKAGE_NAME) + mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/bin + + @echo "-> Downloading package" + wget -q -O /tmp/tmp/sigil-$(SIGIL_VERSION).tgz $(SIGIL_URL) + cd /tmp/tmp/ && tar zxf /tmp/tmp/sigil-$(SIGIL_VERSION).tgz + + @echo "-> Copying files into place" + cp /tmp/tmp/sigil /tmp/build/usr/bin/sigil && chmod +x /tmp/build/usr/bin/sigil + + @echo "-> Creating $(SIGIL_RPM_PACKAGE_NAME)" + sudo fpm -t rpm -s dir -C /tmp/build -n gliderlabs-sigil \ + --version $(SIGIL_VERSION) \ + -a $(RPM_ARCHITECTURE) \ + --package $(SIGIL_RPM_PACKAGE_NAME) \ + --url "https://github.com/$(SIGIL_REPO_NAME)" \ + --category utils \ + --description "$$SIGIL_DESCRIPTION" \ + --license 'MIT License' \ + . + mv *.rpm /tmp diff --git a/rpm/dokku.postinst b/rpm/dokku.postinst new file mode 100644 index 000000000..78a0ef331 --- /dev/null +++ b/rpm/dokku.postinst @@ -0,0 +1,71 @@ +#!/bin/bash +set +o posix # rpm uses /bin/sh that forces bash in posix mode +set -eo pipefail; [[ $TRACE ]] && set -x + +readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}" +readonly DOKKU_LIB_ROOT="${DOKKU_LIB_PATH:-/var/lib/dokku}" + +call-sshcommand() { + if [[ -x /usr/local/bin/sshcommand ]]; then + /usr/local/bin/sshcommand "$@" + elif [[ -x /usr/bin/sshcommand ]]; then + /usr/bin/sshcommand "$@" + else + echo "Unable to find sshcommand binary" 1>&2 + exit 1 + fi +} + +echo "Setting up dokku user" +getent passwd dokku >/dev/null || useradd -m -s /bin/bash dokku +mkdir -p $DOKKU_ROOT/.ssh +touch $DOKKU_ROOT/.ssh/authorized_keys +chown -R dokku:dokku $DOKKU_ROOT/.ssh +usermod -aG docker dokku + +echo "Setting up storage directories" +mkdir -p ${DOKKU_LIB_ROOT}/data ${DOKKU_LIB_ROOT}/data/storage +chown dokku:dokku -R ${DOKKU_LIB_ROOT}/data + +echo "Setting up plugin directories" +# should be replaced by `plugn init` +mkdir -p ${DOKKU_LIB_ROOT}/core-plugins/available ${DOKKU_LIB_ROOT}/plugins/available +mkdir -p ${DOKKU_LIB_ROOT}/core-plugins/enabled ${DOKKU_LIB_ROOT}/plugins/enabled +touch ${DOKKU_LIB_ROOT}/core-plugins/config.toml ${DOKKU_LIB_ROOT}/plugins/config.toml + +echo "Migrating old plugins" +find ${DOKKU_LIB_ROOT}/plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do + if [ "$plugin" = "available" ] || [ "$plugin" = "enabled" ]; then + continue + elif [ -f ${DOKKU_LIB_ROOT}/plugins/$plugin/.core ]; then + rm -rf ${DOKKU_LIB_ROOT}/plugins/$plugin + elif [ ! -d ${DOKKU_LIB_ROOT}/plugins/available/$plugin ]; then + mv ${DOKKU_LIB_ROOT}/plugins/$plugin ${DOKKU_LIB_ROOT}/plugins/available; + fi +done + +echo "Enabling all core plugins" +find ${DOKKU_LIB_ROOT}/core-plugins/available -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do + if [ ! -d ${DOKKU_LIB_ROOT}/plugins/available/$plugin ]; then + ln -s ${DOKKU_LIB_ROOT}/core-plugins/available/$plugin ${DOKKU_LIB_ROOT}/plugins/available/$plugin; + PLUGIN_PATH=${DOKKU_LIB_ROOT}/core-plugins plugn enable $plugin + PLUGIN_PATH=${DOKKU_LIB_ROOT}/plugins plugn enable $plugin + fi +done +find -L ${DOKKU_LIB_ROOT} -type l -delete +chown dokku:dokku -R ${DOKKU_LIB_ROOT}/plugins ${DOKKU_LIB_ROOT}/core-plugins + +echo "Ensure proper sshcommand path" +echo '/usr/bin/dokku' > "${DOKKU_ROOT}/.sshcommand" +if [[ -f .ssh/authorized_keys ]]; then + sed -i.bak 's#/usr/local/bin/dokku#/usr/bin/dokku#' "${DOKKU_ROOT}/.ssh/authorized_keys" + rm "${DOKKU_ROOT}/.ssh/authorized_keys" +fi + +echo "Install all core plugins" +dokku plugin:install --core + +rm -f ${DOKKU_ROOT}/VERSION +cp ${DOKKU_LIB_ROOT}/STABLE_VERSION ${DOKKU_ROOT}/VERSION + +exit 0 diff --git a/rpm/herokuish.postinst b/rpm/herokuish.postinst new file mode 100644 index 000000000..ca21c098b --- /dev/null +++ b/rpm/herokuish.postinst @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set +o posix # rpm uses /bin/sh that forces bash in posix mode + +echo 'Starting docker' +systemctl start docker + +sleep 5 + +count=`sudo docker images | grep gliderlabs/herokuish | wc -l` +if [ "$count" -ne 0 ]; then + echo 'Removing old herokuish image' + sudo docker rmi gliderlabs/herokuish +fi + +echo 'Importing herokuish into docker (around 5 minutes)' +sudo docker build -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null From 4e1a93224e670783d3c4a09268419bad6e4e1ab1 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Mon, 19 Sep 2016 06:55:04 +0300 Subject: [PATCH 006/295] No need to migrate old plugins on centos --- rpm/dokku.postinst | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/rpm/dokku.postinst b/rpm/dokku.postinst index 78a0ef331..3ae122595 100644 --- a/rpm/dokku.postinst +++ b/rpm/dokku.postinst @@ -33,17 +33,6 @@ mkdir -p ${DOKKU_LIB_ROOT}/core-plugins/available ${DOKKU_LIB_ROOT}/plugins/avai mkdir -p ${DOKKU_LIB_ROOT}/core-plugins/enabled ${DOKKU_LIB_ROOT}/plugins/enabled touch ${DOKKU_LIB_ROOT}/core-plugins/config.toml ${DOKKU_LIB_ROOT}/plugins/config.toml -echo "Migrating old plugins" -find ${DOKKU_LIB_ROOT}/plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do - if [ "$plugin" = "available" ] || [ "$plugin" = "enabled" ]; then - continue - elif [ -f ${DOKKU_LIB_ROOT}/plugins/$plugin/.core ]; then - rm -rf ${DOKKU_LIB_ROOT}/plugins/$plugin - elif [ ! -d ${DOKKU_LIB_ROOT}/plugins/available/$plugin ]; then - mv ${DOKKU_LIB_ROOT}/plugins/$plugin ${DOKKU_LIB_ROOT}/plugins/available; - fi -done - echo "Enabling all core plugins" find ${DOKKU_LIB_ROOT}/core-plugins/available -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do if [ ! -d ${DOKKU_LIB_ROOT}/plugins/available/$plugin ]; then From 58f28c1aea853ae8af4d441d309c20b95b6905f1 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Mon, 19 Sep 2016 07:05:50 +0300 Subject: [PATCH 007/295] Fix make lint --- tests.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.mk b/tests.mk index 8549d8259..343cc8804 100644 --- a/tests.mk +++ b/tests.mk @@ -71,7 +71,7 @@ lint: # these are disabled due to their expansive existence in the codebase. we should clean it up though # SC2034: VAR appears unused - https://github.com/koalaman/shellcheck/wiki/SC2034 @echo linting... - @$(QUIET) find . -not -path '*/\.*' -not -path './debian/*' -type f | xargs file | grep text | awk -F ':' '{ print $$1 }' | xargs head -n1 | egrep -B1 "bash" | grep "==>" | awk '{ print $$2 }' | xargs shellcheck -e SC2034 + @$(QUIET) find . -not -path '*/\.*' -not -path './debian/*' -not -path './rpm/*' -type f | xargs file | grep text | awk -F ':' '{ print $$1 }' | xargs head -n1 | egrep -B1 "bash" | grep "==>" | awk '{ print $$2 }' | xargs shellcheck -e SC2034 unit-tests: @echo running unit tests... From dc879e2c4a0dac5478a1d98058f515aff39ec3b6 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Fri, 23 Sep 2016 13:33:37 +0300 Subject: [PATCH 008/295] Improve posinstall scripts with spellcheck --- rpm/dokku.postinst | 99 ++++++++++++++++++++++-------------------- rpm/herokuish.postinst | 24 +++++----- tests.mk | 2 +- 3 files changed, 66 insertions(+), 59 deletions(-) diff --git a/rpm/dokku.postinst b/rpm/dokku.postinst index 3ae122595..8638a9065 100644 --- a/rpm/dokku.postinst +++ b/rpm/dokku.postinst @@ -1,60 +1,63 @@ -#!/bin/bash +#!/usr/bin/env bash set +o posix # rpm uses /bin/sh that forces bash in posix mode set -eo pipefail; [[ $TRACE ]] && set -x -readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}" -readonly DOKKU_LIB_ROOT="${DOKKU_LIB_PATH:-/var/lib/dokku}" - -call-sshcommand() { - if [[ -x /usr/local/bin/sshcommand ]]; then - /usr/local/bin/sshcommand "$@" - elif [[ -x /usr/bin/sshcommand ]]; then - /usr/bin/sshcommand "$@" - else - echo "Unable to find sshcommand binary" 1>&2 - exit 1 - fi +setup-user() { + echo "Setting up dokku user" + getent passwd dokku >/dev/null || useradd -m -s /bin/bash dokku + mkdir -p "$DOKKU_ROOT/.ssh" + touch "$DOKKU_ROOT/.ssh/authorized_keys" + chown -R dokku:dokku "$DOKKU_ROOT/.ssh" + usermod -aG docker dokku } -echo "Setting up dokku user" -getent passwd dokku >/dev/null || useradd -m -s /bin/bash dokku -mkdir -p $DOKKU_ROOT/.ssh -touch $DOKKU_ROOT/.ssh/authorized_keys -chown -R dokku:dokku $DOKKU_ROOT/.ssh -usermod -aG docker dokku +setup-storage() { + echo "Setting up storage directories" + mkdir -p "${DOKKU_LIB_ROOT}/data" "${DOKKU_LIB_ROOT}/data/storage" + chown dokku:dokku -R "${DOKKU_LIB_ROOT}/data" +} -echo "Setting up storage directories" -mkdir -p ${DOKKU_LIB_ROOT}/data ${DOKKU_LIB_ROOT}/data/storage -chown dokku:dokku -R ${DOKKU_LIB_ROOT}/data +setup-plugins() { + echo "Setting up plugin directories" + # should be replaced by `plugn init` + mkdir -p "${DOKKU_LIB_ROOT}/core-plugins/available" "${DOKKU_LIB_ROOT}/plugins/available" + mkdir -p "${DOKKU_LIB_ROOT}/core-plugins/enabled" "${DOKKU_LIB_ROOT}/plugins/enabled" + touch "${DOKKU_LIB_ROOT}/core-plugins/config.toml" "${DOKKU_LIB_ROOT}/plugins/config.toml" -echo "Setting up plugin directories" -# should be replaced by `plugn init` -mkdir -p ${DOKKU_LIB_ROOT}/core-plugins/available ${DOKKU_LIB_ROOT}/plugins/available -mkdir -p ${DOKKU_LIB_ROOT}/core-plugins/enabled ${DOKKU_LIB_ROOT}/plugins/enabled -touch ${DOKKU_LIB_ROOT}/core-plugins/config.toml ${DOKKU_LIB_ROOT}/plugins/config.toml + echo "Enabling all core plugins" + find "${DOKKU_LIB_ROOT}/core-plugins/available" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do + if [ ! -d "${DOKKU_LIB_ROOT}/plugins/available/$plugin" ]; then + ln -s "${DOKKU_LIB_ROOT}/core-plugins/available/$plugin" "${DOKKU_LIB_ROOT}/plugins/available/$plugin" + PLUGIN_PATH="${DOKKU_LIB_ROOT}/core-plugins" plugn enable "$plugin" + PLUGIN_PATH="${DOKKU_LIB_ROOT}/plugins" plugn enable "$plugin" + fi + done + find -L "${DOKKU_LIB_ROOT}" -type l -delete + chown dokku:dokku -R "${DOKKU_LIB_ROOT}/plugins" "${DOKKU_LIB_ROOT}/core-plugins" -echo "Enabling all core plugins" -find ${DOKKU_LIB_ROOT}/core-plugins/available -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do - if [ ! -d ${DOKKU_LIB_ROOT}/plugins/available/$plugin ]; then - ln -s ${DOKKU_LIB_ROOT}/core-plugins/available/$plugin ${DOKKU_LIB_ROOT}/plugins/available/$plugin; - PLUGIN_PATH=${DOKKU_LIB_ROOT}/core-plugins plugn enable $plugin - PLUGIN_PATH=${DOKKU_LIB_ROOT}/plugins plugn enable $plugin - fi -done -find -L ${DOKKU_LIB_ROOT} -type l -delete -chown dokku:dokku -R ${DOKKU_LIB_ROOT}/plugins ${DOKKU_LIB_ROOT}/core-plugins + echo "Install all core plugins" + dokku plugin:install --core +} -echo "Ensure proper sshcommand path" -echo '/usr/bin/dokku' > "${DOKKU_ROOT}/.sshcommand" -if [[ -f .ssh/authorized_keys ]]; then - sed -i.bak 's#/usr/local/bin/dokku#/usr/bin/dokku#' "${DOKKU_ROOT}/.ssh/authorized_keys" - rm "${DOKKU_ROOT}/.ssh/authorized_keys" -fi +setup-sshcommand() { + echo "Ensure proper sshcommand path" + echo '/usr/bin/dokku' > "${DOKKU_ROOT}/.sshcommand" +} -echo "Install all core plugins" -dokku plugin:install --core +setup-version() { + rm -f "${DOKKU_ROOT}/VERSION" + cp "${DOKKU_LIB_ROOT}/STABLE_VERSION" "${DOKKU_ROOT}/VERSION" +} -rm -f ${DOKKU_ROOT}/VERSION -cp ${DOKKU_LIB_ROOT}/STABLE_VERSION ${DOKKU_ROOT}/VERSION +main() { + readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}" + readonly DOKKU_LIB_ROOT="${DOKKU_LIB_PATH:-/var/lib/dokku}" -exit 0 + setup-user + setup-storage + setup-plugins + setup-sshcommand + setup-version +} + +main diff --git a/rpm/herokuish.postinst b/rpm/herokuish.postinst index ca21c098b..e9c5db778 100644 --- a/rpm/herokuish.postinst +++ b/rpm/herokuish.postinst @@ -1,16 +1,20 @@ #!/usr/bin/env bash set +o posix # rpm uses /bin/sh that forces bash in posix mode -echo 'Starting docker' -systemctl start docker +main() { + echo 'Starting docker' + systemctl start docker -sleep 5 + sleep 5 -count=`sudo docker images | grep gliderlabs/herokuish | wc -l` -if [ "$count" -ne 0 ]; then - echo 'Removing old herokuish image' - sudo docker rmi gliderlabs/herokuish -fi + count=$(sudo docker images | grep -c gliderlabs/herokuish) + if [ "$count" -ne 0 ]; then + echo 'Removing old herokuish image' + sudo docker rmi gliderlabs/herokuish + fi -echo 'Importing herokuish into docker (around 5 minutes)' -sudo docker build -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null + echo 'Importing herokuish into docker (around 5 minutes)' + sudo docker build -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null +} + +main diff --git a/tests.mk b/tests.mk index 343cc8804..8549d8259 100644 --- a/tests.mk +++ b/tests.mk @@ -71,7 +71,7 @@ lint: # these are disabled due to their expansive existence in the codebase. we should clean it up though # SC2034: VAR appears unused - https://github.com/koalaman/shellcheck/wiki/SC2034 @echo linting... - @$(QUIET) find . -not -path '*/\.*' -not -path './debian/*' -not -path './rpm/*' -type f | xargs file | grep text | awk -F ':' '{ print $$1 }' | xargs head -n1 | egrep -B1 "bash" | grep "==>" | awk '{ print $$2 }' | xargs shellcheck -e SC2034 + @$(QUIET) find . -not -path '*/\.*' -not -path './debian/*' -type f | xargs file | grep text | awk -F ':' '{ print $$1 }' | xargs head -n1 | egrep -B1 "bash" | grep "==>" | awk '{ print $$2 }' | xargs shellcheck -e SC2034 unit-tests: @echo running unit tests... From 537906c504d7472699751cbc52a9507d6809c3e5 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Fri, 23 Sep 2016 16:56:22 +0300 Subject: [PATCH 009/295] Support CentOS in bootstrap.sh --- Vagrantfile | 9 +++++++ bootstrap.sh | 71 +++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 71 insertions(+), 9 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index f21dd62f7..53f578c8d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -76,6 +76,15 @@ Vagrant::configure("2") do |config| vm.vm.provision :shell, :inline => "cd /root/dokku && make install-from-deb" end + config.vm.define "dokku-rpm", autostart: false do |vm| + vm.vm.box = "centos/7" + vm.vm.synced_folder File.dirname(__FILE__), "/root/dokku" + vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT + vm.vm.hostname = "#{DOKKU_DOMAIN}" + vm.vm.network :private_network, ip: DOKKU_IP + vm.vm.provision :shell, :inline => "cd /root/dokku && bash bootstrap.sh" + end + config.vm.define "build", autostart: false do |vm| vm.vm.synced_folder File.dirname(__FILE__), "/root/dokku" vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT diff --git a/bootstrap.sh b/bootstrap.sh index b5aacb6ff..b787f47d0 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -14,10 +14,6 @@ set -eo pipefail; [[ $TRACE ]] && set -x ensure-environment() { local FREE_MEMORY echo "Preparing to install $DOKKU_TAG from $DOKKU_REPO..." - if ! command -v apt-get &>/dev/null; then - echo "This installation script requires apt-get. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/" - exit 1 - fi hostname -f > /dev/null 2>&1 || { echo "This installation script requires that you have a hostname set for the instance. Please set a hostname for 127.0.0.1 in your /etc/hosts" @@ -33,10 +29,15 @@ ensure-environment() { install-requirements() { echo "--> Ensuring we have the proper dependencies" - apt-get update -qq > /dev/null - if [[ $(lsb_release -sr) == "12.04" ]]; then - apt-get -qq -y install python-software-properties - fi + + case "$DOKKU_DISTRO" in + debian|ubuntu) + apt-get update -qq > /dev/null + if [[ "$DOKKU_DISTRO_VERSION" == "12.04" ]]; then + apt-get -qq -y install python-software-properties + fi + ;; + esac } install-dokku() { @@ -68,9 +69,14 @@ install-dokku() { fi } - install-dokku-from-source() { local DOKKU_CHECKOUT="$1" + + if ! command -v apt-get &>/dev/null; then + echo "This installation script requires apt-get. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/" + exit 1 + fi + apt-get -qq -y install git make software-properties-common cd /root if [[ ! -d /root/dokku ]]; then @@ -84,6 +90,21 @@ install-dokku-from-source() { } install-dokku-from-package() { + case "$DOKKU_DISTRO" in + debian|ubuntu) + install-dokku-from-deb-package "$@" + ;; + centos) + install-dokku-from-rpm-package "$@" + ;; + *) + echo "Unsupported Linux distribution. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/" + exit 1 + ;; + esac +} + +install-dokku-from-deb-package() { local DOKKU_CHECKOUT="$1" local NO_INSTALL_RECOMMENDS=${DOKKU_NO_INSTALL_RECOMMENDS:=""} @@ -124,7 +145,39 @@ install-dokku-from-package() { fi } +install-dokku-from-rpm-package() { + local DOKKU_CHECKOUT="$1" + + if [[ "$DOKKU_DISTRO_VERSION" != "7" ]]; then + echo "Only CentOS version 7 is supported." + exit 1 + fi + + echo "--> Installing docker" + curl -fsSL https://get.docker.com/ | sh + + echo "--> Installing epel for nginx packages to be available" + yum install -y epel-release + + echo "--> Installing herokuish and dokku" + curl -s https://packagecloud.io/install/repositories/dokku/dokku/script.rpm.sh | bash + if [[ -n $DOKKU_CHECKOUT ]]; then + yum -y install herokuish "dokku-$DOKKU_CHECKOUT" + else + yum -y install herokuish dokku + fi + + echo "--> Starting nginx" + systemctl start nginx +} + main() { + export DOKKU_DISTRO DOKKU_DISTRO_VERSION + # shellcheck disable=SC1091 + DOKKU_DISTRO=$(. /etc/os-release && echo "$ID") + # shellcheck disable=SC1091 + DOKKU_DISTRO_VERSION=$(. /etc/os-release && echo "$VERSION_ID") + export DEBIAN_FRONTEND=noninteractive export DOKKU_REPO=${DOKKU_REPO:-"https://github.com/dokku/dokku.git"} From 7bf22df7c3ce5a374bea038c50d27e2ab39f53f0 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Fri, 23 Sep 2016 17:01:42 +0300 Subject: [PATCH 010/295] Use /etc/os-release that is more standartized --- dokku | 17 +++-------------- rpm.mk | 1 - 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/dokku b/dokku index 1ce6e59a7..b26f6c799 100755 --- a/dokku +++ b/dokku @@ -7,20 +7,9 @@ export DOKKU_ROOT=${DOKKU_ROOT:=~dokku} [[ -d $DOKKU_ROOT/.dokkurc ]] && for f in $DOKKU_ROOT/.dokkurc/*; do source "$f"; done [[ $DOKKU_TRACE ]] && set -x -case "$(lsb_release -si)" in - Arch) - export DOKKU_DISTRO=${DOKKU_DISTRO:="arch"} - ;; - Debian) - export DOKKU_DISTRO=${DOKKU_DISTRO:="debian"} - ;; - CentOS) - export DOKKU_DISTRO=${DOKKU_DISTRO:="centos"} - ;; - *) - export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"} - ;; -esac +export DOKKU_DISTRO +# shellcheck disable=SC1091 +DOKKU_DISTRO=$(. /etc/os-release && echo "$ID") export DOKKU_IMAGE=${DOKKU_IMAGE:="gliderlabs/herokuish"} export DOKKU_LIB_ROOT=${DOKKU_LIB_PATH:="/var/lib/dokku"} diff --git a/rpm.mk b/rpm.mk index 4232cf041..083189b29 100644 --- a/rpm.mk +++ b/rpm.mk @@ -92,7 +92,6 @@ endif --depends 'sudo' \ --depends 'python' \ --depends 'nc' \ - --depends 'redhat-lsb-core' \ --after-install rpm/dokku.postinst \ --url "https://github.com/$(DOKKU_REPO_NAME)" \ --description $(DOKKU_DESCRIPTION) \ From 288d72327d3d0ce08d476e0c5d3fdb380ea90754 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Fri, 23 Sep 2016 18:37:07 +0300 Subject: [PATCH 011/295] Add package_cloud instructions to release-process.md --- docs/development/release-process.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/development/release-process.md b/docs/development/release-process.md index 131887146..940e047bd 100644 --- a/docs/development/release-process.md +++ b/docs/development/release-process.md @@ -51,6 +51,7 @@ git tag v0.9.9 vagrant up build export PACKAGECLOUD_TOKEN=SOME_TOKEN package_cloud push dokku/dokku/ubuntu/trusty dokku_0.9.9_amd64.deb +package_cloud push dokku/dokku/el/7 dokku-0.9.9-1.x86_64.rpm ``` If new versions of other packages were created, these should also be pushed at this time. From 542f4dd430a03d33781b312b80548ef139db77b1 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Fri, 23 Sep 2016 22:44:58 +0300 Subject: [PATCH 012/295] Add RPM installation docs --- CONTRIBUTING.md | 2 +- docs/development/release-process.md | 2 +- docs/getting-started/install/rpm.md | 16 ++++++++++++++++ docs/getting-started/installation.md | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 docs/getting-started/install/rpm.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1599d2c3d..4e8a25fde 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,7 +55,7 @@ doesn't already include that problem or suggestion before submitting an issue. If you find a match, add a quick "+1" or "I have this problem too." Doing this helps prioritize the most common problems and requests. -When reporting issues, please include your host OS (Ubuntu 14.04, Fedora 19, +When reporting issues, please include your host OS (Ubuntu 14.04, CentOS 7, etc). Please include: * The output of `uname -a`. diff --git a/docs/development/release-process.md b/docs/development/release-process.md index 940e047bd..c8efc1347 100644 --- a/docs/development/release-process.md +++ b/docs/development/release-process.md @@ -39,7 +39,7 @@ At the moment, tags need not be signed, though that may change in the future. ## Debian and RPM packages -The `build` target in the Dokku `Vagrantfile` creates debian packages for Dokku at a point in time. The version will be based upon the latest local tag - you may create your own, internal tags/releases if that is so desired. +The `build` target in the Dokku `Vagrantfile` creates debian and rpm packages for Dokku at a point in time. The version will be based upon the latest local tag - you may create your own, internal tags/releases if that is so desired. Debian package information is held in the `debian` directory of the Dokku project. diff --git a/docs/getting-started/install/rpm.md b/docs/getting-started/install/rpm.md new file mode 100644 index 000000000..9da831394 --- /dev/null +++ b/docs/getting-started/install/rpm.md @@ -0,0 +1,16 @@ +# RPM Package Installation Notes + +Dokku defaults to being installed via RPM package. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of Dokku without the use of our `bootstrap.sh` bash script. The following are the steps run by said script: + +```shell +# install docker +curl -fsSL https://get.docker.com/ | sh + +# install epel for nginx packages to be available +sudo yum install -y epel-release + +# install dokku +curl -s https://packagecloud.io/install/repositories/dokku/dokku/script.rpm.sh | sudo bash +sudo yum install -y herokuish dokku +sudo dokku plugin:install-dependencies --core +``` diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index c4dfd0a90..20d896aa9 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -48,6 +48,7 @@ For various reasons, certain hosting providers may have other steps that should As well, you may wish to customize your installation in some other fashion. or experiment with vagrant. The guides below should get you started: - [Debian Package Installation Notes](/dokku/getting-started/install/debian/) +- [RPM Package Installation Notes](/dokku/getting-started/install/rpm/) - [Vagrant Installation Notes](/dokku/getting-started/install/vagrant/) - [Advanced Install Customization](/dokku/getting-started/advanced-installation/) From f6488147bd7716aecb0920bcd2cfda3fa45cdd11 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Fri, 23 Sep 2016 22:47:57 +0300 Subject: [PATCH 013/295] Mention CentOS 7 in rpm docs --- docs/getting-started/install/rpm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started/install/rpm.md b/docs/getting-started/install/rpm.md index 9da831394..74675e676 100644 --- a/docs/getting-started/install/rpm.md +++ b/docs/getting-started/install/rpm.md @@ -1,6 +1,6 @@ # RPM Package Installation Notes -Dokku defaults to being installed via RPM package. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of Dokku without the use of our `bootstrap.sh` bash script. The following are the steps run by said script: +Dokku defaults to being installed via RPM package on CentOS 7. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of Dokku without the use of our `bootstrap.sh` bash script. The following are the steps run by said script: ```shell # install docker From b771f0f80921a44cafff7e852d791694283c34bf Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Fri, 23 Sep 2016 23:20:26 +0300 Subject: [PATCH 014/295] Note the version when rpm will be added --- docs/getting-started/install/rpm.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/getting-started/install/rpm.md b/docs/getting-started/install/rpm.md index 74675e676..1b71370d8 100644 --- a/docs/getting-started/install/rpm.md +++ b/docs/getting-started/install/rpm.md @@ -1,5 +1,7 @@ # RPM Package Installation Notes +> New as of 0.8.0 + Dokku defaults to being installed via RPM package on CentOS 7. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of Dokku without the use of our `bootstrap.sh` bash script. The following are the steps run by said script: ```shell From 35f1161453c73ab8b1ddcd5352c0fb13fc67b151 Mon Sep 17 00:00:00 2001 From: Mriyam Tamuli Date: Sat, 8 Oct 2016 14:53:53 +0530 Subject: [PATCH 015/295] Solves SSH Key problem when admin user already exists --- contrib/dokku-installer.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/contrib/dokku-installer.py b/contrib/dokku-installer.py index b57cf3b63..ab01a01a6 100755 --- a/contrib/dokku-installer.py +++ b/contrib/dokku-installer.py @@ -3,6 +3,7 @@ import cgi import json import os +import re import SimpleHTTPServer import SocketServer import subprocess @@ -100,7 +101,10 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): with open('{0}/HOSTNAME'.format(dokku_root), 'w') as f: f.write(params['hostname'].value) - command = ['sshcommand', 'acl-add', 'dokku', 'admin'] + user = 'admin' + if self.admin_user_exists(): + user = 'web-admin' + command = ['sshcommand', 'acl-add', 'dokku', user] for key in params['keys'].value.split("\n"): proc = subprocess.Popen(command, stdin=subprocess.PIPE) proc.stdin.write(key) @@ -119,6 +123,16 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): self.end_headers() self.wfile.write(json.dumps({'status': 'ok'})) + def admin_user_exists(self): + command = 'dokku ssh-keys:list' + pattern = re.compile(r'NAME="admin"') + proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + for line in proc.stdout: + if pattern.search(line): + return True + else: + return False + def set_debconf_selection(debconf_type, key, value): found = False From d6443d7560549765e6a77872c6bb3a828d67898b Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 8 Oct 2016 19:15:39 +0200 Subject: [PATCH 016/295] Return exit 1 in config:get if no ENV file exists --- plugins/config/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/config/functions b/plugins/config/functions index c97ff7c57..908f6a7af 100755 --- a/plugins/config/functions +++ b/plugins/config/functions @@ -150,7 +150,7 @@ config_get() { config_create "$ENV_FILE" if [[ ! -s $ENV_FILE ]]; then - return 0 + return 1 fi local KEY="${*: -1}" From 056ff73c2823469197d5c92a7e692c67c2258b49 Mon Sep 17 00:00:00 2001 From: Mriyam Tamuli Date: Thu, 13 Oct 2016 05:18:45 +0530 Subject: [PATCH 017/295] Proper usernames --- contrib/dokku-installer.py | 48 +++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/contrib/dokku-installer.py b/contrib/dokku-installer.py index ab01a01a6..9634951dc 100755 --- a/contrib/dokku-installer.py +++ b/contrib/dokku-installer.py @@ -101,11 +101,20 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): with open('{0}/HOSTNAME'.format(dokku_root), 'w') as f: f.write(params['hostname'].value) - user = 'admin' - if self.admin_user_exists(): - user = 'web-admin' - command = ['sshcommand', 'acl-add', 'dokku', user] - for key in params['keys'].value.split("\n"): + for (index, key) in enumerate(params['keys'].value.splitlines(), 1): + user = 'admin' + if self.admin_user_exists() is not None: + user = 'web-admin' + if self.web_admin_user_exists() is not None: + index = int(self.web_admin_user_exists()) + 1 + elif self.web_admin_user_exists() is None: + index = 1 + elif self.admin_user_exists() is None: + pass + else: + index = int(self.admin_user_exists()) + 1 + user = user + str(index) + command = ['sshcommand', 'acl-add', 'dokku', user] proc = subprocess.Popen(command, stdin=subprocess.PIPE) proc.stdin.write(key) proc.stdin.close() @@ -123,15 +132,28 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): self.end_headers() self.wfile.write(json.dumps({'status': 'ok'})) + def web_admin_user_exists(self): + return self.user_exists('web-admin(\d)') + def admin_user_exists(self): - command = 'dokku ssh-keys:list' - pattern = re.compile(r'NAME="admin"') - proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) - for line in proc.stdout: - if pattern.search(line): - return True - else: - return False + return self.user_exists('admin(\d)') + + def user_exists(self, name): + command = 'dokku ssh-keys:list' + pattern = re.compile(r'NAME="' + name + '"') + proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + max_num = 0 + exists = False + for line in proc.stdout: + m = pattern.search(line) + if m: + # User of the form `user` or `user#` exists + exists = True + max_num = max(max_num, m.group(1)) + if exists: + return max_num + else: + return None def set_debconf_selection(debconf_type, key, value): From 48b3dffecb8e4c194d23eab45aeefdd2f0187df3 Mon Sep 17 00:00:00 2001 From: Mriyam Tamuli Date: Thu, 13 Oct 2016 15:55:59 +0530 Subject: [PATCH 018/295] Proper usernames --- contrib/dokku-installer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/dokku-installer.py b/contrib/dokku-installer.py index 9634951dc..0e103d010 100755 --- a/contrib/dokku-installer.py +++ b/contrib/dokku-installer.py @@ -133,10 +133,10 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): self.wfile.write(json.dumps({'status': 'ok'})) def web_admin_user_exists(self): - return self.user_exists('web-admin(\d)') + return self.user_exists('web-admin(\d+)') def admin_user_exists(self): - return self.user_exists('admin(\d)') + return self.user_exists('admin(\d+)') def user_exists(self, name): command = 'dokku ssh-keys:list' From 10bb4900c031cfbece8f9f71ce7e8307a0874a68 Mon Sep 17 00:00:00 2001 From: Mriyam Tamuli Date: Thu, 13 Oct 2016 19:13:29 +0530 Subject: [PATCH 019/295] Correct indentation --- contrib/dokku-installer.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/contrib/dokku-installer.py b/contrib/dokku-installer.py index 0e103d010..9c897fc70 100755 --- a/contrib/dokku-installer.py +++ b/contrib/dokku-installer.py @@ -133,27 +133,27 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): self.wfile.write(json.dumps({'status': 'ok'})) def web_admin_user_exists(self): - return self.user_exists('web-admin(\d+)') + return self.user_exists('web-admin(\d+)') def admin_user_exists(self): - return self.user_exists('admin(\d+)') + return self.user_exists('admin(\d+)') def user_exists(self, name): - command = 'dokku ssh-keys:list' - pattern = re.compile(r'NAME="' + name + '"') - proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) - max_num = 0 - exists = False - for line in proc.stdout: - m = pattern.search(line) - if m: - # User of the form `user` or `user#` exists - exists = True - max_num = max(max_num, m.group(1)) - if exists: - return max_num - else: - return None + command = 'dokku ssh-keys:list' + pattern = re.compile(r'NAME="' + name + '"') + proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + max_num = 0 + exists = False + for line in proc.stdout: + m = pattern.search(line) + if m: + # User of the form `user` or `user#` exists + exists = True + max_num = max(max_num, m.group(1)) + if exists: + return max_num + else: + return None def set_debconf_selection(debconf_type, key, value): From 030405b93de1c7998522d6f4b9e5565a29734a94 Mon Sep 17 00:00:00 2001 From: Stefan Seemayer Date: Sun, 16 Oct 2016 15:58:08 +0200 Subject: [PATCH 020/295] Remove duplicate SSL hostnames Ref dokku/dokku-letsencrypt#76 Certificates provided by Let's Encrypt can have the domain provided in the Subject Name field listed again in the Subject Alt Name fields, leading to the same domain getting listed twice by get_ssl_hostnames() that in turn leads to a duplicate server_name field in the nginx configuration. This patch adds a sort -u to ensure that every SSL hostname will only be listed once. --- plugins/certs/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/certs/functions b/plugins/certs/functions index b64a14a56..a130c993e 100755 --- a/plugins/certs/functions +++ b/plugins/certs/functions @@ -26,6 +26,6 @@ get_ssl_hostnames() { else local SSL_HOSTNAMES=$SSL_HOSTNAME fi - echo -e "$SSL_HOSTNAMES" + echo -e "$SSL_HOSTNAMES" | sort -u return 0 } From a2bacd80963670daccb557174c962ba68f2232a7 Mon Sep 17 00:00:00 2001 From: Flavio Poletti Date: Sat, 15 Oct 2016 23:55:43 +0200 Subject: [PATCH 021/295] Patch GH #2446 "Adding a file with two ssh-key..." This is a proposed change for addressing GH #2446 "Adding a file with two ssh-keys can result in an error" (see https://github.com/dokku/dokku/issues/2446). The following checks are performed: - validity of key contents when read from a file - key contents only contains one single line/key - authorized_keys file is ultimately valid The last test is an extension over the previous implementation in that all lines in the file are checked. The commit also includes extensions to the relevant test file to excercise the new checks. It also takes care to save and then restore the authorized_keys file. --- plugins/ssh-keys/functions | 6 ++++- plugins/ssh-keys/subcommands/add | 4 +++ tests/unit/30_ssh_keys.bats | 43 ++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/plugins/ssh-keys/functions b/plugins/ssh-keys/functions index 32e7e971e..24b5e6807 100755 --- a/plugins/ssh-keys/functions +++ b/plugins/ssh-keys/functions @@ -5,7 +5,11 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" verify_ssh_key_file() { declare desc="Test that public key is valid" [[ -s ${DOKKU_ROOT}/.ssh/authorized_keys ]] || dokku_log_fail "No public keys found." - ssh-keygen -l -f "${DOKKU_ROOT}/.ssh/authorized_keys" &> /dev/null || dokku_log_fail "${DOKKU_ROOT}/.ssh/authorized_keys failed ssh-keygen check." + local key line=0 + while read key ; do + line=$((line + 1)) + ssh-keygen -l -f /dev/stdin <<< "$key" &> /dev/null || dokku_log_fail "${DOKKU_ROOT}/.ssh/authorized_keys line $line failed ssh-keygen check." + done <"${DOKKU_ROOT}/.ssh/authorized_keys" } verify_ssh_key_exists() { diff --git a/plugins/ssh-keys/subcommands/add b/plugins/ssh-keys/subcommands/add index 165993a25..dac80e909 100755 --- a/plugins/ssh-keys/subcommands/add +++ b/plugins/ssh-keys/subcommands/add @@ -14,10 +14,14 @@ add_keys() { key_contents="$key_from_pipe" elif [[ -n "$key_file" ]]; then key_contents="$(cat "$key_file")" + ssh-keygen -lf /dev/stdin <<< "$key_contents" &> /dev/null || dokku_log_fail "Key from file is not a valid ssh public key" fi [[ -n "$name" && -n "$key_contents" ]] || dokku_log_fail "Two arguments are required if not piping, ie: dokku ssh-keys:add " + local count="$(wc -l <<< "$key_contents")" + [ "$count" -eq 1 ] || dokku_log_fail 'Too many keys provided, set one per invocation of dokku ssh-keys:add ' verify_ssh_key_exists echo "$key_contents" | sshcommand acl-add dokku "$name" || dokku_log_fail "sshcommand returned an error: $?" + verify_ssh_key_file } add_keys "$@" diff --git a/tests/unit/30_ssh_keys.bats b/tests/unit/30_ssh_keys.bats index d3f157c04..6f4b3e287 100644 --- a/tests/unit/30_ssh_keys.bats +++ b/tests/unit/30_ssh_keys.bats @@ -4,10 +4,31 @@ load test_helper setup() { global_setup + + # create a temporary key and save in a variable create_key + local KEY="$(cat /tmp/testkey.pub)" + destroy_key + + # now create key that will be really used + create_key + + # the temporary key is useful for adding in the file with two keys + # useful for a negative test + { cat /tmp/testkey.pub ; echo "$KEY" ; } > /tmp/testkey-double.pub + + # another negative test input + echo 'invalid!' > /tmp/testkey-invalid.pub + + # save current authorized_keys to remove all changes afterwards + cp "${DOKKU_ROOT:-/home/dokku}/.ssh/authorized_keys" /tmp/testkey-authorized_keys } teardown() { + # restore authorized_keys to its contents before the tests + cp /tmp/testkey-authorized_keys "${DOKKU_ROOT:-/home/dokku}/.ssh/authorized_keys" + + # normal cleanup after here destroy_key global_teardown } @@ -37,4 +58,26 @@ teardown() { echo "output: "$output echo "status: "$status assert_success + run /bin/bash -c "dokku ssh-keys:add name3 /tmp/testkey-double.pub" + echo "output: "$output + echo "status: "$status + assert_failure + run /bin/bash -c "dokku ssh-keys:add name4 /tmp/testkey-invalid.pub" + echo "output: "$output + echo "status: "$status + assert_failure + run /bin/bash -c "dokku ssh-keys:add name4 /tmp/testkey.pub" + echo "output: "$output + echo "status: "$status + assert_success + + # leave this as the last test in the sequence! It introduces an error in authorized_keys + run /bin/bash -c 'echo invalid >> "${DOKKU_ROOT:-/home/dokku}/.ssh/authorized_keys"' + echo "output: "$output + echo "status: "$status + assert_success + run /bin/bash -c "dokku ssh-keys:add name5 /tmp/testkey.pub" + echo "output: "$output + echo "status: "$status + assert_failure } From 65c2cffc6af7490d49544345b1391603b2de43c0 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Wed, 19 Oct 2016 17:25:54 +0300 Subject: [PATCH 022/295] Fix sshcommand on CentOS with sudo CentOS 7 resets path with $ sudo by default Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin --- rpm.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rpm.mk b/rpm.mk index 083189b29..1d430a9a3 100644 --- a/rpm.mk +++ b/rpm.mk @@ -124,15 +124,15 @@ rpm-plugn: rpm-sshcommand: rm -rf /tmp/tmp /tmp/build $(SSHCOMMAND_RPM_PACKAGE_NAME) - mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/local/bin + mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/bin @echo "-> Downloading package" wget -q -O /tmp/tmp/sshcommand-$(SSHCOMMAND_VERSION) $(SSHCOMMAND_URL) @echo "-> Copying files into place" - mkdir -p "/tmp/build/usr/local/bin" - cp /tmp/tmp/sshcommand-$(SSHCOMMAND_VERSION) /tmp/build/usr/local/bin/sshcommand - chmod +x /tmp/build/usr/local/bin/sshcommand + mkdir -p "/tmp/build/usr/bin" + cp /tmp/tmp/sshcommand-$(SSHCOMMAND_VERSION) /tmp/build/usr/bin/sshcommand + chmod +x /tmp/build/usr/bin/sshcommand @echo "-> Creating $(SSHCOMMAND_RPM_PACKAGE_NAME)" sudo fpm -t rpm -s dir -C /tmp/build -n sshcommand \ From aca8d0c682922e1755101469bf3698a78806e246 Mon Sep 17 00:00:00 2001 From: Francois Teychene Date: Thu, 20 Oct 2016 15:04:16 +0200 Subject: [PATCH 023/295] Add new community plugin Add new community plugin build hook. This plugin provide a way for application to define scripts in their codebase to be executed before the project build (Dockerfile or Herokuish). Use case : A Java application with only an ADD of the generated fat jar in the Dockerfile. The plugin allow the user to define a script to run the compilation before the docker build execution. --- docs/community/plugins.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/community/plugins.md b/docs/community/plugins.md index a961ed5f0..775b21778 100644 --- a/docs/community/plugins.md +++ b/docs/community/plugins.md @@ -119,6 +119,7 @@ Note: The following plugins have been supplied by our community and may not have [thrashr888]: https://github.com/thrashr888 [wmluke]: https://github.com/wmluke [Zenedith]: https://github.com/Zenedith +[fteychene]: https://github.com/fteychene ### Datastores @@ -184,6 +185,7 @@ Note: The following plugins have been supplied by our community and may not have | [robots.txt](https://notabug.org/candlewaster/dokku-robots.txt) | [candlewaster][] | 0.4.x | | [SSH Deployment Keys](https://github.com/cedricziel/dokku-deployment-keys)3 | [cedricziel][] | 0.4.0+ | | [SSH Hostkeys](https://github.com/cedricziel/dokku-hostkeys-plugin)4 | [cedricziel][] | 0.3.x | +| [Application build hook](https://github.com/fteychene/dokku-build-hook) | [fteychene][] | 0.4.0+ | [217d00a]: https://github.com/dokku/dokku/commit/217d00a1bc47a7e24d8847617bb08a1633025fc7 From 25e5db5a5b36b9cd1fa326685d670d7ef1fc2bb2 Mon Sep 17 00:00:00 2001 From: Deokhyun Ko Date: Thu, 27 Oct 2016 05:39:43 -0600 Subject: [PATCH 024/295] Update plugins.md Added "Access" plugin --- docs/community/plugins.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/community/plugins.md b/docs/community/plugins.md index a961ed5f0..12f507fc9 100644 --- a/docs/community/plugins.md +++ b/docs/community/plugins.md @@ -222,6 +222,7 @@ Note: The following plugins have been supplied by our community and may not have | [Webhooks](https://github.com/nickstenning/dokku-webhooks) | [nickstenning][] | 0.3.x | | [Wkhtmltopdf](https://github.com/mbriskar/dokku-wkhtmltopdf) | [mbriskar][] | 0.4.0+ | | [Wordpress Setup](https://github.com/dudagroup/dokku-wordpress-template) | [abossard][] | | +| [Access](https://github.com/mainto/dokku-access) | [mainto](https://github.com/mainto) | 0.4.0+ | ### Deprecated Plugins From efa88d00870cc084447a3f518781772cf0969529 Mon Sep 17 00:00:00 2001 From: Pranav Goel Date: Sat, 29 Oct 2016 14:29:28 +0530 Subject: [PATCH 025/295] Update README.md --- README.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f52a76cb1..1d09d0e46 100644 --- a/README.md +++ b/README.md @@ -7,26 +7,31 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. ## Requirements -- A fresh VM running `Debian 8.2 x64`, `Ubuntu 14.04 x64`, or `Ubuntu 16.04 x64` +A fresh VM running any one of +- `Debian 8.2 x64` +- `Ubuntu 14.04 x64` +- `Ubuntu 16.04 x64` -## Installing +## Installation -To install the latest stable release, you can run the following commands as a user that has access to `sudo`: +To install the latest stable release, run the following commands as a user who has access to `sudo`: - wget https://raw.githubusercontent.com/dokku/dokku/v0.7.2/bootstrap.sh - sudo DOKKU_TAG=v0.7.2 bash bootstrap.sh +``` +wget https://raw.githubusercontent.com/dokku/dokku/v0.7.2/bootstrap.sh +sudo DOKKU_TAG=v0.7.2 bash bootstrap.sh +``` You can then proceed to the ip address or domain name associated with your server to complete the web-based installation. -If you wish for a more unattended installation method, see [these](http://dokku.viewdocs.io/dokku/getting-started/install/debian/#unattended-installation) docs. +If you wish for a more unattended installation method, you can see [these](http://dokku.viewdocs.io/dokku/getting-started/install/debian/#unattended-installation) docs. -### Upgrading +### Upgrade -[View the docs for upgrading](http://dokku.viewdocs.io/dokku/getting-started/upgrading/) from an older version of Dokku. +[View the docs] for upgrading(http://dokku.viewdocs.io/dokku/getting-started/upgrading/) from an older version of Dokku. ## Documentation -Full documentation - including advanced installation docs - are available online at [docs](http://dokku.viewdocs.io/dokku/) +Full documentation - including advanced installation docs - are available online [here](http://dokku.viewdocs.io/dokku/) ## Support From 2e1d8def403cff184865382893510ae953200980 Mon Sep 17 00:00:00 2001 From: Pranav Goel Date: Sat, 29 Oct 2016 14:30:42 +0530 Subject: [PATCH 026/295] Update SPONSORS.md --- SPONSORS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SPONSORS.md b/SPONSORS.md index 4c7c0b9bc..eb1cd5b87 100644 --- a/SPONSORS.md +++ b/SPONSORS.md @@ -1,3 +1,5 @@ +#Sponsors + [Deis](http://deis.io) [DigitalOcean](https://www.digitalocean.com/) From 14833e22cb58466ca00e40aa6440c0075c0bd151 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Mon, 31 Oct 2016 09:49:49 +0200 Subject: [PATCH 027/295] Fix dokku-redeploy systemd script to start only after docker According to https://docs.docker.com/engine/admin/host_integration/#/systemd it should use After=docker.service and it works at least on CentOS 7. --- plugins/00_dokku-standard/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/00_dokku-standard/install b/plugins/00_dokku-standard/install index 9ef25cf45..b129367b7 100755 --- a/plugins/00_dokku-standard/install +++ b/plugins/00_dokku-standard/install @@ -30,7 +30,8 @@ if [[ $(systemctl 2> /dev/null) =~ -\.mount ]]; then cat< /etc/systemd/system/dokku-redeploy.service [Unit] Description=Dokku app redeploy service -After=docker.target +Requires=docker.service +After=docker.service [Service] Type=simple From faaf81d6e9d3a256769037c19375799b6835a43c Mon Sep 17 00:00:00 2001 From: nahtnam Date: Sat, 12 Nov 2016 22:05:05 -0800 Subject: [PATCH 028/295] Update troubleshooting.md Add `killed` symptom to troubleshooting guide. --- docs/getting-started/troubleshooting.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/getting-started/troubleshooting.md b/docs/getting-started/troubleshooting.md index ef6b35ead..48cdb40e8 100644 --- a/docs/getting-started/troubleshooting.md +++ b/docs/getting-started/troubleshooting.md @@ -154,3 +154,23 @@ dokku config:set --global CURL_CONNECT_TIMEOUT=30 ``` Please see https://github.com/dokku/dokku/issues/509 + +*** + +__Symptom:__ Build fails with `Killed` message. + +__Solution:__ + +This generally occurs when the server runs out of memory. You can either add more ram to your server or setup swap space. The follow script will create 2gb of swap space. + +```shell +sudo install -o root -g root -m 0600 /dev/null /swapfile +dd if=/dev/zero of=/swapfile bs=1k count=2048k +mkswap /swapfile +swapon /swapfile +echo "/swapfile swap swap auto 0 0" | sudo tee -a /etc/fstab +sudo sysctl -w vm.swappiness=10 +echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf +``` + +*** From ccc44b0c162f1758364e4fbe6a680cbf44478922 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Mon, 14 Nov 2016 22:21:41 +0900 Subject: [PATCH 029/295] Fix bug when VHOST without newline --- plugins/domains/functions | 2 +- tests/unit/20_domains.bats | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/domains/functions b/plugins/domains/functions index 2cc3a78a4..b66531f5f 100755 --- a/plugins/domains/functions +++ b/plugins/domains/functions @@ -148,7 +148,7 @@ domains_add_global() { if [[ $(egrep -w "^$DOMAIN$" "$GLOBAL_VHOST_PATH" > /dev/null 2>&1; echo $?) -eq 0 ]]; then dokku_log_info1 "Skipping: $DOMAIN already added" else - echo "$DOMAIN" >> "$GLOBAL_VHOST_PATH" + sed -i -e "\$a\\$DOMAIN" "$GLOBAL_VHOST_PATH" dokku_log_info1 "Added $DOMAIN" fi done diff --git a/tests/unit/20_domains.bats b/tests/unit/20_domains.bats index 3aba4aa8f..631eea8f9 100644 --- a/tests/unit/20_domains.bats +++ b/tests/unit/20_domains.bats @@ -170,7 +170,7 @@ teardown() { echo "status: "$status assert_success - run bash -c "dokku domains | grep -q global.dokku.me" + run bash -c "dokku domains | egrep -qw '^global.dokku.me\$'" echo "output: "$output echo "status: "$status assert_success From 6c10fd4c3978d7fe55ee967e1d21bc2f393a53c0 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Tue, 15 Nov 2016 09:09:11 -0600 Subject: [PATCH 030/295] Fixing typo Changed from "Move information" to "More information" --- docs/advanced-usage/docker-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced-usage/docker-options.md b/docs/advanced-usage/docker-options.md index cd6261ae8..da2dd0dc3 100644 --- a/docs/advanced-usage/docker-options.md +++ b/docs/advanced-usage/docker-options.md @@ -77,4 +77,4 @@ The above example will result in the following options being passed to Docker du You may also include comments (lines beginning with a #) and blank lines in the DOCKER_OPTIONS file. -Move information on Docker options can be found here: http://docs.docker.io/en/latest/reference/run/ . +More information on Docker options can be found here: http://docs.docker.io/en/latest/reference/run/ . From 729677c41af538abb0d74155b79e02a93b1ea66e Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Tue, 15 Nov 2016 09:12:38 -0600 Subject: [PATCH 031/295] Fixing broken link The old link seems to not exist anymore. Not sure if this is what's intended to be linked to, but seems like the closest thing. --- docs/advanced-usage/docker-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced-usage/docker-options.md b/docs/advanced-usage/docker-options.md index da2dd0dc3..d66650fee 100644 --- a/docs/advanced-usage/docker-options.md +++ b/docs/advanced-usage/docker-options.md @@ -77,4 +77,4 @@ The above example will result in the following options being passed to Docker du You may also include comments (lines beginning with a #) and blank lines in the DOCKER_OPTIONS file. -More information on Docker options can be found here: http://docs.docker.io/en/latest/reference/run/ . +More information on Docker options can be found here: https://docs.docker.com/engine/reference/commandline/run/. From 434672a8ddbc42c46fc46d3be8d0d0ec6b3046f4 Mon Sep 17 00:00:00 2001 From: Josh Manders Date: Tue, 15 Nov 2016 11:17:12 -0600 Subject: [PATCH 032/295] bump font size --- docs/assets/style.css | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/assets/style.css b/docs/assets/style.css index 34d6acc43..da3c92f26 100644 --- a/docs/assets/style.css +++ b/docs/assets/style.css @@ -1,7 +1,6 @@ body { font-family: 'Open Sans', sans-serif; font-weight: 400; - font-size: 12px; padding-bottom: 40px; color: #5a5a5a; -webkit-font-smoothing: antialiased; @@ -21,7 +20,7 @@ h1 { .header .heading { color: #fff; font-size: 23px; - margin: 0; + margin: 7px 0 0 0; padding: 0 0 0 1em; } .header a { @@ -67,7 +66,6 @@ h1 { color: #444; display: block; font-weight: 400; - font-size: 14px; margin: 0 20px; padding: 3px 0; text-align: center; @@ -246,7 +244,6 @@ a.list-group-item { -webkit-font-smoothing: antialiased; box-sizing: border-box; color: rgb(71, 74, 84); - font-size: 14px; font-weight: normal; height: 20px; line-height: 20px; From c4c7886037f816460c9ac74c267bf9e56a9126cf Mon Sep 17 00:00:00 2001 From: Josh Manders Date: Thu, 17 Nov 2016 12:55:08 -0600 Subject: [PATCH 033/295] add plugin uninstall trigger --- docs/development/plugin-triggers.md | 15 +++++++++++++++ plugins/plugin/functions | 1 + 2 files changed, 16 insertions(+) diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index 846c6fecd..b19d8f184 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -866,6 +866,21 @@ APP="$1"; IMAGE_TAG="$2" some code to remove a docker hub tag because it's not implemented in the CLI.... ``` +### `uninstall` + - Description: Used to cleanup after itself. + - Invoked by: `dokku plugin:uninstall` + - Arguments: None + - Example: + + ```shell + #!/usr/bin/env bash + # Cleanup up extra containers created + + set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + + docker rmi -f "${PLUGIN_IMAGE_DEPENDENCY}" + ``` + ### `update` - Description: Can be used to run plugin updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates. diff --git a/plugins/plugin/functions b/plugins/plugin/functions index be9bf6d16..abed5c29b 100755 --- a/plugins/plugin/functions +++ b/plugins/plugin/functions @@ -70,6 +70,7 @@ uninstall_plugin() { local PLUGIN="$1" [[ -e $PLUGIN_CORE_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Cannot uninstall a core plugin" [[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin ($PLUGIN) is not currently installed" + plugn trigger uninstall plugn uninstall "$PLUGIN" dokku_log_info1_quiet "Plugin $PLUGIN uninstalled" } From d4475e582d399d26c8a7870edcf48ef760cba0f8 Mon Sep 17 00:00:00 2001 From: Josh Manders Date: Thu, 17 Nov 2016 16:06:57 -0600 Subject: [PATCH 034/295] pass plugin to uninstall --- docs/development/plugin-triggers.md | 6 ++++-- plugins/plugin/functions | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index b19d8f184..27fd3c6f4 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -869,7 +869,7 @@ some code to remove a docker hub tag because it's not implemented in the CLI.... ### `uninstall` - Description: Used to cleanup after itself. - Invoked by: `dokku plugin:uninstall` - - Arguments: None + - Arguments: `$PLUGIN` - Example: ```shell @@ -878,7 +878,9 @@ some code to remove a docker hub tag because it's not implemented in the CLI.... set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x - docker rmi -f "${PLUGIN_IMAGE_DEPENDENCY}" + PLUGIN="$1" + + [[ "$PLUGIN" = "my-plugin" ]] && docker rmi -f "${PLUGIN_IMAGE_DEPENDENCY}" ``` ### `update` diff --git a/plugins/plugin/functions b/plugins/plugin/functions index abed5c29b..3b814d7f8 100755 --- a/plugins/plugin/functions +++ b/plugins/plugin/functions @@ -70,7 +70,7 @@ uninstall_plugin() { local PLUGIN="$1" [[ -e $PLUGIN_CORE_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Cannot uninstall a core plugin" [[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin ($PLUGIN) is not currently installed" - plugn trigger uninstall + plugn trigger uninstall "$PLUGIN" plugn uninstall "$PLUGIN" dokku_log_info1_quiet "Plugin $PLUGIN uninstalled" } From 7ac47d2e61d29e489e452470716a7c664d362f09 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 20 Nov 2016 15:15:40 -0700 Subject: [PATCH 035/295] Fix iteration on all apps for `dokku proxy` command Closes #2481 --- plugins/proxy/subcommands/default | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/proxy/subcommands/default b/plugins/proxy/subcommands/default index cd913904c..4e867c850 100755 --- a/plugins/proxy/subcommands/default +++ b/plugins/proxy/subcommands/default @@ -6,13 +6,14 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions" proxy_main_cmd() { declare desc="displays app proxy implementation via command line" local cmd="proxy" - local ALL_APPS=$(dokku_apps) - if [[ -n "$2" ]]; then - local APP="$2" + [[ "$1" == "$cmd" ]] && shift 1 + local APPS=$(dokku_apps) + if [[ -n "$1" ]]; then + local APPS="$1" fi - local APPS=${APP:="$ALL_APPS"} dokku_col_log_info1_quiet "App Name" "Proxy Type" + local app for app in $APPS; do verify_app_name "$app" dokku_col_log_msg "$app" "$(get_app_proxy_type "$app")" From 9951a16ccce7b8475ad5dd77602af7b212b3a742 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 20 Nov 2016 15:37:05 -0700 Subject: [PATCH 036/295] docs: standardize on node-js-app as the app name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We’ll probably want to update this to whatever the hip language of the day is, but for now, having the same reference everywhere works. --- docs/configuration/ssl.md | 3 +-- docs/deployment/methods/buildpacks.md | 11 ++++------- docs/deployment/methods/dockerfiles.md | 2 +- docs/deployment/zero-downtime-deploys.md | 14 +++++++------- docs/development/plugin-creation.md | 4 ++-- docs/getting-started/upgrading.md | 4 ++-- 6 files changed, 17 insertions(+), 21 deletions(-) diff --git a/docs/configuration/ssl.md b/docs/configuration/ssl.md index 7a1a397d8..8656606c6 100644 --- a/docs/configuration/ssl.md +++ b/docs/configuration/ssl.md @@ -29,8 +29,7 @@ The `certs:add` command can be used to push a `tar` containing a certificate `.c ```shell tar cvf cert-key.tar server.crt server.key -# replace APP with the name of your application -dokku certs:add < cert-key.tar +dokku certs:add node-js-app < cert-key.tar ``` > Note: If your `.crt` file came alongside a `.ca-bundle`, you'll want to concatenate those into a single `.crt` file before adding it to the `.tar`. diff --git a/docs/deployment/methods/buildpacks.md b/docs/deployment/methods/buildpacks.md index 897d9ef41..79f1bc2d4 100644 --- a/docs/deployment/methods/buildpacks.md +++ b/docs/deployment/methods/buildpacks.md @@ -14,12 +14,11 @@ In certain cases you may want to specify a custom buildpack. While Dokku uses he To use a specific buildpack, you can run the following Dokku command: ```shell -# replace APP with the name of your application # replace REPOSITORY_URL with your buildpack's url -dokku config:set APP BUILDPACK_URL=REPOSITORY_URL +dokku config:set node-js-app BUILDPACK_URL=REPOSITORY_URL # example: using a specific ruby buildpack version -dokku config:set APP BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-ruby.git#v142 +dokku config:set node-js-app BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-ruby.git#v142 ``` Please check the documentation for your particular buildpack as you may need to include configuration files (such as a Procfile) in your project root. @@ -45,16 +44,14 @@ As Dokku pins all buildpacks via herokuish releases, there may be occasions wher ```shell # using the latest nodejs buildpack -# replace APP with the name of your application -dokku config:set APP BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs +dokku config:set node-js-app BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs ``` You may also wish to use a **specific** version of a buildpack, which is also simple ```shell # using v87 of the nodejs buildpack -# replace APP with the name of your application -dokku config:set APP BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs#v87 +dokku config:set node-js-app BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs#v87 ``` ## Specifying commands via Procfile diff --git a/docs/deployment/methods/dockerfiles.md b/docs/deployment/methods/dockerfiles.md index a51b427da..ebc91f65b 100644 --- a/docs/deployment/methods/dockerfiles.md +++ b/docs/deployment/methods/dockerfiles.md @@ -34,7 +34,7 @@ ENTRYPOINT ["node"] You can do: ```shell -dokku config:set APP DOKKU_DOCKERFILE_START_CMD="--harmony server.js" +dokku config:set node-js-app DOKKU_DOCKERFILE_START_CMD="--harmony server.js" ``` To tell docker what to run. diff --git a/docs/deployment/zero-downtime-deploys.md b/docs/deployment/zero-downtime-deploys.md index 2ef6bd89e..a2ff6db3d 100644 --- a/docs/deployment/zero-downtime-deploys.md +++ b/docs/deployment/zero-downtime-deploys.md @@ -52,7 +52,7 @@ Dokku will wait `60` seconds before stopping the old container so that existing ```shell dokku config:set --global DOKKU_WAIT_TO_RETIRE=120 -dokku config:set DOKKU_WAIT_TO_RETIRE=120 +dokku config:set node-js-app DOKKU_WAIT_TO_RETIRE=120 ``` > Note that during this time, multiple containers may be running on your server, which can be an issue for memory-hungry applications on memory-constrained servers. @@ -92,7 +92,7 @@ dokku checks:run APP Checks can be scoped to a particular process type: ```shell -dokku checks:run APP worker +dokku checks:run node-js-app worker ``` ``` @@ -108,7 +108,7 @@ dokku checks:run APP worker An app process id may also be specified: ```shell -dokku checks:run APP web.2 +dokku checks:run node-js-app web.2 ``` ``` @@ -124,7 +124,7 @@ dokku checks:run APP web.2 Non-existent process types will result in an error: ```shell -dokku checks:run APP non-existent +dokku checks:run node-js-app non-existent ``` ``` @@ -135,7 +135,7 @@ Invalid process type specified (APP.non-existent) Non-existent process ids will *also* result in an error ```shell -dokku checks:run APP web.3 +dokku checks:run node-js-app web.3 ``` ``` @@ -214,7 +214,7 @@ dokku config:set --global DOKKU_CHECKS_ATTEMPTS=10 If your application runs multiple processes (a background worker configured in your `Procfile`, for example) and you have checks to ensure that your web application has booted up, you may want to disable the default check wait time for that application to avoid the `10` second wait per non-web process: ```shell -dokku config:set DOKKU_DEFAULT_CHECKS_WAIT=0 +dokku config:set node-js-app DOKKU_DEFAULT_CHECKS_WAIT=0 ``` ### Configuring docker stop timeout @@ -222,7 +222,7 @@ dokku config:set DOKKU_DEFAULT_CHECKS_WAIT=0 [By default](https://docs.docker.com/engine/reference/commandline/stop/), docker will wait 10 seconds from the time the `stop` command is passed to a container before it attempts to kill said container. This timeout can be configured on a per-app basis in Dokku by setting the `DOKKU_DOCKER_STOP_TIMEOUT` configuration variable. This timeout applies to normal zero-downtime deployments as well as the `ps:stop` and `apps:destroy` commands. ```shell -dokku config:set $APP DOKKU_DOCKER_STOP_TIMEOUT=20 +dokku config:set node-js-app DOKKU_DOCKER_STOP_TIMEOUT=20 ``` ## Example: Successful Rails Deployment diff --git a/docs/development/plugin-creation.md b/docs/development/plugin-creation.md index 3c7bff94a..2a2134082 100644 --- a/docs/development/plugin-creation.md +++ b/docs/development/plugin-creation.md @@ -150,8 +150,8 @@ A few notes: - As some plugins require access to set app config settings and do not want/require the default Heroku-style behavior of a restart, we have the following "internal" commands that provide this functionality : ```shell - dokku config:set --no-restart APP KEY1=VALUE1 [KEY2=VALUE2 ...] - dokku config:unset --no-restart APP KEY1 [KEY2 ...] + dokku config:set --no-restart node-js-app KEY1=VALUE1 [KEY2=VALUE2 ...] + dokku config:unset --no-restart node-js-app KEY1 [KEY2 ...] ``` - From time to time you may want to allow other plugins access to (some of) your plugin's functionality. You can expose this by including a `functions` file in your plugin for others to source. Consider all functions in that file to be publicly accessible by other plugins. Any functions not wished to be made "public" should reside within your plugin trigger or commands files. - As of 0.4.0, we allow image tagging and deployment of said tagged images. Therefore, hard-coding of `$IMAGE` as `dokku/$APP` is no longer sufficient. Instead, for non `pre/post-build-*` plugins, use `get_running_image_tag()` & `get_app_image_name()` as sourced from common/functions. See the [plugin triggers](/dokku/development/plugin-triggers) doc for examples. diff --git a/docs/getting-started/upgrading.md b/docs/getting-started/upgrading.md index 42cfa36a6..667d668e4 100644 --- a/docs/getting-started/upgrading.md +++ b/docs/getting-started/upgrading.md @@ -25,7 +25,7 @@ If Dokku was installed via `apt-get install dokku` or `bootstrap.sh` (most commo ```shell sudo apt-get update dokku apps -dokku ps:stop # repeat to shut down each running app +dokku ps:stop APP # repeat to shut down each running app sudo apt-get install -qq -y dokku herokuish dokku ps:rebuildall # rebuilds all applications ``` @@ -46,7 +46,7 @@ If you installed Dokku from source (less common), upgrade with: ```shell dokku apps -dokku ps:stop # repeat to shut down each running app +dokku ps:stop APP # repeat to shut down each running app cd ~/dokku git pull --tags origin master From 95239a57310323835763a96c9552510585edd942 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 20 Nov 2016 15:37:21 -0700 Subject: [PATCH 037/295] docs: remove unnecessary example --- docs/deployment/logs.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/deployment/logs.md b/docs/deployment/logs.md index 9be0352f8..eefb5983c 100644 --- a/docs/deployment/logs.md +++ b/docs/deployment/logs.md @@ -24,13 +24,8 @@ Dokku also supports certain command-line arguments that augment the `log` comman -q, --quiet # display raw logs without colors, time and names ``` -You can use these modifiers as +You can use these modifiers as follows: -```shell -dokku logs -``` - -For example, ```shell dokku logs node-js-app -t -p web From f6c072fa2b0bb768d5dcaef122561b331a7e5311 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 20 Nov 2016 15:38:01 -0700 Subject: [PATCH 038/295] docs: remove extra output --- docs/advanced-usage/plugin-management.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/docs/advanced-usage/plugin-management.md b/docs/advanced-usage/plugin-management.md index 985b386ae..01af0b16b 100644 --- a/docs/advanced-usage/plugin-management.md +++ b/docs/advanced-usage/plugin-management.md @@ -72,17 +72,6 @@ Receiving objects: 100% (646/646), 134.24 KiB | 0 bytes/s, done. Resolving deltas: 100% (406/406), done. Checking connectivity... done. -----> Plugin postgres enabled ------> Migrating zero downtime env variables to 0.5.x. The following variables have been deprecated -=====> DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS -=====> Please use dokku checks:[disable|enable] to control zero downtime functionality -=====> Migration complete -=====> ------> Migrating zero downtime env variables to 0.6.x. The following variables will be migrated -=====> DOKKU_CHECKS_ENABLED -> DOKKU_CHECKS_SKIPPED -=====> Migration complete -=====> -Adding user dokku to group adm -Starting nginx (via systemctl): nginx.service. ``` You can also uninstall a third-party plugin using the `plugin:uninstall` command: From d7bc6976ed73ac782ed872b0c734cad65eb3897c Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 20 Nov 2016 16:07:05 -0700 Subject: [PATCH 039/295] docs: Mention that ports are ignored in CHECKS doc Closes #2487 [ci skip] --- docs/deployment/zero-downtime-deploys.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/deployment/zero-downtime-deploys.md b/docs/deployment/zero-downtime-deploys.md index a2ff6db3d..0a502ce37 100644 --- a/docs/deployment/zero-downtime-deploys.md +++ b/docs/deployment/zero-downtime-deploys.md @@ -189,6 +189,8 @@ https://admin.example.com Admin Dashboard https://static.example.com/logo.png ``` +While a full url may be used in order to invoke checks, if you are using relative urls, the port *must* be omitted. + ### Check Settings The default behavior is to wait for `5` seconds before running the checks, to timeout the checks after `30` seconds, and to attempt the checks `5` times. If the checks fail `5` times, the deployment is considered failed and the old container will continue serving traffic. From 8d6f32e1e34d61e1d9cccceb824682f36585c66d Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 20 Nov 2016 16:12:26 -0700 Subject: [PATCH 040/295] docs: reword zero downtime docs to make them flow better [ci skip] --- docs/deployment/zero-downtime-deploys.md | 184 ++++++++++------------- 1 file changed, 83 insertions(+), 101 deletions(-) diff --git a/docs/deployment/zero-downtime-deploys.md b/docs/deployment/zero-downtime-deploys.md index 0a502ce37..c1b24c9d5 100644 --- a/docs/deployment/zero-downtime-deploys.md +++ b/docs/deployment/zero-downtime-deploys.md @@ -10,18 +10,32 @@ checks:run [process-type(s)] Runs zero-downtime checks for all proce checks:skip [process-type(s)] Skip zero-downtime checks for all processes (or comma-separated process-type list) ``` -Following a deploy, Dokku will wait `10` seconds before routing traffic to the new container to give your application time to boot up. If the application is not running after this time, then the deploy is failed and your old container will continue serving traffic. You can modify this value globally or on a per-application basis: - -```shell -dokku config:set --global DOKKU_DEFAULT_CHECKS_WAIT=30 -dokku config:set node-js-app DOKKU_DEFAULT_CHECKS_WAIT=30 -``` - -You can also choose to skip checks or disable zero-downtime completely on a per-application/per-process basis - -> Note that `checks:disable` will now (as of 0.6.0) cause downtime for that process-type during deployments. +By default, Dokku will wait `10` seconds after starting each container before assuming it is up and proceeding with the deploy. Once this has occurred for all containers started by for an application, traffic will be switched to point to your new containers. Dokku will also wait a further `60` seconds _after_ the deploy is complete before terminating old containers in order to give time for long running connections to terminate. In either case, you may have more than one container running for a given application. + +You may both create user-defined checks for web processes using a `CHECKS` file, as well as customize any and all parts of this experience using the checks plugin. + +## Configuring Check Settings using the `config` plugin + +There are certain settings that can be configured via environment variables: + +- `DOKKU_DEFAULT_CHECKS_WAIT`: (default: `10`) If no user-defined checks are specified - or if the process being checked is not a `web` process - this is the period of time Dokku will wait before checking that a container is still running. +- `DOKKU_DOCKER_STOP_TIMEOUT`: (default: `10`) Configurable grace period given to the `docker stop` command. If a container has not stopped by this time, a `kill -9` signal or equivalent is sent in order to force-terminate the container. Both the `ps:stop` and `apps:destroy` commands _also_ respect this value. If not specified, the docker defaults for the [docker stop command](https://docs.docker.com/engine/reference/commandline/stop/) will be used. +- `DOKKU_WAIT_TO_RETIRE`: (default: `60`) After a successful deploy, the grace period given to old containers before they are stopped/terminated. This is useful for ensuring completion of long-running http connections. + +The following settings may also be specified in the `CHECKS` file, though are available as environment variables in order to ease application reuse. + +- `DOKKU_CHECKS_WAIT`: (default: `5`) Wait this many seconds for the container to start before running checks. +- `DOKKU_CHECKS_TIMEOUT`: (default: `30`) Wait this many seconds for each response before marking it as a failure. +- `DOKKU_CHECKS_ATTEMPTS`: (default: `5`) Number of retries for to run for a specific check before marking it as a failure + +## Skipping and Disabling Checks + +> Note that `checks:disable` will now (as of 0.6.0) cause downtime for that process-type during deployments. Previously, it acted as `checks:skip` currently does. + +You can choose to skip checks completely on a per-application/per-process basis. Skipping checks will avoid the default 10 second waiting period entirely, as well as any other user-defined checks. ```shell +# process type specification is optional dokku checks:skip node-js-app worker,web ``` @@ -33,8 +47,7 @@ dokku checks:skip node-js-app worker,web DOKKU_CHECKS_SKIPPED: worker,web ``` -Additionally, any given process can only be configured to disable zero-downtime. example: - +Zero-downtime checks can also be disabled completely. This will stop old containers **before** new ones start, which may result in broken connections and downtime if your application fails to boot properly. ```shell dokku checks:disable node-js-app worker @@ -48,14 +61,67 @@ dokku checks:disable node-js-app worker DOKKU_CHECKS_SKIPPED: web ``` -Dokku will wait `60` seconds before stopping the old container so that existing connections are given a chance to complete. You can modify this value globally or on a per-application basis: +## Customizing Checks -```shell -dokku config:set --global DOKKU_WAIT_TO_RETIRE=120 -dokku config:set node-js-app DOKKU_WAIT_TO_RETIRE=120 +If your application needs a longer period to boot up - perhaps to load data into memory, or because of slow boot time - you may also use dokku's `checks` functionality to more precisely check whether an application can serve traffic or not. + +Checks are run against the detected `web` process from your application's `Procfile`. For non-web processes, Dokku will fallback to the aforementioned process uptime check. + +To specify checks, add a `CHECKS` file to the root of your project directory. The `CHECKS` file should be plain text and may contain: + +- Check instructions +- Settings (NAME=VALUE) +- Comments (lines starting with #) +- Empty lines + +> For dockerfile-based deploys, the file *must* be in `/app/CHECKS` within the container. `/app` is used by default as the root container directory for buildpack-based deploys. + +### Check Instructions + +The format of a check instruction is a path or relative URL, optionally followed by the expected content: + +``` +/about Our Amazing Team ``` -> Note that during this time, multiple containers may be running on your server, which can be an issue for memory-hungry applications on memory-constrained servers. +The `CHECKS` file can contain multiple checks: + +``` +/ My Amazing App +/stylesheets/index.css .body +/scripts/index.js $(function() +/images/logo.png +``` + +To check an application that supports multiple hostnames, use relative URLs that include the hostname: + +``` +//admin.example.com Admin Dashboard +//static.example.com/logo.png +``` + +You can also specify the protocol to explicitly check HTTPS requests: + +``` +https://admin.example.com Admin Dashboard +https://static.example.com/logo.png +``` + +While a full url may be used in order to invoke checks, if you are using relative urls, the port *must* be omitted. + +### Check Settings + +The default behavior is to wait for `5` seconds before running the checks, to timeout the checks after `30` seconds, and to attempt the checks `5` times. If the checks fail `5` times, the deployment is considered failed and the old container will continue serving traffic. + +You can change the default behavior by setting `WAIT`, `TIMEOUT`, and `ATTEMPTS` to different values in the `CHECKS` file: + +``` +WAIT=30 # Wait 1/2 minute +TIMEOUT=60 # Timeout after a minute +ATTEMPTS=10 # Attempt checks 10 times + +/ My Amazing App +``` ## Manually Invoking Checks @@ -143,90 +209,6 @@ dokku checks:run node-js-app web.3 Invalid container id specified (APP.web.3) ``` -## Customizing Checks - -If your application needs a longer period to boot up - perhaps to load data into memory, or because of slow boot time - you may also use dokku's `checks` functionality to more precisely check whether an application can serve traffic or not. - -Checks are run against the detected `web` process from your application's `Procfile`. For non-web processes, Dokku will fallback to the aforementioned process uptime check. - -To specify checks, add a `CHECKS` file to the root of your project directory. The `CHECKS` file should be plain text and may contain: - -* Check instructions -* Settings (NAME=VALUE) -* Comments (lines starting with #) -* Empty lines - -> For dockerfile-based deploys, the file *must* be in `/app/CHECKS` within the container. `/app` is used by default as the root container directory for buildpack-based deploys. - -### Check Instructions - -The format of a check instruction is a path or relative URL, optionally followed by the expected content: - -``` -/about Our Amazing Team -``` - -The `CHECKS` file can contain multiple checks: - -``` -/ My Amazing App -/stylesheets/index.css .body -/scripts/index.js $(function() -/images/logo.png -``` - -To check an application that supports multiple hostnames, use relative URLs that include the hostname: - -``` -//admin.example.com Admin Dashboard -//static.example.com/logo.png -``` - -You can also specify the protocol to explicitly check HTTPS requests: - -``` -https://admin.example.com Admin Dashboard -https://static.example.com/logo.png -``` - -While a full url may be used in order to invoke checks, if you are using relative urls, the port *must* be omitted. - -### Check Settings - -The default behavior is to wait for `5` seconds before running the checks, to timeout the checks after `30` seconds, and to attempt the checks `5` times. If the checks fail `5` times, the deployment is considered failed and the old container will continue serving traffic. - -You can change the default behavior by setting `WAIT`, `TIMEOUT`, and `ATTEMPTS` to different values in the `CHECKS` file: - -``` -WAIT=30 # Wait 1/2 minute -TIMEOUT=60 # Timeout after a minute -ATTEMPTS=10 # Attempt checks 10 times - -/ My Amazing App -``` - -You can also override the default `WAIT`, `TIMEOUT`, and `ATTEMPTS` variables for the global Dokku installation: - -```shell -dokku config:set --global DOKKU_CHECKS_WAIT=30 -dokku config:set --global DOKKU_CHECKS_TIMEOUT=60 -dokku config:set --global DOKKU_CHECKS_ATTEMPTS=10 -``` - -If your application runs multiple processes (a background worker configured in your `Procfile`, for example) and you have checks to ensure that your web application has booted up, you may want to disable the default check wait time for that application to avoid the `10` second wait per non-web process: - -```shell -dokku config:set node-js-app DOKKU_DEFAULT_CHECKS_WAIT=0 -``` - -### Configuring docker stop timeout - -[By default](https://docs.docker.com/engine/reference/commandline/stop/), docker will wait 10 seconds from the time the `stop` command is passed to a container before it attempts to kill said container. This timeout can be configured on a per-app basis in Dokku by setting the `DOKKU_DOCKER_STOP_TIMEOUT` configuration variable. This timeout applies to normal zero-downtime deployments as well as the `ps:stop` and `apps:destroy` commands. - -```shell -dokku config:set node-js-app DOKKU_DOCKER_STOP_TIMEOUT=20 -``` - ## Example: Successful Rails Deployment In this example, a Rails application is successfully deployed to dokku. The initial round of checks fails while the server is starting, but once it starts they succeed and the deployment is successful. `WAIT` is set to `10` because our application takes a while to boot up. `ATTEMPTS` is set to `6`, but the third attempt succeeds. From 63817fc6f396b0404281028c6e24f370255d84a9 Mon Sep 17 00:00:00 2001 From: Josh Manders Date: Sun, 20 Nov 2016 17:49:02 -0600 Subject: [PATCH 041/295] add warning --- docs/development/plugin-triggers.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index 27fd3c6f4..d8d8fdced 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -867,6 +867,7 @@ some code to remove a docker hub tag because it's not implemented in the CLI.... ``` ### `uninstall` + - Description: Used to cleanup after itself. - Invoked by: `dokku plugin:uninstall` - Arguments: `$PLUGIN` @@ -883,6 +884,8 @@ some code to remove a docker hub tag because it's not implemented in the CLI.... [[ "$PLUGIN" = "my-plugin" ]] && docker rmi -f "${PLUGIN_IMAGE_DEPENDENCY}" ``` + > To avoid uninstalling other plugins make sure to check the plugin name like shown in the example. + ### `update` - Description: Can be used to run plugin updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates. From 4e25639de4bfde96e29bc3291e13706bd0ece104 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 21 Nov 2016 19:08:33 -0700 Subject: [PATCH 042/295] Create the user's `authorized_keys` file if it does not exist Closes #2469 --- plugins/ssh-keys/functions | 5 +++++ plugins/ssh-keys/subcommands/add | 1 + 2 files changed, 6 insertions(+) diff --git a/plugins/ssh-keys/functions b/plugins/ssh-keys/functions index 24b5e6807..b6765691e 100755 --- a/plugins/ssh-keys/functions +++ b/plugins/ssh-keys/functions @@ -16,3 +16,8 @@ verify_ssh_key_exists() { declare desc="Test that public key exists" [[ -e ${DOKKU_ROOT}/.ssh/authorized_keys ]] || dokku_log_fail "No public keys found." } + +create_ssh_key_file() { + declare desc="Ensure the public key file exists" + touch "${DOKKU_ROOT}/.ssh/authorized_keys" +} diff --git a/plugins/ssh-keys/subcommands/add b/plugins/ssh-keys/subcommands/add index dac80e909..4424c3004 100755 --- a/plugins/ssh-keys/subcommands/add +++ b/plugins/ssh-keys/subcommands/add @@ -19,6 +19,7 @@ add_keys() { [[ -n "$name" && -n "$key_contents" ]] || dokku_log_fail "Two arguments are required if not piping, ie: dokku ssh-keys:add " local count="$(wc -l <<< "$key_contents")" [ "$count" -eq 1 ] || dokku_log_fail 'Too many keys provided, set one per invocation of dokku ssh-keys:add ' + create_ssh_key_file verify_ssh_key_exists echo "$key_contents" | sshcommand acl-add dokku "$name" || dokku_log_fail "sshcommand returned an error: $?" verify_ssh_key_file From 50b1c9d5c61135371ef77a33c009d21347629331 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 21 Nov 2016 19:33:50 -0700 Subject: [PATCH 043/295] Detect nginx versions that support HTTP/2 well Certain versions of nginx have bugs that prevent HTTP/2 from properly responding to all clients, thus causing applications to be unavailable. Closes #2435 --- plugins/nginx-vhosts/functions | 31 ++++++++++++++++++- .../nginx-vhosts/templates/nginx.conf.sigil | 4 +-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 2b6f6bc4b..8c88d9a48 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -148,7 +148,7 @@ get_custom_nginx_template() { } is_spdy_enabled() { - declare desc="detects whether the installed nginx version has spdy or http2 support" + declare desc="detects whether the installed nginx version has spdy support" local NGINX_VERSION="$1" local MAJOR_VERSION MINOR_VERSION PATCH_VERSION local HAS_SUPPORT=true @@ -174,6 +174,33 @@ is_spdy_enabled() { echo $HAS_SUPPORT } +is_http2_enabled() { + declare desc="detects whether the installed nginx version has http2 support" + local NGINX_VERSION="$1" + local MAJOR_VERSION MINOR_VERSION PATCH_VERSION + local HAS_SUPPORT=false + + if ! which nginx > /dev/null 2>&1; then + echo $HAS_SUPPORT + return + fi + + MAJOR_VERSION=$(echo "$NGINX_VERSION" | awk '{split($0,a,"."); print a[1]}') + MINOR_VERSION=$(echo "$NGINX_VERSION" | awk '{split($0,a,"."); print a[2]}') + PATCH_VERSION=$(echo "$NGINX_VERSION" | awk '{split($0,a,"."); print a[3]}') + if [[ "$MAJOR_VERSION" -ge "2" ]]; then + HAS_SUPPORT=true + elif [[ "$MAJOR_VERSION" -eq "1" ]]; then + if [[ "$MINOR_VERSION" -eq "11" ]] && [[ "$PATCH_VERSION" -ge "5" ]]; then + HAS_SUPPORT=true + elif [[ "$MINOR_VERSION" -ge "12" ]]; then + HAS_SUPPORT=true + fi + fi + + echo $HAS_SUPPORT +} + nginx_build_config() { declare desc="build nginx config to proxy app containers using sigil" local APP="$1"; verify_app_name "$APP" @@ -250,6 +277,7 @@ nginx_build_config() { local NGINX_VERSION="$(nginx -v 2>&1 | cut -d'/' -f 2)" local SPDY_SUPPORTED="$(is_spdy_enabled "$NGINX_VERSION")" + local HTTP2_SUPPORTED="$(is_http2_enabled "$NGINX_VERSION")" eval "$(config_export app "$APP")" local SIGIL_PARAMS=(-f $NGINX_TEMPLATE APP="$APP" DOKKU_ROOT="$DOKKU_ROOT" @@ -257,6 +285,7 @@ nginx_build_config() { DOKKU_APP_LISTENERS="$DOKKU_APP_LISTENERS" PASSED_LISTEN_IP_PORT="$PASSED_LISTEN_IP_PORT" SPDY_SUPPORTED="$SPDY_SUPPORTED" + HTTP2_SUPPORTED="$HTTP2_SUPPORTED" DOKKU_APP_LISTEN_PORT="$DOKKU_APP_LISTEN_PORT" DOKKU_APP_LISTEN_IP="$DOKKU_APP_LISTEN_IP" APP_SSL_PATH="$APP_SSL_PATH" SSL_INUSE="$SSL_INUSE" SSL_SERVER_NAME="$SSL_SERVER_NAME" NGINX_PORT="$NGINX_PORT" NGINX_SSL_PORT="$NGINX_SSL_PORT" RAW_TCP_PORTS="$RAW_TCP_PORTS" diff --git a/plugins/nginx-vhosts/templates/nginx.conf.sigil b/plugins/nginx-vhosts/templates/nginx.conf.sigil index 1d00745b0..6638afe37 100644 --- a/plugins/nginx-vhosts/templates/nginx.conf.sigil +++ b/plugins/nginx-vhosts/templates/nginx.conf.sigil @@ -38,8 +38,8 @@ server { } {{ else if eq $scheme "https"}} server { - listen [::]:{{ $listen_port }} ssl {{ if eq $.SPDY_SUPPORTED "true" }}spdy{{ else }}http2{{ end }}; - listen {{ $listen_port }} ssl {{ if eq $.SPDY_SUPPORTED "true" }}spdy{{ else }}http2{{ end }}; + listen [::]:{{ $listen_port }} ssl {{ if eq $.SPDY_SUPPORTED "true" }}spdy{{ else if eq $.HTTP2_SUPPORTED "true" }}http2{{ end }}; + listen {{ $listen_port }} ssl {{ if eq $.SPDY_SUPPORTED "true" }}spdy{{ else if eq $.HTTP2_SUPPORTED "true" }}http2{{ end }}; {{ if $.SSL_SERVER_NAME }}server_name {{ $.SSL_SERVER_NAME }}; {{ end }} {{ if $.NOSSL_SERVER_NAME }}server_name {{ $.NOSSL_SERVER_NAME }}; {{ end }} access_log /var/log/nginx/{{ $.APP }}-access.log; From 72aa611d2ab27d2b9cf8eab14bb39c6e69389933 Mon Sep 17 00:00:00 2001 From: Josh Manders Date: Tue, 22 Nov 2016 18:31:53 -0600 Subject: [PATCH 044/295] make features heading more clear [skip ci] --- docs/community/plugins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/community/plugins.md b/docs/community/plugins.md index 24179b69c..e0ff3eabb 100644 --- a/docs/community/plugins.md +++ b/docs/community/plugins.md @@ -163,7 +163,7 @@ Note: The following plugins have been supplied by our community and may not have [c77cbf1]: https://github.com/dokku/dokku/commit/c77cbf1d3ae07f0eafb85082ed7edcae9e836147 [28de3ec]: https://github.com/dokku/dokku/commit/28de3ecaa3231a223f83fd8d03f373308673bc40 -### Dokku Features +### Plugins Implementing new Features for Dokku | Plugin | Author | Compatibility | | ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- | From 0dfe92100f112ab56fd43885b9faabedfdc87937 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 24 Nov 2016 09:37:03 -0700 Subject: [PATCH 045/295] Update plugins.md [ci skip] --- docs/community/plugins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/community/plugins.md b/docs/community/plugins.md index e0ff3eabb..53ff17a73 100644 --- a/docs/community/plugins.md +++ b/docs/community/plugins.md @@ -163,7 +163,7 @@ Note: The following plugins have been supplied by our community and may not have [c77cbf1]: https://github.com/dokku/dokku/commit/c77cbf1d3ae07f0eafb85082ed7edcae9e836147 [28de3ec]: https://github.com/dokku/dokku/commit/28de3ecaa3231a223f83fd8d03f373308673bc40 -### Plugins Implementing new Features for Dokku +### Plugins Implementing New Dokku Functionality | Plugin | Author | Compatibility | | ------------------------------------------------------------------------------------------------- | --------------------- | --------------------- | From e4fee97d9b34a924f0770797d29e698c0bd1f472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=81ebkowski?= Date: Fri, 25 Nov 2016 16:03:44 +0100 Subject: [PATCH 046/295] update the dokku-acl link --- docs/community/plugins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/community/plugins.md b/docs/community/plugins.md index 53ff17a73..bbc29406d 100644 --- a/docs/community/plugins.md +++ b/docs/community/plugins.md @@ -220,7 +220,7 @@ Note: The following plugins have been supplied by our community and may not have | [Rollbar](https://github.com/iloveitaly/dokku-rollbar) | [iloveitaly][] | 0.5.0+ | | [Slack Notifications](https://github.com/ribot/dokku-slack) | [ribot][] | 0.4.0+ | | [Tor](https://github.com/michaelshobbs/dokku-tor) | [michaelshobbs][] | 0.4.0+ | -| [User ACL](https://github.com/mlebkowski/dokku-acl) | [Maciej Łebkowski][] | 0.4.0+ | +| [User ACL](https://github.com/dokku-community/dokku-acl) | [Maciej Łebkowski][] | 0.4.0+ | | [Webhooks](https://github.com/nickstenning/dokku-webhooks) | [nickstenning][] | 0.3.x | | [Wkhtmltopdf](https://github.com/mbriskar/dokku-wkhtmltopdf) | [mbriskar][] | 0.4.0+ | | [Wordpress Setup](https://github.com/dudagroup/dokku-wordpress-template) | [abossard][] | | From 608cdcf3c182ab348007805d162db7516e556105 Mon Sep 17 00:00:00 2001 From: Mriyam Tamuli Date: Sat, 26 Nov 2016 22:37:54 +0530 Subject: [PATCH 047/295] Adds the report subcommand to the apps plugin --- plugins/apps/subcommands/report | 73 +++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 plugins/apps/subcommands/report diff --git a/plugins/apps/subcommands/report b/plugins/apps/subcommands/report new file mode 100755 index 000000000..febcb5e18 --- /dev/null +++ b/plugins/apps/subcommands/report @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/apps/functions" + +report_single_app() { + local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" + verify_app_name "$APP" + local DOKKU_APP_CIDS=$(get_app_container_ids "$APP") + if [[ -n $DOKKU_APP_CIDS ]]; then + local cid + for CID in $DOKKU_APP_CIDS; do + local APP_CONTAINER_STATUS + local DOKKU_APP_CID + DOKKU_APP_CID=$CID + APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Status}}' "$CID") + done + fi + local flag_map=( + "--app-dir: $APP_DIR" + "--git-sha: $(GIT_DIR="$APP_DIR" git rev-parse --short HEAD 2> /dev/null || false)" + "--app-cid: ${DOKKU_APP_CID:0:12}" + "--status: $APP_CONTAINER_STATUS" + ) + + if [[ -z "$INFO_FLAG" ]]; then + dokku_log_info2 "$APP" + if (is_deployed "$APP"); then + for flag in "${flag_map[@]}"; do + key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')" + dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")" + done + else + echo "not deployed" + fi + else + local match=false; local value_exists=false + for flag in "${flag_map[@]}"; do + valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)" + if [[ "$flag" == "${INFO_FLAG}:"* ]]; then + value=${flag#*: } + size="${#value}" + if [[ "$size" -ne 0 ]]; then + echo "$value" && match=true && value_exists=true + else + match=true + fi + fi + done + if [[ "$match" == "true" ]]; then + [[ "$value_exists" == "true" ]] || dokku_log_fail "not_deployed" + else + dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}" + fi + fi +} + +apps_report_cmd() { + declare desc="shows reports for an app" + local cmd="apps:report" + local INSTALLED_APPS=$(dokku_apps) + local APP + + if [[ -z $2 ]]; then + for APP in $INSTALLED_APPS; do + report_single_app "$APP" + done + else + report_single_app "$2" "$3" + fi +} + +apps_report_cmd "$@" From fcba766a757333275262f3df3e919813ec45d6eb Mon Sep 17 00:00:00 2001 From: John Schulz Date: Sat, 26 Nov 2016 14:53:43 -0500 Subject: [PATCH 048/295] Add Dokku Wordpress plugin to docs. --- docs/community/plugins.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/community/plugins.md b/docs/community/plugins.md index bbc29406d..f3ca12059 100644 --- a/docs/community/plugins.md +++ b/docs/community/plugins.md @@ -224,6 +224,7 @@ Note: The following plugins have been supplied by our community and may not have | [Webhooks](https://github.com/nickstenning/dokku-webhooks) | [nickstenning][] | 0.3.x | | [Wkhtmltopdf](https://github.com/mbriskar/dokku-wkhtmltopdf) | [mbriskar][] | 0.4.0+ | | [Wordpress Setup](https://github.com/dudagroup/dokku-wordpress-template) | [abossard][] | | +| [Dokku Wordpress](https://github.com/dokku-community/dokku-wordpress) | [josegonzalez][] | 0.4.0+ | | [Access](https://github.com/mainto/dokku-access) | [mainto](https://github.com/mainto) | 0.4.0+ | ### Deprecated Plugins From 0d54423618a8e9c6a340e2686dddbdb78c69d68b Mon Sep 17 00:00:00 2001 From: John Schulz Date: Sat, 26 Nov 2016 15:19:02 -0500 Subject: [PATCH 049/295] Removing outdated dokku-wordpress-template plugin --- docs/community/plugins.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/community/plugins.md b/docs/community/plugins.md index f3ca12059..01d5d6a33 100644 --- a/docs/community/plugins.md +++ b/docs/community/plugins.md @@ -223,7 +223,6 @@ Note: The following plugins have been supplied by our community and may not have | [User ACL](https://github.com/dokku-community/dokku-acl) | [Maciej Łebkowski][] | 0.4.0+ | | [Webhooks](https://github.com/nickstenning/dokku-webhooks) | [nickstenning][] | 0.3.x | | [Wkhtmltopdf](https://github.com/mbriskar/dokku-wkhtmltopdf) | [mbriskar][] | 0.4.0+ | -| [Wordpress Setup](https://github.com/dudagroup/dokku-wordpress-template) | [abossard][] | | | [Dokku Wordpress](https://github.com/dokku-community/dokku-wordpress) | [josegonzalez][] | 0.4.0+ | | [Access](https://github.com/mainto/dokku-access) | [mainto](https://github.com/mainto) | 0.4.0+ | From f71611f5a1ebb6ae9158a94f253080f4cc9cf53f Mon Sep 17 00:00:00 2001 From: John Schulz Date: Sat, 26 Nov 2016 18:24:52 -0500 Subject: [PATCH 050/295] Updated author name to dokku-community --- docs/community/plugins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/community/plugins.md b/docs/community/plugins.md index 01d5d6a33..15fe1ab5c 100644 --- a/docs/community/plugins.md +++ b/docs/community/plugins.md @@ -223,7 +223,7 @@ Note: The following plugins have been supplied by our community and may not have | [User ACL](https://github.com/dokku-community/dokku-acl) | [Maciej Łebkowski][] | 0.4.0+ | | [Webhooks](https://github.com/nickstenning/dokku-webhooks) | [nickstenning][] | 0.3.x | | [Wkhtmltopdf](https://github.com/mbriskar/dokku-wkhtmltopdf) | [mbriskar][] | 0.4.0+ | -| [Dokku Wordpress](https://github.com/dokku-community/dokku-wordpress) | [josegonzalez][] | 0.4.0+ | +| [Dokku Wordpress](https://github.com/dokku-community/dokku-wordpress) | [dokku-community][] | 0.4.0+ | | [Access](https://github.com/mainto/dokku-access) | [mainto](https://github.com/mainto) | 0.4.0+ | ### Deprecated Plugins From 8d60d071df300e84e54e9f1d804891396aea48fe Mon Sep 17 00:00:00 2001 From: Mriyam Tamuli Date: Sun, 27 Nov 2016 19:24:57 +0530 Subject: [PATCH 051/295] Docs and help text for apps:report subcommand --- docs/deployment/application-management.md | 49 +++++++++++++++++++++++ plugins/apps/commands | 1 + 2 files changed, 50 insertions(+) diff --git a/docs/deployment/application-management.md b/docs/deployment/application-management.md index 9b44c3ebc..38d8993d2 100644 --- a/docs/deployment/application-management.md +++ b/docs/deployment/application-management.md @@ -7,6 +7,7 @@ apps # List your apps apps:create # Create a new app apps:destroy # Permanently destroy an app apps:rename # Rename an app +apps:report [] [] # Display report about an app ``` ## Usage @@ -112,3 +113,51 @@ Renaming node-js-app to io-js-app... done ``` This will copy all of your app's contents into a new app directory with the name of your choice, delete your old app, then rebuild the new version of the app and deploy it. All of your config variables, including database urls, will be preserved. + +### Displaying reports about an app + +> New as of 0.7.2 + +You can get a report about the deployed apps using the `apps:report` command: + +```shell +dokku apps:report +``` + +``` +=====> node-js-sample + App dir: /home/dokku/node-js-sample + Git sha: dbddc3f + App cid: 7b18489c98be + Status: running +=====> python-sample +not deployed +=====> ruby-sample + App dir: /home/dokku/ruby-sample + Git sha: a2d477c + App cid: 78a44d71012a + Status: running +``` + +You can run the command for a specific app also. + +```shell +dokku apps:report node-js-sample +``` + +``` +=====> node-js-sample + App dir: /home/dokku/node-js-sample + Git sha: dbddc3f + App cid: 7b18489c98be + Status: running +``` + +You can pass flags which will output only the value of the specific information you want. For example: +```shell +dokku apps:report node-js-sample --git-sha +``` + +``` +dbddc3f +``` diff --git a/plugins/apps/commands b/plugins/apps/commands index c46d255b1..60f2053b1 100755 --- a/plugins/apps/commands +++ b/plugins/apps/commands @@ -11,6 +11,7 @@ case "$1" in apps:create , Create a new app apps:destroy , Permanently destroy an app apps:rename , Rename an app + apps:report [] [], Display report about an app help_content } From d001fcc89609b7d69f5358d5330cf5cb464e2796 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Mon, 28 Nov 2016 02:53:46 +0000 Subject: [PATCH 052/295] Added certs default help function --- plugins/certs/commands | 23 +++-------------------- plugins/certs/functions | 24 ++++++++++++++++++++++++ plugins/certs/subcommands/default | 13 +++++++++++++ 3 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 plugins/certs/subcommands/default diff --git a/plugins/certs/commands b/plugins/certs/commands index c34b902c8..e04a558a3 100755 --- a/plugins/certs/commands +++ b/plugins/certs/commands @@ -1,31 +1,14 @@ #!/usr/bin/env bash [[ " help certs:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_AVAILABLE_PATH/certs/functions" case "$1" in help | certs:help) - help_content_func () { - declare desc="return certs plugin help content" - cat< CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin - certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate - certs:generate DOMAIN, Generate a key and certificate signing request (and self-signed certificate) - certs:info , Show certificate information for an ssl endpoint - certs:key CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate - certs:remove , Remove an SSL Endpoint from an app - certs:rollback , [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app - certs:update CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin -help_content - } + if [[ $1 = "certs:help" ]] ; then - echo -e 'Usage: dokku certs:COMMAND' - echo '' - echo 'Manage Dokku apps SSL (TLS) certs.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, + help_formatted else help_content_func fi diff --git a/plugins/certs/functions b/plugins/certs/functions index a130c993e..77d10de83 100755 --- a/plugins/certs/functions +++ b/plugins/certs/functions @@ -2,6 +2,30 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +help_formatted (){ + echo -e 'Usage: dokku certs:COMMAND' + echo '' + echo 'Manage Dokku apps SSL (TLS) certs.' + echo '' + echo 'Additional commands:' + help_content_func | sort | column -c2 -t -s, +} + +help_content_func () { + declare desc="return certs plugin help content" + cat< CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin + certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate + certs:generate DOMAIN, Generate a key and certificate signing request (and self-signed certificate) + certs:info , Show certificate information for an ssl endpoint + certs:key CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate + certs:remove , Remove an SSL Endpoint from an app + certs:rollback , [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app + certs:update CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin +help_content + } + is_ssl_enabled() { declare desc="returns 0 if ssl is enabled for given app" local APP=$1; verify_app_name "$APP" diff --git a/plugins/certs/subcommands/default b/plugins/certs/subcommands/default new file mode 100644 index 000000000..f9869973a --- /dev/null +++ b/plugins/certs/subcommands/default @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/certs/functions" + +certs_main_cmd() { + declare desc="return certs plugin help content" + local cmd="certs" + help_formatted +} + +certs_main_cmd "$@" + From a1d34773459dad6ccd8a17d1903b0a6765273e83 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 27 Nov 2016 19:55:02 -0700 Subject: [PATCH 053/295] docs: upgrade sshcommand and plugn as well [ci skip] --- docs/getting-started/upgrading.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started/upgrading.md b/docs/getting-started/upgrading.md index 667d668e4..8adc671db 100644 --- a/docs/getting-started/upgrading.md +++ b/docs/getting-started/upgrading.md @@ -26,7 +26,7 @@ If Dokku was installed via `apt-get install dokku` or `bootstrap.sh` (most commo sudo apt-get update dokku apps dokku ps:stop APP # repeat to shut down each running app -sudo apt-get install -qq -y dokku herokuish +sudo apt-get install -qq -y dokku herokuish sshcommand plugn dokku ps:rebuildall # rebuilds all applications ``` From 74db5b9d3bd57501227a8bbf71c5c09573af7127 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Mon, 28 Nov 2016 02:59:32 +0000 Subject: [PATCH 054/295] Added ssh-keys default help function --- plugins/ssh-keys/commands | 18 +++--------------- plugins/ssh-keys/functions | 19 +++++++++++++++++++ plugins/ssh-keys/subcommands/default | 12 ++++++++++++ 3 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 plugins/ssh-keys/subcommands/default diff --git a/plugins/ssh-keys/commands b/plugins/ssh-keys/commands index bfd36a0ce..a205bd054 100755 --- a/plugins/ssh-keys/commands +++ b/plugins/ssh-keys/commands @@ -1,26 +1,14 @@ #!/usr/bin/env bash [[ " help ssh-keys:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions" case "$1" in help | ssh-keys:help) - help_content_func () { - declare desc="return ssh-keys plugin help content" - cat< [/path/to/key], Add a new public key by pipe or path - ssh-keys:remove , Remove SSH public key by name -help_content - } + if [[ $1 = "ssh-keys:help" ]] ; then - echo -e 'Usage: dokku ssh-keys[:COMMAND]' - echo '' - echo 'Manage public ssh keys that are allowed to connect to Dokku' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, + help_formatted else help_content_func fi diff --git a/plugins/ssh-keys/functions b/plugins/ssh-keys/functions index 24b5e6807..262eacc44 100755 --- a/plugins/ssh-keys/functions +++ b/plugins/ssh-keys/functions @@ -2,6 +2,25 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +help_formatted (){ + echo -e 'Usage: dokku ssh-keys[:COMMAND]' + echo '' + echo 'Manage public ssh keys that are allowed to connect to Dokku' + echo '' + echo 'Additional commands:' + help_content_func | sort | column -c2 -t -s, +} + +help_content_func () { + declare desc="return ssh-keys plugin help content" + cat< [/path/to/key], Add a new public key by pipe or path + ssh-keys:remove , Remove SSH public key by name +help_content + } + verify_ssh_key_file() { declare desc="Test that public key is valid" [[ -s ${DOKKU_ROOT}/.ssh/authorized_keys ]] || dokku_log_fail "No public keys found." diff --git a/plugins/ssh-keys/subcommands/default b/plugins/ssh-keys/subcommands/default new file mode 100644 index 000000000..9b31420a5 --- /dev/null +++ b/plugins/ssh-keys/subcommands/default @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_AVAILABLE_PATH/config/functions" +source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions" + +ssh_keys_main_cmd() { + declare desc="return ssh-keys plugin help content" + local cmd="ssh-keys" + help_formatted +} + +ssh_keys_main_cmd "$@" From 810ba72879bbc0092929aa8c987c7cdeb3c3179f Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Mon, 28 Nov 2016 03:03:30 +0000 Subject: [PATCH 055/295] Added nginx default help function --- plugins/nginx-vhosts/commands | 18 +++--------------- plugins/nginx-vhosts/functions | 19 +++++++++++++++++++ plugins/nginx-vhosts/subcommands/default | 13 +++++++++++++ 3 files changed, 35 insertions(+), 15 deletions(-) create mode 100644 plugins/nginx-vhosts/subcommands/default diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index f7911fc25..2995231d7 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -1,26 +1,14 @@ #!/usr/bin/env bash [[ " help nginx:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" case "$1" in help | nginx:help) - help_content_func () { - declare desc="return nginx plugin help content" - cat<, (Re)builds nginx config for given app - nginx:access-logs [-t], Show the nginx access logs for an application (-t follows) - nginx:error-logs [-t], Show the nginx error logs for an application (-t follows) -help_content - } + if [[ $1 = "nginx:help" ]] ; then - echo -e 'Usage: dokku nginx[:COMMAND]' - echo '' - echo 'Interact with Dokku'"'"'s Nginx proxy.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, + help_formatted else help_content_func fi diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 2b6f6bc4b..e98e2e704 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -6,6 +6,25 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/domains/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" +help_formatted (){ + echo -e 'Usage: dokku nginx[:COMMAND]' + echo '' + echo 'Interact with Dokku'"'"'s Nginx proxy.' + echo '' + echo 'Additional commands:' + help_content_func | sort | column -c2 -t -s, +} + +help_content_func () { + declare desc="return nginx plugin help content" + cat<, (Re)builds nginx config for given app + nginx:access-logs [-t], Show the nginx access logs for an application (-t follows) + nginx:error-logs [-t], Show the nginx error logs for an application (-t follows) +help_content + } + validate_nginx() { declare desc="validate entire nginx config" set +e diff --git a/plugins/nginx-vhosts/subcommands/default b/plugins/nginx-vhosts/subcommands/default new file mode 100644 index 000000000..30cb86061 --- /dev/null +++ b/plugins/nginx-vhosts/subcommands/default @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/config/functions" +source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" + +nginx_main_cmd() { + declare desc="display nginx plugin help content" + local cmd="nginx" + help_formatted +} + +nginx_main_cmd "$@" From 42947934520d1ca0f151650fbb52f5256f47cfe7 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Mon, 28 Nov 2016 03:06:30 +0000 Subject: [PATCH 056/295] Added storage default help function --- plugins/storage/commands | 17 ++--------------- plugins/storage/functions | 19 +++++++++++++++++++ plugins/storage/subcommands/default | 12 ++++++++++++ 3 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 plugins/storage/subcommands/default diff --git a/plugins/storage/commands b/plugins/storage/commands index 337f07473..03d73207f 100755 --- a/plugins/storage/commands +++ b/plugins/storage/commands @@ -1,26 +1,13 @@ #!/usr/bin/env bash [[ " storage:help help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" case "$1" in help | storage:help) - help_content_func () { - declare desc="return storage plugin help content" - cat<, List bind mounts for app's container(s) (host:container) - storage:mount , Create a new bind mount - storage:unmount , Remove an existing bind mount -help_content - } if [[ $1 = "shell:help" ]] ; then - echo -e 'Usage: dokku storage:COMMAND' - echo '' - echo 'Mount local volume / directories inside containers.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, + help_formatted else help_content_func fi diff --git a/plugins/storage/functions b/plugins/storage/functions index 767059f13..02752b0bc 100755 --- a/plugins/storage/functions +++ b/plugins/storage/functions @@ -2,6 +2,25 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +help_formatted (){ + echo -e 'Usage: dokku storage:COMMAND' + echo '' + echo 'Mount local volume / directories inside containers.' + echo '' + echo 'Additional commands:' + help_content_func | sort | column -c2 -t -s, +} + +help_content_func () { + declare desc="return storage plugin help content" + cat<, List bind mounts for app's container(s) (host:container) + storage:mount , Create a new bind mount + storage:unmount , Remove an existing bind mount +help_content + } + verify_paths() { declare desc="verifies storage paths" echo "$1" | grep -qe '^/.*\:/' || dokku_log_fail "Storage path must be two valid paths divided by colon." diff --git a/plugins/storage/subcommands/default b/plugins/storage/subcommands/default new file mode 100644 index 000000000..764a9f5a0 --- /dev/null +++ b/plugins/storage/subcommands/default @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" + +storage_main_cmd() { + declare desc="Display storage plugin help content" + local cmd="storage" + help_formatted +} + +storage_main_cmd "$@" From d04b0f7cca2561666e1e9b300452f3925c551d66 Mon Sep 17 00:00:00 2001 From: Mriyam Tamuli Date: Mon, 28 Nov 2016 08:46:30 +0530 Subject: [PATCH 057/295] Use dokku helpers to output to stderr --- plugins/apps/subcommands/report | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/apps/subcommands/report b/plugins/apps/subcommands/report index febcb5e18..9a3963f68 100755 --- a/plugins/apps/subcommands/report +++ b/plugins/apps/subcommands/report @@ -31,7 +31,7 @@ report_single_app() { dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")" done else - echo "not deployed" + dokku_log_fail "not deployed" fi else local match=false; local value_exists=false @@ -48,7 +48,7 @@ report_single_app() { fi done if [[ "$match" == "true" ]]; then - [[ "$value_exists" == "true" ]] || dokku_log_fail "not_deployed" + [[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed" else dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}" fi From 86b5b71f2868ae687a8cd3324fdbcbe33e7b0e65 Mon Sep 17 00:00:00 2001 From: Simon Kotwicz Date: Sat, 26 Nov 2016 23:38:58 -0500 Subject: [PATCH 058/295] fix some typos in deployment docs --- docs/deployment/one-off-processes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deployment/one-off-processes.md b/docs/deployment/one-off-processes.md index b40dc7bf4..3210a6f7c 100644 --- a/docs/deployment/one-off-processes.md +++ b/docs/deployment/one-off-processes.md @@ -29,7 +29,7 @@ dokku run my-app console If you want to remove the container after a command has started, you can run the following command: ```shell -# keep `run` containers around +# don't keep `run` containers around dokku config:set --global DOKKU_RM_CONTAINER=1 # revert the above setting and keep containers around From cce2a41db6b06037396773f2da459a7dd1740589 Mon Sep 17 00:00:00 2001 From: John Schulz Date: Sun, 27 Nov 2016 23:34:08 -0500 Subject: [PATCH 059/295] Forgot to map dokku-community github user. [ci skip] --- docs/community/plugins.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/community/plugins.md b/docs/community/plugins.md index 15fe1ab5c..b1b5c0a1f 100644 --- a/docs/community/plugins.md +++ b/docs/community/plugins.md @@ -69,6 +69,7 @@ Note: The following plugins have been supplied by our community and may not have [cu12]: https://github.com/cu12 [darkpixel]: https://github.com/darkpixel [dokku]: https://github.com/dokku +[dokku-community]: https://github.com/dokku-community [dyson]: https://github.com/dyson [F4-Group]: https://github.com/F4-Group [fermuch]: https://github.com/fermuch From 6a9b3f6df2688a539e0b5e09146e31db59cab65b Mon Sep 17 00:00:00 2001 From: Ilya Semenov Date: Mon, 28 Nov 2016 21:55:59 +0700 Subject: [PATCH 060/295] Add domains:set and domains:set-global commands --- docs/configuration/domains.md | 7 +++- docs/development/plugin-triggers.md | 2 +- plugins/domains/commands | 2 ++ plugins/domains/functions | 42 +++++++++++++++++++++-- plugins/domains/subcommands/set | 16 +++++++++ plugins/domains/subcommands/set-global | 15 +++++++++ tests/unit/20_domains.bats | 46 ++++++++++++++++++++++++-- 7 files changed, 123 insertions(+), 7 deletions(-) create mode 100755 plugins/domains/subcommands/set create mode 100755 plugins/domains/subcommands/set-global diff --git a/docs/configuration/domains.md b/docs/configuration/domains.md index fdda6a71f..6703a3743 100644 --- a/docs/configuration/domains.md +++ b/docs/configuration/domains.md @@ -3,14 +3,16 @@ > New as of 0.3.10 ``` +domains [] # List domains domains:add [ ...] # Add domains to app domains:add-global [ ...] # Add global domain names -domains [] # List domains domains:clear # Clear all domains for app domains:disable # Disable VHOST support domains:enable # Enable VHOST support domains:remove [ ...] # Remove domains from app domains:remove-global [ ...] # Remove global domain names +domains:set [ ...] # Set domains for app +domains:set-global [ ...] # Set global domain names ``` > Adding a domain before deploying an application will result in port mappings being set. This may cause issues for applications that use non-standard ports, as those will not be automatically detected. Please refer to the [proxy documentation](/dokku/advanced-usage/proxy-management/) for information as to how to reconfigure the mappings. @@ -68,6 +70,9 @@ dokku domains:clear myapp # remove a custom domain from app dokku domains:remove myapp example.com + +# set all custom domains for app +dokku domains:set myapp example.com example.org ``` ## Default site diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index d8d8fdced..c763ab867 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -467,7 +467,7 @@ curl "http://httpstat.us/200" ### `post-domains-update` - Description: Allows you to run commands once the domain for an application has been updated. It also sends in the command that has been used. This can be "add", "clear" or "remove". The third argument will be the optional list of domains -- Invoked by: `dokku domains:add`, `dokku domains:clear`, `dokku domains:remove` +- Invoked by: `dokku domains:add`, `dokku domains:clear`, `dokku domains:remove`, `dokku domains:set` - Arguments: `$APP` `action name` `domains` - Example: diff --git a/plugins/domains/commands b/plugins/domains/commands index 7504678f7..5b2018369 100755 --- a/plugins/domains/commands +++ b/plugins/domains/commands @@ -15,6 +15,8 @@ case "$1" in domains:enable , Enable VHOST support domains:remove [ ...], Remove domains from app domains:remove-global [ ...], Remove global domain names + domains:set [ ...], Set domains for app + domains:set-global [ ...], Set global domain names help_content } diff --git a/plugins/domains/functions b/plugins/domains/functions index b66531f5f..51abd1a16 100755 --- a/plugins/domains/functions +++ b/plugins/domains/functions @@ -85,7 +85,7 @@ domains_add() { fi done - if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]];then + if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then domains_enable "$APP" --no-restart fi @@ -105,12 +105,34 @@ domains_remove() { plugn trigger post-domains-update "$APP" "remove" "$@" } +domains_set() { + declare desc="set list of domains for app" + verify_app_name "$1" + local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" + + shift 1 + for DOMAIN in "$@"; do + if ! (is_valid_hostname "$DOMAIN"); then + dokku_log_fail "$DOMAIN is invalid. exiting..." + fi + done + + echo "$*" | tr " " "\n" > "$APP_VHOST_PATH" + dokku_log_info1 "Set $* for $APP" + + if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then + domains_enable "$APP" --no-restart + fi + + plugn trigger post-domains-update "$APP" "set" "$@" +} + domains_disable() { declare desc="disable domains/VHOST support" verify_app_name "$1" local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" - if [[ "$(is_app_vhost_enabled "$APP")" == "true" ]];then + if [[ "$(is_app_vhost_enabled "$APP")" == "true" ]]; then disable_app_vhost "$APP" else dokku_log_info1 "domains (VHOST) support is already disabled for app ($APP)" @@ -123,7 +145,7 @@ domains_enable() { local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" local DEFAULT_VHOSTS="$(get_default_vhosts "$APP")" - if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]];then + if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then if [[ -n "$DEFAULT_VHOSTS" ]]; then echo "$DEFAULT_VHOSTS" > "$APP_VHOST_PATH" fi @@ -163,3 +185,17 @@ domains_remove_global() { dokku_log_info1 "Removed $DOMAIN" done } + +domains_set_global() { + declare desc="set list of global domains" + local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST" + + for DOMAIN in "$@"; do + if ! (is_valid_hostname "$DOMAIN"); then + dokku_log_fail "$DOMAIN is invalid. exiting..." + fi + done + + echo "$*" | tr " " "\n" > "$GLOBAL_VHOST_PATH" + dokku_log_info1 "Set $*" +} diff --git a/plugins/domains/subcommands/set b/plugins/domains/subcommands/set new file mode 100755 index 000000000..6a7ba21e8 --- /dev/null +++ b/plugins/domains/subcommands/set @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/domains/functions" + +domains_set_cmd() { + declare desc="set domains for app via command line" + local cmd="domains:set" + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" + [[ -z $3 ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 $2 [ ...]" + + shift 1 + domains_set "$@" +} + +domains_set_cmd "$@" diff --git a/plugins/domains/subcommands/set-global b/plugins/domains/subcommands/set-global new file mode 100755 index 000000000..665990104 --- /dev/null +++ b/plugins/domains/subcommands/set-global @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/domains/functions" + +domains_set_global_cmd() { + declare desc="set global domain names via command line" + local cmd="domains:set-global" + [[ -z $2 ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 [ ...]" + + shift 1 + domains_set_global "$@" +} + +domains_set_global_cmd "$@" diff --git a/tests/unit/20_domains.bats b/tests/unit/20_domains.bats index 631eea8f9..dbbafae4e 100644 --- a/tests/unit/20_domains.bats +++ b/tests/unit/20_domains.bats @@ -146,6 +146,27 @@ teardown() { refute_line *.dokku.me } +@test "(domains) domains:set" { + run dokku domains:add $TEST_APP www.test.app.dokku.me test.app.dokku.me + echo "output: "$output + echo "status: "$status + assert_success + + run dokku domains:set $TEST_APP 2.app.dokku.me a--domain.with--hyphens + echo "output: "$output + echo "status: "$status + assert_success + + run dokku domains $TEST_APP + echo "output: "$output + echo "status: "$status + assert_success + refute_line www.test.app.dokku.me + refute_line test.app.dokku.me + assert_line 2.app.dokku.me + assert_line a--domain.with--hyphens +} + @test "(domains) domains:clear" { run dokku domains:add $TEST_APP test.app.dokku.me echo "output: "$output @@ -217,13 +238,34 @@ teardown() { assert_success dokku domains:setup $TEST_APP - run bash -c "dokku domains $TEST_APP | grep -q ${TEST_APP}.global1.dokku.me" + + run dokku domains $TEST_APP + echo "output: "$output + echo "status: "$status + assert_success + assert_line ${TEST_APP}.global1.dokku.me + assert_line ${TEST_APP}.global2.dokku.me +} + +@test "(domains) domains:set-global" { + run dokku domains:add-global global1.dokku.me global2.dokku.me echo "output: "$output echo "status: "$status assert_success - run bash -c "dokku domains $TEST_APP | grep -q ${TEST_APP}.global2.dokku.me" + run dokku domains:set-global global3.dokku.me global4.dokku.me echo "output: "$output echo "status: "$status assert_success + + dokku domains:setup $TEST_APP + + run dokku domains $TEST_APP + echo "output: "$output + echo "status: "$status + assert_success + refute_line ${TEST_APP}.global1.dokku.me + refute_line ${TEST_APP}.global2.dokku.me + assert_line ${TEST_APP}.global3.dokku.me + assert_line ${TEST_APP}.global4.dokku.me } From 45f8b8ccc857234835e8254c736718f9fd9d0cb5 Mon Sep 17 00:00:00 2001 From: Mriyam Tamuli Date: Thu, 1 Dec 2016 11:39:18 +0530 Subject: [PATCH 061/295] Adds the report subcommand to the ps plugin --- plugins/ps/commands | 1 + plugins/ps/subcommands/report | 104 ++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100755 plugins/ps/subcommands/report diff --git a/plugins/ps/commands b/plugins/ps/commands index 6f705f448..c5ee28b84 100755 --- a/plugins/ps/commands +++ b/plugins/ps/commands @@ -13,6 +13,7 @@ case "$1" in ps:stop , Stop app container(s) ps:rebuild , Rebuild an app from source ps:rebuildall, Rebuild all apps from source + ps:report, Shows report of all processes in app container(s) ps:restart , Restart app container(s) ps:restartall, Restart all deployed app containers ps:restore, Start previously running apps e.g. after reboot diff --git a/plugins/ps/subcommands/report b/plugins/ps/subcommands/report new file mode 100755 index 000000000..e80f009ba --- /dev/null +++ b/plugins/ps/subcommands/report @@ -0,0 +1,104 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/docker-options/functions" +source "$PLUGIN_AVAILABLE_PATH/ps/functions" + +ps_report_single_app() { + local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" + local passed_phases="deploy" + local APP_CIDS=$(get_app_container_ids "$APP"); local PROCS=0; local RUNNING="" + + for CID in $APP_CIDS; do + local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" 2>/dev/null || true) + if [[ "$APP_CONTAINER_STATUS" == "true" ]]; then RUNNING+="0"; else RUNNING+="1"; fi + PROCS=$((PROCS + 1)) + done + + if [[ "${#RUNNING}" -eq 0 ]] || [[ "${#RUNNING}" -ne 0 ]] && [[ "$RUNNING" != *"0"* ]]; then + RUNNING="false" + elif [[ "$RUNNING" != *"1"* ]] && [[ "${#RUNNING}" -ne 0 ]]; then + RUNNING="true"; + else + RUNNING="mixed" + fi + + if (is_deployed "$APP"); then DEPLOYED="true"; else DEPLOYED="false"; fi + RESTARTPOLICY=$(get_restart_policies "$(get_phase_file_path "$passed_phases")") + + local CONTAINER_FILES="$(find "$DOKKU_ROOT/$APP" -maxdepth 1 -name "CONTAINER.*" -printf "%f\n" 2>/dev/null | sort -t . -k 2 -n | xargs)" + local CONTAINER_FILE + local DOKKU_APP_RESTORE=$(config_get "$APP" DOKKU_APP_RESTORE || true) + local STATUSES=() + if [[ "$DOKKU_APP_RESTORE" != 0 ]]; then RESTORE="true"; else RESTORE="false"; fi + for CONTAINER_FILE in $CONTAINER_FILES; do + CID=$(<$DOKKU_ROOT/$APP/$CONTAINER_FILE) + local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID") + STATUSES+=("${CONTAINER_FILE#*.}:$APP_CONTAINER_STATUS#${CID:0:12}") + done + local flag_map=( + "--processes: $PROCS" + "--deployed: $DEPLOYED" + "--running: $RUNNING" + "--restore: $RESTORE" + "--restart-policy: $RESTARTPOLICY" + ) + + if [[ -z "$INFO_FLAG" ]]; then + dokku_log_info2 "$APP" + for flag in "${flag_map[@]}"; do + key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')" + dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")" + done + for STATUS in "${STATUSES[@]}"; do + name=${STATUS%:*} + value=${STATUS#*:} + status=${value%#*} + cid=${value#*#} + dokku_log_verbose "$(printf "%-20s %-10s (CID: %s)" "Status $name" "$status" "$cid")" + done + else + local match=false; local value_exists=false + for STATUS in "${STATUSES[@]}"; do + name=${STATUS%:*} + value=${STATUS#*:} + status=${value%#*} + cid=${value#*#} + status_flag="--status-$name" + flag_map+=("$status_flag: $status") + done + for flag in "${flag_map[@]}"; do + valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)" + if [[ "$flag" == "${INFO_FLAG}:"* ]]; then + value=${flag#*: } + size="${#value}" + if [[ "$size" -ne 0 ]]; then + echo "$value" && match=true && value_exists=true + else + match=true + fi + fi + done + if [[ "$match" == "true" ]]; then + [[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed" + else + dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}" + fi + fi +} + +ps_report_cmd() { + declare desc="shows reports for an app" + local cmd="ps:report" + local INSTALLED_APPS=$(dokku_apps); local APP + + if [[ -z $2 ]]; then + for APP in $INSTALLED_APPS; do + ps_report_single_app "$APP" + done + else + ps_report_single_app "$2" "$3" + fi +} + +ps_report_cmd "$@" From d4b85999af2e2fa3541a958ab3a81c1f694677d5 Mon Sep 17 00:00:00 2001 From: Ilya Semenov Date: Thu, 1 Dec 2016 13:21:57 +0700 Subject: [PATCH 062/295] Clarify instructions for arranging default nginx site --- docs/configuration/domains.md | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/docs/configuration/domains.md b/docs/configuration/domains.md index 6703a3743..9313a6258 100644 --- a/docs/configuration/domains.md +++ b/docs/configuration/domains.md @@ -77,7 +77,9 @@ dokku domains:set myapp example.com example.org ## Default site -By default, Dokku will route any received request with an unknown HOST header value to the lexicographically first site in the nginx config stack. If this is not the desired behavior, you may want to add the following configuration to the global nginx configuration. This will catch all unknown HOST header values and return a `410 Gone` response. You can replace the `return 410;` with `return 444;` which will cause nginx to not respond to requests that do not match known domains (connection refused). +By default, Dokku will route any received request with an unknown HOST header value to the lexicographically first site in the nginx config stack. If this is not the desired behavior, you may want to add the following configuration to the global nginx configuration. + +Create the file at `/etc/nginx/conf.d/00-default-vhost.conf`: ```nginx server { @@ -90,17 +92,8 @@ server { } ``` -You may also wish to use a separate vhost in your `/etc/nginx/sites-enabled` directory. To do so, create the vhost in that directory as `/etc/nginx/sites-enabled/00-default.conf`. You will also need to change two lines in the main `nginx.conf`: +This will catch all unknown HOST header values and return a `410 Gone` response. You can replace the `return 410;` with `return 444;` which will cause nginx to not respond to requests that do not match known domains (connection refused). -```nginx -# Swap both conf.d include line and the sites-enabled include line. From: -include /etc/nginx/conf.d/*.conf; -include /etc/nginx/sites-enabled/*; - -# to the following - -include /etc/nginx/sites-enabled/*; -include /etc/nginx/conf.d/*.conf; -``` +The configuration file must be loaded before `/etc/nginx/conf.d/dokku.conf`, so it can not be arranged as a vhost in `/etc/nginx/sites-enabled` that is only processed afterwards. Alternatively, you may push an app to your Dokku host with a name like "00-default". As long as it lists first in `ls /home/dokku/*/nginx.conf | head`, it will be used as the default nginx vhost. From a574a6db1c672af2965e0d249dcf14f600f722b1 Mon Sep 17 00:00:00 2001 From: Mriyam Tamuli Date: Fri, 2 Dec 2016 00:00:10 +0530 Subject: [PATCH 063/295] Quotes unquoted variable --- plugins/ps/subcommands/report | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ps/subcommands/report b/plugins/ps/subcommands/report index e80f009ba..e637ceab2 100755 --- a/plugins/ps/subcommands/report +++ b/plugins/ps/subcommands/report @@ -32,7 +32,7 @@ ps_report_single_app() { local STATUSES=() if [[ "$DOKKU_APP_RESTORE" != 0 ]]; then RESTORE="true"; else RESTORE="false"; fi for CONTAINER_FILE in $CONTAINER_FILES; do - CID=$(<$DOKKU_ROOT/$APP/$CONTAINER_FILE) + CID=$(< "$DOKKU_ROOT/$APP/$CONTAINER_FILE") local APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID") STATUSES+=("${CONTAINER_FILE#*.}:$APP_CONTAINER_STATUS#${CID:0:12}") done From 71ee7e73a7b81f339721a75114fa49c0713dadfe Mon Sep 17 00:00:00 2001 From: Stefan Gloutnikov Date: Fri, 2 Dec 2016 12:53:39 +0200 Subject: [PATCH 064/295] Update DreamHost Cloud install instructions. --- docs/getting-started/install/dreamhost.md | 26 +++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/getting-started/install/dreamhost.md b/docs/getting-started/install/dreamhost.md index 296f6cc87..8fa721a05 100644 --- a/docs/getting-started/install/dreamhost.md +++ b/docs/getting-started/install/dreamhost.md @@ -4,7 +4,7 @@ Cloud-init script can be used to automate installation of Dokku on Dreamhost (or any other OpenStack-compatible cloud with minimal changes). -A new server can be created on DreamHost Cloud from the command line +A new server instance can be created on DreamHost Cloud from the command line using openstack client or from the web UI and with the same command use a cloud-init script to install Dokku. Install the [openstack cli](https://help.dreamhost.com/hc/en-us/articles/216185658-How-to-Install-the-OpenStack-command-line-clients), @@ -18,18 +18,18 @@ source openrc.sh # Set the environment variables for DreamHost Cloud ``` This allows openstack client to connect to DreamHost API endpoints. -The command below creates a new server named `my-dokku-instance` based -on Ubuntu 14.04, with 2GB RAM and 1CPU (the flavor called -`semisonic`), opening network port access to http and ssh (the +The command below creates a new server instance named `my-dokku-instance` +based on Ubuntu 14.04, with 2GB RAM and 1CPU (the flavor called +`supersonic`), opening network port access to http and ssh (the `default` security group), and the name of the chosen SSH key. This key will be automatically added to the new server in the -`authorized_keys` for the default SSH user (`dhc-user`), and it will +`authorized_keys` for the default SSH user (`ubuntu`), and it will be reused by Dokku. ```sh openstack server create \ --image Ubuntu-14.04 \ - --flavor gp1.semisonic \ + --flavor gp1.supersonic \ --security-group default \ --key-name $YOUR_SSH_KEYNAME \ --user-data dokku-cloudinit.sh \ @@ -178,8 +178,20 @@ debconf_selections: | # set the domain name of the new Dokku server dokku dokku/hostname string $YOUR_FULL_QUALIFIED_DOMAIN # this copies over the public SSH key assigned to the server - dokku dokku/key_file string /home/dhc-user/.ssh/authorized_keys + dokku dokku/key_file string /home/ubuntu/.ssh/authorized_keys packages: - dokku ``` + +Shortly after running the create command you will get a confirmation that the +instance has been created, and after about a minute it should be ready to login. +Check the IP of the instance through the web UI or by running: + +```sh +nova list +``` + +SSH with the `ubuntu` username and the public key previously added. +Keep in mind that if you logged in quick enough dokku might still be installing +in the background, and not be ready. The installation takes a few minutes. From 0fed122a992d30e84ab4920aa564d67e8da3c0ab Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Sat, 3 Dec 2016 19:07:34 +0000 Subject: [PATCH 065/295] Revert "Added storage default help function" This reverts commit 42947934520d1ca0f151650fbb52f5256f47cfe7. --- plugins/storage/commands | 17 +++++++++++++++-- plugins/storage/functions | 19 ------------------- plugins/storage/subcommands/default | 12 ------------ 3 files changed, 15 insertions(+), 33 deletions(-) delete mode 100644 plugins/storage/subcommands/default diff --git a/plugins/storage/commands b/plugins/storage/commands index 03d73207f..337f07473 100755 --- a/plugins/storage/commands +++ b/plugins/storage/commands @@ -1,13 +1,26 @@ #!/usr/bin/env bash [[ " storage:help help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" case "$1" in help | storage:help) + help_content_func () { + declare desc="return storage plugin help content" + cat<, List bind mounts for app's container(s) (host:container) + storage:mount , Create a new bind mount + storage:unmount , Remove an existing bind mount +help_content + } if [[ $1 = "shell:help" ]] ; then - help_formatted + echo -e 'Usage: dokku storage:COMMAND' + echo '' + echo 'Mount local volume / directories inside containers.' + echo '' + echo 'Additional commands:' + help_content_func | sort | column -c2 -t -s, else help_content_func fi diff --git a/plugins/storage/functions b/plugins/storage/functions index 02752b0bc..767059f13 100755 --- a/plugins/storage/functions +++ b/plugins/storage/functions @@ -2,25 +2,6 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -help_formatted (){ - echo -e 'Usage: dokku storage:COMMAND' - echo '' - echo 'Mount local volume / directories inside containers.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, -} - -help_content_func () { - declare desc="return storage plugin help content" - cat<, List bind mounts for app's container(s) (host:container) - storage:mount , Create a new bind mount - storage:unmount , Remove an existing bind mount -help_content - } - verify_paths() { declare desc="verifies storage paths" echo "$1" | grep -qe '^/.*\:/' || dokku_log_fail "Storage path must be two valid paths divided by colon." diff --git a/plugins/storage/subcommands/default b/plugins/storage/subcommands/default deleted file mode 100644 index 764a9f5a0..000000000 --- a/plugins/storage/subcommands/default +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" - -storage_main_cmd() { - declare desc="Display storage plugin help content" - local cmd="storage" - help_formatted -} - -storage_main_cmd "$@" From 010c89e8104dafa0b2b9fcfae6d008af33306d64 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Sat, 3 Dec 2016 19:08:02 +0000 Subject: [PATCH 066/295] Revert "Added ssh-keys default help function" This reverts commit 74db5b9d3bd57501227a8bbf71c5c09573af7127. --- plugins/ssh-keys/commands | 18 +++++++++++++++--- plugins/ssh-keys/functions | 19 ------------------- plugins/ssh-keys/subcommands/default | 12 ------------ 3 files changed, 15 insertions(+), 34 deletions(-) delete mode 100644 plugins/ssh-keys/subcommands/default diff --git a/plugins/ssh-keys/commands b/plugins/ssh-keys/commands index a205bd054..bfd36a0ce 100755 --- a/plugins/ssh-keys/commands +++ b/plugins/ssh-keys/commands @@ -1,14 +1,26 @@ #!/usr/bin/env bash [[ " help ssh-keys:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions" case "$1" in help | ssh-keys:help) - + help_content_func () { + declare desc="return ssh-keys plugin help content" + cat< [/path/to/key], Add a new public key by pipe or path + ssh-keys:remove , Remove SSH public key by name +help_content + } if [[ $1 = "ssh-keys:help" ]] ; then - help_formatted + echo -e 'Usage: dokku ssh-keys[:COMMAND]' + echo '' + echo 'Manage public ssh keys that are allowed to connect to Dokku' + echo '' + echo 'Additional commands:' + help_content_func | sort | column -c2 -t -s, else help_content_func fi diff --git a/plugins/ssh-keys/functions b/plugins/ssh-keys/functions index 262eacc44..24b5e6807 100755 --- a/plugins/ssh-keys/functions +++ b/plugins/ssh-keys/functions @@ -2,25 +2,6 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -help_formatted (){ - echo -e 'Usage: dokku ssh-keys[:COMMAND]' - echo '' - echo 'Manage public ssh keys that are allowed to connect to Dokku' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, -} - -help_content_func () { - declare desc="return ssh-keys plugin help content" - cat< [/path/to/key], Add a new public key by pipe or path - ssh-keys:remove , Remove SSH public key by name -help_content - } - verify_ssh_key_file() { declare desc="Test that public key is valid" [[ -s ${DOKKU_ROOT}/.ssh/authorized_keys ]] || dokku_log_fail "No public keys found." diff --git a/plugins/ssh-keys/subcommands/default b/plugins/ssh-keys/subcommands/default deleted file mode 100644 index 9b31420a5..000000000 --- a/plugins/ssh-keys/subcommands/default +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_AVAILABLE_PATH/config/functions" -source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions" - -ssh_keys_main_cmd() { - declare desc="return ssh-keys plugin help content" - local cmd="ssh-keys" - help_formatted -} - -ssh_keys_main_cmd "$@" From 0062227c579689727e0399aae09a9b538dfc0c0c Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Sat, 3 Dec 2016 19:08:25 +0000 Subject: [PATCH 067/295] Revert "Added certs default help function" This reverts commit d001fcc89609b7d69f5358d5330cf5cb464e2796. --- plugins/certs/commands | 23 ++++++++++++++++++++--- plugins/certs/functions | 24 ------------------------ plugins/certs/subcommands/default | 13 ------------- 3 files changed, 20 insertions(+), 40 deletions(-) delete mode 100644 plugins/certs/subcommands/default diff --git a/plugins/certs/commands b/plugins/certs/commands index e04a558a3..c34b902c8 100755 --- a/plugins/certs/commands +++ b/plugins/certs/commands @@ -1,14 +1,31 @@ #!/usr/bin/env bash [[ " help certs:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_AVAILABLE_PATH/certs/functions" case "$1" in help | certs:help) - + help_content_func () { + declare desc="return certs plugin help content" + cat< CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin + certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate + certs:generate DOMAIN, Generate a key and certificate signing request (and self-signed certificate) + certs:info , Show certificate information for an ssl endpoint + certs:key CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate + certs:remove , Remove an SSL Endpoint from an app + certs:rollback , [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app + certs:update CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin +help_content + } if [[ $1 = "certs:help" ]] ; then - help_formatted + echo -e 'Usage: dokku certs:COMMAND' + echo '' + echo 'Manage Dokku apps SSL (TLS) certs.' + echo '' + echo 'Additional commands:' + help_content_func | sort | column -c2 -t -s, else help_content_func fi diff --git a/plugins/certs/functions b/plugins/certs/functions index 77d10de83..a130c993e 100755 --- a/plugins/certs/functions +++ b/plugins/certs/functions @@ -2,30 +2,6 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -help_formatted (){ - echo -e 'Usage: dokku certs:COMMAND' - echo '' - echo 'Manage Dokku apps SSL (TLS) certs.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, -} - -help_content_func () { - declare desc="return certs plugin help content" - cat< CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin - certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate - certs:generate DOMAIN, Generate a key and certificate signing request (and self-signed certificate) - certs:info , Show certificate information for an ssl endpoint - certs:key CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate - certs:remove , Remove an SSL Endpoint from an app - certs:rollback , [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app - certs:update CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin -help_content - } - is_ssl_enabled() { declare desc="returns 0 if ssl is enabled for given app" local APP=$1; verify_app_name "$APP" diff --git a/plugins/certs/subcommands/default b/plugins/certs/subcommands/default deleted file mode 100644 index f9869973a..000000000 --- a/plugins/certs/subcommands/default +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_AVAILABLE_PATH/certs/functions" - -certs_main_cmd() { - declare desc="return certs plugin help content" - local cmd="certs" - help_formatted -} - -certs_main_cmd "$@" - From 1f47803324b08708212ccd553b73c75098cf83a4 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Sat, 3 Dec 2016 19:27:49 +0000 Subject: [PATCH 068/295] Added certs plugin default to info --- plugins/certs/functions | 33 +++++++++++++++++++++++++++++++ plugins/certs/subcommands/default | 12 +++++++++++ plugins/certs/subcommands/info | 32 ------------------------------ 3 files changed, 45 insertions(+), 32 deletions(-) create mode 100644 plugins/certs/subcommands/default diff --git a/plugins/certs/functions b/plugins/certs/functions index a130c993e..55c0ea953 100755 --- a/plugins/certs/functions +++ b/plugins/certs/functions @@ -2,6 +2,39 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +certs_info_cmd() { + # This is here because it's used in both the info and the default + declare desc="prints SSL certificate info for app" + local cmd="certs:info" + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" + verify_app_name "$2" + local APP="$2"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" + + if [[ -n "$APP_SSL_PATH" ]]; then + dokku_log_info1 "Fetching SSL Endpoint info for $APP..." + dokku_log_info1 "Certificate details:" + dokku_log_info2 "Common Name(s): " + + for domain in $(get_ssl_hostnames "$APP" | xargs); do + dokku_log_info2 " $domain" + done + + dokku_log_info2 "Expires At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')" + dokku_log_info2 "Issuer: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")" + dokku_log_info2 "Starts At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')" + dokku_log_info2 "Subject: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")" + local SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)" + if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then + local SSL_SELF_SIGNED="verified by a certificate authority." + else + local SSL_SELF_SIGNED="self signed." + fi + dokku_log_info2 "SSL certificate is $SSL_SELF_SIGNED" + else + dokku_log_info1 "$APP does not have an SSL endpoint" + fi +} + is_ssl_enabled() { declare desc="returns 0 if ssl is enabled for given app" local APP=$1; verify_app_name "$APP" diff --git a/plugins/certs/subcommands/default b/plugins/certs/subcommands/default new file mode 100644 index 000000000..5eabd33b8 --- /dev/null +++ b/plugins/certs/subcommands/default @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/certs/functions" + +certs_main_cmd() { + declare desc="an alias for certs:info" + local cmd="certs" + certs_info_cmd "$@" +} + +certs_main_cmd "$@" diff --git a/plugins/certs/subcommands/info b/plugins/certs/subcommands/info index cfda760d8..77fd90b7c 100755 --- a/plugins/certs/subcommands/info +++ b/plugins/certs/subcommands/info @@ -3,36 +3,4 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/certs/functions" -certs_info_cmd() { - declare desc="prints SSL certificate info for app" - local cmd="certs:info" - [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" - verify_app_name "$2" - local APP="$2"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" - - if [[ -n "$APP_SSL_PATH" ]]; then - dokku_log_info1 "Fetching SSL Endpoint info for $APP..." - dokku_log_info1 "Certificate details:" - dokku_log_info2 "Common Name(s): " - - for domain in $(get_ssl_hostnames "$APP" | xargs); do - dokku_log_info2 " $domain" - done - - dokku_log_info2 "Expires At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')" - dokku_log_info2 "Issuer: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")" - dokku_log_info2 "Starts At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')" - dokku_log_info2 "Subject: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")" - local SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)" - if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then - local SSL_SELF_SIGNED="verified by a certificate authority." - else - local SSL_SELF_SIGNED="self signed." - fi - dokku_log_info2 "SSL certificate is $SSL_SELF_SIGNED" - else - dokku_log_info1 "$APP does not have an SSL endpoint" - fi -} - certs_info_cmd "$@" From f2a4f61920f2a99bdb5d9765e12bad6c9963ec40 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Sat, 3 Dec 2016 19:36:11 +0000 Subject: [PATCH 069/295] Added ssh-keys plugin default to list --- plugins/ssh-keys/functions | 7 +++++++ plugins/ssh-keys/subcommands/default | 12 ++++++++++++ plugins/ssh-keys/subcommands/list | 7 ------- 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 plugins/ssh-keys/subcommands/default diff --git a/plugins/ssh-keys/functions b/plugins/ssh-keys/functions index 24b5e6807..767f4ae11 100755 --- a/plugins/ssh-keys/functions +++ b/plugins/ssh-keys/functions @@ -2,6 +2,13 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +list_ssh_keys() { + declare desc="List ssh key hashes" + local cmd="ssh-keys:list" + verify_ssh_key_file + sshcommand list dokku +} + verify_ssh_key_file() { declare desc="Test that public key is valid" [[ -s ${DOKKU_ROOT}/.ssh/authorized_keys ]] || dokku_log_fail "No public keys found." diff --git a/plugins/ssh-keys/subcommands/default b/plugins/ssh-keys/subcommands/default new file mode 100644 index 000000000..abdbaa619 --- /dev/null +++ b/plugins/ssh-keys/subcommands/default @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions" + +ssh_keys_main_cmd() { + declare desc="an alias for ssh-keys:list" + local cmd="ssh-keys" + list_ssh_keys +} + +ssh_keys_main_cmd "$@" \ No newline at end of file diff --git a/plugins/ssh-keys/subcommands/list b/plugins/ssh-keys/subcommands/list index ce485bbd6..fb78c5e2a 100755 --- a/plugins/ssh-keys/subcommands/list +++ b/plugins/ssh-keys/subcommands/list @@ -3,11 +3,4 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions" -list_ssh_keys() { - declare desc="List ssh key hashes" - local cmd="ssh-keys:list" - verify_ssh_key_file - sshcommand list dokku -} - list_ssh_keys "$@" From 58d774a316020ee96fcadbe9479106dd109152e0 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Sat, 3 Dec 2016 19:38:48 +0000 Subject: [PATCH 070/295] Added default for storage plugin to list --- plugins/storage/functions | 10 ++++++++++ plugins/storage/subcommands/default | 13 +++++++++++++ plugins/storage/subcommands/list | 9 --------- 3 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 plugins/storage/subcommands/default diff --git a/plugins/storage/functions b/plugins/storage/functions index 767059f13..d65daeb26 100755 --- a/plugins/storage/functions +++ b/plugins/storage/functions @@ -2,6 +2,16 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +storage_list_cmd() { + declare desc="List all bound mounts" + local cmd="storage:list" + local passed_phases="deploy" + [[ ! $2 ]] && dokku_log_fail "storage:list requires an app to list." + verify_app_name "$2" && local APP="$2" + echo "$APP volume bind-mounts:" + get_bind_mounts "$(get_phase_file_path "$passed_phases")" +} + verify_paths() { declare desc="verifies storage paths" echo "$1" | grep -qe '^/.*\:/' || dokku_log_fail "Storage path must be two valid paths divided by colon." diff --git a/plugins/storage/subcommands/default b/plugins/storage/subcommands/default new file mode 100644 index 000000000..194ef7942 --- /dev/null +++ b/plugins/storage/subcommands/default @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" + +storage_main_cmd() { + declare desc="an alias for storage:list" + local cmd="storage" + storage_list_cmd "$@" +} + +storage_main_cmd "$@" diff --git a/plugins/storage/subcommands/list b/plugins/storage/subcommands/list index ecaab29b0..a16999a38 100755 --- a/plugins/storage/subcommands/list +++ b/plugins/storage/subcommands/list @@ -4,14 +4,5 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" -storage_list_cmd() { - declare desc="List all bound mounts" - local cmd="storage:list" - local passed_phases="deploy" - [[ ! $2 ]] && dokku_log_fail "storage:list requires an app to list." - verify_app_name "$2" && local APP="$2" - echo "$APP volume bind-mounts:" - get_bind_mounts "$(get_phase_file_path "$passed_phases")" -} storage_list_cmd "$@" From 23c71c8d6951b5877aa9d4a503d39c9b9e26a5f0 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 3 Dec 2016 20:23:19 -0700 Subject: [PATCH 071/295] Update docs regarding if the ssh-keys plugin should be in use [ci skip] --- docs/deployment/user-management.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deployment/user-management.md b/docs/deployment/user-management.md index b8a4c4b70..17e8f924b 100644 --- a/docs/deployment/user-management.md +++ b/docs/deployment/user-management.md @@ -12,7 +12,7 @@ When pushing to Dokku, ssh key based authorization is the preferred authenticati Users in Dokku are managed via the `~/dokku/.ssh/authorized_keys` file. It is **highly** recommended that you follow the steps below to manage users on a Dokku server. -> Users of older versions of Dokku should use the `sshcommand` binary to manage keys. Please refer to the Dokku documentation for your version for more details. +> Users of older versions of Dokku may use the `sshcommand` binary to manage keys instead of the `ssh-keys` plugin. Please refer to the Dokku documentation for your version for more details. ## Usage From da44c240d79a7344a10d6c0435050b02605ce045 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 4 Dec 2016 15:20:09 -0700 Subject: [PATCH 072/295] Use same check for dockerfile apps during a tar build --- plugins/tar/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tar/functions b/plugins/tar/functions index 93b024645..a9c8aa049 100755 --- a/plugins/tar/functions +++ b/plugins/tar/functions @@ -24,7 +24,7 @@ tar_build() { tar -x -C "$TAR_BUILD_TMP_WORK_DIR" -f "$DOKKU_ROOT/$APP/src.tar" --strip-components="$BOGUS_PARTS" chmod -R u+r "$TAR_BUILD_TMP_WORK_DIR" - if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]]; then + if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]] && [[ -z $(config_get "$APP" BUILDPACK_URL || true) ]]; then plugn trigger pre-receive-app "$APP" "dockerfile" "$TAR_BUILD_TMP_WORK_DIR" dokku_receive "$APP" "dockerfile" "$TAR_BUILD_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/" else From 88f2dc7f607d737f15cbb1f1e1e97ca45f08bc1b Mon Sep 17 00:00:00 2001 From: Josh Manders Date: Tue, 6 Dec 2016 21:04:37 -0600 Subject: [PATCH 073/295] Docs: Fix #2521 --- README.md | 2 +- docs/getting-started/advanced-installation.md | 4 ++-- docs/getting-started/installation.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f52a76cb1..5a31bd058 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. To install the latest stable release, you can run the following commands as a user that has access to `sudo`: - wget https://raw.githubusercontent.com/dokku/dokku/v0.7.2/bootstrap.sh + wget https://raw.githubusercontent.com/dokku/dokku/v0.7.2/bootstrap.sh; sudo DOKKU_TAG=v0.7.2 bash bootstrap.sh You can then proceed to the ip address or domain name associated with your server to complete the web-based installation. diff --git a/docs/getting-started/advanced-installation.md b/docs/getting-started/advanced-installation.md index 975ea7129..100ee7f2e 100644 --- a/docs/getting-started/advanced-installation.md +++ b/docs/getting-started/advanced-installation.md @@ -4,7 +4,7 @@ You can always install Dokku straight from the latest - potentially unstable - m ```shell # using a branch results in installing from source -wget https://raw.githubusercontent.com/dokku/dokku/master/bootstrap.sh +wget https://raw.githubusercontent.com/dokku/dokku/master/bootstrap.sh; sudo DOKKU_BRANCH=master bash bootstrap.sh ``` @@ -29,7 +29,7 @@ sudo SSHCOMMAND_URL=https://raw.githubusercontent.com/yourusername/sshcommand/ma The bootstrap script allows the Dokku repository URL to be overridden to bootstrap a host from your own clone of Dokku using the `DOKKU_REPO` environment variable. Example: ```shell -wget https://raw.githubusercontent.com/dokku/dokku/master/bootstrap.sh +wget https://raw.githubusercontent.com/dokku/dokku/master/bootstrap.sh; chmod +x bootstrap.sh sudo DOKKU_REPO=https://github.com/yourusername/dokku.git DOKKU_BRANCH=master ./bootstrap.sh ``` diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 4dd29ebb0..d3715a566 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -21,7 +21,7 @@ To install the latest stable version of dokku, you can run the following shell c ```shell # for debian systems, installs Dokku via apt-get -wget https://raw.githubusercontent.com/dokku/dokku/v0.7.2/bootstrap.sh +wget https://raw.githubusercontent.com/dokku/dokku/v0.7.2/bootstrap.sh; sudo DOKKU_TAG=v0.7.2 bash bootstrap.sh ``` From eae3d463df7f7c67279e329e9eef0aa81078b371 Mon Sep 17 00:00:00 2001 From: Turtle Kalus Date: Sun, 4 Dec 2016 18:49:25 -0800 Subject: [PATCH 074/295] Fix for dokku/dokku#2474 `SSL_SERVER_NAME` should contain items found in the ssl certs (E.G. CommonName and AltNames), but not already in the `NOSSL_SERVER_NAME` list. That will avoid the dups in the `nginx.conf` and kill the warning initially cited in dokku/dokku#2474 --- plugins/nginx-vhosts/functions | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 8c88d9a48..c68d9aa66 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -272,7 +272,14 @@ nginx_build_config() { else local SSL_VHOSTS=$(< "$DOKKU_ROOT/HOSTNAME") fi - local SSL_SERVER_NAME=$(echo "$SSL_VHOSTS" | xargs) + local SSL_SERVER_NAME + local host + for host in $SSL_VHOSTS; do + # SSL_SERVER_NAME should only contain items not in NOSSL_SERVER_NAME + if [[ ! $NOSSL_SERVER_NAME =~ (^|[[:space:]])$host($|[[:space:]]) ]]; then + SSL_SERVER_NAME="${host}${SSL_SERVER_NAME:+ $SSL_SERVER_NAME}" + fi + done fi local NGINX_VERSION="$(nginx -v 2>&1 | cut -d'/' -f 2)" From dda58a82f92a04720337b5a2fb008c3d03f88653 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Fri, 9 Dec 2016 03:46:25 -0600 Subject: [PATCH 075/295] Plugin-triggers typo: dokkku -> dokku --- docs/development/plugin-triggers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index c763ab867..d1431a5d4 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -27,7 +27,7 @@ There are a number of plugin-related triggers. These can be optionally implement The following plugin triggers describe those available to a Dokku installation. As well, there is an example for each trigger that you can use as templates for your own plugin development. -> The example plugin trigger code is not guaranteed to be implemented as in within dokkku, and are merely simplified examples. Please look at the Dokku source for larger, more in-depth examples. +> The example plugin trigger code is not guaranteed to be implemented as in within dokku, and are merely simplified examples. Please look at the Dokku source for larger, more in-depth examples. ### `post-config-update` From c9a1a94cc190d2c6f2326eabd6103e71635f1358 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Fri, 9 Dec 2016 15:05:51 -0800 Subject: [PATCH 076/295] actually fail deploy when app.json script fails --- plugins/00_dokku-standard/exec-app-json-scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/00_dokku-standard/exec-app-json-scripts b/plugins/00_dokku-standard/exec-app-json-scripts index b6a6870de..7bb3e5809 100755 --- a/plugins/00_dokku-standard/exec-app-json-scripts +++ b/plugins/00_dokku-standard/exec-app-json-scripts @@ -42,7 +42,7 @@ execute_script() { COMMAND+=" rm -rf /tmp/cache ; " COMMAND+=" ln -sf /cache /tmp/cache ; " COMMAND+=" fi ; " - COMMAND+=" $SCRIPT_CMD ;" + COMMAND+=" $SCRIPT_CMD || exit 1;" COMMAND+=" if [[ -d '/cache' ]]; then " COMMAND+=" echo removing installation cache... ; " COMMAND+=" rm -f /tmp/cache ; " From 49b01143a083d3edbd2f36e3907e5ca6cf7f9e65 Mon Sep 17 00:00:00 2001 From: Mriyam Tamuli Date: Sun, 11 Dec 2016 13:26:07 +0530 Subject: [PATCH 077/295] Correct apps:report to not exit if one app is not deployed --- plugins/apps/subcommands/report | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/apps/subcommands/report b/plugins/apps/subcommands/report index 9a3963f68..6a915cc94 100755 --- a/plugins/apps/subcommands/report +++ b/plugins/apps/subcommands/report @@ -5,6 +5,11 @@ source "$PLUGIN_AVAILABLE_PATH/apps/functions" report_single_app() { local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" + local use_echo; + if [[ "$INFO_FLAG" == "true" ]]; then + use_echo=true + INFO_FLAG="" + fi verify_app_name "$APP" local DOKKU_APP_CIDS=$(get_app_container_ids "$APP") if [[ -n $DOKKU_APP_CIDS ]]; then @@ -31,7 +36,11 @@ report_single_app() { dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")" done else - dokku_log_fail "not deployed" + if [[ "$use_echo" ]]; then + echo "not deployed" + else + dokku_log_fail "not deployed" + fi fi else local match=false; local value_exists=false @@ -63,7 +72,7 @@ apps_report_cmd() { if [[ -z $2 ]]; then for APP in $INSTALLED_APPS; do - report_single_app "$APP" + report_single_app "$APP" "true" done else report_single_app "$2" "$3" From cda2e3d048688d844ed577c1cddbf2932461a309 Mon Sep 17 00:00:00 2001 From: Slava Vishnyakov Date: Thu, 15 Dec 2016 14:19:41 +0300 Subject: [PATCH 078/295] Re-deploying/restarting --- docs/deployment/application-deployment.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/deployment/application-deployment.md b/docs/deployment/application-deployment.md index e96df35ba..1ea084291 100644 --- a/docs/deployment/application-deployment.md +++ b/docs/deployment/application-deployment.md @@ -101,6 +101,15 @@ If you only want to rebuild and tag a container, you can skip the deployment pha dokku config:set ruby-rails-sample DOKKU_SKIP_DEPLOY=true ``` +### Re-Deploying / restarting + +If you need to re-deploy (or restart) your app: + +```shell +# on your Dokku host +dokku deploy ruby-rails-sample +``` + ### Deploying with private git submodules Dokku uses git locally (i.e. not a docker image) to build its own copy of your app repo, including submodules. This is done as the `dokku` user. Therefore, in order to deploy private git submodules, you'll need to drop your deploy key in `/home/dokku/.ssh/` and potentially add github.com (or your VCS host key) into `/home/dokku/.ssh/known_hosts`. The following test should help confirm you've done it correctly. From de9f495e2cf0f5e88e56c3e97acb12580602811b Mon Sep 17 00:00:00 2001 From: Slava Vishnyakov Date: Thu, 15 Dec 2016 14:22:52 +0300 Subject: [PATCH 079/295] storage needs deploy too --- docs/advanced-usage/persistent-storage.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/advanced-usage/persistent-storage.md b/docs/advanced-usage/persistent-storage.md index 88348290f..719db87a1 100644 --- a/docs/advanced-usage/persistent-storage.md +++ b/docs/advanced-usage/persistent-storage.md @@ -25,6 +25,12 @@ dokku storage:mount app-name /var/lib/dokku/data/storage:/storage Dokku will then mount the shared contents of `/var/lib/dokku/data/storage` to `/storage` inside the container. +You will also need to restart the deployment, to activate storage: + +```shell +dokku deploy app-name +``` + A more complete workflow may require making a custom directory for your application and mounting it within your `/app/storage` directory instead. The mount point is *not* relative to your application's working directory, and is instead relative to the root of the container. ```shell From 42b1666fbe7bc47686db764be62012c3ee3f9a92 Mon Sep 17 00:00:00 2001 From: Slava Vishnyakov Date: Thu, 15 Dec 2016 17:15:00 +0300 Subject: [PATCH 080/295] Update persistent-storage.md --- docs/advanced-usage/persistent-storage.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/advanced-usage/persistent-storage.md b/docs/advanced-usage/persistent-storage.md index 719db87a1..b9d9fd0b2 100644 --- a/docs/advanced-usage/persistent-storage.md +++ b/docs/advanced-usage/persistent-storage.md @@ -25,10 +25,10 @@ dokku storage:mount app-name /var/lib/dokku/data/storage:/storage Dokku will then mount the shared contents of `/var/lib/dokku/data/storage` to `/storage` inside the container. -You will also need to restart the deployment, to activate storage: +You will also need to restart the deployment, to activate storage (see [ps](http://dokku.viewdocs.io/dokku/deployment/process-management/)): ```shell -dokku deploy app-name +dokku ps:rebuild app-name ``` A more complete workflow may require making a custom directory for your application and mounting it within your `/app/storage` directory instead. The mount point is *not* relative to your application's working directory, and is instead relative to the root of the container. From 88f37028a2686ef2a24ef81fa44bfa2a00ce7c57 Mon Sep 17 00:00:00 2001 From: Slava Vishnyakov Date: Thu, 15 Dec 2016 17:15:38 +0300 Subject: [PATCH 081/295] Update application-deployment.md --- docs/deployment/application-deployment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/deployment/application-deployment.md b/docs/deployment/application-deployment.md index 1ea084291..89ef0d22b 100644 --- a/docs/deployment/application-deployment.md +++ b/docs/deployment/application-deployment.md @@ -103,11 +103,11 @@ dokku config:set ruby-rails-sample DOKKU_SKIP_DEPLOY=true ### Re-Deploying / restarting -If you need to re-deploy (or restart) your app: +If you need to re-deploy (or restart) your app (see [ps](http://dokku.viewdocs.io/dokku/deployment/process-management/)): ```shell # on your Dokku host -dokku deploy ruby-rails-sample +dokku ps:rebuild ruby-rails-sample ``` ### Deploying with private git submodules From a53c61b4d892d27ba0b44fa4612f85a20b06e4f4 Mon Sep 17 00:00:00 2001 From: Slava Vishnyakov Date: Thu, 15 Dec 2016 18:46:16 +0300 Subject: [PATCH 082/295] Update persistent-storage.md --- docs/advanced-usage/persistent-storage.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/advanced-usage/persistent-storage.md b/docs/advanced-usage/persistent-storage.md index b9d9fd0b2..a34f7bd2a 100644 --- a/docs/advanced-usage/persistent-storage.md +++ b/docs/advanced-usage/persistent-storage.md @@ -25,7 +25,8 @@ dokku storage:mount app-name /var/lib/dokku/data/storage:/storage Dokku will then mount the shared contents of `/var/lib/dokku/data/storage` to `/storage` inside the container. -You will also need to restart the deployment, to activate storage (see [ps](http://dokku.viewdocs.io/dokku/deployment/process-management/)): +Once you have mounted persistent storage, you will also need to restart the application. See the +[process scaling documentation](/dokku/deployment/process-management) for more information. ```shell dokku ps:rebuild app-name From f100a3ee4c857334201a1fcd95d972b3c24b54f4 Mon Sep 17 00:00:00 2001 From: Slava Vishnyakov Date: Thu, 15 Dec 2016 18:46:52 +0300 Subject: [PATCH 083/295] Update application-deployment.md --- docs/deployment/application-deployment.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/deployment/application-deployment.md b/docs/deployment/application-deployment.md index 89ef0d22b..138d4f4d0 100644 --- a/docs/deployment/application-deployment.md +++ b/docs/deployment/application-deployment.md @@ -103,7 +103,8 @@ dokku config:set ruby-rails-sample DOKKU_SKIP_DEPLOY=true ### Re-Deploying / restarting -If you need to re-deploy (or restart) your app (see [ps](http://dokku.viewdocs.io/dokku/deployment/process-management/)): +If you need to re-deploy (or restart) your app. See the +[process scaling documentation](/dokku/deployment/process-management) for more information. ```shell # on your Dokku host From 4c86f888161313b13be6f361488089bdf56622f7 Mon Sep 17 00:00:00 2001 From: Slava Vishnyakov Date: Thu, 15 Dec 2016 18:47:58 +0300 Subject: [PATCH 084/295] Update application-deployment.md --- docs/deployment/application-deployment.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/deployment/application-deployment.md b/docs/deployment/application-deployment.md index 138d4f4d0..e9ec691d2 100644 --- a/docs/deployment/application-deployment.md +++ b/docs/deployment/application-deployment.md @@ -103,14 +103,15 @@ dokku config:set ruby-rails-sample DOKKU_SKIP_DEPLOY=true ### Re-Deploying / restarting -If you need to re-deploy (or restart) your app. See the -[process scaling documentation](/dokku/deployment/process-management) for more information. +If you need to re-deploy (or restart) your app: ```shell # on your Dokku host dokku ps:rebuild ruby-rails-sample ``` +(See the [process scaling documentation](/dokku/deployment/process-management) for more information. + ### Deploying with private git submodules Dokku uses git locally (i.e. not a docker image) to build its own copy of your app repo, including submodules. This is done as the `dokku` user. Therefore, in order to deploy private git submodules, you'll need to drop your deploy key in `/home/dokku/.ssh/` and potentially add github.com (or your VCS host key) into `/home/dokku/.ssh/known_hosts`. The following test should help confirm you've done it correctly. From c5117cb42f566968fa323aa62e8e17913e0efe0d Mon Sep 17 00:00:00 2001 From: Slava Vishnyakov Date: Thu, 15 Dec 2016 18:48:22 +0300 Subject: [PATCH 085/295] Update application-deployment.md --- docs/deployment/application-deployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deployment/application-deployment.md b/docs/deployment/application-deployment.md index e9ec691d2..903add341 100644 --- a/docs/deployment/application-deployment.md +++ b/docs/deployment/application-deployment.md @@ -110,7 +110,7 @@ If you need to re-deploy (or restart) your app: dokku ps:rebuild ruby-rails-sample ``` -(See the [process scaling documentation](/dokku/deployment/process-management) for more information. +See the [process scaling documentation](/dokku/deployment/process-management) for more information. ### Deploying with private git submodules From 3f219a3f8e980ab4586db356637caaf4bd2ef825 Mon Sep 17 00:00:00 2001 From: facundomedica Date: Fri, 16 Dec 2016 15:17:36 -0300 Subject: [PATCH 086/295] Solution to problem related to firewall Resume: Ubuntu 16.04 seems to have the firewall enabled by default, which prohibits the access to apps. Original issue: https://github.com/dokku/dokku/issues/2532 --- docs/getting-started/troubleshooting.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/getting-started/troubleshooting.md b/docs/getting-started/troubleshooting.md index 48cdb40e8..799821377 100644 --- a/docs/getting-started/troubleshooting.md +++ b/docs/getting-started/troubleshooting.md @@ -174,3 +174,16 @@ echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf ``` *** + +__Symptom:__ I successfully deployed my application with no deployment errors but I'm receiving Connection Timeout when attempting to access the application. + +__Solution:__ + +This can occur if Dokku is running on a system with a firewall enabled (some OS versions like Ubuntu 16.04 have this enabled by default). The follow script will disable the firewall. + +```shell +sudo ufw disable +``` + +*** + From 127dd7334fcf6736675424b4c37e102809740ef9 Mon Sep 17 00:00:00 2001 From: facundomedica Date: Fri, 16 Dec 2016 15:52:19 -0300 Subject: [PATCH 087/295] Update troubleshooting.md --- docs/getting-started/troubleshooting.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/getting-started/troubleshooting.md b/docs/getting-started/troubleshooting.md index 799821377..5933ea97a 100644 --- a/docs/getting-started/troubleshooting.md +++ b/docs/getting-started/troubleshooting.md @@ -179,7 +179,13 @@ __Symptom:__ I successfully deployed my application with no deployment errors bu __Solution:__ -This can occur if Dokku is running on a system with a firewall enabled (some OS versions like Ubuntu 16.04 have this enabled by default). The follow script will disable the firewall. +This can occur if Dokku is running on a system with a firewall like ufw enabled (some OS versions like Ubuntu 16.04 have this enabled by default). You can check if this is your case by running the following script: + +```shell +sudo ufw status +``` + +If the previous script returned `Status: active` and a list of ports, ufw is enabled and is probably the cause of the symptom described above. To disable it, run: ```shell sudo ufw disable From 171e9625f652959e90e1485651dd74438f59eeb7 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Wed, 28 Dec 2016 07:32:19 +0200 Subject: [PATCH 088/295] Fix dokku-installer.service removal --- debian/postrm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/postrm b/debian/postrm index 859fec170..2ddc84de9 100755 --- a/debian/postrm +++ b/debian/postrm @@ -11,13 +11,13 @@ readonly DOKKU_LIB_ROOT="${DOKKU_LIB_PATH:-/var/lib/dokku}" readonly DOKKU_LOGS_DIR="${DOKKU_LOGS_DIR:="/var/log/dokku"}" main() { - if [[ -f /etc/systemd/system/dokku-installer.conf ]] || [[ -f /etc/init/dokku-installer.conf ]]; then + if [[ -f /etc/systemd/system/dokku-installer.service ]] || [[ -f /etc/init/dokku-installer.conf ]]; then service dokku-installer stop || true fi rm -f /etc/init/dokku-installer.conf rm -f /etc/init/dokku-redeploy.conf - rm -f /etc/systemd/system/dokku-installer.conf + rm -f /etc/systemd/system/dokku-installer.service rm -f /etc/systemd/system/dokku-redeploy.service rm -f /etc/update-motd.d/99-dokku From 7af00ef744c80a930f8fca7db6595c42a8917c34 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 3 Jan 2017 09:36:37 -0800 Subject: [PATCH 089/295] update herokuish to 0.3.29 --- deb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deb.mk b/deb.mk index f9f9c52ac..ec970000b 100644 --- a/deb.mk +++ b/deb.mk @@ -1,6 +1,6 @@ HEROKUISH_DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku' HEROKUISH_REPO_NAME ?= gliderlabs/herokuish -HEROKUISH_VERSION ?= 0.3.19 +HEROKUISH_VERSION ?= 0.3.24 HEROKUISH_ARCHITECTURE = amd64 HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb From 6c8c4de3981c60948f939897a458267576f095a8 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 8 Jan 2017 05:24:03 -0700 Subject: [PATCH 090/295] feat: skip checking for /etc/os-release On OSX, this file does not exist [ci skip] --- dokku | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dokku b/dokku index b26f6c799..05ae39621 100755 --- a/dokku +++ b/dokku @@ -9,7 +9,7 @@ export DOKKU_ROOT=${DOKKU_ROOT:=~dokku} export DOKKU_DISTRO # shellcheck disable=SC1091 -DOKKU_DISTRO=$(. /etc/os-release && echo "$ID") +DOKKU_DISTRO=$(. /etc/os-release > /dev/null 2>&1 || true ; echo "$ID") export DOKKU_IMAGE=${DOKKU_IMAGE:="gliderlabs/herokuish"} export DOKKU_LIB_ROOT=${DOKKU_LIB_PATH:="/var/lib/dokku"} From f3113296eedca00549fad128d4f415580f4b7cdb Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 8 Jan 2017 05:24:34 -0700 Subject: [PATCH 091/295] fix: ensure man-db is installed when generating man pages [ci skip] --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fb703f02b..4eeeda230 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,7 @@ copyfiles: chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} || true $(MAKE) addman -addman: help2man +addman: help2man man-db mkdir -p /usr/local/share/man/man1 help2man -Nh help -v version -n "configure and get information from your dokku installation" -o /usr/local/share/man/man1/dokku.1 dokku mandb From 6ab9e04ba65d4ed31b9a2ce1f7fa858db75b9b13 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 8 Jan 2017 16:41:05 -0700 Subject: [PATCH 092/295] fix: allow overriding both DOKKU_VERSION and GIT_REV via environment variables --- Makefile | 6 +++++- arch.mk | 4 ++++ deb.mk | 8 ++++++++ rpm.mk | 10 +++++++++- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4eeeda230..64c86a5f3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -DOKKU_VERSION = master +DOKKU_VERSION ?= master SSHCOMMAND_URL ?= https://raw.githubusercontent.com/dokku/sshcommand/v0.6.0/sshcommand PLUGN_URL ?= https://github.com/dokku/plugn/releases/download/v0.2.2/plugn_0.2.2_linux_x86_64.tgz @@ -76,7 +76,11 @@ addman: help2man man-db mandb version: +ifeq ($(DOKKU_VERSION),master) git describe --tags > ~dokku/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ~dokku/VERSION +else + echo $(DOKKU_VERSION) > ~dokku/VERSION +endif plugin-dependencies: plugn sudo -E dokku plugin:install-dependencies --core diff --git a/arch.mk b/arch.mk index c9b9159a5..c10f17186 100644 --- a/arch.mk +++ b/arch.mk @@ -22,7 +22,11 @@ arch-setup: arch-dokku: arch-setup echo "-> Update package sums, create metadata file and test the build of the package" +ifeq ($(DOKKU_VERSION),master) git describe --tags > /tmp/VERSION +else + echo $(DOKKU_VERSION) > /tmp/VERSION +endif cat /tmp/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/STABLE_VERSION sed -i -e "s/pkgver=.*/pkgver=`cat /tmp/STABLE_VERSION`/" /dokku-arch/PKGBUILD cd /dokku-arch; updpkgsums; mksrcinfo; makepkg -fd diff --git a/deb.mk b/deb.mk index ec970000b..eac9a9ced 100644 --- a/deb.mk +++ b/deb.mk @@ -128,14 +128,22 @@ deb-dokku: cp /usr/local/share/man/man1/dokku.1 /tmp/build/usr/share/man/man1/dokku.1 gzip -9 /tmp/build/usr/share/man/man1/dokku.1 cp contrib/dokku-installer.py /tmp/build/usr/share/dokku/contrib +ifeq ($(DOKKU_VERSION),master) git describe --tags > /tmp/build/var/lib/dokku/VERSION +else + echo $(DOKKU_VERSION) > /tmp/build/var/lib/dokku/VERSION +endif cat /tmp/build/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build/var/lib/dokku/STABLE_VERSION ifneq (,$(findstring false,$(IS_RELEASE))) sed -i.bak -e "s/^/`date +%s`:/" /tmp/build/var/lib/dokku/STABLE_VERSION && rm /tmp/build/var/lib/dokku/STABLE_VERSION.bak endif rm /tmp/build/DEBIAN/lintian-overrides mv debian/lintian-overrides /tmp/build/usr/share/lintian/overrides/dokku +ifdef DOKKU_GIT_REV + echo "$(DOKKU_GIT_REV)" > /tmp/build/var/lib/dokku/GIT_REV +else git rev-parse HEAD > /tmp/build/var/lib/dokku/GIT_REV +endif sed -i "s/^Version: .*/Version: `cat /tmp/build/var/lib/dokku/STABLE_VERSION`/g" /tmp/build/DEBIAN/control dpkg-deb --build /tmp/build "/tmp/dokku_`cat /tmp/build/var/lib/dokku/STABLE_VERSION`_$(DOKKU_ARCHITECTURE).deb" lintian "/tmp/dokku_`cat /tmp/build/var/lib/dokku/STABLE_VERSION`_$(DOKKU_ARCHITECTURE).deb" diff --git a/rpm.mk b/rpm.mk index 1d430a9a3..67d7662d9 100644 --- a/rpm.mk +++ b/rpm.mk @@ -65,12 +65,20 @@ rpm-dokku: cp /usr/local/share/man/man1/dokku.1 /tmp/build/usr/share/man/man1/dokku.1 gzip -9 /tmp/build/usr/share/man/man1/dokku.1 cp contrib/dokku-installer.py /tmp/build/usr/share/dokku/contrib +ifeq ($(DOKKU_VERSION),master) git describe --tags > /tmp/build/var/lib/dokku/VERSION +else + echo $(DOKKU_VERSION) > /tmp/build/var/lib/dokku/VERSION +endif cat /tmp/build/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build/var/lib/dokku/STABLE_VERSION ifneq (,$(findstring false,$(IS_RELEASE))) - sed -i.bak -e "s/^/`date +%s`:/" /tmp/build/var/lib/dokku/STABLE_VERSION && rm /tmp/build/var/lib/dokku/STABLE_VERSION.bak + sed -i.bak -e "s/^/`date +%s`-/" /tmp/build/var/lib/dokku/STABLE_VERSION && rm /tmp/build/var/lib/dokku/STABLE_VERSION.bak endif +ifdef DOKKU_GIT_REV + echo "$(DOKKU_GIT_REV)" > /tmp/build/var/lib/dokku/GIT_REV +else git rev-parse HEAD > /tmp/build/var/lib/dokku/GIT_REV +endif @echo "-> Creating rpm package" VERSION=$$(cat /tmp/build/var/lib/dokku/STABLE_VERSION); \ From e46b0952e27338be9433e227d5f07f6d90752d9b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 8 Jan 2017 16:49:32 -0700 Subject: [PATCH 093/295] feat: add release-related Dockerfiles These two docker files are used to create deb and rpm packages which are later extracted and pushed to packagecloud. [ci skip] --- .dockerignore | 8 ++++++++ contrib/build-centos.Dockerfile | 34 +++++++++++++++++++++++++++++++++ contrib/build-ubuntu.Dockerfile | 34 +++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 .dockerignore create mode 100644 contrib/build-centos.Dockerfile create mode 100644 contrib/build-ubuntu.Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..0ef019adc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +*Dockerfile +.dockerignore +.git +.vagrant +contrib +docs +tests +!contrib/dokku-installer.py diff --git a/contrib/build-centos.Dockerfile b/contrib/build-centos.Dockerfile new file mode 100644 index 000000000..95473c10d --- /dev/null +++ b/contrib/build-centos.Dockerfile @@ -0,0 +1,34 @@ +FROM ubuntu:14.04 + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +RUN apt-get -qq -y install gcc git build-essential wget ruby-dev ruby1.9.1 lintian rpm help2man man-db + +RUN command -v fpm > /dev/null || sudo gem install fpm --no-ri --no-rdoc + +WORKDIR /dokku + +COPY Makefile /dokku/ + +COPY *.mk /dokku/ + +RUN make deb-setup rpm-setup + +COPY . /dokku + +RUN make sshcommand plugn version copyfiles + +ARG DOKKU_VERSION=master +ENV DOKKU_VERSION ${DOKKU_VERSION} + +ARG DOKKU_GIT_REV +ENV DOKKU_GIT_REV ${DOKKU_GIT_REV} + +ARG IS_RELEASE=false +ENV IS_RELEASE ${IS_RELEASE} + +RUN make rpm-herokuish rpm-dokku rpm-plugn rpm-sshcommand rpm-sigil + +RUN mkdir -p /data && cp /tmp/*.rpm /data && ls /data/ diff --git a/contrib/build-ubuntu.Dockerfile b/contrib/build-ubuntu.Dockerfile new file mode 100644 index 000000000..a5c9892cb --- /dev/null +++ b/contrib/build-ubuntu.Dockerfile @@ -0,0 +1,34 @@ +FROM ubuntu:14.04 + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +RUN apt-get -qq -y install gcc git build-essential wget ruby-dev ruby1.9.1 lintian rpm help2man man-db + +RUN command -v fpm > /dev/null || sudo gem install fpm --no-ri --no-rdoc + +WORKDIR /dokku + +COPY Makefile /dokku/ + +COPY *.mk /dokku/ + +RUN make deb-setup rpm-setup + +COPY . /dokku + +RUN make sshcommand plugn version copyfiles + +ARG DOKKU_VERSION=master +ENV DOKKU_VERSION ${DOKKU_VERSION} + +ARG DOKKU_GIT_REV +ENV DOKKU_GIT_REV ${DOKKU_GIT_REV} + +ARG IS_RELEASE=false +ENV IS_RELEASE ${IS_RELEASE} + +RUN make deb-herokuish deb-dokku deb-plugn deb-sshcommand deb-sigil + +RUN mkdir -p /data && cp /tmp/*.deb /data && ls /data/ From 87573b81bbeb8ec6eb3d408926656fdf0f9cc1ca Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 8 Jan 2017 17:22:30 -0700 Subject: [PATCH 094/295] Release 0.8.0 --- HISTORY.md | 62 ++++++++++++++++++++++++ README.md | 4 +- contrib/dokku-installer.py | 2 +- debian/control | 2 +- docs/advanced-usage/plugin-management.md | 48 +++++++++--------- docs/assets/favicons/browserconfig.xml | 8 +-- docs/assets/favicons/manifest.json | 12 ++--- docs/assets/style.css | 4 +- docs/assets/versions.json | 11 ++++- docs/development/release-process.md | 2 +- docs/getting-started/installation.md | 4 +- docs/home.html | 42 ++++++++-------- docs/template.html | 36 +++++++------- plugins/00_dokku-standard/plugin.toml | 2 +- plugins/20_events/plugin.toml | 2 +- plugins/apps/plugin.toml | 2 +- plugins/build-env/plugin.toml | 2 +- plugins/certs/plugin.toml | 2 +- plugins/checks/plugin.toml | 2 +- plugins/common/plugin.toml | 2 +- plugins/config/plugin.toml | 2 +- plugins/docker-options/plugin.toml | 2 +- plugins/domains/plugin.toml | 2 +- plugins/enter/plugin.toml | 2 +- plugins/git/plugin.toml | 2 +- plugins/logs/plugin.toml | 2 +- plugins/named-containers/plugin.toml | 2 +- plugins/nginx-vhosts/plugin.toml | 2 +- plugins/plugin/plugin.toml | 2 +- plugins/proxy/plugin.toml | 2 +- plugins/ps/plugin.toml | 2 +- plugins/repo/plugin.toml | 2 +- plugins/shell/plugin.toml | 2 +- plugins/ssh-keys/plugin.toml | 2 +- plugins/storage/plugin.toml | 2 +- plugins/tags/plugin.toml | 2 +- plugins/tar/plugin.toml | 2 +- 37 files changed, 178 insertions(+), 107 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 601a8ac7f..e49a57fe3 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,67 @@ # History +## 0.8.0 + +The big kahuna. Lots of documentation changes, and a few bug fixes to make Dokku development a bit easier. + +CentOS 7 users will be happy to see that we now have experimental support for your operating system. Huge thanks to @ebeigarts for working on that feature :) + +Thanks to all the contributors who helped with this release! + +### Bug Fixes + +- #2407: @josegonzalez Move core post-deploy triggers to core-post-deploy +- #2442: @znz Fix `is_tag_force_available` bug when docker major version up +- #2452: @mbtamuli Solves SSH Key problem when admin user already exists +- #2454: @onbjerg Return exit 1 in config:get if no ENV file exists +- #2464: @sseemayer Remove duplicate SSL hostnames +- #2465: @polettix Fix issue when importing ssh-keys +- #2477: @ebeigarts Fix dokku-redeploy systemd script to start only after docker +- #2485: @znz Fix bug when VHOST file is missing newline +- #2492: @josegonzalez Fix iteration on all apps for `dokku proxy` command +- #2495: @josegonzalez Create the user's `authorized_keys` file if it does not exist +- #2496: @josegonzalez Detect nginx versions that support HTTP/2 well +- #2518: @josegonzalez Use same check for dockerfile apps during a tar build +- #2526: @michaelshobbs Actually fail deploy when app.json script fails +- #2539: @ebeigarts Fix dokku-installer.service removal + +### New Features + +- #2378: @knjcode Skip container finish processing when zero downtime is disabled +- #2406: @josegonzalez Use apps_create method when renaming an application +- #2419: @ebeigarts Support for CentOS 7 +- #2489: @joshmanders Add plugin uninstall trigger +- #2510: @IlyaSemenov Add domains:set and domains:set-global commands +- #2544: @michaelshobbs Update herokuish to 0.3.24 +- #2552: @josegonzalez Allow package building on OSX +- #2553: @josegonzalez Add release-related Dockerfiles + +### Documentation + +- #2432: @josegonzalez Clarify DOKKU_SCALE docs +- #2433: @alexgleason Add robots.txt plugin to community docs +- #2437: @vishnubhagwan Fix warning in installation docs +- #2451: @mbtamuli Document the logs plugin +- #2470: @fteychene Add build-hook to plugins doc +- #2472: @mainto Add dokku-access to plugins doc +- #2484: @nahtnam Document build issues when a `Killed` message is displayed +- #2486: @OmarShehata Fixing typo & broken link in docs +- #2488: @joshmanders Bump font size in documentation +- #2493: @josegonzalez Clarify checks documentation +- #2497: @joshmanders Make features heading more clear +- #2503: @mlebkowski Update dokku-acl plugin link +- #2505: @kjschulz Add Dokku Wordpress plugin to docs +- #2506: @simonkotwicz Fix typos in deployment docs +- #2507: @josegonzalez Update upgrade docs to point out sshcommand and plugn upgrading as well +- #2509: @kjschulz Map dokku-community user in plugins +- #2511: @IlyaSemenov Clarify instructions for arranging default nginx site +- #2515: @sgloutnikov Update DreamHost Cloud install instructions +- #2517: @josegonzalez Update docs regarding if the ssh-keys plugin should be in use +- #2522: @joshmanders Ensure install documentation can be run via copy-paste +- #2525: @OmarShehata Plugin-triggers typo: dokkku -> dokku +- #2531: @slava-vishnyakov Document rebuilding app after mounting storage +- #2533: @facundomedica Document potential firewall problem on Ubuntu 16.04 + ## 0.7.2 This minor release contains mostly documentation changes, and should be fully backwards compatible with previous 0.7.x releases. diff --git a/README.md b/README.md index 5a31bd058..c6febc908 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. To install the latest stable release, you can run the following commands as a user that has access to `sudo`: - wget https://raw.githubusercontent.com/dokku/dokku/v0.7.2/bootstrap.sh; - sudo DOKKU_TAG=v0.7.2 bash bootstrap.sh + wget https://raw.githubusercontent.com/dokku/dokku/v0.8.0/bootstrap.sh; + sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh You can then proceed to the ip address or domain name associated with your server to complete the web-based installation. diff --git a/contrib/dokku-installer.py b/contrib/dokku-installer.py index 9c897fc70..67380722f 100755 --- a/contrib/dokku-installer.py +++ b/contrib/dokku-installer.py @@ -10,7 +10,7 @@ import subprocess import sys import threading -VERSION = 'v0.7.2' +VERSION = 'v0.8.0' hostname = '' try: diff --git a/debian/control b/debian/control index f8c628bb2..d88270c1a 100644 --- a/debian/control +++ b/debian/control @@ -1,5 +1,5 @@ Package: dokku -Version: 0.7.2 +Version: 0.8.0 Section: web Priority: optional Architecture: amd64 diff --git a/docs/advanced-usage/plugin-management.md b/docs/advanced-usage/plugin-management.md index 01af0b16b..3ac658310 100644 --- a/docs/advanced-usage/plugin-management.md +++ b/docs/advanced-usage/plugin-management.md @@ -31,30 +31,30 @@ dokku plugin ``` plugn: dev - 00_dokku-standard 0.7.2 enabled dokku core standard plugin - 20_events 0.7.2 enabled dokku core events logging plugin - apps 0.7.2 enabled dokku core apps plugin - build-env 0.7.2 enabled dokku core build-env plugin - certs 0.7.2 enabled dokku core certificate management plugin - checks 0.7.2 enabled dokku core checks plugin - common 0.7.2 enabled dokku core common plugin - config 0.7.2 enabled dokku core config plugin - docker-options 0.7.2 enabled dokku core docker-options plugin - domains 0.7.2 enabled dokku core domains plugin - enter 0.7.2 enabled dokku core enter plugin - git 0.7.2 enabled dokku core git plugin - logs 0.7.2 enabled dokku core logs plugin - named-containers 0.7.2 enabled dokku core named containers plugin - nginx-vhosts 0.7.2 enabled dokku core nginx-vhosts plugin - plugin 0.7.2 enabled dokku core plugin plugin - proxy 0.7.2 enabled dokku core proxy plugin - ps 0.7.2 enabled dokku core ps plugin - repo 0.7.2 enabled dokku core repo plugin - shell 0.7.2 enabled dokku core shell plugin - ssh-keys 0.7.2 enabled dokku core ssh-keys plugin - storage 0.7.2 enabled dokku core storage plugin - tags 0.7.2 enabled dokku core tags plugin - tar 0.7.2 enabled dokku core tar plugin + 00_dokku-standard 0.8.0 enabled dokku core standard plugin + 20_events 0.8.0 enabled dokku core events logging plugin + apps 0.8.0 enabled dokku core apps plugin + build-env 0.8.0 enabled dokku core build-env plugin + certs 0.8.0 enabled dokku core certificate management plugin + checks 0.8.0 enabled dokku core checks plugin + common 0.8.0 enabled dokku core common plugin + config 0.8.0 enabled dokku core config plugin + docker-options 0.8.0 enabled dokku core docker-options plugin + domains 0.8.0 enabled dokku core domains plugin + enter 0.8.0 enabled dokku core enter plugin + git 0.8.0 enabled dokku core git plugin + logs 0.8.0 enabled dokku core logs plugin + named-containers 0.8.0 enabled dokku core named containers plugin + nginx-vhosts 0.8.0 enabled dokku core nginx-vhosts plugin + plugin 0.8.0 enabled dokku core plugin plugin + proxy 0.8.0 enabled dokku core proxy plugin + ps 0.8.0 enabled dokku core ps plugin + repo 0.8.0 enabled dokku core repo plugin + shell 0.8.0 enabled dokku core shell plugin + ssh-keys 0.8.0 enabled dokku core ssh-keys plugin + storage 0.8.0 enabled dokku core storage plugin + tags 0.8.0 enabled dokku core tags plugin + tar 0.8.0 enabled dokku core tar plugin ``` Installing a plugin is easy as well using the `plugin:install` command. This command will also trigger the `install` pluginhook on all existing plugins. diff --git a/docs/assets/favicons/browserconfig.xml b/docs/assets/favicons/browserconfig.xml index 1881ad8c8..14e9c8e67 100644 --- a/docs/assets/favicons/browserconfig.xml +++ b/docs/assets/favicons/browserconfig.xml @@ -2,10 +2,10 @@ - - - - + + + + #da532c diff --git a/docs/assets/favicons/manifest.json b/docs/assets/favicons/manifest.json index a3d6a7458..1bc480147 100644 --- a/docs/assets/favicons/manifest.json +++ b/docs/assets/favicons/manifest.json @@ -2,37 +2,37 @@ "name": "Dokku", "icons": [ { - "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.7.2\/docs\/assets\/favicons\/android-chrome-36x36.png", + "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-36x36.png", "sizes": "36x36", "type": "image\/png", "density": "0.75" }, { - "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.7.2\/docs\/assets\/favicons\/android-chrome-48x48.png", + "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-48x48.png", "sizes": "48x48", "type": "image\/png", "density": "1.0" }, { - "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.7.2\/docs\/assets\/favicons\/android-chrome-72x72.png", + "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-72x72.png", "sizes": "72x72", "type": "image\/png", "density": "1.5" }, { - "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.7.2\/docs\/assets\/favicons\/android-chrome-96x96.png", + "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-96x96.png", "sizes": "96x96", "type": "image\/png", "density": "2.0" }, { - "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.7.2\/docs\/assets\/favicons\/android-chrome-144x144.png", + "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-144x144.png", "sizes": "144x144", "type": "image\/png", "density": "3.0" }, { - "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.7.2\/docs\/assets\/favicons\/android-chrome-192x192.png", + "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-192x192.png", "sizes": "192x192", "type": "image\/png", "density": "4.0" diff --git a/docs/assets/style.css b/docs/assets/style.css index da3c92f26..6377af5ef 100644 --- a/docs/assets/style.css +++ b/docs/assets/style.css @@ -35,13 +35,13 @@ h1 { background-repeat: no-repeat; } .header .navbar-brand a { - background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.7.2/docs/assets/dokku.png); + background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/dokku.png); text-indent: 40px; } .blurb { color: #424242; background-color: #ededed; - background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.7.2/docs/assets/gplaypattern.png); + background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/gplaypattern.png); padding: 45px 0; text-align: center; } diff --git a/docs/assets/versions.json b/docs/assets/versions.json index 32140569b..eb62acaf0 100644 --- a/docs/assets/versions.json +++ b/docs/assets/versions.json @@ -1 +1,10 @@ -{ "max-versions": [ "0.3.26", "0.4.14", "0.5.8", "0.6.5", "0.7.2" ] } +{ + "max-versions": [ + "0.3.26", + "0.4.14", + "0.5.8", + "0.6.5", + "0.7.2", + "0.8.0" + ] +} diff --git a/docs/development/release-process.md b/docs/development/release-process.md index c8efc1347..52a81cb8b 100644 --- a/docs/development/release-process.md +++ b/docs/development/release-process.md @@ -67,7 +67,7 @@ The workflow looks like this: ```shell # having dokku-arch in ../dokku-arch vagrant up build-arch -# wait for "==> build-arch: ==> Finished making: dokku 0.7.2-2 (Mon Feb 22 23:20:37 CET 2016)" +# wait for "==> build-arch: ==> Finished making: dokku 0.8.0-2 (Mon Feb 22 23:20:37 CET 2016)" cd ../dokku-arch git add PKGBUILD .SRCINFO git commit -m 'Update to dokku 0.9.9' diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index d3715a566..6e0358d2e 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -21,8 +21,8 @@ To install the latest stable version of dokku, you can run the following shell c ```shell # for debian systems, installs Dokku via apt-get -wget https://raw.githubusercontent.com/dokku/dokku/v0.7.2/bootstrap.sh; -sudo DOKKU_TAG=v0.7.2 bash bootstrap.sh +wget https://raw.githubusercontent.com/dokku/dokku/v0.8.0/bootstrap.sh; +sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh ``` The installation process takes about 5-10 minutes, depending upon internet connection speed. diff --git a/docs/home.html b/docs/home.html index 402a9e9b8..f8f0c65f9 100644 --- a/docs/home.html +++ b/docs/home.html @@ -7,33 +7,33 @@ - + Dokku - The smallest PaaS implementation you've ever seen - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + @@ -98,12 +98,12 @@

$ - wget https://raw.githubusercontent.com/dokku/dokku/v0.7.2/bootstrap.sh + wget https://raw.githubusercontent.com/dokku/dokku/v0.8.0/bootstrap.sh

$ - sudo DOKKU_TAG=v0.7.2 bash bootstrap.sh + sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh

 # go to your server's IP and follow the web installer diff --git a/docs/template.html b/docs/template.html index 7c69c23c8..4676c64a2 100644 --- a/docs/template.html +++ b/docs/template.html @@ -10,26 +10,26 @@ Dokku - The smallest PaaS implementation you've ever seen - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + From 0e0012cca1a3248770feb8b1755418883d350c65 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 8 Jan 2017 21:43:37 -0700 Subject: [PATCH 101/295] fix: remove extra closing tag --- docs/template.html | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/template.html b/docs/template.html index b765039a8..1fd721650 100644 --- a/docs/template.html +++ b/docs/template.html @@ -7,7 +7,6 @@ -> Dokku - The smallest PaaS implementation you've ever seen From 13ef76127de8950487dbc26bb93f5cd09de9ac57 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 25 Nov 2016 01:15:44 -0700 Subject: [PATCH 102/295] Suppress output unless the `git submodule update` call fails This will give a bit more warning to developers as to what might be going on, allowing them to respond appropriately. Closes #2479 --- plugins/git/functions | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/git/functions b/plugins/git/functions index 33158d646..dd6ac32a2 100755 --- a/plugins/git/functions +++ b/plugins/git/functions @@ -28,7 +28,7 @@ git_build_app_repo() { git remote add origin "$DOKKU_ROOT/$APP" &> /dev/null git fetch --depth=1 origin "refs/tags/$TMP_TAG" &> /dev/null git reset --hard FETCH_HEAD &> /dev/null - git submodule update --init --recursive &> /dev/null + suppress_output git submodule update --init --recursive GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true find -name .git -prune -exec rm -rf {} \; > /dev/null @@ -41,6 +41,21 @@ git_build_app_repo() { fi } +suppress_output() { + declare desc="suppress all output from a given command unless there is an error" + local TMP_COMMAND_OUTPUT + TMP_COMMAND_OUTPUT=$(mktemp "/tmp/${FUNCNAME[0]}.XXXX") + trap 'rm -rf "$TMP_COMMAND_OUTPUT" > /dev/null' RETURN INT TERM EXIT + + $* 2>&1 > "$TMP_COMMAND_OUTPUT" || { + local exit_code="$?" + cat "$TMP_COMMAND_OUTPUT" + return "$exit_code" + } + return 0 +} + + git_hook_cmd() { declare desc="kick off receive-app trigger from git prereceive hook" local cmd="git-hook" From b23c6020794ca016a3e01f7095d3e6c283e9b686 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 9 Jan 2017 00:36:35 -0700 Subject: [PATCH 103/295] chore: remove extra whitespace in client [ci skip] --- contrib/dokku_client.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 6ed95a804..855f76ea5 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -34,11 +34,11 @@ client_help_msg() { } is_git_repo() { - git rev-parse &>/dev/null + git rev-parse &>/dev/null } has_dokku_remote() { - git remote show | grep dokku + git remote show | grep dokku } if [[ -z $DOKKU_HOST ]]; then From 332c429e31d9ee52ffc23ecb1c6495f5136b184d Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 9 Jan 2017 00:37:54 -0700 Subject: [PATCH 104/295] refactor: make variables local and move them into correct functions --- contrib/dokku_client.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 855f76ea5..0584912d1 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -1,9 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -MOVES=(ABLE ABNORMA AGAIN AIREXPL ANG ANGER ASAIL ATTACK AURORA AWL BAN BAND BARE BEAT BEATED BELLY BIND BITE BLOC BLOOD BODY BOOK BREATH BUMP CAST CHAM CLAMP CLAP CLAW CLEAR CLI CLIP CLOUD CONTRO CONVY COOLHIT CRASH CRY CUT DESCRI D-FIGHT DIG DITCH DIV DOZ DRE DUL DU-PIN DYE EARTH EDU EG-BOMB EGG ELEGY ELE-HIT EMBODY EMPLI ENGL ERUPT EVENS EXPLOR EYES FALL FAST F-CAR F-DANCE FEARS F-FIGHT FIGHT FIR FIRE FIREHIT FLAME FLAP FLASH FLEW FORCE FRA FREEZE FROG G-BIRD GENKISS GIFT G-KISS G-MOUSE GRADE GROW HAMMER HARD HAT HATE H-BOMB HELL-R HEMP HINT HIT HU HUNT HYPNOSI INHA IRO IRONBAR IR-WING J-GUN KEE KICK KNIF KNIFE KNOCK LEVEL LIGH LIGHHIT LIGHT LIVE L-WALL MAD MAJUS MEL MELO MESS MILK MIMI MISS MIXING MOVE MUD NI-BED NOISY NOONLI NULL N-WAVE PAT PEACE PIN PLAN PLANE POIS POL POWDE POWE POWER PRIZE PROTECT PROUD RAGE RECOR REFLAC REFREC REGR RELIV RENEW R-FIGHT RING RKICK ROCK ROUND RUS RUSH SAND SAW SCISSOR SCRA SCRIPT SEEN SERVER SHADOW SHELL SHINE SHO SIGHT SIN SMALL SMELT SMOK SNAKE SNO SNOW SOU SO-WAVE SPAR SPEC SPID S-PIN SPRA STAM STARE STEA STONE STORM STRU STRUG STUDEN SUBS SUCID SUN-LIG SUNRIS SUPLY S-WAVE TAILS TANGL TASTE TELLI THANK TONKICK TOOTH TORL TRAIN TRIKICK TUNGE VOLT WA-GUN WATCH WAVE W-BOMB WFALL WFING WHIP WHIRL WIND WOLF WOOD WOR YUJA) -NAMES=(SEED GRASS FLOWE SHAD CABR SNAKE GOLD COW GUIKI PEDAL DELAN B-FLY BIDE KEYU FORK LAP PIGE PIJIA CAML LAT BIRD BABOO VIV ABOKE PIKAQ RYE SAN BREAD LIDEL LIDE PIP PIKEX ROK JUGEN PUD BUDE ZHIB GELU GRAS FLOW LAFUL ATH BALA CORN MOLUF DESP DAKED MIMI BOLUX KODA GELUD MONK SUMOY GEDI WENDI NILEM NILE NILEC KEZI YONGL HUDE WANLI GELI GUAIL MADAQ WUCI WUCI MUJEF JELLY SICIB GELU NELUO BOLI JIALE YED YEDE CLO SCARE AOCO DEDE DEDEI BAWU JIUG BADEB BADEB HOLE BALUX GES FANT QUAR YIHE SWAB SLIPP CLU DEPOS BILIY YUANO SOME NO YELA EMPT ZECUN XIAHE BOLEL DEJI MACID XIHON XITO LUCK MENJI GELU DECI XIDE DASAJ DONGN RICUL MINXI BALIY ZENDA LUZEL HELE5 0FENB KAIL JIAND CARP JINDE LAPU MUDE YIFU LINLI SANDI HUSI JINC OUMU OUMUX CAP KUIZA PUD TIAO FRMAN CLAU SPARK DRAGO BOLIU GUAIL MIYOU MIY QIAOK BEIL MUKEI RIDED MADAM BAGEP CROC ALIGE OUDAL OUD DADA HEHE YEDEA NUXI NUXIN ROUY ALIAD STICK QIANG LAAND PIQI PI PUPI DEKE DEKEJ NADI NADIO MALI PEA ELECT FLOWE MAL MALI HUSHU NILEE YUZI POPOZ DUZI HEBA XIAN SHAN YEYEA WUY LUO KEFE HULA CROW YADEH MOW ANNAN SUONI KYLI HULU HUDEL YEHE GULAE YEHE BLU GELAN BOAT NIP POIT HELAK XINL BEAR LINB MAGEH MAGEJ WULI YIDE RIVE FISH AOGU DELIE MANTE KONMU DELU HELU HUAN HUMA DONGF JINCA HEDE DEFU LIBY JIAPA MEJI HELE BUHU MILK HABI THUN GARD DON YANGQ SANAQ BANQ LUJ PHIX SIEI EGG) - random_number() { [[ -n "$1" ]] && RANGE="$1" if [[ -n "$RANGE" ]]; then @@ -16,15 +13,19 @@ random_number() { } random_name() { - NUM1=$(random_number ${#MOVES[@]}) - NUM2=$(random_number ${#MOVES[@]}) - NUM3=$(random_number ${#NAMES[@]}) + local NUM1 NUM2 NUM3 UPPER_APPNAME lower_appname + local MOVES=(ABLE ABNORMA AGAIN AIREXPL ANG ANGER ASAIL ATTACK AURORA AWL BAN BAND BARE BEAT BEATED BELLY BIND BITE BLOC BLOOD BODY BOOK BREATH BUMP CAST CHAM CLAMP CLAP CLAW CLEAR CLI CLIP CLOUD CONTRO CONVY COOLHIT CRASH CRY CUT DESCRI D-FIGHT DIG DITCH DIV DOZ DRE DUL DU-PIN DYE EARTH EDU EG-BOMB EGG ELEGY ELE-HIT EMBODY EMPLI ENGL ERUPT EVENS EXPLOR EYES FALL FAST F-CAR F-DANCE FEARS F-FIGHT FIGHT FIR FIRE FIREHIT FLAME FLAP FLASH FLEW FORCE FRA FREEZE FROG G-BIRD GENKISS GIFT G-KISS G-MOUSE GRADE GROW HAMMER HARD HAT HATE H-BOMB HELL-R HEMP HINT HIT HU HUNT HYPNOSI INHA IRO IRONBAR IR-WING J-GUN KEE KICK KNIF KNIFE KNOCK LEVEL LIGH LIGHHIT LIGHT LIVE L-WALL MAD MAJUS MEL MELO MESS MILK MIMI MISS MIXING MOVE MUD NI-BED NOISY NOONLI NULL N-WAVE PAT PEACE PIN PLAN PLANE POIS POL POWDE POWE POWER PRIZE PROTECT PROUD RAGE RECOR REFLAC REFREC REGR RELIV RENEW R-FIGHT RING RKICK ROCK ROUND RUS RUSH SAND SAW SCISSOR SCRA SCRIPT SEEN SERVER SHADOW SHELL SHINE SHO SIGHT SIN SMALL SMELT SMOK SNAKE SNO SNOW SOU SO-WAVE SPAR SPEC SPID S-PIN SPRA STAM STARE STEA STONE STORM STRU STRUG STUDEN SUBS SUCID SUN-LIG SUNRIS SUPLY S-WAVE TAILS TANGL TASTE TELLI THANK TONKICK TOOTH TORL TRAIN TRIKICK TUNGE VOLT WA-GUN WATCH WAVE W-BOMB WFALL WFING WHIP WHIRL WIND WOLF WOOD WOR YUJA) + local NAMES=(SEED GRASS FLOWE SHAD CABR SNAKE GOLD COW GUIKI PEDAL DELAN B-FLY BIDE KEYU FORK LAP PIGE PIJIA CAML LAT BIRD BABOO VIV ABOKE PIKAQ RYE SAN BREAD LIDEL LIDE PIP PIKEX ROK JUGEN PUD BUDE ZHIB GELU GRAS FLOW LAFUL ATH BALA CORN MOLUF DESP DAKED MIMI BOLUX KODA GELUD MONK SUMOY GEDI WENDI NILEM NILE NILEC KEZI YONGL HUDE WANLI GELI GUAIL MADAQ WUCI WUCI MUJEF JELLY SICIB GELU NELUO BOLI JIALE YED YEDE CLO SCARE AOCO DEDE DEDEI BAWU JIUG BADEB BADEB HOLE BALUX GES FANT QUAR YIHE SWAB SLIPP CLU DEPOS BILIY YUANO SOME NO YELA EMPT ZECUN XIAHE BOLEL DEJI MACID XIHON XITO LUCK MENJI GELU DECI XIDE DASAJ DONGN RICUL MINXI BALIY ZENDA LUZEL HELE5 0FENB KAIL JIAND CARP JINDE LAPU MUDE YIFU LINLI SANDI HUSI JINC OUMU OUMUX CAP KUIZA PUD TIAO FRMAN CLAU SPARK DRAGO BOLIU GUAIL MIYOU MIY QIAOK BEIL MUKEI RIDED MADAM BAGEP CROC ALIGE OUDAL OUD DADA HEHE YEDEA NUXI NUXIN ROUY ALIAD STICK QIANG LAAND PIQI PI PUPI DEKE DEKEJ NADI NADIO MALI PEA ELECT FLOWE MAL MALI HUSHU NILEE YUZI POPOZ DUZI HEBA XIAN SHAN YEYEA WUY LUO KEFE HULA CROW YADEH MOW ANNAN SUONI KYLI HULU HUDEL YEHE GULAE YEHE BLU GELAN BOAT NIP POIT HELAK XINL BEAR LINB MAGEH MAGEJ WULI YIDE RIVE FISH AOGU DELIE MANTE KONMU DELU HELU HUAN HUMA DONGF JINCA HEDE DEFU LIBY JIAPA MEJI HELE BUHU MILK HABI THUN GARD DON YANGQ SANAQ BANQ LUJ PHIX SIEI EGG) - UPPER_APPNAME="${MOVES[${NUM1}]}-${MOVES[${NUM2}]}-${NAMES[${NUM3}]}" + NUM1=$(random_number ${#MOVES[@]}) + NUM2=$(random_number ${#MOVES[@]}) + NUM3=$(random_number ${#NAMES[@]}) - [[ "$BASH_VERSION" =~ 4.* ]] && lower_appname=${UPPER_APPNAME,,} - [[ -z "$lower_appname" ]] && lower_appname=$(echo "$UPPER_APPNAME" | tr '[:upper:]' '[:lower:]') - echo "$lower_appname" + UPPER_APPNAME="${MOVES[${NUM1}]}-${MOVES[${NUM2}]}-${NAMES[${NUM3}]}" + + [[ "$BASH_VERSION" =~ 4.* ]] && lower_appname=${UPPER_APPNAME,,} + [[ -z "$lower_appname" ]] && lower_appname=$(echo "$UPPER_APPNAME" | tr '[:upper:]' '[:lower:]') + echo "$lower_appname" } client_help_msg() { From 70f3e3407f2b46d47c7f5e12fbdedaae286029d4 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 9 Jan 2017 00:44:13 -0700 Subject: [PATCH 105/295] chore: prefix functions with fn- --- contrib/dokku_client.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 0584912d1..5b0f8ada5 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -random_number() { +fn-random-number() { [[ -n "$1" ]] && RANGE="$1" if [[ -n "$RANGE" ]]; then number=$RANDOM @@ -12,14 +12,14 @@ random_number() { echo $number } -random_name() { +fn-random-name() { local NUM1 NUM2 NUM3 UPPER_APPNAME lower_appname local MOVES=(ABLE ABNORMA AGAIN AIREXPL ANG ANGER ASAIL ATTACK AURORA AWL BAN BAND BARE BEAT BEATED BELLY BIND BITE BLOC BLOOD BODY BOOK BREATH BUMP CAST CHAM CLAMP CLAP CLAW CLEAR CLI CLIP CLOUD CONTRO CONVY COOLHIT CRASH CRY CUT DESCRI D-FIGHT DIG DITCH DIV DOZ DRE DUL DU-PIN DYE EARTH EDU EG-BOMB EGG ELEGY ELE-HIT EMBODY EMPLI ENGL ERUPT EVENS EXPLOR EYES FALL FAST F-CAR F-DANCE FEARS F-FIGHT FIGHT FIR FIRE FIREHIT FLAME FLAP FLASH FLEW FORCE FRA FREEZE FROG G-BIRD GENKISS GIFT G-KISS G-MOUSE GRADE GROW HAMMER HARD HAT HATE H-BOMB HELL-R HEMP HINT HIT HU HUNT HYPNOSI INHA IRO IRONBAR IR-WING J-GUN KEE KICK KNIF KNIFE KNOCK LEVEL LIGH LIGHHIT LIGHT LIVE L-WALL MAD MAJUS MEL MELO MESS MILK MIMI MISS MIXING MOVE MUD NI-BED NOISY NOONLI NULL N-WAVE PAT PEACE PIN PLAN PLANE POIS POL POWDE POWE POWER PRIZE PROTECT PROUD RAGE RECOR REFLAC REFREC REGR RELIV RENEW R-FIGHT RING RKICK ROCK ROUND RUS RUSH SAND SAW SCISSOR SCRA SCRIPT SEEN SERVER SHADOW SHELL SHINE SHO SIGHT SIN SMALL SMELT SMOK SNAKE SNO SNOW SOU SO-WAVE SPAR SPEC SPID S-PIN SPRA STAM STARE STEA STONE STORM STRU STRUG STUDEN SUBS SUCID SUN-LIG SUNRIS SUPLY S-WAVE TAILS TANGL TASTE TELLI THANK TONKICK TOOTH TORL TRAIN TRIKICK TUNGE VOLT WA-GUN WATCH WAVE W-BOMB WFALL WFING WHIP WHIRL WIND WOLF WOOD WOR YUJA) local NAMES=(SEED GRASS FLOWE SHAD CABR SNAKE GOLD COW GUIKI PEDAL DELAN B-FLY BIDE KEYU FORK LAP PIGE PIJIA CAML LAT BIRD BABOO VIV ABOKE PIKAQ RYE SAN BREAD LIDEL LIDE PIP PIKEX ROK JUGEN PUD BUDE ZHIB GELU GRAS FLOW LAFUL ATH BALA CORN MOLUF DESP DAKED MIMI BOLUX KODA GELUD MONK SUMOY GEDI WENDI NILEM NILE NILEC KEZI YONGL HUDE WANLI GELI GUAIL MADAQ WUCI WUCI MUJEF JELLY SICIB GELU NELUO BOLI JIALE YED YEDE CLO SCARE AOCO DEDE DEDEI BAWU JIUG BADEB BADEB HOLE BALUX GES FANT QUAR YIHE SWAB SLIPP CLU DEPOS BILIY YUANO SOME NO YELA EMPT ZECUN XIAHE BOLEL DEJI MACID XIHON XITO LUCK MENJI GELU DECI XIDE DASAJ DONGN RICUL MINXI BALIY ZENDA LUZEL HELE5 0FENB KAIL JIAND CARP JINDE LAPU MUDE YIFU LINLI SANDI HUSI JINC OUMU OUMUX CAP KUIZA PUD TIAO FRMAN CLAU SPARK DRAGO BOLIU GUAIL MIYOU MIY QIAOK BEIL MUKEI RIDED MADAM BAGEP CROC ALIGE OUDAL OUD DADA HEHE YEDEA NUXI NUXIN ROUY ALIAD STICK QIANG LAAND PIQI PI PUPI DEKE DEKEJ NADI NADIO MALI PEA ELECT FLOWE MAL MALI HUSHU NILEE YUZI POPOZ DUZI HEBA XIAN SHAN YEYEA WUY LUO KEFE HULA CROW YADEH MOW ANNAN SUONI KYLI HULU HUDEL YEHE GULAE YEHE BLU GELAN BOAT NIP POIT HELAK XINL BEAR LINB MAGEH MAGEJ WULI YIDE RIVE FISH AOGU DELIE MANTE KONMU DELU HELU HUAN HUMA DONGF JINCA HEDE DEFU LIBY JIAPA MEJI HELE BUHU MILK HABI THUN GARD DON YANGQ SANAQ BANQ LUJ PHIX SIEI EGG) - NUM1=$(random_number ${#MOVES[@]}) - NUM2=$(random_number ${#MOVES[@]}) - NUM3=$(random_number ${#NAMES[@]}) + NUM1=$(fn-random-number ${#MOVES[@]}) + NUM2=$(fn-random-number ${#MOVES[@]}) + NUM3=$(fn-random-number ${#NAMES[@]}) UPPER_APPNAME="${MOVES[${NUM1}]}-${MOVES[${NUM2}]}-${NAMES[${NUM3}]}" @@ -28,17 +28,17 @@ random_name() { echo "$lower_appname" } -client_help_msg() { +fn-client-help-msg() { echo "==> Configure the DOKKU_HOST environment variable or run $0 from a repository with a git remote named dokku" echo "--> i.e. git remote add dokku dokku@:" exit 20 # exit with specific status. only used in units tests for now } -is_git_repo() { +fn-is-git-repo() { git rev-parse &>/dev/null } -has_dokku_remote() { +fn-has-dokku-remote() { git remote show | grep dokku } @@ -46,7 +46,7 @@ if [[ -z $DOKKU_HOST ]]; then if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then DOKKU_HOST=$(git remote -v 2>/dev/null | grep -Ei "^dokku" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true) else - client_help_msg + fn-client-help-msg fi fi @@ -66,7 +66,7 @@ if [[ ! -z $DOKKU_HOST ]]; then case "$1" in apps:create) if [[ -z "$2" ]]; then - appname=$(random_name) + appname=$(fn-random-name) counter=0 while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$appname"; do if [[ $counter -ge 100 ]]; then @@ -90,7 +90,7 @@ if [[ ! -z $DOKKU_HOST ]]; then fi ;; apps:destroy) - is_git_repo && has_dokku_remote && git remote remove dokku + fn-is-git-repo && fn-has-dokku-remote && git remote remove dokku ;; esac @@ -105,5 +105,5 @@ if [[ ! -z $DOKKU_HOST ]]; then exit $? fi else - client_help_msg + fn-client-help-msg fi From 5ddcf06ce93011fe9a016debc58ee52cfe4dc868 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 9 Jan 2017 01:15:22 -0700 Subject: [PATCH 106/295] feat: add the ability to specify a remote via the `--remote` flag Closes #2523 --- contrib/dokku_client.sh | 138 ++++++++++++++++++++++------------------ 1 file changed, 77 insertions(+), 61 deletions(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 5b0f8ada5..a3cf2bbfe 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +export DOKKU_PORT=${DOKKU_PORT:=22} +export DOKKU_HOST=${DOKKU_HOST:=} fn-random-number() { [[ -n "$1" ]] && RANGE="$1" @@ -39,71 +41,85 @@ fn-is-git-repo() { } fn-has-dokku-remote() { - git remote show | grep dokku + git remote show | grep -E "^${DOKKU_GIT_REMOTE}\s" } -if [[ -z $DOKKU_HOST ]]; then - if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then - DOKKU_HOST=$(git remote -v 2>/dev/null | grep -Ei "^dokku" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true) - else - fn-client-help-msg - fi -fi +fn-dokku-host() { + declare DOKKU_GIT_REMOTE="$1" DOKKU_HOST="$2" -export DOKKU_PORT=${DOKKU_PORT:=22} - -if [[ ! -z $DOKKU_HOST ]]; then - _dokku() { - appname="" + if [[ -z "$DOKKU_HOST" ]]; then if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then - set +e - appname=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_HOST" | head -n 1 | cut -f2 -d'@' | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null) - set -e - else - echo "This is not a git repository" + DOKKU_HOST=$(git remote -v 2>/dev/null | grep -Ei "^${DOKKU_GIT_REMOTE}\s" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true) fi - - case "$1" in - apps:create) - if [[ -z "$2" ]]; then - appname=$(fn-random-name) - counter=0 - while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$appname"; do - if [[ $counter -ge 100 ]]; then - echo "Error: could not reasonably generate a new app name. try cleaning up some apps..." - ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps - exit 1 - else - appname=$(random_name) - counter=$((counter+1)) - fi - done - else - appname="$2" - fi - if git remote add dokku "dokku@$DOKKU_HOST:$appname"; then - echo "-----> Dokku remote added at $DOKKU_HOST" - echo "-----> Application name is $appname" - else - echo "! Dokku remote not added! Do you already have a dokku remote?" - return - fi - ;; - apps:destroy) - fn-is-git-repo && fn-has-dokku-remote && git remote remove dokku - ;; - esac - - [[ -n "$@" ]] && [[ -n "$appname" ]] && app_arg="--app $appname" - # echo "ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@" - # shellcheck disable=SC2068,SC2086 - ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@ - } - - if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then - _dokku "$@" - exit $? fi -else - fn-client-help-msg + + echo "$DOKKU_HOST" +} + +main() { + local DOKKU_GIT_REMOTE + local next_index=1; local skip=false; local args=("$@") + + for arg in "$@"; do + $skip && break + case "$arg" in + --remote) + DOKKU_GIT_REMOTE=${args[$next_index]} + skip=true + shift 2 + ;; + esac + done + + DOKKU_HOST="$(fn-dokku-host "$DOKKU_GIT_REMOTE" "$DOKKU_HOST")" + + appname="" + if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then + set +e + appname=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_HOST" | head -n 1 | cut -f2 -d'@' | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null) + set -e + else + echo "This is not a git repository" + fi + + case "$1" in + apps:create) + if [[ -z "$2" ]]; then + appname=$(fn-random-name) + counter=0 + while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$appname"; do + if [[ $counter -ge 100 ]]; then + echo "Error: could not reasonably generate a new app name. try cleaning up some apps..." + ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps + exit 1 + else + appname=$(random_name) + counter=$((counter+1)) + fi + done + else + appname="$2" + fi + if git remote add dokku "dokku@$DOKKU_HOST:$appname"; then + echo "-----> Dokku remote added at ${DOKKU_HOST} called ${DOKKU_GIT_REMOTE}" + echo "-----> Application name is ${appname}" + else + echo "! Dokku remote not added! Do you already have a dokku remote?" + return + fi + ;; + apps:destroy) + fn-is-git-repo && fn-has-dokku-remote && git remote remove "$DOKKU_GIT_REMOTE" + ;; + esac + + [[ -n "$@" ]] && [[ -n "$appname" ]] && app_arg="--app $appname" + # echo "ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@" + # shellcheck disable=SC2068,SC2086 + ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@ +} + +if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then + main "$@" + exit $? fi From 13c78e8e9a26940f505344e00cb1831b6a5c5d5e Mon Sep 17 00:00:00 2001 From: Justin Clark Date: Fri, 12 Aug 2016 19:57:31 -0700 Subject: [PATCH 107/295] Add exceptions back to dokku_client.sh for plugins that should not be passed an app name implicitly --- contrib/dokku_client.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index a3cf2bbfe..00907eaf1 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -113,6 +113,9 @@ main() { ;; esac + [[ "$1" =~ apps|certs|certs:chain|domains:add-global|domains:remove-global|domains:set-global|help|ls|nginx|ps:rebuildall|ps:restartall|ps:restore|shell|storage|trace|version ]] && unset appname + [[ "$1" =~ events*|plugin*|ssh-keys* ]] && unset appname + [[ -n "$2" ]] && [[ "$2" == "--global" ]] && unset appname [[ -n "$@" ]] && [[ -n "$appname" ]] && app_arg="--app $appname" # echo "ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@" # shellcheck disable=SC2068,SC2086 From e107c19dbf8e639650a97ff2b621de8f9931d0fb Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 9 Jan 2017 01:31:10 -0700 Subject: [PATCH 108/295] chore: remove extra local declarations --- contrib/dokku_client.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 00907eaf1..7a6b08812 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -58,7 +58,7 @@ fn-dokku-host() { main() { local DOKKU_GIT_REMOTE - local next_index=1; local skip=false; local args=("$@") + local next_index=1 skip=false args=("$@") for arg in "$@"; do $skip && break From 9272e4017872120b3cfec5ec745888be833c8473 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 9 Jan 2017 02:12:18 -0700 Subject: [PATCH 109/295] fix: skip following argument when current argument is --app --- dokku | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dokku b/dokku index 05ae39621..978d617f4 100755 --- a/dokku +++ b/dokku @@ -35,10 +35,12 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" parse_args "$@" args=("$@") +skip_arg=false if [[ "${args[0]}" =~ ^--.* ]]; then for arg in "$@"; do + $skip_arg && skip_arg=false && continue if [[ "$arg" == "--app" ]]; then - shift 2 + shift 2 && skip_arg=true elif [[ "$arg" =~ ^--.* ]]; then shift 1 else From 594b41cc709559b47aaad5a12f30ae99a61238be Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 9 Jan 2017 02:13:52 -0700 Subject: [PATCH 110/295] fix: properly handle argument parsing when skip is set to true Previously, using the --app flag would mean that we would stop properly parsing all proceeding flags, so the --app flag would only work when set last. --- plugins/common/functions | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/common/functions b/plugins/common/functions index 786cf4a34..20cb21c46 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -251,7 +251,12 @@ parse_args() { declare desc="top-level cli arg parser" local next_index=1; local skip=false; local args=("$@") for arg in "$@"; do - $skip && skip=false && continue + if [[ "$skip" == "true" ]]; then + next_index=$(( next_index + 1 )) + skip=false + continue + fi + case "$arg" in --quiet) export DOKKU_QUIET_OUTPUT=1 @@ -272,7 +277,7 @@ parse_args() { export DOKKU_APP_NAME=${args[$next_index]}; skip=true ;; esac - local next_index=$(( next_index + 1 )) + next_index=$(( next_index + 1 )) done return 0 } From 6e00064cb39798f9e17bac0492dc5e8ed691d656 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 9 Jan 2017 02:33:45 -0700 Subject: [PATCH 111/295] fix: Properly parse flags in the dokku client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Respect the --app flag - Respect the --trace flag - Skip the second argument after both --app and --remote flags - The `--global` flag should be set as is when specified after a “valid” command - Fix issues when checking if the --app flag should be passed via ssh - Use APP as the variable name for the current app --- contrib/dokku_client.sh | 80 ++++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 7a6b08812..9ba6d9d63 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -57,52 +57,73 @@ fn-dokku-host() { } main() { - local DOKKU_GIT_REMOTE - local next_index=1 skip=false args=("$@") + declare CMD="$1" APP_ARG="$2" + local DOKKU_GIT_REMOTE APP="" + local cmd_set=false arg_set="$2" next_index=1 skip=false args=("$@") for arg in "$@"; do - $skip && break - case "$arg" in - --remote) - DOKKU_GIT_REMOTE=${args[$next_index]} - skip=true - shift 2 - ;; - esac + if [[ "$skip" == "true" ]]; then + next_index=$(( next_index + 1 )) + skip=false + continue + fi + + if [[ "$arg" == "--app" ]]; then + APP=${args[$next_index]} + skip=true + shift 2 + elif [[ "$arg" == "--remote" ]]; then + DOKKU_GIT_REMOTE=${args[$next_index]} + skip=true + shift 2 + elif [[ "$arg" =~ ^--.* ]]; then + [[ "$cmd_set" == "true" ]] && APP_ARG="$arg" && break + [[ "$arg" == "--trace" ]] && export DOKKU_TRACE=1 + else + if [[ "$cmd_set" == "true" ]]; then + APP_ARG="$arg" + break + else + CMD="$arg" + cmd_set=true + fi + fi + next_index=$(( next_index + 1 )) done DOKKU_HOST="$(fn-dokku-host "$DOKKU_GIT_REMOTE" "$DOKKU_HOST")" - appname="" - if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then - set +e - appname=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_HOST" | head -n 1 | cut -f2 -d'@' | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null) - set -e - else - echo "This is not a git repository" + if [[ -z "$APP" ]]; then + if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then + set +e + APP=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_HOST" | head -n 1 | cut -f2 -d'@' | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null) + set -e + else + echo "This is not a git repository" + fi fi - case "$1" in + case "$CMD" in apps:create) - if [[ -z "$2" ]]; then - appname=$(fn-random-name) + if [[ -z "$APP_ARG" ]]; then + APP=$(fn-random-name) counter=0 - while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$appname"; do + while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$APP"; do if [[ $counter -ge 100 ]]; then echo "Error: could not reasonably generate a new app name. try cleaning up some apps..." ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps exit 1 else - appname=$(random_name) + APP=$(random_name) counter=$((counter+1)) fi done else - appname="$2" + APP="$APP_ARG" fi - if git remote add dokku "dokku@$DOKKU_HOST:$appname"; then + if git remote add dokku "dokku@$DOKKU_HOST:$APP"; then echo "-----> Dokku remote added at ${DOKKU_HOST} called ${DOKKU_GIT_REMOTE}" - echo "-----> Application name is ${appname}" + echo "-----> Application name is ${APP}" else echo "! Dokku remote not added! Do you already have a dokku remote?" return @@ -113,10 +134,11 @@ main() { ;; esac - [[ "$1" =~ apps|certs|certs:chain|domains:add-global|domains:remove-global|domains:set-global|help|ls|nginx|ps:rebuildall|ps:restartall|ps:restore|shell|storage|trace|version ]] && unset appname - [[ "$1" =~ events*|plugin*|ssh-keys* ]] && unset appname - [[ -n "$2" ]] && [[ "$2" == "--global" ]] && unset appname - [[ -n "$@" ]] && [[ -n "$appname" ]] && app_arg="--app $appname" + [[ " apps certs help ls nginx shell storage trace version " == *" $CMD "* ]] && unset APP + [[ " certs:chain domains:add-global domains:remove-global domains:set-global ps:rebuildall ps:restartall ps:restore " == *" $CMD "* ]] && unset APP + [[ "$CMD" =~ events*|plugin*|ssh-keys* ]] && unset APP + [[ -n "$APP_ARG" ]] && [[ "$APP_ARG" == "--global" ]] && unset APP + [[ -n "$@" ]] && [[ -n "$APP" ]] && app_arg="--app $APP" # echo "ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@" # shellcheck disable=SC2068,SC2086 ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@ From c216b3be7f5f2aec0dfcab44eeaa1605b73a35fd Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 9 Jan 2017 02:34:48 -0700 Subject: [PATCH 112/295] feat: add support for --global flag when calling `dokku domains` --- docs/configuration/domains.md | 2 +- plugins/domains/subcommands/default | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/configuration/domains.md b/docs/configuration/domains.md index 9313a6258..86e9e3e7e 100644 --- a/docs/configuration/domains.md +++ b/docs/configuration/domains.md @@ -3,7 +3,7 @@ > New as of 0.3.10 ``` -domains [] # List domains +domains [|--global] # List domains domains:add [ ...] # Add domains to app domains:add-global [ ...] # Add global domain names domains:clear # Clear all domains for app diff --git a/plugins/domains/subcommands/default b/plugins/domains/subcommands/default index 011a1c292..c046e7fac 100755 --- a/plugins/domains/subcommands/default +++ b/plugins/domains/subcommands/default @@ -12,6 +12,11 @@ domains_main_cmd() { dokku_log_info2_quiet "Global Domain Name" get_global_vhosts fi + + if [[ "$APP" == "--global" ]]; then + return + fi + if [[ -n "$APP" ]]; then verify_app_name "$APP" if [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then From 90510378c85fee4e7106cb65db1de4bfff633024 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Thu, 12 Jan 2017 13:27:22 +0200 Subject: [PATCH 113/295] Improve install documentation on CentOS --- README.md | 8 +++++++- docs/getting-started/install/rpm.md | 6 +++++- docs/getting-started/installation.md | 6 ++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c6febc908..d3ed4328a 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,13 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. ## Requirements -- A fresh VM running `Debian 8.2 x64`, `Ubuntu 14.04 x64`, or `Ubuntu 16.04 x64` +A fresh VM running any of the following OS: + +- Ubuntu 16.04 x64 +- Ubuntu 14.04 x64 +- Debian 8.2 x64 +- CentOS 7 x64 *(experimental)* +- Arch Linux x64 *(experimental)* ## Installing diff --git a/docs/getting-started/install/rpm.md b/docs/getting-started/install/rpm.md index 1b71370d8..f51e9283f 100644 --- a/docs/getting-started/install/rpm.md +++ b/docs/getting-started/install/rpm.md @@ -1,6 +1,8 @@ # RPM Package Installation Notes -> New as of 0.8.0 +> New as of 0.8.0 *(experimental)* + +>**Warning:** Web installer is not available on CentOS. You will need to configure [SSH keys](/dokku/deployment/user-management/#adding-ssh-keys) and [virtual hosts](/dokku/configuration/domains/#customizing-hostnames) using dokku command line interface. Dokku defaults to being installed via RPM package on CentOS 7. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of Dokku without the use of our `bootstrap.sh` bash script. The following are the steps run by said script: @@ -16,3 +18,5 @@ curl -s https://packagecloud.io/install/repositories/dokku/dokku/script.rpm.sh | sudo yum install -y herokuish dokku sudo dokku plugin:install-dependencies --core ``` + +The [devicemapper](https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/) is the default Docker storage driver on CentOS 7 and defaults to a configuration mode known as `loop-lvm`. This mode is designed to work out-of-the-box with no additional configuration. However, production deployments should not run under `loop-lvm` mode. The preferred configuration for production deployments is [`direct-lvm`](https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/#/configure-direct-lvm-mode-for-production). diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 6e0358d2e..e2c5ddb1e 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -6,12 +6,12 @@ Dokku is an extensible, open source Platform as a Service that runs on a single To start using Dokku, you'll need a system that meets the following minimum requirements: -- A fresh installation of [Ubuntu 14.04 x64](http://www.ubuntu.com/download/) with the FQDN set [1] +- A fresh installation of [Ubuntu 16.04 x64](https://www.ubuntu.com/download), [Ubuntu 14.04 x64](https://www.ubuntu.com/download), [Debian 8.2 x64](https://www.debian.org/distrib/) or [CentOS 7 x64](https://www.centos.org/download/) *(experimental)* with the FQDN set [1] - At least `1GB` of system memory [2] You can *optionally* have a domain name pointed at the host's IP, though this is not necessary. -Dokku is designed for usage on a fresh installation of Ubuntu, and should install all necessary dependencies if installing via the bootstrap method. +Dokku is designed for usage on a fresh VM installation, and should install all necessary dependencies if installing via the bootstrap method. ### Installing the latest stable version @@ -33,6 +33,8 @@ Once the installation is complete, you can open a browser to setup your SSH key >**Warning:** If you don't complete setup via the web installer (even if you set up SSH keys and virtual hosts otherwise) your Dokku installation will remain vulnerable to anyone finding the setup page and inserting their key. +>**Warning:** Web installer is not available on CentOS and Arch Linux. You will need to configure [SSH keys](/dokku/deployment/user-management/#adding-ssh-keys) and [virtual hosts](/dokku/configuration/domains/#customizing-hostnames) using dokku command line interface. + #### 3. Deploy your first application Once you save your settings, the web admin will self-terminate and you should be able to run or deploy to the Dokku installation. From 0de746da4e62dd08e437bce5f5c7eb2bd8af6251 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 13 Jan 2017 16:20:13 -0700 Subject: [PATCH 114/295] fix shellcheck issues --- plugins/git/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/functions b/plugins/git/functions index dd6ac32a2..620da1729 100755 --- a/plugins/git/functions +++ b/plugins/git/functions @@ -47,7 +47,7 @@ suppress_output() { TMP_COMMAND_OUTPUT=$(mktemp "/tmp/${FUNCNAME[0]}.XXXX") trap 'rm -rf "$TMP_COMMAND_OUTPUT" > /dev/null' RETURN INT TERM EXIT - $* 2>&1 > "$TMP_COMMAND_OUTPUT" || { + "$@" > "$TMP_COMMAND_OUTPUT" 2>&1 || { local exit_code="$?" cat "$TMP_COMMAND_OUTPUT" return "$exit_code" From 06fa58ff47ca935459a90e8ef7e7f14356f18ad5 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 13 Jan 2017 17:29:51 -0700 Subject: [PATCH 115/295] chore: remove extra space [ci skip] --- plugins/ps/subcommands/restore | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/ps/subcommands/restore b/plugins/ps/subcommands/restore index 1dab28f4b..818c3d980 100755 --- a/plugins/ps/subcommands/restore +++ b/plugins/ps/subcommands/restore @@ -20,7 +20,6 @@ ps_restore_cmd() { if ps_start "$app"; then continue fi - dokku_log_warn "dokku ps:restore ${app} failed" fi done From 24c4f25dd0558f73f152dbc2f8921e7100856d69 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 14 Jan 2017 13:58:45 -0700 Subject: [PATCH 116/295] fix: set DOKKU_GIT_REMOTE to a default of dokku --- contrib/dokku_client.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 9ba6d9d63..707a6b98a 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -58,7 +58,7 @@ fn-dokku-host() { main() { declare CMD="$1" APP_ARG="$2" - local DOKKU_GIT_REMOTE APP="" + local DOKKU_GIT_REMOTE="dokku" APP="" local cmd_set=false arg_set="$2" next_index=1 skip=false args=("$@") for arg in "$@"; do From 0f5dec17978415a6c54238ca23be648a251fd4ce Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 14 Jan 2017 14:00:21 -0700 Subject: [PATCH 117/295] refactor: rename variable usage to DOKKU_REMOTE_HOST This allows us to make it a local variable --- contrib/dokku_client.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 707a6b98a..46bcbf718 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -58,7 +58,7 @@ fn-dokku-host() { main() { declare CMD="$1" APP_ARG="$2" - local DOKKU_GIT_REMOTE="dokku" APP="" + local APP="" DOKKU_GIT_REMOTE="dokku" DOKKU_REMOTE_HOST="" local cmd_set=false arg_set="$2" next_index=1 skip=false args=("$@") for arg in "$@"; do @@ -78,7 +78,7 @@ main() { shift 2 elif [[ "$arg" =~ ^--.* ]]; then [[ "$cmd_set" == "true" ]] && APP_ARG="$arg" && break - [[ "$arg" == "--trace" ]] && export DOKKU_TRACE=1 + [[ "$arg" == "--trace" ]] && export DOKKU_TRACE=1 && set -x else if [[ "$cmd_set" == "true" ]]; then APP_ARG="$arg" @@ -91,12 +91,12 @@ main() { next_index=$(( next_index + 1 )) done - DOKKU_HOST="$(fn-dokku-host "$DOKKU_GIT_REMOTE" "$DOKKU_HOST")" + DOKKU_REMOTE_HOST="$(fn-dokku-host "$DOKKU_GIT_REMOTE" "$DOKKU_HOST")" if [[ -z "$APP" ]]; then if [[ -d .git ]] || git rev-parse --git-dir > /dev/null 2>&1; then set +e - APP=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_HOST" | head -n 1 | cut -f2 -d'@' | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null) + APP=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_REMOTE_HOST" | head -n 1 | cut -f2 -d'@' | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null) set -e else echo "This is not a git repository" @@ -108,10 +108,10 @@ main() { if [[ -z "$APP_ARG" ]]; then APP=$(fn-random-name) counter=0 - while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps 2>/dev/null| grep -q "$APP"; do + while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_REMOTE_HOST" apps 2>/dev/null| grep -q "$APP"; do if [[ $counter -ge 100 ]]; then echo "Error: could not reasonably generate a new app name. try cleaning up some apps..." - ssh -p "$DOKKU_PORT" "dokku@$DOKKU_HOST" apps + ssh -p "$DOKKU_PORT" "dokku@$DOKKU_REMOTE_HOST" apps exit 1 else APP=$(random_name) @@ -121,8 +121,8 @@ main() { else APP="$APP_ARG" fi - if git remote add dokku "dokku@$DOKKU_HOST:$APP"; then - echo "-----> Dokku remote added at ${DOKKU_HOST} called ${DOKKU_GIT_REMOTE}" + if git remote add dokku "dokku@$DOKKU_REMOTE_HOST:$APP"; then + echo "-----> Dokku remote added at ${DOKKU_REMOTE_HOST} called ${DOKKU_GIT_REMOTE}" echo "-----> Application name is ${APP}" else echo "! Dokku remote not added! Do you already have a dokku remote?" @@ -139,9 +139,9 @@ main() { [[ "$CMD" =~ events*|plugin*|ssh-keys* ]] && unset APP [[ -n "$APP_ARG" ]] && [[ "$APP_ARG" == "--global" ]] && unset APP [[ -n "$@" ]] && [[ -n "$APP" ]] && app_arg="--app $APP" - # echo "ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@" + # echo "ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_REMOTE_HOST -- $app_arg $@" # shellcheck disable=SC2068,SC2086 - ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_HOST -- $app_arg $@ + ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_REMOTE_HOST -- $app_arg $@ } if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then From 67f05b8eed1b05c8d3bf6d0924525b84d8a3fec6 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 14 Jan 2017 14:02:14 -0700 Subject: [PATCH 118/295] fix: show error message when there is no DOKKU_REMOTE_HOST available --- contrib/dokku_client.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 46bcbf718..45267ae12 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -31,8 +31,8 @@ fn-random-name() { } fn-client-help-msg() { - echo "==> Configure the DOKKU_HOST environment variable or run $0 from a repository with a git remote named dokku" - echo "--> i.e. git remote add dokku dokku@:" + echo "==> Configure the DOKKU_HOST environment variable or run $0 from a repository with a git remote named dokku" 1>&2 + echo "--> i.e. git remote add dokku dokku@:" 1>&2 exit 20 # exit with specific status. only used in units tests for now } @@ -53,6 +53,10 @@ fn-dokku-host() { fi fi + if [[ -z "$DOKKU_HOST" ]]; then + fn-client-help-msg + fi + echo "$DOKKU_HOST" } From 8497bd6d707f276e59dede423c7d0d062efd548a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 14 Jan 2017 14:08:22 -0700 Subject: [PATCH 119/295] chore: remove extra newline [ci skip] --- plugins/git/functions | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/git/functions b/plugins/git/functions index 620da1729..96ce9b9aa 100755 --- a/plugins/git/functions +++ b/plugins/git/functions @@ -55,7 +55,6 @@ suppress_output() { return 0 } - git_hook_cmd() { declare desc="kick off receive-app trigger from git prereceive hook" local cmd="git-hook" From fc4b7ce0ee656b7ad2723cf888059f29efc05e31 Mon Sep 17 00:00:00 2001 From: klemens Date: Sat, 14 Jan 2017 22:35:24 +0100 Subject: [PATCH 120/295] spelling fixes --- docs/configuration/ssl.md | 2 +- docs/deployment/process-management.md | 4 ++-- plugins/checks/commands | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/configuration/ssl.md b/docs/configuration/ssl.md index 8656606c6..31d8a080f 100644 --- a/docs/configuration/ssl.md +++ b/docs/configuration/ssl.md @@ -50,7 +50,7 @@ Note that with the default nginx template, requests will be redirected to the `h The `certs:generate` command will walk you through the correct `openssl` commands to create a key, csr and a self-signed cert for a given app/domain. We automatically put the self-signed cert in place as well as add the specified domain to the application configuration. -If you decide to obtain a CA signed certficate, you can import that certificate using the aformentioned `dokku certs:add` command. +If you decide to obtain a CA signed certificate, you can import that certificate using the aforementioned `dokku certs:add` command. ### Certificate information diff --git a/docs/deployment/process-management.md b/docs/deployment/process-management.md index bd924e4e4..997dcd240 100644 --- a/docs/deployment/process-management.md +++ b/docs/deployment/process-management.md @@ -31,7 +31,7 @@ dokku ps node-js-app ### Rebuilding applications -There are some Dokku commands which will not automatically rebuild an application's environment, or which can be told to skip a rebuild. For instance, you may wish to run mulitple `config:set` commands without a restart so as to speed up configuration. In these cases, you can ultimately trigger an application rebuild using `ps:rebuild` +There are some Dokku commands which will not automatically rebuild an application's environment, or which can be told to skip a rebuild. For instance, you may wish to run multiple `config:set` commands without a restart so as to speed up configuration. In these cases, you can ultimately trigger an application rebuild using `ps:rebuild` ```shell dokku ps:rebuild node-js-app @@ -92,7 +92,7 @@ dokku ps:scale node-js-app ### Stopping applications -Deployed applications can be stopped using the `ps:stop` command. This turns all running containers for an application, and will result in a `502 Bad Gateway` reponse for the default nginx proxy implementation. +Deployed applications can be stopped using the `ps:stop` command. This turns all running containers for an application, and will result in a `502 Bad Gateway` response for the default nginx proxy implementation. ```shell dokku ps:stop node-js-app diff --git a/plugins/checks/commands b/plugins/checks/commands index 2400b5ee0..5f27055ac 100755 --- a/plugins/checks/commands +++ b/plugins/checks/commands @@ -16,7 +16,7 @@ help_content } if [[ $1 = "checks:help" ]] ; then - echo -e 'Usage: dokku checks[:COMAND]' + echo -e 'Usage: dokku checks[:COMMAND]' echo '' echo 'Manage zero-downtime settings.' echo '' From e09d09323950af566756a529e52e9bf2f05fae76 Mon Sep 17 00:00:00 2001 From: klemens Date: Sat, 14 Jan 2017 22:38:27 +0100 Subject: [PATCH 121/295] spelling fixes --- docs/advanced-usage/repository-management.md | 4 ++-- plugins/repo/commands | 2 +- plugins/repo/subcommands/gc | 2 +- tests/apps/multi/static/styles/main.scss | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/advanced-usage/repository-management.md b/docs/advanced-usage/repository-management.md index 9cee535aa..e8235f863 100644 --- a/docs/advanced-usage/repository-management.md +++ b/docs/advanced-usage/repository-management.md @@ -3,7 +3,7 @@ > New as of 0.6.0 ``` -repo:gc # Runs 'git gc --agressive' against the application's repo +repo:gc # Runs 'git gc --aggressive' against the application's repo repo:purge-cache # Deletes the contents of the build cache stored in the repository ``` @@ -13,7 +13,7 @@ The repository plugin is meant to allow users to perform management commands aga ### Git Garbage Collection -This will run a git gc --agressive against the applications repo. This is performed on the Dokku host, and not within an application container. +This will run a git gc --aggressive against the applications repo. This is performed on the Dokku host, and not within an application container. ```shell dokku repo:gc node-js-app diff --git a/plugins/repo/commands b/plugins/repo/commands index 5025f89f5..816768bf3 100755 --- a/plugins/repo/commands +++ b/plugins/repo/commands @@ -7,7 +7,7 @@ case "$1" in help_content_func () { declare desc="return repo plugin help content" cat<, Runs 'git gc --agressive' against the application's repo + repo:gc , Runs 'git gc --aggressive' against the application's repo repo:purge-cache , Deletes the contents of the build cache stored in the repository help_content } diff --git a/plugins/repo/subcommands/gc b/plugins/repo/subcommands/gc index 0fd3f281e..fbeb9b153 100755 --- a/plugins/repo/subcommands/gc +++ b/plugins/repo/subcommands/gc @@ -3,7 +3,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" repo_gc() { - declare desc="runs 'git gc --agressive' against the application's repo" + declare desc="runs 'git gc --aggressive' against the application's repo" local cmd="repo:gc" [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" local APP="$2"; local APP_DIR="$DOKKU_ROOT/$APP" diff --git a/tests/apps/multi/static/styles/main.scss b/tests/apps/multi/static/styles/main.scss index 93efb53fa..20b7ae981 100644 --- a/tests/apps/multi/static/styles/main.scss +++ b/tests/apps/multi/static/styles/main.scss @@ -1,4 +1,4 @@ -// override scss variables within bootsrap by delaring them +// override scss variables within bootsrap by declaring them // before importing bootstrap $brand-primary: #428bca !default; From f0ecac59986b748c7a9b75827cdce165b810a8d8 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 15 Jan 2017 01:05:08 -0700 Subject: [PATCH 122/295] Update persistent storage to reference the sample app as normal [ci skip] --- docs/advanced-usage/persistent-storage.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/advanced-usage/persistent-storage.md b/docs/advanced-usage/persistent-storage.md index a34f7bd2a..5410debaa 100644 --- a/docs/advanced-usage/persistent-storage.md +++ b/docs/advanced-usage/persistent-storage.md @@ -17,10 +17,11 @@ The storage plugin requires explicit paths on the host side. This is intentional ## Usage -This example demonstrates how to mount the recommended directory to `/storage` inside the container: +This example demonstrates how to mount the recommended directory to `/storage` inside an application called `node-js-app`: ```shell -dokku storage:mount app-name /var/lib/dokku/data/storage:/storage +# we use a subdirectory inside of the host directory to scope it to just the app +dokku storage:mount node-js-app /var/lib/dokku/data/storage/node-js-app:/storage ``` Dokku will then mount the shared contents of `/var/lib/dokku/data/storage` to `/storage` inside the container. @@ -35,17 +36,17 @@ dokku ps:rebuild app-name A more complete workflow may require making a custom directory for your application and mounting it within your `/app/storage` directory instead. The mount point is *not* relative to your application's working directory, and is instead relative to the root of the container. ```shell -# creating storage for the app 'ruby-rails-sample' -mkdir -p /var/lib/dokku/data/storage/ruby-rails-sample +# creating storage for the app 'node-js-app' +mkdir -p /var/lib/dokku/data/storage/node-js-app # ensure the proper user has access to this directory -chown -R dokku:dokku /var/lib/dokku/data/storage/ruby-rails-sample +chown -R dokku:dokku /var/lib/dokku/data/storage/node-js-app # as of 0.7.x, you should chown using the `32767` user and group id -chown -R 32767:32767 /var/lib/dokku/data/storage/ruby-rails-sample +chown -R 32767:32767 /var/lib/dokku/data/storage/node-js-app # mount the directory into your container's /app/storage directory, relative to root -dokku storage:mount app-name /var/lib/dokku/data/storage/app-name:/app/storage +dokku storage:mount app-name /var/lib/dokku/data/storage/node-js-app:/app/storage ``` You can mount one or more directories as desired by following the above pattern. From 927d569db592171123504180aabd462fb2edbcce Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 15 Jan 2017 01:07:12 -0700 Subject: [PATCH 123/295] Move "new as of" note to correct section Also move note up. [ci skip] --- docs/advanced-usage/persistent-storage.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/advanced-usage/persistent-storage.md b/docs/advanced-usage/persistent-storage.md index 5410debaa..4cf00aafe 100644 --- a/docs/advanced-usage/persistent-storage.md +++ b/docs/advanced-usage/persistent-storage.md @@ -11,6 +11,8 @@ storage:mount # Create a new bind mount storage:unmount # Remove an existing bind mount ``` +> The storage plugin is compatible with storage mounts created with the docker-options. The storage plugin will only list mounts from the deploy/run phase. + ## Ideology and Background The storage plugin requires explicit paths on the host side. This is intentional to ensure that new users avoid running into unexpected results with implicit paths that may not exist (a feature deprecate in [Docker 1.9.0](https://github.com/docker/docker/releases/tag/v1.9.0])). The container directory is created for the mount point in the container. Any existing directory contents are not accessible after a mount is added to the container. Dokku creates a new directory `/var/lib/dokku/data/storage` during installation, it's the general consensus that new users should use this directory. Mounts are only available at run and deploy times, you must redeploy (restart) an app to mount or unmount to an existing app's container. @@ -81,15 +83,10 @@ You cannot use mounted volumes during the build phase of a Dockerfile deploy. Th > Note: **This can cause data loss** if you bind a mount under `/app` in buildpack apps as herokuish will attempt to remove the original app path during the build phase. -## Docker-Options Note - -The storage plugin is compatible with storage mounts created with the docker-options. The storage plugin will only list mounts from the deploy phase. - +## Application User and Persistent Storage file ownership (buildpack apps only) > New as of 0.7.1 -## Application User and Persistent Storage file ownership (buildpack apps only) - By default, Dokku will execute your buildpack application processes as the `herokuishuser` user. You may override this by setting the `DOKKU_APP_USER` config variable. > NOTE: this user must exist in your herokuish image. From f5f2a5f1719492eadf0a17d84f9faf2eb6d79c30 Mon Sep 17 00:00:00 2001 From: Alexis Tyler Date: Mon, 16 Jan 2017 18:12:11 +1030 Subject: [PATCH 124/295] Reload nginx after creating default vhost file --- docs/configuration/domains.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/configuration/domains.md b/docs/configuration/domains.md index 9313a6258..b71b2042c 100644 --- a/docs/configuration/domains.md +++ b/docs/configuration/domains.md @@ -92,6 +92,8 @@ server { } ``` +Make sure to reload nginx after creating this file by running `service nginx reload`. + This will catch all unknown HOST header values and return a `410 Gone` response. You can replace the `return 410;` with `return 444;` which will cause nginx to not respond to requests that do not match known domains (connection refused). The configuration file must be loaded before `/etc/nginx/conf.d/dokku.conf`, so it can not be arranged as a vhost in `/etc/nginx/sites-enabled` that is only processed afterwards. From b874692d06168e562b7d591f446662d9e1a645ac Mon Sep 17 00:00:00 2001 From: Alexis Tyler Date: Mon, 16 Jan 2017 18:25:20 +1030 Subject: [PATCH 125/295] add dokku report command for 0.4.10+ --- ISSUE_TEMPLATE.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index 0917e8bcc..c83340e33 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -3,6 +3,8 @@ Description of problem: Output of the following commands + + - `uname -a`: - `free -m`: - `docker version`: From 3a8e80c5307d36cd633f634892dd7675c1d169a7 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 16 Jan 2017 15:38:35 -0700 Subject: [PATCH 126/295] fix: use correct markup for link [ci skip] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c2b73d82c..2ceb0e61b 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ If you wish for a more unattended installation method, see [these](http://dokku. ### Upgrade -[View the docs] for upgrading(http://dokku.viewdocs.io/dokku/getting-started/upgrading/) from an older version of Dokku. +[View the docs](http://dokku.viewdocs.io/dokku/getting-started/upgrading/) for upgrading from an older version of Dokku. ## Documentation From eb5d4d07085eb54c9e84b74f9a98374f86cefe52 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 16 Jan 2017 15:42:25 -0700 Subject: [PATCH 127/295] docs: move badges to newline [ci skip] --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ceb0e61b..10fd7bbb8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ -# Dokku [![Build Status](https://img.shields.io/circleci/project/dokku/dokku/master.svg?style=flat-square "Build Status")](https://circleci.com/gh/dokku/dokku/tree/master) [![Ubuntu Package](https://img.shields.io/badge/package-ubuntu-brightgreen.svg?style=flat-square "Ubuntu Package")](https://packagecloud.io/dokku/dokku) [![Arch Package](https://img.shields.io/badge/package-arch-brightgreen.svg?style=flat-square "Arch Package")](https://aur.archlinux.org/packages/dokku/) [![IRC Network](https://img.shields.io/badge/irc-freenode-blue.svg?style=flat-square "IRC Freenode")](https://webchat.freenode.net/?channels=dokku) [![Slack Group](https://img.shields.io/badge/irc-slack-blue.svg?style=flat-square "Slack Group")](https://glider-slackin.herokuapp.com/) [![Documentation](https://img.shields.io/badge/docs-viewdocs-blue.svg?style=flat-square "Viewdocs")](http://dokku.viewdocs.io/dokku/) +# Dokku +[![Build Status](https://img.shields.io/circleci/project/dokku/dokku/master.svg?style=flat-square "Build Status")](https://circleci.com/gh/dokku/dokku/tree/master) +[![Ubuntu Package](https://img.shields.io/badge/package-ubuntu-brightgreen.svg?style=flat-square "Ubuntu Package")](https://packagecloud.io/dokku/dokku) +[![Arch Package](https://img.shields.io/badge/package-arch-brightgreen.svg?style=flat-square "Arch Package")](https://aur.archlinux.org/packages/dokku/) +[![IRC Network](https://img.shields.io/badge/irc-freenode-blue.svg?style=flat-square "IRC Freenode")](https://webchat.freenode.net/?channels=dokku) +[![Slack Group](https://img.shields.io/badge/irc-slack-blue.svg?style=flat-square "Slack Group")](https://glider-slackin.herokuapp.com/) +[![Documentation](https://img.shields.io/badge/docs-viewdocs-blue.svg?style=flat-square "Viewdocs")](http://dokku.viewdocs.io/dokku/) [![OpenCollective](https://opencollective.com/dokku/sponsors/badge.svg?style=flat-square)](#sponsors) [![OpenCollective](https://opencollective.com/dokku/backers/badge.svg?style=flat-square)](#backers) [![Gratipay](https://img.shields.io/gratipay/dokku.svg?style=flat-square)](https://gratipay.com/dokku/) From e233e916aafa8837a2e728286a9e00d75450254b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 16 Jan 2017 15:43:12 -0700 Subject: [PATCH 128/295] docs: move sponsors and backers section up --- README.md | 82 +++++++++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 10fd7bbb8..5058bf804 100644 --- a/README.md +++ b/README.md @@ -11,47 +11,6 @@ Docker powered mini-Heroku. The smallest PaaS implementation you've ever seen. -## Requirements - -A fresh VM running any of the following operating systems: - -- Ubuntu 16.04 x64 -- Ubuntu 14.04 x64 -- Debian 8.2 x64 -- CentOS 7 x64 *(experimental)* -- Arch Linux x64 *(experimental)* - -## Installation - -To install the latest stable release, run the following commands as a user who has access to `sudo`: - -```shell -wget https://raw.githubusercontent.com/dokku/dokku/v0.8.0/bootstrap.sh -sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh -``` - -You can then proceed to the ip address or domain name associated with your server to complete the web-based installation. - -If you wish for a more unattended installation method, see [these](http://dokku.viewdocs.io/dokku/getting-started/install/debian/#unattended-installation) docs. - -### Upgrade - -[View the docs](http://dokku.viewdocs.io/dokku/getting-started/upgrading/) for upgrading from an older version of Dokku. - -## Documentation - -Full documentation - including advanced installation docs - are available online [here](http://dokku.viewdocs.io/dokku/) - -## Support - -You can use [Github Issues](https://github.com/dokku/dokku/issues), check [Troubleshooting](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) in the documentation, or join us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku) - -## Contribution - -After checking [Github Issues](https://github.com/dokku/dokku/issues), the [Troubleshooting Guide](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) or having a chat with us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku), feel free to fork and create a Pull Request. - -While we may not merge your PR as is, they serve to start conversations and improve the general Dokku experience for all users. - ## Sponsors See our list of past sponsors in the [SPONSORS](https://github.com/dokku/dokku/blob/master/SPONSORS.md) file. @@ -125,6 +84,47 @@ Support us with a monthly donation and help us continue our activities. [[Become +## Requirements + +A fresh VM running any of the following operating systems: + +- Ubuntu 16.04 x64 +- Ubuntu 14.04 x64 +- Debian 8.2 x64 +- CentOS 7 x64 *(experimental)* +- Arch Linux x64 *(experimental)* + +## Installation + +To install the latest stable release, run the following commands as a user who has access to `sudo`: + +```shell +wget https://raw.githubusercontent.com/dokku/dokku/v0.8.0/bootstrap.sh +sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh +``` + +You can then proceed to the ip address or domain name associated with your server to complete the web-based installation. + +If you wish for a more unattended installation method, see [these](http://dokku.viewdocs.io/dokku/getting-started/install/debian/#unattended-installation) docs. + +### Upgrade + +[View the docs](http://dokku.viewdocs.io/dokku/getting-started/upgrading/) for upgrading from an older version of Dokku. + +## Documentation + +Full documentation - including advanced installation docs - are available online [here](http://dokku.viewdocs.io/dokku/) + +## Support + +You can use [Github Issues](https://github.com/dokku/dokku/issues), check [Troubleshooting](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) in the documentation, or join us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku) + +## Contribution + +After checking [Github Issues](https://github.com/dokku/dokku/issues), the [Troubleshooting Guide](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) or having a chat with us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku), feel free to fork and create a Pull Request. + +While we may not merge your PR as is, they serve to start conversations and improve the general Dokku experience for all users. + ## License [MIT License](https://github.com/dokku/dokku/blob/master/LICENSE) © Jeff Lindsay From 33c9bc9908b41b9c668611e5d814682207df21d0 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Wed, 18 Jan 2017 09:25:08 +0200 Subject: [PATCH 129/295] Recommend parallel package for faster ps:restore --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index d88270c1a..a3c7f25dd 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Section: web Priority: optional Architecture: amd64 Depends: locales, git, make, curl, gcc, man-db, sshcommand, gliderlabs-sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1), software-properties-common, python-software-properties -Recommends: herokuish +Recommends: herokuish, parallel Pre-Depends: nginx, dnsutils, cgroupfs-mount | cgroup-lite, plugn, sudo, python2.7, debconf Maintainer: Jose Diaz-Gonzalez Description: Docker-powered PaaS that helps build and manage the lifecycle of applications From fec2f8e38ea69500c36e4a797f5265a64a1fad3c Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Fri, 20 Jan 2017 00:26:51 +0900 Subject: [PATCH 130/295] Remove unused variable --- contrib/dokku_client.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/dokku_client.sh b/contrib/dokku_client.sh index 45267ae12..a0a1963cc 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -63,7 +63,7 @@ fn-dokku-host() { main() { declare CMD="$1" APP_ARG="$2" local APP="" DOKKU_GIT_REMOTE="dokku" DOKKU_REMOTE_HOST="" - local cmd_set=false arg_set="$2" next_index=1 skip=false args=("$@") + local cmd_set=false next_index=1 skip=false args=("$@") for arg in "$@"; do if [[ "$skip" == "true" ]]; then From bdb38ceaa87c5134821f9a167a1e5f46bb5b296e Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 19 Jan 2017 17:34:09 -0700 Subject: [PATCH 131/295] Require specific versions for dokku-maintained packages Closes #2450 [ci skip] --- debian/control | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/control b/debian/control index a3c7f25dd..d4ff40970 100644 --- a/debian/control +++ b/debian/control @@ -3,9 +3,9 @@ Version: 0.8.0 Section: web Priority: optional Architecture: amd64 -Depends: locales, git, make, curl, gcc, man-db, sshcommand, gliderlabs-sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1), software-properties-common, python-software-properties -Recommends: herokuish, parallel -Pre-Depends: nginx, dnsutils, cgroupfs-mount | cgroup-lite, plugn, sudo, python2.7, debconf +Depends: locales, git, make, curl, gcc, man-db, sshcommand (>= 0.6.0), gliderlabs-sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1), software-properties-common, python-software-properties +Recommends: herokuish (>= 0.3.4), parallel +Pre-Depends: nginx, dnsutils, cgroupfs-mount | cgroup-lite, plugn (>= 0.2.2), sudo, python2.7, debconf Maintainer: Jose Diaz-Gonzalez Description: Docker-powered PaaS that helps build and manage the lifecycle of applications Dokku is an extensible, open source Platform as a Service From 517314565329bc544698e63df78b96db091ccea9 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Fri, 20 Jan 2017 23:47:07 +0900 Subject: [PATCH 132/295] Fix font URL It is broken since https://github.com/dokku/dokku/commit/a00a9219dae3921c22538f89751b8ae50b45e930#diff-d93d3d701f4e262a6177c91d4e0b9a36R10 --- docs/home.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/home.html b/docs/home.html index f8f0c65f9..d65794e82 100644 --- a/docs/home.html +++ b/docs/home.html @@ -7,7 +7,7 @@ - + Dokku - The smallest PaaS implementation you've ever seen From a564eae9f16b041befe8d0885bb7cec43e234ade Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 22 Jan 2017 21:39:30 -0700 Subject: [PATCH 133/295] feat: implement application cloning Application cloning can be used to setup review applications based on an existing application. This is useful in CI/CD pipelines where a developer may wish to verify code in a custom environment without overwriting a shared staging environment. --- docs/deployment/application-management.md | 23 +++++++++++++ plugins/apps/commands | 1 + plugins/apps/subcommands/clone | 39 +++++++++++++++++++++++ tests/unit/10_apps.bats | 33 +++++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100755 plugins/apps/subcommands/clone diff --git a/docs/deployment/application-management.md b/docs/deployment/application-management.md index 9b44c3ebc..7f7add379 100644 --- a/docs/deployment/application-management.md +++ b/docs/deployment/application-management.md @@ -4,6 +4,7 @@ ``` apps # List your apps +apps:clone # Clone an app apps:create # Create a new app apps:destroy # Permanently destroy an app apps:rename # Rename an app @@ -112,3 +113,25 @@ Renaming node-js-app to io-js-app... done ``` This will copy all of your app's contents into a new app directory with the name of your choice, delete your old app, then rebuild the new version of the app and deploy it. All of your config variables, including database urls, will be preserved. + +### Cloning an existing app + +> New as of 0.8.1 + +You can clone an existing app using the `apps:clone` command. Note that the application *must* have been deployed at least once, or the rename will not complete successfully: + +```shell +dokku apps:clone node-js-app io-js-app +``` + +``` +Cloning node-js-app to io-js-app... done +``` + +This will copy all of your app's contents into a new app directory with the name of your choice and then rebuild the new version of the app and deploy it. All of your config variables, including database urls, will be preserved. + +By default, Dokku will deploy this new application, though you can skip the deploy by using the `--skip-deploy` flag: + +```shell +dokku apps:clone --skip-deploy node-js-app io-js-app +``` diff --git a/plugins/apps/commands b/plugins/apps/commands index c46d255b1..660d799fb 100755 --- a/plugins/apps/commands +++ b/plugins/apps/commands @@ -8,6 +8,7 @@ case "$1" in declare desc="return apps plugin help content" cat< , Clone an app apps:create , Create a new app apps:destroy , Permanently destroy an app apps:rename , Rename an app diff --git a/plugins/apps/subcommands/clone b/plugins/apps/subcommands/clone new file mode 100755 index 000000000..4f1a4c38d --- /dev/null +++ b/plugins/apps/subcommands/clone @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/apps/functions" +source "$PLUGIN_AVAILABLE_PATH/ps/functions" + +apps_clone_cmd() { + declare desc="renames an app" + declare OLD_APP="$2" NEW_APP="$3" + local cmd="apps:rename" + local SKIP_REBUILD=false + + if [[ "$2" == "--skip-deploy" ]]; then + SKIP_REBUILD=true + OLD_APP="$3" + NEW_APP="$4" + fi + + [[ -z "$OLD_APP" ]] && dokku_log_fail "Please specify an app to run the command on" + [[ -d "$DOKKU_ROOT/$NEW_APP" ]] && dokku_log_fail "Name is already taken" + local NEW_CACHE_DIR="$DOKKU_ROOT/$NEW_APP/cache" + + apps_create "$NEW_APP" + cp -a "$DOKKU_ROOT/$OLD_APP/." "$DOKKU_ROOT/$NEW_APP" + + if [[ -d "$NEW_CACHE_DIR" ]] && ! rmdir "$NEW_CACHE_DIR"; then + docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$NEW_CACHE_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache + fi + rm -rf "$NEW_CACHE_DIR" + + [[ -f "$DOKKU_ROOT/$NEW_APP/URLS" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/URLS" + [[ -f "$DOKKU_ROOT/$NEW_APP/VHOST" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/VHOST" + [[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]] && sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" + [[ "$SKIP_REBUILD" == "false" ]] || ps_rebuild "$NEW_APP" + plugn trigger post-app-clone "$OLD_APP" "$NEW_APP" + echo "Cloning $OLD_APP to $NEW_APP... done" +} + +apps_clone_cmd "$@" diff --git a/tests/unit/10_apps.bats b/tests/unit/10_apps.bats index 9558b3e9b..17ed29be3 100644 --- a/tests/unit/10_apps.bats +++ b/tests/unit/10_apps.bats @@ -90,3 +90,36 @@ teardown () { echo "status: "$status assert_success } + +@test "(apps) apps:clone" { + deploy_app + run bash -c "dokku apps:clone $TEST_APP great-test-name" + echo "output: "$output + echo "status: "$status + assert_success + run bash -c "dokku apps | grep $TEST_APP" + echo "output: "$output + echo "status: "$status + assert_success + run bash -c "curl --silent --write-out '%{http_code}\n' `dokku url great-test-name` | grep 404" + echo "output: "$output + echo "status: "$status + assert_output "" + run bash -c "dokku --force apps:destroy great-test-name" + echo "output: "$output + echo "status: "$status + assert_success + + run bash -c "dokku apps:clone --skip-deploy $TEST_APP great-test-name" + echo "output: "$output + echo "status: "$status + assert_success + run bash -c "curl --silent --write-out '%{http_code}\n' `dokku url great-test-name` | grep 404" + echo "output: "$output + echo "status: "$status + assert_failure + run bash -c "dokku --force apps:destroy great-test-name" + echo "output: "$output + echo "status: "$status + assert_success +} From 143b4802c30274e4f78cd47a6ea2853697c73f1b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 22 Jan 2017 22:55:09 -0700 Subject: [PATCH 134/295] fix: use correct verb [ci skip] --- plugins/apps/subcommands/clone | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/apps/subcommands/clone b/plugins/apps/subcommands/clone index 4f1a4c38d..565ed13bc 100755 --- a/plugins/apps/subcommands/clone +++ b/plugins/apps/subcommands/clone @@ -5,9 +5,9 @@ source "$PLUGIN_AVAILABLE_PATH/apps/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" apps_clone_cmd() { - declare desc="renames an app" + declare desc="clones an app" declare OLD_APP="$2" NEW_APP="$3" - local cmd="apps:rename" + local cmd="apps:clone" local SKIP_REBUILD=false if [[ "$2" == "--skip-deploy" ]]; then From dd517a3dd11a283f82e0aac02e2a5aa9881f4550 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 22 Jan 2017 22:55:28 -0700 Subject: [PATCH 135/295] Update application-management.md [ci skip] --- docs/deployment/application-management.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deployment/application-management.md b/docs/deployment/application-management.md index 7f7add379..3ee69f6a9 100644 --- a/docs/deployment/application-management.md +++ b/docs/deployment/application-management.md @@ -4,7 +4,7 @@ ``` apps # List your apps -apps:clone # Clone an app +apps:clone # Clones an app apps:create # Create a new app apps:destroy # Permanently destroy an app apps:rename # Rename an app From 33a7619eac98b6ecba0504c61a537daa8bbc5d1f Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 22 Jan 2017 22:55:40 -0700 Subject: [PATCH 136/295] Update commands [ci skip] --- plugins/apps/commands | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/apps/commands b/plugins/apps/commands index 660d799fb..234108cdf 100755 --- a/plugins/apps/commands +++ b/plugins/apps/commands @@ -8,7 +8,7 @@ case "$1" in declare desc="return apps plugin help content" cat< , Clone an app + apps:clone , Clones an app apps:create , Create a new app apps:destroy , Permanently destroy an app apps:rename , Rename an app From d473c1635fbb4faf5ac0f941843c17689a8b3173 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 23 Jan 2017 12:03:16 -0700 Subject: [PATCH 137/295] docs: add a note about errors that can occur for non-generic config [ci skip] --- docs/deployment/application-management.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/deployment/application-management.md b/docs/deployment/application-management.md index 3ee69f6a9..1ddf5715a 100644 --- a/docs/deployment/application-management.md +++ b/docs/deployment/application-management.md @@ -130,6 +130,8 @@ Cloning node-js-app to io-js-app... done This will copy all of your app's contents into a new app directory with the name of your choice and then rebuild the new version of the app and deploy it. All of your config variables, including database urls, will be preserved. +> Warning: If you have exposed specific ports via docker-options, added generic domains, or performed anything that cannot be done against multiple applications, `apps:clone` may result in errors. + By default, Dokku will deploy this new application, though you can skip the deploy by using the `--skip-deploy` flag: ```shell From c82c9562b633063510987936c7381c02a6ffca3f Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 24 Jan 2017 02:54:26 -0700 Subject: [PATCH 138/295] fix: use correct check for skipping a rebuild --- plugins/apps/subcommands/clone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/apps/subcommands/clone b/plugins/apps/subcommands/clone index 565ed13bc..829882c2c 100755 --- a/plugins/apps/subcommands/clone +++ b/plugins/apps/subcommands/clone @@ -31,7 +31,7 @@ apps_clone_cmd() { [[ -f "$DOKKU_ROOT/$NEW_APP/URLS" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/URLS" [[ -f "$DOKKU_ROOT/$NEW_APP/VHOST" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/VHOST" [[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]] && sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" - [[ "$SKIP_REBUILD" == "false" ]] || ps_rebuild "$NEW_APP" + [[ "$SKIP_REBUILD" == "true" ]] || ps_rebuild "$NEW_APP" plugn trigger post-app-clone "$OLD_APP" "$NEW_APP" echo "Cloning $OLD_APP to $NEW_APP... done" } From f393fa04421c9979bf8f866acaa0ba3b23c6b145 Mon Sep 17 00:00:00 2001 From: Dave Bevan Date: Wed, 25 Jan 2017 17:37:26 +0000 Subject: [PATCH 139/295] Behind-proxy support for herokuish install Inject http proxy envvars to docker build command to allow package installation behind corporate proxies. These envvars (http_proxy and https_proxy) are standard, and usually configured via system-wide /etc/profile.d files. In cases where these envvars are not configured, the additions appear to be mute and non-destructive. --- deb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deb.mk b/deb.mk index eac9a9ced..ab1e831c7 100644 --- a/deb.mk +++ b/deb.mk @@ -92,7 +92,7 @@ deb-herokuish: @echo " sudo docker rmi gliderlabs/herokuish" >> /tmp/tmp/post-install @echo "fi" >> /tmp/tmp/post-install @echo "echo 'Importing herokuish into docker (around 5 minutes)'" >> /tmp/tmp/post-install - @echo "sudo docker build -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null" >> /tmp/tmp/post-install + @echo "sudo docker build --build-args http_proxy=$http_proxy --build-args https_proxy=$https_proxy -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null" >> /tmp/tmp/post-install @echo "-> Cloning repository" git clone -q "https://github.com/$(HEROKUISH_REPO_NAME).git" --branch "v$(HEROKUISH_VERSION)" /tmp/tmp/herokuish > /dev/null From 0aeee7ea28d7678f45be7fa5708fb91a5c21a108 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 26 Jan 2017 00:32:23 -0700 Subject: [PATCH 140/295] Allow specifying the deploy branch via DOKKU_DEPLOY_BRANCH Closes #2494 --- docs/deployment/application-deployment.md | 12 ++++++++++ plugins/git/functions | 27 +++++++++++++++++++++-- tests/unit/20_config.bats | 14 ++++++++++++ tests/unit/test_helper.bash | 11 ++++----- 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/docs/deployment/application-deployment.md b/docs/deployment/application-deployment.md index 903add341..c8f0d2e9a 100644 --- a/docs/deployment/application-deployment.md +++ b/docs/deployment/application-deployment.md @@ -90,6 +90,18 @@ Dokku supports deploying applications via [Heroku buildpacks](https://devcenter. Dokku only supports deploying from its master branch, so if you'd like to deploy a different local branch use: ```git push dokku :master``` +An alternative is to use the `DOKKU_DEPLOY_BRANCH` application config value to specify a branch that should be deployed. The implicit default is master, and this can be modified both at the app and global level: + +```shell +# on your Dokku host + +# set it globally +dokku config:set --global DOKKU_DEPLOY_BRANCH=some-branch + +# override for a specific app +dokku config:set ruby-rails-sample DOKKU_DEPLOY_BRANCH=some-branch +``` + You can also support pushing multiple branches using the [receive-branch](/dokku/development/plugin-triggers/#receive-branch) plugin trigger in a custom plugin. ### Skipping deployment diff --git a/plugins/git/functions b/plugins/git/functions index 96ce9b9aa..5e0da3726 100755 --- a/plugins/git/functions +++ b/plugins/git/functions @@ -55,16 +55,39 @@ suppress_output() { return 0 } +git_deploy_branch() { + declare desc="retrieve the deploy branch for a given application" + local cmd="git-hook" + local APP="$1" + + local DOKKU_DEPLOY_BRANCH="$(config_get "$APP" DOKKU_DEPLOY_BRANCH || true)" + local DOKKU_GLOBAL_DEPLOY_BRANCH="$(config_get --global DOKKU_DEPLOY_BRANCH || true)" + if [[ -n "$DOKKU_DEPLOY_BRANCH" ]]; then + echo "$DOKKU_DEPLOY_BRANCH" + elif [[ -n "$DOKKU_GLOBAL_DEPLOY_BRANCH" ]]; then + echo "$DOKKU_GLOBAL_DEPLOY_BRANCH" + else + echo "master" + fi +} + git_hook_cmd() { declare desc="kick off receive-app trigger from git prereceive hook" local cmd="git-hook" - local APP="$2" + local APP="$2" + local DOKKU_DEPLOY_BRANCH="$(git_deploy_branch "$APP")" + + if ! git check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" 2> /dev/null; then + echo $'\e[1G\e[K'"-----> WARNING: Invalid branch name '$DOKKU_DEPLOY_BRANCH' specified via DOKKU_DEPLOY_BRANCH." + echo $'\e[1G\e[K'"-----> For more details, please see the man page for 'git-check-ref-format.'" + return + fi local oldrev newrev refname while read -r oldrev newrev refname; do # Only run this script for the master branch. You can remove this # if block if you wish to run it for others as well. - if [[ $refname = "refs/heads/master" ]]; then + if [[ $refname = "refs/heads/${DOKKU_DEPLOY_BRANCH}" ]]; then # broken out into plugin so we might support other methods to receive an app # shellcheck disable=SC2086 plugn trigger receive-app $APP $newrev diff --git a/tests/unit/20_config.bats b/tests/unit/20_config.bats index a5894372c..87dafa332 100644 --- a/tests/unit/20_config.bats +++ b/tests/unit/20_config.bats @@ -145,3 +145,17 @@ teardown() { echo "status: "$status assert_success } + +@test "(config) deploy specific DOKKU_DEPLOY_BRANCH" { + run ssh dokku@dokku.me config:set --global DOKKU_DEPLOY_BRANCH=global-branch + GIT_REMOTE_BRANCH=global-branch deploy_app + echo "output: "$output + echo "status: "$status + assert_success + + run ssh dokku@dokku.me config:set $TEST_APP DOKKU_DEPLOY_BRANCH=app-branch + GIT_REMOTE_BRANCH=app-branch deploy_app + echo "output: "$output + echo "status: "$status + assert_success +} diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index e6d16da86..b59841339 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -196,10 +196,11 @@ assert_http_redirect() { } deploy_app() { - local APP_TYPE="$1"; local APP_TYPE=${APP_TYPE:="nodejs-express"} - local GIT_REMOTE="$2"; local GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"} - local CUSTOM_TEMPLATE="$3"; local TMP=$(mktemp -d "/tmp/dokku.me.XXXXX") - local CUSTOM_PATH="$4" + declare APP_TYPE="$1" GIT_REMOTE="$2" CUSTOM_TEMPLATE="$3" CUSTOM_PATH="$4" + local APP_TYPE=${APP_TYPE:="nodejs-express"} + local GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"} + local GIT_REMOTE_BRANCH=${GIT_REMOTE_BRANCH:="master"} + local TMP=$(mktemp -d "/tmp/dokku.me.XXXXX") rmdir "$TMP" && cp -r "./tests/apps/$APP_TYPE" "$TMP" @@ -218,7 +219,7 @@ deploy_app() { [[ -f gitignore ]] && mv gitignore .gitignore git add . git commit -m 'initial commit' - git push target master || destroy_app $? + git push target "master:${GIT_REMOTE_BRANCH}" || destroy_app $? } setup_client_repo() { From 7cac755c988d3fa4b6ec3f4281cc0c6025e7b20c Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 26 Jan 2017 00:46:35 -0700 Subject: [PATCH 141/295] Clarify when the `~/.ssh/config` settings need to match `vagrant ssh-config` output Closes #2466 [ci skip] --- docs/getting-started/install/vagrant.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/getting-started/install/vagrant.md b/docs/getting-started/install/vagrant.md index d6116be84..b6f79c7b0 100644 --- a/docs/getting-started/install/vagrant.md +++ b/docs/getting-started/install/vagrant.md @@ -21,13 +21,15 @@ cd path/to/dokku vagrant up ``` -- Setup SSH Config in `~/.ssh/config`. The port listed here is usually correct, though you may want to verify that it is the same as the one listed in the output of `vagrant ssh-config dokku` +- Setup SSH Config in `~/.ssh/config`. ```ini Host dokku.me Port 22 ``` + > For users that have customized the IP address of their VM - either in a custom `Vagrantfile` or via the `DOKKU_IP` environment variable - and are not using `10.0.0.2` for the Vagrant IP, you'll need to instead use the output of `vagrant ssh-config dokku` for your ~/.ssh/config entry. + - Copy your SSH key via `cat ~/.ssh/id_rsa.pub | pbcopy` and paste it into the dokku-installer at http://dokku.me . Change the `Hostname` field on the Dokku Setup screen to your domain and then check the box that says `Use virtualhost naming`. Then click *Finish Setup* to install your key. You'll be directed to application deployment instructions from here. Please note, the `dokku.me` domain is setup to point to `10.0.0.2` along with all subdomains (ie yourapp.dokku.me). If you change the `DOKKU_IP` in your vagrant setup you'll need to update your `/etc/hosts` file to point your reconfigured ip address. From 9f9b3374bda881f80e9bccf63d72236348ae6875 Mon Sep 17 00:00:00 2001 From: Dave Bevan Date: Thu, 26 Jan 2017 10:34:02 +0000 Subject: [PATCH 142/295] Make docker build --build-args optional Change the proxy-sensing --build-args such that they only added if defined. --- deb.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deb.mk b/deb.mk index ab1e831c7..0b38c744d 100644 --- a/deb.mk +++ b/deb.mk @@ -92,7 +92,10 @@ deb-herokuish: @echo " sudo docker rmi gliderlabs/herokuish" >> /tmp/tmp/post-install @echo "fi" >> /tmp/tmp/post-install @echo "echo 'Importing herokuish into docker (around 5 minutes)'" >> /tmp/tmp/post-install - @echo "sudo docker build --build-args http_proxy=$http_proxy --build-args https_proxy=$https_proxy -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null" >> /tmp/tmp/post-install + @echo 'if [ ! -z ${http_proxy+x} ]; then BUILDARGS="--build-args http_proxy=$http_proxy"; fi' >> /tmp/tmp/post-install + @echo 'if [ ! -z ${https_proxy+x} ]; then BUILDARGS="$BUILDARGS --build-args https_proxy=$https_proxy"; fi' >> /tmp/tmp/post-install + @echo 'if [ ! -z ${BUILDARGS+x} ]; then echo Adding proxy settings to docker build: $BUILDARGS; fi' >> /tmp/tmp/post-install + @echo "sudo docker build $BUILDARGS -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null" >> /tmp/tmp/post-install @echo "-> Cloning repository" git clone -q "https://github.com/$(HEROKUISH_REPO_NAME).git" --branch "v$(HEROKUISH_VERSION)" /tmp/tmp/herokuish > /dev/null From 96a0c2531da8826f9ae0d29e369d5d0db5a75fd2 Mon Sep 17 00:00:00 2001 From: Dave Bevan Date: Fri, 27 Jan 2017 12:02:55 +0000 Subject: [PATCH 143/295] Update deb.mk Updates as requested --- deb.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deb.mk b/deb.mk index 0b38c744d..1d7221a10 100644 --- a/deb.mk +++ b/deb.mk @@ -92,10 +92,10 @@ deb-herokuish: @echo " sudo docker rmi gliderlabs/herokuish" >> /tmp/tmp/post-install @echo "fi" >> /tmp/tmp/post-install @echo "echo 'Importing herokuish into docker (around 5 minutes)'" >> /tmp/tmp/post-install - @echo 'if [ ! -z ${http_proxy+x} ]; then BUILDARGS="--build-args http_proxy=$http_proxy"; fi' >> /tmp/tmp/post-install - @echo 'if [ ! -z ${https_proxy+x} ]; then BUILDARGS="$BUILDARGS --build-args https_proxy=$https_proxy"; fi' >> /tmp/tmp/post-install - @echo 'if [ ! -z ${BUILDARGS+x} ]; then echo Adding proxy settings to docker build: $BUILDARGS; fi' >> /tmp/tmp/post-install - @echo "sudo docker build $BUILDARGS -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null" >> /tmp/tmp/post-install + @echo 'if [[ ! -z ${http_proxy+x} ]]; then BUILDARGS="--build-args http_proxy=$http_proxy"; fi' >> /tmp/tmp/post-install + @echo 'if [[ ! -z ${https_proxy+x} ]]; then BUILDARGS="$BUILDARGS --build-args https_proxy=$https_proxy"; fi' >> /tmp/tmp/post-install + @echo 'if [[ ! -z ${BUILDARGS+x} ]]; then echo Adding proxy settings to docker build: $BUILDARGS; fi' >> /tmp/tmp/post-install + @echo 'sudo docker build $BUILDARGS -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null' >> /tmp/tmp/post-install @echo "-> Cloning repository" git clone -q "https://github.com/$(HEROKUISH_REPO_NAME).git" --branch "v$(HEROKUISH_VERSION)" /tmp/tmp/herokuish > /dev/null From aae740188866c8478a98b4d29d164b2ce3551739 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 30 Jan 2017 03:04:02 -0500 Subject: [PATCH 144/295] fix: always set a default ssl port for apps with ssl enabled Closes #2535 --- plugins/nginx-vhosts/functions | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 8f1af2c40..eaf3ce409 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -100,14 +100,13 @@ configure_nginx_ports() { config_set --no-restart "$APP" DOKKU_NGINX_PORT="$NGINX_PORT" fi if [[ -z "$DOKKU_NGINX_SSL_PORT" ]]; then - if (is_ssl_enabled "$APP") && [[ -z "$RAW_TCP_PORTS" ]]; then - if [[ "$IS_APP_VHOST_ENABLED" == "false" ]]; then + if (is_ssl_enabled "$APP") + local NGINX_SSL_PORT=443 + if [[ -z "$RAW_TCP_PORTS" ]] && [[ "$IS_APP_VHOST_ENABLED" == "false" ]]; then dokku_log_info1 "no nginx ssl port set. setting to random open high port" - local NGINX_SSL_PORT=$(get_available_port) - else - local NGINX_SSL_PORT=443 + NGINX_SSL_PORT=$(get_available_port) fi - config_set --no-restart "$APP" DOKKU_NGINX_SSL_PORT="$NGINX_SSL_PORT" + config_set --no-restart "$APP" DOKKU_NGINX_SSL_PORT="$NGINX_SSL_PORT" fi fi if [[ -z "$DOKKU_PROXY_PORT_MAP" ]]; then From 0de2c28c92c92874b45e5fa4ccc959fbb2750924 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Wed, 1 Feb 2017 11:52:19 -0800 Subject: [PATCH 145/295] upgrade to herokuish v0.3.25 --- deb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deb.mk b/deb.mk index eac9a9ced..ca8411157 100644 --- a/deb.mk +++ b/deb.mk @@ -1,6 +1,6 @@ HEROKUISH_DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku' HEROKUISH_REPO_NAME ?= gliderlabs/herokuish -HEROKUISH_VERSION ?= 0.3.24 +HEROKUISH_VERSION ?= 0.3.25 HEROKUISH_ARCHITECTURE = amd64 HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb From 336ffc9b0991efc12ca4a657851d9083cb96c13a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 5 Feb 2017 13:39:49 -0500 Subject: [PATCH 146/295] Update functions --- plugins/nginx-vhosts/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index eaf3ce409..85c0aebfe 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -100,7 +100,7 @@ configure_nginx_ports() { config_set --no-restart "$APP" DOKKU_NGINX_PORT="$NGINX_PORT" fi if [[ -z "$DOKKU_NGINX_SSL_PORT" ]]; then - if (is_ssl_enabled "$APP") + if (is_ssl_enabled "$APP"); then local NGINX_SSL_PORT=443 if [[ -z "$RAW_TCP_PORTS" ]] && [[ "$IS_APP_VHOST_ENABLED" == "false" ]]; then dokku_log_info1 "no nginx ssl port set. setting to random open high port" From daa8faa3aad1202f6e1741cc9c3782a18b17e73e Mon Sep 17 00:00:00 2001 From: Andy Jeffries Date: Wed, 15 Feb 2017 16:02:38 +0000 Subject: [PATCH 147/295] Added information on SSL_CERT_FILE build failure --- docs/getting-started/troubleshooting.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/getting-started/troubleshooting.md b/docs/getting-started/troubleshooting.md index 5933ea97a..7300b457a 100644 --- a/docs/getting-started/troubleshooting.md +++ b/docs/getting-started/troubleshooting.md @@ -155,6 +155,8 @@ dokku config:set --global CURL_CONNECT_TIMEOUT=30 Please see https://github.com/dokku/dokku/issues/509 +Another reason for this error (although it may respond immediately ruling out a timeout issue) may be because you've set the config setting `SSL_CERT_FILE`. Using a config setting with this key interferes with the buildpack's ability to download it's dependencies, so you must rename the config setting to something else, e.g. `MY_APP_SSL_CERT_FILE`. + *** __Symptom:__ Build fails with `Killed` message. From 7c30babdec403576eefd5252864cc0268fc4ad67 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 19 Feb 2017 19:57:09 -0500 Subject: [PATCH 148/295] fix: Ensure VHOST files exist before executing commands against them Closes #2609 --- plugins/domains/functions | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/domains/functions b/plugins/domains/functions index 51abd1a16..a4171dbd0 100755 --- a/plugins/domains/functions +++ b/plugins/domains/functions @@ -98,6 +98,7 @@ domains_remove() { local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" shift 1 + touch "$APP_VHOST_PATH" for DOMAIN in "$@"; do sed -i "\|^$DOMAIN\$|d" "$APP_VHOST_PATH" dokku_log_info1 "Removed $DOMAIN from $APP" @@ -111,6 +112,7 @@ domains_set() { local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" shift 1 + touch "$APP_VHOST_PATH" for DOMAIN in "$@"; do if ! (is_valid_hostname "$DOMAIN"); then dokku_log_fail "$DOMAIN is invalid. exiting..." @@ -132,6 +134,7 @@ domains_disable() { verify_app_name "$1" local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" + touch "$APP_VHOST_PATH" if [[ "$(is_app_vhost_enabled "$APP")" == "true" ]]; then disable_app_vhost "$APP" else @@ -145,6 +148,7 @@ domains_enable() { local APP="$1"; local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" local DEFAULT_VHOSTS="$(get_default_vhosts "$APP")" + touch "$APP_VHOST_PATH" if [[ "$(is_app_vhost_enabled "$APP")" == "false" ]]; then if [[ -n "$DEFAULT_VHOSTS" ]]; then echo "$DEFAULT_VHOSTS" > "$APP_VHOST_PATH" @@ -160,6 +164,7 @@ domains_add_global() { declare desc="add list of global domains" local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST" + touch "$GLOBAL_VHOST_PATH" for DOMAIN in "$@"; do if ! (is_valid_hostname "$DOMAIN"); then dokku_log_fail "$DOMAIN is invalid. exiting..." @@ -180,6 +185,7 @@ domains_remove_global() { declare desc="remove list of domains" local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST" + touch "$GLOBAL_VHOST_PATH" for DOMAIN in "$@"; do sed -i "\|^$DOMAIN\$|d" "$GLOBAL_VHOST_PATH" dokku_log_info1 "Removed $DOMAIN" @@ -190,6 +196,7 @@ domains_set_global() { declare desc="set list of global domains" local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST" + touch "$GLOBAL_VHOST_PATH" for DOMAIN in "$@"; do if ! (is_valid_hostname "$DOMAIN"); then dokku_log_fail "$DOMAIN is invalid. exiting..." From 189366097e5bc587c683e482d2b03a1d0c2aa81e Mon Sep 17 00:00:00 2001 From: Michael van Olden Date: Sun, 19 Feb 2017 20:01:57 -0500 Subject: [PATCH 149/295] Update linode.md to reflect latest Linode.com process [ci skip] Linode now supports KVM virtualization on all VMs by default. So, this verbiage was completely removed. GRUB 2 is now one of the default options in the Kernel Menu. The additional Ubuntu packages are no longer required. Wording changed to reflect updated instructions. --- docs/getting-started/install/linode.md | 43 +++++++++----------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/docs/getting-started/install/linode.md b/docs/getting-started/install/linode.md index 85d05c103..1fb3bcad9 100644 --- a/docs/getting-started/install/linode.md +++ b/docs/getting-started/install/linode.md @@ -1,41 +1,28 @@ # Installing on Linode -When installing Dokku on a Linode server, you'll likely see an error during Docker installation: +## Enable AUFS Storage Driver + +When installing Dokku on a newly-created Linode server, you'll likely see an error during Docker installation: > Warning: current kernel is not supported by the linux-image-extra-virtual package. We have no AUFS support. Consider installing the packages linux-image-virtual kernel and linux-image-extra-virtual for AUFS support. After 10 seconds, the installation will continue as normal. -This warning is the result of Linode using its own kernel, which does not support AUFS, instead of using the kernel supplied by Ubuntu. If you ignore the warning, Docker will fall back to using the DeviceMapper storage backend and Dokku will work normally. However, AUFS is better tested and will perform better. +This warning is the result of Linode using its own kernel, which does not support AUFS, instead of using the kernel supplied by Debian/Ubuntu. If you ignore the warning, Docker will fall back to using the DeviceMapper storage backend and Dokku will work normally. However, AUFS is better tested and will perform better. -If you would like to use AUFS, follow the steps below to install Ubuntu's kernel and configure your server to boot it instead of Linode's. +To avoid this error message and use AUFS, follow the steps below to select the GRUB 2 kernel. -## Preparing your Linode for AUFS -__Warning__: These steps will delete *everything* on your Linode. +### Select the GRUB 2 kernel instead of the default Linode kernel: -1. Open your server's dashboard in the [Linode Manager](https://manager.linode.com/). - -2. Make sure your Linode is [using KVM](https://www.linode.com/docs/platform/kvm#how-to-enable-kvm), not Xen, for virtualization. - -3. In the "Rebuild" tab, select "Ubuntu 14.04 LTS", set a root password, and rebuild. - -4. Once your Linode has been created, click "Boot" and wait for it to complete. - -5. SSH into your Linode as root and run the following commands: - - ```shell - apt-get update - apt-get -qq upgrade - apt-get install linux-image-virtual linux-image-extra-virtual - ``` - -6. When prompted, install Grub onto the first hard drive. - -7. Back in your server's dashboard, click "Edit" on its Configuration Profile - -8. Change the "Kernel" option to "GRUB 2" and save your changes. - -9. Lastly, reboot the Linode. +1. Login to your [Linode Manager](http://manager.linode.com), open the `Dashboard` associated with your new server. +2. Click `Edit` for the `Configuration Profile`. You should now be on the `Edit Configuration Profile` page. +3. Scroll down to `Boot Settings` > `Kernel menu`. Change the "Kernel" option to "GRUB 2" and save your changes. +4. If you have already pushed the `Boot` button and your server is running, you will need to reboot it before continuing. Otherwise, you can now push the `Boot` button to start your server and proceed with the normal Dokku installation. Once your server comes back online, you'll be running Ubuntu's default kernel. You can now follow Dokku's [normal installation instructions](/dokku/getting-started/installation/) and `bootstrap.sh` will take care of everything else. + + +### Verify that you are using AUFS: + +Once you have fully installed Dokku and rebooted your server, you can verify that AUFS is being used with the terminal command: `docker info`. If AUFS is being used, you should see `Storage Driver: aufs` in the output. From 51217521e337dbb0b714d67f5f0abccc1b30a426 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 16:39:43 -0700 Subject: [PATCH 150/295] feat: add certs:report Refs #2356 --- docs/configuration/ssl.md | 55 +++++++++++++ plugins/certs/commands | 1 + plugins/certs/subcommands/report | 136 +++++++++++++++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100755 plugins/certs/subcommands/report diff --git a/docs/configuration/ssl.md b/docs/configuration/ssl.md index 31d8a080f..8e574562b 100644 --- a/docs/configuration/ssl.md +++ b/docs/configuration/ssl.md @@ -9,6 +9,7 @@ certs:add CRT KEY # Add an ssl endpoint to an app. Can al certs:generate DOMAIN # Generate a key and certificate signing request (and self-signed certificate) certs:info # Show certificate information for an ssl endpoint. certs:remove # Remove an SSL Endpoint from an app. +certs:report [] [] # Displays an ssl report for one or more apps certs:update CRT KEY # Update an SSL Endpoint on an app. Can also import from a tarball on stdin ``` @@ -76,6 +77,60 @@ dokku certs:info node-js-app The `certs:remove` command only works on app-specific certificates. It will `rm` the app-specific tls directory, rebuild the nginx configuration, and reload nginx. +### Displaying ssl reports about an app + +> New as of 0.8.1 + +You can get a report about the apps ssl status using the `certs:report` command: + +```shell +dokku certs:report +``` + +``` +=====> node-js-sample + Ssl dir: /home/dokku/node-js-sample/tls + Ssl enabled: true + Ssl hostnames: *.node-js-sample.org node-js-sample.org + Ssl expires at: Oct 5 23:59:59 2019 GMT + Ssl issuer: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Domain Validation Secure Server CA + Ssl starts at: Oct 5 00:00:00 2016 GMT + Ssl subject: OU=Domain Control Validated; OU=PositiveSSL Wildcard; CN=*.node-js-sample.org + Ssl verified: self signed. +=====> python-sample + Ssl dir: /home/dokku/python-sample/tls + Ssl enabled: false + Ssl hostnames: + Ssl expires at: + Ssl issuer: + Ssl starts at: + Ssl subject: + Ssl verified: +``` + +You can run the command for a specific app also. + +```shell +dokku certs:report node-js-sample +``` + +``` +=====> node-js-sample ssl information + Ssl dir: /home/dokku/node-js-sample/tls + Ssl enabled: true + Ssl hostnames: *.example.org example.org + Ssl expires at: Oct 5 23:59:59 2019 GMT + Ssl issuer: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Domain Validation Secure Server CA + Ssl starts at: Oct 5 00:00:00 2016 GMT + Ssl subject: OU=Domain Control Validated; OU=PositiveSSL Wildcard; CN=*.example.org + Ssl verified: self signed. +``` + +You can pass flags which will output only the value of the specific information you want. For example: + +```shell +dokku certs:report node-js-sample --ssl-enabled +``` ## HSTS Header diff --git a/plugins/certs/commands b/plugins/certs/commands index c34b902c8..550d97f8d 100755 --- a/plugins/certs/commands +++ b/plugins/certs/commands @@ -14,6 +14,7 @@ case "$1" in certs:info , Show certificate information for an ssl endpoint certs:key CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate certs:remove , Remove an SSL Endpoint from an app + certs:report [] [], Displays an ssl report for one or more apps certs:rollback , [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app certs:update CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin help_content diff --git a/plugins/certs/subcommands/report b/plugins/certs/subcommands/report new file mode 100755 index 000000000..6f0e59031 --- /dev/null +++ b/plugins/certs/subcommands/report @@ -0,0 +1,136 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/certs/functions" + +fn-ssl-enabled() { + declare APP="$1" + local SSL_ENABLED=false + + if is_ssl_enabled "$APP"; then + SSL_ENABLED=true + fi + echo "$SSL_ENABLED" +} + +fn-ssl-expires-at() { + declare APP="$1" + local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" + + if is_ssl_enabled "$APP"; then + echo "$(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')" + fi +} + +fn-ssl-hostnames() { + declare APP="$1" + + if is_ssl_enabled "$APP"; then + get_ssl_hostnames "$APP" | xargs + fi +} + +fn-ssl-issuer() { + declare APP="$1" + local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" + + if is_ssl_enabled "$APP"; then + echo "$(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")" + fi +} + +fn-ssl-starts-at() { + declare APP="$1" + local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" + + if is_ssl_enabled "$APP"; then + echo "$(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')" + fi +} + +fn-ssl-subject() { + declare APP="$1" + local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" + + if is_ssl_enabled "$APP"; then + echo "$(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")" + fi +} + +fn-ssl-verified() { + declare APP="$1" + local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" + local SSL_VERIFY_OUTPUT=false SSL_SELF_SIGNED="self signed" + + if ! is_ssl_enabled "$APP"; then + return + fi + + SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)" + if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then + SSL_SELF_SIGNED="verified by a certificate authority" + fi + + echo "$SSL_SELF_SIGNED" +} + +certs_report_single_app() { + local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" + if [[ "$INFO_FLAG" == "true" ]]; then + INFO_FLAG="" + fi + verify_app_name "$APP" + local flag_map=( + "--ssl-dir: $APP_DIR/tls" + "--ssl-enabled: $(fn-ssl-enabled "$APP")" + "--ssl-hostnames: $(fn-ssl-hostnames "$APP")" + "--ssl-expires-at: $(fn-ssl-expires-at "$APP")" + "--ssl-issuer: $(fn-ssl-issuer "$APP")" + "--ssl-starts-at: $(fn-ssl-starts-at "$APP")" + "--ssl-subject: $(fn-ssl-subject "$APP")" + "--ssl-verified: $(fn-ssl-verified "$APP")" + ) + + if [[ -z "$INFO_FLAG" ]]; then + dokku_log_info2 "$APP ssl information" + for flag in "${flag_map[@]}"; do + key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')" + dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")" + done + else + local match=false; local value_exists=false + for flag in "${flag_map[@]}"; do + valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)" + if [[ "$flag" == "${INFO_FLAG}:"* ]]; then + value=${flag#*: } + size="${#value}" + if [[ "$size" -ne 0 ]]; then + echo "$value" && match=true && value_exists=true + else + match=true + fi + fi + done + if [[ "$match" == "true" ]]; then + [[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed" + else + dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}" + fi + fi +} + +certs_report_cmd() { + declare desc="displays an ssl report for one or more apps" + local cmd="certs:report" + local INSTALLED_APPS=$(dokku_apps); local APP + + if [[ -z $2 ]]; then + for APP in $INSTALLED_APPS; do + certs_report_single_app "$APP" "true" + done + else + certs_report_single_app "$2" "$3" + fi +} + +certs_report_cmd "$@" From dcb88226b5f77c34163c0728e1f69ac30eb63233 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 16:47:14 -0700 Subject: [PATCH 151/295] refactor: ensure that certs:default and certs:info are deprecated in favor of certs:report Refs #2356 --- docs/configuration/ssl.md | 23 +------------------ plugins/certs/functions | 33 --------------------------- plugins/certs/internal-functions | 38 +++++++++++++++++++++++++++++++ plugins/certs/subcommands/default | 12 +++------- plugins/certs/subcommands/info | 4 ++-- 5 files changed, 44 insertions(+), 66 deletions(-) create mode 100755 plugins/certs/internal-functions mode change 100644 => 100755 plugins/certs/subcommands/default diff --git a/docs/configuration/ssl.md b/docs/configuration/ssl.md index 8e574562b..4c9b25e8f 100644 --- a/docs/configuration/ssl.md +++ b/docs/configuration/ssl.md @@ -7,7 +7,6 @@ Dokku supports SSL/TLS certificate inspection and CSR/Self-signed certificate ge ``` certs:add CRT KEY # Add an ssl endpoint to an app. Can also import from a tarball on stdin. certs:generate DOMAIN # Generate a key and certificate signing request (and self-signed certificate) -certs:info # Show certificate information for an ssl endpoint. certs:remove # Remove an SSL Endpoint from an app. certs:report [] [] # Displays an ssl report for one or more apps certs:update CRT KEY # Update an SSL Endpoint on an app. Can also import from a tarball on stdin @@ -53,31 +52,11 @@ The `certs:generate` command will walk you through the correct `openssl` command If you decide to obtain a CA signed certificate, you can import that certificate using the aforementioned `dokku certs:add` command. -### Certificate information - -The `certs:info` command will simply inspect the install SSL cert and print out details. NOTE: The server-wide certificate will be inspect if installed and no app-specific certificate exists. - -```shell -dokku certs:info node-js-app -``` - -``` ------> Fetching SSL Endpoint info for node-js-app... ------> Certificate details: -=====> Common Name(s): -=====> test.dokku.me -=====> Expires At: Aug 24 23:32:59 2016 GMT -=====> Issuer: C=US, ST=California, L=San Francisco, O=dokku.me, CN=test.dokku.me -=====> Starts At: Aug 25 23:32:59 2015 GMT -=====> Subject: C=US; ST=California; L=San Francisco; O=dokku.me; CN=test.dokku.me -=====> SSL certificate is self signed. -``` - ### Certificate removal The `certs:remove` command only works on app-specific certificates. It will `rm` the app-specific tls directory, rebuild the nginx configuration, and reload nginx. -### Displaying ssl reports about an app +### Displaying certificate reports about an app > New as of 0.8.1 diff --git a/plugins/certs/functions b/plugins/certs/functions index 55c0ea953..a130c993e 100755 --- a/plugins/certs/functions +++ b/plugins/certs/functions @@ -2,39 +2,6 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -certs_info_cmd() { - # This is here because it's used in both the info and the default - declare desc="prints SSL certificate info for app" - local cmd="certs:info" - [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" - verify_app_name "$2" - local APP="$2"; local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" - - if [[ -n "$APP_SSL_PATH" ]]; then - dokku_log_info1 "Fetching SSL Endpoint info for $APP..." - dokku_log_info1 "Certificate details:" - dokku_log_info2 "Common Name(s): " - - for domain in $(get_ssl_hostnames "$APP" | xargs); do - dokku_log_info2 " $domain" - done - - dokku_log_info2 "Expires At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')" - dokku_log_info2 "Issuer: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")" - dokku_log_info2 "Starts At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')" - dokku_log_info2 "Subject: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")" - local SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)" - if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then - local SSL_SELF_SIGNED="verified by a certificate authority." - else - local SSL_SELF_SIGNED="self signed." - fi - dokku_log_info2 "SSL certificate is $SSL_SELF_SIGNED" - else - dokku_log_info1 "$APP does not have an SSL endpoint" - fi -} - is_ssl_enabled() { declare desc="returns 0 if ssl is enabled for given app" local APP=$1; verify_app_name "$APP" diff --git a/plugins/certs/internal-functions b/plugins/certs/internal-functions new file mode 100755 index 000000000..3e319812b --- /dev/null +++ b/plugins/certs/internal-functions @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/certs/functions" + +certs_info_cmd() { + # This is here because it's used in both the info and the default + declare desc="prints SSL certificate info for app" + local cmd="certs:info" + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" + verify_app_name "$2" + local APP="$2" + local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" + + if [[ -n "$APP_SSL_PATH" ]]; then + dokku_log_info1 "Fetching SSL Endpoint info for $APP..." + dokku_log_info1 "Certificate details:" + dokku_log_info2 "Common Name(s): " + + for domain in $(get_ssl_hostnames "$APP" | xargs); do + dokku_log_info2 " $domain" + done + + dokku_log_info2 "Expires At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')" + dokku_log_info2 "Issuer: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")" + dokku_log_info2 "Starts At: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')" + dokku_log_info2 "Subject: $(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")" + local SSL_VERIFY_OUTPUT="$(openssl verify -verbose -purpose sslserver "$APP_SSL_PATH/server.crt" | awk -F ':' '{ print $2 }' | tail -1 | xargs || true)" + if [[ "$SSL_VERIFY_OUTPUT" == "OK" ]]; then + local SSL_SELF_SIGNED="verified by a certificate authority." + else + local SSL_SELF_SIGNED="self signed." + fi + dokku_log_info2 "SSL certificate is $SSL_SELF_SIGNED" + else + dokku_log_info1 "$APP does not have an SSL endpoint" + fi +} diff --git a/plugins/certs/subcommands/default b/plugins/certs/subcommands/default old mode 100644 new mode 100755 index 5eabd33b8..9591bedae --- a/plugins/certs/subcommands/default +++ b/plugins/certs/subcommands/default @@ -1,12 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_AVAILABLE_PATH/certs/functions" +source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions" -certs_main_cmd() { - declare desc="an alias for certs:info" - local cmd="certs" - certs_info_cmd "$@" -} - -certs_main_cmd "$@" +dokku_log_warn "Deprecated: Please use certs:report" +certs_info_cmd "$@" diff --git a/plugins/certs/subcommands/info b/plugins/certs/subcommands/info index 77fd90b7c..9591bedae 100755 --- a/plugins/certs/subcommands/info +++ b/plugins/certs/subcommands/info @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_AVAILABLE_PATH/certs/functions" +source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions" +dokku_log_warn "Deprecated: Please use certs:report" certs_info_cmd "$@" From 507ae1de331c640dc28afa5898e7126383c012c5 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 16:50:38 -0700 Subject: [PATCH 152/295] =?UTF-8?q?fix:=20ensure=20certs:info=20doesn?= =?UTF-8?q?=E2=80=99t=20output=20error=20information=20when=20ssl=20files?= =?UTF-8?q?=20are=20missing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/certs/internal-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/certs/internal-functions b/plugins/certs/internal-functions index 3e319812b..a225ae6d7 100755 --- a/plugins/certs/internal-functions +++ b/plugins/certs/internal-functions @@ -12,7 +12,7 @@ certs_info_cmd() { local APP="$2" local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" - if [[ -n "$APP_SSL_PATH" ]]; then + if is_ssl_enabled "$APP"; then dokku_log_info1 "Fetching SSL Endpoint info for $APP..." dokku_log_info1 "Certificate details:" dokku_log_info2 "Common Name(s): " From cb71d8a0be01abe078a72331b75dc3174d231c98 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 16:51:46 -0700 Subject: [PATCH 153/295] fix: clean up certs help output --- plugins/certs/commands | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/certs/commands b/plugins/certs/commands index 550d97f8d..972968821 100755 --- a/plugins/certs/commands +++ b/plugins/certs/commands @@ -7,11 +7,11 @@ case "$1" in help_content_func () { declare desc="return certs plugin help content" cat< CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate certs:generate DOMAIN, Generate a key and certificate signing request (and self-signed certificate) - certs:info , Show certificate information for an ssl endpoint + certs:info , [DEPRECATED] Alternative for certs:report certs:key CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate certs:remove , Remove an SSL Endpoint from an app certs:report [] [], Displays an ssl report for one or more apps @@ -21,14 +21,18 @@ help_content } if [[ $1 = "certs:help" ]] ; then - echo -e 'Usage: dokku certs:COMMAND' - echo '' - echo 'Manage Dokku apps SSL (TLS) certs.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, + echo -e 'Usage: dokku certs:COMMAND' + echo '' + echo 'Manage Dokku apps SSL (TLS) certs.' + echo '' + echo 'Additional commands:' + help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + help_content_func else - help_content_func + cat< Date: Mon, 20 Feb 2017 17:11:53 -0700 Subject: [PATCH 154/295] refactor: move certs:help into internal-functions --- plugins/certs/commands | 32 ++----------------------------- plugins/certs/internal-functions | 33 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/plugins/certs/commands b/plugins/certs/commands index 972968821..9e13305ab 100755 --- a/plugins/certs/commands +++ b/plugins/certs/commands @@ -1,39 +1,11 @@ #!/usr/bin/env bash [[ " help certs:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in help | certs:help) - help_content_func () { - declare desc="return certs plugin help content" - cat< CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin - certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate - certs:generate DOMAIN, Generate a key and certificate signing request (and self-signed certificate) - certs:info , [DEPRECATED] Alternative for certs:report - certs:key CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate - certs:remove , Remove an SSL Endpoint from an app - certs:report [] [], Displays an ssl report for one or more apps - certs:rollback , [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app - certs:update CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin -help_content - } - - if [[ $1 = "certs:help" ]] ; then - echo -e 'Usage: dokku certs:COMMAND' - echo '' - echo 'Manage Dokku apps SSL (TLS) certs.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then - help_content_func - else - cat< CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin + certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate + certs:generate DOMAIN, Generate a key and certificate signing request (and self-signed certificate) + certs:info , [DEPRECATED] Alternative for certs:report + certs:key CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate + certs:remove , Remove an SSL Endpoint from an app + certs:report [] [], Displays an ssl report for one or more apps + certs:rollback , [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app + certs:update CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin +help_content +} + +certs_help_cmd() { + if [[ $1 = "certs:help" ]] ; then + echo -e 'Usage: dokku certs[:COMMAND]' + echo '' + echo 'Manage Dokku apps SSL (TLS) certs.' + echo '' + echo 'Additional commands:' + certs_help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + certs_help_content_func + else + cat< Date: Mon, 20 Feb 2017 17:18:29 -0700 Subject: [PATCH 155/295] feat: implement apps:list Also deprecate the `apps` command in favor of `apps:list` --- plugins/apps/commands | 3 ++- plugins/apps/internal-functions | 14 ++++++++++++++ plugins/apps/subcommands/default | 16 +++------------- plugins/apps/subcommands/list | 5 +++++ 4 files changed, 24 insertions(+), 14 deletions(-) create mode 100755 plugins/apps/internal-functions create mode 100755 plugins/apps/subcommands/list diff --git a/plugins/apps/commands b/plugins/apps/commands index 97b8fae13..d6a140f4b 100755 --- a/plugins/apps/commands +++ b/plugins/apps/commands @@ -7,10 +7,11 @@ case "$1" in help_content_func () { declare desc="return apps plugin help content" cat< , Clones an app apps:create , Create a new app apps:destroy , Permanently destroy an app + apps:list, List your apps apps:rename , Rename an app apps:report [] [], Display report about an app help_content diff --git a/plugins/apps/internal-functions b/plugins/apps/internal-functions new file mode 100755 index 000000000..1374bda6b --- /dev/null +++ b/plugins/apps/internal-functions @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" + +apps_list_cmd() { + declare desc="lists all apps" + local cmd="apps" + local app + + dokku_log_info2_quiet "My Apps" + for app in $(dokku_apps); do + echo "$app" + done +} diff --git a/plugins/apps/subcommands/default b/plugins/apps/subcommands/default index 47f5973a6..ac2c04ed3 100755 --- a/plugins/apps/subcommands/default +++ b/plugins/apps/subcommands/default @@ -1,16 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions" -apps_main_cmd() { - declare desc="lists all apps" - local cmd="apps" - local app - - dokku_log_info2_quiet "My Apps" - for app in $(dokku_apps); do - echo "$app" - done -} - -apps_main_cmd "$@" +dokku_log_warn "Deprecated: Please use apps:list" +apps_list_cmd "$@" diff --git a/plugins/apps/subcommands/list b/plugins/apps/subcommands/list new file mode 100755 index 000000000..b9573fac2 --- /dev/null +++ b/plugins/apps/subcommands/list @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions" + +apps_list_cmd "$@" From cd3e637387d1560ea3c9f5465e42fb065dc66642 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 17:22:41 -0700 Subject: [PATCH 156/295] refactor: move apps:help to internal-functions --- plugins/apps/commands | 32 ++-------------------------- plugins/apps/internal-functions | 37 +++++++++++++++++++++++++++++++++ plugins/apps/subcommands/report | 2 +- 3 files changed, 40 insertions(+), 31 deletions(-) diff --git a/plugins/apps/commands b/plugins/apps/commands index d6a140f4b..84cd4b172 100755 --- a/plugins/apps/commands +++ b/plugins/apps/commands @@ -1,39 +1,11 @@ #!/usr/bin/env bash [[ " help apps:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in help | apps:help) - help_content_func () { - declare desc="return apps plugin help content" - cat< , Clones an app - apps:create , Create a new app - apps:destroy , Permanently destroy an app - apps:list, List your apps - apps:rename , Rename an app - apps:report [] [], Display report about an app -help_content - } - - if [[ $1 = "apps:help" ]] ; then - echo -e 'Usage: dokku apps[:COMMAND]' - echo '' - echo 'List your apps.' - echo '' - echo 'Example:' - echo '' - echo '$ dokku apps' - echo '=====> My Apps' - echo 'example' - echo 'example2' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + apps_help_cmd "$@" ;; *) diff --git a/plugins/apps/internal-functions b/plugins/apps/internal-functions index 1374bda6b..274132560 100755 --- a/plugins/apps/internal-functions +++ b/plugins/apps/internal-functions @@ -2,6 +2,43 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +apps_help_content_func() { + declare desc="return apps plugin help content" + cat< , Clones an app + apps:create , Create a new app + apps:destroy , Permanently destroy an app + apps:list, List your apps + apps:rename , Rename an app + apps:report [] [], Display report about an app +help_content +} + +apps_help_cmd() { + if [[ $1 = "apps:help" ]] ; then + echo -e 'Usage: dokku apps[:COMMAND]' + echo '' + echo 'Manage Dokku apps' + echo '' + echo 'Example:' + echo '' + echo '$ dokku apps' + echo '=====> My Apps' + echo 'example' + echo 'example2' + echo '' + echo 'Additional commands:' + apps_help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + apps_help_content_func + else + cat< Date: Mon, 20 Feb 2017 17:24:09 -0700 Subject: [PATCH 157/295] cleanup: move from apps to apps:list subcommand for tests and docs --- docs/deployment/application-management.md | 11 +++++++---- tests/unit/10_apps.bats | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/deployment/application-management.md b/docs/deployment/application-management.md index 679246815..27d220af8 100644 --- a/docs/deployment/application-management.md +++ b/docs/deployment/application-management.md @@ -3,10 +3,10 @@ > New as of 0.3.1 ``` -apps # List your apps apps:clone # Clones an app apps:create # Create a new app apps:destroy # Permanently destroy an app +apps:list # List your apps apps:rename # Rename an app apps:report [] [] # Display report about an app ``` @@ -15,10 +15,12 @@ apps:report [] [] # Display report about an app ### Listing Applications -You can easily list all available applications using the `apps` command: +> New as of 0.8.1. Use the `apps` command for older versions. + +You can easily list all available applications using the `apps:list` command: ```shell -dokku apps +dokku apps:list ``` ``` @@ -30,7 +32,7 @@ python-app Note that you can easily hide extra output from Dokku commands by using the `--quiet` flag, which makes it easier to parse on the command-line. ```shell -dokku --quiet apps +dokku --quiet apps:list ``` ``` @@ -179,6 +181,7 @@ dokku apps:report node-js-sample ``` You can pass flags which will output only the value of the specific information you want. For example: + ```shell dokku apps:report node-js-sample --git-sha ``` diff --git a/tests/unit/10_apps.bats b/tests/unit/10_apps.bats index 17ed29be3..797304716 100644 --- a/tests/unit/10_apps.bats +++ b/tests/unit/10_apps.bats @@ -15,7 +15,7 @@ teardown () { echo "output: "$output echo "status: "$status assert_success - run bash -c "dokku apps | grep $TEST_APP" + run bash -c "dokku apps:list | grep $TEST_APP" echo "output: "$output echo "status: "$status assert_output $TEST_APP @@ -36,7 +36,7 @@ teardown () { echo "output: "$output echo "status: "$status assert_success - run bash -c "dokku apps | grep $TEST_APP" + run bash -c "dokku apps:list | grep $TEST_APP" echo "output: "$output echo "status: "$status assert_output $TEST_APP @@ -64,7 +64,7 @@ teardown () { echo "output: "$output echo "status: "$status assert_success - run bash -c "dokku apps | grep $TEST_APP" + run bash -c "dokku apps:list | grep $TEST_APP" echo "output: "$output echo "status: "$status assert_output "" @@ -97,7 +97,7 @@ teardown () { echo "output: "$output echo "status: "$status assert_success - run bash -c "dokku apps | grep $TEST_APP" + run bash -c "dokku apps:list | grep $TEST_APP" echo "output: "$output echo "status: "$status assert_success From cbcb720228055f84eb02cc24d5f36eb9910d1e97 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 18:04:57 -0700 Subject: [PATCH 158/295] feat: implement checks:report command Refs #2356 --- docs/deployment/zero-downtime-deploys.md | 41 +++++++++++++ plugins/checks/commands | 1 + plugins/checks/subcommands/report | 75 ++++++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100755 plugins/checks/subcommands/report diff --git a/docs/deployment/zero-downtime-deploys.md b/docs/deployment/zero-downtime-deploys.md index c1b24c9d5..731eb3e4d 100644 --- a/docs/deployment/zero-downtime-deploys.md +++ b/docs/deployment/zero-downtime-deploys.md @@ -6,6 +6,7 @@ checks Show zero-downtime status checks:disable [process-type(s)] Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments*** checks:enable [process-type(s)] Enable zero-downtime deployment for all processes (or comma-separated process-type list) +checks:report [] [] Displays a checks report for one or more apps checks:run [process-type(s)] Runs zero-downtime checks for all processes (or comma-separated process-type list) checks:skip [process-type(s)] Skip zero-downtime checks for all processes (or comma-separated process-type list) ``` @@ -61,6 +62,46 @@ dokku checks:disable node-js-app worker DOKKU_CHECKS_SKIPPED: web ``` +### Displaying checks reports about an app + +> New as of 0.8.1 + +You can get a report about the app's checks status using the `checks:report` command: + +```shell +dokku checks:report +``` + +``` +=====> search checks information + Checks disabled list: none + Checks skipped list: none +=====> python-sample + Checks disabled list: none + Checks skipped list: none +=====> ruby-sample + Checks disabled list: _all_ + Checks skipped list: none +``` + +You can run the command for a specific app also. + +```shell +dokku checks:report node-js-sample +``` + +``` +=====> node-js-sample checks information + Checks disabled list: none + Checks skipped list: none +``` + +You can pass flags which will output only the value of the specific information you want. For example: + +```shell +dokku checks:report node-js-sample --git-sha +``` + ## Customizing Checks If your application needs a longer period to boot up - perhaps to load data into memory, or because of slow boot time - you may also use dokku's `checks` functionality to more precisely check whether an application can serve traffic or not. diff --git a/plugins/checks/commands b/plugins/checks/commands index 5f27055ac..efbfb70ef 100755 --- a/plugins/checks/commands +++ b/plugins/checks/commands @@ -10,6 +10,7 @@ case "$1" in checks , Show zero-downtime status checks:disable [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments*** checks:enable [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list) + checks:report [] [], Displays a checks report for one or more apps checks:run [process-type(s)], Runs zero-downtime checks for all processes (or comma-separated process-type list) checks:skip [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list) help_content diff --git a/plugins/checks/subcommands/report b/plugins/checks/subcommands/report new file mode 100755 index 000000000..e0caf4cdd --- /dev/null +++ b/plugins/checks/subcommands/report @@ -0,0 +1,75 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/checks/functions" + +fn-checks-disabled-list() { + declare APP="$1" + + local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED) + DOKKU_CHECKS_DISABLED="${DOKKU_CHECKS_DISABLED:-none}" + echo "$DOKKU_CHECKS_DISABLED" +} + +fn-checks-skipped-list() { + declare APP="$1" + + local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED) + DOKKU_CHECKS_SKIPPED="${DOKKU_CHECKS_SKIPPED:-none}" + echo "$DOKKU_CHECKS_SKIPPED" +} + +checks_report_single_app() { + local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" + if [[ "$INFO_FLAG" == "true" ]]; then + INFO_FLAG="" + fi + verify_app_name "$APP" + local flag_map=( + "--checks-disabled-list: $(fn-checks-disabled-list "$APP")" + "--checks-skipped-list: $(fn-checks-skipped-list "$APP")" + ) + + if [[ -z "$INFO_FLAG" ]]; then + dokku_log_info2 "$APP checks information" + for flag in "${flag_map[@]}"; do + key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')" + dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")" + done + else + local match=false; local value_exists=false + for flag in "${flag_map[@]}"; do + valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)" + if [[ "$flag" == "${INFO_FLAG}:"* ]]; then + value=${flag#*: } + size="${#value}" + if [[ "$size" -ne 0 ]]; then + echo "$value" && match=true && value_exists=true + else + match=true + fi + fi + done + if [[ "$match" == "true" ]]; then + [[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed" + else + dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}" + fi + fi +} + +checks_report_cmd() { + declare desc="shows reports for an app" + local cmd="checks:report" + local INSTALLED_APPS=$(dokku_apps); local APP + + if [[ -z $2 ]]; then + for APP in $INSTALLED_APPS; do + checks_report_single_app "$APP" "true" + done + else + checks_report_single_app "$2" "$3" + fi +} + +checks_report_cmd "$@" From 3b3eefcb73a8d7602a412546e439bc114b9af149 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 18:06:32 -0700 Subject: [PATCH 159/295] refactor: deprecate the checks command in favor of checks:report --- plugins/checks/commands | 2 +- plugins/checks/subcommands/default | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/checks/commands b/plugins/checks/commands index efbfb70ef..50414215f 100755 --- a/plugins/checks/commands +++ b/plugins/checks/commands @@ -7,7 +7,7 @@ case "$1" in help_content_func () { declare desc="return checks plugin help content" cat<, Show zero-downtime status + checks , [DEPRECATED] Alternative for checks:report checks:disable [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments*** checks:enable [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list) checks:report [] [], Displays a checks report for one or more apps diff --git a/plugins/checks/subcommands/default b/plugins/checks/subcommands/default index f1102fb14..783ef3e31 100755 --- a/plugins/checks/subcommands/default +++ b/plugins/checks/subcommands/default @@ -12,6 +12,7 @@ checks_main_cmd() { local APPS="$1" fi + dokku_log_warn "Deprecated: Please use checks:report" dokku_col_log_info1_quiet "App Name" "Proctypes Disabled" "Proctypes Skipped" local app for app in $APPS; do From dd4960f1ce07e286ae8323e29bdaa0e437c27844 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 18:18:44 -0700 Subject: [PATCH 160/295] refactor: move checks:help to internal-functions --- plugins/checks/commands | 24 ++--------------------- plugins/checks/internal-functions | 32 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 22 deletions(-) create mode 100755 plugins/checks/internal-functions diff --git a/plugins/checks/commands b/plugins/checks/commands index 50414215f..0aed38a1b 100755 --- a/plugins/checks/commands +++ b/plugins/checks/commands @@ -1,31 +1,11 @@ #!/usr/bin/env bash [[ " help checks:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/checks/internal-functions" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in help | checks:help) - help_content_func () { - declare desc="return checks plugin help content" - cat<, [DEPRECATED] Alternative for checks:report - checks:disable [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments*** - checks:enable [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list) - checks:report [] [], Displays a checks report for one or more apps - checks:run [process-type(s)], Runs zero-downtime checks for all processes (or comma-separated process-type list) - checks:skip [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list) -help_content - } - - if [[ $1 = "checks:help" ]] ; then - echo -e 'Usage: dokku checks[:COMMAND]' - echo '' - echo 'Manage zero-downtime settings.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + checks_help_cmd "$@" ;; *) diff --git a/plugins/checks/internal-functions b/plugins/checks/internal-functions new file mode 100755 index 000000000..d0ebad465 --- /dev/null +++ b/plugins/checks/internal-functions @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" + +checks_help_content_func() { + declare desc="return checks plugin help content" + cat<, [DEPRECATED] Alternative for checks:report + checks:disable [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments*** + checks:enable [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list) + checks:report [] [], Displays a checks report for one or more apps + checks:run [process-type(s)], Runs zero-downtime checks for all processes (or comma-separated process-type list) + checks:skip [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list) +help_content +} + +checks_help_cmd() { + if [[ $1 = "checks:help" ]] ; then + echo -e 'Usage: dokku checks[:COMMAND]' + echo '' + echo 'Manage zero-downtime settings.' + echo '' + echo 'Additional commands:' + checks_help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + checks_help_content_func + else + cat< Date: Mon, 20 Feb 2017 19:07:10 -0700 Subject: [PATCH 161/295] Correct docs for checks:report [ci skip] --- docs/deployment/zero-downtime-deploys.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/deployment/zero-downtime-deploys.md b/docs/deployment/zero-downtime-deploys.md index 731eb3e4d..69c05730b 100644 --- a/docs/deployment/zero-downtime-deploys.md +++ b/docs/deployment/zero-downtime-deploys.md @@ -76,10 +76,10 @@ dokku checks:report =====> search checks information Checks disabled list: none Checks skipped list: none -=====> python-sample +=====> python-sample checks information Checks disabled list: none Checks skipped list: none -=====> ruby-sample +=====> ruby-sample checks information Checks disabled list: _all_ Checks skipped list: none ``` @@ -99,7 +99,7 @@ dokku checks:report node-js-sample You can pass flags which will output only the value of the specific information you want. For example: ```shell -dokku checks:report node-js-sample --git-sha +dokku checks:report node-js-sample --checks-disabled-list ``` ## Customizing Checks From 40262915726557b32a3e961400667aa18c3fe10a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 19:22:18 -0700 Subject: [PATCH 162/295] SC2005: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'. --- plugins/certs/subcommands/report | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/certs/subcommands/report b/plugins/certs/subcommands/report index 6f0e59031..43aa31648 100755 --- a/plugins/certs/subcommands/report +++ b/plugins/certs/subcommands/report @@ -18,7 +18,7 @@ fn-ssl-expires-at() { local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" if is_ssl_enabled "$APP"; then - echo "$(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }')" + openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not After :" | awk -F " : " '{ print $2 }' fi } @@ -35,7 +35,7 @@ fn-ssl-issuer() { local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" if is_ssl_enabled "$APP"; then - echo "$(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g")" + openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Issuer:" | xargs | sed -e "s/Issuer: //g" fi } @@ -44,7 +44,7 @@ fn-ssl-starts-at() { local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" if is_ssl_enabled "$APP"; then - echo "$(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }')" + openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -text | grep "Not Before:" | awk -F ": " '{ print $2 }' fi } @@ -53,7 +53,7 @@ fn-ssl-subject() { local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" if is_ssl_enabled "$APP"; then - echo "$(openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g")" + openssl x509 -in "$APP_SSL_PATH/server.crt" -noout -subject | sed -e "s:subject= ::g"| sed -e "s:^/::g" | sed -e "s:/:; :g" fi } From adc3b24ed7db6aaa1741e99faa6cbc1fde8f8bdc Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 20:04:01 -0700 Subject: [PATCH 163/295] docs: use node-js-app as sample app name [ci skip] --- docs/deployment/application-management.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/deployment/application-management.md b/docs/deployment/application-management.md index 679246815..7320aa178 100644 --- a/docs/deployment/application-management.md +++ b/docs/deployment/application-management.md @@ -150,8 +150,8 @@ dokku apps:report ``` ``` -=====> node-js-sample - App dir: /home/dokku/node-js-sample +=====> node-js-app + App dir: /home/dokku/node-js-app Git sha: dbddc3f App cid: 7b18489c98be Status: running @@ -167,12 +167,12 @@ not deployed You can run the command for a specific app also. ```shell -dokku apps:report node-js-sample +dokku apps:report node-js-app ``` ``` -=====> node-js-sample - App dir: /home/dokku/node-js-sample +=====> node-js-app + App dir: /home/dokku/node-js-app Git sha: dbddc3f App cid: 7b18489c98be Status: running @@ -180,5 +180,5 @@ dokku apps:report node-js-sample You can pass flags which will output only the value of the specific information you want. For example: ```shell -dokku apps:report node-js-sample --git-sha +dokku apps:report node-js-app --git-sha ``` From a09560542bfac3554d6efb20148fda8f65003010 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 20:08:38 -0700 Subject: [PATCH 164/295] refactor: move ssh-keys:help to internal-functions --- plugins/ssh-keys/commands | 22 ++-------------------- plugins/ssh-keys/internal-functions | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 20 deletions(-) create mode 100755 plugins/ssh-keys/internal-functions diff --git a/plugins/ssh-keys/commands b/plugins/ssh-keys/commands index bfd36a0ce..1aabfd445 100755 --- a/plugins/ssh-keys/commands +++ b/plugins/ssh-keys/commands @@ -1,29 +1,11 @@ #!/usr/bin/env bash [[ " help ssh-keys:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/ssh-keys/internal-functions" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in help | ssh-keys:help) - help_content_func () { - declare desc="return ssh-keys plugin help content" - cat< [/path/to/key], Add a new public key by pipe or path - ssh-keys:remove , Remove SSH public key by name -help_content - } - - if [[ $1 = "ssh-keys:help" ]] ; then - echo -e 'Usage: dokku ssh-keys[:COMMAND]' - echo '' - echo 'Manage public ssh keys that are allowed to connect to Dokku' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + ssh_keys_help_cmd "$@" ;; *) diff --git a/plugins/ssh-keys/internal-functions b/plugins/ssh-keys/internal-functions new file mode 100755 index 000000000..bc4d868e7 --- /dev/null +++ b/plugins/ssh-keys/internal-functions @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +ssh_keys_help_content_func() { + declare desc="return ssh-keys plugin help content" + cat< [/path/to/key], Add a new public key by pipe or path + ssh-keys:remove , Remove SSH public key by name +help_content +} + +ssh_keys_help_cmd() { + if [[ $1 = "ssh-keys:help" ]] ; then + echo -e 'Usage: dokku ssh-keys[:COMMAND]' + echo '' + echo 'Manage public ssh keys that are allowed to connect to Dokku' + echo '' + echo 'Additional commands:' + ssh_keys_help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + ssh_keys_help_content_func + else + cat< Date: Mon, 20 Feb 2017 20:09:09 -0700 Subject: [PATCH 165/295] refactor: alias ssh-keys:default to ssh-keys:help --- plugins/ssh-keys/subcommands/default | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) mode change 100644 => 100755 plugins/ssh-keys/subcommands/default diff --git a/plugins/ssh-keys/subcommands/default b/plugins/ssh-keys/subcommands/default old mode 100644 new mode 100755 index abdbaa619..20fea35c3 --- a/plugins/ssh-keys/subcommands/default +++ b/plugins/ssh-keys/subcommands/default @@ -1,12 +1,5 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions" +source "$PLUGIN_AVAILABLE_PATH/ssh-keys/internal-functions" -ssh_keys_main_cmd() { - declare desc="an alias for ssh-keys:list" - local cmd="ssh-keys" - list_ssh_keys -} - -ssh_keys_main_cmd "$@" \ No newline at end of file +ssh_keys_help_cmd "$@" From e441594981b2e0068d05fdbbec2f49fb663047a4 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 20:11:53 -0700 Subject: [PATCH 166/295] chore: use correct source path --- plugins/00_dokku-standard/pre-deploy | 2 +- plugins/00_dokku-standard/subcommands/run | 2 +- plugins/nginx-vhosts/proxy-disable | 2 +- plugins/nginx-vhosts/proxy-enable | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/00_dokku-standard/pre-deploy b/plugins/00_dokku-standard/pre-deploy index 928637b41..c78257140 100755 --- a/plugins/00_dokku-standard/pre-deploy +++ b/plugins/00_dokku-standard/pre-deploy @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/00_dokku-standard/exec-app-json-scripts" +source "$PLUGIN_AVAILABLE_PATH/config/functions" exec_app_json_scripts() { declare desc="core app.json scripts execution" diff --git a/plugins/00_dokku-standard/subcommands/run b/plugins/00_dokku-standard/subcommands/run index 4a0d04d66..1c413de7c 100755 --- a/plugins/00_dokku-standard/subcommands/run +++ b/plugins/00_dokku-standard/subcommands/run @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions" +source "$PLUGIN_AVAILABLE_PATH/ps/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions" dokku_run_cmd() { diff --git a/plugins/nginx-vhosts/proxy-disable b/plugins/nginx-vhosts/proxy-disable index 681c860c2..77b68b81f 100755 --- a/plugins/nginx-vhosts/proxy-disable +++ b/plugins/nginx-vhosts/proxy-disable @@ -2,7 +2,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions" +source "$PLUGIN_AVAILABLE_PATH/ps/functions" nginx_proxy_disable() { declare desc="disable nginx proxy" diff --git a/plugins/nginx-vhosts/proxy-enable b/plugins/nginx-vhosts/proxy-enable index 366f94ed8..9e18f7024 100755 --- a/plugins/nginx-vhosts/proxy-enable +++ b/plugins/nginx-vhosts/proxy-enable @@ -2,7 +2,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/ps/functions" +source "$PLUGIN_AVAILABLE_PATH/ps/functions" nginx_proxy_enable() { declare desc="enable nginx proxy" From 0e899cdd1395af71388600a973a7c5fbf7fb9f32 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 21:41:19 -0700 Subject: [PATCH 167/295] feat: implement proxy:report command Also deprecate `proxy:default` in favor of `proxy:report` Refs #2356 --- docs/advanced-usage/proxy-management.md | 54 +++++++++++++++++-- plugins/proxy/commands | 1 + plugins/proxy/functions | 14 +++-- plugins/proxy/subcommands/default | 1 + plugins/proxy/subcommands/report | 70 +++++++++++++++++++++++++ 5 files changed, 132 insertions(+), 8 deletions(-) create mode 100755 plugins/proxy/subcommands/report diff --git a/docs/advanced-usage/proxy-management.md b/docs/advanced-usage/proxy-management.md index 31d695530..09f88c0c4 100644 --- a/docs/advanced-usage/proxy-management.md +++ b/docs/advanced-usage/proxy-management.md @@ -3,19 +3,21 @@ > New as of 0.5.0, Enhanced in 0.6.0 ``` -proxy # Show proxy settings for app proxy:disable # Disable proxy for app proxy:enable # Enable proxy for app proxy:ports # List proxy port mappings for app proxy:ports-add :: [::...] # Set proxy port mappings for app proxy:ports-clear # Clear all proxy port mappings for app proxy:ports-remove [|::...] # Unset proxy port mappings for app +proxy:report [] [] # Displays a proxy report for one or more apps proxy:set # Set proxy type for app ``` In Dokku 0.5.0, port proxying was decoupled from the `nginx-vhosts` plugin into the proxy plugin. Dokku 0.6.0 introduced the ability to map host ports to specific container ports. In the future this will allow other proxy software - such as HAProxy or Caddy - to be used in place of nginx. -## Container network interface binding +## Usage + +### Container network interface binding > New as of 0.5.0 @@ -58,7 +60,51 @@ CONTAINER ID IMAGE COMMAND CREATED d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp node-js-app.web.1 ``` -## Proxy port mapping +### Displaying proxy reports about an app + +> New as of 0.8.1 + +You can get a report about the app's proxy status using the `proxy:report` command: + +```shell +dokku proxy:report +``` + +``` +=====> node-js-app proxy information + Proxy enabled: true + Proxy type: nginx + Proxy port map: http:80:5000 https:443:5000 +=====> python-sample proxy information + Proxy enabled: true + Proxy type: nginx + Proxy port map: http:80:5000 +=====> ruby-sample proxy information + Proxy enabled: true + Proxy type: nginx + Proxy port map: http:80:5000 +``` + +You can run the command for a specific app also. + +```shell +dokku proxy:report node-js-app +``` + +``` +=====> node-js-app proxy information + Proxy enabled: true + Proxy type: nginx + Proxy port map: http:80:5000 https:443:5000 +``` + +You can pass flags which will output only the value of the specific information you want. For example: + +```shell +dokku proxy:report node-js-app --proxy-type +``` + +### Proxy port mapping > New as of 0.6.0 @@ -141,7 +187,7 @@ By default, buildpack apps and dockerfile apps **without** explicitly exposed po > Note: This default behavior **will not** be automatically changed on subsequent pushes and must be manipulated with the `proxy:ports-*` syntax detailed above. -## Proxy Port Scheme +#### Proxy Port Scheme The proxy port scheme is as follows: diff --git a/plugins/proxy/commands b/plugins/proxy/commands index 25d60d2ea..7df9f973b 100755 --- a/plugins/proxy/commands +++ b/plugins/proxy/commands @@ -14,6 +14,7 @@ case "$1" in proxy:ports-clear , Clear all proxy port mappings for app proxy:ports-add :: [::...], Set proxy port mappings for app proxy:ports-remove [|::...], Unset proxy port mappings for app + proxy:report [] [], Displays a proxy report for one or more apps proxy:set , Set proxy type for app help_content } diff --git a/plugins/proxy/functions b/plugins/proxy/functions index d7d3b1a2f..5202a21ef 100755 --- a/plugins/proxy/functions +++ b/plugins/proxy/functions @@ -24,10 +24,16 @@ get_app_proxy_type() { echo "$APP_PROXY_TYPE" } +get_app_proxy_port_map() { + declare desc="return a list of configured port mappings" + local APP="$1"; local PROXY_PORT_MAP="$(config_get "$APP" DOKKU_PROXY_PORT_MAP || true)" + echo "$PROXY_PORT_MAP" +} + list_app_proxy_ports() { declare desc="list proxy port mappings for an app" local APP="$1"; verify_app_name "$APP" - local PROXY_PORT_MAP="$(config_get "$APP" DOKKU_PROXY_PORT_MAP || true)" + local PROXY_PORT_MAP="$(get_app_proxy_port_map "$APP")" if [[ -n "$PROXY_PORT_MAP" ]]; then dokku_log_info1_quiet "Port mappings for $APP" @@ -45,7 +51,7 @@ filter_app_proxy_ports() { declare desc="list proxy port mappings for an app that start with a particular scheme and a host port" local APP="$1"; verify_app_name "$APP" local SCHEME="$2" HOST_PORT="$3" - local PROXY_PORT_MAP="$(config_get "$APP" DOKKU_PROXY_PORT_MAP || true)" + local PROXY_PORT_MAP="$(get_app_proxy_port_map "$APP")" if [[ -n "$PROXY_PORT_MAP" ]]; then local port_map @@ -62,7 +68,7 @@ filter_app_proxy_ports() { add_proxy_ports() { declare desc="add proxy port mappings from an app" local APP="$1" - local PROXY_PORT_MAP="$(config_get "$APP" DOKKU_PROXY_PORT_MAP || true)" + local PROXY_PORT_MAP="$(get_app_proxy_port_map "$APP")" shift 1 local INPUT_PORTS="$*" @@ -78,7 +84,7 @@ add_proxy_ports() { remove_proxy_ports() { declare desc="remove specific proxy port mappings from an app" local APP="$1" - local PROXY_PORT_MAP="$(config_get "$APP" DOKKU_PROXY_PORT_MAP || true)" + local PROXY_PORT_MAP="$(get_app_proxy_port_map "$APP")" local RE_PORT='^[0-9]+$' shift 1 diff --git a/plugins/proxy/subcommands/default b/plugins/proxy/subcommands/default index 4e867c850..03c08f400 100755 --- a/plugins/proxy/subcommands/default +++ b/plugins/proxy/subcommands/default @@ -12,6 +12,7 @@ proxy_main_cmd() { local APPS="$1" fi + dokku_log_warn "Deprecated: Please use proxy:report" dokku_col_log_info1_quiet "App Name" "Proxy Type" local app for app in $APPS; do diff --git a/plugins/proxy/subcommands/report b/plugins/proxy/subcommands/report new file mode 100755 index 000000000..260483417 --- /dev/null +++ b/plugins/proxy/subcommands/report @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/proxy/functions" + +fn-proxy-enabled() { + declare APP="$1" + local PROXY_ENABLED=false + + if [[ "$(is_app_proxy_enabled "$APP")" == "true" ]]; then + PROXY_ENABLED=true + fi + echo "$PROXY_ENABLED" +} + +proxy_report_single_app() { + local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" + if [[ "$INFO_FLAG" == "true" ]]; then + INFO_FLAG="" + fi + verify_app_name "$APP" + local flag_map=( + "--proxy-enabled: $(fn-proxy-enabled "$APP")" + "--proxy-type: $(get_app_proxy_type "$APP")" + "--proxy-port-map: $(get_app_proxy_port_map "$APP")" + ) + + if [[ -z "$INFO_FLAG" ]]; then + dokku_log_info2 "$APP proxy information" + for flag in "${flag_map[@]}"; do + key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')" + dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")" + done + else + local match=false; local value_exists=false + for flag in "${flag_map[@]}"; do + valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)" + if [[ "$flag" == "${INFO_FLAG}:"* ]]; then + value=${flag#*: } + size="${#value}" + if [[ "$size" -ne 0 ]]; then + echo "$value" && match=true && value_exists=true + else + match=true + fi + fi + done + if [[ "$match" == "true" ]]; then + [[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed" + else + dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}" + fi + fi +} + +proxy_report_cmd() { + declare desc="displays a proxy report for one or more apps" + local cmd="proxy:report" + local INSTALLED_APPS=$(dokku_apps); local APP + + if [[ -z $2 ]]; then + for APP in $INSTALLED_APPS; do + proxy_report_single_app "$APP" "true" + done + else + proxy_report_single_app "$2" "$3" + fi +} + +proxy_report_cmd "$@" From 225840b79d004d0b4befcdd33826c2ff0867ee7a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 21:48:58 -0700 Subject: [PATCH 168/295] refactor: move proxy:help to internal-functions --- plugins/proxy/commands | 27 ++----------------------- plugins/proxy/internal-functions | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 25 deletions(-) create mode 100644 plugins/proxy/internal-functions diff --git a/plugins/proxy/commands b/plugins/proxy/commands index 7df9f973b..db59fda92 100755 --- a/plugins/proxy/commands +++ b/plugins/proxy/commands @@ -1,34 +1,11 @@ #!/usr/bin/env bash [[ " help proxy:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/proxy/internal-functions" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in help | proxy:help) - help_content_func () { - declare desc="return proxy plugin help content" - cat<, Show proxy settings for app - proxy:enable , Enable proxy for app - proxy:disable , Disable proxy for app - proxy:ports , List proxy port mappings for app - proxy:ports-clear , Clear all proxy port mappings for app - proxy:ports-add :: [::...], Set proxy port mappings for app - proxy:ports-remove [|::...], Unset proxy port mappings for app - proxy:report [] [], Displays a proxy report for one or more apps - proxy:set , Set proxy type for app -help_content - } - - if [[ $1 = "proxy:help" ]] ; then - echo -e 'Usage: dokku proxy[:COMMAND]' - echo '' - echo 'Control the proxy used by dokku, per app.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + proxy_vhosts_help_cmd "$@" ;; *) diff --git a/plugins/proxy/internal-functions b/plugins/proxy/internal-functions new file mode 100644 index 000000000..ec85d4ab2 --- /dev/null +++ b/plugins/proxy/internal-functions @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +proxy_vhosts_help_content_func() { + declare desc="return proxy plugin help content" + cat<, [DEPRECATED] Show proxy settings for app + proxy:enable , Enable proxy for app + proxy:disable , Disable proxy for app + proxy:ports , List proxy port mappings for app + proxy:ports-clear , Clear all proxy port mappings for app + proxy:ports-add :: [::...], Set proxy port mappings for app + proxy:ports-remove [|::...], Unset proxy port mappings for app + proxy:report [] [], Displays a proxy report for one or more apps + proxy:set , Set proxy type for app +help_content +} + +proxy_vhosts_help_cmd() { + if [[ $1 = "proxy:help" ]] ; then + echo -e 'Usage: dokku proxy[:COMMAND]' + echo '' + echo 'Manage the proxy used by dokku on a per app.' + echo '' + echo 'Additional commands:' + proxy_vhosts_help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + proxy_vhosts_help_content_func + else + cat< Date: Mon, 20 Feb 2017 22:35:52 -0700 Subject: [PATCH 169/295] refactor: move nginx:help to internal-functions --- plugins/nginx-vhosts/commands | 14 ++++--------- plugins/nginx-vhosts/functions | 19 ----------------- plugins/nginx-vhosts/internal-functions | 28 +++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 29 deletions(-) create mode 100755 plugins/nginx-vhosts/internal-functions diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 2995231d7..3dbfc98d8 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -1,21 +1,15 @@ #!/usr/bin/env bash [[ " help nginx:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" case "$1" in help | nginx:help) - - - if [[ $1 = "nginx:help" ]] ; then - help_formatted - else - help_content_func - fi - ;; + nginx_vhosts_help_cmd "$@" + ;; *) exit "$DOKKU_NOT_IMPLEMENTED_EXIT" - ;; + ;; esac diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 8f1af2c40..c68d9aa66 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -6,25 +6,6 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/domains/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" -help_formatted (){ - echo -e 'Usage: dokku nginx[:COMMAND]' - echo '' - echo 'Interact with Dokku'"'"'s Nginx proxy.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, -} - -help_content_func () { - declare desc="return nginx plugin help content" - cat<, (Re)builds nginx config for given app - nginx:access-logs [-t], Show the nginx access logs for an application (-t follows) - nginx:error-logs [-t], Show the nginx error logs for an application (-t follows) -help_content - } - validate_nginx() { declare desc="validate entire nginx config" set +e diff --git a/plugins/nginx-vhosts/internal-functions b/plugins/nginx-vhosts/internal-functions new file mode 100755 index 000000000..93d929bb6 --- /dev/null +++ b/plugins/nginx-vhosts/internal-functions @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +nginx_vhosts_help_content_func() { + declare desc="return nginx plugin help content" + cat<, (Re)builds nginx config for given app + nginx:access-logs [-t], Show the nginx access logs for an application (-t follows) + nginx:error-logs [-t], Show the nginx error logs for an application (-t follows) +help_content +} + +nginx_vhosts_help_cmd() { + if [[ $1 = "nginx:help" ]] ; then + echo -e 'Usage: dokku nginx[:COMMAND]' + echo '' + echo 'Interact with Dokku'"'"'s Nginx proxy.' + echo '' + echo 'Additional commands:' + nginx_vhosts_help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + nginx_vhosts_help_content_func + else + cat< Date: Mon, 20 Feb 2017 22:39:53 -0700 Subject: [PATCH 170/295] refactor: alias nginx:default to nginx:help --- plugins/nginx-vhosts/subcommands/default | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) mode change 100644 => 100755 plugins/nginx-vhosts/subcommands/default diff --git a/plugins/nginx-vhosts/subcommands/default b/plugins/nginx-vhosts/subcommands/default old mode 100644 new mode 100755 index 30cb86061..5a4deae9b --- a/plugins/nginx-vhosts/subcommands/default +++ b/plugins/nginx-vhosts/subcommands/default @@ -1,13 +1,5 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_AVAILABLE_PATH/config/functions" -source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" +source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions" -nginx_main_cmd() { - declare desc="display nginx plugin help content" - local cmd="nginx" - help_formatted -} - -nginx_main_cmd "$@" +nginx_vhosts_help_cmd "$@" From 48653e566319f75ca289543d2049cb90b856894f Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 22:44:51 -0700 Subject: [PATCH 171/295] chore: properly name functions --- plugins/proxy/commands | 2 +- plugins/proxy/internal-functions | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) mode change 100644 => 100755 plugins/proxy/internal-functions diff --git a/plugins/proxy/commands b/plugins/proxy/commands index db59fda92..3802db5ef 100755 --- a/plugins/proxy/commands +++ b/plugins/proxy/commands @@ -5,7 +5,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in help | proxy:help) - proxy_vhosts_help_cmd "$@" + proxy_help_cmd "$@" ;; *) diff --git a/plugins/proxy/internal-functions b/plugins/proxy/internal-functions old mode 100644 new mode 100755 index ec85d4ab2..3ff81c845 --- a/plugins/proxy/internal-functions +++ b/plugins/proxy/internal-functions @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -proxy_vhosts_help_content_func() { +proxy_help_content_func() { declare desc="return proxy plugin help content" cat<, [DEPRECATED] Show proxy settings for app @@ -16,16 +16,16 @@ proxy_vhosts_help_content_func() { help_content } -proxy_vhosts_help_cmd() { +proxy_help_cmd() { if [[ $1 = "proxy:help" ]] ; then echo -e 'Usage: dokku proxy[:COMMAND]' echo '' echo 'Manage the proxy used by dokku on a per app.' echo '' echo 'Additional commands:' - proxy_vhosts_help_content_func | sort | column -c2 -t -s, + proxy_help_content_func | sort | column -c2 -t -s, elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then - proxy_vhosts_help_content_func + proxy_help_content_func else cat< Date: Mon, 20 Feb 2017 22:50:07 -0700 Subject: [PATCH 172/295] refactor: move domains:help to internal-functions --- plugins/domains/commands | 28 ++---------------------- plugins/domains/internal-functions | 35 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 26 deletions(-) create mode 100755 plugins/domains/internal-functions diff --git a/plugins/domains/commands b/plugins/domains/commands index 5b2018369..1ed2fde7f 100755 --- a/plugins/domains/commands +++ b/plugins/domains/commands @@ -1,35 +1,11 @@ #!/usr/bin/env bash [[ " help domains:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/domains/internal-functions" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in help | domains:help) - help_content_func () { - declare desc="return domains plugin help content" - cat<], List domains - domains:add [ ...], Add domains to app - domains:add-global [ ...], Add global domain names - domains:clear , Clear all domains for app - domains:disable , Disable VHOST support - domains:enable , Enable VHOST support - domains:remove [ ...], Remove domains from app - domains:remove-global [ ...], Remove global domain names - domains:set [ ...], Set domains for app - domains:set-global [ ...], Set global domain names -help_content - } - - if [[ $1 = "domains:help" ]] ; then - echo -e 'Usage: dokku domains[:COMMAND]' - echo '' - echo 'Manage vhost domains used by the Dokku proxy.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + domains_help_cmd "$@" ;; *) diff --git a/plugins/domains/internal-functions b/plugins/domains/internal-functions new file mode 100755 index 000000000..33ab2dd1c --- /dev/null +++ b/plugins/domains/internal-functions @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +domains_help_content_func () { + declare desc="return domains plugin help content" + cat<], List domains + domains:add [ ...], Add domains to app + domains:add-global [ ...], Add global domain names + domains:clear , Clear all domains for app + domains:disable , Disable VHOST support + domains:enable , Enable VHOST support + domains:remove [ ...], Remove domains from app + domains:remove-global [ ...], Remove global domain names + domains:set [ ...], Set domains for app + domains:set-global [ ...], Set global domain names +help_content +} + +domains_help_cmd() { + if [[ $1 = "domains:help" ]] ; then + echo -e 'Usage: dokku domains[:COMMAND]' + echo '' + echo 'Manage vhost domains used by the Dokku proxy.' + echo '' + echo 'Additional commands:' + domains_help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + domains_help_content_func + else + cat< Date: Mon, 20 Feb 2017 23:17:35 -0700 Subject: [PATCH 173/295] feat: implement domains:report command Also deprecate `domains:default` in favor of `domains:report` Refs #2356 --- docs/configuration/domains.md | 52 +++++++++++++++- plugins/domains/internal-functions | 3 +- plugins/domains/subcommands/default | 1 + plugins/domains/subcommands/report | 92 +++++++++++++++++++++++++++++ 4 files changed, 145 insertions(+), 3 deletions(-) create mode 100755 plugins/domains/subcommands/report diff --git a/docs/configuration/domains.md b/docs/configuration/domains.md index 048a495ef..6f7402d3a 100644 --- a/docs/configuration/domains.md +++ b/docs/configuration/domains.md @@ -3,7 +3,6 @@ > New as of 0.3.10 ``` -domains [|--global] # List domains domains:add [ ...] # Add domains to app domains:add-global [ ...] # Add global domain names domains:clear # Clear all domains for app @@ -11,6 +10,7 @@ domains:disable # Disable VHOST support domains:enable # Enable VHOST support domains:remove [ ...] # Remove domains from app domains:remove-global [ ...] # Remove global domain names +domains:report [] [] # Displays a domains report for one or more apps domains:set [ ...] # Set domains for app domains:set-global [ ...] # Set global domain names ``` @@ -41,7 +41,7 @@ NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev` echo "$NEW_SUBDOMAIN.$VHOST" ``` -If the `nginx-hostname` has no output, the normal hostname algorithm will be executed. +If the `nginx-hostname` plugin has no output, the normal hostname algorithm will be executed. ## Disabling VHOSTS @@ -75,6 +75,54 @@ dokku domains:remove myapp example.com dokku domains:set myapp example.com example.org ``` +## Displaying domains reports about an app + +> New as of 0.8.1 + +You can get a report about the app's domains status using the `domains:report` command: + +```shell +dokku domains:report +``` + +``` +=====> node-js-app domains information + Domains app enabled: true + Domains app vhosts: ruby-sample.example.org + Domains global enabled: true + Domains global vhosts: example.org +=====> python-sample domains information + Domains app enabled: true + Domains app vhosts: ruby-sample.example.org + Domains global enabled: true + Domains global vhosts: example.org +=====> ruby-sample domains information + Domains app enabled: true + Domains app vhosts: ruby-sample.example.org + Domains global enabled: true + Domains global vhosts: example.org +``` + +You can run the command for a specific app also. + +```shell +dokku domains:report node-js-app +``` + +``` +=====> node-js-app domains information + Domains app enabled: true + Domains app vhosts: node-js-app.example.org + Domains global enabled: true + Domains global vhosts: example.org +``` + +You can pass flags which will output only the value of the specific information you want. For example: + +```shell +dokku domains:report node-js-app --domains-app-enabled +``` + ## Default site By default, Dokku will route any received request with an unknown HOST header value to the lexicographically first site in the nginx config stack. If this is not the desired behavior, you may want to add the following configuration to the global nginx configuration. diff --git a/plugins/domains/internal-functions b/plugins/domains/internal-functions index 33ab2dd1c..fb4ab8fce 100755 --- a/plugins/domains/internal-functions +++ b/plugins/domains/internal-functions @@ -4,7 +4,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x domains_help_content_func () { declare desc="return domains plugin help content" cat<], List domains + domains [], [DEPRECATED] Alternative for domains:report domains:add [ ...], Add domains to app domains:add-global [ ...], Add global domain names domains:clear , Clear all domains for app @@ -12,6 +12,7 @@ domains_help_content_func () { domains:enable , Enable VHOST support domains:remove [ ...], Remove domains from app domains:remove-global [ ...], Remove global domain names + domains:report [] [], Displays a domains report for one or more apps domains:set [ ...], Set domains for app domains:set-global [ ...], Set global domain names help_content diff --git a/plugins/domains/subcommands/default b/plugins/domains/subcommands/default index c046e7fac..27728e49c 100755 --- a/plugins/domains/subcommands/default +++ b/plugins/domains/subcommands/default @@ -8,6 +8,7 @@ domains_main_cmd() { local cmd="domains" local APP="$2" + dokku_log_warn "Deprecated: Please use domains:report" if [[ "$(is_global_vhost_enabled)" == "true" ]]; then dokku_log_info2_quiet "Global Domain Name" get_global_vhosts diff --git a/plugins/domains/subcommands/report b/plugins/domains/subcommands/report new file mode 100755 index 000000000..ce7f3078a --- /dev/null +++ b/plugins/domains/subcommands/report @@ -0,0 +1,92 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/domains/functions" + +fn-domains-app-enabled() { + declare APP="$1" + local DOMAINS_APP_ENABLED=false + if [[ "$(is_app_vhost_enabled "$APP")" == "true" ]]; then + DOMAINS_APP_ENABLED=true + fi + echo "$DOMAINS_APP_ENABLED" +} + +fn-domains-app-vhosts() { + declare APP="$1" + local APP_VHOST_FILE="$DOKKU_ROOT/$APP/VHOST" + if [[ -f "$APP_VHOST_FILE" ]]; then + tr '\n' ' ' < "$APP_VHOST_FILE" + fi +} + +fn-domains-global-enabled() { + local DOMAINS_GLOBAL_ENABLED=false + if [[ "$(is_global_vhost_enabled)" == "true" ]]; then + DOMAINS_GLOBAL_ENABLED=true + fi + echo "$DOMAINS_GLOBAL_ENABLED" +} + +fn-domains-global-vhosts() { + if [[ "$(is_global_vhost_enabled)" == "true" ]]; then + get_global_vhosts | tr '\n' ' ' + fi +} + +domains_report_single_app() { + local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" + if [[ "$INFO_FLAG" == "true" ]]; then + INFO_FLAG="" + fi + verify_app_name "$APP" + local flag_map=( + "--domains-app-enabled: $(fn-domains-app-enabled "$APP")" + "--domains-app-vhosts: $(fn-domains-app-vhosts "$APP")" + "--domains-global-enabled: $(fn-domains-global-enabled)" + "--domains-global-vhosts: $(fn-domains-global-vhosts)" + ) + + if [[ -z "$INFO_FLAG" ]]; then + dokku_log_info2 "$APP domains information" + for flag in "${flag_map[@]}"; do + key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')" + dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")" + done + else + local match=false; local value_exists=false + for flag in "${flag_map[@]}"; do + valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)" + if [[ "$flag" == "${INFO_FLAG}:"* ]]; then + value=${flag#*: } + size="${#value}" + if [[ "$size" -ne 0 ]]; then + echo "$value" && match=true && value_exists=true + else + match=true + fi + fi + done + if [[ "$match" == "true" ]]; then + [[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed" + else + dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}" + fi + fi +} + +domains_report_cmd() { + declare desc="displays a domains report for one or more apps" + local cmd="domains:report" + local INSTALLED_APPS=$(dokku_apps); local APP + + if [[ -z $2 ]]; then + for APP in $INSTALLED_APPS; do + domains_report_single_app "$APP" "true" + done + else + domains_report_single_app "$2" "$3" + fi +} + +domains_report_cmd "$@" From 088b7f360e8418c01578fac5c0c21230b91381b9 Mon Sep 17 00:00:00 2001 From: "Raphael D. Pinheiro" Date: Thu, 23 Feb 2017 13:25:33 -0300 Subject: [PATCH 174/295] enhance regex to allow multiple dots in file names things like mydomain.com.crt and mydomain.com.key will be better interpreted --- plugins/certs/subcommands/add | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/certs/subcommands/add b/plugins/certs/subcommands/add index c705d1cde..69ba70721 100755 --- a/plugins/certs/subcommands/add +++ b/plugins/certs/subcommands/add @@ -44,7 +44,7 @@ certs_set() { trap 'popd &> /dev/null || true; rm -rf $CERTS_SET_TMP_WORK_DIR > /dev/null' RETURN tar xvf - <&0 - local CRT_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name "*.crt") + local CRT_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name ".crt$") local CRT_FILE_COUNT=$(printf "%s" "$CRT_FILE_SEARCH" | grep -c '^') if [[ $CRT_FILE_COUNT -lt 1 ]]; then dokku_log_fail "Tar archive is missing .crt file" @@ -54,7 +54,7 @@ certs_set() { local CRT_FILE=$CRT_FILE_SEARCH fi - local KEY_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name "*.key") + local KEY_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name "*.key$") local KEY_FILE_COUNT=$(printf "%s" "$KEY_FILE_SEARCH" | grep -c '^') if [[ $KEY_FILE_COUNT -lt 1 ]]; then dokku_log_fail "Tar archive is missing .key file" From 0c98a340949cac1fcc7d7091fba2763335c29bbc Mon Sep 17 00:00:00 2001 From: "Raphael D. Pinheiro" Date: Thu, 23 Feb 2017 13:27:50 -0300 Subject: [PATCH 175/295] enhance regex to allow multiple dots in file names removed remaining * --- plugins/certs/subcommands/add | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/certs/subcommands/add b/plugins/certs/subcommands/add index 69ba70721..2cd29fe06 100755 --- a/plugins/certs/subcommands/add +++ b/plugins/certs/subcommands/add @@ -54,7 +54,7 @@ certs_set() { local CRT_FILE=$CRT_FILE_SEARCH fi - local KEY_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name "*.key$") + local KEY_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name ".key$") local KEY_FILE_COUNT=$(printf "%s" "$KEY_FILE_SEARCH" | grep -c '^') if [[ $KEY_FILE_COUNT -lt 1 ]]; then dokku_log_fail "Tar archive is missing .key file" From b0777a44cb7e1a4d8d30934798f95cd500a9d7ba Mon Sep 17 00:00:00 2001 From: "Raphael D. Pinheiro" Date: Thu, 23 Feb 2017 13:44:28 -0300 Subject: [PATCH 176/295] add test to certs:add with multiple dots Add test to certs:add command to allow multiple dots in file name --- tests/unit/10_certs.bats | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/unit/10_certs.bats b/tests/unit/10_certs.bats index e7978ab13..94f9a0d0f 100644 --- a/tests/unit/10_certs.bats +++ b/tests/unit/10_certs.bats @@ -33,6 +33,13 @@ teardown() { assert_success } +@test "(certs) certs:add with multiple dots in the filename" { + run bash -c "dokku certs:add $TEST_APP $BATS_TMPDIR/tls/domain.com.crt $BATS_TMPDIR/tls/domain.com.key" + echo "output: "$output + echo "status: "$status + assert_success +} + @test "(certs) certs:add < tar" { run bash -c "dokku certs:add $TEST_APP < $BATS_TEST_DIRNAME/server_ssl.tar" echo "output: "$output From 8a6bce37459771d95e13a142b0a6af564eb7c7d8 Mon Sep 17 00:00:00 2001 From: "Raphael D. Pinheiro" Date: Thu, 23 Feb 2017 16:33:36 -0300 Subject: [PATCH 177/295] add multiple dots tar for testing --- tests/unit/10_certs.bats | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/10_certs.bats b/tests/unit/10_certs.bats index 94f9a0d0f..9b2003b88 100644 --- a/tests/unit/10_certs.bats +++ b/tests/unit/10_certs.bats @@ -6,6 +6,7 @@ setup_local_tls() { TLS=$BATS_TMPDIR/tls mkdir -p $TLS tar xf $BATS_TEST_DIRNAME/server_ssl.tar -C $TLS + tar xf $BATS_TEST_DIRNAME/domain_ssl.tar -C $TLS sudo chown -R dokku:dokku $TLS } From adf0a9ee742796ac59c5d8e521b17882b1354757 Mon Sep 17 00:00:00 2001 From: raphaklaus Date: Fri, 24 Feb 2017 12:41:12 -0300 Subject: [PATCH 178/295] add domain_ssl tar for testing --- tests/unit/domain_ssl.tar | Bin 0 -> 10240 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/unit/domain_ssl.tar diff --git a/tests/unit/domain_ssl.tar b/tests/unit/domain_ssl.tar new file mode 100644 index 0000000000000000000000000000000000000000..b10121314427a48c21b823c5488e1d943e8ba378 GIT binary patch literal 10240 zcmeH~Ne`nq7RT$%r>HxcW)E%E_`-{0BL#kc;abm)F+^6kqXQt)><(DavgMX(J1%ley%A_?jXLDDpJVDR_-3r zRRiI73j$RY42voXf+h(T5ayC*Nh?;Fp7DXHQC2oNk{Deb@wv&@JYA^P?!GXQXqK}iB!>eL`_W4&p?%{e*o_QZ@@Q)LdtfN%#WSJssC=}KmVujXtk*eLK#0sT z^0p+4&;#Dmd4Shw^5qs`FPf9erH|kyrkpZd*;jEfxO84i+IcUAPP9GKcLPM;wf%yg zj+!me`el;M2oI<}nUx~Yua_+qmWynRyMY(?;lj~*nFw6qDY!b#V=NcJf+%rQiQ2Asv?EEU}auGv!{ zL4Sgg$#7zr!gDn`eMV_F)(ZCGWGIx)@ky^|G?>h0geR6n4EreHK{-6imp2rTG8cJg z#@J1)^6Vxm{)m&wx})ilG11UV;sdo_?d!;R>(L47+Y6a8v|IUt)ZMVmYVmdI#0 zmed}G$Mj;Fd{RY9B7-^@uS%w`#oA)pW!rq!s)q*gqo(AgdI1`YkJ{YFcRb(KgEpS( zS067_`KfxyFOnxp>1!P&)XvTZSR-SEuFIJy zXFSp246MTZRh5@wNWRoo ztZIhAAEQE=T~tjS{JY1?T{|QA<=hBzJla#T^AF*X-?ZQl;V$ zo&wWxvBBP~Cws{UuegN~B7~xQ8b`zH9%o#SMNi&@dc8}Qd@o2Jl@og4Xx;8n`P|y= z*;?g0c{&v=liV~fzAcE+N|%+0HrparVcvY=8i1{TqhMKdjPhPMIo!1^rPCE_wrMFPjMIY5{?Pmk1wMmn5 z6wkm|56IX?&dYbXqC*c`P>8{wk@qk3A4xIH5Bnw!EexcJ_MkAf`n(3%#>3T4l-6tJ8<#NB}d--8Q; z3nUS07I~b$>9@3F?x6#GC|cib;tF+_JkBbJw$NwlIMC~42RZ_U>F3TB1a?rpx2#_b zxI)dL#5V1Yc%R#L`MtRQo3N1Ii|e0-RhHle1zeG?qjFUfO16NAyr)MH zXjPOKVR<*uzAH>iI>_}adZ*H^XhVy8WFomj_1K=FLaF+h+2!0*!s9Mi$dFL=F!j=P z+C&CmC_H%!P1L|}L@Xn)=W`wo`@*Z+$gJQOCu?s$6h&iy!?gQ_LzRdP={A`8%yk^D#MOy;Q$5?g>q))sj6zU=F?< z@s(=_Qsg@LqmFr-zoh_O>UDeO>TzG<>N4}(#I75w$dzHUZ`E-;x_o4(CVapbow|2$ zDe-xMd~X+dHq#NG66))`$if5<56IeRcf+1XTosK<(DYl6G;e$T*L-wTDXzr^MV zTdNw;cA%H#F_m>)a>pk+*pk)AV4u_z>7a9{g^?y8N*-M?QezSoXr)0+P35Z1VdQWz z>Y}V6u&dEc?CltlPm;#i*>!JqdV+UvtmZ=6S46DwGeu!}MnT;nXGXorTKAHZ_cf1r`)75ht}^{T${F@1Xyew*(@JwE%(p}Z(Vdg^k`>aha*1|M+@*=P6(p*318o4C z`)#_64l`+S!D=bQvLKXB^4*dgP1E#Z=MjkveWi;hT%Q`^)Ycd3J|sb1q_s07F;#kG z1AUF+P4+=`!O||Ey(KL?8nQQ7(N-fcSK3|40#rVf&%v_9+fD5Q;2JC$m>BOvKK<(t zmGPSm?LXWTKg~V_J_J4lJ_J4lJ_J4lJ_J4lJ_J4lJ_J4lJ_J4lJ_J4lJ_J4lJ_J4l I{_F()2Ihj_O#lD@ literal 0 HcmV?d00001 From b0c577ddd7cc73adfa1603841927e01a7935817e Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Mon, 27 Feb 2017 22:41:42 +0900 Subject: [PATCH 179/295] Update command in example --- plugins/apps/internal-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/apps/internal-functions b/plugins/apps/internal-functions index 274132560..4de6de77e 100755 --- a/plugins/apps/internal-functions +++ b/plugins/apps/internal-functions @@ -23,7 +23,7 @@ apps_help_cmd() { echo '' echo 'Example:' echo '' - echo '$ dokku apps' + echo '$ dokku apps:list' echo '=====> My Apps' echo 'example' echo 'example2' From c1cef4f99ebd8d2cd18329c58a99f6ab875b8598 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Mon, 27 Feb 2017 23:04:54 +0900 Subject: [PATCH 180/295] Fix `certs:help` `certs` requires `app` argument like `certs:info`. --- plugins/certs/internal-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/certs/internal-functions b/plugins/certs/internal-functions index a7a38179f..77f4f0c79 100755 --- a/plugins/certs/internal-functions +++ b/plugins/certs/internal-functions @@ -6,7 +6,7 @@ source "$PLUGIN_AVAILABLE_PATH/certs/functions" certs_help_content_func() { declare desc="return certs plugin help content" cat<, [DEPRECATED] Alternative for certs:report certs:add CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate certs:generate DOMAIN, Generate a key and certificate signing request (and self-signed certificate) From d79a79084eaceeff12e0137e413ef54deab03ccc Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 27 Feb 2017 07:30:21 -0700 Subject: [PATCH 181/295] fix: bail early when checking ps output for an undeployed app Closes #2630 --- plugins/ps/subcommands/default | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/ps/subcommands/default b/plugins/ps/subcommands/default index 46dec800a..bcb52434d 100755 --- a/plugins/ps/subcommands/default +++ b/plugins/ps/subcommands/default @@ -8,10 +8,10 @@ ps_main_cmd() { [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" local APP="$2"; verify_app_name "$APP" - local DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids "$APP") - ! (is_deployed "$APP") && echo "App $APP has not been deployed" && exit 0 + local DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids "$APP") + local CID for CID in $DOKKU_APP_RUNNING_CONTAINER_IDS; do has_tty && local DOKKU_RUN_OPTS="-i -t" From f7a25eb4808321895bb0908c1d3483bfb5bb1951 Mon Sep 17 00:00:00 2001 From: David Poggi Date: Tue, 28 Feb 2017 13:20:47 -0500 Subject: [PATCH 182/295] update ssl.md Make sure we're respecting the respectively ;) --- docs/configuration/ssl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuration/ssl.md b/docs/configuration/ssl.md index 4c9b25e8f..6d59f6090 100644 --- a/docs/configuration/ssl.md +++ b/docs/configuration/ssl.md @@ -119,7 +119,7 @@ Beware that if you enable the header and a subsequent deploy of your application ## Running behind a load balancer -Your application has access to the HTTP headers `X-Forwarded-Proto`, `X-Forwarded-For` and `X-Forwarded-Port`. These headers indicate the protocol of the original request (HTTP or HTTPS), the port number, and the IP address of the client making the request, respectively. The default configuration is for Nginx to set these headers. +Your application has access to the HTTP headers `X-Forwarded-Proto`, `X-Forwarded-Port` and `X-Forwarded-For`. These headers indicate the protocol of the original request (HTTP or HTTPS), the port number, and the IP address of the client making the request, respectively. The default configuration is for Nginx to set these headers. If your server runs behind an HTTP/S load balancer, then Nginx will see all requests as coming from the load balancer. If your load balancer sets the `X-Forwarded-` headers, you can tell Nginx to pass these headers from load balancer to your application by using the following [nginx custom template](/dokku/configuration/nginx/#customizing-the-nginx-configuration) From 246e54a293dc5cb91f9aeb6bef870224ef3c8f14 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Tue, 28 Feb 2017 17:02:33 -0700 Subject: [PATCH 183/295] update herokuish to 0.3.26 --- deb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deb.mk b/deb.mk index dfc253fa3..6a60b41aa 100644 --- a/deb.mk +++ b/deb.mk @@ -1,6 +1,6 @@ HEROKUISH_DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku' HEROKUISH_REPO_NAME ?= gliderlabs/herokuish -HEROKUISH_VERSION ?= 0.3.25 +HEROKUISH_VERSION ?= 0.3.26 HEROKUISH_ARCHITECTURE = amd64 HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb From a3989aafaa47f079f889488db468083e6a373542 Mon Sep 17 00:00:00 2001 From: raphaklaus Date: Thu, 2 Mar 2017 16:38:25 -0300 Subject: [PATCH 184/295] add grep to find crt and key files --- plugins/certs/subcommands/add | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/certs/subcommands/add b/plugins/certs/subcommands/add index 2cd29fe06..8ba096a93 100755 --- a/plugins/certs/subcommands/add +++ b/plugins/certs/subcommands/add @@ -44,7 +44,7 @@ certs_set() { trap 'popd &> /dev/null || true; rm -rf $CERTS_SET_TMP_WORK_DIR > /dev/null' RETURN tar xvf - <&0 - local CRT_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name ".crt$") + local CRT_FILE_SEARCH=$(find . -not -path '*/\.*' -type f | grep ".crt$") local CRT_FILE_COUNT=$(printf "%s" "$CRT_FILE_SEARCH" | grep -c '^') if [[ $CRT_FILE_COUNT -lt 1 ]]; then dokku_log_fail "Tar archive is missing .crt file" @@ -54,7 +54,7 @@ certs_set() { local CRT_FILE=$CRT_FILE_SEARCH fi - local KEY_FILE_SEARCH=$(find . -not -path '*/\.*' -type f -name ".key$") + local KEY_FILE_SEARCH=$(find . -not -path '*/\.*' -type f | grep ".key$") local KEY_FILE_COUNT=$(printf "%s" "$KEY_FILE_SEARCH" | grep -c '^') if [[ $KEY_FILE_COUNT -lt 1 ]]; then dokku_log_fail "Tar archive is missing .key file" From 1e387b3b420a49ff87d16265a30efade2f1a0dbf Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 3 Mar 2017 09:04:49 -0700 Subject: [PATCH 185/295] fix: support new docker packages Refs #2636 --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index d4ff40970..75d42b2aa 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Version: 0.8.0 Section: web Priority: optional Architecture: amd64 -Depends: locales, git, make, curl, gcc, man-db, sshcommand (>= 0.6.0), gliderlabs-sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1), software-properties-common, python-software-properties +Depends: locales, git, make, curl, gcc, man-db, sshcommand (>= 0.6.0), gliderlabs-sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1) | docker-ce | docker-ee, software-properties-common, python-software-properties Recommends: herokuish (>= 0.3.4), parallel Pre-Depends: nginx, dnsutils, cgroupfs-mount | cgroup-lite, plugn (>= 0.2.2), sudo, python2.7, debconf Maintainer: Jose Diaz-Gonzalez From 31c9775ef490ee792a37cf1965c675da5e7356bf Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 4 Mar 2017 16:17:27 -0700 Subject: [PATCH 186/295] docs: Add documentation surrounding flags that ps:report accepts Closes #2631 [ci skip] --- docs/deployment/process-management.md | 11 ++++++----- plugins/ps/commands | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/deployment/process-management.md b/docs/deployment/process-management.md index 997dcd240..bded4f5fa 100644 --- a/docs/deployment/process-management.md +++ b/docs/deployment/process-management.md @@ -4,15 +4,16 @@ ``` ps # List processes running in app container(s) -ps:rebuildall # Rebuild all apps from source ps:rebuild # Rebuild an app from source -ps:restartall # Restart all deployed app containers +ps:rebuildall # Rebuild all apps from source +ps:report [] [] # Displays a process report for one or more apps ps:restart # Restart app container(s) -ps:scale = [=] # Set how many processes of a given process to run +ps:restart-policy # Shows the restart-policy for an app +ps:restartall # Restart all deployed app containers +ps:scale = [=] # Get/Set how many instances of a given process to run +ps:set-restart-policy # Sets app restart-policy ps:start # Start app container(s) ps:stop # Stop app container(s) -ps:restart-policy # Shows the restart-policy for an app -ps:set-restart-policy # Sets app restart-policy ``` By default, Dokku will only start a single `web` process - if defined - though process scaling can be managed by the `ps` plugin or [via a custom `DOKKU_SCALE` file](/dokku/deployment/process-management/#manually-managing-process-scaling). diff --git a/plugins/ps/commands b/plugins/ps/commands index c5ee28b84..a17a2ef55 100755 --- a/plugins/ps/commands +++ b/plugins/ps/commands @@ -13,7 +13,7 @@ case "$1" in ps:stop , Stop app container(s) ps:rebuild , Rebuild an app from source ps:rebuildall, Rebuild all apps from source - ps:report, Shows report of all processes in app container(s) + ps:report [] [], Displays a process report for one or more apps ps:restart , Restart app container(s) ps:restartall, Restart all deployed app containers ps:restore, Start previously running apps e.g. after reboot From 926cb51906423a774c84a72fa1e3d5c63c3a157e Mon Sep 17 00:00:00 2001 From: Felix Wolfsteller Date: Mon, 6 Mar 2017 10:23:08 +0100 Subject: [PATCH 187/295] Improve README with more speaking link to doc. Also, add a full stop somewhere. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5058bf804..703cb2ef2 100644 --- a/README.md +++ b/README.md @@ -113,11 +113,11 @@ If you wish for a more unattended installation method, see [these](http://dokku. ## Documentation -Full documentation - including advanced installation docs - are available online [here](http://dokku.viewdocs.io/dokku/) +Full documentation - including advanced installation docs - are available online at [http://dokku.viewdocs.io/dokku/](http://dokku.viewdocs.io/dokku/). ## Support -You can use [Github Issues](https://github.com/dokku/dokku/issues), check [Troubleshooting](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) in the documentation, or join us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku) +You can use [Github Issues](https://github.com/dokku/dokku/issues), check [Troubleshooting](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) in the documentation, or join us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku). ## Contribution From e870f844c6827715e105d050ae0fad0a0556ef79 Mon Sep 17 00:00:00 2001 From: Josh Cohen Date: Mon, 6 Mar 2017 08:06:24 -0500 Subject: [PATCH 188/295] Add documentation for how to grant other Unix accounts Dokku access without giving them full sudo privileges. --- docs/deployment/user-management.md | 13 +++++++++++++ docs/getting-started/advanced-installation.md | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/deployment/user-management.md b/docs/deployment/user-management.md index 17e8f924b..37000e98d 100644 --- a/docs/deployment/user-management.md +++ b/docs/deployment/user-management.md @@ -73,3 +73,16 @@ dokku ssh-keys:remove KEY_NAME ## Scoping commands to specific users Keys are given unique names, which can be used in conjunction with the [user-auth](/dokku/development/plugin-triggers/#user-auth) plugin trigger to handle command authorization. Please see the documentation on that trigger for more information. + +## Granting other Unix user accounts Dokku access + +Any Unix user account which belongs to the 'sudo' Unix group can run Dokku. However, you may want to give them Dokku access but not full sudo privileges. + +To allow other Unix user accounts to be able to run Dokku commands, without giving them full sudo access, modify your sudoers configuration. + +Use `visudo /etc/sudoers.d/dokku-users`, or `visudo /etc/sudoers` to add the following line: + +``` +%dokku ALL=(ALL:ALL) NOPASSWD:SETENV: /usr/bin/dokku +``` + diff --git a/docs/getting-started/advanced-installation.md b/docs/getting-started/advanced-installation.md index 100ee7f2e..065b68d0f 100644 --- a/docs/getting-started/advanced-installation.md +++ b/docs/getting-started/advanced-installation.md @@ -52,7 +52,7 @@ Once Dokku is installed, if you are not using the web-installer, you'll want to Set up a domain and a wildcard domain pointing to that host. Make sure `/home/dokku/VHOST` is set to this domain. By default it's set to whatever hostname the host has. This file is only created if the hostname can be resolved by dig (`dig +short $(hostname -f)`). Otherwise you have to create the file manually and set it to your preferred domain. If this file still is not present when you push your app, Dokku will publish the app with a port number (i.e. `http://example.com:49154` - note the missing subdomain). -Follow the [user management documentation](/dokku/deployment/user-management/) in order to add users to dokku. +Follow the [user management documentation](/dokku/deployment/user-management/) in order to add users to Dokku, or to give other Unix accounts access to Dokku. That's it! From 41d3b258bb061a0de978a73b89955367c3c62061 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 9 Mar 2017 01:56:27 -0700 Subject: [PATCH 189/295] fix: properly escape post-install variables Closes #2646 [ci skip] --- deb.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deb.mk b/deb.mk index 6a60b41aa..7e5d4dfb5 100644 --- a/deb.mk +++ b/deb.mk @@ -92,10 +92,10 @@ deb-herokuish: @echo " sudo docker rmi gliderlabs/herokuish" >> /tmp/tmp/post-install @echo "fi" >> /tmp/tmp/post-install @echo "echo 'Importing herokuish into docker (around 5 minutes)'" >> /tmp/tmp/post-install - @echo 'if [[ ! -z ${http_proxy+x} ]]; then BUILDARGS="--build-args http_proxy=$http_proxy"; fi' >> /tmp/tmp/post-install - @echo 'if [[ ! -z ${https_proxy+x} ]]; then BUILDARGS="$BUILDARGS --build-args https_proxy=$https_proxy"; fi' >> /tmp/tmp/post-install - @echo 'if [[ ! -z ${BUILDARGS+x} ]]; then echo Adding proxy settings to docker build: $BUILDARGS; fi' >> /tmp/tmp/post-install - @echo 'sudo docker build $BUILDARGS -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null' >> /tmp/tmp/post-install + @echo 'if [[ ! -z $${http_proxy+x} ]]; then BUILDARGS="--build-args http_proxy=$$http_proxy"; fi' >> /tmp/tmp/post-install + @echo 'if [[ ! -z $${https_proxy+x} ]]; then BUILDARGS="$$BUILDARGS --build-args https_proxy=$$https_proxy"; fi' >> /tmp/tmp/post-install + @echo 'if [[ ! -z $${BUILDARGS+x} ]]; then echo Adding proxy settings to docker build: $$BUILDARGS; fi' >> /tmp/tmp/post-install + @echo 'sudo docker build $$BUILDARGS -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null' >> /tmp/tmp/post-install @echo "-> Cloning repository" git clone -q "https://github.com/$(HEROKUISH_REPO_NAME).git" --branch "v$(HEROKUISH_VERSION)" /tmp/tmp/herokuish > /dev/null From 3b2bb2ebc646ed9e7d784eff561a5f8c78134ed7 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 10 Mar 2017 19:47:26 -0700 Subject: [PATCH 190/295] docs: Note that the remote username is important [ci skip] --- docs/deployment/application-deployment.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/deployment/application-deployment.md b/docs/deployment/application-deployment.md index c8f0d2e9a..faeb06e54 100644 --- a/docs/deployment/application-deployment.md +++ b/docs/deployment/application-deployment.md @@ -52,6 +52,7 @@ Now you can deploy the `ruby-rails-sample` app to your Dokku server. All you hav ```shell # from your local machine +# the remote username *must* be dokku or pushes will fail git remote add dokku dokku@dokku.me:ruby-rails-sample git push dokku master ``` @@ -142,6 +143,8 @@ Note that if the buildpack or dockerfile build process require ssh key access fo The name of remote repository is used as the name of application to be deployed, as for example above: ```shell +# from your local machine +# the remote username *must* be dokku or pushes will fail git remote add dokku dokku@dokku.me:ruby-rails-sample git push dokku master ``` @@ -154,6 +157,8 @@ remote: http://ruby-rails-sample.dokku.me You can also specify fully qualified names, say `app.dokku.me`, as ```shell +# from your local machine +# the remote username *must* be dokku or pushes will fail git remote add dokku dokku@dokku.me:app.dokku.me git push dokku master ``` @@ -166,6 +171,8 @@ remote: http://app.dokku.me This is in particular useful, then you want to deploy to root domain, as ```shell +# from your local machine +# the remote username *must* be dokku or pushes will fail git remote add dokku dokku@dokku.me:dokku.me git push dokku master ``` From 7bbad9f074ea067cad52b4f3ad601835c0dac480 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 12 Mar 2017 21:24:25 -0600 Subject: [PATCH 191/295] fix: ensure the help output for nginx/ssh-keys renders correctly Closes #2627 [ci skip] --- plugins/nginx-vhosts/subcommands/default | 2 +- plugins/ssh-keys/subcommands/default | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/nginx-vhosts/subcommands/default b/plugins/nginx-vhosts/subcommands/default index 5a4deae9b..08be1d5e9 100755 --- a/plugins/nginx-vhosts/subcommands/default +++ b/plugins/nginx-vhosts/subcommands/default @@ -2,4 +2,4 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions" -nginx_vhosts_help_cmd "$@" +nginx_vhosts_help_cmd "nginx:help" diff --git a/plugins/ssh-keys/subcommands/default b/plugins/ssh-keys/subcommands/default index 20fea35c3..2260f6e62 100755 --- a/plugins/ssh-keys/subcommands/default +++ b/plugins/ssh-keys/subcommands/default @@ -2,4 +2,4 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_AVAILABLE_PATH/ssh-keys/internal-functions" -ssh_keys_help_cmd "$@" +ssh_keys_help_cmd "ssh-keys:help" From 2bcad2014bdfa469c9fbf2a4f53040c86da396ce Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 12 Mar 2017 21:26:19 -0600 Subject: [PATCH 192/295] chore: unify error output when an app is not declared --- docs/development/plugin-creation.md | 4 ++-- plugins/common/functions | 2 +- plugins/nginx-vhosts/subcommands/access-logs | 2 +- plugins/nginx-vhosts/subcommands/build-config | 2 +- plugins/storage/functions | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/development/plugin-creation.md b/docs/development/plugin-creation.md index 2a2134082..b8d5e1b8d 100644 --- a/docs/development/plugin-creation.md +++ b/docs/development/plugin-creation.md @@ -30,7 +30,7 @@ hello_main_cmd() { set -- $cmd $@ ## - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$2" local APP="$2"; @@ -58,7 +58,7 @@ hello_world_cmd() { set -- $cmd $@ ## - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$2" local APP="$2"; diff --git a/plugins/common/functions b/plugins/common/functions index 20cb21c46..86278277f 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -530,7 +530,7 @@ dokku_deploy_cmd() { source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" - [[ -z $1 ]] && dokku_log_fail "Please specify an app to deploy" + [[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on" local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG") verify_app_name "$APP" plugn trigger pre-deploy "$APP" "$IMAGE_TAG" diff --git a/plugins/nginx-vhosts/subcommands/access-logs b/plugins/nginx-vhosts/subcommands/access-logs index 5b8fa8990..055d84713 100755 --- a/plugins/nginx-vhosts/subcommands/access-logs +++ b/plugins/nginx-vhosts/subcommands/access-logs @@ -7,7 +7,7 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" nginx_logs_cmd() { declare desc="display app nginx logs from command line" local cmd="$1" - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" nginx_logs "$@" } diff --git a/plugins/nginx-vhosts/subcommands/build-config b/plugins/nginx-vhosts/subcommands/build-config index 212c8ef15..74b118da2 100755 --- a/plugins/nginx-vhosts/subcommands/build-config +++ b/plugins/nginx-vhosts/subcommands/build-config @@ -7,7 +7,7 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" nginx_build_config_cmd() { declare desc="build nginx config to proxy app containers from command line" local cmd="nginx:build-config" - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" nginx_build_config "$2" } diff --git a/plugins/storage/functions b/plugins/storage/functions index d65daeb26..6d2ec0a6c 100755 --- a/plugins/storage/functions +++ b/plugins/storage/functions @@ -6,7 +6,7 @@ storage_list_cmd() { declare desc="List all bound mounts" local cmd="storage:list" local passed_phases="deploy" - [[ ! $2 ]] && dokku_log_fail "storage:list requires an app to list." + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$2" && local APP="$2" echo "$APP volume bind-mounts:" get_bind_mounts "$(get_phase_file_path "$passed_phases")" From 6124f2693bf4e630b4ab258593221e21c054deb3 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 12 Mar 2017 21:26:46 -0600 Subject: [PATCH 193/295] feat: make plugin:default an alias of plugin:list --- plugins/plugin/commands | 2 +- plugins/plugin/internal-functions | 10 ++++++++++ plugins/plugin/subcommands/default | 12 ++++-------- plugins/plugin/subcommands/list | 5 +++++ 4 files changed, 20 insertions(+), 9 deletions(-) create mode 100755 plugins/plugin/internal-functions create mode 100755 plugins/plugin/subcommands/list diff --git a/plugins/plugin/commands b/plugins/plugin/commands index a5b4dff78..7f4164239 100755 --- a/plugins/plugin/commands +++ b/plugins/plugin/commands @@ -7,7 +7,7 @@ case "$1" in help_content_func () { declare desc="return plugin plugin help content" cat< Date: Sun, 12 Mar 2017 21:26:54 -0600 Subject: [PATCH 194/295] chore: formatting --- plugins/ssh-keys/internal-functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/ssh-keys/internal-functions b/plugins/ssh-keys/internal-functions index bc4d868e7..e4bff023f 100755 --- a/plugins/ssh-keys/internal-functions +++ b/plugins/ssh-keys/internal-functions @@ -2,8 +2,8 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x ssh_keys_help_content_func() { - declare desc="return ssh-keys plugin help content" - cat< [/path/to/key], Add a new public key by pipe or path ssh-keys:remove , Remove SSH public key by name From ef9b453aa84a56fde4ffe0287ae3592152861e73 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 12 Mar 2017 21:27:21 -0600 Subject: [PATCH 195/295] refactor: mark storage:list as deprecated --- plugins/storage/subcommands/default | 3 ++- plugins/storage/subcommands/list | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) mode change 100644 => 100755 plugins/storage/subcommands/default diff --git a/plugins/storage/subcommands/default b/plugins/storage/subcommands/default old mode 100644 new mode 100755 index 194ef7942..f37200047 --- a/plugins/storage/subcommands/default +++ b/plugins/storage/subcommands/default @@ -2,11 +2,12 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" storage_main_cmd() { declare desc="an alias for storage:list" local cmd="storage" + + dokku_log_warn "Deprecated: Please use storage:list" storage_list_cmd "$@" } diff --git a/plugins/storage/subcommands/list b/plugins/storage/subcommands/list index a16999a38..ca27076b3 100755 --- a/plugins/storage/subcommands/list +++ b/plugins/storage/subcommands/list @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" storage_list_cmd "$@" From 48503e9f4066212083ec45fff53d76db98a3e2a6 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 12 Mar 2017 21:28:29 -0600 Subject: [PATCH 196/295] fix: add missing import --- plugins/storage/functions | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/storage/functions b/plugins/storage/functions index 6d2ec0a6c..1183fc57c 100755 --- a/plugins/storage/functions +++ b/plugins/storage/functions @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" storage_list_cmd() { declare desc="List all bound mounts" From 0153bc49bcb1f16e9d35925954f306daaee7f98c Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 12 Mar 2017 21:28:45 -0600 Subject: [PATCH 197/295] feat: create tar:default alias for tar:help --- plugins/tar/commands | 20 ++------------------ plugins/tar/internal-functions | 27 +++++++++++++++++++++++++++ plugins/tar/subcommands/default | 5 +++++ 3 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 plugins/tar/internal-functions create mode 100755 plugins/tar/subcommands/default diff --git a/plugins/tar/commands b/plugins/tar/commands index 60a8123a5..50fb131fb 100755 --- a/plugins/tar/commands +++ b/plugins/tar/commands @@ -1,27 +1,11 @@ #!/usr/bin/env bash [[ " help tar:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/tar/internal-functions" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in help | tar:help) - help_content_func () { - declare desc="return tar plugin help content" - cat<, Reads an tarball containing the app from stdin - tar:from , Loads an app tarball from url -help_content - } - - if [[ $1 = "tar:help" ]] ; then - echo -e 'Usage: dokku tar[:COMMAND]' - echo '' - echo 'An alternative to using git, apps are loaded via tarballs instead.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + tar_help_cmd "$1" ;; *) diff --git a/plugins/tar/internal-functions b/plugins/tar/internal-functions new file mode 100644 index 000000000..1d81df165 --- /dev/null +++ b/plugins/tar/internal-functions @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +tar_help_content_func() { + declare desc="return tar plugin help content" + cat<, Reads an tarball containing the app from stdin + tar:from , Loads an app tarball from url +help_content +} + +tar_help_cmd() { + if [[ $1 = "tar:help" ]] ; then + echo -e 'Usage: dokku tar[:COMMAND]' + echo '' + echo 'An alternative to using git, apps are loaded via tarballs instead.' + echo '' + echo 'Additional commands:' + tar_help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + tar_help_content_func + else + cat< Date: Sun, 12 Mar 2017 21:29:01 -0600 Subject: [PATCH 198/295] feat: create repo:default alias for repo:help --- plugins/repo/commands | 20 ++------------------ plugins/repo/internal-functions | 27 +++++++++++++++++++++++++++ plugins/repo/subcommands/default | 5 +++++ 3 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 plugins/repo/internal-functions create mode 100755 plugins/repo/subcommands/default diff --git a/plugins/repo/commands b/plugins/repo/commands index 816768bf3..c261c436b 100755 --- a/plugins/repo/commands +++ b/plugins/repo/commands @@ -1,27 +1,11 @@ #!/usr/bin/env bash [[ " help repo:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/repo/internal-functions" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in help | repo:help) - help_content_func () { - declare desc="return repo plugin help content" - cat<, Runs 'git gc --aggressive' against the application's repo - repo:purge-cache , Deletes the contents of the build cache stored in the repository -help_content - } - - if [[ $1 = "repo:help" ]] ; then - echo -e 'Usage: dokku repo[:COMMAND]' - echo '' - echo "Runs commands that interact with the app's repo" - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + repo_help_cmd "$@" ;; *) diff --git a/plugins/repo/internal-functions b/plugins/repo/internal-functions new file mode 100644 index 000000000..f58becc18 --- /dev/null +++ b/plugins/repo/internal-functions @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +repo_help_content_func () { + declare desc="return repo plugin help content" + cat<, Runs 'git gc --aggressive' against the application's repo + repo:purge-cache , Deletes the contents of the build cache stored in the repository +help_content +} + +repo_help_cmd() { + if [[ $1 = "repo:help" ]] ; then + echo -e 'Usage: dokku repo[:COMMAND]' + echo '' + echo "Runs commands that interact with the app's repo" + echo '' + echo 'Additional commands:' + repo_help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + repo_help_content_func + else + cat< Date: Sun, 12 Mar 2017 21:29:12 -0600 Subject: [PATCH 199/295] feat: mark ps:default command as deprecated --- plugins/ps/subcommands/default | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/ps/subcommands/default b/plugins/ps/subcommands/default index bcb52434d..07f044d57 100755 --- a/plugins/ps/subcommands/default +++ b/plugins/ps/subcommands/default @@ -5,6 +5,8 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" ps_main_cmd() { declare desc="shows running processes in all running app containers" local cmd="ps" + dokku_log_warn "Deprecated: Please use ps:report" + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" local APP="$2"; verify_app_name "$APP" From 30bf228dc971fae6de4899b8cd5e40c30bb45a1f Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 12 Mar 2017 21:29:25 -0600 Subject: [PATCH 200/295] docs: swap in plugin:list command --- docs/advanced-usage/plugin-management.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced-usage/plugin-management.md b/docs/advanced-usage/plugin-management.md index 3ac658310..b61ce2543 100644 --- a/docs/advanced-usage/plugin-management.md +++ b/docs/advanced-usage/plugin-management.md @@ -3,11 +3,11 @@ > New as of 0.4.0 ``` -plugin # Print active plugins plugin:disable # Disable an installed plugin (third-party only) plugin:enable # Enable a previously disabled plugin plugin:install [--core|git-url [--committish tag|branch|commit|--name custom-plugin-name]] # Optionally download git-url (with custom tag/committish) & run install trigger for active plugins (or only core ones) plugin:install-dependencies [--core] # Run install-dependencies trigger for active plugins (or only core ones) +plugin:list # Print active plugins plugin:uninstall # Uninstall a plugin (third-party only) plugin:update [name [committish]] # Optionally update named plugin from git (with custom tag/committish) & run update trigger for active plugins ``` From 3c5335056c041538a340158fefde3aeb55e742ac Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 12 Mar 2017 21:46:58 -0600 Subject: [PATCH 201/295] feat: allow plugin:help and plugin:list subcommands to be run without root --- dokku | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dokku b/dokku index 978d617f4..c663b240a 100755 --- a/dokku +++ b/dokku @@ -56,7 +56,7 @@ if [[ $(id -un) != "dokku" ]] && [[ ! $1 =~ plugin:* ]] && [[ ! $1 == "ssh-keys: exit $? fi -if [[ $(id -un) != "root" && $1 =~ ^plugin:.* ]] || [[ $(id -un) != "root" && $1 == "ssh-keys:add" ]]; then +if [[ $(id -un) != "root" && $1 =~ ^plugin:.* && $1 != "plugin:help" && $1 != "plugin:list" ]] || [[ $(id -un) != "root" && $1 == "ssh-keys:add" ]]; then dokku_log_fail "This command must be run as root" fi From e99e0b02d47c4e055c6bae0dd2a01913ba5e42d2 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 18:33:53 -0700 Subject: [PATCH 202/295] refactor: move storage:help to internal-functions --- plugins/storage/commands | 22 ++-------------------- plugins/storage/internal-functions | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 20 deletions(-) create mode 100755 plugins/storage/internal-functions diff --git a/plugins/storage/commands b/plugins/storage/commands index 337f07473..d4335a84c 100755 --- a/plugins/storage/commands +++ b/plugins/storage/commands @@ -1,29 +1,11 @@ #!/usr/bin/env bash [[ " storage:help help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/storage/internal-functions" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in help | storage:help) - help_content_func () { - declare desc="return storage plugin help content" - cat<, List bind mounts for app's container(s) (host:container) - storage:mount , Create a new bind mount - storage:unmount , Remove an existing bind mount -help_content - } - - if [[ $1 = "shell:help" ]] ; then - echo -e 'Usage: dokku storage:COMMAND' - echo '' - echo 'Mount local volume / directories inside containers.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + storage_help_cmd "$@" ;; *) diff --git a/plugins/storage/internal-functions b/plugins/storage/internal-functions new file mode 100755 index 000000000..913af714b --- /dev/null +++ b/plugins/storage/internal-functions @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +storage_help_content_func() { + declare desc="return storage plugin help content" + cat<, List bind mounts for app's container(s) (host:container) + storage:mount , Create a new bind mount + storage:unmount , Remove an existing bind mount +help_content +} + +storage_help_cmd() { + if [[ $1 = "storage:help" ]] ; then + echo -e 'Usage: dokku storage[:COMMAND]' + echo '' + echo 'Mount local volume / directories inside containers.' + echo '' + echo 'Additional commands:' + storage_help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + storage_help_content_func + else + cat< Date: Mon, 20 Feb 2017 18:34:54 -0700 Subject: [PATCH 203/295] refactor: storage:default is now an alias for storage:help --- plugins/storage/subcommands/default | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/plugins/storage/subcommands/default b/plugins/storage/subcommands/default index f37200047..f54d429ee 100755 --- a/plugins/storage/subcommands/default +++ b/plugins/storage/subcommands/default @@ -1,14 +1,5 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" +source "$PLUGIN_AVAILABLE_PATH/storage/internal-functions" -storage_main_cmd() { - declare desc="an alias for storage:list" - local cmd="storage" - - dokku_log_warn "Deprecated: Please use storage:list" - storage_list_cmd "$@" -} - -storage_main_cmd "$@" +storage_help_cmd "storage:help" From a7f32197f37e17ff246d9d80c4db2b13d45d7a24 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 18:37:06 -0700 Subject: [PATCH 204/295] refactor: move command to internal-functions --- plugins/storage/functions | 10 ---------- plugins/storage/internal-functions | 13 +++++++++++++ plugins/storage/subcommands/list | 3 +-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/plugins/storage/functions b/plugins/storage/functions index 1183fc57c..d7fd8f4cf 100755 --- a/plugins/storage/functions +++ b/plugins/storage/functions @@ -3,16 +3,6 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" -storage_list_cmd() { - declare desc="List all bound mounts" - local cmd="storage:list" - local passed_phases="deploy" - [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" - verify_app_name "$2" && local APP="$2" - echo "$APP volume bind-mounts:" - get_bind_mounts "$(get_phase_file_path "$passed_phases")" -} - verify_paths() { declare desc="verifies storage paths" echo "$1" | grep -qe '^/.*\:/' || dokku_log_fail "Storage path must be two valid paths divided by colon." diff --git a/plugins/storage/internal-functions b/plugins/storage/internal-functions index 913af714b..745c6a8ed 100755 --- a/plugins/storage/internal-functions +++ b/plugins/storage/internal-functions @@ -1,5 +1,8 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" +source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" storage_help_content_func() { declare desc="return storage plugin help content" @@ -26,3 +29,13 @@ storage_help_cmd() { help_desc fi } + +storage_list_cmd() { + declare desc="List all bound mounts" + local cmd="storage:list" + local passed_phases="deploy" + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" + verify_app_name "$2" && local APP="$2" + echo "$APP volume bind-mounts:" + get_bind_mounts "$(get_phase_file_path "$passed_phases")" +} diff --git a/plugins/storage/subcommands/list b/plugins/storage/subcommands/list index ca27076b3..6dff5c6cf 100755 --- a/plugins/storage/subcommands/list +++ b/plugins/storage/subcommands/list @@ -1,6 +1,5 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" - +source "$PLUGIN_AVAILABLE_PATH/storage/internal-functions" storage_list_cmd "$@" From 35acce84ea181571fef9a44a2887843d7befaf69 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 18:37:22 -0700 Subject: [PATCH 205/295] chore: use correct path for sourcing --- plugins/storage/subcommands/mount | 4 ++-- plugins/storage/subcommands/unmount | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/storage/subcommands/mount b/plugins/storage/subcommands/mount index b82a550cb..0a052c65d 100755 --- a/plugins/storage/subcommands/mount +++ b/plugins/storage/subcommands/mount @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" +source "$PLUGIN_AVAILABLE_PATH/storage/functions" +source "$PLUGIN_AVAILABLE_PATH/docker-options/functions" storage_mount_cmd() { declare desc="Add bind-mount, redeploy app if running" diff --git a/plugins/storage/subcommands/unmount b/plugins/storage/subcommands/unmount index d460386d5..7b86f5c38 100755 --- a/plugins/storage/subcommands/unmount +++ b/plugins/storage/subcommands/unmount @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" +source "$PLUGIN_AVAILABLE_PATH/storage/functions" +source "$PLUGIN_AVAILABLE_PATH/docker-options/functions" storage_unmount_cmd() { declare desc="Remove bind-mount, restart app if running" From b7da215ab51219a2ccbbc8f9e3b8200920722cb6 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 19:05:38 -0700 Subject: [PATCH 206/295] feat: implement storage:report command Refs #2356 --- docs/advanced-usage/persistent-storage.md | 45 +++++++++++++++ plugins/storage/internal-functions | 1 + plugins/storage/subcommands/report | 68 +++++++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100755 plugins/storage/subcommands/report diff --git a/docs/advanced-usage/persistent-storage.md b/docs/advanced-usage/persistent-storage.md index 4cf00aafe..72a51f985 100644 --- a/docs/advanced-usage/persistent-storage.md +++ b/docs/advanced-usage/persistent-storage.md @@ -8,6 +8,7 @@ The preferred method to mount external containers to a Dokku managed container, ``` storage:list # List bind mounts for app's container(s) (host:container) storage:mount # Create a new bind mount +storage:report [] [] # Displays a checks report for one or more apps storage:unmount # Remove an existing bind mount ``` @@ -53,6 +54,50 @@ dokku storage:mount app-name /var/lib/dokku/data/storage/node-js-app:/app/storag You can mount one or more directories as desired by following the above pattern. +### Displaying storage reports about an app + +> New as of 0.8.1 + +You can get a report about the app's storage status using the `storage:report` command: + +```shell +dokku storage:report +``` + +``` +=====> node-js-sample storage information + Storage build mounts: + Storage deploy mounts: -v /var/lib/dokku/data/storage/node-js-sample:/app/storage + Storage run mounts: -v /var/lib/dokku/data/storage/node-js-sample:/app/storage +=====> python-sample storage information + Storage build mounts: + Storage deploy mounts: + Storage run mounts: +=====> ruby-sample storage information + Storage build mounts: + Storage deploy mounts: + Storage run mounts: +``` + +You can run the command for a specific app also. + +```shell +dokku storage:report node-js-sample +``` + +``` +=====> node-js-sample storage information + Storage build mounts: + Storage deploy mounts: -v /var/lib/dokku/data/storage/node-js-sample:/app/storage + Storage run mounts: -v /var/lib/dokku/data/storage/node-js-sample:/app/storage +``` + +You can pass flags which will output only the value of the specific information you want. For example: + +```shell +dokku storage:report node-js-sample --storage-deploy-mounts +``` + ## Use Cases ### Persistent storage diff --git a/plugins/storage/internal-functions b/plugins/storage/internal-functions index 745c6a8ed..0c9bf0a64 100755 --- a/plugins/storage/internal-functions +++ b/plugins/storage/internal-functions @@ -9,6 +9,7 @@ storage_help_content_func() { cat<, List bind mounts for app's container(s) (host:container) storage:mount , Create a new bind mount + storage:report [] [], Displays a checks report for one or more apps storage:unmount , Remove an existing bind mount help_content } diff --git a/plugins/storage/subcommands/report b/plugins/storage/subcommands/report new file mode 100755 index 000000000..cc8e0fa60 --- /dev/null +++ b/plugins/storage/subcommands/report @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/docker-options/functions" + +fn-storage-bind-mounts() { + declare APP="$1" PHASE="$2" + local PHASE_FILE="$(fn-get-phase-file-path "$APP" "$PHASE")" + if [[ -r "$PHASE_FILE" ]]; then + sed -e '/^-v/!d' "$PHASE_FILE" | tr '\n' ' ' + fi +} + +storage_report_single_app() { + local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" + if [[ "$INFO_FLAG" == "true" ]]; then + INFO_FLAG="" + fi + verify_app_name "$APP" + local flag_map=( + "--storage-build-mounts: $(fn-storage-bind-mounts "$APP" build)" + "--storage-deploy-mounts: $(fn-storage-bind-mounts "$APP" deploy)" + "--storage-run-mounts: $(fn-storage-bind-mounts "$APP" run)" + ) + + if [[ -z "$INFO_FLAG" ]]; then + dokku_log_info2 "$APP storage information" + for flag in "${flag_map[@]}"; do + key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')" + dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")" + done + else + local match=false; local value_exists=false + for flag in "${flag_map[@]}"; do + valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)" + if [[ "$flag" == "${INFO_FLAG}:"* ]]; then + value=${flag#*: } + size="${#value}" + if [[ "$size" -ne 0 ]]; then + echo "$value" && match=true && value_exists=true + else + match=true + fi + fi + done + if [[ "$match" == "true" ]]; then + [[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed" + else + dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}" + fi + fi +} + +storage_report_cmd() { + declare desc="displays a storage report for one or more apps" + local cmd="storage:report" + local INSTALLED_APPS=$(dokku_apps); local APP + + if [[ -z $2 ]]; then + for APP in $INSTALLED_APPS; do + storage_report_single_app "$APP" "true" + done + else + storage_report_single_app "$2" "$3" + fi +} + +storage_report_cmd "$@" From 9bad0795e208b79635f56d952381894b0048e922 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 19:25:48 -0700 Subject: [PATCH 207/295] fix: add missing functions --- plugins/docker-options/functions | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/docker-options/functions b/plugins/docker-options/functions index d49ba305d..3769245e8 100755 --- a/plugins/docker-options/functions +++ b/plugins/docker-options/functions @@ -4,12 +4,19 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" AVAILABLE_PHASES=(build deploy run) +fn-get-phase-file-path() { + declare desc="return docker-options config file path for specified phase" + local APP="$1" PHASE="$2" + local PHASE_FILE="${DOKKU_ROOT}/${APP}/DOCKER_OPTIONS_${PHASE^^}" + echo "$PHASE_FILE" +} + get_phase_file_path() { declare desc="return docker-options config file path for specified phase" local phase_file_prefix="DOCKER_OPTIONS_" local phase=$1 - [[ "$DOKKU_ROOT" && "$APP" && "$phase_file_prefix" && "$phase" ]] || dokku_log_fail "Error: phase_file_path is incomplete." - echo "${DOKKU_ROOT}/${APP}/${phase_file_prefix}${phase^^}" + [[ "$APP" && "$phase" ]] || dokku_log_fail "Error: phase_file_path is incomplete." + fn-get-phase-file-path "$APP" "$PHASE" } get_phases() { From b7dca68375af40e547665cfebd1b0ff8774839c6 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 19:23:16 -0700 Subject: [PATCH 208/295] fix: use correct source path --- plugins/docker-options/subcommands/add | 2 +- plugins/docker-options/subcommands/default | 2 +- plugins/docker-options/subcommands/remove | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/docker-options/subcommands/add b/plugins/docker-options/subcommands/add index b66576539..8a5242243 100755 --- a/plugins/docker-options/subcommands/add +++ b/plugins/docker-options/subcommands/add @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" +source "$PLUGIN_AVAILABLE_PATH/docker-options/functions" docker_options_add_cmd() { declare desc="Add a docker option to application" diff --git a/plugins/docker-options/subcommands/default b/plugins/docker-options/subcommands/default index 25d4580d5..d499241f9 100755 --- a/plugins/docker-options/subcommands/default +++ b/plugins/docker-options/subcommands/default @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" +source "$PLUGIN_AVAILABLE_PATH/docker-options/functions" docker_options_main_cmd() { declare desc="Display applications docker options" diff --git a/plugins/docker-options/subcommands/remove b/plugins/docker-options/subcommands/remove index f232083ef..6a0b651bf 100755 --- a/plugins/docker-options/subcommands/remove +++ b/plugins/docker-options/subcommands/remove @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" +source "$PLUGIN_AVAILABLE_PATH/docker-options/functions" docker_options_remove_cmd() { declare desc="Remove a docker option from application" From 25e44b5492ef865e5358088531c2c2523e0b5c88 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 19:31:53 -0700 Subject: [PATCH 209/295] docs: use node-js-app as the app name, not node-js-sample --- docs/advanced-usage/persistent-storage.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/advanced-usage/persistent-storage.md b/docs/advanced-usage/persistent-storage.md index 72a51f985..57775853a 100644 --- a/docs/advanced-usage/persistent-storage.md +++ b/docs/advanced-usage/persistent-storage.md @@ -65,10 +65,10 @@ dokku storage:report ``` ``` -=====> node-js-sample storage information +=====> node-js-app storage information Storage build mounts: - Storage deploy mounts: -v /var/lib/dokku/data/storage/node-js-sample:/app/storage - Storage run mounts: -v /var/lib/dokku/data/storage/node-js-sample:/app/storage + Storage deploy mounts: -v /var/lib/dokku/data/storage/node-js-app:/app/storage + Storage run mounts: -v /var/lib/dokku/data/storage/node-js-app:/app/storage =====> python-sample storage information Storage build mounts: Storage deploy mounts: @@ -82,20 +82,20 @@ dokku storage:report You can run the command for a specific app also. ```shell -dokku storage:report node-js-sample +dokku storage:report node-js-app ``` ``` -=====> node-js-sample storage information +=====> node-js-app storage information Storage build mounts: - Storage deploy mounts: -v /var/lib/dokku/data/storage/node-js-sample:/app/storage - Storage run mounts: -v /var/lib/dokku/data/storage/node-js-sample:/app/storage + Storage deploy mounts: -v /var/lib/dokku/data/storage/node-js-app:/app/storage + Storage run mounts: -v /var/lib/dokku/data/storage/node-js-app:/app/storage ``` You can pass flags which will output only the value of the specific information you want. For example: ```shell -dokku storage:report node-js-sample --storage-deploy-mounts +dokku storage:report node-js-app --storage-deploy-mounts ``` ## Use Cases From f1897c7a862ca62287bff357af323636786d6819 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 19:32:59 -0700 Subject: [PATCH 210/295] feat: implement docker-options:report command Refs #2356 --- docs/advanced-usage/docker-options.md | 70 +++++++++++++++++------ plugins/docker-options/commands | 3 +- plugins/docker-options/subcommands/report | 68 ++++++++++++++++++++++ 3 files changed, 121 insertions(+), 20 deletions(-) create mode 100755 plugins/docker-options/subcommands/report diff --git a/docs/advanced-usage/docker-options.md b/docs/advanced-usage/docker-options.md index d66650fee..73b81c5c9 100644 --- a/docs/advanced-usage/docker-options.md +++ b/docs/advanced-usage/docker-options.md @@ -5,15 +5,15 @@ Pass [options](https://docs.docker.com/engine/reference/run/) to Docker during Dokku's `build`, `deploy` and `run` phases ``` -docker-options [phase(s)] # Display app's Docker options for all phases (or comma separated phase list) docker-options:add OPTION # Add Docker option to app for phase (comma-separated phase list) docker-options:remove OPTION # Remove Docker option from app for phase (comma-separated phase list) +docker-options:report [] [] # Displays a docker options report for one or more apps ``` > When specifying multiple phases, they **must** be comma-separated _without_ spaces in between each phase, like so: > > ```shell -> dokku docker-options:add myapp deploy,run "-v /home/dokku/logs/myapp:/app/logs" +> dokku docker-options:add node-js-app deploy,run "-v /var/log/node-js-app:/app/logs" > ``` ## About Dokku phases @@ -22,7 +22,7 @@ Dokku deploys your application in multiple "phases" and the `docker-options` plu - `build`: the container that executes the appropriate buildpack - `deploy`: the container that executes your running/deployed application -- `run`: the container that executes any arbitrary command via `dokku run myapp` +- `run`: the container that executes any arbitrary command via `dokku run` ## Examples @@ -32,31 +32,63 @@ Add some options for the deployed/running app and when executing [`dokku run`](/ ```shell # Mount a host volume in a Docker container: "-v /host/path:/container/path" -dokku docker-options:add myapp deploy "-v /home/dokku/logs/myapp:/app/logs" -dokku docker-options:add myapp run "-v /home/dokku/logs/myapp:/app/logs" +dokku docker-options:add node-js-app deploy "-v /var/log/node-js-app:/app/logs" +dokku docker-options:add node-js-app run "-v /var/log/node-js-app:/app/logs" ``` > Note: When [mounting a host directory](https://docs.docker.com/engine/reference/run/#volume-shared-filesystems) in a Dokku app you should first create that directory as user `dokku` and then mount the directory under `/app` in the container using `docker-options` as above. Otherwise the app will lack write permission in the directory. -### Output Docker options - -```shell -dokku docker-options myapp -``` - -``` -Deploy options: - -v /home/dokku/logs/myapp:/app/logs -Run options: - -v /home/dokku/logs/myapp:/app/logs -``` - ### Remove a Docker option ```shell -dokku docker-options:remove myapp run "-v /home/dokku/logs/myapp:/app/logs" +dokku docker-options:remove node-js-app run "-v /var/log/node-js-app:/app/logs" ``` +### Displaying docker-options reports about an app + +> New as of 0.8.1 + +You can get a report about the app's docker-options status using the `docker-options:report` command: + +```shell +dokku docker-options:report +``` + +``` +=====> node-js-app docker options information + Docker options build: + Docker options deploy: -v /var/log/node-js-app:/app/logs + Docker options run: -v /var/log/node-js-app:/app/logs +=====> python-sample docker options information + Docker options build: + Docker options deploy: + Docker options run: +=====> ruby-sample docker options information + Docker options build: + Docker options deploy: + Docker options run: +``` + +You can run the command for a specific app also. + +```shell +dokku docker-options:report node-js-app +``` + +``` +=====> node-js-app docker options information + Storage build mounts: + Storage deploy mounts: -v /var/log/node-js-app:/app/logs + Storage run mounts: -v /var/log/node-js-app:/app/logs +``` + +You can pass flags which will output only the value of the specific information you want. For example: + +```shell +dokku docker-options:report node-js-app --docker-options-build +``` + + ## Advanced usage In your applications folder `/home/dokku/app_name` create a file called `DOCKER_OPTIONS_RUN` (or `DOCKER_OPTIONS_BUILD` or `DOCKER_OPTIONS_DEPLOY`). diff --git a/plugins/docker-options/commands b/plugins/docker-options/commands index f3fd00ccc..da85da9c8 100755 --- a/plugins/docker-options/commands +++ b/plugins/docker-options/commands @@ -7,9 +7,10 @@ case "$1" in help_content_func () { declare desc="return docker-options plugin help content" cat< [phase(s)], Display app's Docker options for all phases (or comma separated phase list) + docker-options [phase(s)], [DEPRECATED] Alternative for docker-options:report docker-options:add OPTION, Add Docker option to app for phase (comma separated phase list) docker-options:remove OPTION, Remove Docker option from app for phase (comma separated phase list) + docker-options:report [] [], Displays a docker options report for one or more apps help_content } diff --git a/plugins/docker-options/subcommands/report b/plugins/docker-options/subcommands/report new file mode 100755 index 000000000..8cd778fea --- /dev/null +++ b/plugins/docker-options/subcommands/report @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/docker-options/functions" + +fn-docker-options() { + declare APP="$1" PHASE="$2" + local PHASE_FILE="$(fn-get-phase-file-path "$APP" "$PHASE")" + if [[ -r "$PHASE_FILE" ]]; then + cat "$PHASE_FILE" | tr '\n' ' ' + fi +} + +docker_options_report_single_app() { + local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" + if [[ "$INFO_FLAG" == "true" ]]; then + INFO_FLAG="" + fi + verify_app_name "$APP" + local flag_map=( + "--docker-options-build: $(fn-docker-options "$APP" build)" + "--docker-options-deploy: $(fn-docker-options "$APP" deploy)" + "--docker-options-run: $(fn-docker-options "$APP" run)" + ) + + if [[ -z "$INFO_FLAG" ]]; then + dokku_log_info2 "$APP docker options information" + for flag in "${flag_map[@]}"; do + key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')" + dokku_log_verbose "$(printf "%-20s %-25s" "${key^}" "${flag#*: }")" + done + else + local match=false; local value_exists=false + for flag in "${flag_map[@]}"; do + valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)" + if [[ "$flag" == "${INFO_FLAG}:"* ]]; then + value=${flag#*: } + size="${#value}" + if [[ "$size" -ne 0 ]]; then + echo "$value" && match=true && value_exists=true + else + match=true + fi + fi + done + if [[ "$match" == "true" ]]; then + [[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed" + else + dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}" + fi + fi +} + +docker_options_report_cmd() { + declare desc="displays a docker options report for one or more apps" + local cmd="docker-options:report" + local INSTALLED_APPS=$(dokku_apps); local APP + + if [[ -z $2 ]]; then + for APP in $INSTALLED_APPS; do + docker_options_report_single_app "$APP" "true" + done + else + docker_options_report_single_app "$2" "$3" + fi +} + +docker_options_report_cmd "$@" From f5cce3c3a3ed30ca3e0b144bd2150adeee03a0ef Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 19:35:15 -0700 Subject: [PATCH 211/295] fix: pass shellcheck --- plugins/docker-options/subcommands/report | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/docker-options/subcommands/report b/plugins/docker-options/subcommands/report index 8cd778fea..cf81005eb 100755 --- a/plugins/docker-options/subcommands/report +++ b/plugins/docker-options/subcommands/report @@ -7,7 +7,7 @@ fn-docker-options() { declare APP="$1" PHASE="$2" local PHASE_FILE="$(fn-get-phase-file-path "$APP" "$PHASE")" if [[ -r "$PHASE_FILE" ]]; then - cat "$PHASE_FILE" | tr '\n' ' ' + tr '\n' ' ' < "$PHASE_FILE" fi } From d9ff7c218d125e27451271940d7028b7e1fef154 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 20 Feb 2017 21:34:59 -0700 Subject: [PATCH 212/295] Add deprecation notice --- plugins/docker-options/subcommands/default | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/docker-options/subcommands/default b/plugins/docker-options/subcommands/default index d499241f9..4cfaa6114 100755 --- a/plugins/docker-options/subcommands/default +++ b/plugins/docker-options/subcommands/default @@ -6,6 +6,7 @@ source "$PLUGIN_AVAILABLE_PATH/docker-options/functions" docker_options_main_cmd() { declare desc="Display applications docker options" local cmd="docker-options" + dokku_log_warn "Deprecated: Please use docker-options:report" verify_app_name "$2" && local APP="$2" read -ra passed_phases <<< "$(get_phases "$3")" From 367f6bd5e8d74a3740bfdcc2bc99ae55f92792d1 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 23 Feb 2017 19:40:36 -0700 Subject: [PATCH 213/295] fix: add missing source calls --- plugins/plugin/subcommands/default | 2 +- plugins/plugin/subcommands/list | 2 +- plugins/storage/functions | 2 +- plugins/storage/internal-functions | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/plugin/subcommands/default b/plugins/plugin/subcommands/default index 4f1c92e87..8fdd2eaa3 100755 --- a/plugins/plugin/subcommands/default +++ b/plugins/plugin/subcommands/default @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/plugin/internal-functions" +source "$PLUGIN_AVAILABLE_PATH/plugin/internal-functions" dokku_log_warn "Deprecated: Please use plugin:list" plugin_list_cmd "$@" diff --git a/plugins/plugin/subcommands/list b/plugins/plugin/subcommands/list index ef8a23bfb..bb5e4744d 100755 --- a/plugins/plugin/subcommands/list +++ b/plugins/plugin/subcommands/list @@ -1,5 +1,5 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_CORE_AVAILABLE_PATH/plugin/internal-functions" +source "$PLUGIN_AVAILABLE_PATH/plugin/internal-functions" plugin_list_cmd "$@" diff --git a/plugins/storage/functions b/plugins/storage/functions index d7fd8f4cf..643fa906c 100755 --- a/plugins/storage/functions +++ b/plugins/storage/functions @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" +source "$PLUGIN_AVAILABLE_PATH/docker-options/functions" verify_paths() { declare desc="verifies storage paths" diff --git a/plugins/storage/internal-functions b/plugins/storage/internal-functions index 0c9bf0a64..6224e4966 100755 --- a/plugins/storage/internal-functions +++ b/plugins/storage/internal-functions @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions" +source "$PLUGIN_AVAILABLE_PATH/docker-options/functions" +source "$PLUGIN_AVAILABLE_PATH/storage/functions" storage_help_content_func() { declare desc="return storage plugin help content" From 9aaf289fb866a033ee2481403952375bafb05c24 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 24 Feb 2017 09:59:31 -0700 Subject: [PATCH 214/295] fix: use correct variable --- plugins/docker-options/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/docker-options/functions b/plugins/docker-options/functions index 3769245e8..fe95dbf0c 100755 --- a/plugins/docker-options/functions +++ b/plugins/docker-options/functions @@ -16,7 +16,7 @@ get_phase_file_path() { local phase_file_prefix="DOCKER_OPTIONS_" local phase=$1 [[ "$APP" && "$phase" ]] || dokku_log_fail "Error: phase_file_path is incomplete." - fn-get-phase-file-path "$APP" "$PHASE" + fn-get-phase-file-path "$APP" "$phase" } get_phases() { From 6ae948523b4a6c91badf9b81adc0b0494d8855b5 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 12 Mar 2017 22:02:48 -0600 Subject: [PATCH 215/295] fix: redirect error output to /dev/null The docker-options command is deprecated, so the warning was being captured. --- tests/unit/20_docker-options.bats | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/20_docker-options.bats b/tests/unit/20_docker-options.bats index 7c9432f68..fe0db6685 100644 --- a/tests/unit/20_docker-options.bats +++ b/tests/unit/20_docker-options.bats @@ -69,7 +69,7 @@ teardown() { echo "output: "$output echo "status: "$status assert_success - run /bin/bash -c "dokku docker-options $TEST_APP | xargs" + run /bin/bash -c "dokku docker-options $TEST_APP 2> /dev/null | xargs" echo "output: "$output echo "status: "$status assert_output "Deploy options: --restart=on-failure:10" @@ -88,7 +88,7 @@ teardown() { echo "output: "$output echo "status: "$status assert_success - run /bin/bash -c "dokku docker-options $TEST_APP build" + run /bin/bash -c "dokku docker-options $TEST_APP build 2> /dev/null" echo "output: "$output echo "status: "$status assert_output "Build options: none" @@ -107,7 +107,7 @@ teardown() { echo "output: "$output echo "status: "$status assert_success - run /bin/bash -c "dokku docker-options $TEST_APP deploy | xargs" + run /bin/bash -c "dokku docker-options $TEST_APP deploy 2> /dev/null | xargs" echo "output: "$output echo "status: "$status assert_output "Deploy options: --restart=on-failure:10" @@ -126,7 +126,7 @@ teardown() { echo "output: "$output echo "status: "$status assert_success - run /bin/bash -c "dokku docker-options $TEST_APP run" + run /bin/bash -c "dokku docker-options $TEST_APP run 2> /dev/null" echo "output: "$output echo "status: "$status assert_output "Run options: none" From 06d2ffaa141fc8b9f8a34fb4fdac2c50c7e1e14e Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 13 Mar 2017 00:16:32 -0600 Subject: [PATCH 216/295] feat: redirect warnings to stderr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Having warnings on stdout doesn’t convey to a user that it is a warning. --- plugins/common/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/common/functions b/plugins/common/functions index 86278277f..e2843bf69 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -102,7 +102,7 @@ dokku_log_verbose() { dokku_log_warn() { declare desc="log warning formatter" - echo " ! $*" + echo " ! $*" 1>&2 } dokku_log_fail() { From 0d1c8deb57e2521a716f7b880657f7d8a19c0ea2 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 13 Mar 2017 02:00:24 -0600 Subject: [PATCH 217/295] fix: redirect error output to /dev/null The checks command is deprecated, so the warning was being captured. --- tests/unit/10_checks.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/10_checks.bats b/tests/unit/10_checks.bats index c0a8fafc5..085c190d0 100644 --- a/tests/unit/10_checks.bats +++ b/tests/unit/10_checks.bats @@ -17,7 +17,7 @@ teardown() { } @test "(checks) checks" { - run bash -c "dokku checks $TEST_APP| grep $TEST_APP | xargs" + run bash -c "dokku checks $TEST_APP 2> /dev/null | grep $TEST_APP | xargs" echo "output: "$output echo "status: "$status assert_output "$TEST_APP none none" From 91aa5255ec1a51d5d5fc75649cf47a523c087de9 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 15 Mar 2017 02:55:09 -0600 Subject: [PATCH 218/295] fix: ensure we redirect stderr to stdout for test --- tests/unit/40_core_2.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/40_core_2.bats b/tests/unit/40_core_2.bats index 03bbee8ec..561901491 100644 --- a/tests/unit/40_core_2.bats +++ b/tests/unit/40_core_2.bats @@ -41,7 +41,7 @@ build_nginx_config() { echo "output: "$output echo "status: "$status assert_failure - run /bin/bash -c "dokku fakecommand | grep -q 'is not a dokku command'" + run /bin/bash -c "dokku fakecommand 2>&1 | grep -q 'is not a dokku command'" echo "output: "$output echo "status: "$status assert_success From 0215e3ec91d446f8d81cfafa4cc14fe63ae8f0e7 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 15 Mar 2017 03:17:31 -0600 Subject: [PATCH 219/295] fix: redirect domains:default stderr to /dev/null in tests --- tests/unit/test_helper.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index b59841339..2614c284d 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -180,7 +180,7 @@ assert_nonssl_domain() { assert_app_domain() { local domain=$1 - run /bin/bash -c "dokku domains $TEST_APP | grep -xF ${domain}" + run /bin/bash -c "dokku domains $TEST_APP 2> /dev/null | grep -xF ${domain}" echo "output: $output" echo "status: $status" assert_output "${domain}" From 7ba063c6bb28310d3faf15d19ba7774b06b311de Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Wed, 15 Mar 2017 14:52:29 +0200 Subject: [PATCH 220/295] Enable nginx and docker on system startup when using bootstrap.sh on CentOS --- bootstrap.sh | 4 ++++ docs/getting-started/install/rpm.md | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index b787f47d0..087a4d424 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -167,6 +167,10 @@ install-dokku-from-rpm-package() { yum -y install herokuish dokku fi + echo "--> Enabling docker and nginx on system startup" + systemctl enable docker + systemctl enable nginx + echo "--> Starting nginx" systemctl start nginx } diff --git a/docs/getting-started/install/rpm.md b/docs/getting-started/install/rpm.md index f51e9283f..8087c6b26 100644 --- a/docs/getting-started/install/rpm.md +++ b/docs/getting-started/install/rpm.md @@ -7,16 +7,21 @@ Dokku defaults to being installed via RPM package on CentOS 7. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of Dokku without the use of our `bootstrap.sh` bash script. The following are the steps run by said script: ```shell -# install docker +# Install docker curl -fsSL https://get.docker.com/ | sh -# install epel for nginx packages to be available +# Install epel for nginx packages to be available sudo yum install -y epel-release -# install dokku +# Install dokku curl -s https://packagecloud.io/install/repositories/dokku/dokku/script.rpm.sh | sudo bash sudo yum install -y herokuish dokku sudo dokku plugin:install-dependencies --core +systemctl start nginx + +# Enable docker and nginx on system startup +systemctl enable docker +systemctl enable nginx ``` The [devicemapper](https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/) is the default Docker storage driver on CentOS 7 and defaults to a configuration mode known as `loop-lvm`. This mode is designed to work out-of-the-box with no additional configuration. However, production deployments should not run under `loop-lvm` mode. The preferred configuration for production deployments is [`direct-lvm`](https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/#/configure-direct-lvm-mode-for-production). From 01b30e083f75bd047710a6e6200a5141023b86d9 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 15 Mar 2017 09:29:47 -0600 Subject: [PATCH 221/295] fix: redirect stderr to /dev/null in tests --- tests/unit/20_domains.bats | 28 ++++++++++++++-------------- tests/unit/40_proxy.bats | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/unit/20_domains.bats b/tests/unit/20_domains.bats index dbbafae4e..9ec3f345a 100644 --- a/tests/unit/20_domains.bats +++ b/tests/unit/20_domains.bats @@ -18,7 +18,7 @@ teardown() { @test "(domains) domains" { dokku domains:setup $TEST_APP - run bash -c "dokku domains $TEST_APP | grep ${TEST_APP}.dokku.me" + run bash -c "dokku domains $TEST_APP 2> /dev/null | grep ${TEST_APP}.dokku.me" echo "output: "$output echo "status: "$status assert_output "${TEST_APP}.dokku.me" @@ -45,7 +45,7 @@ teardown() { echo "status: "$status assert_success - run dokku domains $TEST_APP + run dokku domains $TEST_APP 2> /dev/null echo "output: "$output echo "status: "$status assert_success @@ -61,7 +61,7 @@ teardown() { echo "status: "$status assert_success - run dokku domains $TEST_APP + run dokku domains $TEST_APP 2> /dev/null echo "output: "$output echo "status: "$status assert_success @@ -101,7 +101,7 @@ teardown() { echo "status: "$status assert_success - run dokku domains $TEST_APP + run dokku domains $TEST_APP 2> /dev/null echo "output: "$output echo "status: "$status assert_success @@ -119,7 +119,7 @@ teardown() { echo "status: "$status assert_success - run dokku domains $TEST_APP + run dokku domains $TEST_APP 2> /dev/null echo "output: "$output echo "status: "$status assert_success @@ -139,7 +139,7 @@ teardown() { echo "status: "$status assert_success - run dokku domains $TEST_APP + run dokku domains $TEST_APP 2> /dev/null echo "output: "$output echo "status: "$status assert_success @@ -157,7 +157,7 @@ teardown() { echo "status: "$status assert_success - run dokku domains $TEST_APP + run dokku domains $TEST_APP 2> /dev/null echo "output: "$output echo "status: "$status assert_success @@ -178,7 +178,7 @@ teardown() { echo "status: "$status assert_success - run dokku domains $TEST_APP + run dokku domains $TEST_APP 2> /dev/null echo "output: "$output echo "status: "$status assert_success @@ -191,7 +191,7 @@ teardown() { echo "status: "$status assert_success - run bash -c "dokku domains | egrep -qw '^global.dokku.me\$'" + run bash -c "dokku domains 2> /dev/null | egrep -qw '^global.dokku.me\$'" echo "output: "$output echo "status: "$status assert_success @@ -203,17 +203,17 @@ teardown() { echo "status: "$status assert_success - run bash -c "dokku domains | grep -q global1.dokku.me" + run bash -c "dokku domains 2> /dev/null | grep -q global1.dokku.me" echo "output: "$output echo "status: "$status assert_success - run bash -c "dokku domains | grep -q global2.dokku.me" + run bash -c "dokku domains 2> /dev/null | grep -q global2.dokku.me" echo "output: "$output echo "status: "$status assert_success - run bash -c "dokku domains | grep -q global3.dokku.me" + run bash -c "dokku domains 2> /dev/null | grep -q global3.dokku.me" echo "output: "$output echo "status: "$status assert_success @@ -239,7 +239,7 @@ teardown() { dokku domains:setup $TEST_APP - run dokku domains $TEST_APP + run dokku domains $TEST_APP 2> /dev/null echo "output: "$output echo "status: "$status assert_success @@ -260,7 +260,7 @@ teardown() { dokku domains:setup $TEST_APP - run dokku domains $TEST_APP + run dokku domains $TEST_APP 2> /dev/null echo "output: "$output echo "status: "$status assert_success diff --git a/tests/unit/40_proxy.bats b/tests/unit/40_proxy.bats index 329da8f33..60ea5037f 100644 --- a/tests/unit/40_proxy.bats +++ b/tests/unit/40_proxy.bats @@ -24,7 +24,7 @@ assert_nonssl_domain() { assert_app_domain() { local domain=$1 - run /bin/bash -c "dokku domains $TEST_APP | grep -xF ${domain}" + run /bin/bash -c "dokku domains $TEST_APP 2> /dev/null | grep -xF ${domain}" echo "output: "$output echo "status: "$status assert_output "${domain}" From 97e35e796c5af09f1cc2633f564dbe0802328dd8 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 16 Mar 2017 02:33:51 -0600 Subject: [PATCH 222/295] fix: ensure we can call the report subcommand without an app while specifying flags Closes #2628 --- plugins/apps/subcommands/report | 22 ++++++++++++++------ plugins/certs/subcommands/report | 25 ++++++++++++++++------- plugins/checks/subcommands/report | 25 ++++++++++++++++------- plugins/docker-options/subcommands/report | 25 ++++++++++++++++------- plugins/domains/subcommands/report | 25 ++++++++++++++++------- plugins/proxy/subcommands/report | 25 ++++++++++++++++------- plugins/ps/subcommands/report | 25 ++++++++++++++++------- plugins/storage/subcommands/report | 25 ++++++++++++++++------- 8 files changed, 142 insertions(+), 55 deletions(-) diff --git a/plugins/apps/subcommands/report b/plugins/apps/subcommands/report index e9680cd16..10e48e54c 100755 --- a/plugins/apps/subcommands/report +++ b/plugins/apps/subcommands/report @@ -4,7 +4,8 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/apps/functions" report_single_app() { - local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" + declare APP="$1" INFO_FLAG="$2" + local APP_DIR="$DOKKU_ROOT/$APP" local use_echo; if [[ "$INFO_FLAG" == "true" ]]; then use_echo=true @@ -68,14 +69,23 @@ apps_report_cmd() { declare desc="displays the app report for one or more apps" local cmd="apps:report" local INSTALLED_APPS=$(dokku_apps) - local APP + local APP="$2" INFO_FLAG="$3" - if [[ -z $2 ]]; then - for APP in $INSTALLED_APPS; do - report_single_app "$APP" "true" + if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then + INFO_FLAG="$APP" + APP="" + fi + + if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then + INFO_FLAG="true" + fi + + if [[ -z "$APP" ]]; then + for app in $INSTALLED_APPS; do + report_single_app "$app" "$INFO_FLAG" | tee || true done else - report_single_app "$2" "$3" + report_single_app "$APP" "$INFO_FLAG" fi } diff --git a/plugins/certs/subcommands/report b/plugins/certs/subcommands/report index 43aa31648..9d8c7d976 100755 --- a/plugins/certs/subcommands/report +++ b/plugins/certs/subcommands/report @@ -74,8 +74,9 @@ fn-ssl-verified() { echo "$SSL_SELF_SIGNED" } -certs_report_single_app() { - local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" +report_single_app() { + declare APP="$1" INFO_FLAG="$2" + local APP_DIR="$DOKKU_ROOT/$APP" if [[ "$INFO_FLAG" == "true" ]]; then INFO_FLAG="" fi @@ -122,14 +123,24 @@ certs_report_single_app() { certs_report_cmd() { declare desc="displays an ssl report for one or more apps" local cmd="certs:report" - local INSTALLED_APPS=$(dokku_apps); local APP + local INSTALLED_APPS=$(dokku_apps) + local APP="$2" INFO_FLAG="$3" - if [[ -z $2 ]]; then - for APP in $INSTALLED_APPS; do - certs_report_single_app "$APP" "true" + if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then + INFO_FLAG="$APP" + APP="" + fi + + if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then + INFO_FLAG="true" + fi + + if [[ -z "$APP" ]]; then + for app in $INSTALLED_APPS; do + report_single_app "$app" "$INFO_FLAG" | tee || true done else - certs_report_single_app "$2" "$3" + report_single_app "$APP" "$INFO_FLAG" fi } diff --git a/plugins/checks/subcommands/report b/plugins/checks/subcommands/report index e0caf4cdd..6c6a4fc02 100755 --- a/plugins/checks/subcommands/report +++ b/plugins/checks/subcommands/report @@ -19,8 +19,9 @@ fn-checks-skipped-list() { echo "$DOKKU_CHECKS_SKIPPED" } -checks_report_single_app() { - local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" +report_single_app() { + declare APP="$1" INFO_FLAG="$2" + local APP_DIR="$DOKKU_ROOT/$APP" if [[ "$INFO_FLAG" == "true" ]]; then INFO_FLAG="" fi @@ -61,14 +62,24 @@ checks_report_single_app() { checks_report_cmd() { declare desc="shows reports for an app" local cmd="checks:report" - local INSTALLED_APPS=$(dokku_apps); local APP + local INSTALLED_APPS=$(dokku_apps) + local APP="$2" INFO_FLAG="$3" - if [[ -z $2 ]]; then - for APP in $INSTALLED_APPS; do - checks_report_single_app "$APP" "true" + if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then + INFO_FLAG="$APP" + APP="" + fi + + if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then + INFO_FLAG="true" + fi + + if [[ -z "$APP" ]]; then + for app in $INSTALLED_APPS; do + report_single_app "$app" "$INFO_FLAG" | tee || true done else - checks_report_single_app "$2" "$3" + report_single_app "$APP" "$INFO_FLAG" fi } diff --git a/plugins/docker-options/subcommands/report b/plugins/docker-options/subcommands/report index cf81005eb..e13618364 100755 --- a/plugins/docker-options/subcommands/report +++ b/plugins/docker-options/subcommands/report @@ -11,8 +11,9 @@ fn-docker-options() { fi } -docker_options_report_single_app() { - local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" +report_single_app() { + declare APP="$1" INFO_FLAG="$2" + local APP_DIR="$DOKKU_ROOT/$APP" if [[ "$INFO_FLAG" == "true" ]]; then INFO_FLAG="" fi @@ -54,14 +55,24 @@ docker_options_report_single_app() { docker_options_report_cmd() { declare desc="displays a docker options report for one or more apps" local cmd="docker-options:report" - local INSTALLED_APPS=$(dokku_apps); local APP + local INSTALLED_APPS=$(dokku_apps) + local APP="$2" INFO_FLAG="$3" - if [[ -z $2 ]]; then - for APP in $INSTALLED_APPS; do - docker_options_report_single_app "$APP" "true" + if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then + INFO_FLAG="$APP" + APP="" + fi + + if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then + INFO_FLAG="true" + fi + + if [[ -z "$APP" ]]; then + for app in $INSTALLED_APPS; do + report_single_app "$app" "$INFO_FLAG" | tee || true done else - docker_options_report_single_app "$2" "$3" + report_single_app "$APP" "$INFO_FLAG" fi } diff --git a/plugins/domains/subcommands/report b/plugins/domains/subcommands/report index ce7f3078a..2d43a44dd 100755 --- a/plugins/domains/subcommands/report +++ b/plugins/domains/subcommands/report @@ -34,8 +34,9 @@ fn-domains-global-vhosts() { fi } -domains_report_single_app() { - local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" +report_single_app() { + declare APP="$1" INFO_FLAG="$2" + local APP_DIR="$DOKKU_ROOT/$APP" if [[ "$INFO_FLAG" == "true" ]]; then INFO_FLAG="" fi @@ -78,14 +79,24 @@ domains_report_single_app() { domains_report_cmd() { declare desc="displays a domains report for one or more apps" local cmd="domains:report" - local INSTALLED_APPS=$(dokku_apps); local APP + local INSTALLED_APPS=$(dokku_apps) + local APP="$2" INFO_FLAG="$3" - if [[ -z $2 ]]; then - for APP in $INSTALLED_APPS; do - domains_report_single_app "$APP" "true" + if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then + INFO_FLAG="$APP" + APP="" + fi + + if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then + INFO_FLAG="true" + fi + + if [[ -z "$APP" ]]; then + for app in $INSTALLED_APPS; do + report_single_app "$app" "$INFO_FLAG" | tee || true done else - domains_report_single_app "$2" "$3" + report_single_app "$APP" "$INFO_FLAG" fi } diff --git a/plugins/proxy/subcommands/report b/plugins/proxy/subcommands/report index 260483417..7247cd9cc 100755 --- a/plugins/proxy/subcommands/report +++ b/plugins/proxy/subcommands/report @@ -13,8 +13,9 @@ fn-proxy-enabled() { echo "$PROXY_ENABLED" } -proxy_report_single_app() { - local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" +report_single_app() { + declare APP="$1" INFO_FLAG="$2" + local APP_DIR="$DOKKU_ROOT/$APP" if [[ "$INFO_FLAG" == "true" ]]; then INFO_FLAG="" fi @@ -56,14 +57,24 @@ proxy_report_single_app() { proxy_report_cmd() { declare desc="displays a proxy report for one or more apps" local cmd="proxy:report" - local INSTALLED_APPS=$(dokku_apps); local APP + local INSTALLED_APPS=$(dokku_apps) + local APP="$2" INFO_FLAG="$3" - if [[ -z $2 ]]; then - for APP in $INSTALLED_APPS; do - proxy_report_single_app "$APP" "true" + if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then + INFO_FLAG="$APP" + APP="" + fi + + if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then + INFO_FLAG="true" + fi + + if [[ -z "$APP" ]]; then + for app in $INSTALLED_APPS; do + report_single_app "$app" "$INFO_FLAG" | tee || true done else - proxy_report_single_app "$2" "$3" + report_single_app "$APP" "$INFO_FLAG" fi } diff --git a/plugins/ps/subcommands/report b/plugins/ps/subcommands/report index e637ceab2..77f952e6e 100755 --- a/plugins/ps/subcommands/report +++ b/plugins/ps/subcommands/report @@ -4,8 +4,9 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_AVAILABLE_PATH/docker-options/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" -ps_report_single_app() { - local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" +report_single_app() { + declare APP="$1" INFO_FLAG="$2" + local APP_DIR="$DOKKU_ROOT/$APP" local passed_phases="deploy" local APP_CIDS=$(get_app_container_ids "$APP"); local PROCS=0; local RUNNING="" @@ -90,14 +91,24 @@ ps_report_single_app() { ps_report_cmd() { declare desc="shows reports for an app" local cmd="ps:report" - local INSTALLED_APPS=$(dokku_apps); local APP + local INSTALLED_APPS=$(dokku_apps) + local APP="$2" INFO_FLAG="$3" - if [[ -z $2 ]]; then - for APP in $INSTALLED_APPS; do - ps_report_single_app "$APP" + if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then + INFO_FLAG="$APP" + APP="" + fi + + if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then + INFO_FLAG="true" + fi + + if [[ -z "$APP" ]]; then + for app in $INSTALLED_APPS; do + report_single_app "$app" "$INFO_FLAG" | tee || true done else - ps_report_single_app "$2" "$3" + report_single_app "$APP" "$INFO_FLAG" fi } diff --git a/plugins/storage/subcommands/report b/plugins/storage/subcommands/report index cc8e0fa60..482e01600 100755 --- a/plugins/storage/subcommands/report +++ b/plugins/storage/subcommands/report @@ -11,8 +11,9 @@ fn-storage-bind-mounts() { fi } -storage_report_single_app() { - local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2" +report_single_app() { + declare APP="$1" INFO_FLAG="$2" + local APP_DIR="$DOKKU_ROOT/$APP" if [[ "$INFO_FLAG" == "true" ]]; then INFO_FLAG="" fi @@ -54,14 +55,24 @@ storage_report_single_app() { storage_report_cmd() { declare desc="displays a storage report for one or more apps" local cmd="storage:report" - local INSTALLED_APPS=$(dokku_apps); local APP + local INSTALLED_APPS=$(dokku_apps) + local APP="$2" INFO_FLAG="$3" - if [[ -z $2 ]]; then - for APP in $INSTALLED_APPS; do - storage_report_single_app "$APP" "true" + if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then + INFO_FLAG="$APP" + APP="" + fi + + if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then + INFO_FLAG="true" + fi + + if [[ -z "$APP" ]]; then + for app in $INSTALLED_APPS; do + report_single_app "$app" "$INFO_FLAG" | tee || true done else - storage_report_single_app "$2" "$3" + report_single_app "$APP" "$INFO_FLAG" fi } From dace6873dfa42fdec50669cbe991871c4e69671a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 16 Mar 2017 04:25:18 -0600 Subject: [PATCH 223/295] Add post-extract plugin trigger This trigger allows you to modify the contents of an application *after* it has been extracted from git/tarball but *before* the image source type is detected. For example, you may wish to autogenerate a Dockerfile based on some other application contents before detecting what type of build process - herokuish or docker file - to use. --- docs/development/plugin-triggers.md | 22 ++++++++++++++++++++++ plugins/git/functions | 2 ++ plugins/tar/functions | 2 ++ 3 files changed, 26 insertions(+) diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index d1431a5d4..fac754c17 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -481,6 +481,28 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x sudo service haproxy reload ``` +### `post-extract` + +- Description: Allows you to modify the contents of an application *after* it has been extracted from git/tarball but *before* the image source type is detected. +- Invoked by: `dokku tar:in`, `dokku tar:from` and the `receive-app` plugin trigger +- Arguments: `$APP` `$TMP_WORK_DIR` `$REV` +- Example: + +```shell +#!/usr/bin/env bash +# Adds a clock process to an app's Procfile + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +APP="$1"; verify_app_name "$APP" +TMP_WORK_DIR="$2" +REV="$3" # optional, may not be sent for tar-based builds + +pushd "$TMP_WORK_DIR" > /dev/null +touch Procfile +echo "clock: some-command" >> Procfile +``` + ### `post-proxy-ports-update` - Description: Allows you to run commands once the proxy port mappings for an application have been updated. It also sends the invoking command. This can be "add", "clear" or "remove". diff --git a/plugins/git/functions b/plugins/git/functions index 5e0da3726..4c6a4a62c 100755 --- a/plugins/git/functions +++ b/plugins/git/functions @@ -32,6 +32,8 @@ git_build_app_repo() { GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true find -name .git -prune -exec rm -rf {} \; > /dev/null + plugn trigger post-extract "$APP" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" "$REV" + if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]] && [[ -z $(config_get "$APP" BUILDPACK_URL || true) ]]; then plugn trigger pre-receive-app "$APP" "dockerfile" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" "$REV" dokku_receive "$APP" "dockerfile" "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/" diff --git a/plugins/tar/functions b/plugins/tar/functions index a9c8aa049..f90d879f5 100755 --- a/plugins/tar/functions +++ b/plugins/tar/functions @@ -24,6 +24,8 @@ tar_build() { tar -x -C "$TAR_BUILD_TMP_WORK_DIR" -f "$DOKKU_ROOT/$APP/src.tar" --strip-components="$BOGUS_PARTS" chmod -R u+r "$TAR_BUILD_TMP_WORK_DIR" + plugn trigger post-extract "$APP" "$TAR_BUILD_TMP_WORK_DIR" + if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]] && [[ -z $(config_get "$APP" BUILDPACK_URL || true) ]]; then plugn trigger pre-receive-app "$APP" "dockerfile" "$TAR_BUILD_TMP_WORK_DIR" dokku_receive "$APP" "dockerfile" "$TAR_BUILD_TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/" From ed6a4426c7d53a4ea0a3a03b6a868a7fed119be1 Mon Sep 17 00:00:00 2001 From: Jeff Fein-Worton Date: Fri, 17 Mar 2017 16:32:33 -0700 Subject: [PATCH 224/295] Minor clarifications --- docs/deployment/application-deployment.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/deployment/application-deployment.md b/docs/deployment/application-deployment.md index faeb06e54..203ad70ba 100644 --- a/docs/deployment/application-deployment.md +++ b/docs/deployment/application-deployment.md @@ -6,6 +6,7 @@ Once Dokku has been configured with at least one user, applications can be deplo ```shell # from your local machine +# SSH access to github must be enabled on this host git clone git@github.com:heroku/ruby-rails-sample.git ``` @@ -53,6 +54,7 @@ Now you can deploy the `ruby-rails-sample` app to your Dokku server. All you hav ```shell # from your local machine # the remote username *must* be dokku or pushes will fail +cd ruby-rails-sample git remote add dokku dokku@dokku.me:ruby-rails-sample git push dokku master ``` From 3c1fc4a7df6c1cf8acbd0fee81b616ed3e57c0fe Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 19 Mar 2017 14:06:32 -0600 Subject: [PATCH 225/295] Release 0.8.1 --- HISTORY.md | 60 ++++++++++++++++++++++++ README.md | 4 +- contrib/dokku-installer.py | 2 +- debian/control | 2 +- docs/advanced-usage/plugin-management.md | 48 +++++++++---------- docs/assets/favicons/browserconfig.xml | 8 ++-- docs/assets/favicons/manifest.json | 12 ++--- docs/assets/style.css | 4 +- docs/assets/versions.json | 2 +- docs/development/release-process.md | 2 +- docs/getting-started/installation.md | 4 +- docs/home.html | 40 ++++++++-------- docs/template.html | 36 +++++++------- plugins/00_dokku-standard/plugin.toml | 2 +- plugins/20_events/plugin.toml | 2 +- plugins/apps/plugin.toml | 2 +- plugins/build-env/plugin.toml | 2 +- plugins/certs/plugin.toml | 2 +- plugins/checks/plugin.toml | 2 +- plugins/common/plugin.toml | 2 +- plugins/config/plugin.toml | 2 +- plugins/docker-options/plugin.toml | 2 +- plugins/domains/plugin.toml | 2 +- plugins/enter/plugin.toml | 2 +- plugins/git/plugin.toml | 2 +- plugins/logs/plugin.toml | 2 +- plugins/named-containers/plugin.toml | 2 +- plugins/nginx-vhosts/plugin.toml | 2 +- plugins/plugin/plugin.toml | 2 +- plugins/proxy/plugin.toml | 2 +- plugins/ps/plugin.toml | 2 +- plugins/repo/plugin.toml | 2 +- plugins/shell/plugin.toml | 2 +- plugins/ssh-keys/plugin.toml | 2 +- plugins/storage/plugin.toml | 2 +- plugins/tags/plugin.toml | 2 +- plugins/tar/plugin.toml | 2 +- 37 files changed, 166 insertions(+), 106 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index e49a57fe3..b1df76704 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,65 @@ # History +## 0.8.1 + +### Bug Fixes + +- #2519: @tkalus Further guard against duplicate ssl server names +- #2554: @josegonzalez Add ssl ports when generating a self-signed certificate +- #2555: @josegonzalez Skip failing applications when running ps:restore on boot +- #2576: @znz Remove unused variable +- #2592: @josegonzalez always set a default ssl port for apps with ssl enabled +- #2612: @josegonzalez Ensure VHOST files exist before executing commands against them +- #2647: @josegonzalez Properly escape post-install variables +- #2650: @josegonzalez Fix help output for nginx and ssh-keys +- #2656: @josegonzalez ensure we can call the report subcommand without an app while specifying flags +- d79a79: @josegonzalez bail early when checking ps output for an undeployed app + +### New Features + +- #2500: @josegonzalez Suppress output unless the `git submodule update` call fails +- #2504: @mbtamuli Implement apps:report and storage:report +- #2508: @OmarShehata Add default functions for all commands +- #2557: @josegonzalez Dokku cli improvements +- #2573: @ebeigarts Recommend parallel package for faster ps:restore +- #2578: @josegonzalez Require specific versions for dokku-maintained packages +- #2583: @josegonzalez Implement apps:clone subcommand +- #2586: @bevand10 Add http-proxy support for deb-herokuish installs +- #2587: @josegonzalez Allow specifying the deploy branch via DOKKU_DEPLOY_BRANCH +- #2594: @michaelshobbs Upgrade to herokuish v0.3.25 +- #2615: @josegonzalez Implement certs:report +- #2616: @josegonzalez Replace apps:default subcommand with apps:list +- #2617: @josegonzalez Implement checks:report +- #2618: @josegonzalez Implement docker-options:report and storage:report +- #2619: @josegonzalez Call ssh-keys:help from ssh-keys:default +- #2620: @josegonzalez Implement domains:report and proxy:report +- #2622: @raphaklaus Allow file names with multiple dots in certs:add command +- #2634: @michaelshobbs Update herokuish to 0.3.26 +- #2657: @josegonzalez Add post-extract plugin trigger + +### Documentation + +- #2475: @pranavgoel25 Minor readme and sponsor changes +- #2556: @josegonzalez Use slightly better font style for docs +- #2560: @ebeigarts Improve install documentation on CentOS +- #2564: @ka7 Fix spelling mistakes +- #2565: @josegonzalez Update persistent storage to reference the sample app as normal +- #2566: @josegonzalez Move "new as of" note in storage docs to correct section +- #2569: @OmgImAlexis Reload nginx after adding default vhost file +- #2570: @OmgImAlexis Update ISSUE_TEMPLATE.md to reference `dokku report` command +- #2580: @znz Fix font URL +- #2588: @josegonzalez Clarify when the `~/.ssh/config` settings need to match `vagrant ssh-config output` +- #2605: @andyjeffries Documented build failures when using SSL_CERT_FILE environment variable +- #2613: @emveeoh Update Linode installation instructions for new GRUB 2 Linode boot option +- #2626: @znz Update apps:help example command +- #2629: @znz Update certs:help output for certs:default subcommand +- #2633: @drpoggi Reference the x-forwarded headers in correct order +- #2637: @josegonzalez Add documentation surrounding flags that ps:report accepts +- #2638: @fwolfst Improve README links +- #2639: @joshco Add documentation for how to grant other Unix accounts Dokku access +- #2648: @josegonzalez Note that the remote username is important +- #2659: @jfw Minor clarifications to application deployment tutorial + ## 0.8.0 The big kahuna. Lots of documentation changes, and a few bug fixes to make Dokku development a bit easier. diff --git a/README.md b/README.md index 703cb2ef2..ccd4939c3 100644 --- a/README.md +++ b/README.md @@ -99,8 +99,8 @@ A fresh VM running any of the following operating systems: To install the latest stable release, run the following commands as a user who has access to `sudo`: ```shell -wget https://raw.githubusercontent.com/dokku/dokku/v0.8.0/bootstrap.sh -sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh +wget https://raw.githubusercontent.com/dokku/dokku/v0.8.1/bootstrap.sh +sudo DOKKU_TAG=v0.8.1 bash bootstrap.sh ``` You can then proceed to the ip address or domain name associated with your server to complete the web-based installation. diff --git a/contrib/dokku-installer.py b/contrib/dokku-installer.py index 67380722f..8146bcd24 100755 --- a/contrib/dokku-installer.py +++ b/contrib/dokku-installer.py @@ -10,7 +10,7 @@ import subprocess import sys import threading -VERSION = 'v0.8.0' +VERSION = 'v0.8.1' hostname = '' try: diff --git a/debian/control b/debian/control index 75d42b2aa..225607c8c 100644 --- a/debian/control +++ b/debian/control @@ -1,5 +1,5 @@ Package: dokku -Version: 0.8.0 +Version: 0.8.1 Section: web Priority: optional Architecture: amd64 diff --git a/docs/advanced-usage/plugin-management.md b/docs/advanced-usage/plugin-management.md index b61ce2543..190b0518d 100644 --- a/docs/advanced-usage/plugin-management.md +++ b/docs/advanced-usage/plugin-management.md @@ -31,30 +31,30 @@ dokku plugin ``` plugn: dev - 00_dokku-standard 0.8.0 enabled dokku core standard plugin - 20_events 0.8.0 enabled dokku core events logging plugin - apps 0.8.0 enabled dokku core apps plugin - build-env 0.8.0 enabled dokku core build-env plugin - certs 0.8.0 enabled dokku core certificate management plugin - checks 0.8.0 enabled dokku core checks plugin - common 0.8.0 enabled dokku core common plugin - config 0.8.0 enabled dokku core config plugin - docker-options 0.8.0 enabled dokku core docker-options plugin - domains 0.8.0 enabled dokku core domains plugin - enter 0.8.0 enabled dokku core enter plugin - git 0.8.0 enabled dokku core git plugin - logs 0.8.0 enabled dokku core logs plugin - named-containers 0.8.0 enabled dokku core named containers plugin - nginx-vhosts 0.8.0 enabled dokku core nginx-vhosts plugin - plugin 0.8.0 enabled dokku core plugin plugin - proxy 0.8.0 enabled dokku core proxy plugin - ps 0.8.0 enabled dokku core ps plugin - repo 0.8.0 enabled dokku core repo plugin - shell 0.8.0 enabled dokku core shell plugin - ssh-keys 0.8.0 enabled dokku core ssh-keys plugin - storage 0.8.0 enabled dokku core storage plugin - tags 0.8.0 enabled dokku core tags plugin - tar 0.8.0 enabled dokku core tar plugin + 00_dokku-standard 0.8.1 enabled dokku core standard plugin + 20_events 0.8.1 enabled dokku core events logging plugin + apps 0.8.1 enabled dokku core apps plugin + build-env 0.8.1 enabled dokku core build-env plugin + certs 0.8.1 enabled dokku core certificate management plugin + checks 0.8.1 enabled dokku core checks plugin + common 0.8.1 enabled dokku core common plugin + config 0.8.1 enabled dokku core config plugin + docker-options 0.8.1 enabled dokku core docker-options plugin + domains 0.8.1 enabled dokku core domains plugin + enter 0.8.1 enabled dokku core enter plugin + git 0.8.1 enabled dokku core git plugin + logs 0.8.1 enabled dokku core logs plugin + named-containers 0.8.1 enabled dokku core named containers plugin + nginx-vhosts 0.8.1 enabled dokku core nginx-vhosts plugin + plugin 0.8.1 enabled dokku core plugin plugin + proxy 0.8.1 enabled dokku core proxy plugin + ps 0.8.1 enabled dokku core ps plugin + repo 0.8.1 enabled dokku core repo plugin + shell 0.8.1 enabled dokku core shell plugin + ssh-keys 0.8.1 enabled dokku core ssh-keys plugin + storage 0.8.1 enabled dokku core storage plugin + tags 0.8.1 enabled dokku core tags plugin + tar 0.8.1 enabled dokku core tar plugin ``` Installing a plugin is easy as well using the `plugin:install` command. This command will also trigger the `install` pluginhook on all existing plugins. diff --git a/docs/assets/favicons/browserconfig.xml b/docs/assets/favicons/browserconfig.xml index 14e9c8e67..73de536be 100644 --- a/docs/assets/favicons/browserconfig.xml +++ b/docs/assets/favicons/browserconfig.xml @@ -2,10 +2,10 @@ - - - - + + + + #da532c diff --git a/docs/assets/favicons/manifest.json b/docs/assets/favicons/manifest.json index 1bc480147..5bc33d712 100644 --- a/docs/assets/favicons/manifest.json +++ b/docs/assets/favicons/manifest.json @@ -2,37 +2,37 @@ "name": "Dokku", "icons": [ { - "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-36x36.png", + "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.1\/docs\/assets\/favicons\/android-chrome-36x36.png", "sizes": "36x36", "type": "image\/png", "density": "0.75" }, { - "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-48x48.png", + "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.1\/docs\/assets\/favicons\/android-chrome-48x48.png", "sizes": "48x48", "type": "image\/png", "density": "1.0" }, { - "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-72x72.png", + "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.1\/docs\/assets\/favicons\/android-chrome-72x72.png", "sizes": "72x72", "type": "image\/png", "density": "1.5" }, { - "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-96x96.png", + "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.1\/docs\/assets\/favicons\/android-chrome-96x96.png", "sizes": "96x96", "type": "image\/png", "density": "2.0" }, { - "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-144x144.png", + "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.1\/docs\/assets\/favicons\/android-chrome-144x144.png", "sizes": "144x144", "type": "image\/png", "density": "3.0" }, { - "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.0\/docs\/assets\/favicons\/android-chrome-192x192.png", + "src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.8.1\/docs\/assets\/favicons\/android-chrome-192x192.png", "sizes": "192x192", "type": "image\/png", "density": "4.0" diff --git a/docs/assets/style.css b/docs/assets/style.css index 5f2c2763d..03605ffba 100644 --- a/docs/assets/style.css +++ b/docs/assets/style.css @@ -35,13 +35,13 @@ h1 { background-repeat: no-repeat; } .header .navbar-brand a { - background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/dokku.png); + background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.8.1/docs/assets/dokku.png); text-indent: 40px; } .blurb { color: #424242; background-color: #ededed; - background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.8.0/docs/assets/gplaypattern.png); + background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.8.1/docs/assets/gplaypattern.png); padding: 45px 0; text-align: center; } diff --git a/docs/assets/versions.json b/docs/assets/versions.json index eb62acaf0..682bd057f 100644 --- a/docs/assets/versions.json +++ b/docs/assets/versions.json @@ -5,6 +5,6 @@ "0.5.8", "0.6.5", "0.7.2", - "0.8.0" + "0.8.1" ] } diff --git a/docs/development/release-process.md b/docs/development/release-process.md index 52a81cb8b..a8a911b56 100644 --- a/docs/development/release-process.md +++ b/docs/development/release-process.md @@ -67,7 +67,7 @@ The workflow looks like this: ```shell # having dokku-arch in ../dokku-arch vagrant up build-arch -# wait for "==> build-arch: ==> Finished making: dokku 0.8.0-2 (Mon Feb 22 23:20:37 CET 2016)" +# wait for "==> build-arch: ==> Finished making: dokku 0.8.1-2 (Mon Feb 22 23:20:37 CET 2016)" cd ../dokku-arch git add PKGBUILD .SRCINFO git commit -m 'Update to dokku 0.9.9' diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index e2c5ddb1e..2aa32afc6 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -21,8 +21,8 @@ To install the latest stable version of dokku, you can run the following shell c ```shell # for debian systems, installs Dokku via apt-get -wget https://raw.githubusercontent.com/dokku/dokku/v0.8.0/bootstrap.sh; -sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh +wget https://raw.githubusercontent.com/dokku/dokku/v0.8.1/bootstrap.sh; +sudo DOKKU_TAG=v0.8.1 bash bootstrap.sh ``` The installation process takes about 5-10 minutes, depending upon internet connection speed. diff --git a/docs/home.html b/docs/home.html index d65794e82..69ff05ccf 100644 --- a/docs/home.html +++ b/docs/home.html @@ -10,30 +10,30 @@ Dokku - The smallest PaaS implementation you've ever seen - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + @@ -98,12 +98,12 @@

$ - wget https://raw.githubusercontent.com/dokku/dokku/v0.8.0/bootstrap.sh + wget https://raw.githubusercontent.com/dokku/dokku/v0.8.1/bootstrap.sh

$ - sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh + sudo DOKKU_TAG=v0.8.1 bash bootstrap.sh

 # go to your server's IP and follow the web installer diff --git a/docs/template.html b/docs/template.html index 1fd721650..d7a96ae20 100644 --- a/docs/template.html +++ b/docs/template.html @@ -9,26 +9,26 @@ Dokku - The smallest PaaS implementation you've ever seen - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + @@ -98,12 +98,12 @@

$ - wget https://raw.githubusercontent.com/dokku/dokku/v0.8.1/bootstrap.sh + wget https://raw.githubusercontent.com/dokku/dokku/v0.8.2/bootstrap.sh

$ - sudo DOKKU_TAG=v0.8.1 bash bootstrap.sh + sudo DOKKU_TAG=v0.8.2 bash bootstrap.sh

 # go to your server's IP and follow the web installer diff --git a/docs/template.html b/docs/template.html index d7a96ae20..19580726f 100644 --- a/docs/template.html +++ b/docs/template.html @@ -9,26 +9,26 @@ Dokku - The smallest PaaS implementation you've ever seen - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + @@ -98,12 +98,12 @@

$ - wget https://raw.githubusercontent.com/dokku/dokku/v0.8.2/bootstrap.sh + wget https://raw.githubusercontent.com/dokku/dokku/v0.9.0/bootstrap.sh

$ - sudo DOKKU_TAG=v0.8.2 bash bootstrap.sh + sudo DOKKU_TAG=v0.9.0 bash bootstrap.sh

 # go to your server's IP and follow the web installer diff --git a/docs/template.html b/docs/template.html index 19580726f..e1cd5258f 100644 --- a/docs/template.html +++ b/docs/template.html @@ -9,26 +9,26 @@ Dokku - The smallest PaaS implementation you've ever seen - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + @@ -98,12 +98,12 @@

$ - wget https://raw.githubusercontent.com/dokku/dokku/v0.9.0/bootstrap.sh + wget https://raw.githubusercontent.com/dokku/dokku/v0.9.1/bootstrap.sh

$ - sudo DOKKU_TAG=v0.9.0 bash bootstrap.sh + sudo DOKKU_TAG=v0.9.1 bash bootstrap.sh

 # go to your server's IP and follow the web installer diff --git a/docs/template.html b/docs/template.html index e1cd5258f..c08c07d7f 100644 --- a/docs/template.html +++ b/docs/template.html @@ -9,26 +9,26 @@ Dokku - The smallest PaaS implementation you've ever seen - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + @@ -98,12 +98,12 @@

$ - wget https://raw.githubusercontent.com/dokku/dokku/v0.9.1/bootstrap.sh + wget https://raw.githubusercontent.com/dokku/dokku/v0.9.2/bootstrap.sh

$ - sudo DOKKU_TAG=v0.9.1 bash bootstrap.sh + sudo DOKKU_TAG=v0.9.2 bash bootstrap.sh

 # go to your server's IP and follow the web installer diff --git a/docs/template.html b/docs/template.html index c08c07d7f..ac3eb0942 100644 --- a/docs/template.html +++ b/docs/template.html @@ -9,26 +9,26 @@ Dokku - The smallest PaaS implementation you've ever seen - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + @@ -98,12 +98,12 @@

$ - wget https://raw.githubusercontent.com/dokku/dokku/v0.9.2/bootstrap.sh + wget https://raw.githubusercontent.com/dokku/dokku/v0.9.3/bootstrap.sh

$ - sudo DOKKU_TAG=v0.9.2 bash bootstrap.sh + sudo DOKKU_TAG=v0.9.3 bash bootstrap.sh

 # go to your server's IP and follow the web installer diff --git a/docs/template.html b/docs/template.html index ac3eb0942..bf85b5804 100644 --- a/docs/template.html +++ b/docs/template.html @@ -9,26 +9,26 @@ Dokku - The smallest PaaS implementation you've ever seen - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + @@ -98,12 +98,12 @@

$ - wget https://raw.githubusercontent.com/dokku/dokku/v0.9.3/bootstrap.sh + wget https://raw.githubusercontent.com/dokku/dokku/v0.9.4/bootstrap.sh

$ - sudo DOKKU_TAG=v0.9.3 bash bootstrap.sh + sudo DOKKU_TAG=v0.9.4 bash bootstrap.sh

 # go to your server's IP and follow the web installer diff --git a/docs/template.html b/docs/template.html index bf85b5804..84b26c22f 100644 --- a/docs/template.html +++ b/docs/template.html @@ -9,26 +9,26 @@ Dokku - The smallest PaaS implementation you've ever seen - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - +