2018-01-02 11:19:00 +01:00
|
|
|
#!/bin/sh
|
2017-10-13 09:33:26 +02:00
|
|
|
|
2017-12-04 17:48:37 +01:00
|
|
|
SOURCE_DIR=$(realpath $(dirname "${0}"))/kanboard
|
2017-10-13 09:33:26 +02:00
|
|
|
|
2018-01-23 21:27:18 +01:00
|
|
|
# Check prerequisites
|
2018-02-01 21:04:01 +01:00
|
|
|
docker image ls | grep -q postfix || $(realpath $(dirname "${0}"))/postfix.sh
|
2018-01-23 21:27:18 +01:00
|
|
|
docker image ls | grep -q postgres || $(realpath $(dirname "${0}"))/postgres.sh
|
|
|
|
|
2018-01-02 11:19:00 +01:00
|
|
|
# Build Docker container
|
|
|
|
docker build -t kanboard ${SOURCE_DIR}
|
2017-10-14 10:30:47 +02:00
|
|
|
|
2017-10-13 09:33:26 +02:00
|
|
|
# Populate database
|
|
|
|
export KANBOARD_PWD=$(head -c 18 /dev/urandom | base64)
|
2018-01-02 11:19:00 +01:00
|
|
|
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
|
2018-01-24 15:42:57 +01:00
|
|
|
docker run --rm kanboard cat /srv/kanboard/app/Schema/Sql/postgres.sql | docker exec -i -e PGPASSWORD=${KANBOARD_PWD} postgres psql kanboard kanboard
|
2017-10-13 09:33:26 +02:00
|
|
|
|
|
|
|
# Configure Kanboard
|
2018-01-24 15:42:57 +01:00
|
|
|
mkdir -p /srv/kanboard/conf /srv/kanboard/data/
|
|
|
|
chown -R 8009:8009 /srv/kanboard/data
|
2018-01-02 11:19:00 +01:00
|
|
|
envsubst <${SOURCE_DIR}/srv/kanboard/conf/config.php >/srv/kanboard/conf/config.php
|
2017-10-13 09:33:26 +02:00
|
|
|
export KANBOARD_ADMIN_USER=admin
|
|
|
|
export KANBOARD_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
2018-01-24 15:42:57 +01:00
|
|
|
export KANBOARD_ADMIN_HASH=$(docker run --rm kanboard php -r "echo password_hash('${KANBOARD_ADMIN_PWD}', PASSWORD_BCRYPT);")
|
2018-01-02 11:19:00 +01:00
|
|
|
envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql kanboard
|
2017-10-13 09:33:26 +02:00
|
|
|
|
2018-01-02 11:19:00 +01:00
|
|
|
# Create KanBoard service
|
|
|
|
cp ${SOURCE_DIR}/etc/init.d/kanboard /etc/init.d/kanboard
|
2018-02-06 21:54:11 +01:00
|
|
|
rc-update add kanboard
|
2018-01-02 11:19:00 +01:00
|
|
|
service kanboard start
|
2017-10-13 09:33:26 +02:00
|
|
|
|
2018-01-02 11:19:00 +01:00
|
|
|
# Create nginx app definition
|
|
|
|
cp ${SOURCE_DIR}/etc/nginx/conf.d/kanboard.conf /etc/nginx/conf.d/kanboard.conf
|
|
|
|
service nginx reload
|
2017-10-13 09:33:26 +02:00
|
|
|
|
|
|
|
# Install cron job
|
2018-01-02 11:19:00 +01:00
|
|
|
cp ${SOURCE_DIR}/etc/periodic/daily/kanboard /etc/periodic/daily/kanboard
|
2017-10-13 09:33:26 +02:00
|
|
|
|
|
|
|
# Add portal application definition
|
2018-01-02 11:19:00 +01:00
|
|
|
portal-app-manager kanboard "https://{host}:8409/" "${KANBOARD_ADMIN_USER}" "${KANBOARD_ADMIN_PWD}"
|
2017-12-04 17:38:48 +01:00
|
|
|
portal-app-manager kanboard-mobile
|