Skip to content

Yourls Server Deployment Overview

Prerequisites

The following configuration parameters are required for the application to function correctly:

Parameter Value
Operating System Ubuntu
Available ports (internal) 8080
Available ports (external) 443
Internal path /

FQDN of the final panel on hostkey.in domain

The domain name template for accessing the application is defined as follows:

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

Files and Directories 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 — Nginx user configurations.

Application Installation Process

Deployment is performed by running containers via docker compose. The application consists of the core URL shortening service and a MySQL database. Once the main containers are up, a reverse proxy with SSL support is deployed.

Docker Containers and Execution

yourls service

  • Image name: yourls:latest

  • Container name: yourls{Server_ID_from_Invapi}.hostkey.in

  • Ports: 127.0.0.1:8080:8080

  • Environment variables:

    • YOURLS_DB_HOST: mysql

    • YOURLS_DB_NAME: yourls

    • YOURLS_DB_USER: yourls

    • YOURLS_DB_PASS: yourls

    • YOURLS_SITE: https://yourls{Server_ID_from_Invapi}.hostkey.in

    • YOURLS_USER: root

    • YOURLS_PASS: {User password}

  • Restart policy: always

mysql service

  • Image name: mysql:8

  • Environment variables:

    • MYSQL_ROOT_PASSWORD: yourls

    • MYSQL_DATABASE: yourls

    • MYSQL_USER: yourls

    • MYSQL_PASSWORD: yourls

  • Volumes: /opt/yourls/mysql-data:/var/lib/mysql

  • Restart policy: always

nginx service

  • Image name: jonasal/nginx-certbot:latest

  • Environment variables:

  • Volumes:

    • nginx_secrets:/etc/letsencrypt

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

  • Network mode: host

  • Restart policy: unless-stopped

Databases

The MySQL database runs in a separate container. Data is stored locally on the host in the /opt/yourls/mysql-data directory. The application connects to the database using the service name mysql.

Permissions Settings

To ensure security, the following access permissions are set:

  • Application directory /opt/yourls: owner root, group root, mode 0750.

  • MySQL data directory /opt/yourls/mysql-data: owner root, group root, mode 0750.

  • Configuration file yourls-compose.yml: owner root, group root, mode 0640.

Location of Configuration Files and Data

File/Directory Type Path
Docker Compose configuration (application) /opt/yourls/yourls-compose.yml
MySQL data /opt/yourls/mysql-data
Nginx configuration /root/nginx/compose.yml

Available Connection Ports

  • 443 (HTTPS) — external access via the reverse proxy.

  • 8080 (HTTP) — internal application access (restricted to interface 127.0.0.1).

Starting and Stopping the Application

Application container management is performed 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

Reverse proxy management is performed from the /root/nginx directory:

  • Start: docker compose -C /root/nginx up -d

  • Stop: docker compose -C /root/nginx down

Reverse Proxies

The nginx-certbot container is used to provide HTTPS support. It utilizes an external volume nginx_secrets to store Let's Encrypt certificates. The proxy configuration is set up to redirect traffic from port 443 to the internal application port 8080.

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