Ricerca nel sito web

Come installare Focalboard su Ubuntu 22.04


Questo tutorial esiste per queste versioni del sistema operativo

  • Ubuntu 22.04 (Jammy Jellyfish)
  • Ubuntu 20.04 (Focal Fossa)

Su questa pagina

  1. Prerequisiti
  2. Installa e configura PostgreSQL
  3. Installa e configura Focalboard
  4. Crea un file di servizio Systemd per Focalboard
  5. Configura Nginx come proxy inverso
  6. Accedi all'interfaccia web di Focalboard
  7. Abilita SSL su Focalboard
  8. Conclusione

Focalboard è uno strumento di gestione dei progetti open source e self-hosted. È multilingue e un'alternativa ad Asana, Trello e Notion che può essere utilizzata dagli sviluppatori per tenere traccia e gestire il lavoro tra i team. Si basa su kanban ed è disponibile per desktop e server. Può essere utilizzato come server personale autonomo per test e sviluppo. Focalboard aiuta gli sviluppatori a rimanere allineati per completare le attività, raggiungere traguardi e raggiungere i propri obiettivi.

In questo post, ti mostreremo come installare Focalboard con Nginx come proxy inverso su Ubuntu 22.04.

Prerequisiti

  • Un server che esegue Ubuntu 22.04.
  • Un nome di dominio valido indicato con l'IP del tuo server.
  • Sul server è configurata una password di root.

Installa e configura PostgreSQL

Focalboard utilizza PostgreSQL per archiviare i propri dati. Quindi il server del database PostgreSQL deve essere installato sul tuo sistema.

Se non è installato, puoi installarlo con altri pacchetti usando il seguente comando:

apt-get install curl wget gnupg2 -y
apt-get install postgresql postgresql-contrib -y

Dopo aver installato PostgreSQL, connettiti a PostgreSQL utilizzando il seguente comando:

su - postgres
psql

Successivamente, crea un database e un utente per PostgreSQL con il seguente comando:

CREATE DATABASE focaldb;
CREATE USER focaluser WITH PASSWORD 'password';

Successivamente, esci dalla shell PostgreSQL con il seguente comando:

\q
exit

Una volta terminato, puoi procedere al passaggio successivo.

Installa e configura Focalboard

Innanzitutto, visita la pagina di download di Focalboard Git Hub e scarica l'ultima versione di Focalboard utilizzando il seguente comando:

VER=$(curl -s https://api.github.com/repos/mattermost/focalboard/releases/latest|grep tag_name | cut -d '"' -f 4)
wget https://github.com/mattermost/focalboard/releases/download/${VER}/focalboard-server-linux-amd64.tar.gz

Una volta completato il download, estrai il file scaricato con il seguente comando:

tar -xvzf focalboard-server-linux-amd64.tar.gz

Successivamente, sposta la focalboard nella directory /opt usando il seguente comando:

mv focalboard /opt

Successivamente, modifica il file di configurazione di Focalboard:

nano /opt/focalboard/config.json

modificare le seguenti righe che corrispondono al database come mostrato di seguito:

"dbtype": "postgres",
"dbconfig": "postgres://focaluser:/focaldb?sslmode=disable&connect_timeout=10",

Salva e chiudi il file quando hai finito.

Crea un file di servizio Systemd per Focalboard

È una buona idea avviare e gestire Focalboard con systemd. Per fare ciò, dovrai creare un file di servizio systemd per Focalboard:

nano /lib/systemd/system/focalboard.service

Aggiungi le seguenti righe:

[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

Salva e chiudi il file, quindi ricarica il demone systemd per applicare le modifiche:

systemctl daemon-reload

Successivamente, avvia e abilita il servizio Focalboard con il seguente comando:

systemctl start focalboard
systemctl enable focalboard

Ora puoi controllare lo stato della Focalboard con il seguente comando:

systemctl status focalboard

Otterrai il seguente output:

? focalboard.service - Focalboard server
     Loaded: loaded (/lib/systemd/system/focalboard.service; disabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-08-21 11:22:22 UTC; 8s ago
   Main PID: 4347 (focalboard-serv)
      Tasks: 4 (limit: 2242)
     Memory: 18.1M
        CPU: 1.977s
     CGroup: /system.slice/focalboard.service
             ??4347 /opt/focalboard/bin/focalboard-server

Aug 21 11:22:23 ubuntu2204 focalboard-server[4347]: debug [2022-08-21 11:22:23.507 Z] listener(s) for blockID                  caller="ws/ser>
Aug 21 11:22:23 ubuntu2204 focalboard-server[4347]: debug [2022-08-21 11:22:23.507 Z] listener(s) for blockID                  caller="ws/ser>
Aug 21 11:22:23 ubuntu2204 focalboard-server[4347]: debug [2022-08-21 11:22:23.510 Z] listener(s) for workspaceID              caller="ws/ser>
Aug 21 11:22:23 ubuntu2204 focalboard-server[4347]: debug [2022-08-21 11:22:23.510 Z] listener(s) for blockID                  caller="ws/ser>
Aug 21 11:22:23 ubuntu2204 focalboard-server[4347]: debug [2022-08-21 11:22:23.510 Z] listener(s) for blockID                  caller="ws/ser>
Aug 21 11:22:24 ubuntu2204 focalboard-server[4347]: debug [2022-08-21 11:22:24.928 Z] import archive - done                    caller="app/im>
Aug 21 11:22:24 ubuntu2204 focalboard-server[4347]: info  [2022-08-21 11:22:24.937 Z] initialized workspace                    caller="app/wo>
Aug 21 11:22:24 ubuntu2204 focalboard-server[4347]: info  [2022-08-21 11:22:24.941 Z] Server.Start                             caller="server>
Aug 21 11:22:24 ubuntu2204 focalboard-server[4347]: info  [2022-08-21 11:22:24.941 Z] http server started                      caller="web/we>
Aug 21 11:22:24 ubuntu2204 focalboard-server[4347]: info  [2022-08-21 11:22:24.947 Z] Starting unix socket server              caller="server>

A questo punto, Focalboard è avviato e in ascolto sulla porta 8000. Puoi controllare le sue porte in ascolto usando il seguente comando:

ss -antpl | grep focalboard

Otterrai il seguente output:

LISTEN 0      4096               *:8000            *:*    users:(("focalboard-serv",pid=4347,fd=9))
LISTEN 0      4096               *:9092            *:*    users:(("focalboard-serv",pid=4347,fd=8))

Una volta terminato, puoi procedere al passaggio successivo.

Configura Nginx come proxy inverso

Successivamente, è una buona idea installare e configurare Nginx come proxy inverso per accedere a Focalboard tramite la porta 80. Innanzitutto, installa il server Nginx con il seguente comando:

apt-get install nginx -y

Una volta installato il server Nginx, crea un file di configurazione dell'host virtuale Nginx:

nano /etc/nginx/conf.d/focalboard.conf

Aggiungi le seguenti righe:

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

server {
   listen 80;

   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;
   }
}

Salva e chiudi il file quando hai finito, quindi verifica Nginx per qualsiasi errore di configurazione della sintassi con il seguente comando:

nginx -t

Otterrai il seguente output:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Successivamente, riavvia il servizio Nginx per applicare le modifiche alla configurazione:

systemctl restart nginx

Puoi anche controllare lo stato di Nginx usando il seguente comando:

systemctl status nginx

Dovresti vedere il seguente output:

? nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-08-21 11:24:08 UTC; 7s ago
       Docs: man:nginx(8)
    Process: 5017 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 5018 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 5019 (nginx)
      Tasks: 2 (limit: 2242)
     Memory: 2.6M
        CPU: 35ms
     CGroup: /system.slice/nginx.service
             ??5019 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
             ??5020 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

Aug 21 11:24:08 ubuntu2204 systemd[1]: Starting A high performance web server and a reverse proxy server...
Aug 21 11:24:08 ubuntu2204 systemd[1]: Started A high performance web server and a reverse proxy server.

Accedi all'interfaccia web di Focalboard

Ora apri il tuo browser web e digita l'URL http://focalboard.example.com/login per accedere a Focalboard. Verrai reindirizzato alla pagina di accesso di Focalboard:

Fare clic sul pulsante Crea un account. Dovresti vedere la pagina di creazione dell'account Focalboard:

Fornisci il tuo indirizzo e-mail, il nome utente dell'amministratore, la password e fai clic sul pulsante Registrati. Dovresti vedere la dashboard di Focalboard nella pagina seguente:

Abilita SSL su Focalboard

Per motivi di sicurezza, è una buona idea proteggere Focalboard con Lets Encrypt SSL. Successivamente, dovrai installare il pacchetto client Certbot per installare e gestire Lets Encrypt SSL.

Innanzitutto, installa Certbot con il seguente comando:

apt-get install python3-certbot-nginx -y

Al termine dell'installazione, esegui il seguente comando per installare Lets Encrypt SSL sul tuo sito web:

certbot --nginx -d focalboard.example.com

Ti verrà chiesto di fornire un indirizzo email valido e di accettare i termini di servizio come mostrato di seguito:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for focalboard.example.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/conf.d/focalboard.conf

Successivamente, scegli se reindirizzare o meno il traffico HTTP su HTTPS come mostrato di seguito:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Digita 2 e premi Invio per completare l'installazione. Dovresti vedere il seguente output:

Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/focalboard.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://focalboard.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=focalboard.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/focalboard.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/focalboard.example.com/privkey.pem
   Your cert will expire on 2022-11-21. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

 - We were unable to subscribe you the EFF mailing list because your
   e-mail address appears to be invalid. You can try again later by
   visiting https://act.eff.org.

Conclusione

Congratulazioni! hai installato con successo Focalboard con Nginx come proxy inverso su Ubuntu 22.04. Ora puoi implementare Focalboard nella tua organizzazione e iniziare a gestire e monitorare facilmente i tuoi progetti dal browser web. Non esitate a chiedermi se avete domande.