Merge pull request #1228 from progrium/mh-switch-to-plugn

switching from pluginhook to plugn
This commit is contained in:
Jose Diaz-Gonzalez committed 2015-09-15 09:16:36 -07:00
commit 63d8994243
74 files changed
+482 -263

No files matched your search

+27 -17
View File
@@ -1,10 +1,12 @@
DOKKU_VERSION = master DOKKU_VERSION = master
SSHCOMMAND_URL ?= https://raw.github.com/progrium/sshcommand/master/sshcommand SSHCOMMAND_URL ?= https://raw.github.com/progrium/sshcommand/master/sshcommand
PLUGINHOOK_URL ?= https://s3.amazonaws.com/progrium-pluginhook/pluginhook_0.1.0_amd64.deb PLUGN_URL ?= https://github.com/progrium/plugn/releases/download/v0.1.0/plugn_0.1.0_linux_x86_64.tgz
STACK_URL ?= https://github.com/gliderlabs/herokuish.git STACK_URL ?= https://github.com/gliderlabs/herokuish.git
PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest
PLUGINS_PATH ?= /var/lib/dokku/plugins DOKKU_LIB_ROOT ?= /var/lib/dokku
PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/plugins
CORE_PLUGINS_PATH ?= ${DOKKU_LIB_ROOT}/core-plugins
# If the first argument is "vagrant-dokku"... # If the first argument is "vagrant-dokku"...
ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS))) ifeq (vagrant-dokku,$(firstword $(MAKECMDGOALS)))
@@ -20,7 +22,7 @@ else
BUILD_STACK_TARGETS = build-in-docker BUILD_STACK_TARGETS = build-in-docker
endif endif
.PHONY: all apt-update install version copyfiles man-db plugins dependencies sshcommand pluginhook docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku .PHONY: all apt-update install version copyfiles man-db plugins dependencies sshcommand plugn docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku
include tests.mk include tests.mk
include deb.mk include deb.mk
@@ -35,7 +37,7 @@ release: deb-all package_cloud packer
package_cloud: package_cloud:
package_cloud push dokku/dokku/ubuntu/trusty herokuish*.deb package_cloud push dokku/dokku/ubuntu/trusty herokuish*.deb
package_cloud push dokku/dokku/ubuntu/trusty sshcommand*.deb package_cloud push dokku/dokku/ubuntu/trusty sshcommand*.deb
package_cloud push dokku/dokku/ubuntu/trusty pluginhook*.deb package_cloud push dokku/dokku/ubuntu/trusty plugn*.deb
package_cloud push dokku/dokku/ubuntu/trusty rubygem*.deb package_cloud push dokku/dokku/ubuntu/trusty rubygem*.deb
package_cloud push dokku/dokku/ubuntu/trusty dokku*.deb package_cloud push dokku/dokku/ubuntu/trusty dokku*.deb
@@ -44,13 +46,21 @@ packer:
copyfiles: copyfiles:
cp dokku /usr/local/bin/dokku cp dokku /usr/local/bin/dokku
mkdir -p ${PLUGINS_PATH} mkdir -p ${CORE_PLUGINS_PATH} ${PLUGINS_PATH}
find ${PLUGINS_PATH} -mindepth 2 -maxdepth 2 -name '.core' -printf '%h\0' | xargs -0 rm -Rf rm -rf ${CORE_PLUGINS_PATH}/*
test -d ${CORE_PLUGINS_PATH}/enabled || PLUGIN_PATH=${CORE_PLUGINS_PATH} plugn init
test -d ${PLUGINS_PATH}/enabled || PLUGIN_PATH=${PLUGINS_PATH} plugn init
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \ find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do \
rm -Rf ${PLUGINS_PATH}/$$plugin && \ rm -Rf ${CORE_PLUGINS_PATH}/available/$$plugin && \
cp -R plugins/$$plugin ${PLUGINS_PATH} && \ rm -Rf ${PLUGINS_PATH}/available/$$plugin && \
touch ${PLUGINS_PATH}/$$plugin/.core; \ rm -rf ${CORE_PLUGINS_PATH}/$$plugin && \
rm -rf ${PLUGINS_PATH}/$$plugin && \
cp -R plugins/$$plugin ${CORE_PLUGINS_PATH}/available && \
ln -s ${CORE_PLUGINS_PATH}/available/$$plugin ${PLUGINS_PATH}/available; \
PLUGIN_PATH=${CORE_PLUGINS_PATH} plugn enable $$plugin ;\
PLUGIN_PATH=${PLUGINS_PATH} plugn enable $$plugin ;\
done done
chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH}
$(MAKE) addman $(MAKE) addman
addman: addman:
@@ -61,13 +71,13 @@ addman:
version: version:
git describe --tags > ~dokku/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ~dokku/VERSION git describe --tags > ~dokku/VERSION 2> /dev/null || echo '~${DOKKU_VERSION} ($(shell date -uIminutes))' > ~dokku/VERSION
plugin-dependencies: pluginhook plugin-dependencies: plugn
dokku plugins-install-dependencies dokku plugin:install-dependencies --core
plugins: pluginhook docker plugins: plugn docker
dokku plugins-install dokku plugin:install --core
dependencies: apt-update sshcommand pluginhook docker help2man man-db dependencies: apt-update sshcommand plugn docker help2man man-db
$(MAKE) -e stack $(MAKE) -e stack
apt-update: apt-update:
@@ -84,9 +94,9 @@ sshcommand:
chmod +x /usr/local/bin/sshcommand chmod +x /usr/local/bin/sshcommand
sshcommand create dokku /usr/local/bin/dokku sshcommand create dokku /usr/local/bin/dokku
pluginhook: plugn:
wget -qO /tmp/pluginhook_0.1.0_amd64.deb ${PLUGINHOOK_URL} wget -qO /tmp/plugn_latest.tgz ${PLUGN_URL}
dpkg -i /tmp/pluginhook_0.1.0_amd64.deb tar xzf /tmp/plugn_latest.tgz -C /usr/local/bin
docker: aufs docker: aufs
apt-get install -qq -y curl apt-get install -qq -y curl
+15 -15
View File
@@ -8,11 +8,11 @@ DOKKU_DESCRIPTION = 'Docker powered mini-Heroku in around 100 lines of Bash'
DOKKU_REPO_NAME ?= progrium/dokku DOKKU_REPO_NAME ?= progrium/dokku
DOKKU_ARCHITECTURE = amd64 DOKKU_ARCHITECTURE = amd64
PLUGINHOOK_DESCRIPTION = 'Simple dispatcher and protocol for shell-based plugins, an improvement to hook scripts' PLUGN_DESCRIPTION = 'Hook system that lets users extend your application with plugins'
PLUGINHOOK_REPO_NAME ?= progrium/pluginhook PLUGN_REPO_NAME ?= progrium/plugn
PLUGINHOOK_VERSION ?= 0.2.0 PLUGN_VERSION ?= 0.1.0
PLUGINHOOK_ARCHITECTURE = amd64 PLUGN_ARCHITECTURE = amd64
PLUGINHOOK_PACKAGE_NAME = pluginhook_$(PLUGINHOOK_VERSION)_$(PLUGINHOOK_ARCHITECTURE).deb PLUGN_PACKAGE_NAME = plugn_$(PLUGN_VERSION)_$(PLUGN_ARCHITECTURE).deb
SSHCOMMAND_DESCRIPTION = 'Turn SSH into a thin client specifically for your app' SSHCOMMAND_DESCRIPTION = 'Turn SSH into a thin client specifically for your app'
SSHCOMMAND_REPO_NAME ?= progrium/sshcommand SSHCOMMAND_REPO_NAME ?= progrium/sshcommand
@@ -26,7 +26,7 @@ GOROOT = /usr/lib/go
GOBIN = /usr/bin/go GOBIN = /usr/bin/go
GOPATH = /home/vagrant/gocode GOPATH = /home/vagrant/gocode
.PHONY: install-from-deb deb-all deb-herokuish deb-dokku deb-gems deb-pluginhook deb-setup deb-sshcommand .PHONY: install-from-deb deb-all deb-herokuish deb-dokku deb-gems deb-plugn deb-setup deb-sshcommand
install-from-deb: install-from-deb:
echo "--> Initial apt-get update" echo "--> Initial apt-get update"
@@ -54,7 +54,7 @@ install-from-deb:
echo "--> Done!" echo "--> Done!"
deb-all: deb-herokuish deb-dokku deb-gems deb-pluginhook deb-sshcommand deb-all: deb-herokuish deb-dokku deb-gems deb-plugn deb-sshcommand
mv /tmp/*.deb . mv /tmp/*.deb .
echo "Done" echo "Done"
@@ -128,24 +128,24 @@ deb-gems: deb-setup
find /tmp/tmp/cache -name '*.gem' | xargs -rn1 fpm -d ruby -d ruby --prefix /var/lib/gems/1.9.1 -s gem -t deb -a $(GEM_ARCHITECTURE) find /tmp/tmp/cache -name '*.gem' | xargs -rn1 fpm -d ruby -d ruby --prefix /var/lib/gems/1.9.1 -s gem -t deb -a $(GEM_ARCHITECTURE)
mv *.deb /tmp mv *.deb /tmp
deb-pluginhook: deb-setup deb-plugn: deb-setup
rm -rf /tmp/tmp /tmp/build $(PLUGINHOOK_PACKAGE_NAME) rm -rf /tmp/tmp /tmp/build $(PLUGN_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build mkdir -p /tmp/tmp /tmp/build
echo "-> Cloning repository" echo "-> Cloning repository"
git clone -q "git@github.com:$(PLUGINHOOK_REPO_NAME).git" /tmp/tmp/pluginhook > /dev/null git clone -q "git@github.com:$(PLUGN_REPO_NAME).git" /tmp/tmp/plugn > /dev/null
rm -rf /tmp/tmp/pluginhook/.git /tmp/tmp/pluginhook/.gitignore rm -rf /tmp/tmp/plugn/.git /tmp/tmp/plugn/.gitignore
echo "-> Copying files into place" echo "-> Copying files into place"
mkdir -p /tmp/build/usr/local/bin $(GOPATH) mkdir -p /tmp/build/usr/local/bin $(GOPATH)
sudo apt-get update > /dev/null sudo apt-get update > /dev/null
sudo apt-get install -qq -y git golang mercurial 2>&1 > /dev/null sudo apt-get install -qq -y git golang mercurial 2>&1 > /dev/null
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && go get "golang.org/x/crypto/ssh/terminal" export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && go get "golang.org/x/crypto/ssh/terminal"
export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && cd /tmp/tmp/pluginhook && go build -o pluginhook export PATH=$(PATH):$(GOROOT)/bin:$(GOPATH)/bin && export GOROOT=$(GOROOT) && export GOPATH=$(GOPATH) && cd /tmp/tmp/plugn && go build -o plugn
mv /tmp/tmp/pluginhook/pluginhook /tmp/build/usr/local/bin/pluginhook mv /tmp/tmp/plugn/plugn /tmp/build/usr/local/bin/plugn
echo "-> Creating $(PLUGINHOOK_PACKAGE_NAME)" echo "-> Creating $(PLUGN_PACKAGE_NAME)"
sudo fpm -t deb -s dir -C /tmp/build -n pluginhook -v $(PLUGINHOOK_VERSION) -a $(PLUGINHOOK_ARCHITECTURE) -p $(PLUGINHOOK_PACKAGE_NAME) --url "https://github.com/$(PLUGINHOOK_REPO_NAME)" --description $(PLUGINHOOK_DESCRIPTION) --license 'MIT License' . sudo fpm -t deb -s dir -C /tmp/build -n plugn -v $(PLUGN_VERSION) -a $(PLUGN_ARCHITECTURE) -p $(PLUGN_PACKAGE_NAME) --url "https://github.com/$(PLUGN_REPO_NAME)" --description $(PLUGN_DESCRIPTION) --license 'MIT License' .
mv *.deb /tmp mv *.deb /tmp
deb-sshcommand: deb-setup deb-sshcommand: deb-setup
+1 -1
View File
@@ -3,7 +3,7 @@ Version: 0.3.12
Section: base Section: base
Priority: optional Priority: optional
Architecture: amd64 Architecture: amd64
Depends: locales, git, make, curl, software-properties-common, lxc-docker-1.6.2, gcc, python-software-properties, man-db, herokuish, sshcommand, pluginhook Depends: locales, git, make, curl, software-properties-common, lxc-docker-1.6.2, gcc, python-software-properties, man-db, herokuish, sshcommand, plugn
Pre-Depends: nginx, dnsutils, ruby, ruby-dev, rubygem-rack, rubygem-rack-protection, rubygem-sinatra, rubygem-tilt, apparmor, cgroupfs-mount | cgroup-lite Pre-Depends: nginx, dnsutils, ruby, ruby-dev, rubygem-rack, rubygem-rack-protection, rubygem-sinatra, rubygem-tilt, apparmor, cgroupfs-mount | cgroup-lite
Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com> Maintainer: Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>
Description: Docker powered mini-Heroku in around 100 lines of Bash Description: Docker powered mini-Heroku in around 100 lines of Bash
+1 -1
View File
@@ -16,7 +16,7 @@ case "$1" in
sshcommand create dokku /usr/local/bin/dokku sshcommand create dokku /usr/local/bin/dokku
egrep -i "^docker" /etc/group || groupadd docker egrep -i "^docker" /etc/group || groupadd docker
usermod -aG docker dokku usermod -aG docker dokku
dokku plugins-install dokku plugin:install --core
rm -f /home/dokku/VERSION rm -f /home/dokku/VERSION
cp /var/lib/dokku/STABLE_VERSION /home/dokku/VERSION cp /var/lib/dokku/STABLE_VERSION /home/dokku/VERSION
+1 -1
View File
@@ -16,7 +16,7 @@ cd dokku
sudo make install sudo make install
``` ```
The `Makefile` allows source URLs to be overridden to include customizations from your own repositories. The `DOCKER_URL`, `PLUGINHOOK_URL`, `SSHCOMMAND_URL` and `STACK_URL` environment variables may be set to override the defaults (see the `Makefile` for how these apply). Example: The `Makefile` allows source URLs to be overridden to include customizations from your own repositories. The `DOCKER_URL`, `PLUGN_URL`, `SSHCOMMAND_URL` and `STACK_URL` environment variables may be set to override the defaults (see the `Makefile` for how these apply). Example:
```shell ```shell
sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/sshcommand make install sudo SSHCOMMAND_URL=https://raw.github.com/yourusername/sshcommand/master/sshcommand make install
+1 -1
View File
@@ -2,7 +2,7 @@
* [Docker](https://github.com/dotcloud/docker) - Container runtime and manager * [Docker](https://github.com/dotcloud/docker) - Container runtime and manager
* [Herokuish](https://github.com/gliderlabs/herokuish) - Buildpack builder * [Herokuish](https://github.com/gliderlabs/herokuish) - Buildpack builder
* [pluginhook](https://github.com/progrium/pluginhook) - Shell based plugins and hooks * [plugn](https://github.com/progrium/plugn) - Shell based plugins and hooks
* [sshcommand](https://github.com/progrium/sshcommand) - Fixed commands over SSH * [sshcommand](https://github.com/progrium/sshcommand) - Fixed commands over SSH
Looking to keep codebase as simple and hackable as possible, so try to keep your line count down. Looking to keep codebase as simple and hackable as possible, so try to keep your line count down.
+15 -6
View File
@@ -3,7 +3,7 @@
If you create your own plugin: If you create your own plugin:
1. Take a look at the plugins shipped with dokku and hack away! 1. Take a look at the plugins shipped with dokku and hack away!
2. Check out the [list of hooks](http://progrium.viewdocs.io/dokku/development/pluginhooks) your plugin can implement. 2. Check out the [list of triggers](http://progrium.viewdocs.io/dokku/development/plugin-triggers) your plugin can implement.
3. Upload your plugin to github with a repository name in form of `dokku-<name>` (e.g. `dokku-mariadb`) 3. Upload your plugin to github with a repository name in form of `dokku-<name>` (e.g. `dokku-mariadb`)
4. Edit [this page](http://progrium.viewdocs.io/dokku/plugins) and add a link to it. 4. Edit [this page](http://progrium.viewdocs.io/dokku/plugins) and add a link to it.
5. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases 5. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases
@@ -15,7 +15,7 @@ The below plugin is a dummy `dokku hello` plugin. If your plugin exposes command
```shell ```shell
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
case "$1" in case "$1" in
hello) hello)
@@ -31,7 +31,7 @@ case "$1" in
;; ;;
help) help)
cat && cat<<EOF cat<<EOF
hello <app>, Says "Hello <app>" hello <app>, Says "Hello <app>"
hello:world, Says "Hello world" hello:world, Says "Hello world"
EOF EOF
@@ -44,6 +44,15 @@ EOF
esac esac
``` ```
Each plugin requires a `plugin.toml` descriptor file with the following required fields:
```shell
[plugin]
description = "dokku hello plugin"
version = "0.1.0"
[plugin.config]
```
A few notes: A few notes:
- You should always support `DOKKU_TRACE` as specified on the 2nd line of the plugin. - You should always support `DOKKU_TRACE` as specified on the 2nd line of the plugin.
@@ -56,7 +65,7 @@ A few notes:
```shell ```shell
IMAGE=$(docker images | grep "user/repo" | awk '{print $3}') IMAGE=$(docker images | grep "user/repo" | awk '{print $3}')
if [[ -z $IMAGE ]]; then if [[ -z $IMAGE ]]; then
dokku_log_fail "user/repo image not found... Did you run 'dokku plugins-install'?" dokku_log_fail "user/repo image not found... Did you run 'dokku plugin:install'?"
fi fi
``` ```
@@ -79,5 +88,5 @@ A few notes:
dokku config:set --no-restart APP KEY1=VALUE1 [KEY2=VALUE2 ...] dokku config:set --no-restart APP KEY1=VALUE1 [KEY2=VALUE2 ...]
dokku config:unset --no-restart APP KEY1 [KEY2 ...] dokku config:unset --no-restart APP KEY1 [KEY2 ...]
``` ```
- From time to time you may want to allow other plugins access to (some of) your plugin's functionality. You can expose this by including a `functions` file in your plugin for others to source. Consider all functions in that file to be publicly accessible by other plugins. Any functions not wished to be made "public" should reside within your pluginhook or commands files. - From time to time you may want to allow other plugins access to (some of) your plugin's functionality. You can expose this by including a `functions` file in your plugin for others to source. Consider all functions in that file to be publicly accessible by other plugins. Any functions not wished to be made "public" should reside within your plugin trigger or commands files.
- As of 0.4.0, we allow image tagging and deployment of said tagged images. Therefore, hard-coding of `$IMAGE` as `dokku/$APP` is no longer sufficient. Instead, for non `pre/post-build-*` plugins, use `get_running_image_tag()` & `get_app_image_name()` as sourced from common/functions. See [pluginhooks](http://progrium.viewdocs.io/dokku/development/pluginhooks) doc for examples. - As of 0.4.0, we allow image tagging and deployment of said tagged images. Therefore, hard-coding of `$IMAGE` as `dokku/$APP` is no longer sufficient. Instead, for non `pre/post-build-*` plugins, use `get_running_image_tag()` & `get_app_image_name()` as sourced from common/functions. See the [plugin triggers](http://progrium.viewdocs.io/dokku/development/plugin-triggers) doc for examples.
@@ -1,15 +1,15 @@
# Pluginhooks # Plugin triggers
[Pluginhooks](https://github.com/progrium/pluginhook) are a good way to jack into existing dokku infrastructure. You can use them to modify the output of various dokku commands or override internal configuration. [Plugin triggers](https://github.com/progrium/plugn) (formerly [pluginhooks](https://github.com/progrium/pluginhook)) are a good way to jack into existing dokku infrastructure. You can use them to modify the output of various dokku commands or override internal configuration.
Pluginhooks are simply scripts that are executed by the system. You can use any language you want, so long as the script: Plugin triggers are simply scripts that are executed by the system. You can use any language you want, so long as the script:
- Is executable - Is executable
- Has the proper language requirements installed - Has the proper language requirements installed
For instance, if you wanted to write a pluginhook in PHP, you would need to have `php` installed and available on the CLI prior to pluginhook invocation. For instance, if you wanted to write a plugin trigger in PHP, you would need to have `php` installed and available on the CLI prior to plugin trigger invocation.
The following is an example for the `nginx-hostname` pluginhook. It reverses the hostname that is provided to nginx during deploys. If you created an executable file named `nginx-hostname` with the following code in your plugin, it would be invoked by dokku during the normal app deployment process: The following is an example for the `nginx-hostname` plugin trigger. It reverses the hostname that is provided to nginx during deploys. If you created an executable file named `nginx-hostname` with the following code in your plugin trigger, it would be invoked by dokku during the normal app deployment process:
```shell ```shell
#!/usr/bin/env bash #!/usr/bin/env bash
@@ -21,18 +21,18 @@ NEW_SUBDOMAIN=`echo $SUBDOMAIN | rev`
echo "$NEW_SUBDOMAIN.$VHOST" echo "$NEW_SUBDOMAIN.$VHOST"
``` ```
## Available Pluginhooks ## Available plugin triggers
There are a number of plugin-related pluginhooks. These can be optionally implemented by plugins and allow integration into the standard dokku plugin setup/backup/teardown process. There are a number of plugin-related triggers. These can be optionally implemented by plugins and allow integration into the standard dokku setup/backup/teardown process.
The following pluginhooks describe those available to a dokku installation. As well, there is an example for each pluginhook that you can use as templates for your own plugin development. The following plugin triggers describe those available to a dokku installation. As well, there is an example for each trigger that you can use as templates for your own plugin development.
> The example pluginhook code is not guaranteed to be implemented as in within dokkku, and are merely simplified examples. Please look at the dokku source for larger, more in-depth examples. > The example plugin trigger code is not guaranteed to be implemented as in within dokkku, and are merely simplified examples. Please look at the dokku source for larger, more in-depth examples.
### `install` ### `install`
- Description: Used to setup any files/configuration for a plugin. - Description: Used to setup any files/configuration for a plugin.
- Invoked by: `dokku plugins-install`. - Invoked by: `dokku plugin:install`.
- Arguments: None - Arguments: None
- Example: - Example:
@@ -50,8 +50,8 @@ fi
### `dependencies` ### `dependencies`
- Description: Used to install system-level dependencies. Invoked by `plugins-install-dependencies`. - Description: Used to install system-level dependencies. Invoked by `plugin:install-dependencies`.
- Invoked by: `dokku plugins-install-dependencies` - Invoked by: `dokku plugin:install-dependencies`
- Arguments: None - Arguments: None
- Example: - Example:
@@ -77,7 +77,7 @@ esac
### `update` ### `update`
- Description: Can be used to run plugin updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates. - Description: Can be used to run plugin updates on a regular interval. You can schedule the invoker in a cron-task to ensure your system gets regular updates.
- Invoked by: `dokku plugins-update`. - Invoked by: `dokku plugin:update`.
- Arguments: None - Arguments: None
- Example: - Example:
@@ -93,7 +93,7 @@ sudo BUILD_STACK=true make install
### `commands help` ### `commands help`
- Description: Used to aggregate all plugin `help` output. Your plugin should implement a `help` command in your `commands` file to take advantage of this pluginhook. This must be implemented inside the `commands` pluginhook file. - Description: Used to aggregate all plugin `help` output. Your plugin should implement a `help` command in your `commands` file to take advantage of this plugin trigger. This must be implemented inside the `commands` plugin file.
- Invoked by: `dokku help` - Invoked by: `dokku help`
- Arguments: None - Arguments: None
- Example: - Example:
@@ -106,7 +106,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in case "$1" in
help | derp:help) help | derp:help)
cat && cat<<EOF cat<<EOF
derp:herp, Herps the derp derp:herp, Herps the derp
derp:serp [file], Shows the file's serp derp:serp [file], Shows the file's serp
EOF EOF
@@ -121,7 +121,7 @@ esac
### `backup-export` ### `backup-export`
- Description: Used to backup files for a given plugin. If your plugin writes files to disk, this pluginhook should be used to echo out their full paths. Any files listed will be copied by the backup plugin to the backup tar.gz. - Description: Used to backup files for a given plugin. If your plugin writes files to disk, this plugin trigger should be used to echo out their full paths. Any files listed will be copied by the backup plugin to the backup tar.gz.
- Invoked by: `dokku backup:export` - Invoked by: `dokku backup:export`
- Arguments: `$VERSION $DOKKU_ROOT` - Arguments: `$VERSION $DOKKU_ROOT`
- Example: - Example:
@@ -252,7 +252,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# Installs the graphicsmagick package into the container # Installs the graphicsmagick package into the container
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP" verify_app_name "$APP"
@@ -279,7 +279,7 @@ docker commit $ID $IMAGE > /dev/null
# Installs a package specified by the `CONTAINER_PACKAGE` env var # Installs a package specified by the `CONTAINER_PACKAGE` env var
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP" verify_app_name "$APP"
@@ -305,7 +305,7 @@ docker commit $ID $IMAGE > /dev/null
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP" verify_app_name "$APP"
@@ -323,7 +323,7 @@ verify_app_name "$APP"
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP" verify_app_name "$APP"
@@ -343,7 +343,7 @@ verify_app_name "$APP"
# `DOKKU_DISABLE_DEPLOY` env var is set to `true` for an app # `DOKKU_DISABLE_DEPLOY` env var is set to `true` for an app
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}" CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}"
@@ -368,7 +368,7 @@ fi
# Runs gulp in our container # Runs gulp in our container
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP" verify_app_name "$APP"
@@ -407,7 +407,7 @@ curl "http://httpstat.us/200"
# Clears out the gulp asset build cache for applications # Clears out the gulp asset build cache for applications
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) APP="$1"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP" verify_app_name "$APP"
@@ -462,7 +462,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP" verify_app_name "$APP"
@@ -480,7 +480,7 @@ verify_app_name "$APP"
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP" verify_app_name "$APP"
@@ -626,7 +626,7 @@ if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
REFERENCE_REPO="$DOKKU_ROOT/$reference_app REFERENCE_REPO="$DOKKU_ROOT/$reference_app
git clone --bare --shared --reference "$REFERENCE_REPO" "$REFERENCE_REPO" "$DOKKU_ROOT/$APP" > /dev/null git clone --bare --shared --reference "$REFERENCE_REPO" "$REFERENCE_REPO" "$DOKKU_ROOT/$APP" > /dev/null
fi fi
pluginhook receive-app $APP $newrev plugn trigger receive-app $APP $newrev
``` ```
### `tags-create` ### `tags-create`
+6 -6
View File
@@ -21,10 +21,10 @@ Enabling dokku events logger
Dokku will then write log entries to ``/var/log/syslog`` as well as a Dokku-specific logs sub-directory ``/var/log/dokku/events.log``, which can be easily displayed with the command `dokku events`: Dokku will then write log entries to ``/var/log/syslog`` as well as a Dokku-specific logs sub-directory ``/var/log/dokku/events.log``, which can be easily displayed with the command `dokku events`:
``` ```
Jul 3 16:09:48 dokku.me dokku[127630]: INVOKED: pre-release-buildstep( pythonapp ) Jul 3 16:09:48 dokku.me dokku[127630]: INVOKED: pre-release-buildpack( pythonapp )
Jul 3 16:10:02 dokku.me dokku[128095]: INVOKED: docker-args-run( rubyapp ) Jul 3 16:10:02 dokku.me dokku[128095]: INVOKED: docker-args-run( rubyapp )
Jul 3 16:10:02 dokku.me dokku[128114]: INVOKED: docker-args-run( nhl ) Jul 3 16:10:02 dokku.me dokku[128114]: INVOKED: docker-args-run( nhl )
Jul 3 16:10:03 dokku.me dokku[128136]: INVOKED: post-release-buildstep( pythonapp ) Jul 3 16:10:03 dokku.me dokku[128136]: INVOKED: post-release-buildpack( pythonapp )
Jul 3 16:10:03 dokku.me dokku[128195]: INVOKED: pre-deploy( pythonapp ) Jul 3 16:10:03 dokku.me dokku[128195]: INVOKED: pre-deploy( pythonapp )
Jul 3 16:10:23 dokku.me dokku[129253]: INVOKED: docker-args-deploy( pythonapp ) Jul 3 16:10:23 dokku.me dokku[129253]: INVOKED: docker-args-deploy( pythonapp )
Jul 3 16:10:24 dokku.me dokku[129337]: INVOKED: bind-external-ip( pythonapp ) Jul 3 16:10:24 dokku.me dokku[129337]: INVOKED: bind-external-ip( pythonapp )
@@ -47,10 +47,10 @@ docker-args-build
pre-delete pre-delete
post-deploy post-deploy
receive-app receive-app
pre-release-buildstep pre-release-buildpack
nginx-pre-reload nginx-pre-reload
docker-args-deploy docker-args-deploy
post-build-buildstep post-build-buildpack
post-domains-update post-domains-update
post-release-dockerfile post-release-dockerfile
check-deploy check-deploy
@@ -63,10 +63,10 @@ bind-external-ip
pre-deploy pre-deploy
post-delete post-delete
dependencies dependencies
pre-build-buildstep pre-build-buildpack
docker-args-run docker-args-run
pre-build-dockerfile pre-build-dockerfile
post-release-buildstep post-release-buildpack
post-build-dockerfile post-build-dockerfile
pre-release-dockerfile pre-release-dockerfile
update update
+1 -1
View File
@@ -126,7 +126,7 @@ scheme://subdomain.domain.tld
The `subdomain` is inferred from the pushed application name, while the `domain` is set during initial configuration in the `$DOKKU_ROOT/VHOST` file. The `subdomain` is inferred from the pushed application name, while the `domain` is set during initial configuration in the `$DOKKU_ROOT/VHOST` file.
You can optionally override this in a plugin by implementing the `nginx-hostname` pluginhook. For example, you can reverse the subdomain with the following sample `nginx-hostname` pluginhook: You can optionally override this in a plugin by implementing the `nginx-hostname` plugin trigger. For example, you can reverse the subdomain with the following sample `nginx-hostname` plugin trigger:
```shell ```shell
#!/usr/bin/env bash #!/usr/bin/env bash
+4 -3
View File
@@ -1,10 +1,11 @@
# Plugins # Plugins
Dokku itself is built out of plugins and uses [pluginhook](https://github.com/progrium/pluginhook) for its plugin system. In essence a plugin is a collection of scripts that will be run based on naming convention. Dokku itself is built out of plugins and uses [plugn](https://github.com/progrium/plugn) for its plugin system. In essence a plugin is a collection of scripts that will be run based on naming convention.
Let's take a quick look at the current dokku nginx plugin that's shipped with dokku by default. Let's take a quick look at the current dokku nginx plugin that's shipped with dokku by default.
nginx-vhosts/ nginx-vhosts/
├── plugin.toml # plugin metadata
├── commands # contains additional commands ├── commands # contains additional commands
├── install # runs on dokku installation ├── install # runs on dokku installation
└── post-deploy # runs after an app is deployed └── post-deploy # runs after an app is deployed
@@ -12,9 +13,9 @@ Let's take a quick look at the current dokku nginx plugin that's shipped with do
## Installing a plugin ## Installing a plugin
```shell ```shell
cd /var/lib/dokku/plugins cd /var/lib/dokku/plugins/available
git clone <git url> git clone <git url>
dokku plugins-install dokku plugin:install
``` ```
## Creating your own plugin ## Creating your own plugin
-3
View File
@@ -13,9 +13,6 @@ ps:start <app> Start app container(s)
ps:stop <app> Stop app container(s) ps:stop <app> Stop app container(s)
``` ```
*NOTE*: As of v0.3.14, `dokku deploy:all` in now deprecated by `ps:restartall` and will be removed in a future version.
## Scaling ## Scaling
Dokku allows you to run multiple process types at different container counts. For example, if you had an app that contained 1 web app listener and 1 background job processor, dokku can, spin up 1 container for each process type defined in the Procfile. By default we will only start the web process. However, if you wanted 2 job processors running simultaneously, you can modify this behavior in a few ways. Dokku allows you to run multiple process types at different container counts. For example, if you had an app that contained 1 web app listener and 1 background job processor, dokku can, spin up 1 container for each process type defined in the Procfile. By default we will only start the web process. However, if you wanted 2 job processors running simultaneously, you can modify this behavior in a few ways.
+1 -1
View File
@@ -77,7 +77,7 @@
<a href="#" class="list-group-item disabled">Development</a> <a href="#" class="list-group-item disabled">Development</a>
<a href="http://progrium.viewdocs.io/dokku/development/plugin-creation" class="list-group-item">Plugin Creation</a> <a href="http://progrium.viewdocs.io/dokku/development/plugin-creation" class="list-group-item">Plugin Creation</a>
<a href="http://progrium.viewdocs.io/dokku/development/pluginhooks" class="list-group-item">Pluginhooks</a> <a href="http://progrium.viewdocs.io/dokku/development/plugin-triggers" class="list-group-item">Plugin Triggers</a>
<a href="http://progrium.viewdocs.io/dokku/development/testing" class="list-group-item">Test Suite</a> <a href="http://progrium.viewdocs.io/dokku/development/testing" class="list-group-item">Test Suite</a>
<a href="http://progrium.viewdocs.io/dokku/development/release-process" class="list-group-item">Release Process</a> <a href="http://progrium.viewdocs.io/dokku/development/release-process" class="list-group-item">Release Process</a>
</div> </div>
+20 -32
View File
@@ -5,15 +5,23 @@ shopt -s nullglob
export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"} export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"}
export DOKKU_IMAGE=${DOKKU_IMAGE:="gliderlabs/herokuish"} export DOKKU_IMAGE=${DOKKU_IMAGE:="gliderlabs/herokuish"}
export DOKKU_ROOT=${DOKKU_ROOT:=~dokku} export DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
export DOKKU_LIB_ROOT=${DOKKU_LIB_PATH:="/var/lib/dokku"}
export PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"} export PLUGIN_PATH=${PLUGIN_PATH:="$DOKKU_LIB_ROOT/plugins"}
export PLUGIN_AVAILABLE_PATH=${PLUGIN_AVAILABLE_PATH:="$PLUGIN_PATH/available"}
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_API_VERSION=1
export DOKKU_NOT_IMPLEMENTED_EXIT=10 export DOKKU_NOT_IMPLEMENTED_EXIT=10
export DOKKU_VALID_EXIT=0 export DOKKU_VALID_EXIT=0
export DOKKU_LOGS_DIR=${DOKKU_LOGS_DIR:="/var/log/dokku"} export DOKKU_LOGS_DIR=${DOKKU_LOGS_DIR:="/var/log/dokku"}
export DOKKU_EVENTS_LOGFILE=${DOKKU_EVENTS_LOGFILE:="$DOKKU_LOGS_DIR/events.log"} export DOKKU_EVENTS_LOGFILE=${DOKKU_EVENTS_LOGFILE:="$DOKKU_LOGS_DIR/events.log"}
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
[[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc [[ -f $DOKKU_ROOT/dokkurc ]] && source $DOKKU_ROOT/dokkurc
[[ -d $DOKKU_ROOT/.dokkurc ]] && for f in $DOKKU_ROOT/.dokkurc/*; do source $f; done [[ -d $DOKKU_ROOT/.dokkurc ]] && for f in $DOKKU_ROOT/.dokkurc/*; do source $f; done
@@ -33,7 +41,7 @@ if [[ "${args[0]}" =~ ^--.* ]]; then
fi fi
! has_tty && DOKKU_QUIET_OUTPUT=1 ! has_tty && DOKKU_QUIET_OUTPUT=1
if [[ $(id -un) != "dokku" && $1 != plugins-install* && $1 != "plugins-update" ]]; then if [[ $(id -un) != "dokku" && $1 != plugin:*install* && $1 != "plugin:update" ]]; then
sudo -u dokku -E -H $0 "$@" sudo -u dokku -E -H $0 "$@"
exit exit
fi fi
@@ -63,7 +71,7 @@ case "$1" in
[[ -z $2 ]] && dokku_log_fail "Please specify an app to deploy" [[ -z $2 ]] && dokku_log_fail "Please specify an app to deploy"
APP="$2"; IMAGE_TAG="$3"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) APP="$2"; IMAGE_TAG="$3"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP" verify_app_name "$APP"
pluginhook pre-deploy $APP $IMAGE_TAG plugn trigger pre-deploy $APP $IMAGE_TAG
is_image_herokuish_based "$IMAGE" && DOKKU_HEROKUISH=true is_image_herokuish_based "$IMAGE" && DOKKU_HEROKUISH=true
DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE" DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
@@ -82,11 +90,10 @@ case "$1" in
DOKKU_PORT_FILE="$DOKKU_ROOT/$APP/PORT.$PROC_TYPE.$CONTAINER_INDEX" DOKKU_PORT_FILE="$DOKKU_ROOT/$APP/PORT.$PROC_TYPE.$CONTAINER_INDEX"
# start the app # start the app
DOCKER_ARGS=$(: | pluginhook docker-args $APP deploy $IMAGE_TAG) DOCKER_ARGS=" -e DYNO='$PROC_TYPE.$CONTAINER_INDEX' "
DOCKER_ARGS+=" -e DYNO='$PROC_TYPE.$CONTAINER_INDEX' " DOCKER_ARGS+=$(: | plugn trigger docker-args-deploy $APP $IMAGE_TAG)
DOCKER_ARGS+=$(: | pluginhook docker-args-deploy $APP $IMAGE_TAG)
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true " [[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
BIND_EXTERNAL=$(pluginhook bind-external-ip $APP) BIND_EXTERNAL=$(plugn trigger bind-external-ip $APP)
[[ -n "$DOKKU_HEROKUISH" ]] && START_CMD="/start $PROC_TYPE" [[ -n "$DOKKU_HEROKUISH" ]] && START_CMD="/start $PROC_TYPE"
@@ -130,7 +137,7 @@ case "$1" in
else else
trap kill_new INT TERM EXIT trap kill_new INT TERM EXIT
dokku_log_info1 "Running pre-flight checks" dokku_log_info1 "Running pre-flight checks"
pluginhook check-deploy $APP $id $PROC_TYPE $port $ipaddr plugn trigger check-deploy $APP $id $PROC_TYPE $port $ipaddr
trap - INT TERM EXIT trap - INT TERM EXIT
fi fi
@@ -158,7 +165,7 @@ case "$1" in
done < "$DOKKU_SCALE_FILE" done < "$DOKKU_SCALE_FILE"
dokku_log_info1 "Running post-deploy" dokku_log_info1 "Running post-deploy"
pluginhook post-deploy $APP $port $ipaddr plugn trigger post-deploy $APP $port $ipaddr
# kill the old container # kill the old container
if [[ -n "$oldids" ]]; then if [[ -n "$oldids" ]]; then
@@ -185,7 +192,7 @@ case "$1" in
# on to the next. # on to the next.
docker stop $oldid \ docker stop $oldid \
|| docker kill $oldid \ || docker kill $oldid \
|| pluginhook retire-container-failed $APP # Trigger pluginhook for event logging || plugn trigger retire-container-failed $APP # plugin trigger for event logging
done done
) & disown -a ) & disown -a
# Use trap since disown/nohup don't seem to keep child alive # Use trap since disown/nohup don't seem to keep child alive
@@ -198,22 +205,6 @@ case "$1" in
docker_cleanup docker_cleanup
;; ;;
plugins)
ls -1 -d $PLUGIN_PATH/*/
;;
plugins-install)
pluginhook install
;;
plugins-install-dependencies)
pluginhook dependencies
;;
plugins-update)
pluginhook update
;;
# DEPRECATED as of v0.3.14 # DEPRECATED as of v0.3.14
deploy:all) deploy:all)
echo "*DEPRECATED* in v0.3.14: deploy:all will be removed in future versions" echo "*DEPRECATED* in v0.3.14: deploy:all will be removed in future versions"
@@ -225,17 +216,14 @@ case "$1" in
echo "" echo ""
echo "Options:" echo "Options:"
cat<<EOF | pluginhook commands help | sort | column -c2 -t -s, cat<<EOF | plugn trigger commands help | sort | column -c2 -t -s,
help, Print the list of commands help, Print the list of commands
plugins, Print active plugins
plugins-install, Install active plugins
plugins-update, Update active plugins
EOF EOF
;; ;;
*) *)
implemented=0 implemented=0
for script in $PLUGIN_PATH/*/commands; do for script in $PLUGIN_ENABLED_PATH/*/commands; do
set +e; $script "$@" ; exit_code=$? ; set -e set +e; $script "$@" ; exit_code=$? ; set -e
if [[ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]]; then if [[ "$exit_code" -eq "$DOKKU_NOT_IMPLEMENTED_EXIT" ]]; then
continue continue
+14 -33
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
case "$1" in case "$1" in
build) build)
@@ -19,39 +19,28 @@ case "$1" in
test "$(docker wait $id)" -eq 0 test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null docker commit $id $IMAGE > /dev/null
[[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR [[ -d $CACHE_DIR ]] || mkdir $CACHE_DIR
# *DEPRECATED* in v0.3.15: `pluginhook pre-build` will be removed in future releases plugn trigger pre-build-buildpack "$APP"
pluginhook pre-build "$APP"
# *DEPRECATED* in v0.3.22: `pluginhook pre-build-buildstep` will be removed in future releases
pluginhook pre-build-buildstep "$APP"
pluginhook pre-build-buildpack "$APP"
# *DEPRECATED* in v0.3.14: `pluginhook docker-args` will be removed in future releases DOCKER_ARGS=$(: | plugn trigger docker-args-build $APP)
# https://github.com/progrium/dokku/issues/896 & https://github.com/progrium/dokku/issues/906
DOCKER_ARGS=$(: | pluginhook docker-args $APP build)
DOCKER_ARGS+=$(: | pluginhook docker-args-build $APP)
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true " [[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
id=$(docker run -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build) id=$(docker run -d -v $CACHE_DIR:/cache -e CACHE_PATH=/cache $DOCKER_ARGS $IMAGE /build)
docker attach $id docker attach $id
test "$(docker wait $id)" -eq 0 test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null docker commit $id $IMAGE > /dev/null
# *DEPRECATED* in v0.3.15: `pluginhook post-build` will be removed in future releases plugn trigger post-build-buildpack "$APP"
pluginhook post-build "$APP"
# *DEPRECATED* in v0.3.22: `pluginhook post-build-buildstep` will be removed in future releases
pluginhook post-build-buildstep "$APP"
pluginhook post-build-buildpack "$APP"
;; ;;
dockerfile) dockerfile)
# extract first port from Dockerfile # extract first port from Dockerfile
DOCKERFILE_PORT=$(get_dockerfile_exposed_port Dockerfile) DOCKERFILE_PORT=$(get_dockerfile_exposed_port Dockerfile)
[[ -n "$DOCKERFILE_PORT" ]] && config_set --no-restart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT [[ -n "$DOCKERFILE_PORT" ]] && config_set --no-restart $APP DOKKU_DOCKERFILE_PORT=$DOCKERFILE_PORT
pluginhook pre-build-dockerfile "$APP" plugn trigger pre-build-dockerfile "$APP"
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache" [[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
docker build $DOKKU_DOCKER_BUILD_OPTS -t "$IMAGE" . docker build $DOKKU_DOCKER_BUILD_OPTS -t "$IMAGE" .
pluginhook post-build-dockerfile "$APP" plugn trigger post-build-dockerfile "$APP"
;; ;;
*) *)
@@ -66,11 +55,7 @@ case "$1" in
case "$IMAGE_SOURCE_TYPE" in case "$IMAGE_SOURCE_TYPE" in
herokuish) herokuish)
# *DEPRECATED* in v0.3.15: `pluginhook pre-release` will be removed in future releases plugn trigger pre-release-buildpack "$APP" "$IMAGE_TAG"
pluginhook pre-release $APP $IMAGE_TAG
# *DEPRECATED* in v0.3.22: `pluginhook pre-release-buildstep` will be removed in future releases
pluginhook pre-release-buildstep $APP $IMAGE_TAG
pluginhook pre-release-buildpack $APP $IMAGE_TAG
if [[ -n $(config_export global) ]]; then if [[ -n $(config_export global) ]]; then
id=$(config_export global | docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh") id=$(config_export global | docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh")
test "$(docker wait $id)" -eq 0 test "$(docker wait $id)" -eq 0
@@ -81,16 +66,13 @@ case "$1" in
test "$(docker wait $id)" -eq 0 test "$(docker wait $id)" -eq 0
docker commit $id $IMAGE > /dev/null docker commit $id $IMAGE > /dev/null
fi fi
# *DEPRECATED* in v0.3.15: `pluginhook post-release` will be removed in future releases plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG"
pluginhook post-release $APP $IMAGE_TAG
# *DEPRECATED* in v0.3.22: `pluginhook post-release-buildstep` will be removed in future releases
pluginhook post-release-buildstep $APP $IMAGE_TAG
pluginhook post-release-buildpack $APP $IMAGE_TAG
;; ;;
dockerfile) dockerfile)
pluginhook pre-release-dockerfile $APP $IMAGE_TAG # buildstep plugins don't necessarily make sense for dockerfiles. call the new breed!!!
pluginhook post-release-dockerfile $APP $IMAGE_TAG plugn trigger pre-release-dockerfile "$APP" "$IMAGE_TAG"
plugn trigger post-release-dockerfile "$APP" "$IMAGE_TAG"
;; ;;
*) *)
@@ -175,8 +157,7 @@ case "$1" in
shift 2 shift 2
DOCKER_ARGS=$(: | pluginhook docker-args $APP run $IMAGE_TAG) DOCKER_ARGS=$(: | plugn trigger docker-args-run $APP $IMAGE_TAG)
DOCKER_ARGS+=$(: | pluginhook docker-args-run $APP $IMAGE_TAG)
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true " [[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
[[ $DOKKU_RM_CONTAINER ]] && DOKKU_RUN_OPTS="--rm" [[ $DOKKU_RM_CONTAINER ]] && DOKKU_RUN_OPTS="--rm"
has_tty && DOKKU_RUN_OPTS+=" -i -t" has_tty && DOKKU_RUN_OPTS+=" -i -t"
@@ -222,7 +203,7 @@ case "$1" in
;; ;;
help) help)
cat && cat<<EOF cat<<EOF
ls, Pretty listing of deployed applications and containers ls, Pretty listing of deployed applications and containers
logs <app> [-t], Show the last logs for an application (-t follows) logs <app> [-t], Show the last logs for an application (-t follows)
run <app> <cmd>, Run a command in the environment of an application run <app> <cmd>, Run a command in the environment of an application
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core standard plugin"
version = "0.4.0"
[plugin.config]
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
PLUGIN_DIR="$(dirname $0)" PLUGIN_DIR="$(dirname $0)"
+2 -2
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_pluginhook_call "$(basename $0)" "$@" [[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename $0)" "$@"
+2 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
DOKKU_RSYSLOG_FILTER=/etc/rsyslog.d/99-dokku.conf DOKKU_RSYSLOG_FILTER=/etc/rsyslog.d/99-dokku.conf
DOKKU_LOGROTATE_FILE=/etc/logrotate.d/dokku DOKKU_LOGROTATE_FILE=/etc/logrotate.d/dokku
@@ -49,6 +49,6 @@ if [[ "$flag_rsyslog_needs_restart" == "y" ]]; then
service rsyslog restart service rsyslog restart
fi fi
[[ ! "$DOKKU_EVENTS" ]] || dokku_log_pluginhook_call "$(basename $0)" "$@" [[ ! "$DOKKU_EVENTS" ]] || dokku_log_plugn_trigger_call "$(basename $0)" "$@"
exit 0 exit 0
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core events logging plugin"
version = "0.4.0"
[plugin.config]
-2
View File
@@ -1,2 +0,0 @@
Please note that the hooks in Dokku are experimental and are likely to change quite a bit.
+4 -4
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
case "$1" in case "$1" in
apps) apps)
@@ -38,7 +38,7 @@ case "$1" in
echo "Destroying $APP (including all add-ons)" echo "Destroying $APP (including all add-ons)"
pluginhook pre-delete $APP $IMAGE_TAG plugn trigger pre-delete $APP $IMAGE_TAG
DOKKU_APP_CIDS=$(get_app_container_ids $APP) DOKKU_APP_CIDS=$(get_app_container_ids $APP)
if [[ -n $DOKKU_APP_CIDS ]]; then if [[ -n $DOKKU_APP_CIDS ]]; then
for ID in $DOKKU_APP_CIDS;do for ID in $DOKKU_APP_CIDS;do
@@ -47,11 +47,11 @@ case "$1" in
done done
fi fi
pluginhook post-delete $APP $IMAGE_TAG plugn trigger post-delete $APP $IMAGE_TAG
;; ;;
help | apps:help) help | apps:help)
cat && cat<<EOF cat<<EOF
apps, List your apps apps, List your apps
apps:create <app>, Create a new app apps:create <app>, Create a new app
apps:destroy <app>, Permanently destroy an app apps:destroy <app>, Permanently destroy an app
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core apps plugin"
version = "0.4.0"
[plugin.config]
+3 -3
View File
@@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_REPO=$(get_app_image_repo $APP)
[[ -n $APP ]] && rm -r "$DOKKU_ROOT/$APP" > /dev/null APP="$1"; IMAGE_REPO=$(get_app_image_repo $APP)
[[ -n $APP ]] && rm -rf "$DOKKU_ROOT/$APP" > /dev/null
# remove all application containers & images # remove all application containers & images
# shellcheck disable=SC2046 # shellcheck disable=SC2046
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG); CACHE_DIR="$DOKKU_ROOT/$APP/cache" APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG); CACHE_DIR="$DOKKU_ROOT/$APP/cache"
verify_app_name "$APP" verify_app_name "$APP"
+4 -4
View File
@@ -11,7 +11,7 @@ case "$1" in
BACKUP_TMP_DIR=$(mktemp -d) BACKUP_TMP_DIR=$(mktemp -d)
BACKUP_TMP_FILE="$BACKUP_TMP_DIR/backup.tar" BACKUP_TMP_FILE="$BACKUP_TMP_DIR/backup.tar"
: | pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from - : | plugn trigger backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from -
pushd $BACKUP_DIR > /dev/null pushd $BACKUP_DIR > /dev/null
find . -maxdepth 1 -type d -not -name . | sed 's:./::g' > "$BACKUP_TMP_DIR/.dokku_backup_apps" find . -maxdepth 1 -type d -not -name . | sed 's:./::g' > "$BACKUP_TMP_DIR/.dokku_backup_apps"
@@ -63,7 +63,7 @@ case "$1" in
BACKUP_ROOT="$BACKUP_TMP_DIR""$DOKKU_ROOT" BACKUP_ROOT="$BACKUP_TMP_DIR""$DOKKU_ROOT"
TARGET_DIR="$DOKKU_ROOT" TARGET_DIR="$DOKKU_ROOT"
if ! pluginhook backup-check $VERSION "$BACKUP_ROOT" "$TARGET_DIR" "$BACKUP_TMP_DIR/.dokku_backup_apps"; then if ! plugn trigger backup-check $VERSION "$BACKUP_ROOT" "$TARGET_DIR" "$BACKUP_TMP_DIR/.dokku_backup_apps"; then
if $force; then if $force; then
echo "-f used. Ignoring warnings." echo "-f used. Ignoring warnings."
else else
@@ -75,7 +75,7 @@ case "$1" in
while read app; do mkdir "$TARGET_DIR/$app"; echo "Imported $app"; done < $BACKUP_TMP_DIR/.dokku_backup_apps while read app; do mkdir "$TARGET_DIR/$app"; echo "Imported $app"; done < $BACKUP_TMP_DIR/.dokku_backup_apps
# have the plugins import their stuff # have the plugins import their stuff
pluginhook backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR "$BACKUP_TMP_DIR/.dokku_backup_apps" plugn trigger backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR "$BACKUP_TMP_DIR/.dokku_backup_apps"
rm -rf $BACKUP_TMP_DIR rm -rf $BACKUP_TMP_DIR
@@ -83,7 +83,7 @@ case "$1" in
;; ;;
help | backup:help) help | backup:help)
cat && cat<<EOF cat<<EOF
backup:export [file], Export dokku configuration files backup:export [file], Export dokku configuration files
backup:import [file], Import dokku configuration files backup:import [file], Import dokku configuration files
EOF EOF
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core backup plugin"
version = "0.4.0"
[plugin.config]
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core build-env plugin"
version = "0.4.0"
[plugin.config]
@@ -1,16 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
APP="$1"; IMAGE=$(get_app_image_name $APP); BUILD_ENV="" APP="$1"; IMAGE=$(get_app_image_name $APP); BUILD_ENV=""
verify_app_name "$APP" verify_app_name "$APP"
[[ -f "$DOKKU_ROOT/BUILD_ENV" ]] && cat "$DOKKU_ROOT/BUILD_ENV" >> "$DOKKU_ROOT/ENV" && {
dokku_log_info2 "Using a global BUILD_ENV file is deprecated as of 0.3.26"
rm "$DOKKU_ROOT/BUILD_ENV"
}
config_get --global CURL_CONNECT_TIMEOUT > /dev/null 2>&1 || config_set --global CURL_CONNECT_TIMEOUT=5 config_get --global CURL_CONNECT_TIMEOUT > /dev/null 2>&1 || config_set --global CURL_CONNECT_TIMEOUT=5
config_get --global CURL_TIMEOUT > /dev/null 2>&1 || config_set --global CURL_TIMEOUT=30 config_get --global CURL_TIMEOUT > /dev/null 2>&1 || config_set --global CURL_TIMEOUT=30
+3 -3
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$(dirname $0)/functions" source "$PLUGIN_AVAILABLE_PATH/certs/functions"
is_tar_import() { is_tar_import() {
[[ -t 0 ]] && return 1 [[ -t 0 ]] && return 1
@@ -144,7 +144,7 @@ case "$1" in
if [[ -d "$APP_SSL_PATH" ]]; then if [[ -d "$APP_SSL_PATH" ]]; then
dokku_log_info1 "Removing SSL endpoint from $APP" dokku_log_info1 "Removing SSL endpoint from $APP"
rm -rf $APP_SSL_PATH rm -rf $APP_SSL_PATH
pluginhook post-domains-update $APP plugn trigger post-domains-update $APP
else else
dokku_log_info1 "An app-specific SSL endpoint is not defined" dokku_log_info1 "An app-specific SSL endpoint is not defined"
fi fi
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
# returns 'global', 'app', 'false' # returns 'global', 'app', 'false'
# if both are configured, app trumps global # if both are configured, app trumps global
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core certificate management plugin"
version = "0.4.0"
[plugin.config]
+2 -2
View File
@@ -35,8 +35,8 @@
# #
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
APP="$1"; DOKKU_APP_CONTAINER_ID="$2"; DOKKU_APP_CONTAINER_TYPE="$3"; DOKKU_APP_LISTEN_PORT="$4"; DOKKU_APP_LISTEN_IP="$5" APP="$1"; DOKKU_APP_CONTAINER_ID="$2"; DOKKU_APP_CONTAINER_TYPE="$3"; DOKKU_APP_LISTEN_PORT="$4"; DOKKU_APP_LISTEN_IP="$5"
if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then if [[ -z "$DOKKU_APP_LISTEN_PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core checks plugin"
version = "0.4.0"
[plugin.config]
+2 -1
View File
@@ -94,7 +94,7 @@ dokku_log_event() {
logger -t dokku -i -- "$@" logger -t dokku -i -- "$@"
} }
dokku_log_pluginhook_call() { dokku_log_plugn_trigger_call() {
local l_hook local l_hook
l_hook="$1" ; shift l_hook="$1" ; shift
@@ -325,6 +325,7 @@ docker_cleanup() {
# delete all non-running containers # delete all non-running containers
# shellcheck disable=SC2046 # shellcheck disable=SC2046
docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null || true docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null || true
# delete unused images # delete unused images
# shellcheck disable=SC2046 # shellcheck disable=SC2046
docker rmi $(docker images -f 'dangling=true' -q) &> /dev/null & docker rmi $(docker images -f 'dangling=true' -q) &> /dev/null &
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core common plugin"
version = "0.4.0"
[plugin.config]
+3 -15
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
case "$1" in case "$1" in
config) config)
@@ -20,20 +20,8 @@ case "$1" in
config_unset "$@" config_unset "$@"
;; ;;
config:set-norestart)
dokku_log_info2 "$1 is deprecated as of v0.3.22"
shift 1
dokku config:set --no-restart "$@"
;;
config:unset-norestart)
dokku_log_info2 "$1 is deprecated as of v0.3.22"
shift 1
dokku config:unset --no-restart "$@"
;;
help | config:help) help | config:help)
cat && cat<<EOF cat<<EOF
config (<app>|--global), Display all global or app-specific config vars config (<app>|--global), Display all global or app-specific config vars
config:get (<app>|--global) KEY, Display a global or app-specific config value config:get (<app>|--global) KEY, Display a global or app-specific config value
config:set (<app>|--global) KEY1=VALUE1 [KEY2=VALUE2 ...], Set one or more config vars config:set (<app>|--global) KEY1=VALUE1 [KEY2=VALUE2 ...], Set one or more config vars
+2 -2
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
STDIN=$(cat); APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG) STDIN=$(cat); APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE" DOCKERFILE_ENV_FILE="$DOKKU_ROOT/$APP/DOCKERFILE_ENV_FILE"
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
config_export() { config_export() {
local CONFIG_TYPE="$1" local CONFIG_TYPE="$1"
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core config plugin"
version = "0.4.0"
[plugin.config]
+2 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
PHASES=(build deploy run) PHASES=(build deploy run)
@@ -140,7 +140,7 @@ case "$1" in
# Display usage help # Display usage help
help) help)
cat && cat<<EOF cat<<EOF
docker-options <app>, Display apps docker options for all phases docker-options <app>, Display apps docker options for all phases
docker-options <app> <phase(s)>, Display apps docker options for phase (comma separated phase list) docker-options <app> <phase(s)>, Display apps docker options for phase (comma separated phase list)
docker-options:add <app> <phase(s)> OPTION, Add docker option to app for phase (comma separated phase list) docker-options:add <app> <phase(s)> OPTION, Add docker option to app for phase (comma separated phase list)
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core docker-options plugin"
version = "0.4.0"
[plugin.config]
+8 -8
View File
@@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_PATH/domains/functions" source "$PLUGIN_AVAILABLE_PATH/domains/functions"
RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}" RE_IPV4="([0-9]{1,3}[\.]){3}[0-9]{1,3}"
@@ -57,7 +57,7 @@ case "$1" in
if [[ -f "$DOKKU_ROOT/VHOST" ]]; then if [[ -f "$DOKKU_ROOT/VHOST" ]]; then
dokku_log_info1 "Creating new $VHOST_PATH..." dokku_log_info1 "Creating new $VHOST_PATH..."
SUBDOMAIN=${APP/%\.${VHOST}/} SUBDOMAIN=${APP/%\.${VHOST}/}
hostname=$(: | pluginhook nginx-hostname $APP $SUBDOMAIN $VHOST) hostname=$(: | plugn trigger nginx-hostname $APP $SUBDOMAIN $VHOST)
if [[ ! -n $hostname ]]; then if [[ ! -n $hostname ]]; then
if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then if [[ "$APP" == *.* ]] && [[ "$SUBDOMAIN" == "$APP" ]]; then
hostname="${APP/\//-}" hostname="${APP/\//-}"
@@ -95,7 +95,7 @@ case "$1" in
done done
# we need to restart the app to make sure we're binding to the appropriate network interface # we need to restart the app to make sure we're binding to the appropriate network interface
dokku nginx:build-config $APP dokku nginx:build-config $APP
pluginhook post-domains-update $APP plugn trigger post-domains-update $APP
for DOMAIN in "$@";do for DOMAIN in "$@";do
dokku_log_info1 "Added $DOMAIN to $APP" dokku_log_info1 "Added $DOMAIN to $APP"
done done
@@ -109,7 +109,7 @@ case "$1" in
rm -f "$DOKKU_ROOT/$APP/VHOST" rm -f "$DOKKU_ROOT/$APP/VHOST"
dokku domains:setup $APP dokku domains:setup $APP
pluginhook post-domains-update $APP plugn trigger post-domains-update $APP
dokku_log_info1 "Cleared domains in $APP" dokku_log_info1 "Cleared domains in $APP"
;; ;;
@@ -130,7 +130,7 @@ case "$1" in
for DOMAIN in "$@";do for DOMAIN in "$@";do
sed -i "/^$DOMAIN$/d" "$DOKKU_ROOT/$APP/VHOST" sed -i "/^$DOMAIN$/d" "$DOKKU_ROOT/$APP/VHOST"
done done
pluginhook post-domains-update $APP plugn trigger post-domains-update $APP
for DOMAIN in "$@";do for DOMAIN in "$@";do
dokku_log_info1 "Removed $DOMAIN from $APP" dokku_log_info1 "Removed $DOMAIN from $APP"
done done
@@ -138,7 +138,7 @@ case "$1" in
;; ;;
help | domains:help) help | domains:help)
cat && cat<<EOF cat<<EOF
domains <app>, List custom domains for app domains <app>, List custom domains for app
domains:add <app> DOMAIN, Add a custom domain to app domains:add <app> DOMAIN, Add a custom domain to app
domains:clear <app>, Clear all custom domains for app domains:clear <app>, Clear all custom domains for app
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
get_app_domains() { get_app_domains() {
local APP=$1; verify_app_name $APP local APP=$1; verify_app_name $APP
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core domains plugin"
version = "0.4.0"
[plugin.config]
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
case "$1" in case "$1" in
enter) enter)
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core enter plugin"
version = "0.4.0"
[plugin.config]
+7 -7
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
git_build_app_repo() { git_build_app_repo() {
verify_app_name "$1" verify_app_name "$1"
@@ -36,11 +36,11 @@ case "$1" in
# Only run this script for the master branch. You can remove this # Only run this script for the master branch. You can remove this
# if block if you wish to run it for others as well. # if block if you wish to run it for others as well.
if [[ $refname = "refs/heads/master" ]] ; then if [[ $refname = "refs/heads/master" ]] ; then
# broken out into pluginhook so we might support other methods to receive an app # broken out into plugin so we might support other methods to receive an app
pluginhook -p receive-app $APP $newrev plugn trigger receive-app $APP $newrev
else else
if test -f "$PLUGIN_PATH"/enabled/*/receive-branch; then if test -f "$PLUGIN_PATH"/enabled/*/receive-branch; then
pluginhook receive-branch $APP $newrev $refname plugn trigger receive-branch $APP $newrev $refname
else else
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master." echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master."
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\/}:master'" echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\/}:master'"
@@ -51,9 +51,9 @@ case "$1" in
git-upload-pack) git-upload-pack)
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')" APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
pluginhook git-pre-pull $APP plugn trigger git-pre-pull $APP
cat | git-upload-pack "$DOKKU_ROOT/$APP" cat | git-upload-pack "$DOKKU_ROOT/$APP"
pluginhook git-post-pull $APP plugn trigger git-post-pull $APP
;; ;;
git-build) git-build)
@@ -100,7 +100,7 @@ EOF
;; ;;
help | git:help) help | git:help)
cat echo -n ""
;; ;;
*) *)
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core git plugin"
version = "0.4.0"
[plugin.config]
+2 -2
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; REV="$2" APP="$1"; REV="$2"
# Don't trigger git build if there is no git repository. # Don't trigger git build if there is no git repository.
if [ ! -d "$DOKKU_ROOT/$APP/refs" ]; then if [ ! -d "$DOKKU_ROOT/$APP/refs" ]; then
cat || true true
else else
dokku git-build $APP $REV dokku git-build $APP $REV
fi fi
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
APP="$1" APP="$1"
NO_VHOST=$(config_get $APP NO_VHOST || true) NO_VHOST=$(config_get $APP NO_VHOST || true)
+8 -8
View File
@@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_PATH/certs/functions" source "$PLUGIN_AVAILABLE_PATH/certs/functions"
source "$PLUGIN_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_PATH/domains/functions" source "$PLUGIN_AVAILABLE_PATH/domains/functions"
validate_nginx () { validate_nginx () {
set +e set +e
@@ -95,7 +95,7 @@ EOF
if [[ -n "$SSL_INUSE" ]]; then if [[ -n "$SSL_INUSE" ]]; then
SCHEME="https" SCHEME="https"
[[ -z "$NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.ssl.conf.template" [[ -z "$NGINX_TEMPLATE" ]] && NGINX_TEMPLATE="$(dirname $0)/templates/nginx.ssl.conf.template"
SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH || true) SSL_VHOSTS=$(egrep "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH || true)
NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH || true) NONSSL_VHOSTS=$(egrep -v "^${SSL_HOSTNAME_REGEX}$" $VHOST_PATH || true)
@@ -111,7 +111,7 @@ EOF
if [[ -n "$NONSSL_VHOSTS" ]]; then if [[ -n "$NONSSL_VHOSTS" ]]; then
NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS | tr '\n' ' ') NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS | tr '\n' ' ')
xargs -i echo "-----> Configuring {}..." <<< "$NONSSL_VHOSTS" xargs -i echo "-----> Configuring {}..." <<< "$NONSSL_VHOSTS"
[[ -z "$NGINX_CUSTOM_TEMPLATE" ]] && NGINX_TEMPLATE="$PLUGIN_PATH/nginx-vhosts/templates/nginx.conf.template" [[ -z "$NGINX_CUSTOM_TEMPLATE" ]] && NGINX_TEMPLATE="$(dirname $0)/templates/nginx.conf.template"
eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF" eval "cat <<< \"$(< $NGINX_TEMPLATE)\" >> $NGINX_CONF"
fi fi
@@ -130,7 +130,7 @@ EOF
if is_deployed "$APP"; then if is_deployed "$APP"; then
dokku_log_info1 "Running nginx-pre-reload" dokku_log_info1 "Running nginx-pre-reload"
pluginhook nginx-pre-reload $APP $DOKKU_APP_LISTEN_PORT $DOKKU_APP_LISTEN_IP plugn trigger nginx-pre-reload $APP $DOKKU_APP_LISTEN_PORT $DOKKU_APP_LISTEN_IP
dokku_log_verbose "Reloading nginx" dokku_log_verbose "Reloading nginx"
validate_nginx && restart_nginx validate_nginx && restart_nginx
@@ -160,7 +160,7 @@ EOF
fi fi
;; ;;
help | nginx:help) help | nginx:help)
cat && cat<<EOF cat<<EOF
nginx:build-config <app>, (Re)builds nginx config for given app nginx:build-config <app>, (Re)builds nginx config for given app
EOF EOF
;; ;;
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core nginx-vhosts plugin"
version = "0.4.0"
[plugin.config]
+2 -2
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/config/functions"
APP="$1" APP="$1"
if [[ -f "$DOKKU_ROOT/$APP/IP.web.1" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]]; then if [[ -f "$DOKKU_ROOT/$APP/IP.web.1" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT.web.1" ]]; then
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1" APP="$1"
+84
View File
@@ -0,0 +1,84 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/plugin/functions"
case "$1" in
plugin)
plugn list
;;
plugin:install)
case "$2" in
--core)
[[ "$#" -gt 2 ]] && dokku_log_info1_quiet "Cannot install additional core plugins, running core plugin install trigger"
PLUGIN_PATH="$PLUGIN_CORE_PATH" plugn trigger install
;;
https:*|git:*)
PLUGIN_GIT_URL="$2"
download_and_enable_plugin $PLUGIN_GIT_URL
plugn trigger install
;;
*)
plugn trigger install
;;
esac
;;
plugin:install-dependencies)
if [[ $2 == "--core" ]]; then
export PLUGIN_PATH="$PLUGIN_CORE_PATH"
fi
plugn trigger dependencies
;;
plugin:update)
case "$2" in
https:*|git:*)
PLUGIN_GIT_URL="$2"
download_and_enable_plugin $PLUGIN_GIT_URL
plugn trigger update
;;
*)
plugn trigger update
;;
esac
;;
plugin:disable)
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to disable"
PLUGIN="$2"
disable_plugin "$PLUGIN"
;;
plugin:enable)
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to enable"
PLUGIN="$2"
enable_plugin "$PLUGIN"
;;
plugin:uninstall)
[[ -z $2 ]] && dokku_log_fail "Please specify a plugin to enable"
PLUGIN="$2"
uninstall_plugin "$PLUGIN"
;;
help | plugin:help)
cat<<EOF
plugin, Print active plugins
plugin:install [--core|git-url], Optionally download git-url & run install trigger for active plugins (or only core ones)
plugin:install-dependencies [--core], Run install-dependencies trigger for active plugins (or only core ones)
plugin:update [git-url], Optionally download git-url & run update trigger for active plugins
plugin:enable <name>, Enable a previously disabled plugin
plugin:disable <name>, Disable an installed plugin (third-party only)
plugin:uninstall <name>, Uninstall a plugin (third-party only)
EOF
;;
*)
exit $DOKKU_NOT_IMPLEMENTED_EXIT
;;
esac
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
disable_plugin() {
local PLUGIN="$1"
[[ -e $PLUGIN_CORE_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Cannot disable a core plugin"
[[ ! -e $PLUGIN_ENABLED_PATH/$PLUGIN ]] && dokku_log_fail "Plugin already disabled"
[[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin does not exist"
plugn disable $PLUGIN
dokku_log_info1_quiet "Plugin $PLUGIN disabled"
}
enable_plugin() {
local PLUGIN="$1"
[[ -e $PLUGIN_ENABLED_PATH/$PLUGIN ]] && dokku_log_fail "Plugin already enabled"
[[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin does not exist"
plugn enable $PLUGIN
dokku_log_info1_quiet "Plugin $PLUGIN enabled"
}
download_plugin() {
local PLUGIN_GIT_URL="$1"
plugn install $PLUGIN_GIT_URL
}
download_and_enable_plugin() {
local PLUGIN_GIT_URL="$1"
local PLUGIN_NAME=$(echo $PLUGIN_GIT_URL | awk -F '/' '{ print $NF }' | sed -e "s:.git::g")
dokku_log_info1_quiet "Cloning plugin repo $PLUGIN_GIT_URL to $PLUGIN_AVAILABLE_PATH/$PLUGIN_NAME"
download_plugin $PLUGIN_GIT_URL
enable_plugin $PLUGIN_NAME
}
uninstall_plugin() {
local PLUGIN_NAME="$1"
[[ -e $PLUGIN_CORE_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Cannot uninstall a core plugin"
[[ ! -e $PLUGIN_AVAILABLE_PATH/$PLUGIN ]] && dokku_log_fail "Plugin does not exist"
plugn uninstall $PLUGIN_NAME
dokku_log_info1_quiet "Plugin $PLUGIN uninstalled"
}
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core plugin plugin"
version = "0.4.0"
[plugin.config]
+12 -12
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$(dirname $0)/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions"
case "$1" in case "$1" in
ps) ps)
@@ -14,7 +14,7 @@ case "$1" in
dokku_log_info1_quiet "running processes in container: $CID" dokku_log_info1_quiet "running processes in container: $CID"
docker exec $DOKKU_RUN_OPTS $CID /bin/sh -c "ps auxwww" docker exec $DOKKU_RUN_OPTS $CID /bin/sh -c "ps auxwww"
done done
;; ;;
ps:start) ps:start)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
@@ -28,7 +28,7 @@ case "$1" in
else else
echo "App $APP already running" echo "App $APP already running"
fi fi
;; ;;
ps:stop) ps:stop)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
@@ -43,14 +43,14 @@ case "$1" in
else else
echo "App $APP already stopped" echo "App $APP already stopped"
fi fi
;; ;;
ps:rebuild) ps:rebuild)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
APP="$2"; verify_app_name "$APP" APP="$2"; verify_app_name "$APP"
pluginhook -p receive-app $APP plugn trigger receive-app $APP
;; ;;
ps:rebuildall) ps:rebuildall)
shopt -s nullglob shopt -s nullglob
@@ -60,7 +60,7 @@ case "$1" in
is_deployed $APP && dokku ps:rebuild $APP is_deployed $APP && dokku ps:rebuild $APP
done done
shopt -u nullglob shopt -u nullglob
;; ;;
ps:restart) ps:restart)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
@@ -70,7 +70,7 @@ case "$1" in
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0 ! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
release_and_deploy "$APP" "$IMAGE_TAG" release_and_deploy "$APP" "$IMAGE_TAG"
;; ;;
ps:restartall) ps:restartall)
shopt -s nullglob shopt -s nullglob
@@ -80,7 +80,7 @@ case "$1" in
dokku ps:restart $APP dokku ps:restart $APP
done done
shopt -u nullglob shopt -u nullglob
;; ;;
ps:scale) ps:scale)
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
@@ -98,10 +98,10 @@ case "$1" in
set_scale "$APP" "$@" set_scale "$APP" "$@"
release_and_deploy "$APP" "$IMAGE_TAG" release_and_deploy "$APP" "$IMAGE_TAG"
fi fi
;; ;;
help | ps:help) help | ps:help)
cat && cat<<EOF cat<<EOF
ps <app>, List processes running in app container(s) ps <app>, List processes running in app container(s)
ps:scale <app> <proc>=<count> [<proc>=<count>], Set how many instances of a given process to run ps:scale <app> <proc>=<count> [<proc>=<count>], Set how many instances of a given process to run
ps:start <app>, Start app container(s) ps:start <app>, Start app container(s)
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
print_dokku_scale_file() { print_dokku_scale_file() {
local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE" local APP="$1"; local DOKKU_SCALE_FILE="$DOKKU_ROOT/$APP/DOKKU_SCALE"
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core ps plugin"
version = "0.4.0"
[plugin.config]
+2 -2
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$(dirname $0)/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions"
APP="$1" APP="$1"
+4 -3
View File
@@ -30,15 +30,16 @@ case "$1" in
[[ "$line" != "$(fc -ln -1 | trim)" ]] && history -s "$line" [[ "$line" != "$(fc -ln -1 | trim)" ]] && history -s "$line"
case $CMD in case $CMD in
# shell builtins # shell builtins
clear) clear)
clear clear
;; ;;
quit|exit) quit|exit)
break break
;; ;;
# Not a built-in, run as regular dokku command # Not a built-in, run as regular dokku command
*) *)
dokku $line || true dokku $line || true
esac esac
@@ -47,7 +48,7 @@ case "$1" in
;; ;;
help | shell:help) help | shell:help)
cat && cat<<EOF cat<<EOF
shell, Spawn dokku shell shell, Spawn dokku shell
EOF EOF
;; ;;
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core shell plugin"
version = "0.4.0"
[plugin.config]
+4 -4
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$(dirname $0)/functions" source "$PLUGIN_AVAILABLE_PATH/tags/functions"
case "$1" in case "$1" in
tags) tags)
@@ -20,7 +20,7 @@ case "$1" in
tag_image "$IMAGE_REPO:latest" "$IMAGE_REPO:$IMAGE_TAG" tag_image "$IMAGE_REPO:latest" "$IMAGE_REPO:$IMAGE_TAG"
dokku_log_info2_quiet "Added $IMAGE_TAG tag to $IMAGE_REPO" dokku_log_info2_quiet "Added $IMAGE_TAG tag to $IMAGE_REPO"
pluginhook tags-create $APP $IMAGE_TAG plugn trigger tags-create $APP $IMAGE_TAG
;; ;;
tags:deploy) tags:deploy)
@@ -45,7 +45,7 @@ case "$1" in
docker rmi "$IMAGE_REPO:$IMAGE_TAG" docker rmi "$IMAGE_REPO:$IMAGE_TAG"
;; ;;
esac esac
pluginhook tags-destroy $APP $IMAGE_TAG plugn trigger tags-destroy $APP $IMAGE_TAG
;; ;;
help | tags:help) help | tags:help)
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
tag_image() { tag_image() {
docker tag -f "$1" "$2" docker tag -f "$1" "$2"
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core tags plugin"
version = "0.4.0"
[plugin.config]
+2 -3
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
case "$1" in case "$1" in
tar-from|tar:from) tar-from|tar:from)
@@ -15,7 +15,7 @@ case "$1" in
APP="$2" APP="$2"
verify_app_name "$2" verify_app_name "$2"
tee "$DOKKU_ROOT/$APP/src.tar" | wc -c tee "$DOKKU_ROOT/$APP/src.tar" | wc -c
pluginhook -p receive-app $APP plugn trigger receive-app $APP
;; ;;
tar-build) tar-build)
@@ -49,7 +49,6 @@ case "$1" in
tar -x -C "$TMP_WORK_DIR" -f "$DOKKU_ROOT/$APP/src.tar" --strip-components=$BOGUS_PARTS tar -x -C "$TMP_WORK_DIR" -f "$DOKKU_ROOT/$APP/src.tar" --strip-components=$BOGUS_PARTS
chmod -R u+r "$TMP_WORK_DIR" chmod -R u+r "$TMP_WORK_DIR"
#find -name .git -prune -exec rm -rf {} \; > /dev/null
if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]]; then if [[ -f Dockerfile ]] && [[ "$([[ -f .env ]] && grep -q BUILDPACK_URL .env; echo $?)" != "0" ]] && [[ ! -f ".buildpacks" ]]; then
dokku receive "$APP" "dockerfile" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/" dokku receive "$APP" "dockerfile" "$TMP_WORK_DIR" | sed -u "s/^/"$'\e[1G'"/"
+4
View File
@@ -0,0 +1,4 @@
[plugin]
description = "dokku core tar plugin"
version = "0.4.0"
[plugin.config]
+2 -2
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; REV="$2" APP="$1"; REV="$2"
# Don't trigger tar build if there is no tarball. # Don't trigger tar build if there is no tarball.
if [ ! -f "$DOKKU_ROOT/$APP/src.tar" ]; then if [ ! -f "$DOKKU_ROOT/$APP/src.tar" ]; then
cat || true true
else else
dokku tar-build $APP dokku tar-build $APP
fi fi
+1 -1
View File
@@ -65,7 +65,7 @@ lint:
# SC2001: See if you can use ${variable//search/replace} instead. - https://github.com/koalaman/shellcheck/wiki/SC2001 # SC2001: See if you can use ${variable//search/replace} instead. - https://github.com/koalaman/shellcheck/wiki/SC2001
@echo linting... @echo linting...
@$(QUIET) shellcheck -e SC2029 ./contrib/dokku_client.sh @$(QUIET) shellcheck -e SC2029 ./contrib/dokku_client.sh
@$(QUIET) find . -not -path '*/\.*' | xargs file | egrep "shell|bash" | grep -v directory | awk '{ print $$1 }' | sed 's/://g' | grep -v dokku_client.sh | xargs shellcheck -e SC2034,SC2086,SC2143,SC2001 @$(QUIET) find . -not -path '*/\.*' | xargs file | egrep "shell|bash" | egrep -v "directory|toml" | awk '{ print $$1 }' | sed 's/://g' | grep -v dokku_client.sh | xargs shellcheck -e SC2034,SC2086,SC2143,SC2001
unit-tests: unit-tests:
@echo running unit tests... @echo running unit tests...
+2 -2
View File
@@ -165,7 +165,7 @@ check_urls() {
} }
@test "(core) port exposure (dockerfile raw port)" { @test "(core) port exposure (dockerfile raw port)" {
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cat<<EOF > $DOCKERFILE cat<<EOF > $DOCKERFILE
EXPOSE 3001/udp EXPOSE 3001/udp
EXPOSE 3003 EXPOSE 3003
@@ -178,7 +178,7 @@ EOF
} }
@test "(core) port exposure (dockerfile tcp port)" { @test "(core) port exposure (dockerfile tcp port)" {
source "$PLUGIN_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
cat<<EOF > $DOCKERFILE cat<<EOF > $DOCKERFILE
EXPOSE 3001/udp EXPOSE 3001/udp
EXPOSE 3000/tcp EXPOSE 3000/tcp
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env bats
load test_helper
TEST_PLUGIN_NAME=smoke-test-plugin
TEST_PLUGIN_GIT_REPO=https://github.com/dokku/${TEST_PLUGIN_NAME}.git
remove_test_plugin() {
rm -rf $PLUGIN_ENABLED_PATH/$TEST_PLUGIN_NAME $PLUGIN_AVAILABLE_PATH/$TEST_PLUGIN_NAME
}
teardown() {
remove_test_plugin || true
}
@test "(plugin) plugin:install, plugin:disable, plugin:uninstall" {
run bash -c "dokku plugin:install $TEST_PLUGIN_GIT_REPO"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku plugin | grep enabled | grep $TEST_PLUGIN_NAME"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku plugin:disable $TEST_PLUGIN_NAME"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku plugin | grep disabled | grep $TEST_PLUGIN_NAME"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku plugin:uninstall $TEST_PLUGIN_NAME"
echo "output: "$output
echo "status: "$status
assert_success
run bash -c "dokku plugin | grep $TEST_PLUGIN_NAME"
echo "output: "$output
echo "status: "$status
assert_failure
}
+6 -1
View File
@@ -2,7 +2,12 @@
# constants # constants
DOKKU_ROOT=${DOKKU_ROOT:=~dokku} DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
PLUGIN_PATH=${PLUGIN_PATH:="/var/lib/dokku/plugins"} DOKKU_LIB_ROOT=${DOKKU_LIB_PATH:="/var/lib/dokku"}
PLUGIN_PATH=${PLUGIN_PATH:="$DOKKU_LIB_ROOT/plugins"}
PLUGIN_AVAILABLE_PATH=${PLUGIN_AVAILABLE_PATH:="$PLUGIN_PATH/available"}
PLUGIN_ENABLED_PATH=${PLUGIN_ENABLED_PATH:="$PLUGIN_PATH/enabled"}
PLUGIN_CORE_PATH=${PLUGIN_CORE_PATH:="$DOKKU_LIB_ROOT/core-plugins"}
PLUGIN_CORE_AVAILABLE_PATH=${PLUGIN_CORE_AVAILABLE_PATH:="$PLUGIN_CORE_PATH/available"}
TEST_APP=my-cool-guy-test-app TEST_APP=my-cool-guy-test-app
# test functions # test functions