Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move crontab to recommended location #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
7 changes: 7 additions & 0 deletions install
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
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 "/etc/sudoers.d/dokku-supply-config"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@josegonzalez I've had a look at the nginx and postgres plugin and it seems like this is what's needed. However, when I try to install the plugin the dokku-supply-config is not created. I'm not sure exactly what I'm missing here.

6 changes: 6 additions & 0 deletions post-extract
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down