How to Install Focalboard on Ubuntu 18.04

Update your system using following command.

sudo apt update -y

Download the focalboard packages and then unpack it to /opt/focalboard

wget https://releases.mattermost.com/focalboard/0.5.0/focalboard-server-linux-amd64.tar.gz
gzip -dc focalboard-server-linux-amd64.tar.gz | tar -xvzf -
sudo mv focalboard /opt

Install NGINX

Now install NGINX using the following command. By default, the Focalboard server runs on port 8000

sudo apt install nginx

Adjust firewall setting as per your need. You can open port 8000 in the firewall or you can disable the firewall in your server.

Configure NGINX

Create new config site.

sudo nano /etc/nginx/sites-available/focalboard 

Copy and paste following configuration:

upstream focalboard {
   server localhost:8000;
   keepalive 32;
}

server {
   listen 80 default_server;

   server_name focalboard.example.com;

   location ~ /ws/* {
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       client_max_body_size 50M;
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_buffers 256 16k;
       proxy_buffer_size 16k;
       client_body_timeout 60;
       send_timeout 300;
       lingering_timeout 5;
       proxy_connect_timeout 1d;
       proxy_send_timeout 1d;
       proxy_read_timeout 1d;
       proxy_pass http://focalboard;
   }

   location / {
       client_max_body_size 50M;
       proxy_set_header Connection "";
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_buffers 256 16k;
       proxy_buffer_size 16k;
       proxy_read_timeout 600s;
       proxy_cache_revalidate on;
       proxy_cache_min_uses 2;
       proxy_cache_use_stale timeout;
       proxy_cache_lock on;
       proxy_http_version 1.1;
       proxy_pass http://focalboard;
   }
}

Test the config and reload NGINX using the following commands:

sudo ln -s /etc/nginx/sites-available/focalboard /etc/nginx/sites-enabled/focalboard
sudo nginx -t
sudo /etc/init.d/nginx reload

Install Postgresql

To install Postgresql, run the following commands on the server.

sudo apt install postgresql postgresql-contrib

Now login as a postgres user to create new database:

sudo --login --user postgres
psql

Currently you are in psql prompt, run the following commands(Change username and password if you want)

CREATE DATABASE focal;
CREATE USER focaluser WITH PASSWORD 'focaluser-password';
\q

Exit the session.

exit

Edit the Focalboard config.json:

nano /opt/focalboard/config.json

Now change the dbconfig setting to use the postgres database which you have created:

"dbtype": "postgres",
"dbconfig": "postgres://boardsuser:boardsuser-password@localhost/boards?sslmode=disable&connect_timeout=10",

Configure focalboard service

Create a new service config file:

sudo nano /lib/systemd/system/focalboard.service

And paste following lines in file.

[Unit]
Description=Focalboard server

[Service]
Type=simple
Restart=always
RestartSec=5s
ExecStart=/opt/focalboard/bin/focalboard-server
WorkingDirectory=/opt/focalboard

[Install]
WantedBy=multi-user.target

Make systemd reload the new unit, and enable it:

sudo systemctl daemon-reload
sudo systemctl start focalboard.service
sudo systemctl enable focalboard.service

Enter the IP Address:8000 in browser to open the focalboar. You will see following screen.

focalboard

Now click the link to register a new user instead, and complete the registration. focalboard