Aug 25, 2024 3 min read

Akaunting: A Complete Checklist for Self-Hosting Success

Akaunting: A Complete Checklist for Self-Hosting Success
Table of Contents

Akaunting is a powerful, open-source accounting application designed for small businesses and freelancers. By self-hosting Akaunting, you gain full control over your data, advanced customization options, and the ability to adapt it to your unique needs. This guide will walk you through deploying Akaunting, configuring it with tools like Nginx, managing backups, and leveraging its core features to get the most out of your setup.

Installing Akaunting

πŸ“¦ Docker/Docker Compose Setup

Running Akaunting with Docker allows for an efficient and isolated deployment. Create a docker-compose.yml file with the following configuration:


version: '3.8'

services:

akaunting:

image: akaunting/akaunting:latest

container_name: akaunting-app

restart: unless-stopped

ports:

- "8080:80"

volumes:

- akaunting_data:/var/www/html

environment:

- APP_KEY=base64:YOUR_APP_KEY_HERE

- DB_HOST=akaunting-db

- DB_PORT=3306

- DB_DATABASE=akaunting

- DB_USERNAME=akaunting_user

- DB_PASSWORD=securepassword

akaunting-db:

image: mariadb:10.5

container_name: akaunting-db

restart: unless-stopped

environment:

- MYSQL_ROOT_PASSWORD=rootpassword

- MYSQL_DATABASE=akaunting

- MYSQL_USER=akaunting_user

- MYSQL_PASSWORD=securepassword

volumes:

- akaunting_db_data:/var/lib/mysql

volumes:

akaunting_data:

akaunting_db_data:

Deploy the stack with the following commands:


docker-compose up -d

Verify that Akaunting is running by visiting http://<SERVER_IP>:8080 in your browser.

πŸš€ Manual Installation

To install Akaunting manually on a Linux server, follow these steps:

  1. Update your server and install dependencies:

sudo apt update && sudo apt upgrade -y

sudo apt install apache2 mariadb-server php php-mysql php-cli php-xml unzip curl -y

  1. Download and extract Akaunting:

wget https://akaunting.com/download/latest -O akaunting.zip

unzip akaunting.zip -d /var/www/akaunting

  1. Set permissions and configure Apache:

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

sudo chmod -R 755 /var/www/akaunting

  1. Create a new virtual host for Akaunting (refer to the Nginx section below for Apache equivalent).

  2. Access Akaunting via your browser and complete the setup wizard.

Configuring Nginx as a Reverse Proxy

🌐 Nginx Configuration

Set up Nginx as a reverse proxy to route traffic to Akaunting:


server {

listen 80;

server_name akaunting.example.com;

root /var/www/akaunting/public;

index index.php index.html;

location / {

try_files $uri $uri/ /index.php?$query_string;

}

location ~ \.php$ {

include snippets/fastcgi-php.conf;

fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

location ~ /\.ht {

deny all;

}

}

Restart Nginx to apply the configuration:


sudo nginx -t

sudo systemctl reload nginx

πŸ”’ SSL/TLS Setup

Secure Akaunting with Let's Encrypt:

  1. Install Certbot:

sudo apt install certbot python3-certbot-nginx -y

  1. Get an SSL certificate:

sudo certbot --nginx -d akaunting.example.com

  1. Automate SSL renewals:

sudo systemctl enable certbot.timer

Logging and Debugging Akaunting

πŸ—ƒοΈ Enabling Debug Logs

Enable debug logging in Akaunting by editing the .env file:


nano /var/www/akaunting/.env

Set the following value:


APP_DEBUG=true

πŸ“„ Viewing Logs

For Docker setups, view logs using:


docker logs akaunting-app

For manual installations, check the log files:


tail -f /var/www/akaunting/storage/logs/laravel.log

πŸ› οΈ Troubleshooting Common Issues

If Akaunting fails to load or shows errors, common issues include incorrect permissions or missing PHP extensions. Verify the required extensions are installed:


php -m | grep -E 'mbstring|openssl|pdo|xml|ctype|json'

Backup and Restore

πŸ—‚οΈ File-Based Backups

Backup Akaunting’s files:


tar -czvf akaunting-backup-$(date +%F).tar.gz /var/www/akaunting

πŸ”„ Database Backups

Export the database:


mysqldump -u akaunting_user -p akaunting > akaunting-db-backup.sql

Restore the database:


mysql -u akaunting_user -p akaunting < akaunting-db-backup.sql

πŸ“… Automated Backup Scripts

Automate backups with a cron job:


crontab -e

Add the following line:


0 2 * * * tar -czvf /backup/akaunting-$(date +\%F).tar.gz /var/www/akaunting && mysqldump -u akaunting_user -p'securepassword' akaunting > /backup/akaunting-db-$(date +\%F).sql

Updating and Upgrading Akaunting

⬆️ Updating Docker Images

Pull the latest Docker image and restart containers:


docker-compose pull

docker-compose up -d

πŸ› οΈ Manual Updates

To update manually, download the latest Akaunting release and replace the existing files, ensuring to back up the .env file and database first.

πŸ” Checking for Updates

Visit Akaunting's official update page to verify if a new version is available.

Leveraging Akaunting’s Unique Features

πŸ”§ Enabling APIs

Activate the Akaunting API by setting the following in .env:


API_ENABLED=true

Access the API via curl:


curl -X GET "http://akaunting.example.com/api/v1/transactions" -H "Authorization: Bearer YOUR_API_TOKEN"

🌟 Advanced Configurations

To extend Akaunting’s functionality, install apps from the Akaunting App Store. For example, install an app via the CLI:


composer require akaunting/your-app-name

Wrapping Up

This guide has provided you with detailed steps to deploy, configure, and manage Akaunting in a self-hosted environment. From Docker deployment to advanced configurations, you now have the tools to make the most of Akaunting’s robust capabilities. Begin customizing and optimizing your setup today to fully leverage its powerful features!

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.