diff --git a/README.md b/README.md index 84793a5..3a8c42e 100644 --- a/README.md +++ b/README.md @@ -24,3 +24,5 @@ This plugin provides hooks: This plugin allows you to store configuration files which reside in the dokku app directory, such as ENV, inside the app's git repository. For example, say you want to include a file called DOCKER_OPTIONS for the [Docker options plugin](https://github.com/dyson/dokku-docker-options). In the root directory of your app repository, create a directory called `.dokku` and put the files in there. This plugin will copy those files into `$DOKKU_ROOT/$APP/` before building the app. + +Optionally if you place a `crontab` in `.dokku` it will move this crontab file to `/etc/cron.d/$APP` diff --git a/install b/install new file mode 100644 index 0000000..c50dbc7 --- /dev/null +++ b/install @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config" +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + + +echo "%dokku ALL=(ALL) NOPASSWD: /bin/cp, /usr/sbin/service cron restart" > /etc/sudoers.d/dokku-supply-config +chmod 0440 "$_SUDOERS_FILE" diff --git a/post-extract b/post-extract index db0adab..719ad0f 100755 --- a/post-extract +++ b/post-extract @@ -10,6 +10,12 @@ suppy-config-post-extract() { if [[ -d "$TMPDIR/.dokku" ]] && [[ "$(ls -A "$TMPDIR/.dokku")" ]]; then output=$(cp -r "$TMPDIR/.dokku/." "$DOKKU_ROOT/$APP") dokku_log_verbose_quiet "$output" + + if [[ "$(ls -A "$TMPDIR/.dokku/crontab")" ]]; then + output=$(sudo cp -r "$TMPDIR/.dokku/crontab" "/etc/cron.d/$APP") + dokku_log_verbose_quiet "$output" + sudo service cron restart + fi fi }