Deployment Overview of Free Domain Certbot on Server¶
Prerequisites and Basic Requirements¶
To successfully deploy this application, the following requirements must be met:
-
Operating System: A Linux-based system with Docker installed.
-
Privileges: Root or sudo access is required for directory creation and Docker management.
-
Domain: A registered domain name configured to point to the server's IP address.
-
Ports: The following ports must be open and available in the firewall:
-
80/TCP(HTTP) -
443/TCP(HTTPS)
FQDN of the final panel on the hostkey.in domain¶
The application uses a dynamic subdomain based on the server ID. The template for the Fully Qualified Domain Name (FQDN) is provided below:
| Parameter | Value |
|---|---|
| Prefix | nginx-certbot |
| Domain | hostkey.in |
| Full template | nginx-certbot{Server_ID_from_Invapi}.hostkey.in |
File and Directory Structure¶
The application data and configuration files are organized in the following directory structure:
-
/data/nginx/: Main application directory. -
/data/nginx/docker-compose.yml: Docker Compose configuration file. -
/data/nginx/nginx-certbot.env: Environment variables for the Nginx container. -
/data/nginx/user_conf.d/: Directory containing custom Nginx server configurations. -
/data/nginx/user_conf.d/nginx-certbot{Server_ID_from_Invapi}.hostkey.in.conf: Specific configuration file for the domain.
Application installation process¶
The application is deployed using Docker Compose with a pre-configured environment. The installation involves the following steps:
-
System Preparation: Installation of the Docker engine on the host system.
-
Directory Creation: Creation of the
/data/nginx/and subdirectories with specific permissions (0640). -
Host Configuration: The local
/etc/hostsfile is updated to include a mapping for127.0.0.1 nginx-certbot{Server_ID_from_Invapi}.hostkey.in. -
Configuration Generation:
-
A
docker-compose.ymlfile is generated in/data/nginx/. -
An Nginx configuration file (
user.conf) is created in theuser_conf.ddirectory to handle SSL termination and domain routing. -
An environment file (
nginx-certbot.env) is placed in the application directory. -
Docker Volume Creation: A Docker volume named
nginx_secretsis created to persist Let's Encrypt certificates. -
Container Deployment: The containers are started using
docker compose up -dfrom within the/data/nginx/directory.
Access Rights and Security¶
-
File Permissions: Configuration files in
/data/nginx/are owned byroot:rootwith permissions set to0644. -
Directory Permissions: Data directories are created with
0640permissions. -
Firewall: Only ports 80 and 443 should be exposed to the public internet for web traffic.
Docker Containers and Their Deployment¶
The deployment utilizes a single primary container managed via Docker Compose:
| Image | Ports | Volumes | Environment Variables | Restart Policy |
|---|---|---|---|---|
jonasal/nginx-certbot:latest | 80:80, 443:443 | - nginx_secrets:/etc/letsencrypt- ./user_conf.d:/etc/nginx/user_conf.d | [email protected] (via .env file) | unless-stopped |
Note: Certbot is utilized within this container to automate the acquisition and renewal of SSL certificates via Let's Encrypt.
Application Update Instructions¶
To update the application, navigate to the installation directory and pull the latest images:
Location of configuration files and data¶
-
Nginx Configuration:
/data/nginx/user_conf.d/ -
Docker Compose File:
/data/nginx/docker-compose.yml -
Environment Variables:
/data/nginx/nginx-certbot.env -
SSL Certificates (Volume): Managed via the
nginx_secretsDocker volume.
Available ports for connection¶
-
HTTP:
80 -
HTTPS:
443