Skip to content

Deployment Overview of Akaunting on Server

Prerequisites and Basic Requirements

To ensure a successful deployment, the following requirements must be met:

  • Operating System: Ubuntu (based on package manager usage).

  • 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)

FQDN of the final panel on the hostkey.in domain

The application is accessible via a specific subdomain template.

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 certificate configurations.

  • /opt/akaunting/data/certbot/www: Directory for Certbot ACME challenges.

  • /etc/nginx/sites-available/akaunting: Nginx site configuration file.

Application installation process

The application is installed using a combination of Git, Docker, and custom environment configurations:

  1. Repository Retrieval: The application source code is cloned from the official Akaunting Docker repository into /opt/akaunting.

  2. Environment Customization: A Dockerfile modification is performed to ensure the application runs on a secure PHP version (php:8.3.36-apache) instead of the default upstream version.

  3. Dependency Installation: System packages including nginx, certbot, git, and docker are installed via the package manager.

  4. Environment Configuration:

  5. A database environment file (db.env) is created to manage MySQL credentials.

  6. An application environment file (run.env) is generated, containing settings for the application URL, locale, and database connection details.

  7. Container Deployment: The application is launched using docker compose.

Access Rights and Security

Security is managed through several layers:

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

  • SSL/TLS: SSL certificates are obtained via Certbot to secure the connection over HTTPS.

  • Nginx Configuration: Nginx acts as a reverse proxy, enforcing an automatic redirect from HTTP (port 80) to HTTPS (port 443).

Databases

The application uses a MySQL database managed within a Docker container.

Parameter Value
Database Name akaunting
Database User admin
Host akaunting-db

The connection details are stored in /opt/akaunting/env/run.env.

Docker Containers and Their Deployment

The application deployment relies on the following containerized services:

Akaunting Application Container

  • Image: Custom built from php:8.3.36-apache (based on the cloned repository).

  • Ports: Internal port 8080 is mapped to host for proxying.

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

  • Restart Policy: Managed by Docker Compose.

Database Container

  • Image: Standard MySQL image (implied via compose).

  • Database Name: akaunting

  • User: admin

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

Custom Scripts and Additional Setup

The deployment process includes several automated configuration steps:

  • PHP Version Verification: A script executes docker exec akaunting php -r 'echo PHP_VERSION;' to ensure the running container matches the required version (8.3.36).

  • SSL Automation: An automated command is executed via Certbot to obtain a Let's Encrypt certificate for the specific FQDN using the --nginx plugin.

  • Nginx Configuration Management: The system dynamically creates and switches between an initial HTTP configuration (for SSL challenge) and a final HTTPS configuration with strict redirection.

Application Update Instructions

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

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

Location of configuration files and data

  • Application Environment: /opt/akaunting/env/run.env

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

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

  • SSL Certificates: /etc/letsencrypt/live/{akaunting{Server_ID_from_Invapi}.hostkey.in}/

Available ports for connection

  • 80: HTTP (Redirected to HTTPS)

  • 443: HTTPS (Main application access)

  • 22: SSH (System management)

Starting and Stopping the application

The application is managed via Docker Compose:

  • Start/Restart Application:

    cd /opt/akaunting && docker compose restart akaunting
    

  • Stop Application:

    cd /opt/akaunting && docker compose stop
    

Proxy Servers

The system uses Nginx as a reverse proxy server. It is configured to:

  1. Handle SSL termination using Let's Encrypt certificates.

  2. Redirect all unencrypted HTTP traffic to HTTPS.

  3. Proxy requests from port 443 to the application running on http://127.0.0.1:8080.

  4. Facilitate Certbot ACME challenges via the .well-known/acme-challenge/ location block.

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