If you have used a project management tool such as Trello, Wekan, and any other related one, you may find yourself at home when using Planka. What I like about Planka is that it has a clean UI and a handful of features. So let’s dive into how to install Planka – A real-time Kanban board application.
It is written using React and Redux-related tools with a Postgres database as the backend database.
This installation follows the manual setup of Planka with Postgres on Ubuntu OS.
1- Setup database
The first thing we will do is install the PostgreSQL database and create a database and user.
apt install postgresql postgresql-contrib ca-certificates curl gnupg
Start the service and enable it at boot.
systemctl start postgresql
systemctl enable postgresql
Login to PostgreSQL as the postgres
user.
sudo -iu postgres
Create a new user and database with:
createuser planka_user -P
createdb planka
We will assign the planka_user to the planka database in the psql
shell.
psql
GRANT ALL PRIVILEGES ON DATABASE planka TO planka_user;
\q
exit
2- Install Nodejs
We will install Nodejs from its repositories.
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=18
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
Update the system and install Nodejs now.
apt update
apt install nodejs
Check the Nodejs version with, node -v
.
3- Install Planka
As we will be using Apache as a reverse proxy, the user www-data
will suffice here.
apt install apache2 vim
Download the package (1.16.1 at this time).
cd /var/www
curl -fsSL https://github.com/plankanban/planka/releases/download/v1.16.1/planka-prebuild-v1.16.1.zip -o planka-prebuild.zip
unzip planka-prebuild.zip
rm planka-prebuild.zip
chown -R www-data:www-data /var/www/planka/
Install all the dependencies:
cd planka
npm install
The configuration is .env and we need to make a few changes there.
cp .env.sample .env
Create a secret key and copy it:
openssl rand -hex 64
vim .env
Change the variable in bold:
## Required
BASE_URL=http://YOUR_DOMAIN_NAME.COM
DATABASE_URL=postgresql://planka:YOUR_DATABASE_PASSWORD@localhost/planka
SECRET_KEY=YOUR_GENERATED_KEY
## Optional
# TRUST_PROXY=0
# TOKEN_EXPIRES_IN=365 # In days
# related: https://github.com/knex/knex/issues/2354
# As knex does not pass query parameters from the connection string we
# have to use environment variables in order to pass the desired values, e.g.
# PGSSLMODE=<value>
# Configure knex to accept SSL certificates
# KNEX_REJECT_UNAUTHORIZED_SSL_CERTIFICATE=false
DEFAULT_ADMIN_EMAIL=YOUR_ADMIN_EMAIL # Do not remove if you want to prevent this user from being edited/deleted
DEFAULT_ADMIN_PASSWORD=YOUR_ADMIN_PASSWORD
DEFAULT_ADMIN_NAME=YOUR_ADMIN_NAME
DEFAULT_ADMIN_USERNAME=YOUR_ADMIN_USERNAME
# OIDC_ISSUER=
# OIDC_CLIENT_ID=
# OIDC_CLIENT_SECRET=
# OIDC_SCOPES=openid email profile
# OIDC_ADMIN_ROLES=admin
# OIDC_ROLES_ATTRIBUTE=groups
# OIDC_IGNORE_ROLES=true
## Do not edit this
TZ=UTC
Start Planka while in /var/www/planka directory:
npm run db:init && npm start --prod
Until here, everything is good so far. Before we proceed to the browser side of things, let’s set up the proxy.
4- Apache proxy with SSL
Create a virtual host file.
cd /etc/apache2/sites-available
vim planka.conf
Copy the following into it while making changes to suit your needs.
<VirtualHost *:80>
ServerName DOMAIN.COM
DocumentRoot /var/www/html
<Directory "/var/www/html">
AllowOverride All
Options -Indexes +FollowSymLinks
</Directory>
ErrorLog /var/log/apache2/DOMAIN.COM_error.log
</VirtualHost>
Save and enable this virtual host.
a2dissite 000-default.conf
a2ensite planka.conf
apachectl -t
systemctl restart apache2
Once you restart Apache, you can now get an SSL certificate from Let’s encrypt.
apt install snap snapd
certbot certonly --webroot -w /var/www/html -d DOAMIN.COM
After successfully obtaining the certificates, we will now add the port 443 block to the virtual host. Change domain name to your actual domain.
<VirtualHost *:443>
ServerName DOMAIN.COM
DocumentRoot /var/www/html
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLHonorCipherOrder On
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
Protocols h2 http/1.1
<Directory "/var/www/html">
AllowOverride All
Options -Indexes +FollowSymLinks
</Directory>
ErrorLog /var/log/apache2/DOMAIN.COM_error.log
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:1337/$1 [P,L]
SSLProxyEngine on
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /.well-known !
ProxyPassReverse /.well-known !
ProxyPass /robots.txt !
ProxyPassReverse /robots.txt !
ProxyPass / http://localhost:1337/
ProxyPassReverse / http://localhost:1337/
SSLEngine on
SSLCertificateKeyFile /etc/letsencrypt/live/DOMAIN.COM/privkey.pem
SSLCertificateFile /etc/letsencrypt/live/DOMAIN.COM/fullchain.pem
</VirtualHost>
Check the configuration file and restart Apache.
apachectl -t
systemctl restart apache2
You can now browse to your domain name and log in with the admin email and password provided in the .env file.
To automatically redirect to HTTPS, add the following in the port 80 block and restart Apache.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}