-
Notifications
You must be signed in to change notification settings - Fork 6
/
install
executable file
·51 lines (44 loc) · 1.47 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/config"
restart_nginx() {
# shellcheck disable=SC1091
case "$(. /etc/os-release > /dev/null 2>&1 || true ; echo "$ID")" in
debian)
/usr/sbin/invoke-rc.d nginx reload > /dev/null
;;
ubuntu)
/etc/init.d/nginx reload > /dev/null
;;
opensuse)
/sbin/service nginx reload > /dev/null
;;
arch|centos|rhel)
/usr/bin/systemctl reload nginx
;;
esac
}
plugin-install() {
declare IMAGE="${POSTEIO_IMAGE}:${POSTEIO_IMAGE_VERSION}"
if [[ "${PLUGIN_DISABLE_PULL}" == "true" ]]; then
echo " ! ${PLUGIN_DISABLE_PULL_VARIABLE} environment variable detected. Not running pull command." 1>&2
echo " ! docker pull ${IMAGE}" 1>&2
return
fi
if [[ "$(docker images -q "${IMAGE}" 2> /dev/null)" == "" ]]; then
docker pull "${IMAGE}"
fi
echo "-----> Creating data directory"
mkdir -p "${POSTEIO_ROOT}" || echo "Failed to create posteio root directory"
chown dokku:dokku "${POSTEIO_ROOT}"
echo "-----> Creating nginx conf directory"
mkdir -p /etc/nginx/conf.d/ || echo "Failed to create nginx conf directory"
echo "-----> Creating nginx conf files"
touch "${POSTEIO_ROOT}/nginx.conf"
chown dokku:dokku "${POSTEIO_ROOT}/nginx.conf"
echo "include ${POSTEIO_ROOT}/nginx.conf;" > /etc/nginx/conf.d/dokku_posteio.conf
echo "-----> Restarting nginx"
restart_nginx
}
plugin-install "$@"