diff --git a/00-install.sh b/00-install.sh index 86c287e..1ebe622 100755 --- a/00-install.sh +++ b/00-install.sh @@ -10,6 +10,7 @@ ${SOURCE_DIR}/02-sahana.sh ${SOURCE_DIR}/03-sambro.sh ${SOURCE_DIR}/10-seeddms.sh ${SOURCE_DIR}/50-pandora.sh +${SOURCE_DIR}/60-kanboard.sh # Perform cleanup only if DEBUG environment variable is not set if [ ${DEBUG:-0} -eq 0 ]; then diff --git a/60-kanboard.sh b/60-kanboard.sh new file mode 100755 index 0000000..f99f69d --- /dev/null +++ b/60-kanboard.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +SOURCE_DIR=$(realpath $(dirname "${0}")) + +# Install dependencies for Kanboard +apt-get -y --no-install-recommends install php7.0-gd php7.0-fpm php7.0-mbstring php7.0-pgsql php7.0-zip + +# Install Kanboard +wget https://github.com/kanboard/kanboard/releases/download/v1.0.47/kanboard-1.0.47.zip -O /srv/kanboard.zip +unzip /srv/kanboard.zip -d /srv +rm -f /srv/kanboard.zip + +# Populate database +export KANBOARD_PWD=$(head -c 18 /dev/urandom | base64) +envsubst <${SOURCE_DIR}/kanboard/tmp/kanboard-createdb.sql >/tmp/kanboard-createdb.sql +sudo -u postgres psql -f /tmp/kanboard-createdb.sql +rm -f /tmp/kanboard-createdb.sql +export PGPASSWORD=${KANBOARD_PWD} +psql -f /srv/kanboard/app/Schema/Sql/postgres.sql kanboard kanboard + +# Configure Kanboard +envsubst <${SOURCE_DIR}/kanboard/srv/kanboard/config.php >/srv/kanboard/config.php +export KANBOARD_ADMIN_USER=admin +export KANBOARD_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) +envsubst <${SOURCE_DIR}/kanboard/tmp/kanboard-adminpwd.sql >/tmp/kanboard-adminpwd.sql +psql -f /tmp/kanboard-adminpwd.sql kanboard kanboard +unset PGPASSWORD + +# Create OS user +adduser --system --group --home /srv/kanboard --shell /bin/false kanboard +chown -R kanboard:www-data /srv/kanboard/ + +# Create PHP and nginx app definition +cp ${SOURCE_DIR}/kanboard/etc/php/7.0/fpm/pool.d/kanboard.conf /etc/php/7.0/fpm/pool.d/kanboard.conf +cp ${SOURCE_DIR}/kanboard/etc/nginx/apps-available/kanboard /etc/nginx/apps-available/kanboard +ln -s /etc/nginx/apps-available/kanboard /etc/nginx/apps-enabled/kanboard + +# Restart services +systemctl restart php7.0-fpm +systemctl restart nginx + +# Install cron job +cp ${SOURCE_DIR}/kanboard/etc/cron.d/kanboard /etc/cron.d/kanboard + +# Add portal application definition +${SOURCE_DIR}/basic/portal-app-manager.py kanboard "/kanboard/" "${KANBOARD_ADMIN_USER}" "${KANBOARD_ADMIN_PWD}" + +# TODO: Admin pwd set +# TODO: Portal card diff --git a/kanboard/etc/cron.d/kanboard b/kanboard/etc/cron.d/kanboard new file mode 100644 index 0000000..d7ccc99 --- /dev/null +++ b/kanboard/etc/cron.d/kanboard @@ -0,0 +1 @@ +0 8 * * * kanboard /srv/kanboard/cli cronjob >/dev/null diff --git a/kanboard/etc/nginx/apps-available/kanboard b/kanboard/etc/nginx/apps-available/kanboard new file mode 100644 index 0000000..55b0f68 --- /dev/null +++ b/kanboard/etc/nginx/apps-available/kanboard @@ -0,0 +1,11 @@ +location /kanboard { + alias /srv/kanboard; + index index.php; + try_files = $uri $uri/ /kanboard/index.php; + + location ~ \.php$ { + include snippets/fastcgi-php.conf; + fastcgi_param SCRIPT_FILENAME $request_filename; + fastcgi_pass unix:/run/php/kanboard.sock; + } +} diff --git a/kanboard/etc/php/7.0/fpm/pool.d/kanboard.conf b/kanboard/etc/php/7.0/fpm/pool.d/kanboard.conf new file mode 100644 index 0000000..342d334 --- /dev/null +++ b/kanboard/etc/php/7.0/fpm/pool.d/kanboard.conf @@ -0,0 +1,12 @@ +[kanboard] +user = kanboard +group = kanboard + +listen = /run/php/kanboard.sock +listen.owner = www-data +listen.group = www-data + +pm = ondemand +pm.max_children = 8 + +php_admin_value[open_basedir] = /srv/kanboard:/tmp diff --git a/kanboard/srv/kanboard/config.php b/kanboard/srv/kanboard/config.php new file mode 100644 index 0000000..a725d2c --- /dev/null +++ b/kanboard/srv/kanboard/config.php @@ -0,0 +1,239 @@ +