Skip to content

Deployment Overview of LEMP on Server

Prerequisites and Basic Requirements

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

  • Operating System: Ubuntu

  • Privileges: Root or sudo access is required for package installation and directory management.

  • Ports: The following ports must be open in the firewall to allow traffic and database connections:

  • 80 (HTTP)

  • 443 (HTTPS)

  • 88 (Web Service)

  • 3306 (MySQL/MariaDB)

  • 5432 (PostgreSQL - if applicable via container)

FQDN of the final panel on the hostkey.in domain

The application is configured to be accessible via a specific subdomain template on the hostkey.in domain.

Parameter Value
Prefix lamp
Domain hostkey.in
Full template lamp{Server_ID_from_Invapi}.hostkey.in

File and Directory Structure

The application uses the following directory structure for persistent data and web content:

  • /root/data: Stores database files (/var/lib/mysql).

  • /root/webroot: Stores website files and source code (/var/www/html).

  • /data/nginx/user_conf.d: Contains custom Nginx configuration files.

  • /data/nginx/nginx-certbot.env: Environment file for the SSL certificate manager.

Application Installation Process

The application is deployed using a combination of system package management and Docker containers:

  1. System Preparation: The server undergoes an automated setup to install the Docker engine.

  2. Directory Initialization: The installation creates necessary directories for data persistence (/root/data) and web content (/root/webroot) with 0755 permissions.

  3. Docker Network Setup: A dedicated Docker network named lemp-net is created to facilitate communication between services.

  4. Container Deployment: The LEMP stack is deployed as a Docker container using the adhocore/lemp:8.3 image.

Access Rights and Security

  • Directory Permissions: Data and webroot directories are owned by root with group root.

  • Network Isolation: The application runs within a dedicated Docker network (lemp-net).

  • Firewall Requirements: External access is restricted to specific service ports, while internal communication occurs over the virtual bridge.

Databases

The deployment includes a database service managed within the LEMP container:

  • Connection Method: Localhost or via port 3306.

  • Storage Location: Persistent storage is mapped to /root/data on the host machine.

  • Credentials: The MySQL root password is set during the initial setup phase.

Docker Containers and Their Deployment

The deployment consists of two primary container components:

LEMP Stack Container

  • Image Name: adhocore/lemp:8.3

  • Container Name: lemp-stack

  • Ports:

  • 88:80 (Web traffic)

  • 3306:3306 (MySQL)

  • 5432:5432 (PostgreSQL)

  • Volumes:

  • /root/data:/var/lib/mysql

  • /root/webroot:/var/www/html

  • Environment Variables:

  • MYSQL_ROOT_PASSWORD: Configured during deployment.

  • Restart Policy: always

Nginx Certbot Container

This container is used exclusively for managing SSL certificates via Let's Encrypt.

  • Image Name: jonasal/nginx-certbot:latest

  • Network Mode: host

  • Volumes:

  • nginx_secrets:/etc/letsencrypt (External volume)

  • /data/nginx/user_conf.d:/etc/nginx/user_conf.d

Application Update Instructions

To update the main LEMP application, perform the following steps:

  1. Pull the latest image for the stack:

    docker pull adhocore/lemp:8.3
    

  2. Restart the container to apply changes:

    docker compose up -d
    
    (Note: If manual Docker commands are used, use docker restart lemp-stack)

Available Ports for Connection

Service Port
Web Interface (HTTP) 88
MySQL/MariaDB 3306
PostgreSQL 5432

Proxy Servers

The system utilizes an Nginx proxy with Certbot integration to handle SSL termination. The configuration is managed through custom files located in /data/nginx/user_conf.d and the certificates are stored in a persistent volume named nginx_secrets.

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