Deployment Overview of VictoriaMetrics on Server¶
Prerequisites and Basic Requirements¶
To successfully deploy VictoriaMetrics on this server, the following environment prerequisites must be met:
-
The server must have Docker and Docker Compose installed and operational.
-
Administrative privileges (root or sudo access) are required to create volumes, manage services, and configure network settings.
-
The server must have network connectivity to resolve external domains and fetch container images from Docker Hub.
-
The deployment assumes a Linux-based operating system compatible with the provided Docker configuration.
FQDN of the Final Panel¶
The VictoriaMetrics panel is accessible via the following Fully Qualified Domain Name (FQDN) on the hostkey.in domain:
-
Format:
victoriametrics<Server ID>.hostkey.in -
Access Port:
443(HTTPS)
Note: Replace <Server ID> with the actual identifier assigned to the specific server instance. The service is exposed via the root path /.
File and Directory Structure¶
The application components, configuration files, and data storage are organized within the root directory structure as follows:
| Directory/Path | Description |
|---|---|
/root/victoria-metrics-data | Main data directory containing configuration templates and mounted volumes. |
/root/victoria-metrics-data/compose.yml | Docker Compose definition file for service orchestration. |
/root/victoria-metrics-data/authconfig.yml | Authentication configuration file for the vmauth service. |
/data/nginx/user_conf.d | Directory for Nginx user configuration (managed by the proxy container). |
Application Installation Process¶
The application is deployed using Docker Compose. The process involves generating the necessary configuration files and starting the containerized services:
-
The deployment creates the directory
/root/victoria-metrics-datawith root ownership. -
A Docker Compose file (
compose.yml) is generated at/root/victoria-metrics-data/compose.yml. -
An authentication configuration file (
authconfig.yml) is generated at/root/victoria-metrics-data/authconfig.yml. -
A Docker volume named
victoriametricsis created to persist application data. -
The services are started by executing the
docker compose up -dcommand within the/root/victoria-metrics-datadirectory.
Docker Containers and Their Deployment¶
The deployment utilizes three distinct containers defined in the compose.yml file:
-
nginx:
-
Image:
jonasal/nginx-certbot:latest -
Purpose: Reverse proxy with SSL/TLS termination and certificate management.
-
Ports: Exposes port
80and443externally. -
Environment: Configured with the email
[email protected]for Certbot. -
Volumes: Mounts
nginx_secretsfor Let's Encrypt certificates and maps/data/nginx/user_conf.d. -
victoriametrics:
-
Image:
victoriametrics/victoria-metrics:latest -
Purpose: Core VictoriaMetrics server.
-
Ports: Exposes port
8428internally. -
Volumes: Mounts
/root/victoria-metrics-dataand thevictoriametricsnamed volume. -
Restart Policy:
unless-stopped. -
vmauth:
-
Image:
victoriametrics/vmauth -
Purpose: Authentication layer for VictoriaMetrics.
-
Ports: Exposes port
8427internally. -
Command: Starts with the configuration flag
-auth.config=/root/victoria-metrics-data/authconfig.yml. -
Dependencies: Must start after the
victoriametricsservice. -
Volumes: Mounts
/root/victoria-metrics-data. -
Restart Policy:
unless-stopped.
Proxy Servers¶
Access to the VictoriaMetrics panel is managed through an Nginx reverse proxy configured with Certbot for automatic SSL certificate management:
-
Software: Nginx (via
jonasal/nginx-certbot:latest). -
SSL/TLS: Enabled via Let's Encrypt. Certificates are stored in the
nginx_secretsvolume at/etc/letsencryptinside the container. -
Configuration: The proxy listens on standard HTTP (
80) and HTTPS (443) ports. -
Domain Mapping: The proxy is configured to forward requests for the specific FQDN to the internal VictoriaMetrics service.
Location of Configuration Files and Data¶
Key files and data locations on the host server include:
-
Compose Definition:
/root/victoria-metrics-data/compose.yml -
Auth Configuration:
/root/victoria-metrics-data/authconfig.yml -
Application Data: Persisted within the Docker volume named
victoriametrics, mapped to/victoria-metricsinside the container. -
Certificate Secrets: Stored in the Docker volume
nginx_secrets, mapped to/etc/letsencryptinside the Nginx container.
Available Ports for Connection¶
The following ports are available for connection to the deployed services:
-
Port 443: HTTPS access to the VictoriaMetrics panel via the public FQDN.
-
Port 80: HTTP access, used primarily for SSL certificate validation by Let's Encrypt.
-
Port 8428: Direct internal access to the VictoriaMetrics service (bound to localhost or internal network).
-
Port 8427: Direct internal access to the
vmauthservice.
Permission Settings¶
File and directory permissions are set as follows during the deployment:
-
Directory:
/root/victoria-metrics-data -
Owner:
root -
Group:
root -
Mode:
0644 -
Files:
-
compose.yml: Ownerroot, Grouproot, Mode0644. -
authconfig.yml: Ownerroot, Grouproot, Mode0644.
Starting, Stopping, and Updating¶
Service management is performed using Docker Compose commands executed from the /root/victoria-metrics-data directory:
-
Start Services:
-
Stop Services:
-
Update Services: To apply changes to the
compose.ymlor pull new image versions:
Note: The authconfig.yml file references the SSH password ({{ ansible_ssh_pass }}) for the root user, which is used to authenticate against the VictoriaMetrics internal endpoint.