-
Notifications
You must be signed in to change notification settings - Fork 6
/
install
executable file
·35 lines (28 loc) · 1.02 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
enable_systemd_unit() {
local plugin_path="$PLUGIN_AVAILABLE_PATH/monit"
if hash systemctl 2> /dev/null; then
cp -f "$plugin_path/dokku-monit.service" /etc/systemd/system/
systemctl reenable dokku-monit.service
systemctl start dokku-monit.service
else
echo >&2 "Could not install systemd unit because systemctl was not found."
return 1
fi
}
plugin-install() {
local plugin_path="$PLUGIN_AVAILABLE_PATH/monit"
if [[ ! -f "$DOKKU_ROOT/.monitrc" ]]; then
password=$(openssl rand -hex 16)
sigil -f "$plugin_path/templates/monitrc.sigil" DOKKU_ROOT="$DOKKU_ROOT" PASSWORD="$password" > "$DOKKU_ROOT/.monitrc"
chown dokku:dokku "$DOKKU_ROOT/.monitrc"
chmod 0600 "$DOKKU_ROOT/.monitrc"
fi
if hash monit 2> /dev/null; then
enable_systemd_unit
else
echo >&2 "Could not find Monit. Please run dokku plugin:install-dependencies."
fi
}
plugin-install