#!/bin/usr/fish

#### PostgreSQL required

# Install Kanboard

## Find the latest release on https://github.com/kanboard/kanboard/releases
set version '1.2.11'

## PostgreSQL setup
sudo -u postgres psql -f Templates/postgres_kanboard.sql
sudo mkdir -p "/var/www/kanboard-$version"
sudo cp Templates/config.php "/var/www/kanboard-$version/"

## Install PHP
sudo apt install -y apache2 libapache2-mod-php php-cli php-mbstring  \
    php-opcache php-json php-pgsql php-gd php-xml php-zip

## Install Kanboard
### Go to apache folder
cd /var/www

### Download the latest release from https://github.com/kanboard/kanboard/releases
sudo wget "https://github.com/kanboard/kanboard/archive/v$version.zip"

### Deploy
sudo unzip "v$version.zip"
sudo mkdir "kanboard-$version/plugins"
sudo chown -R www-data:www-data "kanboard-$version/data"
sudo chown -R www-data:www-data "kanboard-$version/plugins"
sudo rm "v$version.zip"

