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/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/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`: diff --git a/Makefile b/Makefile index fb703f02b..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 @@ -70,13 +70,17 @@ 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 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/README.md b/README.md index 5a31bd058..5058bf804 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,16 @@ -# Dokku [![Build Status](https://img.shields.io/circleci/project/dokku/dokku/master.svg?style=flat-square "Build Status")](https://circleci.com/gh/dokku/dokku/tree/master) [![Ubuntu Package](https://img.shields.io/badge/package-ubuntu-brightgreen.svg?style=flat-square "Ubuntu Package")](https://packagecloud.io/dokku/dokku) [![Arch Package](https://img.shields.io/badge/package-arch-brightgreen.svg?style=flat-square "Arch Package")](https://aur.archlinux.org/packages/dokku/) [![IRC Network](https://img.shields.io/badge/irc-freenode-blue.svg?style=flat-square "IRC Freenode")](https://webchat.freenode.net/?channels=dokku) [![Slack Group](https://img.shields.io/badge/irc-slack-blue.svg?style=flat-square "Slack Group")](https://glider-slackin.herokuapp.com/) [![Documentation](https://img.shields.io/badge/docs-viewdocs-blue.svg?style=flat-square "Viewdocs")](http://dokku.viewdocs.io/dokku/) +# Dokku +[![Build Status](https://img.shields.io/circleci/project/dokku/dokku/master.svg?style=flat-square "Build Status")](https://circleci.com/gh/dokku/dokku/tree/master) +[![Ubuntu Package](https://img.shields.io/badge/package-ubuntu-brightgreen.svg?style=flat-square "Ubuntu Package")](https://packagecloud.io/dokku/dokku) +[![Arch Package](https://img.shields.io/badge/package-arch-brightgreen.svg?style=flat-square "Arch Package")](https://aur.archlinux.org/packages/dokku/) +[![IRC Network](https://img.shields.io/badge/irc-freenode-blue.svg?style=flat-square "IRC Freenode")](https://webchat.freenode.net/?channels=dokku) +[![Slack Group](https://img.shields.io/badge/irc-slack-blue.svg?style=flat-square "Slack Group")](https://glider-slackin.herokuapp.com/) +[![Documentation](https://img.shields.io/badge/docs-viewdocs-blue.svg?style=flat-square "Viewdocs")](http://dokku.viewdocs.io/dokku/) [![OpenCollective](https://opencollective.com/dokku/sponsors/badge.svg?style=flat-square)](#sponsors) [![OpenCollective](https://opencollective.com/dokku/backers/badge.svg?style=flat-square)](#backers) [![Gratipay](https://img.shields.io/gratipay/dokku.svg?style=flat-square)](https://gratipay.com/dokku/) 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` - -## Installing - -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 - -You can then proceed to the ip address or domain name associated with your server to complete the web-based installation. - -If you wish for a more unattended installation method, see [these](http://dokku.viewdocs.io/dokku/getting-started/install/debian/#unattended-installation) docs. - -### Upgrading - -[View the docs for upgrading](http://dokku.viewdocs.io/dokku/getting-started/upgrading/) from an older version of Dokku. - -## Documentation - -Full documentation - including advanced installation docs - are available online at [docs](http://dokku.viewdocs.io/dokku/) - -## Support - -You can use [Github Issues](https://github.com/dokku/dokku/issues), check [Troubleshooting](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) in the documentation, or join us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku) - -## Contribution - -After checking [Github Issues](https://github.com/dokku/dokku/issues), the [Troubleshooting Guide](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) or having a chat with us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku), feel free to fork and create a Pull Request. - -While we may not merge your PR as is, they serve to start conversations and improve the general Dokku experience for all users. - ## Sponsors See our list of past sponsors in the [SPONSORS](https://github.com/dokku/dokku/blob/master/SPONSORS.md) file. @@ -111,6 +84,47 @@ Support us with a monthly donation and help us continue our activities. [[Become +## Requirements + +A fresh VM running any of the following operating systems: + +- Ubuntu 16.04 x64 +- Ubuntu 14.04 x64 +- Debian 8.2 x64 +- CentOS 7 x64 *(experimental)* +- Arch Linux x64 *(experimental)* + +## Installation + +To install the latest stable release, run the following commands as a user who has access to `sudo`: + +```shell +wget https://raw.githubusercontent.com/dokku/dokku/v0.8.0/bootstrap.sh +sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh +``` + +You can then proceed to the ip address or domain name associated with your server to complete the web-based installation. + +If you wish for a more unattended installation method, see [these](http://dokku.viewdocs.io/dokku/getting-started/install/debian/#unattended-installation) docs. + +### Upgrade + +[View the docs](http://dokku.viewdocs.io/dokku/getting-started/upgrading/) for upgrading from an older version of Dokku. + +## Documentation + +Full documentation - including advanced installation docs - are available online [here](http://dokku.viewdocs.io/dokku/) + +## Support + +You can use [Github Issues](https://github.com/dokku/dokku/issues), check [Troubleshooting](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) in the documentation, or join us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku) + +## Contribution + +After checking [Github Issues](https://github.com/dokku/dokku/issues), the [Troubleshooting Guide](http://dokku.viewdocs.io/dokku/getting-started/troubleshooting/) or having a chat with us on [freenode in #dokku](https://webchat.freenode.net/?channels=%23dokku), feel free to fork and create a Pull Request. + +While we may not merge your PR as is, they serve to start conversations and improve the general Dokku experience for all users. + ## License [MIT License](https://github.com/dokku/dokku/blob/master/LICENSE) © Jeff Lindsay diff --git a/SPONSORS.md b/SPONSORS.md index 4c7c0b9bc..eb1cd5b87 100644 --- a/SPONSORS.md +++ b/SPONSORS.md @@ -1,3 +1,5 @@ +#Sponsors + [Deis](http://deis.io) [DigitalOcean](https://www.digitalocean.com/) 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/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/ 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/contrib/dokku_client.sh b/contrib/dokku_client.sh index 6ed95a804..a0a1963cc 100755 --- a/contrib/dokku_client.sh +++ b/contrib/dokku_client.sh @@ -1,10 +1,9 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +export DOKKU_PORT=${DOKKU_PORT:=22} +export DOKKU_HOST=${DOKKU_HOST:=} -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() { +fn-random-number() { [[ -n "$1" ]] && RANGE="$1" if [[ -n "$RANGE" ]]; then number=$RANDOM @@ -15,94 +14,141 @@ random_number() { echo $number } -random_name() { - NUM1=$(random_number ${#MOVES[@]}) - NUM2=$(random_number ${#MOVES[@]}) - NUM3=$(random_number ${#NAMES[@]}) +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) - UPPER_APPNAME="${MOVES[${NUM1}]}-${MOVES[${NUM2}]}-${NAMES[${NUM3}]}" + NUM1=$(fn-random-number ${#MOVES[@]}) + NUM2=$(fn-random-number ${#MOVES[@]}) + NUM3=$(fn-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() { - 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@:" +fn-client-help-msg() { + 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 } -is_git_repo() { - git rev-parse &>/dev/null +fn-is-git-repo() { + git rev-parse &>/dev/null } -has_dokku_remote() { - git remote show | grep dokku +fn-has-dokku-remote() { + 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 - client_help_msg +fn-dokku-host() { + declare DOKKU_GIT_REMOTE="$1" DOKKU_HOST="$2" + + 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_GIT_REMOTE}\s" | head -n 1 | cut -f1 -d' ' | cut -f2 -d '@' | cut -f1 -d':' 2>/dev/null || true) + fi fi -fi -export DOKKU_PORT=${DOKKU_PORT:=22} + if [[ -z "$DOKKU_HOST" ]]; then + fn-client-help-msg + fi + + echo "$DOKKU_HOST" +} -if [[ ! -z $DOKKU_HOST ]]; then - _dokku() { - appname="" +main() { + declare CMD="$1" APP_ARG="$2" + local APP="" DOKKU_GIT_REMOTE="dokku" DOKKU_REMOTE_HOST="" + local cmd_set=false next_index=1 skip=false args=("$@") + + for arg in "$@"; do + 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 && set -x + 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_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 - 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) + 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" fi - - case "$1" in - apps:create) - if [[ -z "$2" ]]; then - appname=$(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) - is_git_repo && 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 - client_help_msg + + case "$CMD" in + apps:create) + if [[ -z "$APP_ARG" ]]; then + APP=$(fn-random-name) + counter=0 + 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_REMOTE_HOST" apps + exit 1 + else + APP=$(random_name) + counter=$((counter+1)) + fi + done + else + APP="$APP_ARG" + fi + 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?" + return + fi + ;; + apps:destroy) + fn-is-git-repo && fn-has-dokku-remote && git remote remove "$DOKKU_GIT_REMOTE" + ;; + esac + + [[ " 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_REMOTE_HOST -- $app_arg $@" + # shellcheck disable=SC2068,SC2086 + 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 + main "$@" + exit $? fi diff --git a/deb.mk b/deb.mk index f9f9c52ac..ca8411157 100644 --- a/deb.mk +++ b/deb.mk @@ -1,6 +1,6 @@ HEROKUISH_DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku' HEROKUISH_REPO_NAME ?= gliderlabs/herokuish -HEROKUISH_VERSION ?= 0.3.19 +HEROKUISH_VERSION ?= 0.3.25 HEROKUISH_ARCHITECTURE = amd64 HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb @@ -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/debian/control b/debian/control index f8c628bb2..d4ff40970 100644 --- a/debian/control +++ b/debian/control @@ -1,11 +1,11 @@ Package: dokku -Version: 0.7.2 +Version: 0.8.0 Section: web Priority: optional Architecture: amd64 -Depends: locales, git, make, curl, gcc, man-db, sshcommand, gliderlabs-sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1), software-properties-common, python-software-properties -Recommends: herokuish -Pre-Depends: nginx, dnsutils, cgroupfs-mount | cgroup-lite, plugn, sudo, python2.7, debconf +Depends: locales, git, make, curl, gcc, man-db, sshcommand (>= 0.6.0), gliderlabs-sigil, docker-engine-cs (>= 1.9.1) | docker-engine (>= 1.9.1), software-properties-common, python-software-properties +Recommends: herokuish (>= 0.3.4), parallel +Pre-Depends: nginx, dnsutils, cgroupfs-mount | cgroup-lite, plugn (>= 0.2.2), sudo, python2.7, debconf Maintainer: Jose Diaz-Gonzalez Description: Docker-powered PaaS that helps build and manage the lifecycle of applications Dokku is an extensible, open source Platform as a Service 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 diff --git a/docs/advanced-usage/persistent-storage.md b/docs/advanced-usage/persistent-storage.md index a34f7bd2a..4cf00aafe 100644 --- a/docs/advanced-usage/persistent-storage.md +++ b/docs/advanced-usage/persistent-storage.md @@ -11,16 +11,19 @@ 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. ## 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 +38,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. @@ -80,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. 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/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/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..5f2c2763d 100644 --- a/docs/assets/style.css +++ b/docs/assets/style.css @@ -1,5 +1,5 @@ body { - font-family: 'Open Sans', sans-serif; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-weight: 400; padding-bottom: 40px; color: #5a5a5a; @@ -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; } @@ -209,6 +209,7 @@ h1 { .list-group-item { border: none; + font-size: 14px; font-weight: normal; padding: .2rem .5rem; color: #157577; @@ -246,7 +247,7 @@ a.list-group-item { color: rgb(71, 74, 84); font-weight: normal; height: 20px; - line-height: 20px; + line-height: 1.5; text-align: left; } .markdown-body h1 { 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/configuration/domains.md b/docs/configuration/domains.md index 9313a6258..048a495ef 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 @@ -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. 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/application-deployment.md b/docs/deployment/application-deployment.md index 903add341..c8f0d2e9a 100644 --- a/docs/deployment/application-deployment.md +++ b/docs/deployment/application-deployment.md @@ -90,6 +90,18 @@ Dokku supports deploying applications via [Heroku buildpacks](https://devcenter. Dokku only supports deploying from its master branch, so if you'd like to deploy a different local branch use: ```git push dokku :master``` +An alternative is to use the `DOKKU_DEPLOY_BRANCH` application config value to specify a branch that should be deployed. The implicit default is master, and this can be modified both at the app and global level: + +```shell +# on your Dokku host + +# set it globally +dokku config:set --global DOKKU_DEPLOY_BRANCH=some-branch + +# override for a specific app +dokku config:set ruby-rails-sample DOKKU_DEPLOY_BRANCH=some-branch +``` + You can also support pushing multiple branches using the [receive-branch](/dokku/development/plugin-triggers/#receive-branch) plugin trigger in a custom plugin. ### Skipping deployment diff --git a/docs/deployment/application-management.md b/docs/deployment/application-management.md index 9b44c3ebc..1ddf5715a 100644 --- a/docs/deployment/application-management.md +++ b/docs/deployment/application-management.md @@ -4,6 +4,7 @@ ``` apps # List your apps +apps:clone # Clones an app apps:create # Create a new app apps:destroy # Permanently destroy an app apps:rename # Rename an app @@ -112,3 +113,27 @@ Renaming node-js-app to io-js-app... done ``` This will copy all of your app's contents into a new app directory with the name of your choice, delete your old app, then rebuild the new version of the app and deploy it. All of your config variables, including database urls, will be preserved. + +### Cloning an existing app + +> New as of 0.8.1 + +You can clone an existing app using the `apps:clone` command. Note that the application *must* have been deployed at least once, or the rename will not complete successfully: + +```shell +dokku apps:clone node-js-app io-js-app +``` + +``` +Cloning node-js-app to io-js-app... done +``` + +This will copy all of your app's contents into a new app directory with the name of your choice and then rebuild the new version of the app and deploy it. All of your config variables, including database urls, will be preserved. + +> Warning: If you have exposed specific ports via docker-options, added generic domains, or performed anything that cannot be done against multiple applications, `apps:clone` may result in errors. + +By default, Dokku will deploy this new application, though you can skip the deploy by using the `--skip-deploy` flag: + +```shell +dokku apps:clone --skip-deploy node-js-app io-js-app +``` 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/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/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/install/vagrant.md b/docs/getting-started/install/vagrant.md index d6116be84..b6f79c7b0 100644 --- a/docs/getting-started/install/vagrant.md +++ b/docs/getting-started/install/vagrant.md @@ -21,13 +21,15 @@ cd path/to/dokku vagrant up ``` -- Setup SSH Config in `~/.ssh/config`. The port listed here is usually correct, though you may want to verify that it is the same as the one listed in the output of `vagrant ssh-config dokku` +- Setup SSH Config in `~/.ssh/config`. ```ini Host dokku.me Port 22 ``` + > For users that have customized the IP address of their VM - either in a custom `Vagrantfile` or via the `DOKKU_IP` environment variable - and are not using `10.0.0.2` for the Vagrant IP, you'll need to instead use the output of `vagrant ssh-config dokku` for your ~/.ssh/config entry. + - Copy your SSH key via `cat ~/.ssh/id_rsa.pub | pbcopy` and paste it into the dokku-installer at http://dokku.me . Change the `Hostname` field on the Dokku Setup screen to your domain and then check the box that says `Use virtualhost naming`. Then click *Finish Setup* to install your key. You'll be directed to application deployment instructions from here. Please note, the `dokku.me` domain is setup to point to `10.0.0.2` along with all subdomains (ie yourapp.dokku.me). If you change the `DOKKU_IP` in your vagrant setup you'll need to update your `/etc/hosts` file to point your reconfigured ip address. diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index d3715a566..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 @@ -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. @@ -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. diff --git a/docs/home.html b/docs/home.html index 402a9e9b8..d65794e82 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..1fd721650 100644 --- a/docs/template.html +++ b/docs/template.html @@ -7,29 +7,28 @@ - Dokku - The smallest PaaS implementation you've ever seen - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + diff --git a/dokku b/dokku index b26f6c799..978d617f4 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"} @@ -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 diff --git a/plugins/00_dokku-standard/plugin.toml b/plugins/00_dokku-standard/plugin.toml index b0a1b8939..21e999806 100644 --- a/plugins/00_dokku-standard/plugin.toml +++ b/plugins/00_dokku-standard/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core standard plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/20_events/plugin.toml b/plugins/20_events/plugin.toml index 8221c20a6..4e15db2c6 100644 --- a/plugins/20_events/plugin.toml +++ b/plugins/20_events/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core events logging plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/apps/commands b/plugins/apps/commands index c46d255b1..234108cdf 100755 --- a/plugins/apps/commands +++ b/plugins/apps/commands @@ -8,6 +8,7 @@ case "$1" in declare desc="return apps plugin help content" cat< , Clones an app apps:create , Create a new app apps:destroy , Permanently destroy an app apps:rename , Rename an app diff --git a/plugins/apps/plugin.toml b/plugins/apps/plugin.toml index abda804a0..e79c48f60 100644 --- a/plugins/apps/plugin.toml +++ b/plugins/apps/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core apps plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/apps/subcommands/clone b/plugins/apps/subcommands/clone new file mode 100755 index 000000000..829882c2c --- /dev/null +++ b/plugins/apps/subcommands/clone @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x +source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +source "$PLUGIN_AVAILABLE_PATH/apps/functions" +source "$PLUGIN_AVAILABLE_PATH/ps/functions" + +apps_clone_cmd() { + declare desc="clones an app" + declare OLD_APP="$2" NEW_APP="$3" + local cmd="apps:clone" + local SKIP_REBUILD=false + + if [[ "$2" == "--skip-deploy" ]]; then + SKIP_REBUILD=true + OLD_APP="$3" + NEW_APP="$4" + fi + + [[ -z "$OLD_APP" ]] && dokku_log_fail "Please specify an app to run the command on" + [[ -d "$DOKKU_ROOT/$NEW_APP" ]] && dokku_log_fail "Name is already taken" + local NEW_CACHE_DIR="$DOKKU_ROOT/$NEW_APP/cache" + + apps_create "$NEW_APP" + cp -a "$DOKKU_ROOT/$OLD_APP/." "$DOKKU_ROOT/$NEW_APP" + + if [[ -d "$NEW_CACHE_DIR" ]] && ! rmdir "$NEW_CACHE_DIR"; then + docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$NEW_CACHE_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache + fi + rm -rf "$NEW_CACHE_DIR" + + [[ -f "$DOKKU_ROOT/$NEW_APP/URLS" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/URLS" + [[ -f "$DOKKU_ROOT/$NEW_APP/VHOST" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/VHOST" + [[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]] && sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" + [[ "$SKIP_REBUILD" == "true" ]] || ps_rebuild "$NEW_APP" + plugn trigger post-app-clone "$OLD_APP" "$NEW_APP" + echo "Cloning $OLD_APP to $NEW_APP... done" +} + +apps_clone_cmd "$@" diff --git a/plugins/build-env/plugin.toml b/plugins/build-env/plugin.toml index ade77a4a7..92ce826fe 100644 --- a/plugins/build-env/plugin.toml +++ b/plugins/build-env/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core build-env plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] 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/plugin.toml b/plugins/certs/plugin.toml index cc275d6b9..b0caec7f9 100644 --- a/plugins/certs/plugin.toml +++ b/plugins/certs/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core certificate management plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/certs/subcommands/add b/plugins/certs/subcommands/add index 07601378c..c705d1cde 100755 --- a/plugins/certs/subcommands/add +++ b/plugins/certs/subcommands/add @@ -72,7 +72,6 @@ certs_set() { cp "$KEY_FILE" "$APP_SSL_PATH/server.key" chmod 750 "$APP_SSL_PATH" chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.key" - cd "$DOKKU_ROOT" plugn trigger post-certs-update "$APP" plugn trigger post-domains-update "$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/generate b/plugins/certs/subcommands/generate index daa2caed8..10349e9f9 100755 --- a/plugins/certs/subcommands/generate +++ b/plugins/certs/subcommands/generate @@ -22,14 +22,15 @@ certs_generate_cmd() { mkdir -p "$APP_SSL_PATH" dokku_log_info1 "Installing certificate and key..." - mv -f "$CERTS_GENERATE_TMP_WORK_DIR/server.key" "$CERTS_GENERATE_TMP_WORK_DIR/server.crt" "$APP_SSL_PATH" + mv -f "$CERTS_GENERATE_TMP_WORK_DIR/server.crt" "$CERTS_GENERATE_TMP_WORK_DIR/server.csr" "$CERTS_GENERATE_TMP_WORK_DIR/server.key" "$APP_SSL_PATH" chmod 750 "$APP_SSL_PATH" - chmod 640 "$APP_SSL_PATH/server.key" "$APP_SSL_PATH/server.crt" + chmod 640 "$APP_SSL_PATH/server.crt" "$APP_SSL_PATH/server.csr" "$APP_SSL_PATH/server.key" + plugn trigger post-certs-update "$APP" [[ -n "$DOMAIN" ]] && (domains_add "$APP" "$DOMAIN" || plugn trigger post-domains-update "$APP") dokku_log_info1 "The following is a certificate signing request that can be used" dokku_log_info1 "to generate an 'officially' signed SSL certificate for $APP at $DOMAIN" dokku_log_info1 "by a CA of your choosing." - cat server.csr + cat "$APP_SSL_PATH/server.csr" else dokku_log_info1 "$APP has an SSL endpoint already defined" fi 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 "$@" 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 '' diff --git a/plugins/checks/plugin.toml b/plugins/checks/plugin.toml index 1b4d3b6b7..bf1d75246 100644 --- a/plugins/checks/plugin.toml +++ b/plugins/checks/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core checks plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] 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 } diff --git a/plugins/common/plugin.toml b/plugins/common/plugin.toml index 9a1675ca7..6aa57777e 100644 --- a/plugins/common/plugin.toml +++ b/plugins/common/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core common plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/config/plugin.toml b/plugins/config/plugin.toml index 4f87dd4ea..d2e907e8b 100644 --- a/plugins/config/plugin.toml +++ b/plugins/config/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core config plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/docker-options/plugin.toml b/plugins/docker-options/plugin.toml index a802b0fc4..fb4500136 100644 --- a/plugins/docker-options/plugin.toml +++ b/plugins/docker-options/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core docker-options plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/domains/plugin.toml b/plugins/domains/plugin.toml index a16a166ce..dc46154f6 100644 --- a/plugins/domains/plugin.toml +++ b/plugins/domains/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core domains plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] 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 diff --git a/plugins/enter/plugin.toml b/plugins/enter/plugin.toml index 71417684a..c37818a91 100644 --- a/plugins/enter/plugin.toml +++ b/plugins/enter/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core enter plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/git/functions b/plugins/git/functions index 33158d646..5e0da3726 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,16 +41,53 @@ 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 + + "$@" > "$TMP_COMMAND_OUTPUT" 2>&1 || { + local exit_code="$?" + cat "$TMP_COMMAND_OUTPUT" + return "$exit_code" + } + return 0 +} + +git_deploy_branch() { + declare desc="retrieve the deploy branch for a given application" + local cmd="git-hook" + local APP="$1" + + local DOKKU_DEPLOY_BRANCH="$(config_get "$APP" DOKKU_DEPLOY_BRANCH || true)" + local DOKKU_GLOBAL_DEPLOY_BRANCH="$(config_get --global DOKKU_DEPLOY_BRANCH || true)" + if [[ -n "$DOKKU_DEPLOY_BRANCH" ]]; then + echo "$DOKKU_DEPLOY_BRANCH" + elif [[ -n "$DOKKU_GLOBAL_DEPLOY_BRANCH" ]]; then + echo "$DOKKU_GLOBAL_DEPLOY_BRANCH" + else + echo "master" + fi +} + git_hook_cmd() { declare desc="kick off receive-app trigger from git prereceive hook" local cmd="git-hook" - local APP="$2" + local APP="$2" + local DOKKU_DEPLOY_BRANCH="$(git_deploy_branch "$APP")" + + if ! git check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" 2> /dev/null; then + echo $'\e[1G\e[K'"-----> WARNING: Invalid branch name '$DOKKU_DEPLOY_BRANCH' specified via DOKKU_DEPLOY_BRANCH." + echo $'\e[1G\e[K'"-----> For more details, please see the man page for 'git-check-ref-format.'" + return + fi local oldrev newrev refname while read -r oldrev newrev refname; do # Only run this script for the master branch. You can remove this # if block if you wish to run it for others as well. - if [[ $refname = "refs/heads/master" ]]; then + if [[ $refname = "refs/heads/${DOKKU_DEPLOY_BRANCH}" ]]; then # broken out into plugin so we might support other methods to receive an app # shellcheck disable=SC2086 plugn trigger receive-app $APP $newrev diff --git a/plugins/git/plugin.toml b/plugins/git/plugin.toml index e045d49d2..7a4d20407 100644 --- a/plugins/git/plugin.toml +++ b/plugins/git/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core git plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/logs/plugin.toml b/plugins/logs/plugin.toml index 8913ebada..f07495e97 100644 --- a/plugins/logs/plugin.toml +++ b/plugins/logs/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core logs plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/named-containers/plugin.toml b/plugins/named-containers/plugin.toml index 6488244b6..7519949ea 100644 --- a/plugins/named-containers/plugin.toml +++ b/plugins/named-containers/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core named containers plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] 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 8c88d9a48..8f1af2c40 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 @@ -272,7 +291,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)" diff --git a/plugins/nginx-vhosts/plugin.toml b/plugins/nginx-vhosts/plugin.toml index b7beac324..a9d71618b 100644 --- a/plugins/nginx-vhosts/plugin.toml +++ b/plugins/nginx-vhosts/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core nginx-vhosts plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] 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 "$@" diff --git a/plugins/plugin/plugin.toml b/plugins/plugin/plugin.toml index 7e2660bd1..c51efc9f6 100644 --- a/plugins/plugin/plugin.toml +++ b/plugins/plugin/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core plugin plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/proxy/plugin.toml b/plugins/proxy/plugin.toml index c046c6ad6..9fac76603 100644 --- a/plugins/proxy/plugin.toml +++ b/plugins/proxy/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core proxy plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/ps/plugin.toml b/plugins/ps/plugin.toml index f25ef3c61..d8f492ffe 100644 --- a/plugins/ps/plugin.toml +++ b/plugins/ps/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core ps plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/ps/subcommands/restore b/plugins/ps/subcommands/restore index 0b7b83729..818c3d980 100755 --- a/plugins/ps/subcommands/restore +++ b/plugins/ps/subcommands/restore @@ -7,11 +7,20 @@ source "$PLUGIN_AVAILABLE_PATH/ps/functions" ps_restore_cmd() { declare desc="starts all apps with DOKKU_APP_RESTORE not set to 0 via command line" local cmd="ps:restore" + + if which parallel > /dev/null 2>&1; then + dokku_apps | parallel dokku ps:start + return + fi + for app in $(dokku_apps); do local DOKKU_APP_RESTORE=$(config_get "$app" DOKKU_APP_RESTORE || true) if [[ $DOKKU_APP_RESTORE != 0 ]]; then echo "Restoring app $app ..." - ps_start "$app" + if ps_start "$app"; then + continue + fi + dokku_log_warn "dokku ps:restore ${app} failed" fi done } 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/plugin.toml b/plugins/repo/plugin.toml index f354ceff0..2498cb82f 100644 --- a/plugins/repo/plugin.toml +++ b/plugins/repo/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core repo plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] 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/plugins/shell/plugin.toml b/plugins/shell/plugin.toml index 3e96e7c2e..2cc88f6aa 100644 --- a/plugins/shell/plugin.toml +++ b/plugins/shell/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core shell plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] diff --git a/plugins/ssh-keys/functions b/plugins/ssh-keys/functions index b6765691e..f45dce1ff 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/plugin.toml b/plugins/ssh-keys/plugin.toml index f6c7db1c3..1bf62a150 100644 --- a/plugins/ssh-keys/plugin.toml +++ b/plugins/ssh-keys/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core ssh-keys plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] 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 "$@" 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/plugin.toml b/plugins/storage/plugin.toml index b822d1c04..862e8342e 100644 --- a/plugins/storage/plugin.toml +++ b/plugins/storage/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core storage plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] 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 "$@" diff --git a/plugins/tags/plugin.toml b/plugins/tags/plugin.toml index c5bc6d690..07231f6d2 100644 --- a/plugins/tags/plugin.toml +++ b/plugins/tags/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core tags plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] 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 diff --git a/plugins/tar/plugin.toml b/plugins/tar/plugin.toml index 25b425fcc..bf5dc5000 100644 --- a/plugins/tar/plugin.toml +++ b/plugins/tar/plugin.toml @@ -1,4 +1,4 @@ [plugin] description = "dokku core tar plugin" -version = "0.7.2" +version = "0.8.0" [plugin.config] 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); \ 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; diff --git a/tests/unit/10_apps.bats b/tests/unit/10_apps.bats index 9558b3e9b..17ed29be3 100644 --- a/tests/unit/10_apps.bats +++ b/tests/unit/10_apps.bats @@ -90,3 +90,36 @@ teardown () { echo "status: "$status assert_success } + +@test "(apps) apps:clone" { + deploy_app + run bash -c "dokku apps:clone $TEST_APP great-test-name" + echo "output: "$output + echo "status: "$status + assert_success + run bash -c "dokku apps | grep $TEST_APP" + echo "output: "$output + echo "status: "$status + assert_success + run bash -c "curl --silent --write-out '%{http_code}\n' `dokku url great-test-name` | grep 404" + echo "output: "$output + echo "status: "$status + assert_output "" + run bash -c "dokku --force apps:destroy great-test-name" + echo "output: "$output + echo "status: "$status + assert_success + + run bash -c "dokku apps:clone --skip-deploy $TEST_APP great-test-name" + echo "output: "$output + echo "status: "$status + assert_success + run bash -c "curl --silent --write-out '%{http_code}\n' `dokku url great-test-name` | grep 404" + echo "output: "$output + echo "status: "$status + assert_failure + run bash -c "dokku --force apps:destroy great-test-name" + echo "output: "$output + echo "status: "$status + assert_success +} diff --git a/tests/unit/20_config.bats b/tests/unit/20_config.bats index a5894372c..87dafa332 100644 --- a/tests/unit/20_config.bats +++ b/tests/unit/20_config.bats @@ -145,3 +145,17 @@ teardown() { echo "status: "$status assert_success } + +@test "(config) deploy specific DOKKU_DEPLOY_BRANCH" { + run ssh dokku@dokku.me config:set --global DOKKU_DEPLOY_BRANCH=global-branch + GIT_REMOTE_BRANCH=global-branch deploy_app + echo "output: "$output + echo "status: "$status + assert_success + + run ssh dokku@dokku.me config:set $TEST_APP DOKKU_DEPLOY_BRANCH=app-branch + GIT_REMOTE_BRANCH=app-branch deploy_app + echo "output: "$output + echo "status: "$status + assert_success +} diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index e6d16da86..b59841339 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -196,10 +196,11 @@ assert_http_redirect() { } deploy_app() { - local APP_TYPE="$1"; local APP_TYPE=${APP_TYPE:="nodejs-express"} - local GIT_REMOTE="$2"; local GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"} - local CUSTOM_TEMPLATE="$3"; local TMP=$(mktemp -d "/tmp/dokku.me.XXXXX") - local CUSTOM_PATH="$4" + declare APP_TYPE="$1" GIT_REMOTE="$2" CUSTOM_TEMPLATE="$3" CUSTOM_PATH="$4" + local APP_TYPE=${APP_TYPE:="nodejs-express"} + local GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"} + local GIT_REMOTE_BRANCH=${GIT_REMOTE_BRANCH:="master"} + local TMP=$(mktemp -d "/tmp/dokku.me.XXXXX") rmdir "$TMP" && cp -r "./tests/apps/$APP_TYPE" "$TMP" @@ -218,7 +219,7 @@ deploy_app() { [[ -f gitignore ]] && mv gitignore .gitignore git add . git commit -m 'initial commit' - git push target master || destroy_app $? + git push target "master:${GIT_REMOTE_BRANCH}" || destroy_app $? } setup_client_repo() {