Skip to content

Deployment Overview of Web-LGSM on Server

Prerequisites and Basic Requirements

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

  • Operating System: Debian or Ubuntu.

  • Privileges: Sudo access is required for initial setup and package installation.

  • User Account: A dedicated non-root user named mcbserver is created to manage the application processes.

  • Network/Ports:

  • Port 443 (HTTPS) must be open for external web access via the proxy.

  • Port 12357 is used internally by the Web-LGSM backend.

FQDN of the final panel on the hostkey.in domain

The application uses a specific subdomain template for accessing the web interface:

| Parameter | Value | | Prefix | web-lgsm | | Domain | hostkey.in | | Full template | web-lgsm{Server_ID_from_Invapi}.hostkey.in |

File and Directory Structure

The application data and configuration files are organized as follows:

  • Application Home Directory: /home/mcbserver/web-lgsm

  • LGSM Server Data: /home/mcbserver/mcbserver

  • Nginx Configuration Directory: /root/nginx

  • User Configuration Files: /data/nginx/user_conf.d

  • SSL Certificates: Managed via Docker volumes in nginx_secrets.

Application installation process

The installation follows a multi-stage process involving system dependency setup, the core LGSM engine, and the Web-LGSM management interface:

  1. System Preparation: The package manager cache is updated, and essential utilities such as sudo, git, python3, jq, unzip, and netcat-openbsd are installed.

  2. Core LGSM Installation:

  3. The official LinuxGSM installation script is downloaded to the user's home directory.

  4. The script is executed using the command bash linuxgsm.sh mcbserver.

  5. Web-LGSM Deployment:

  6. The Web-LGSM repository is cloned from GitHub into /home/mcbserver/web-lgsm.

  7. An installation script (install.sh) located within the repository is executed to configure the web interface environment.

  8. Service Configuration: A systemd unit file is created to manage the Python-based backend as a background service.

Access Rights and Security

Security is enforced through several mechanisms:

  • User Isolation: The application runs under the mcbserver user, not the root user.

  • Sudo Configuration: The mcbserver user is granted passwordless sudo privileges specifically for necessary administrative tasks via a custom configuration in /etc/sudoers.d/.

  • Directory Permissions: Strict permissions are applied to sensitive directories (e.g., /etc/sudoers.d is set to 0750).

  • Proxy Layer: An Nginx container acts as a reverse proxy, shielding the backend from direct exposure and providing SSL termination.

Docker Containers and Their Deployment

The deployment utilizes a Docker container to handle web traffic and SSL certificate management:

Container Name Image Ports (Host) Volumes Restart Policy
nginx jonasal/nginx-certbot:latest 443/tcp, 80/tcp nginx_secrets:/etc/letsencrypt
/data/nginx/user_conf.d:/etc/nginx/user_conf.d
/home:/home
unless-stopped

Custom Scripts and Additional Setup

The following actions are performed during the deployment to prepare the environment:

  • Environment Cleanup: The /tmp/. directory is managed to ensure correct permissions for installation processes.

  • Backend Service Initialization: A custom systemd service named web-lgsm.service is configured. It executes the backend via python3 /home/mcbserver/web-lgsm/web-lgsm.py.

Application Update Instructions

To update the Web-LGSM application, perform the following steps:

  1. Navigate to the application directory:

    cd /home/mcbserver/web-lgsm
    

  2. Pull the latest changes from the repository and restart the service (if applicable via your specific workflow).

  3. For the proxy layer, use:

    docker compose pull && docker compose up -d
    

Location of configuration files and data

  • Web Interface Source: /home/mcbserver/web-lgsm

  • Nginx Compose File: /root/nginx/compose.yml

  • Systemd Service Unit: /etc/systemd/system/web-lgsm.service

Available ports for connection

  • HTTPS (External): 443

  • HTTP (Internal Backend): 12357

Starting and Stopping the application

The Web-LGSM backend is managed via systemctl:

  • Start the service:

    sudo systemctl start web-lgsm.service
    

  • Stop the service:

    sudo systemctl stop web-lgsm.service
    

  • Check status:

    sudo systemctl status web-lgsm.service
    

Proxy Servers (Nginx, SSL, custom domains)

The application uses an Nginx container (jonasal/nginx-certbot) to provide:

  • SSL Termination: Automated certificate management via Certbot.

  • Reverse Proxying: Routing traffic from the external domain web-lgsm{Server_ID_from_Invapi}.hostkey.in to the internal backend running on port 12357.

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