focalboard/website/site/content/download/personal-edition/ubuntu.md
Harshil Sharma 08db4fed61
Workspace switcher (#1052)
* API WIP

* WIP

* Finished changes

* Fixed colors:

* Don't enforce charset adn collation in migration, pick from database DSN

* Added MySQL query

* Updated mocks

* Added tests

* Lint fixes

* Fixed typo and removed unsed style

* Checked in a snapshot

* Updated snapshot

* Updated Cypress test

* Updated Cypress test

* Updated Cypress test

* Fixed review comments

* Fixed tests

* Added default collation for MySQL

* Added documentation for ensuring correct database collation

* Updated migrations

* Fixed a bug with collation

* Fixed lint errors

* Used correct collation

* debugging

* Updating css

* Minor UI changes

* USe inbuilt default collation

* Used only charset for mysql

* Fixed linter issue:

* Added migration for matching collation

* Reverted local config changes

* Reverted local config changes

* Handled the case of personal server running on MySQL

* WIP

* Now running collation matching migration onlyt for plugins

* Minor optimization

* Multiple review fixes

* Added group by clause to primary query

* Supported for subpacth

Co-authored-by: Asaad Mahmood <asaadmahmood@users.noreply.github.com>
2021-09-08 10:22:03 +05:30

6.9 KiB

title date subsection weight
Personal Server (Ubuntu) 2020-12-15T12:02:23-04:00 Personal Edition 2

Focalboard Personal Server allows your team to work together on shared project boards.

Follow these steps it up on an Ubuntu server. To upgrade an existing installation, see the upgrade guide.

Set up Ubuntu Server 18.04

Popular hosted options include:

Install Focalboard

Download the Ubuntu archive package from the appropriate release in GitHub. E.g. this is the link for v0.7.0 (which may no longer be the latest one):

wget https://github.com/mattermost/focalboard/releases/download/v0.7.0/focalboard-server-linux-amd64.tar.gz
tar -xvzf focalboard-server-linux-amd64.tar.gz
sudo mv focalboard /opt

Install NGINX

By default, the Focalboard server runs on port 8000 (specified in config.json). We recommend running NGINX as a web proxy to forward http and websocket requests from port 80 to it. To install NGINX, run:

sudo apt update
sudo apt install nginx

You may need to adjust your firewall settings depending on the host, e.g.

Configure NGINX

Create a new site config:

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

Copy and paste this 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;
   }
}

If there is a default site, you may need to delete it

sudo rm /etc/nginx/sites-enabled/default

Enable the Focalboard site, test the config, and reload NGINX:

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

Set up TLS on NGINX

For a production server, it's important to set up TLS to encrypt web traffic. Without this, your login passwords and data are unprotected. Refer to the NGINX TLS guide and Let's Encrypt Certbot guide on setting this up.

Focalboard stores data in a SQLite database by default, but we recommend running against Postgres in production (we've tested against Postgres 10.15). To install, run:

sudo apt install postgresql postgresql-contrib

Then run as the postgres user to create a new database:

sudo --login --user postgres
psql

On the psql prompt, run the following commands (change the user/password to your own values):

CREATE DATABASE boards;
CREATE USER <b>boardsuser</b> WITH PASSWORD '<b>boardsuser-password</b>';
\q

Exit the postgres user session:

exit

Edit the Focalboard config.json:

nano /opt/focalboard/config.json

Change the dbconfig setting to use the postgres database you created:

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

Install MySQL

As an alternative to Postgres, you also can store your data in a MySQL database. To install, run:

sudo apt-get install mysql-server

Log in as root in your database:

sudo mysql

At the MySQL prompt, run the following commands (change user/password to your own values):

CREATE DATABASE boards;
GRANT ALL on boards.* to 'boardsuser'@'localhost' identified by 'boardsuser-password';

Exit the mysql-prompt:

exit

Edit the Focalboard config.json:

nano /opt/focalboard/config.json

Change the dbconfig setting to use the MySQL database you created:

When MySQL is being used, using collation is recommended over using charset.

Using a variant of utf8mb4 collation is required. For example, utf8mb4_general_ci is used by default when no collation is specified.

If you're using Focalboard as a Mattermost Plugin prior to version 0.9 with MySQL, please ensure the collations of focalboard tables (tables with the prefix focalboard_) is the same as the collation of mattermost tables.

"dbtype": "mysql",
"dbconfig": "boardsuser:boardsuser-password@tcp(127.0.0.1:3306)/boards",

Configure Focalboard to run as a service

This will keep the server running across reboots. First, create a new service config file:

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

Paste in the following:

[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 start it on machine reboot:

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

Test the server

At this point, the Focalboard server should be running.

Test that it's running locally with:

curl localhost:8000
curl localhost

The first command checks that the server is running on port 8000 (default), and the second checks that NGINX is proxying requests successfully. Both commands should return the same snippet of HTML.

To access the server remotely, open a browser to its IP address or domain.

Set up the server

Refer to the server setup guide to complete server setup.