Merge branch 'master' into wcalandro-patch-1

This commit is contained in:
Wyatt Calandro
2018-12-04 22:27:59 -07:00
committed by GitHub
129 changed files with 1397 additions and 319 deletions

View File

@@ -1,5 +1,87 @@
# History
## 0.13.1
Install/update via the bootstrap script:
```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.13.1/bootstrap.sh
sudo DOKKU_TAG=v0.13.1 bash bootstrap.sh
```
### Bug Fixes
- #3324: @josegonzalez Add missing source of config functions
## 0.13.0
### Bug Fixes
- #3312: @josegonzalez fix: keep track of failed containers regardless of docker kill output
- #3299: @josegonzalez Wrap script_bin in double-quotes
- #3295: @alexquick Sort config:show by key name
- #3288: @josegonzalez Wrap script binary in single quotes during executable check
### New Features
- #3302: @josegonzalez Add ability to check on app lock status via apps:locked command
- #3315: @aokon Upgrade herokuish to 0.4.5 version
- #3236: @josegonzalez Retire old containers
- #3307: @josegonzalez Add support for docker.io package
- #3301: @josegonzalez Add ability to sync packages to a new version of ubuntu
- #3286: @josegonzalez Sanitize docker inspect output with ps:inspect
- #3240: @josegonzalez Refactor Procfile handling to use go-procfile-util
- #3282: @josegonzalez Use create instead of run for faster and more reliable file copy from docker images
- #3280: @josegonzalez Better scheduler support
- #3259: @josegonzalez Check if script is executable when a full path is specified
### Documentation
- #3314: @royklutman Remove reference to non-existent DigitalOcean hosting plan
- #3313: @morenoh149 Indicate to user to specify hostname
- #3310: @josegonzalez Add a note to our issue template begging for money
- #3281: @josegonzalez Add documentation on custom error pages
## 0.12.13
### New Features
- #3257: @josegonzalez Suppress output in git plugin during builds
- #3254: @michaelshobbs Update herokuish to 0.4.4
### Documentation
- #3270: @alexymik Correct typo in git documentation
- #3268: @josegonzalez Correct notice on ubuntu support
- #3247: @mimischi Fix typo in ps:stopall
- #3246: @dv Change DISABLE_CHOWN to disable-chown
## 0.12.12
### New Features
- #3244: @josegonzalez Allow disabling chown for persistent storage in scheduler-docker-local
## 0.12.11
### Bug Fixes
- #3238: @josegonzalez Handle proxy issues in app renaming
- #3234: @mashrikt Unset GIT_QUARANTINE_PATH when updating repo submodule
- #3223: @josegonzalez Get the global scheduler if no app is specified
- #3218: @wcalandro Fix error text when using "dokku plugin:uninstall"
### New Features
- #3242: @josegonzalez Upgrade herokuish to 0.4.3
- #3241: @josegonzalez Add a subcommand for retrieving failed app deploy logs
- #3237: @josegonzalez Support --quiet header when showing all environment variables
### Documentation
- #3235: @josegonzalez Switch from ps:rebuild to ps:restart
- #3221: @josegonzalez Better callout for why env vars do not get applied to dockerfile builds
## 0.12.10
### New Features

View File

@@ -1,3 +1,5 @@
> If you're using Dokku - especially for commercial purposes - consider donating to project development via [OpenCollective](https://opencollective.com/dokku) or [Patreon](https://www.patreon.com/dokku). Funds go to general development, support, and infrastructure costs.
>
> If you need help figuring out how to use a specific buildpack, or are having issues using multiple buildpacks, please see our [irc or slack channels](http://dokku.viewdocs.io/dokku/getting-started/where-to-get-help/#the-irc-and-slack-channels). Issues pertaining to buildpacks may be closed and locked.
## Description of problem
@@ -27,8 +29,9 @@
### Additional information
- `docker inspect CONTAINER_ID` (if applicable):
(BEWARE: `docker inspect` will print environment variables for some commands, be sure you're not exposing any sensitive information when posting issues. You may replace these values with XXXXXXX):
- Container Inspect Output (if applicable):
- 0.13.0+: `dokku inspect APP_NAME`
- <0.13.0: `docker inspect CONTAINER_ID`: WARNING, `docker inspect` will print environment variables for some commands, be sure you're not exposing any sensitive information when posting issues. You may replace these values with XXXXXXX.
- `cat /home/dokku/<app>/nginx.conf` (if applicable):
- Link to the exact repository being deployed (if possible/applicable):
- If a deploy is failing or behaving unexpectedly:

View File

@@ -1,6 +1,7 @@
DOKKU_VERSION ?= master
SSHCOMMAND_URL ?= https://raw.githubusercontent.com/dokku/sshcommand/v0.7.0/sshcommand
PROCFILE_UTIL_URL ?= https://github.com/josegonzalez/go-procfile-util/releases/download/v0.4.0/procfile-util_0.4.0_linux_x86_64.tgz
PLUGN_URL ?= https://github.com/dokku/plugn/releases/download/v0.3.0/plugn_0.3.0_linux_x86_64.tgz
SIGIL_URL ?= https://github.com/gliderlabs/sigil/releases/download/v0.4.0/sigil_0.4.0_Linux_x86_64.tgz
STACK_URL ?= https://github.com/gliderlabs/herokuish.git
@@ -26,7 +27,7 @@ endif
include common.mk
.PHONY: all apt-update install version copyfiles copyplugin man-db plugins dependencies sshcommand plugn docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku go-build
.PHONY: all apt-update install version copyfiles copyplugin man-db plugins dependencies sshcommand procfile-util plugn docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku go-build
include tests.mk
include deb.mk
@@ -109,13 +110,13 @@ else
echo $(DOKKU_VERSION) > ~dokku/VERSION
endif
plugin-dependencies: plugn
plugin-dependencies: plugn procfile-util
sudo -E dokku plugin:install-dependencies --core
plugins: plugn docker
plugins: plugn procfile-util docker
sudo -E dokku plugin:install --core
dependencies: apt-update sshcommand plugn docker help2man man-db sigil
dependencies: apt-update sshcommand plugn procfile-util docker help2man man-db sigil
$(MAKE) -e stack
apt-update:
@@ -132,6 +133,10 @@ sshcommand:
chmod +x /usr/local/bin/sshcommand
sshcommand create dokku /usr/local/bin/dokku
procfile-util:
wget -qO /tmp/procfile-util_latest.tgz ${PROCFILE_UTIL_URL}
tar xzf /tmp/procfile-util_latest.tgz -C /usr/local/bin
plugn:
wget -qO /tmp/plugn_latest.tgz ${PLUGN_URL}
tar xzf /tmp/plugn_latest.tgz -C /usr/local/bin

View File

@@ -1,5 +1,5 @@
# 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)
[![Build Status](https://img.shields.io/circleci/project/github/dokku/dokku.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)
@@ -88,9 +88,8 @@ Support us with a monthly donation and help us continue our activities. [[Become
A fresh VM running any of the following operating systems:
- Ubuntu 16.04 x64
- Ubuntu 14.04 x64
- Debian 8.2 x64
- Ubuntu x64 - Any currently supported release
- Debian 8.2+ x64
- CentOS 7 x64 *(experimental)*
- Arch Linux x64 *(experimental)*
@@ -99,8 +98,8 @@ A fresh VM running any of the following operating systems:
To install the latest stable release, run the following commands as a user who has access to `sudo`:
```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.12.10/bootstrap.sh
sudo DOKKU_TAG=v0.12.10 bash bootstrap.sh
wget https://raw.githubusercontent.com/dokku/dokku/v0.13.1/bootstrap.sh
sudo DOKKU_TAG=v0.13.1 bash bootstrap.sh
```
You can then proceed to the ip address or domain name associated with your server to complete the web-based installation.

View File

@@ -173,6 +173,7 @@ install-dokku-from-deb-package() {
[[ -n $DOKKU_HOSTNAME ]] && echo "dokku dokku/hostname string $DOKKU_HOSTNAME" | sudo debconf-set-selections
[[ -n $DOKKU_SKIP_KEY_FILE ]] && echo "dokku dokku/skip_key_file boolean $DOKKU_SKIP_KEY_FILE" | sudo debconf-set-selections
[[ -n $DOKKU_KEY_FILE ]] && echo "dokku dokku/key_file string $DOKKU_KEY_FILE" | sudo debconf-set-selections
[[ -n $DOKKU_NGINX_ENABLE ]] && echo "dokku dokku/nginx_enable string $DOKKU_NGINX_ENABLE" | sudo debconf-set-selections
if [[ -n $DOKKU_CHECKOUT ]]; then
# shellcheck disable=SC2086

51
contrib/copy-packages Normal file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env python2.7
import os
import requests
import shutil
import subprocess
from requests.auth import HTTPBasicAuth
PACKAGECLOUD_API_TOKEN = os.getenv('DOKKU_PACKAGECLOUD_API_TOKEN')
def download_file(filename, url):
r = requests.get(url, stream=True)
with open(filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
def upload_file(filename):
versions = [
"bionic",
]
cmd_template = "package_cloud push dokku/dokku/ubuntu/{0} {1}"
for version in versions:
cmd = cmd_template.format(version, filename)
subprocess.call(cmd, shell=True)
def main():
auth = HTTPBasicAuth(PACKAGECLOUD_API_TOKEN, '')
base = requests.get('https://packagecloud.io/api/v1/repos/dokku/dokku/packages/deb/ubuntu/trusty.json',
auth=auth)
data = base.json()
urls = []
for package in data:
urls.append(package['versions_url'])
download_urls = {}
for url in urls:
base = requests.get('https://packagecloud.io{0}'.format(url),
auth=auth)
data = base.json()
for version in data:
download_urls['downloads/' + version['filename']] = version['download_url']
for filename, download_url in download_urls.items():
print "downloading", filename
download_file(filename, download_url)
upload_file(filename)
if __name__ == "__main__":
main()

View File

@@ -10,7 +10,7 @@ import subprocess
import sys
import threading
VERSION = 'v0.12.10'
VERSION = 'v0.13.1'
hostname = ''
try:
@@ -120,6 +120,7 @@ class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
proc.stdin.close()
proc.wait()
set_debconf_selection('boolean', 'nginx_enable', 'true')
set_debconf_selection('boolean', 'skip_key_file', 'true')
set_debconf_selection('boolean', 'vhost_enable', vhost_enable)
set_debconf_selection('boolean', 'web_config', 'false')

2
deb.mk
View File

@@ -1,6 +1,6 @@
HEROKUISH_DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku'
HEROKUISH_REPO_NAME ?= gliderlabs/herokuish
HEROKUISH_VERSION ?= 0.4.2
HEROKUISH_VERSION ?= 0.4.5
HEROKUISH_ARCHITECTURE = amd64
HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb

1
debian/config vendored
View File

@@ -17,6 +17,7 @@ if [ $RET = "true" ]; then
exit 0
fi
db_input "high" "dokku/nginx_enable" || true
db_input "high" "dokku/hostname" || true
db_input "high" "dokku/vhost_enable" || true
if [ "$ACTION" != "reconfigure" ]; then

4
debian/control vendored
View File

@@ -1,9 +1,9 @@
Package: dokku
Version: 0.12.10
Version: 0.13.1
Section: web
Priority: optional
Architecture: amd64
Depends: locales, git, make, curl, gcc, man-db, netcat, sshcommand (>= 0.6.0), gliderlabs-sigil, docker-engine-cs (>= 1.7.1) | docker-engine (>= 1.7.1) | docker-io (>= 1.7.1) | docker-ce | docker-ee, net-tools, software-properties-common, python-software-properties | python3-software-properties, rsyslog
Depends: locales, git, make, curl, gcc, man-db, netcat, sshcommand (>= 0.6.0), gliderlabs-sigil, docker-engine-cs (>= 1.7.1) | docker-engine (>= 1.7.1) | docker-io (>= 1.7.1) | docker.io (>= 1.7.1) | docker-ce | docker-ee, net-tools, software-properties-common, procfile-util, python-software-properties | python3-software-properties, rsyslog
Recommends: herokuish (>= 0.3.4), parallel, dokku-update
Pre-Depends: nginx (>= 1.8.0) | openresty, dnsutils, cgroupfs-mount | cgroup-lite, plugn (>= 0.3.0), sudo, python2.7, debconf
Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>

6
debian/postinst vendored
View File

@@ -59,9 +59,13 @@ case "$1" in
fi
done
db_get "dokku/nginx_enable"
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
if [ "$plugin" = "nginx-vhosts" ] && [ "$RET" = "false" ]; then
echo "Skipping enable of nginx-vhosts plugin"
continue
elif [ ! -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

5
debian/postrm vendored
View File

@@ -21,7 +21,10 @@ main() {
rm -f /etc/systemd/system/dokku-redeploy.service
rm -f /etc/update-motd.d/99-dokku
(nginx -t && service nginx reload) || true
db_get "dokku/nginx_enable"
if [ "$RET" = "true" ]; then
(nginx -t && service nginx reload) || true
fi
if [[ "$1" == "purge" ]]; then
rm -f /etc/nginx/conf.d/dokku.conf

5
debian/templates vendored
View File

@@ -22,3 +22,8 @@ Template: dokku/key_file
Description: Keyfile for initial user:
Type: string
Default: /root/.ssh/id_rsa.pub
Template: dokku/nginx_enable
Description: Enable nginx-vhosts plugin?
Type: boolean
Default: true

View File

@@ -39,11 +39,11 @@ 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.
Once you have mounted persistent storage, you will also need to restart the application. See the
Once you have mounted persistent storage, you will also need to restart the application. See the
[process scaling documentation](/docs/deployment/process-management.md) for more information.
```shell
dokku ps:rebuild app-name
dokku ps:restart 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.
@@ -132,7 +132,7 @@ Your app may have services that are running in memory and need to be backed up l
By default, Dokku will only bind storage mounts during the deploy and run phases. Under certain conditions, one might want to bind a storage mount during the build phase. This can be accomplished by using the `docker-options` plugin directly.
```shell
dokku docker-options:add <app> build "-v /tmp/python-test:/opt/test"
dokku docker-options:add node-js-app build "-v /tmp/python-test:/opt/test"
```
You cannot use mounted volumes during the build phase of a Dockerfile deploy. This is because Docker does not support volumes when executing `docker build`.
@@ -147,4 +147,4 @@ By default, Dokku will execute your buildpack application processes as the `hero
> NOTE: this user must exist in your herokuish image.
Additionally, Dokku will ensure your storage mounts are owned by either `herokuishuser` or the overridden value you have set in `DOKKU_APP_USER`.
Additionally, the default `docker-local` scheduler that comes with Dokku will ensure your storage mounts are owned by either `herokuishuser` or the overridden value you have set in `DOKKU_APP_USER`. See the [scheduler-docker-local documentation](/docs/advanced-usage/schedulers/docker-local.md#disabling-chown-of-persistent-storage) docs for more information.

View File

@@ -31,31 +31,31 @@ dokku plugin
```
plugn: dev
00_dokku-standard 0.12.10 enabled dokku core standard plugin
20_events 0.12.10 enabled dokku core events logging plugin
apps 0.12.10 enabled dokku core apps plugin
build-env 0.12.10 enabled dokku core build-env plugin
certs 0.12.10 enabled dokku core certificate management plugin
checks 0.12.10 enabled dokku core checks plugin
common 0.12.10 enabled dokku core common plugin
config 0.12.10 enabled dokku core config plugin
docker-options 0.12.10 enabled dokku core docker-options plugin
domains 0.12.10 enabled dokku core domains plugin
enter 0.12.10 enabled dokku core enter plugin
git 0.12.10 enabled dokku core git plugin
logs 0.12.10 enabled dokku core logs plugin
named-containers 0.12.10 enabled dokku core named containers plugin
network 0.12.10 enabled dokku core network plugin
nginx-vhosts 0.12.10 enabled dokku core nginx-vhosts plugin
plugin 0.12.10 enabled dokku core plugin plugin
proxy 0.12.10 enabled dokku core proxy plugin
ps 0.12.10 enabled dokku core ps plugin
repo 0.12.10 enabled dokku core repo plugin
shell 0.12.10 enabled dokku core shell plugin
ssh-keys 0.12.10 enabled dokku core ssh-keys plugin
storage 0.12.10 enabled dokku core storage plugin
tags 0.12.10 enabled dokku core tags plugin
tar 0.12.10 enabled dokku core tar plugin
00_dokku-standard 0.13.1 enabled dokku core standard plugin
20_events 0.13.1 enabled dokku core events logging plugin
apps 0.13.1 enabled dokku core apps plugin
build-env 0.13.1 enabled dokku core build-env plugin
certs 0.13.1 enabled dokku core certificate management plugin
checks 0.13.1 enabled dokku core checks plugin
common 0.13.1 enabled dokku core common plugin
config 0.13.1 enabled dokku core config plugin
docker-options 0.13.1 enabled dokku core docker-options plugin
domains 0.13.1 enabled dokku core domains plugin
enter 0.13.1 enabled dokku core enter plugin
git 0.13.1 enabled dokku core git plugin
logs 0.13.1 enabled dokku core logs plugin
named-containers 0.13.1 enabled dokku core named containers plugin
network 0.13.1 enabled dokku core network plugin
nginx-vhosts 0.13.1 enabled dokku core nginx-vhosts plugin
plugin 0.13.1 enabled dokku core plugin plugin
proxy 0.13.1 enabled dokku core proxy plugin
ps 0.13.1 enabled dokku core ps plugin
repo 0.13.1 enabled dokku core repo plugin
shell 0.13.1 enabled dokku core shell plugin
ssh-keys 0.13.1 enabled dokku core ssh-keys plugin
storage 0.13.1 enabled dokku core storage plugin
tags 0.13.1 enabled dokku core tags plugin
tar 0.13.1 enabled dokku core tar plugin
```
Installing a plugin is easy as well using the `plugin:install` command. This command will also trigger the `install` pluginhook on all existing plugins.

View File

@@ -1,5 +1,12 @@
# Docker Local Scheduler
> Subcommands new as of 0.12.12
```
scheduler-docker-local:report [<app>] [<flag>] # Displays a scheduler-docker-local report for one or more apps
scheduler-docker-local:set <app> <key> (<value>) # Set or clear a scheduler-docker-local property for an app
```
> New as of 0.12.0
Dokku natively includes functionality to manage application lifecycles for a single server using the `scheduler-docker-local` plugin. It is the default scheduler, but as with all schedulers, it is set on a per-application basis. The scheduler can currently be overridden by running the following command:
@@ -14,6 +21,22 @@ As it is the default, unsetting the `DOCKER_SCHEDULER` config variable is also a
dokku config:unset node-js-app DOCKER_SCHEDULER
```
## Usage
### Disabling chown of persistent storage
The `scheduler-docker-local` plugin will ensure your storage mounts are owned by either `herokuishuser` or the overridden value you have set in `DOKKU_APP_USER`. You may disable this by running the following `scheduler-docker-local:set` command for your application:
```shell
dokku scheduler-docker-local:set node-js-app disable-chown true
```
Once set, you may re-enable it by setting a blank value for `disable-chown`:
```shell
dokku scheduler-docker-local:set node-js-app disable-chown
```
## Implemented Triggers
This plugin implements various functionality through `plugn` triggers to integrate with Docker for running apps on a single server. The following functionality is supported by the `scheduler-docker-local` plugin.
@@ -25,7 +48,8 @@ This plugin implements various functionality through `plugn` triggers to integra
- `pre-restore`
- `scheduler-deploy`
- `scheduler-docker-cleanup`
- `scheduler-logs-failed`
- `scheduler-run`
- `scheduler-stop`
- `scheduler-tags-create`
- `scheduler-tags-destroy`
- `scheduler-tags-destroy`

View File

@@ -2,10 +2,10 @@
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/mstile-70x70.png"/>
<square150x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/mstile-150x150.png"/>
<square310x310logo src="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/mstile-310x310.png"/>
<wide310x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/mstile-310x150.png"/>
<square70x70logo src="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/mstile-70x70.png"/>
<square150x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/mstile-150x150.png"/>
<square310x310logo src="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/mstile-310x310.png"/>
<wide310x150logo src="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/mstile-310x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>

View File

@@ -2,37 +2,37 @@
"name": "Dokku",
"icons": [
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.12.10\/docs\/assets\/favicons\/android-chrome-36x36.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.13.1\/docs\/assets\/favicons\/android-chrome-36x36.png",
"sizes": "36x36",
"type": "image\/png",
"density": "0.75"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.12.10\/docs\/assets\/favicons\/android-chrome-48x48.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.13.1\/docs\/assets\/favicons\/android-chrome-48x48.png",
"sizes": "48x48",
"type": "image\/png",
"density": "1.0"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.12.10\/docs\/assets\/favicons\/android-chrome-72x72.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.13.1\/docs\/assets\/favicons\/android-chrome-72x72.png",
"sizes": "72x72",
"type": "image\/png",
"density": "1.5"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.12.10\/docs\/assets\/favicons\/android-chrome-96x96.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.13.1\/docs\/assets\/favicons\/android-chrome-96x96.png",
"sizes": "96x96",
"type": "image\/png",
"density": "2.0"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.12.10\/docs\/assets\/favicons\/android-chrome-144x144.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.13.1\/docs\/assets\/favicons\/android-chrome-144x144.png",
"sizes": "144x144",
"type": "image\/png",
"density": "3.0"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.12.10\/docs\/assets\/favicons\/android-chrome-192x192.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.13.1\/docs\/assets\/favicons\/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image\/png",
"density": "4.0"

View File

@@ -39,13 +39,13 @@ h1 {
font-size: 1.6em;
}
.header .navbar-brand a {
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/dokku.png);
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/dokku.png);
text-indent: 40px;
}
.blurb {
color: #424242;
background-color: #ededed;
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/gplaypattern.png);
background-image: url(https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/gplaypattern.png);
padding: 45px 0;
text-align: center;
}

View File

@@ -9,6 +9,7 @@
"0.9.4",
"0.10.5",
"0.11.6",
"0.12.10"
"0.12.13",
"0.13.1"
]
}

View File

@@ -13,8 +13,9 @@ config:export (<app>|--global) [--envfile]
config:keys (<app>|--global) [--merged] Show keys set in environment
config:bundle (<app>|--global) [--merged] Bundle environment into tarfile
```
> For security reasons - and as per [docker recommendations](https://github.com/docker/docker/issues/13490) - Dockerfile-based deploys have variables available *only* during runtime, as noted in [this issue](https://github.com/dokku/dokku/issues/1860).
The variables are available both at run time and during the application build/compilation step for buildpack-based deploys. For security reasons - and as per [docker recommendations](https://github.com/docker/docker/issues/13490) - Dockerfile-based deploys have variables available *only* during runtime, as noted in [this issue](https://github.com/dokku/dokku/issues/1860).
Environment variables are available both at run time and during the application build/compilation step for buildpack-based deploys.
For buildpack deploys, Dokku will create a `/app/.env` file that can be used for legacy buildpacks. Note that this is *not* updated when `config:set` or `config:unset` is called, and is only written during a `deploy` or `ps:rebuild`. Developers are encouraged to instead read from the application environment directly, as the proper values will be available then.

View File

@@ -75,6 +75,16 @@ Your `nginx.conf` file - not to be confused with Dokku's `nginx.conf.sigil` - wo
Please adjust the `Procfile` and `nginx.conf` file as appropriate.
## Custom Error Pages
By default, Dokku provides custom error pages for the following three categories of errors:
- 4xx: For all non-404 errors with a 4xx response code.
- 404: For "404 Not Found" errors.
- 5xx: For all 5xx error responses
These are provided as an alternative to the generic Nginx error page, are shared for _all_ applications, and their contents are located on disk at `/var/lib/dokku/data/nginx-vhosts/dokku-errors`. To customize them for a specific app, create a custom `nginx.conf.sigil` as described above and change the paths to point elsewhere.
## Domains plugin
See the [domain configuration documentation](/docs/configuration/domains.md).

View File

@@ -1,5 +1,8 @@
# Deploying to Dokku
> Note: This document uses the hostname `dokku.me` in commands. For your server please
> substitute your server's hostname instead.
## Deploy tutorial
Once Dokku has been configured with at least one user, applications can be deployed via a `git push` command. To quickly see Dokku deployment in action, you can use the Heroku Ruby on Rails example app.
@@ -63,6 +66,10 @@ git push dokku master
> the upstream with the scheme `ssh://` like so: `ssh://dokku@dokku.me:ruby-rails-sample`
> Please see the [Git](https://git-scm.com/docs/git-clone#_git_urls_a_id_urls_a) documentation for more details.
> Note: Your private key should be registered with ssh-agent in local development. If you get a
> permission denied error when pushing you can register your private key by running
> `ssh-add -k ~/<your private key>`.
```
Counting objects: 231, done.
Delta compression using up to 8 threads.

View File

@@ -8,10 +8,11 @@ apps:create <app> # Create a new app
apps:destroy <app> # Permanently destroy an app
apps:exists <app> # Checks if an app exists
apps:list # List your apps
apps:lock # Creates a '.deploy.lock' file in an application's repo
apps:lock <app> # Locks an app for deployment
apps:locked <app> # Checks if an app is locked for deployment
apps:rename <old-app> <new-app> # Rename an app
apps:report [<app>] [<flag>] # Display report about an app
apps:unlock # Removes the '.deploy.lock' file from an application's repo
apps:unlock <app> # Unlocks an app for deployment
```
## Usage
@@ -193,10 +194,25 @@ dokku apps:unlock node-js-app
```
! A deploy may be in progress.
! Removing the application lock will not stop in progress deploys.
! Removing the app lock will not stop in progress deploys.
-----> Deploy lock removed.
```
### Checking lock status
> New as of 0.13.0
In some cases, you may wish to inspect the state of an app lock. To do so, you can issue an `apps:lock` command. This will exit non-zero if there is no app lock in place.
```shell
dokku apps:locked node-js-app
```
```
Deploy lock does not exist
```
### Displaying reports about an app
> New as of 0.8.1

View File

@@ -1,19 +1,21 @@
# Log Management
```
logs <app> # display recent log output
logs <app> [-h] [-t] [-n num] [-q] [-p process] # Display recent log output
logs:failed [<app>] # Shows the last failed deploy logs
```
## Usage
### Application Logs
You can easily get logs of an application using the `logs` command:
### App Logs
You can easily get logs of an app using the `logs` command:
```shell
dokku logs node-js-app
```
## Behavioral modifiers
#### Behavioral modifiers
Dokku also supports certain command-line arguments that augment the `log` command's behavior.
@@ -26,8 +28,25 @@ Dokku also supports certain command-line arguments that augment the `log` comman
You can use these modifiers as follows:
```shell
dokku logs node-js-app -t -p web
```
will show logs continually from the web process.
### Failed Deploy Logs
> Warning: The default `docker-local` scheduler will "store" these until the next deploy or until the old containers are garbage collected - whichever runs first. If you require the logs beyond this point in time, please ship the logs to a centralized log server.
In some cases, it may be useful to retrieve the logs from a previously failed deploy.
You can retrieve these logs by using the `logs:failed` command
```shell
dokku logs:failed node-js-app
```
You can also retrieve the failed logs for each app:
```shell
dokku logs:failed node-js-app
```

View File

@@ -51,7 +51,7 @@ dokku git:set --global deploy-branch SOME_BRANCH_NAME
dokku git:set node-js-app deploy-branch SOME_BRANCH_NAME
```
Pushing multiple branches can also be supportec by creating a [receive-branch](/docs/development/plugin-triggers.md#receive-branch) plugin trigger in a custom plugin.
Pushing multiple branches can also be supported by creating a [receive-branch](/docs/development/plugin-triggers.md#receive-branch) plugin trigger in a custom plugin.
### Configuring the GIT_REV Environment Variable

View File

@@ -4,6 +4,7 @@
```
ps <app> # List processes running in app container(s)
ps:inspect <app> # Displays a sanitized version of docker inspect for an app
ps:rebuild <app> # Rebuild an app from source
ps:rebuildall # Rebuild all apps from source
ps:report [<app>] [<flag>] # Displays a process report for one or more apps
@@ -32,6 +33,18 @@ To find out if your application's containers are running the commands you expect
dokku ps node-js-app
```
### Inspecting app containers
> New as of 0.13.0
A common administrative task to perform is calling `docker inspect` on the containers that are running for an application. This can be an error-prone task to perform, and may also reveal sensitive environment variables if not done correctly. Dokku provides a wrapper around this command via the `ps:inspect` subcommand:
```shell
dokku ps:inspect node-js-app
```
This command will gather all the running container IDs for your application and call `docker inspect`, sanitizing the output data so it can be copy-pasted elsewhere safely.
### 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 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`

View File

@@ -373,6 +373,21 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `network-clear-config`
- Description: Clears network configuration
- Invoked by: `internally triggered by proxy-clear-config within proxy implementations`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `network-compute-ports`
- Description: Computes the ports for a given app container
@@ -1040,6 +1055,21 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `proxy-clear-config`
- Description: Clears the proxy implementation configuration for a given app
- Invoked by: `internally triggered by apps:rename`
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `proxy-enable`
- Description: Enables the configured proxy implementation for an app
@@ -1147,9 +1177,12 @@ APP="$1";
### `scheduler-deploy`
> Warning: The scheduler plugin trigger apis are under development and may change
> between minor releases until the 1.0 release.
- Description: Allows you to run scheduler commands when an app is deployed
- Invoked by: `dokku deploy`
- Arguments: `$DOKKU_SCHEDULER APP IMAGE_TAG`
- Arguments: `$DOKKU_SCHEDULER $APP $IMAGE_TAG`
- Example:
```shell
@@ -1163,9 +1196,12 @@ DOKKU_SCHEDULER="$1"; APP="$2"; IMAGE_TAG="$3";
### `scheduler-docker-cleanup`
> Warning: The scheduler plugin trigger apis are under development and may change
> between minor releases until the 1.0 release.
- Description: Allows you to run scheduler commands when dokku cleanup is invoked
- Invoked by: `dokku deploy, dokku cleanup`
- Arguments: `$DOKKU_SCHEDULER APP FORCE_CLEANUP`
- Arguments: `$DOKKU_SCHEDULER $APP $FORCE_CLEANUP`
- Example:
```shell
@@ -1177,11 +1213,52 @@ DOKKU_SCHEDULER="$1"; APP="$2"; FORCE_CLEANUP="$3";
# TODO
```
### `scheduler-inspect`
> Warning: The scheduler plugin trigger apis are under development and may change
> between minor releases until the 1.0 release.
- Description: Allows you to run inspect commands for all containers for a given app
- Invoked by: `dokku ps:inspect`
- Arguments: `$DOKKU_SCHEDULER $APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
DOKKU_SCHEDULER="$1"; APP="$2";
# TODO
```
### `scheduler-logs-failed`
> Warning: The scheduler plugin trigger apis are under development and may change
> between minor releases until the 1.0 release.
- Description: Allows you to run scheduler commands when retrieving failed container logs
- Invoked by: `dokku logs:failed`
- Arguments: `$DOKKU_SCHEDULER $APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
DOKKU_SCHEDULER="$1"; APP="$2"; ARGS="${@:3}";
# TODO
```
### `scheduler-run`
> Warning: The scheduler plugin trigger apis are under development and may change
> between minor releases until the 1.0 release.
- Description: Allows you to run scheduler commands when a command is executed for your app
- Invoked by: `dokku run`
- Arguments: `$DOKKU_SCHEDULER APP ...ARGS`
- Arguments: `$DOKKU_SCHEDULER $APP ...ARGS`
- Example:
```shell
@@ -1195,9 +1272,12 @@ DOKKU_SCHEDULER="$1"; APP="$2"; ARGS="${@:3}";
### `scheduler-stop`
> Warning: The scheduler plugin trigger apis are under development and may change
> between minor releases until the 1.0 release.
- Description: Allows you to run scheduler commands when a tag is destroyed
- Invoked by: `dokku apps:destroy, dokku ps:stop`
- Arguments: `$DOKKU_SCHEDULER APP REMOVE_CONTAINERS`
- Arguments: `$DOKKU_SCHEDULER $APP $REMOVE_CONTAINERS`
- Example:
```shell
@@ -1211,9 +1291,12 @@ DOKKU_SCHEDULER="$1"; APP="$2"; REMOVE_CONTAINERS="$3";
### `scheduler-tags-create`
> Warning: The scheduler plugin trigger apis are under development and may change
> between minor releases until the 1.0 release.
- Description: Allows you to run scheduler commands when a tag is created
- Invoked by: `dokku tags:create`
- Arguments: `$DOKKU_SCHEDULER APP SOURCE_IMAGE TARGET_IMAGE`
- Arguments: `$DOKKU_SCHEDULER $APP $SOURCE_IMAGE $TARGET_IMAGE`
- Example:
```shell
@@ -1227,9 +1310,12 @@ DOKKU_SCHEDULER="$1" APP="$2" SOURCE_IMAGE="$3" TARGET_IMAGE="$4"
### `scheduler-tags-destroy`
> Warning: The scheduler plugin trigger apis are under development and may change
> between minor releases until the 1.0 release.
- Description: Allows you to run scheduler commands when a tag is destroyed
- Invoked by: `dokku tags:destroy`
- Arguments: `$DOKKU_SCHEDULER APP IMAGE_REPO IMAGE_TAG`
- Arguments: `$DOKKU_SCHEDULER $APP $IMAGE_REPO $IMAGE_TAG`
- Example:
```shell

View File

@@ -30,7 +30,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.12.10-2 (Mon Feb 22 23:20:37 CET 2016)"
# wait for "==> build-arch: ==> Finished making: dokku 0.13.1-2 (Mon Feb 22 23:20:37 CET 2016)"
cd ../dokku-arch
git add PKGBUILD .SRCINFO
git commit -m 'Update to dokku 0.9.9'

View File

@@ -62,7 +62,7 @@ Follow the [user management documentation](/docs/deployment/user-management.md)
## VMs with less than 1GB of memory
Having less than 1GB of system memory available for Dokku and its containers, for example Digital Ocean's small 512MB machines, might result in unexpected errors, such as **! [remote rejected] master -> master (pre-receive hook declined)** during installation of NPM dependencies (https://github.com/npm/npm/issues/3867).
Having less than 1GB of system memory available for Dokku and its containers may result in unexpected errors, such as **! [remote rejected] master -> master (pre-receive hook declined)** during installation of NPM dependencies (https://github.com/npm/npm/issues/3867).
To work around this issue, it might suffice to augment the linux swap file size to a maximum of twice the physical memory size.
@@ -80,4 +80,5 @@ free
echo "/var/swap.img none swap sw 0 0" >> /etc/fstab
```
Reference: https://www.digitalocean.com/community/tutorials/how-to-configure-virtual-memory-swap-file-on-a-vps
[Reference](https://www.digitalocean.com/community/tutorials/how-to-configure-virtual-memory-swap-file-on-a-vps)

View File

@@ -41,3 +41,4 @@ After setting the desired options, proceed with the installation as described ab
| dokku/hostname | string | dokku.me | Hostname, used as vhost domain and for showing app URL after deploy |
| dokku/skip_key_file| boolean | false | Don't check for the existence of the dokku/key_file. Warning: Setting this to true, will require you to manually add an SSH key later on. |
| dokku/key_file | string | /root/.ssh/id_rsa.pub | Path on disk to an SSH key to add to the Dokku user (Will be ignored on `dpkg-reconfigure`) |
| dokku/nginx_enable | boolean | true | Enable nginx-vhosts plugin |

View File

@@ -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.12.10/bootstrap.sh;
sudo DOKKU_TAG=v0.12.10 bash bootstrap.sh
wget https://raw.githubusercontent.com/dokku/dokku/v0.13.1/bootstrap.sh;
sudo DOKKU_TAG=v0.13.1 bash bootstrap.sh
```
The installation process takes about 5-10 minutes, depending upon internet connection speed.

View File

@@ -10,30 +10,30 @@
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
<title>Dokku - The smallest PaaS implementation you've ever seen</title>
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/favicon.ico">
<meta name="apple-mobile-web-app-title" content="Dokku">
<meta name="application-name" content="Dokku">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/browserconfig.xml">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/style.css" rel="stylesheet">
<link href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/style.css" rel="stylesheet">
<!-- <link href="/dokku/docs/assets/style.css" rel="stylesheet"> -->
<style>
</style>
@@ -98,12 +98,12 @@
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.12.10/bootstrap.sh</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.13.1/bootstrap.sh</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">sudo DOKKU_TAG=v0.12.10 bash bootstrap.sh</span>
<span class="command">sudo DOKKU_TAG=v0.13.1 bash bootstrap.sh</span>
</p>
<p class="line">
<span class="output">&nbsp;# go to your server's IP and follow the web installer</span>
@@ -269,7 +269,7 @@
<div class="container">
<footer>
<p>&copy; 2013-2017 Dokku</p>
<p>&copy; 2013-2018 Dokku</p>
</footer>
</div>
<script>

View File

@@ -9,26 +9,26 @@
<meta name="author" content="">
<title>Dokku - The smallest PaaS implementation you've ever seen</title>
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/favicon.ico">
<meta name="apple-mobile-web-app-title" content="Dokku">
<meta name="application-name" content="Dokku">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/favicons/browserconfig.xml">
<meta name="msapplication-TileImage" content="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<script>
@@ -42,7 +42,7 @@
</script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.rawgit.com/dokku/dokku/v0.12.10/docs/assets/style.css" rel="stylesheet">
<link href="https://cdn.rawgit.com/dokku/dokku/v0.13.1/docs/assets/style.css" rel="stylesheet">
<!-- <link href="/dokku/docs/assets/style.css" rel="stylesheet"> -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">
<style>

2
dokku
View File

@@ -42,6 +42,8 @@ export PLUGIN_ENABLED_PATH=${PLUGIN_ENABLED_PATH:="$PLUGIN_PATH/enabled"}
export PLUGIN_CORE_PATH=${PLUGIN_CORE_PATH:="$DOKKU_LIB_ROOT/core-plugins"}
export PLUGIN_CORE_AVAILABLE_PATH=${PLUGIN_CORE_AVAILABLE_PATH:="$PLUGIN_CORE_PATH/available"}
export PLUGIN_CORE_ENABLED_PATH=${PLUGIN_CORE_ENABLED_PATH:="$PLUGIN_CORE_PATH/enabled"}
export DOKKU_SYSTEM_GROUP=${DOKKU_SYSTEM_GROUP:="dokku"}
export DOKKU_SYSTEM_USER=${DOKKU_SYSTEM_USER:="dokku"}
export DOKKU_API_VERSION=1
export DOKKU_NOT_IMPLEMENTED_EXIT=10

View File

@@ -44,6 +44,15 @@ execute_script() {
COMMAND+=" rm -rf /tmp/cache ; "
COMMAND+=" ln -sf /cache /tmp/cache ; "
COMMAND+=" fi ; "
if [[ "$SCRIPT_CMD" == /* ]]; then
local SCRIPT_BIN="$(echo "$SCRIPT_CMD" | cut -d' ' -f1)"
COMMAND+=" if [[ ! -x \"$SCRIPT_BIN\" ]]; then "
COMMAND+=" echo specified binary is not executable ; "
COMMAND+=" exit 1 ; "
COMMAND+=" fi "
fi
COMMAND+=" $SCRIPT_CMD || exit 1;"
COMMAND+=" if [[ -d '/cache' ]]; then "
COMMAND+=" echo removing installation cache... ; "

View File

@@ -9,7 +9,7 @@ if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
[[ $(dig +short "$(< "$DOKKU_ROOT/HOSTNAME")") ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
fi
dokku_path=$(which dokku)
dokku_path="$(which dokku)"
# temporary hack for https://github.com/dokku/dokku/issues/82
# redeploys all apps after a reboot

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core standard plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -9,7 +9,7 @@ dokku_run_cmd() {
verify_app_name "$APP"
shift 2
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
plugn trigger scheduler-run "$DOKKU_SCHEDULER" "$APP" "$@"
}

View File

@@ -0,0 +1 @@
hook

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core events logging plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -0,0 +1 @@
hook

View File

@@ -36,7 +36,7 @@ apps_destroy() {
echo "Destroying $APP (including all add-ons)"
plugn trigger pre-delete "$APP" "$IMAGE_TAG"
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
local REMOVE_CONTAINERS="true"
plugn trigger scheduler-stop "$DOKKU_SCHEDULER" "$APP" "$REMOVE_CONTAINERS"
plugn trigger post-delete "$APP" "$IMAGE_TAG"
@@ -63,4 +63,4 @@ apps_maybe_create() {
suppress_output apps_create "$APP"
fi
fi
}
}

View File

@@ -85,10 +85,11 @@ apps_help_content_func() {
apps:create <app>, Create a new app
apps:destroy <app>, Permanently destroy an app
apps:list, List your apps
apps:lock <app>, Creates a '.deploy.lock' file in an application's repo
apps:lock <app>, Locks an app for deployment
apps:locked <app>, Checks if an app is locked for deployment
apps:rename <old-app> <new-app>, Rename an app
apps:report [<app>] [<flag>], Display report about an app
apps:unlock <app>, Removes the '.deploy.lock' file from an application's repo
apps:unlock <app>, Unlocks an app for deployment
help_content
}
@@ -137,4 +138,4 @@ apps_is_locked() {
fi
echo "$LOCKED"
}
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core apps plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -4,7 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
apps_lock_cmd() {
declare desc="creates a '.deploy.lock' file in an application's repo"
declare desc="locks an app for deployment"
declare cmd="apps:lock"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"; verify_app_name "$APP"

20
plugins/apps/subcommands/locked Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
apps_locked_cmd() {
declare desc="checks if an app is locked for deployment"
declare cmd="apps:locked"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"; verify_app_name "$APP"
local LOCKED="$(apps_is_locked "$APP")"
if [[ "$LOCKED" != "true" ]] ; then
dokku_log_fail_quiet "Deploy lock does not exist"
fi
dokku_log_quiet "Deploy lock exists"
}
apps_locked_cmd "$@"

View File

@@ -14,12 +14,13 @@ apps_rename_cmd() {
local OLD_CACHE_DIR="$DOKKU_ROOT/$OLD_APP/cache"
local OLD_CACHE_HOST_DIR="$DOKKU_HOST_ROOT/$OLD_APP/cache"
if [[ -d "$OLD_CACHE_DIR" ]] && ! rmdir "$OLD_CACHE_DIR"; then
if [[ -d "$OLD_CACHE_DIR" ]] && ! rmdir "$OLD_CACHE_DIR" > /dev/null 2>&1; then
docker run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$OLD_CACHE_HOST_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"
plugn trigger proxy-clear-config "$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"
[[ -f "$DOKKU_ROOT/$NEW_APP/VHOST" ]] && sed -i -e "s/$OLD_APP/$NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/VHOST"

View File

@@ -4,19 +4,19 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
apps_unlock_cmd() {
declare desc="removes the '.deploy.lock' file from an application's repo"
declare desc="unlocks an app for deployment"
declare cmd="apps:unlock"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"; verify_app_name "$APP"
if [[ -f "$DOKKU_ROOT/$APP/.deploy.lock" ]]; then
dokku_log_warn "A deploy may be in progress."
dokku_log_warn "Removing the application lock will not stop in progress deploys."
dokku_log_warn "Removing the app lock will not stop in progress deploys."
fi
rm -f "$DOKKU_ROOT/$APP/.deploy.lock" || dokku_log_fail "Unable to remove deploy lock"
dokku_log_info1 "Deploy lock removed."
dokku_log_info1 "Deploy lock removed"
}
apps_unlock_cmd "$@"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core build-env plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core certificate management plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core checks plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -37,8 +37,6 @@ dokku_log_info1_quiet() {
declare desc="log info1 formatter (with quiet option)"
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
echo "-----> $*"
else
return 0
fi
}
@@ -46,8 +44,6 @@ dokku_log_info2_quiet() {
declare desc="log info2 formatter (with quiet option)"
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
echo "=====> $*"
else
return 0
fi
}
@@ -60,8 +56,6 @@ dokku_col_log_info1_quiet() {
declare desc="columnar log info1 formatter (with quiet option)"
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
printf "%-6s %-18s %-25s %-25s %-25s\n" "----->" "$@"
else
return 0
fi
}
@@ -74,8 +68,6 @@ dokku_col_log_info2_quiet() {
declare desc="columnar log info2 formatter (with quiet option)"
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
printf "%-6s %-18s %-25s %-25s %-25s\n" "=====>" "$@"
else
return 0
fi
}
@@ -88,8 +80,6 @@ dokku_col_log_msg_quiet() {
declare desc="columnar log formatter (with quiet option)"
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
printf "%-25s %-25s %-25s %-25s\n" "$@"
else
return 0
fi
}
@@ -97,8 +87,6 @@ dokku_log_verbose_quiet() {
declare desc="log verbose formatter (with quiet option)"
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
echo " $*"
else
return 0
fi
}
@@ -107,11 +95,26 @@ dokku_log_verbose() {
echo " $*"
}
dokku_log_warn_quiet() {
declare desc="log warning formatter"
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
echo " ! $*" 1>&2
fi
}
dokku_log_warn() {
declare desc="log warning formatter"
echo " ! $*" 1>&2
}
dokku_log_fail_quiet() {
declare desc="log fail formatter"
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
echo "$@" 1>&2
fi
exit 1
}
dokku_log_fail() {
declare desc="log fail formatter"
echo "$@" 1>&2
@@ -221,6 +224,22 @@ get_app_image_name() {
echo "$IMAGE"
}
get_app_scheduler() {
declare desc="fetch the scheduler for a given application"
declare APP="$1"
local DOKKU_SCHEDULER
DOKKU_APP_SCHEDULER="$(config_get "$APP" DOKKU_SCHEDULER || true)"
DOKKU_GLOBAL_SCHEDULER="$(config_get --global DOKKU_SCHEDULER || true)"
DOKKU_SCHEDULER=${DOKKU_APP_SCHEDULER:="$DOKKU_GLOBAL_SCHEDULER"}
if [[ -z "$DOKKU_SCHEDULER" ]]; then
DOKKU_SCHEDULER="docker-local"
fi
echo "$DOKKU_SCHEDULER"
}
get_running_image_tag() {
declare desc="retrieve current image tag for a given app. returns empty string if no deployed containers are found"
local APP="$1"
@@ -309,7 +328,7 @@ copy_from_image() {
[[ -z "$WORKDIR" ]] && local WORKDIR=/app
local SRC_FILE="$WORKDIR/$SRC_FILE"
fi
local CID=$(docker run "$DOKKU_GLOBAL_RUN_ARGS" -d "$IMAGE" bash)
local CID=$(docker create "$DOKKU_GLOBAL_RUN_ARGS" "$IMAGE")
docker cp "$CID:$SRC_FILE" "$DST_DIR"
docker rm -f "$CID" &> /dev/null
else
@@ -376,25 +395,6 @@ get_app_running_container_types() {
echo "$CONTAINER_TYPES"
}
get_cmd_from_procfile() {
declare desc="parse cmd from app Procfile"
local APP=$1; local PROC_TYPE=$2; local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
verify_app_name "$APP"
if [[ -f $DOKKU_PROCFILE ]]; then
local line; local name; local command
while read -r line || [[ -n "$line" ]]; do
if [[ -z "$line" ]] || [[ "$line" == "#"* ]]; then
continue
fi
line=$(strip_inline_comments "$line")
name="${line%%:*}"
command="${line#*:[[:space:]]}"
[[ "$name" == "$PROC_TYPE" ]] && echo "$command" && break
done < "$DOKKU_PROCFILE"
fi
}
is_deployed() {
declare desc="return 0 if given app has a running container"
local APP="$1"
@@ -559,7 +559,7 @@ dokku_deploy_cmd() {
declare APP="$1" IMAGE_TAG="$2"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
plugn trigger scheduler-deploy "$DOKKU_SCHEDULER" "$APP" "$IMAGE_TAG"
}
@@ -633,8 +633,7 @@ docker_cleanup() {
fi
dokku_log_info1 "Cleaning up..."
local DOKKU_SCHEDULER="docker-local"
[[ -n "$APP" ]] && DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
plugn trigger scheduler-docker-cleanup "$DOKKU_SCHEDULER" "$APP" "$FORCE_CLEANUP"
# delete all non-running containers
@@ -947,15 +946,30 @@ acquire_app_deploy_lock() {
declare desc="acquire advisory lock for use in git/tar deploys"
local APP="$1"; verify_app_name "$APP"
local LOCK_TYPE="${2:-waiting}"
local APP_DEPLOY_LOCK_FD="200"
local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"
local LOCK_WAITING_MSG="$APP currently has a deploy lock in place. Waiting..."
local LOCK_FAILED_MSG="$APP currently has a deploy lock in place. Exiting..."
acquire_advisory_lock "$APP_DEPLOY_LOCK_FILE" "$LOCK_TYPE" "$LOCK_WAITING_MSG" "$LOCK_FAILED_MSG"
}
release_app_deploy_lock() {
declare desc="release advisory lock used in git/tar deploys"
local APP="$1"; verify_app_name "$APP"
local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"
release_advisory_lock "$APP_DEPLOY_LOCK_FILE"
}
acquire_advisory_lock() {
declare desc="acquire advisory lock"
local LOCK_FILE="$1" LOCK_TYPE="$2" LOCK_WAITING_MSG="$3" LOCK_FAILED_MSG="$4"
local LOCK_FD="200"
local SHOW_MSG=true
eval "exec $APP_DEPLOY_LOCK_FD>$APP_DEPLOY_LOCK_FILE"
eval "exec $LOCK_FD>$LOCK_FILE"
if [[ "$LOCK_TYPE" == "waiting" ]]; then
while [[ $(flock -n "$APP_DEPLOY_LOCK_FD" &>/dev/null ; echo $?) -ne 0 ]]; do
while [[ $(flock -n "$LOCK_FD" &>/dev/null ; echo $?) -ne 0 ]]; do
if [[ "$SHOW_MSG" == "true" ]]; then
echo "$LOCK_WAITING_MSG"
SHOW_MSG=false
@@ -963,17 +977,16 @@ acquire_app_deploy_lock() {
sleep 1
done
else
flock -n "$APP_DEPLOY_LOCK_FD" &>/dev/null || dokku_log_fail "$LOCK_FAILED_MSG"
flock -n "$LOCK_FD" &>/dev/null || dokku_log_fail "$LOCK_FAILED_MSG"
fi
}
release_app_deploy_lock() {
declare desc="release advisory lock used in git/tar deploys"
local APP="$1"; verify_app_name "$APP"
local APP_DEPLOY_LOCK_FD="200"
local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock"
release_advisory_lock() {
declare desc="release advisory lock"
local LOCK_FILE="$1"
local LOCK_FD="200"
flock -u "$APP_DEPLOY_LOCK_FD" && rm -f "$APP_DEPLOY_LOCK_FILE" &> /dev/null
flock -u "$LOCK_FD" && rm -f "$LOCK_FILE" &> /dev/null
}
suppress_output() {

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core common plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -144,13 +144,6 @@ func setPermissions(path string, fileMode os.FileMode) (err error) {
systemGroup := os.Getenv("DOKKU_SYSTEM_GROUP")
systemUser := os.Getenv("DOKKU_SYSTEM_USER")
if systemGroup == "" {
systemGroup = "dokku"
}
if systemUser == "" {
systemUser = "dokku"
}
group, err := user.LookupGroup(systemGroup)
if err != nil {
return

View File

@@ -67,15 +67,6 @@ fn-plugin-property-setup() {
mkdir -p "${DOKKU_LIB_ROOT}/config/${PLUGIN}"
chmod 0755 "${DOKKU_LIB_ROOT}/config/${PLUGIN}"
if [[ -z "$DOKKU_SYSTEM_GROUP" ]]; then
export DOKKU_SYSTEM_GROUP=dokku
fi
if [[ -z "$DOKKU_SYSTEM_USER" ]]; then
export DOKKU_SYSTEM_USER=dokku
fi
chown "${DOKKU_SYSTEM_USER}:${DOKKU_SYSTEM_GROUP}" "${DOKKU_LIB_ROOT}/config/${PLUGIN}"
}
@@ -86,7 +77,7 @@ fn-plugin-property-read() {
if [[ -z "$PLUGIN" ]] || [[ -z "$APP" ]] || [[ -z "$KEY" ]]; then
return 1
fi
if [[ ! -f "${DOKKU_LIB_ROOT:?}/config/${PLUGIN}/${APP}/${KEY}" ]]; then
return 1
fi

View File

@@ -240,9 +240,17 @@ func prettyPrintEnvEntries(prefix string, entries map[string]string) string {
colConfig := columnize.DefaultConfig()
colConfig.Prefix = prefix
colConfig.Delim = "\x00"
lines := make([]string, 0, len(entries))
for k, v := range entries {
lines = append(lines, fmt.Sprintf("%s:\x00%s", k, v))
//some keys may be prefixes of each other so we need to sort them rather than the resulting lines
keys := make([]string, 0, len(entries))
for k := range entries {
keys = append(keys, k)
}
sort.Strings(keys)
lines := make([]string, 0, len(keys))
for _, k := range keys {
lines = append(lines, fmt.Sprintf("%s:\x00%s", k, entries[k]))
}
return columnize.Format(lines, colConfig)
}

View File

@@ -56,6 +56,7 @@ func TestExport(t *testing.T) {
Expect(e.Export(ExportFormatDockerArgs)).To(Equal("--env=BAR='BAZ' --env=BAZ='a\nb' --env=FOO='b'\\''ar '"))
Expect(e.Export(ExportFormatShell)).To(Equal("BAR='BAZ' BAZ='a\nb' FOO='b'\\''ar '"))
Expect(e.Export(ExportFormatExports)).To(Equal("export BAR='BAZ'\nexport BAZ='a\nb'\nexport FOO='b'\\''ar '"))
Expect(e.Export(ExportFormatPretty)).To(Equal("BAR: BAZ\nBAZ: a\nb\nFOO: b'ar"))
}
func TestGet(t *testing.T) {

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core config plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -25,7 +25,7 @@ func CommandShow(args []string, global bool, shell bool, export bool, merged boo
if appName != "" {
contextName = appName
}
common.LogInfo2(contextName + " env vars")
common.LogInfo2Quiet(contextName + " env vars")
fmt.Println(env.Export(ExportFormatPretty))
}
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core docker-options plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core domains plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core enter plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -44,7 +44,7 @@ git_build_app_repo() {
pushd "$DOKKU_ROOT/$APP" > /dev/null
# unset the git quarantine path to allow us to use 2.13.0+
# See this issue for more information: https://github.com/dokku/dokku/issues/2796
env -u GIT_QUARANTINE_PATH git worktree add "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" "$REV" > /dev/null
suppress_output env -u GIT_QUARANTINE_PATH git worktree add "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" "$REV"
popd > /dev/null 2>&1 || pushd "/tmp" > /dev/null
pushd "$GIT_BUILD_APP_REPO_TMP_WORK_DIR" > /dev/null
else
@@ -65,13 +65,13 @@ git_build_app_repo() {
GIT_DIR="$DOKKU_ROOT/$APP" git tag -d "$TMP_TAG" &> /dev/null || true
fi
suppress_output git submodule update --init --recursive
suppress_output env -u GIT_QUARANTINE_PATH git submodule update --init --recursive
find . -name .git -prune -exec rm -rf {} \; > /dev/null
if use_git_worktree; then
pushd "$DOKKU_ROOT/$APP"
pushd "$DOKKU_ROOT/$APP" > /dev/null
git worktree prune
popd
popd > /dev/null
fi
local DOKKU_APP_DISABLE_ANSI_PREFIX_REMOVAL DOKKU_GLOBAL_DISABLE_ANSI_PREFIX_REMOVAL DOKKU_DISABLE_ANSI_PREFIX_REMOVAL

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core git plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -1,27 +1,11 @@
#!/usr/bin/env bash
[[ " help logs:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/logs/internal-functions"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
usage() {
declare desc="logs specific usage"
echo "Usage: dokku logs <app>"
echo " display recent log output"
echo ""
echo " -n, --num NUM # the number of lines to display"
echo " -p, --ps PS # only display logs from the given process"
echo " -t, --tail # continually stream logs"
echo " -q, --quiet # display raw logs without colors, time and names"
}
case "$1" in
logs:help)
usage
;;
help)
cat<<EOF
logs <app> [-h] [-t] [-n num] [-q] [-p process], Show the last logs for an application
EOF
help | logs:help)
cmd-logs-help "$@"
;;
*)

38
plugins/logs/internal-functions Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
fn-logs-usage() {
declare desc="logs specific usage"
echo "Usage: dokku logs <app>"
echo " display recent log output"
echo ""
echo " -n, --num NUM # the number of lines to display"
echo " -p, --ps PS # only display logs from the given process"
echo " -t, --tail # continually stream logs"
echo " -q, --quiet # display raw logs without colors, time and names"
}
fn-logs-help-content() {
declare desc="return logs plugin help content"
cat<<help_content
logs <app> [-h] [-t] [-n num] [-q] [-p process], Display recent log output
logs:failed <app>, Show the last logs for an application
help_content
}
cmd-logs-help() {
if [[ $1 = "logs:help" ]] ; then
echo -e 'Usage: dokku logs[:COMMAND]'
echo ''
echo 'Output app logs'
echo ''
echo 'Additional commands:'
fn-logs-help-content | sort | column -c2 -t -s,
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
fn-logs-help-content
else
cat<<help_desc
logs, Output app logs
help_desc
fi
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core logs plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -1,24 +1,22 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/logs/internal-functions"
logs_default_cmd() {
declare desc="shows the last logs for an app via command line"
declare desc="display recent log output"
local cmd="logs"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$2"; verify_app_name "$2"
local APP_ROOT="$DOKKU_ROOT/$APP"
local COLORS=(36 33 32 35 31)
if ! (is_deployed "$APP"); then
echo "Application's container not found"
exit 1
fi
! (is_deployed "$APP") && dokku_log_fail "App $APP has not been deployed"
shift 2;
local TEMP=$(getopt -o htqn:p: --long help,tail,quiet,num:,ps: -n 'dokku logs' -- "$@")
local EXIT_CODE="$?"
if [[ "$EXIT_CODE" != 0 ]]; then usage >&2 ; exit 1 ; fi
if [[ "$EXIT_CODE" != 0 ]]; then fn-logs-usage >&2 ; exit 1 ; fi
eval set -- "$TEMP"
local DOKKU_LOGS_LINE_NUMBERS="100"
@@ -29,7 +27,7 @@ logs_default_cmd() {
-p|--ps) local DOKKU_LOGS_ONLY_PROCESS="$2"; shift 2 ;;
-q|--quiet) local DOKKU_LOGS_NO_PRETTY_PRINT="true"; shift ;;
--) shift; break ;;
*) echo "Internal error"; exit 1;;
*) dokku_log_fail "Internal error";;
esac
done

33
plugins/logs/subcommands/failed Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/apps/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
cmd-logs-failed() {
declare desc="shows the last failed deploy logs"
declare cmd="logs:failed" argv=("$@"); [[ ${argv[0]} == "$cmd" ]] && shift 1
declare APP="$1"
local DOKKU_SCHEDULER
if [[ -z "$APP" ]]; then
local INSTALLED_APPS=$(dokku_apps)
for app in $INSTALLED_APPS; do
fn-logs-failed-single "$app" | tee || true
done
else
fn-logs-failed-single "$APP"
fi
}
fn-logs-failed-single() {
declare desc="shows the last failed deploy logs for an app"
declare APP="$1"
local DOKKU_SCHEDULER
dokku_log_info2_quiet "${APP} failed deploy logs"
DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
plugn trigger scheduler-logs-failed "$DOKKU_SCHEDULER" "$APP"
}
cmd-logs-failed "$@"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core network plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -26,3 +26,9 @@ nginx_vhosts_help_cmd() {
help_desc
fi
}
nginx_clear_config() {
declare desc="Remove the nginx conf file"
declare APP="$1";
rm -f "$DOKKU_ROOT/$APP/nginx.conf"
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core nginx-vhosts plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
trigger-nginx-vhosts-clear-config() {
declare desc="clear nginx config for proxy app containers from command line"
declare trigger="trigger-nginx-vhosts-clear-config"
declare APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
if [[ "$(get_app_proxy_type "$APP")" = "nginx" ]]; then
plugn trigger network-clear-config "$APP"
nginx_clear_config "$APP"
fi
}
trigger-nginx-vhosts-clear-config "$@"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core plugin plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core proxy plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -8,6 +8,7 @@ case "$1" in
declare desc="return ps plugin help content"
cat<<help_content
ps <app>, List processes running in app container(s)
ps:inspect <app>, Displays a sanitized version of docker inspect for an app
ps:scale <app> <proc>=<count> [<proc>=<count>...], Get/Set how many instances of a given process to run
ps:start <app>, Start app container(s)
ps:startall, Starts all apps via command line

View File

@@ -3,6 +3,17 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
get_cmd_from_procfile() {
declare desc="parse cmd from app Procfile"
declare APP="$1" PROC_TYPE="$2" PORT="$3"
local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
local COMMAND
verify_app_name "$APP"
[[ ! -f $DOKKU_PROCFILE ]] && return
procfile-util show --procfile "$DOKKU_PROCFILE" --process-type "$PROC_TYPE" --default-port "$PORT"
}
print_dokku_scale_file() {
declare desc="prints contents of DOKKU_SCALE file"
local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
@@ -23,6 +34,11 @@ extract_procfile() {
copy_from_image "$IMAGE" "Procfile" "$DOKKU_PROCFILE" 2>/dev/null || true
if [[ -f "$DOKKU_PROCFILE" ]]; then
dokku_log_info1_quiet "App Procfile file found ($DOKKU_PROCFILE)"
# shellcheck disable=SC2069
PROCFILE_ERRORS="$(procfile-util check --procfile "$DOKKU_PROCFILE" 2>&1 >/dev/null || true)"
if [[ -n "$PROCFILE_ERRORS" ]]; then
dokku_log_fail "${PROCFILE_ERRORS}"
fi
else
dokku_log_info1_quiet "No Procfile found in app image"
fi
@@ -71,12 +87,21 @@ generate_scale_file() {
set_scale() {
declare desc="sets app proc type scaling"
local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
declare APP="$1"
local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
shift 1
extract_procfile "$APP" "$IMAGE_TAG" > /dev/null
trap 'remove_procfile $APP' RETURN INT TERM EXIT
local SCALE_SETTINGS=("$@")
for procscale in "${SCALE_SETTINGS[@]}"; do
local PROC_NAME=${procscale%%=*}
local PROC_COUNT=${procscale#*=}
if [[ -f "$DOKKU_PROCFILE" ]] && ! procfile-util exists --procfile "$DOKKU_PROCFILE" --process-type "$PROC_NAME" > /dev/null 2>&1; then
dokku_log_fail "${PROC_NAME} is not a valid process name"
fi
is_number "$PROC_COUNT" || dokku_log_fail "ps:scale $PROC_COUNT is not a number"
dokku_log_info1_quiet "Scaling $APP:$PROC_NAME to $PROC_COUNT"
if (egrep -q "^${PROC_NAME}=" "$DOKKU_SCALE_FILE" > /dev/null 2>&1); then
@@ -119,7 +144,7 @@ ps_stop() {
! (is_deployed "$APP") && dokku_log_warn "App $APP has not been deployed" && exit 0
dokku_log_quiet "Stopping $APP ..."
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
plugn trigger scheduler-stop "$DOKKU_SCHEDULER" "$APP"
plugn trigger post-stop "$APP"
}
@@ -148,6 +173,7 @@ ps_scale() {
local APP="$1"; verify_app_name "$APP"
local IMAGE_TAG=$(get_running_image_tag "$APP")
local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
local DOKKU_PROCFILE="$DOKKU_ROOT/$APP/DOKKU_PROCFILE"
shift 1
[[ ! -e $DOKKU_SCALE_FILE ]] && generate_scale_file "$APP" "$IMAGE_TAG"
@@ -208,4 +234,4 @@ fn-ps-is-app-running() {
declare APP="$1"
APP_STATUS=$(fn-ps-app-status "$APP")
echo "$APP_STATUS" | cut -d ' ' -f 2
}
}

View File

@@ -4,11 +4,14 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
set_default_restart_policies() {
trigger-ps-install() {
declare desc="set the default restart policy for all applications if there is not one already set"
local APPS="$(dokku_apps)"
local APP
mkdir -p "${DOKKU_LIB_ROOT}/data/ps"
chown -R "${DOKKU_SYSTEM_USER}:${DOKKU_SYSTEM_GROUP}" "${DOKKU_LIB_ROOT}/data/ps"
for APP in $APPS; do
local RESTART_POLICIES=$(get_restart_policies "$(get_phase_file_path "deploy")")
if [[ -z "$RESTART_POLICIES" ]]; then
@@ -18,4 +21,4 @@ set_default_restart_policies() {
done
}
set_default_restart_policies "$@"
trigger-ps-install "$@"

View File

@@ -4,6 +4,16 @@ source "$PLUGIN_AVAILABLE_PATH/docker-options/functions"
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
cmd-ps-inspect() {
declare desc="displays a sanitized version of docker inspect for an app"
local cmd="ps:inspect"
local APP="$2"
verify_app_name "$APP"
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
plugn trigger scheduler-inspect "$DOKKU_SCHEDULER" "$APP"
}
cmd-ps-report() {
declare desc="displays a ps report for one or more apps"
local cmd="ps:report"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core ps plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

5
plugins/ps/subcommands/inspect Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
source "$PLUGIN_AVAILABLE_PATH/ps/internal-functions"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
cmd-ps-inspect "$@"

View File

@@ -8,8 +8,9 @@ ps_restore_cmd() {
declare desc="starts all apps with DOKKU_APP_RESTORE not set to 0 via command line"
local cmd="ps:restore"
local APP="$2"
local DOKKU_SCHEDULER
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
plugn trigger pre-restore "$DOKKU_SCHEDULER"
if [[ -n "$APP" ]]; then

17
plugins/ps/subcommands/retire Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
ps_retire_cmd() {
declare desc="ensures old containers are retired"
local cmd="ps:retire"
local LOCK_FILE="${DOKKU_LIB_ROOT}/data/ps/retire"
local DOKKU_SCHEDULER=$(config_get "--global" DOKKU_SCHEDULER || echo "docker-local")
acquire_advisory_lock "$LOCK_FILE" "exclusive" "" "Failed to acquire ps:retire lock"
plugn trigger scheduler-retire "$DOKKU_SCHEDULER"
release_advisory_lock "$LOCK_FILE"
}
ps_retire_cmd "$@"

View File

@@ -10,7 +10,7 @@ ps_stopall_cmd() {
local GNU_PARALLEL
if which parallel > /dev/null 2>&1; then
dokku_log_info1 "Rebuilding in parallel"
dokku_log_info1 "Stopping in parallel"
GNU_PARALLEL=$(parallel -V 2>&1 | grep GNU || true)
if [[ -z "$GNU_PARALLEL" ]]; then
# shellcheck disable=SC2046

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core repo plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -43,7 +43,7 @@ scheduler-docker-local-check-deploy() {
local trigger="scheduler-docker-local-check-deploy"
local APP="$1"; local DOKKU_APP_CONTAINER_ID="$2"; local DOKKU_APP_CONTAINER_TYPE="$3"; local DOKKU_APP_LISTEN_PORT="$4"; local DOKKU_APP_LISTEN_IP="$5"
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
return
fi

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions"
case "$1" in
help | scheduler-docker-local:help)
cmd-scheduler-docker-local-help "$@"
;;
*)
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
;;
esac

View File

@@ -9,7 +9,7 @@ scheduler-docker-local-core-post-deploy() {
declare APP="$1";
local APP_ROOT="$DOKKU_ROOT/$APP"
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
return
fi

View File

@@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
scheduler-docker-local-install() {
declare desc="scheduler-docker-local install plugin trigger"
declare trigger="scheduler-docker-local-install"
local DOKKU_PATH
mkdir -p "${DOKKU_LIB_ROOT}/data/scheduler-docker-local"
chown -R "${DOKKU_SYSTEM_USER}:${DOKKU_SYSTEM_GROUP}" "${DOKKU_LIB_ROOT}/data/scheduler-docker-local"
fn-plugin-property-setup "scheduler-docker-local"
DOKKU_PATH="$(which dokku)"
if [[ $(systemctl 2> /dev/null) =~ -\.mount ]]; then
cat<<EOF > /etc/systemd/system/dokku-retire.service
[Unit]
Description=Dokku retire service
Requires=docker.service
After=docker.service
[Service]
Type=oneshot
User=$DOKKU_SYSTEM_USER
ExecStart=$DOKKU_PATH ps:restore
[Install]
WantedBy=docker.service
EOF
cat<<EOF > /etc/systemd/system/dokku-retire.timer
[Unit]
Description=Run dokku-retire.service every 2 minutes
[Timer]
OnCalendar=*:0/2
EOF
if command -v systemctl &>/dev/null; then
systemctl reenable dokku-redeploy
fi
else
cat<<EOF > /etc/cron.d/dokku-retire
PATH=/usr/local/bin:/usr/bin:/bin
SHELL=/bin/bash
2 * * * * $DOKKU_SYSTEM_USER $DOKKU_PATH ps:retire
EOF
fi
}
scheduler-docker-local-install "$@"

View File

@@ -0,0 +1,123 @@
#!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
cmd-scheduler-docker-local-report() {
declare desc="displays a scheduler-docker-local report for one or more apps"
local cmd="scheduler-docker-local:report"
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi
if [[ -z "$APP" ]]; then
for app in $INSTALLED_APPS; do
cmd-scheduler-docker-local-report-single "$app" "$INFO_FLAG" | tee || true
done
else
cmd-scheduler-docker-local-report-single "$APP" "$INFO_FLAG"
fi
}
cmd-scheduler-docker-local-report-single() {
declare APP="$1" INFO_FLAG="$2"
if [[ "$INFO_FLAG" == "true" ]]; then
INFO_FLAG=""
fi
verify_app_name "$APP"
local flag_map=(
"--scheduler-docker-local-disable-chown: $(fn-plugin-property-get "scheduler-docker-local" "$APP" "disable-chown" "")"
)
if [[ -z "$INFO_FLAG" ]]; then
dokku_log_info2_quiet "${APP} scheduler-docker-local information"
for flag in "${flag_map[@]}"; do
key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')"
dokku_log_verbose "$(printf "%-30s %-25s" "${key^}" "${flag#*: }")"
done
else
local match=false; local value_exists=false
for flag in "${flag_map[@]}"; do
valid_flags="${valid_flags} $(echo "$flag" | cut -d':' -f1)"
if [[ "$flag" == "${INFO_FLAG}:"* ]]; then
value=${flag#*: }
size="${#value}"
if [[ "$size" -ne 0 ]]; then
echo "$value" && match=true && value_exists=true
else
match=true
fi
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
}
scheduler_docker_local_help_content_func() {
declare desc="return scheduler-docker-local plugin help content"
cat<<help_content
scheduler-docker-local:report [<app>] [<flag>], Displays a scheduler-docker-local report for one or more apps
scheduler-docker-local:set <app> <property> (<value>), Set or clear a scheduler-docker-local property for an app
help_content
}
cmd-scheduler-docker-local-help() {
if [[ $1 = "scheduler-docker-local:help" ]] ; then
echo -e 'Usage: dokku scheduler-docker-local[:COMMAND]'
echo ''
echo 'Manages the scheduler-docker-local integration for an app.'
echo ''
echo 'Additional commands:'
scheduler_docker_local_help_content_func | sort | column -c2 -t -s,
echo ''
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
scheduler_docker_local_help_content_func
else
cat<<help_desc
scheduler-docker-local, Manages the scheduler-docker-local integration for an app
help_desc
fi
}
fn-scheduler-docker-local-retire-container() {
declare APP="$1" CID="$2" DEAD_TIME="$3"
if ! docker inspect "${CID}" > /dev/null; then
return
fi
DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
# Attempt to stop, if that fails, then force a kill as docker seems
# to not send SIGKILL as the docs would indicate. If that fails, move
# on to the next.
# shellcheck disable=SC2086
docker stop $DOCKER_STOP_TIME_ARG "$oldid" \
|| docker kill "$oldid" \
|| dokku_log_warn "Unable to kill container ${CID}"
if ! docker kill "$CID"; then
dokku_log_warn "Unable to kill container ${CID}"
fi
}
fn-scheduler-docker-local-register-retired-container() {
declare APP="$1" CID="$2" WAIT="$3"
local DEAD_CONTAINER_FILE="${DOKKU_LIB_ROOT}/data/scheduler-docker-local/dead-containers"
local CURRENT_TIME DEAD_TIME
CURRENT_TIME="$(date +%s)"
DEAD_TIME=$((CURRENT_TIME + WAIT))
echo "${APP} ${CID} ${DEAD_TIME}" >> "${DEAD_CONTAINER_FILE}"
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core scheduler-docker-local plugin"
version = "0.12.10"
version = "0.13.1"
[plugin.config]

View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
scheduler-docker-local-post-create() {
declare desc="scheduler-docker-local post-create plugin trigger"
declare trigger="scheduler-docker-local-post-create"
declare APP="$1"
mkdir -p "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/${APP}"
chown -R "${DOKKU_SYSTEM_USER}:${DOKKU_SYSTEM_GROUP}" "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/${APP}"
}
scheduler-docker-local-post-create "$@"

View File

@@ -8,7 +8,7 @@ scheduler-docker-local-post-delete() {
declare trigger="scheduler-docker-local post-delete"
declare APP="$1"
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
return
fi

View File

@@ -1,16 +1,17 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
scheduler-docker-local-pre-deploy() {
declare desc="scheduler-docker-local pre-deploy plugin trigger"
declare trigger="scheduler-docker-local pre-deploy"
declare APP="$1" IMAGE_TAG="$2"
local IMAGE DOCKER_ARGS DOKKU_APP_TYPE DOKKU_APP_USER APP_PATHS CONTAINER_PATHS
local IMAGE DISABLE_CHOWN DOCKER_ARGS DOKKU_APP_TYPE DOKKU_APP_USER APP_PATHS CONTAINER_PATHS
declare -a ARG_ARRAY
local DOKKU_SCHEDULER=$(config_get "$APP" DOKKU_SCHEDULER || echo "docker-local")
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
return
fi
@@ -30,10 +31,17 @@ scheduler-docker-local-pre-deploy() {
eval "ARG_ARRAY=($DOCKER_ARGS)"
fi
if [[ "$DOKKU_APP_TYPE" == "herokuish" ]] && [[ -n "$CONTAINER_PATHS" ]]; then
# shellcheck disable=SC2086
docker run $DOKKU_GLOBAL_RUN_ARGS "${ARG_ARRAY[@]}" $IMAGE /bin/bash -c "find $CONTAINER_PATHS -not -user $DOKKU_APP_USER -print0 | xargs -0 -r chown -R $DOKKU_APP_USER" || true
if [[ "$DOKKU_APP_TYPE" != "herokuish" ]] || [[ -z "$CONTAINER_PATHS" ]]; then
return
fi
DISABLE_CHOWN="$(fn-plugin-property-get "scheduler-docker-local" "$APP" "disable-chown" "")"
if [[ "$DISABLE_CHOWN" == "true" ]]; then
return
fi
# shellcheck disable=SC2086
docker run $DOKKU_GLOBAL_RUN_ARGS "${ARG_ARRAY[@]}" $IMAGE /bin/bash -c "find $CONTAINER_PATHS -not -user $DOKKU_APP_USER -print0 | xargs -0 -r chown -R $DOKKU_APP_USER" || true
}
scheduler-docker-local-pre-deploy "$@"

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
cmd-scheduler-docker-local-report-single "$@"

View File

@@ -3,6 +3,8 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/checks/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions"
scheduler-docker-local-scheduler-deploy() {
declare desc="deploys an image tag for a given application"
@@ -13,6 +15,8 @@ scheduler-docker-local-scheduler-deploy() {
return
fi
rm -f "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP/failed-containers"
local DOKKU_DOCKER_STOP_TIMEOUT DOKKU_HEROKUISH DOKKU_NETWORK_BIND_ALL IMAGE
DOKKU_HEROKUISH=false
IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
@@ -60,13 +64,8 @@ scheduler-docker-local-scheduler-deploy() {
declare -a ARG_ARRAY
eval "ARG_ARRAY=($DOCKER_ARGS)"
[[ "$DOKKU_HEROKUISH" == "true" ]] && local START_CMD="/start $PROC_TYPE"
if [[ "$DOKKU_HEROKUISH" == "false" ]]; then
local DOKKU_DOCKERFILE_START_CMD=$(config_get "$APP" DOKKU_DOCKERFILE_START_CMD || true)
local DOKKU_PROCFILE_START_CMD=$(get_cmd_from_procfile "$APP" "$PROC_TYPE")
local START_CMD=${DOKKU_DOCKERFILE_START_CMD:-$DOKKU_PROCFILE_START_CMD}
fi
local START_CMD
[[ "$DOKKU_HEROKUISH" == "true" ]] && START_CMD="/start $PROC_TYPE"
if [[ "$PROC_TYPE" == "web" ]]; then
ports=($(plugn trigger network-compute-ports "$APP" "$PROC_TYPE" "$DOKKU_HEROKUISH"))
@@ -79,6 +78,7 @@ scheduler-docker-local-scheduler-deploy() {
DOKKU_DOCKER_PORT_ARGS+=" -p $p "
done
START_CMD=$(fn-scheduler-docker-local-extract-start-cmd "$APP" "$PROC_TYPE" "$START_CMD" "$DOKKU_HEROKUISH" "$DOKKU_PORT")
if [[ "$DOKKU_NETWORK_BIND_ALL" == "false" ]]; then
# shellcheck disable=SC2086
cid=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d -e PORT=$DOKKU_PORT "${ARG_ARRAY[@]}" $IMAGE $START_CMD)
@@ -87,6 +87,8 @@ scheduler-docker-local-scheduler-deploy() {
cid=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d $DOKKU_DOCKER_PORT_ARGS -e PORT=$DOKKU_PORT "${ARG_ARRAY[@]}" $IMAGE $START_CMD)
fi
else
START_CMD=$(fn-scheduler-docker-local-extract-start-cmd "$APP" "$PROC_TYPE" "$START_CMD" "$DOKKU_HEROKUISH")
# shellcheck disable=SC2086
cid=$(docker run $DOKKU_GLOBAL_RUN_ARGS -d "${ARG_ARRAY[@]}" $IMAGE $START_CMD)
fi
@@ -96,14 +98,16 @@ scheduler-docker-local-scheduler-deploy() {
kill_new() {
declare desc="wrapper function to kill newly started app container"
local cid="$1"
docker inspect "$cid" &> /dev/null && docker stop "$cid" > /dev/null && docker kill "$cid" &> /dev/null
declare CID="$1" PROC_TYPE="$2" CONTAINER_INDEX="$3"
mkdir -p "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP"
echo "${CID} ${PROC_TYPE}.${CONTAINER_INDEX}" >> "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP/failed-containers"
docker inspect "$CID" &> /dev/null && docker stop "$CID" > /dev/null && docker kill "$CID" &> /dev/null
trap - INT TERM EXIT
kill -9 $$
}
# run checks first, then post-deploy hooks, which switches proxy traffic
trap 'kill_new $cid' INT TERM EXIT
trap 'kill_new $cid $PROC_TYPE $CONTAINER_INDEX' INT TERM EXIT
if [[ "$(is_app_proctype_checks_disabled "$APP" "$PROC_TYPE")" == "false" ]]; then
dokku_log_info1 "Attempting pre-flight checks"
plugn trigger check-deploy "$APP" "$cid" "$PROC_TYPE" "$port" "$ipaddr"
@@ -152,6 +156,7 @@ scheduler-docker-local-scheduler-deploy() {
local oldid
for oldid in $oldids; do
dokku_log_info2 "$oldid"
fn-scheduler-docker-local-register-retired-container "$APP" "$oldid" "$WAIT"
done
(
exec >/dev/null 2>/dev/null </dev/null
@@ -164,7 +169,7 @@ scheduler-docker-local-scheduler-deploy() {
# shellcheck disable=SC2086
docker stop $DOCKER_STOP_TIME_ARG "$oldid" \
|| docker kill "$oldid" \
|| plugn trigger retire-container-failed "$APP" # plugin trigger for event logging
|| plugn trigger retire-container-failed "$APP" "$oldid" # plugin trigger for event logging
done
) & disown -a
# Use trap since disown/nohup don't seem to keep child alive
@@ -173,4 +178,18 @@ scheduler-docker-local-scheduler-deploy() {
fi
}
fn-scheduler-docker-local-extract-start-cmd() {
declare APP="$1" PROC_TYPE="$2" START_CMD="$3" DOKKU_HEROKUISH="$4" PORT="$5"
local DOKKU_DOCKERFILE_START_CMD DOKKU_PROCFILE_START_CMD START_CMD
if [[ "$DOKKU_HEROKUISH" != "false" ]]; then
echo "$START_CMD"
return
fi
DOKKU_DOCKERFILE_START_CMD=$(config_get "$APP" DOKKU_DOCKERFILE_START_CMD || true)
DOKKU_PROCFILE_START_CMD=$(get_cmd_from_procfile "$APP" "$PROC_TYPE" "$PORT")
START_CMD=${DOKKU_DOCKERFILE_START_CMD:-$DOKKU_PROCFILE_START_CMD}
echo "$START_CMD"
}
scheduler-docker-local-scheduler-deploy "$@"

View File

@@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
scheduler-docker-local-scheduler-inspect() {
declare desc="scheduler-docker-local scheduler-inspect plugin trigger"
declare trigger="scheduler-docker-local scheduler-inspect"
declare DOKKU_SCHEDULER="$1" APP="$2"
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
return
fi
local TMP_INSPECT_CMD=$(mktemp "/tmp/${FUNCNAME[0]}.XXXX")
trap 'rm -rf "$TMP_INSPECT_CMD" > /dev/null' RETURN INT TERM EXIT
cat > "$TMP_INSPECT_CMD" <<EOF
import json
import sys
output = []
data = json.load(sys.stdin)
for container in data:
env = []
whitelist = ['CACHE_PATH=', 'DOCKER_', 'DOKKU_', 'DYNO=', 'PATH=', 'PORT=', 'USER=']
for e in container['Config']['Env']:
append = False
for w in whitelist:
if e.startswith(w):
append = True
break
if append:
env.append(e)
continue
k, v = e.split('=', 2)
env.append('{0}=XXXXXX'.format(k))
container['Config']['Env'] = env
output.append(container)
print json.dumps(data, sort_keys=True, indent=4)
EOF
local CONTAINER_FILES="$(find "$DOKKU_ROOT/$APP" -maxdepth 1 -name "CONTAINER.*" -printf "%f\n" 2>/dev/null | sort -t . -k 2 -n | xargs)"
local CIDS=()
for CONTAINER_FILE in $CONTAINER_FILES; do
CIDS+="$(< "$DOKKU_ROOT/$APP/$CONTAINER_FILE")"
done
docker inspect "${CIDS[@]}" | python2.7 "$TMP_INSPECT_CMD"
}
scheduler-docker-local-scheduler-inspect "$@"

View File

@@ -0,0 +1,56 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
scheduler-docker-local-scheduler-logs-failed() {
declare desc="scheduler-docker-local scheduler-logs-failed plugin trigger"
declare trigger="scheduler-docker-local scheduler-logs-failed"
declare DOKKU_SCHEDULER="$1" APP="$2"
local FAILED_CONTAINERS_FILE="${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP/failed-containers"
local DEAD_CONTAINERS=() DOKKU_LOGS_CMD=() RUNNING_CONTAINERS=()
local CID LINE PREFIX
shift 2
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
return
fi
if [[ ! -f "$FAILED_CONTAINERS_FILE" ]]; then
dokku_log_warn "No failed containers found"
return
fi
while read -r LINE || [[ -n "$LINE" ]]; do
CID="$(echo "$LINE" | cut -d ' ' -f1)"
PREFIX="$(echo "$LINE" | cut -d ' ' -f2)"
if docker inspect "${CID}" > /dev/null 2>&1; then
RUNNING_CONTAINERS+=("$CID")
else
DEAD_CONTAINERS+=("$CID")
fi
done < "$FAILED_CONTAINERS_FILE"
for CID in "${DEAD_CONTAINERS[@]}"; do
dokku_log_warn "App container $CID no longer running"
sed -i "/${CID}/d" "$FAILED_CONTAINERS_FILE"
done
if [[ ${#RUNNING_CONTAINERS[@]} -eq 0 ]]; then
dokku_log_warn "No failed containers found"
return
fi
((MAX_INDEX=${#RUNNING_CONTAINERS[*]} - 1)) || true
for i in ${!RUNNING_CONTAINERS[*]}; do
local CID="${RUNNING_CONTAINERS[i]}"
DOKKU_LOGS_CMD+="(docker logs $DOKKU_LOGS_ARGS $CID 2>&1)"
if [[ $i != "$MAX_INDEX" ]]; then
local DOKKU_LOGS_CMD+="& "
else
local DOKKU_LOGS_CMD+="; "
fi
done
bash -c "($DOKKU_LOGS_CMD)"
}
scheduler-docker-local-scheduler-logs-failed "$@"

View File

@@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions"
scheduler-docker-local-scheduler-retire() {
declare desc="retires all old containers once they have aged out"
declare trigger="scheduler-docker-local scheduler-retire"
local DEAD_CONTAINER_FILE="${DOKKU_LIB_ROOT}/data/scheduler-docker-local/dead-containers"
local APP CID CURRENT_TIME DEAD_TIME
DEAD_CONTAINERS=()
while read line; do
CURRENT_TIME="$(date +%s)"
APP="$(echo "$line" | cut -d ' ' -f1)"
CID="$(echo "$line" | cut -d ' ' -f2)"
DEAD_TIME="$(echo "$line" | cut -d ' ' -f3)"
if [[ "$CURRENT_TIME" -le "$DEAD_TIME" ]]; then
continue
fi
fn-scheduler-docker-local-retire-container "$APP" "$CID" "$DEAD_TIME"
if docker ps -aq -f "id=${CID}" -f "status=running" > /dev/null 2>&1; then
dokku_log_warn "Container ${CID} still running"
continue
fi
docker rm -f "$CID" > /dev/null 2>&1 || true
if docker inspect "${CID}" > /dev/null 2>&1; then
dokku_log_warn "Container ${CID} still running"
continue
fi
DEAD_CONTAINERS+=("$CID")
done < "$DEAD_CONTAINER_FILE"
for CID in "${DEAD_CONTAINERS[@]}"; do
sed -i "/${CID}/d" "$DEAD_CONTAINER_FILE"
done
}
scheduler-docker-local-scheduler-retire "$@"

Some files were not shown because too many files have changed in this diff Show More