50 lines
1.8 KiB
Bash
50 lines
1.8 KiB
Bash
|
#!/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
|