focalboard/website/site/content/download/personal-edition/ubuntu.md

198 lines
5.7 KiB
Markdown
Raw Normal View History

2021-01-07 23:12:26 +01:00
---
title: "Personal Server (Ubuntu)"
date: "2020-12-15T12:02:23-04:00"
subsection: Personal Edition
weight: 2
---
2021-01-26 18:49:49 +01:00
Focalboard Personal Server allows your team to work together on shared project boards.
2021-01-11 20:33:53 +01:00
Follow these steps it up on an Ubuntu server. To upgrade an existing installation, see [the upgrade guide](../ubuntu-upgrade).
2021-01-07 23:12:26 +01:00
## Set up Ubuntu Server 18.04
Popular hosted options include:
* [Digital Ocean](https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04)
* [Amazon EC2](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html)
2021-01-26 18:49:49 +01:00
## Install Focalboard
2021-01-07 23:12:26 +01:00
2021-05-24 21:02:02 +02:00
Download the Ubuntu archive package from the appropriate [release in GitHub](https://github.com/mattermost/focalboard/releases). E.g. this is the link for v0.6.7 (which may no longer be the latest one):
2021-01-07 23:12:26 +01:00
```
2021-05-24 21:02:02 +02:00
wget https://github.com/mattermost/focalboard/releases/download/v0.6.7/focalboard-server-linux-amd64.tar.gz
2021-01-26 20:13:05 +01:00
tar -xvzf focalboard-server-linux-amd64.tar.gz
sudo mv focalboard /opt
2021-01-07 23:12:26 +01:00
```
## Install NGINX
2021-01-26 18:49:49 +01:00
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:
2021-01-07 23:12:26 +01:00
```
sudo apt update
sudo apt install nginx
```
You may need to adjust your firewall settings depending on the host, e.g.
* [Digital Ocean](https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04)
* [EC2](https://docs.nginx.com/nginx/deployment-guides/amazon-web-services/ec2-instances-for-nginx/)
### Configure NGINX
Create a new site config:
```
2021-01-26 20:13:05 +01:00
sudo nano /etc/nginx/sites-available/focalboard
2021-01-07 23:12:26 +01:00
```
Copy and paste this configuration:
```
2021-01-26 20:13:05 +01:00
upstream focalboard {
2021-01-07 23:12:26 +01:00
server localhost:8000;
keepalive 32;
}
server {
listen 80 default_server;
2021-01-26 20:13:05 +01:00
server_name focalboard.example.com;
2021-01-07 23:12:26 +01:00
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;
2021-01-26 20:13:05 +01:00
proxy_pass http://focalboard;
2021-01-07 23:12:26 +01:00
}
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;
2021-01-26 20:13:05 +01:00
proxy_pass http://focalboard;
2021-01-07 23:12:26 +01:00
}
}
```
2021-01-26 20:13:05 +01:00
Enable the site, test the config, and reload NGINX:
```
2021-03-13 16:07:37 +01:00
sudo ln -s /etc/nginx/sites-available/focalboard /etc/nginx/sites-enabled/focalboard
2021-01-26 20:13:05 +01:00
sudo nginx -t
sudo /etc/init.d/nginx reload
```
2021-01-25 20:08:42 +01:00
## Set up TLS on NGINX
2021-01-21 20:58:19 +01:00
2021-02-01 21:05:14 +01:00
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](https://docs.nginx.com/nginx/admin-guide/security-controls/terminating-ssl-http/) and [Let's Encrypt Certbot guide](https://certbot.eff.org/lets-encrypt/ubuntubionic-nginx) on setting this up.
2021-01-21 20:58:19 +01:00
2021-01-07 23:12:26 +01:00
## Install Postgresql (Recommended)
2021-01-26 18:49:49 +01:00
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:
2021-01-07 23:12:26 +01:00
```
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):
<pre>
2021-01-26 20:13:05 +01:00
CREATE DATABASE boards;
CREATE USER <b>boardsuser</b> WITH PASSWORD '<b>boardsuser-password</b>';
2021-01-07 23:12:26 +01:00
\q
</pre>
Exit the postgres user session:
```
exit
```
2021-01-26 18:49:49 +01:00
Edit the Focalboard config.json:
2021-01-07 23:12:26 +01:00
```
2021-01-26 20:13:05 +01:00
nano /opt/focalboard/config.json
2021-01-07 23:12:26 +01:00
```
Change the dbconfig setting to use the postgres database you created:
```
"dbtype": "postgres",
2021-01-26 20:13:05 +01:00
"dbconfig": "postgres://boardsuser:boardsuser-password@localhost/boards?sslmode=disable&connect_timeout=10",
2021-01-07 23:12:26 +01:00
```
2021-01-26 18:49:49 +01:00
## Configure Focalboard to run as a service
2021-01-07 23:12:26 +01:00
This will keep the server running across reboots. First, create a new service config file:
```
2021-01-26 20:17:55 +01:00
sudo nano /lib/systemd/system/focalboard.service
2021-01-07 23:12:26 +01:00
```
Paste in the following:
```
[Unit]
2021-01-26 18:49:49 +01:00
Description=Focalboard server
2021-01-07 23:12:26 +01:00
[Service]
Type=simple
Restart=always
RestartSec=5s
2021-01-28 23:23:52 +01:00
ExecStart=/opt/focalboard/bin/focalboard-server
2021-01-26 20:13:05 +01:00
WorkingDirectory=/opt/focalboard
2021-01-07 23:12:26 +01:00
[Install]
WantedBy=multi-user.target
```
Make systemd reload the new unit, and start it on machine reboot:
```
sudo systemctl daemon-reload
2021-01-26 20:17:55 +01:00
sudo systemctl start focalboard.service
sudo systemctl enable focalboard.service
2021-01-07 23:12:26 +01:00
```
## Test the server
2021-01-26 18:49:49 +01:00
At this point, the Focalboard server should be running.
2021-01-07 23:12:26 +01:00
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.
2021-01-21 20:54:28 +01:00
## Set up the server
2021-03-13 16:07:37 +01:00
Refer to the [server setup guide](/guide/server-setup/) to complete server setup.