From 8200348f3c3f17aa75504a883e169b7ac9048414 Mon Sep 17 00:00:00 2001 From: knjcode Date: Fri, 19 Aug 2016 13:36:45 +0900 Subject: [PATCH 001/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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/116] 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 14833e22cb58466ca00e40aa6440c0075c0bd151 Mon Sep 17 00:00:00 2001 From: Edgars Beigarts Date: Mon, 31 Oct 2016 09:49:49 +0200 Subject: [PATCH 024/116] 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 025/116] 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 026/116] 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 027/116] 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 028/116] 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 029/116] 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 030/116] 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 031/116] 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 032/116] 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 033/116] 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 034/116] 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 035/116] 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 036/116] 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 037/116] 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 038/116] 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 039/116] 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 040/116] 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 041/116] 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 042/116] 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 043/116] 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 fcba766a757333275262f3df3e919813ec45d6eb Mon Sep 17 00:00:00 2001 From: John Schulz Date: Sat, 26 Nov 2016 14:53:43 -0500 Subject: [PATCH 044/116] 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 045/116] 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 046/116] 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 d001fcc89609b7d69f5358d5330cf5cb464e2796 Mon Sep 17 00:00:00 2001 From: Omar Shehata Date: Mon, 28 Nov 2016 02:53:46 +0000 Subject: [PATCH 047/116] 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 048/116] 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 049/116] 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 050/116] 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 051/116] 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 86b5b71f2868ae687a8cd3324fdbcbe33e7b0e65 Mon Sep 17 00:00:00 2001 From: Simon Kotwicz Date: Sat, 26 Nov 2016 23:38:58 -0500 Subject: [PATCH 052/116] 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 053/116] 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 054/116] 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 d4b85999af2e2fa3541a958ab3a81c1f694677d5 Mon Sep 17 00:00:00 2001 From: Ilya Semenov Date: Thu, 1 Dec 2016 13:21:57 +0700 Subject: [PATCH 055/116] 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 71ee7e73a7b81f339721a75114fa49c0713dadfe Mon Sep 17 00:00:00 2001 From: Stefan Gloutnikov Date: Fri, 2 Dec 2016 12:53:39 +0200 Subject: [PATCH 056/116] 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 057/116] 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 058/116] 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 059/116] 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 060/116] 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 061/116] 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 062/116] 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 063/116] 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 064/116] 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 065/116] 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 066/116] 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 067/116] 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 068/116] 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 cda2e3d048688d844ed577c1cddbf2932461a309 Mon Sep 17 00:00:00 2001 From: Slava Vishnyakov Date: Thu, 15 Dec 2016 14:19:41 +0300 Subject: [PATCH 069/116] 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 070/116] 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 071/116] 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 072/116] 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 073/116] 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 074/116] 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 075/116] 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 076/116] 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 077/116] 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 078/116] 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 079/116] 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 080/116] 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 081/116] 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 082/116] 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 083/116] 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 084/116] 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 085/116] 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 092/116] 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 093/116] 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 094/116] 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 095/116] 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 096/116] 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 097/116] 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 098/116] 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 099/116] 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 100/116] 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 101/116] 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 102/116] 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 103/116] 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 104/116] 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 105/116] 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 106/116] 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 107/116] 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 108/116] 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 109/116] 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 110/116] 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 111/116] 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 112/116] 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 113/116] 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 114/116] 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 115/116] 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 116/116] 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`: