41 lines
1.6 KiB
Bash
Executable File
41 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
SOURCE_DIR=$(realpath $(dirname "${0}"))/kanboard
|
|
|
|
# Check prerequisites
|
|
docker image ls | grep -q postfix || $(realpath $(dirname "${0}"))/postfix.sh
|
|
docker image ls | grep -q postgres || $(realpath $(dirname "${0}"))/postgres.sh
|
|
|
|
# Build Docker container
|
|
docker build -t kanboard ${SOURCE_DIR}
|
|
|
|
# Populate database
|
|
export KANBOARD_PWD=$(head -c 18 /dev/urandom | base64)
|
|
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
|
|
docker run --rm kanboard cat /srv/kanboard/app/Schema/Sql/postgres.sql | docker exec -i -e PGPASSWORD=${KANBOARD_PWD} postgres psql kanboard kanboard
|
|
|
|
# Configure Kanboard
|
|
mkdir -p /srv/kanboard/conf /srv/kanboard/data/
|
|
chown -R 8009:8009 /srv/kanboard/data
|
|
envsubst <${SOURCE_DIR}/srv/kanboard/conf/config.php >/srv/kanboard/conf/config.php
|
|
export KANBOARD_ADMIN_USER=admin
|
|
export KANBOARD_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
|
|
export KANBOARD_ADMIN_HASH=$(docker run --rm kanboard php -r "echo password_hash('${KANBOARD_ADMIN_PWD}', PASSWORD_BCRYPT);")
|
|
envsubst <${SOURCE_DIR}/adminpwd.sql | docker exec -i postgres psql kanboard
|
|
|
|
# Create KanBoard service
|
|
cp ${SOURCE_DIR}/etc/init.d/kanboard /etc/init.d/kanboard
|
|
rc-update add kanboard
|
|
service kanboard start
|
|
|
|
# Create nginx app definition
|
|
cp ${SOURCE_DIR}/etc/nginx/conf.d/kanboard.conf /etc/nginx/conf.d/kanboard.conf
|
|
service nginx reload
|
|
|
|
# Install cron job
|
|
cp ${SOURCE_DIR}/etc/periodic/daily/kanboard /etc/periodic/daily/kanboard
|
|
|
|
# Add portal application definition
|
|
portal-app-manager kanboard "https://{host}:8409/" "${KANBOARD_ADMIN_USER}" "${KANBOARD_ADMIN_PWD}"
|
|
portal-app-manager kanboard-mobile -p clienturl "http://{host}:8809/"
|