Skip to content

Deployment Overview of Akaunting on Server

Prerequisites and Basic Requirements

To ensure a successful deployment, the server must meet the following requirements:

  • Operating System: Ubuntu (latest stable release).

  • Privileges: Root or sudo access is required for all installation steps.

  • Ports: The following ports must be open in the firewall:

  • 22 (SSH)

  • 80 (HTTP)

  • 443 (HTTPS)

  • Dependencies: The system requires Git, Docker, Docker Compose V2, Nginx, MySQL Server, and PHP 8.3 with various extensions.

FQDN of the final panel on the hostkey.in domain

The application is accessible via a specific subdomain template based on the server ID.

Parameter Value
Prefix akaunting
Domain hostkey.in
Full template akaunting{Server_ID}.hostkey.in

File and Directory Structure

The application and its configuration files are organized as follows:

  • Application Root: /opt/akaunting

  • Environment Configurations: /opt/akaunting/env/ (contains db.env and run.env)

  • Certbot Data: /opt/akaunting/data/certbot/conf and /opt/akaunting/data/certbot/www

  • Nginx Configuration: /etc/nginx/sites-available/akaunting

Application Installation Process

The installation follows a multi-stage process involving system dependency setup, source code retrieval, and container orchestration:

  1. System Dependency Setup:

  2. The universe repository is enabled.

  3. Core packages including docker.io, nginx, mysql-server, and certbot are installed.

  4. PHP 8.3 is installed along with essential modules (php8.3-fpm, php8.3-mysql, php8.3-curl, php8.3-gd, php8.3-xml, php8.3-mbstring, php8.3-intl, php8.3-gmp, php8.3-bcmath, and php8.3-zip).

  5. IonCube Loader: The IonCube Loader is downloaded, extracted, and configured as a PHP extension for both FPM and CLI environments to support encrypted files.

  6. Composer & Node.js: Composer is installed globally, and Node.js 18 is added via the official NodeSource repository.

  7. Source Code Retrieval:

  8. The application source code is cloned from the official Akaunting Docker repository into /opt/akaunting using git.

  9. Container Orchestration:

  10. Environment files (db.env and run.env) are generated in /opt/akaunting/env/.

  11. The application is started using docker compose up --detach from the installation directory.

  12. Web Server & SSL Configuration:

  13. Nginx is configured as a reverse proxy for the application.

  14. Certbot is used to obtain an SSL certificate via the --nginx plugin.

  15. Once the certificate is obtained, Nginx is reconfigured to enforce HTTPS and redirect all HTTP traffic to secure connections.

Access Rights and Security

  • Firewall: The Uncomplicated Firewall (UFW) is enabled with rules allowing incoming traffic on ports 22, 80, and 443.

  • Permissions: Configuration files in /etc/nginx/sites-available/ are owned by root with 0644 permissions.

Databases

The application uses a MySQL database managed via Docker containers.

Parameter Value
Database Name akaunting
Database User admin
Connection Host akaunting-db (Docker internal network)
Port 3306

Docker Containers and Their Deployment

The application is deployed using Docker Compose. The following containers are managed:

Akaunting Application Container

  • Image: Derived from the cloned repository.

  • Ports: Internal port 8080 (mapped via Nginx proxy).

  • Environment Variables: Loaded from /opt/akaunting/env/run.env.

  • Restart Policy: Managed by Docker Compose.

Database Container

  • Image: MySQL/MariaDB image.

  • Network: Connected to the application network.

  • Environment Variables: Configured via /opt/akaunting/env/db.env.

Custom Scripts and Additional Setup

The deployment includes several automated configuration steps:

  • Environment Generation: Automated creation of db.env for database credentials and run.env for application settings (including production mode and SSL URL).

  • Nginx Proxy Chain: A two-stage Nginx setup is used. First, a temporary configuration allows the Certbot challenge to pass through port 80. Once SSL is active, a final configuration is applied that enforces TLS 1.2/1.3 and proxies traffic to the container on localhost:8080.

Application Update Instructions

To update the main application, navigate to the installation directory and run the following command:

cd /opt/akaunting && docker compose pull && docker compose up -d

Location of Configuration Files and Data

  • Main App Config: /opt/akaunting/env/run.env

  • Database Config: /opt/akaunting/env/db.env

  • Nginx Site Config: /etc/nginx/sites-available/akaunting

  • SSL Certificates: /etc/letsencrypt/live/{your_domain}/

Available Ports for Connection

  • HTTPS (Secure Web Access): 443

  • HTTP (Redirect to HTTPS): 80

  • SSH (Remote Management): 22

Starting and Stopping the Application

The application is managed via Docker Compose from the installation directory:

  • Start the application:

    cd /opt/akaunting && docker compose up -d
    

  • Stop the application:

    cd /opt/akaunting && docker compose down
    

  • Restart the application:

    cd /opt/akaunting && docker compose restart akaunting
    

Proxy Servers

The system uses Nginx as a reverse proxy server. It handles SSL termination via Certbot (Let's Encrypt) and forwards all requests to the Akaunting container running on port 8080. The configuration includes strict security headers and enforces HTTPS redirection for all incoming traffic.

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×