这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.vagrant
.vagrant/*
.DS_Store
stack.tgz
build
tmp
tmp/*
*.deb
43 changes: 41 additions & 2 deletions docs/development/plugin-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,53 @@ If you create your own plugin:
3. Edit [this page](http://progrium.viewdocs.io/dokku/plugins) and add a link to it.
4. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases

### Sample plugin
### Sample plugin - new structure
The below plugin is a dummy `dokku hello` plugin.

hello/command

```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"

[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2";

echo "Hello $APP"
```

hello/subcommands/world

```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"

[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2";

echo "Hello world"
```

hello/help.txt

```shell
: <app> Says "Hello <app>"
hello:world Says "Hello world"
```


### Sample plugin - old structure (still supported but not advised)

The below plugin is a dummy `dokku hello` plugin. If your plugin exposes commands, this is a good template for your `commands` file:

```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$(dirname $0)/../common/functions"
source "$PLUGIN_PATH/common/functions"

case "$1" in
hello)
Expand Down
29 changes: 4 additions & 25 deletions dokku
Original file line number Diff line number Diff line change
Expand Up @@ -138,22 +138,6 @@ case "$1" in
docker rmi $(docker images -f 'dangling=true' -q) &> /dev/null &
;;

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
deploy:all)
echo "*DEPRECATED* in v0.3.14: deploy:all will be removed in future versions"
Expand All @@ -165,29 +149,24 @@ case "$1" in
echo ""
echo "Options:"

cat<<EOF | pluginhook commands help | sort
help Print the list of commands
plugins Print active plugins
plugins-install Install active plugins
plugins-update Update active plugins
EOF
pluginhook commands help | sort
;;

*)
implemented=0
for script in $PLUGIN_PATH/*/commands; do
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
fi

implemented=1
if [ "$exit_code" -ne "$DOKKU_VALID_EXIT" ]; then
if [[ "$exit_code" -ne "$DOKKU_VALID_EXIT" ]]; then
exit $exit_code
fi
done

if [ "$implemented" -eq 0 ]; then
if [[ "$implemented" -eq 0 ]]; then
dokku_log_warn "\`$*\` is not a dokku command."
dokku_log_warn "See \`dokku help\` for a list of available commands."
exit 1
Expand Down
209 changes: 0 additions & 209 deletions plugins/00_dokku-standard/commands

This file was deleted.

2 changes: 0 additions & 2 deletions plugins/WARNING

This file was deleted.

4 changes: 4 additions & 0 deletions plugins/apps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Dokku core apps plugin

This plugin handles creation and destruction of applications.

6 changes: 6 additions & 0 deletions plugins/apps/command
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_PATH/common/functions"

dokku_log_info2_quiet "My Apps"
find $DOKKU_ROOT -follow -maxdepth 1 -type d \( ! -iname ".*" \) -not -path $DOKKU_ROOT/tls | sed 's|^\./||g' | sed 's|'$DOKKU_ROOT'\/||' | tail -n +2 | sort
Loading