Install Restyaboard, an Open Source Kanban board.



Update package index.

$ sudo apt-get update

Upgrade installed packages.

$ sudo apt-get upgrade

Install basic utilities.

$ sudo apt-get install unzip wget git

Install the PostgreSQL server.

$ sudo apt-get install postgresql

Create a database user and password for the Restyaboard application.

Role restya is hard-coded in the SQL file, so remember this later if you want to use a different one.
$ sudo -u postgres psql -c "CREATE ROLE restya WITH LOGIN PASSWORD 'restyaboard'"

Create database.

$ sudo -u postgres createdb -O restya -E UTF8 restyaboard

Determine the location for the host-based authentication configuration file.

$ sudo -u postgres psql -c 'SHOW hba_file' -t

Update database authentication.

$ cat << EOF | sudo tee -a /etc/postgresql/11/main/pg_hba.conf
# restyaboard
host    restyaboard      restya          md5

Reload PostgreSQL server configuration.

$ sudo -u postgres psql -c "SELECT pg_reload_conf()"

Install nginx web server.

$ sudo apt-get install nginx-full

Install PHP Fast Process Manager with additional modules.

$ sudo apt-get install php-fpm php-pgsql php-curl php-imagick php-mbstring php-xml

Determine the location of the PHP configuration file.

$ php -i | grep "Loaded Configuration File"
Loaded Configuration File => /etc/php/7.3/cli/php.ini

Specify the default PHP timezone.

$ sudo sed -i -e "s/^;date.timezone =/date.timezone = Europe/Warsaw/" /etc/php/7.3/fpm/php.ini

Determine PHP FPM service name.

$ systemctl list-units php*
php7.3-fpm.service    loaded active running The PHP 7.3 FastCGI Process Manager
phpsessionclean.timer loaded active waiting Clean PHP session files every 30 mins
LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
2 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

Reload PHP Fast Process Manager.

$ sudo systemctl reload php7.3-fpm

Create a directory to store the SSL certificate.

$ sudo mkdir /etc/nginx/ssl

Create a single-domain SSL certificate.

$ sudo openssl req -subj "/" -x509 -nodes -days 730 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt

Create an Nginx site configuration. It is the default configuration located in the project repository – restyaboard.conf.

$ sudo cat << EOF | sudo tee /etc/nginx/sites-available/restyaboard
server {
        #listen 80 default_server;
        listen 443 ssl;

        ssl_certificate ssl/nginx.crt;
        ssl_certificate_key ssl/nginx.key;

        server_name _;

        root /var/www/html;
        index  index.html index.php;

        gzip on;
        gzip_disable "msie6";

        gzip_comp_level 6;
        # gzip_comp_level 9;
        gzip_min_length  1100;
        gzip_buffers 16 8k;
        gzip_proxied any;
        # gzip_http_version 1.1;
        gzip_types       text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss;

        client_max_body_size 300M;

        rewrite ^/oauth/authorize$ /server/php/authorize.php last;
        rewrite ^/oauth_callback/([a-zA-Z0-9_\.]*)/([a-zA-Z0-9_\.]*)\$ /server/php/oauth_callback.php?plugin=\$1&code=\$2 last;
        rewrite ^/download/([0-9]*)/([a-zA-Z0-9_\.]*)\$ /server/php/download.php?id=\$1&hash=\$2 last;
        rewrite ^/ical/([0-9]*)/([0-9]*)/([a-z0-9]*).ics\$ /server/php/ical.php?board_id=\$1&user_id=\$2&hash=\$3 last;
        rewrite ^/api/(.*)$ /server/php/R/r.php?_url=\$1&\$args last;
        rewrite ^/api_explorer/api-docs/$ /client/api_explorer/api-docs/index.php last;

        location / {
                root /var/www/html/client;

        location ~ \.php\$ {
                try_files \$uri =404;
                include fastcgi_params;
                fastcgi_pass    unix:/run/php/php7.3-fpm.sock;
                fastcgi_index   index.php;
                fastcgi_param   SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
                fastcgi_param   PHP_VALUE "upload_max_filesize=80M \n post_max_size=120M \n max_execution_time=200 \n max_input_time=200 \n memory_limit=256M";

        location ~* \.(css|js|less|html|ttf|woff|jpg|jpeg|gif|png|bmp|ico) {
                root /var/www/html/client;
                if (-f \$request_filename) {
                rewrite ^/img/([a-zA-Z_]*)/([a-zA-Z_]*)/([a-zA-Z0-9_\.]*)\$ /server/php/image.php?size=\$1&model=\$2&filename=\$3 last;
                add_header        Cache-Control public;
                add_header        Cache-Control must-revalidate;
                expires           7d;

Disable default Nginx site.

$ sudo unlink /etc/nginx/sites-enabled/default

Enable configured site.

$ sudo ln -s /etc/nginx/sites-available/restyaboard /etc/nginx/sites-enabled/

Reload Nginx configuration.

$ sudo systemctl reload nginx

Remove the default index file.

$ sudo rm /var/www/html/index.nginx-debian.html

Download recent Restyaboard release.

$ wget

Extract application to the /var/www/html/ directory.

$ sudo unzip -d /var/www/html/

Change user and group to www-data:www-data.

$ sudo chown -R www-data:www-data /var/www/html

Configure database access in /var/www/html/server/php/ configuration file.

    define('R_DB_HOST', 'localhost');
    define('R_DB_USER', 'restya');
    define('R_DB_PASSWORD', 'hjVl2!rGd');
    define('R_DB_NAME', 'restyaboard');
    define('R_DB_PORT', 5432);
$ sudo sed -i -e "s/define('R_DB_PASSWORD', 'hjVl2\!rGd');/define('R_DB_PASSWORD', 'restyaboard');/" /var/www/html/server/php/

Load database schema (provide the password when asked).

$ sudo cat /var/www/html/sql/restyaboard_with_empty_data.sql | psql restyaboard --username=restya --password --host=localhost

Get basic board applications.

$ sudo git clone /var/www/html/client/apps

Remove Codenames application.

$ sudo rm -rf  /var/www/html/client/apps/r_codenames

Remove .git directory. Alternatively, you can deny access to this directory using Nginx.

$ sudo rm -rf /var/www/html/client/apps/.git

Fix permissions for additional applications.

$ sudo chown -R www-data:www-data /var/www/html/client/apps

That is all. Use user username/restya password or admin username/restya the password to log into an application.