How to install Restyaboard

Install Restyaboard an Open source kanban board. I am using it on daily basis to manage this blog.

Nextcloud
Restyaboard

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 PostgreSQL server.

$ sudo apt-get install postgresql

Create user and password for Restyaboard application.

$ sudo -u postgres psql -c "CREATE ROLE restyaboard WITH LOGIN PASSWORD 'restyaboard'"

Create database.

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

Configure database authentication for created user.

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

Reload PostrgeSQL 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

Specify default PHP timezone.

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

Reload PHP Fast Process Manager.

$ sudo systemctl reload php7.0-fpm

Create directory to store SSL certificate.

$ sudo mkdir /etc/nginx/ssl

Create single domain SSL certificate.

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

Create nginx site configuration. It is the default configuration located in a project repository.

$ sudo cat << EOF | 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.0-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) {
                        break;
                }
                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;
        }
}

EOF

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 debault index file.

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

Download recent Restyaboard release.

$ wget https://github.com/RestyaPlatform/board/releases/download/v0.6.1/board-v0.6.1.zip

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

$ sudo unzip -d /var/www/html/ board-v0.6.1.zip

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

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

Configure database access.

$ sudo sed -i -e "/^define('R_DB_HOST'/c\define('R_DB_HOST', 'localhost');" /var/www/html/server/php/config.inc.php
$ sudo sed -i -e "/^define('R_DB_USER'/c\define('R_DB_USER', 'restyaboard');" /var/www/html/server/php/config.inc.php
$ sudo sed -i -e "/^define('R_DB_PASSWORD'/c\define('R_DB_PASSWORD', 'restyaboard');" /var/www/html/server/php/config.inc.php
$ sudo sed -i -e "/^define('R_DB_NAME'/c\define('R_DB_NAME', 'restyaboard');" /var/www/html/server/php/config.inc.php
$ sudo sed -i -e "/^define('R_DB_PORT'/c\define('R_DB_PORT', 5432);" /var/www/html/server/php/config.inc.php

Load database schema.

$ psql restyaboard --username=restyaboard --password --host=localhost < /var/www/html/sql/restyaboard_with_empty_data.sql 

Get basic board applications.

$ sudo git clone https://github.com/RestyaPlatform/board-apps.git /var/www/html/client/apps

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

Restyaboard installation process does not require any special actions. Official installer performs too many operations, so I decided to describe it using simplest possible way. Just remember to change passwords.

Additional information

Restyaboard » Install & Configure

Restyaboard » Apps

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system.