YOURLS Server Deployment Overview¶
Prerequisites¶
The following conditions are required for the application to function correctly:
-
Operating System: Ubuntu.
-
Access Rights: root privileges to manage containers and system directories.
-
Network Access: ports 80 and 443 must be open for web proxy operation.
FQDN of the final panel on hostkey.in domain¶
| Parameter | Value |
|---|---|
| Prefix | yourls |
| Domain | hostkey.in |
| Full Template | yourls{Server_ID_from_Invapi}.hostkey.in |
File and Directory Structure¶
Main directories used in the system:
-
/opt/yourls— application root directory. -
/opt/yourls/mysql-data— MySQL database data storage. -
/root/nginx— Nginx reverse proxy configuration. -
/data/nginx/user_conf.d— custom Nginx configurations.
Application Installation Process¶
Deployment is performed by creating the necessary directories, preparing volumes for the database, and launching containers via Docker Compose. The application is installed in two stages: deployment of the core stack (YOURLS + MySQL) and configuration of the reverse proxy with automatic SSL certificate acquisition.
Docker Containers and Execution¶
Core Application Stack (YOURLS)¶
Containers are launched from /opt/yourls/yourls-compose.yml.
| Container Name | Image | Ports | Volumes | Environment Variables | Restart Policy |
|---|---|---|---|---|---|
yourls{Server_ID}.hostkey.in | yourls:latest | 127.0.0.1:8080:8080 | — | YOURLS_DB_HOST=mysql, YOURLS_DB_NAME=yourls, YOURLS_DB_USER=yourls, YOURLS_DB_PASS=yourls, YOURLS_SITE=https://yourls{Server_ID}.hostkey.in | always |
mysql | mysql:8 | — | /opt/yourls/mysql-data:/var/lib/mysql | MYSQL_ROOT_PASSWORD=yourls, MYSQL_DATABASE=yourls, MYSQL_USER=yourls, MYSQL_PASSWORD=yourls | always |
Reverse Proxy (Nginx Certbot)¶
The container is launched from /root/nginx/compose.yml.
| Container Name | Image | Ports | Volumes | Environment Variables | Restart Policy |
|---|---|---|---|---|---|
nginx | jonasal/nginx-certbot:latest | network_mode: host | nginx_secrets:/etc/letsencrypt, /data/nginx/user_conf.d:/etc/nginx/user_conf.d | [email protected] (from .env file) | unless-stopped |
Application Update¶
Updates are performed using the following command:
Permissions Settings¶
The following directory permissions are set to ensure security:
-
/opt/yourls: ownerroot, grouproot, mode0750. -
/opt/yourls/mysql-data: ownerroot, grouproot, mode0750. -
/root/nginx/compose.yml: ownerroot, grouproot, mode0644. -
/opt/yourls/yourls-compose.yml: ownerroot, grouproot, mode0640.
Configuration Files and Data Location¶
-
Database:
/opt/yourls/mysql-data -
Reverse Proxy Configuration:
/root/nginx/compose.yml -
SSL Secrets:
nginx_secretsvolume (inside the Nginx container at path/etc/letsencrypt)
Available Connection Ports¶
| Port | Protocol | Purpose |
|---|---|---|
| 8080 | TCP | Internal application port (accessible only locally) |
| 443 | HTTPS | External access via reverse proxy |
Starting and Stopping the Application¶
The core application is managed from the /opt/yourls directory:
# Start
docker compose -f /opt/yourls/yourls-compose.yml up -d
# Stop
docker compose -f /opt/yourls/yourls-compose.yml down
The reverse proxy is managed from the /root/nginx directory: