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
mcbserveris created to manage the application processes. -
Network/Ports:
-
Port
443(HTTPS) must be open for external web access via the proxy. -
Port
12357is 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:
-
System Preparation: The package manager cache is updated, and essential utilities such as
sudo,git,python3,jq,unzip, andnetcat-openbsdare installed. -
Core LGSM Installation:
-
The official LinuxGSM installation script is downloaded to the user's home directory.
-
The script is executed using the command
bash linuxgsm.sh mcbserver. -
Web-LGSM Deployment:
-
The Web-LGSM repository is cloned from GitHub into
/home/mcbserver/web-lgsm. -
An installation script (
install.sh) located within the repository is executed to configure the web interface environment. -
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
mcbserveruser, not the root user. -
Sudo Configuration: The
mcbserveruser 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.dis set to0750). -
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.serviceis configured. It executes the backend viapython3 /home/mcbserver/web-lgsm/web-lgsm.py.
Application Update Instructions¶
To update the Web-LGSM application, perform the following steps:
-
Navigate to the application directory:
-
Pull the latest changes from the repository and restart the service (if applicable via your specific workflow).
-
For the proxy layer, use:
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:
-
Stop the service:
-
Check status:
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.into the internal backend running on port12357.