Deployment Overview of Akaunting on Server¶
Prerequisites and Basic Requirements¶
To ensure a successful deployment, the following requirements must be met:
-
Operating System: Ubuntu (latest stable release recommended).
-
Privileges: Root or sudo access is required for all installation steps.
-
Ports: The following TCP ports must be open in the firewall:
-
22(SSH) -
80(HTTP) -
443(HTTPS)
FQDN of the final panel on the hostkey.in domain¶
The application is accessible via a specific subdomain template based on your server ID.
| Parameter | Value |
|---|---|
| Prefix | akaunting |
| Domain | hostkey.in |
| Full template | akaunting{Server_ID_from_Invapi}.hostkey.in |
File and Directory Structure¶
The application uses the following directory structure for configuration, data, and certificates:
-
/opt/akaunting: Main installation directory containing the application source code. -
/opt/akaunting/env/: Contains environment configuration files (db.env,run.env). -
/opt/akaunting/data/certbot/conf: Directory for Certbot SSL certificates. -
/opt/akaunting/data/certbot/www: Directory for Certbot ACME challenges. -
/etc/nginx/sites-available/akaunting: Nginx site configuration file. -
/etc/nginx/sites-enabled/akaunting: Symbolic link to the active Nginx configuration.
Application installation process¶
The application is installed using a combination of Git, Docker, and manual environment setup:
-
System Preparation: The system updates the
aptcache and installs necessary dependencies includinggit,curl,nginx,certbot, anddocker. -
Source Code Acquisition: The application source code is cloned from the official repository:
https://github.com/akaunting/docker.git. -
Environment Customization: A custom Dockerfile modification is performed to ensure the application runs on a secure, patched version of PHP (
php:8.3-apache) instead of the default upstream image. -
Configuration Generation: Environment files (
db.envandrun.env) are created in/opt/akaunting/env/to define database credentials and application settings. -
Container Deployment: The application is launched using Docker Compose within the
/opt/akauntingdirectory. -
Web Server Configuration: Nginx is configured as a reverse proxy to handle incoming traffic on port 80 and 443, forwarding requests to the application container running on port
8080.
Access Rights and Security¶
-
Firewall: The Uncomplicated Firewall (UFW) is enabled with rules allowing TCP traffic on ports
22,80, and443. -
Nginx Security: The default Nginx configuration is removed to prevent unauthorized access via the default landing page.
-
SSL/TLS: SSL certificates are obtained via Certbot, and Nginx is configured to enforce HTTPS by redirecting all HTTP traffic to secure connections.
Databases¶
The application uses a MySQL database managed within a Docker container.
| Parameter | Value |
|---|---|
| Database Name | akaunting |
| Database User | admin |
| Connection Host | akaunting-db |
| Port | 3306 |
Docker Containers and Their Deployment¶
The deployment utilizes Docker Compose to manage the application services. The primary containers are:
Akaunting Application Container¶
-
Image: Custom built image based on
php:8.3-apache. -
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 (as defined in the compose configuration).
-
Environment Variables: Configured via
/opt/akaunting/env/db.env.
Custom Scripts and Additional Setup¶
The deployment includes several automated setup actions:
-
PHP Version Verification: A check is performed after container startup to ensure the running PHP version matches the required
8.3specification. -
SSL Provisioning: An automated process uses Certbot to obtain a Let's Encrypt certificate for the configured FQDN.
-
Nginx Configuration Transition: The system performs a two-stage Nginx setup: first, a temporary configuration is used to pass the Certbot challenge, followed by a final production-ready HTTPS configuration.
Application Update Instructions¶
To update the main application, navigate to the installation directory and execute the following command:
Location of configuration files and data¶
-
Application Environment:
/opt/akaunting/env/ -
Nginx Configs:
/etc/nginx/sites-available/akaunting -
SSL Certificates:
/etc/letsencrypt/live/{domain}/
Available ports for connection¶
-
80: HTTP (Redirected to HTTPS) -
443: HTTPS (Application Access) -
22: SSH (Management)
Starting and Stopping the application¶
The application is managed via Docker Compose:
-
Start the application:
-
Stop the application:
-
Restart the application:
Proxy Servers¶
The system uses Nginx as a reverse proxy server. It handles SSL termination using Let's Encrypt certificates and manages the redirection from HTTP to HTTPS. The traffic is proxied from port 80 and 443 to the application container listening on 127.0.0.1:8080.