Jul 16, 2024 4 min read

Kanboard: The Ultimate Self-Hosting Setup

Kanboard: The Ultimate Self-Hosting Setup
Table of Contents

Kanboard is a lightweight, open-source task and project management tool, ideal for tech-savvy users who want full control of their data and workflows. With features like a simple Kanban interface, built-in automation, and API support, Kanboard is an excellent choice for users looking to self-host a highly customizable and secure solution. In this guide, we’ll cover the end-to-end process of deploying, configuring, and managing Kanboard, including installation, reverse proxy setup, logging, backups, updates, and leveraging its unique features.

Installing Kanboard

πŸ“¦ Docker/Docker Compose Setup

Using Docker is an efficient way to deploy Kanboard while simplifying dependency management and updates. Below is a docker-compose.yml file tailored for Kanboard:


version: '3.8'

services:

kanboard:

image: kanboard/kanboard:latest

container_name: kanboard

ports:

- "8080:80" # Map Kanboard to port 8080 on your host

volumes:

- ./data:/var/www/app/data # Store Kanboard data persistently

- ./plugins:/var/www/app/plugins # Mount external plugins

environment:

- DEBUG=false # Set to true for debugging

- DATABASE_URL=sqlite:/var/www/app/data/db.sqlite # Default SQLite setup

restart: unless-stopped

Deploy Kanboard with the following commands:


mkdir kanboard && cd kanboard

nano docker-compose.yml # Paste the above YAML file

docker-compose up -d # Start the Kanboard container

Access Kanboard by navigating to http://<your-server-ip>:8080 in your browser.

πŸš€ Manual Installation

To install Kanboard on a Linux server without Docker, follow these steps:


sudo apt update && sudo apt install -y apache2 php unzip curl

sudo apt install -y php-sqlite3 php-mbstring php-json php-gd # Install PHP extensions

curl -LO https://github.com/kanboard/kanboard/archive/refs/heads/master.zip

unzip master.zip

sudo mv kanboard-master /var/www/kanboard

sudo chown -R www-data:www-data /var/www/kanboard

sudo chmod -R 755 /var/www/kanboard

## Configure Apache for Kanboard

echo "<VirtualHost *:80>

DocumentRoot /var/www/kanboard

<Directory /var/www/kanboard>

AllowOverride All

</Directory>

</VirtualHost>" | sudo tee /etc/apache2/sites-available/kanboard.conf

sudo a2ensite kanboard.conf

sudo systemctl reload apache2

Visit http://<your-server-ip> to use Kanboard.

Configuring Nginx as a Reverse Proxy

🌐 Nginx Configuration

Set up Nginx to act as a reverse proxy for Kanboard:


sudo apt install nginx -y

echo "server {

listen 80;

server_name yourdomain.com;

location / {

proxy_pass http://127.0.0.1:8080; # Forward to Kanboard Docker container or Apache

proxy_set_header Host \$host;

proxy_set_header X-Real-IP \$remote_addr;

proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;

}

}" | sudo tee /etc/nginx/sites-available/kanboard

sudo ln -s /etc/nginx/sites-available/kanboard /etc/nginx/sites-enabled/

sudo nginx -t # Test configuration

sudo systemctl reload nginx

πŸ”’ SSL/TLS Setup

Use Let’s Encrypt to secure Kanboard with HTTPS:


sudo apt install certbot python3-certbot-nginx -y

sudo certbot --nginx -d yourdomain.com

sudo systemctl reload nginx

Certificates will auto-renew every 90 days using certbot.

πŸ› οΈ Testing and Reloading Nginx

Test the configuration and reload Nginx whenever changes are made:


sudo nginx -t

sudo systemctl reload nginx

Logging and Debugging Kanboard

πŸ—ƒοΈ Enabling Debug Logs

Enable debug logging in Kanboard by modifying the config.php file:


// Add this to /var/www/kanboard/config.php

define('DEBUG', true);

define('LOG_DRIVER', 'file');

define('LOG_FILE', '/var/www/kanboard/data/debug.log');

πŸ“„ Viewing Logs

If using Docker, view logs with:


docker logs kanboard

For manual installations, check the log file:


tail -f /var/www/kanboard/data/debug.log

πŸ› οΈ Troubleshooting Common Issues

  • Database Errors: Ensure SQLite or the configured database is accessible. Check permissions on the data folder.

  • Broken Plugins: Disable plugins in the config.php file if they are causing errors.

πŸ“€ Exporting Logs

Send logs to an ELK Stack or external system:


docker logs kanboard | curl -X POST -H "Content-Type: application/json" -d @- http://elk-server:9200/kanboard_logs

Backup and Restore

πŸ—‚οΈ File-Based Backups

Backup the entire Kanboard directory:


tar -czvf kanboard-backup.tar.gz /var/www/kanboard

Restore with:


tar -xzvf kanboard-backup.tar.gz -C /var/www/

πŸ”„ Database Backups

For SQLite:


cp /var/www/kanboard/data/db.sqlite /path/to/backup/

For MySQL:


mysqldump -u root -p kanboard_db > kanboard_backup.sql

Restore MySQL with:


mysql -u root -p kanboard_db < kanboard_backup.sql

πŸ“… Automated Backup Scripts

Create a cron job to automate backups:


echo "0 2 * * * tar -czvf /backups/kanboard-$(date +\%F).tar.gz /var/www/kanboard" | crontab -

Updating and Upgrading Kanboard

⬆️ Updating Docker Images

Update Kanboard to the latest version using Docker:


docker-compose pull kanboard

docker-compose up -d

πŸ› οΈ Manual Updates

For manual installations:


curl -LO https://github.com/kanboard/kanboard/archive/refs/heads/master.zip

unzip master.zip

cp -r kanboard-master/* /var/www/kanboard

sudo chown -R www-data:www-data /var/www/kanboard

πŸ” Checking for Updates

Check releases on the official Kanboard GitHub page.

Leveraging Kanboard’s Unique Features

πŸ”§ Enabling APIs

Activate the API by editing config.php:


define('API_AUTHENTICATION_HEADER', true);

Test the API with curl:


curl -X GET http://yourdomain.com/jsonrpc.php --user admin:password

🌟 Advanced Configurations

Enable plugins by copying them to the plugins directory:


mkdir /var/www/kanboard/plugins/PluginName

cp -r plugin-files/* /var/www/kanboard/plugins/PluginName

sudo systemctl reload apache2

Wrapping Up

This guide has walked you through the essentials of deploying, configuring, and managing Kanboard. By following these steps, you can fully leverage Kanboard’s capabilities while enjoying the flexibility and control of self-hosting. Start implementing these configurations today to streamline your project management and task tracking workflows!

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Selfhosted Ninja.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.