Deployment Overview of VictoriaMetrics on Server¶
Prerequisites and Basic Requirements¶
The deployment requires a Linux server with the following specifications:
- Operating System: Linux distribution compatible with Docker Engine.
- Privileges: Root access or a user with
sudoprivileges is required to manage Docker containers and system directories. - Ports: The following ports must be open on the server firewall:
80(HTTP) for initial SSL certificate issuance.443(HTTPS) for secure access to the application.8427for thevmauthservice.8428for the VictoriaMetrics service.- Domain: A valid domain name pointing to the server IP address is required for the Nginx reverse proxy and SSL certificate generation.
File and Directory Structure¶
The application files and data are organized in the following locations:
/root/victoria-metrics-data/: The primary directory containing configuration files and mounted volumes.compose.yml: The Docker Compose definition file for the entire stack.authconfig.yml: The authentication configuration file for thevmauthservice./data/nginx/user_conf.d/: Directory containing custom Nginx configuration files./etc/letsencrypt/: Directory where SSL certificates and keys are stored by the Certbot container.
Docker Containers and Their Deployment¶
The application is deployed using Docker Compose, which orchestrates three main services:
- nginx:
- Image:
jonasal/nginx-certbot:latest - Function: Acts as a reverse proxy and handles SSL certificate management via Certbot.
- Ports: Exposes
80and443. - Environment: Configured with the email
[email protected]for certificate notifications. -
Volumes: Mounts
nginx_secretsfor Let's Encrypt data and/data/nginx/user_conf.dfor custom configurations. -
victoriametrics:
- Image:
victoriametrics/victoria-metrics:latest - Function: The core time-series database.
- Ports: Exposes
8428. -
Volumes: Mounts
/root/victoria-metrics-dataand thevictoriametricsDocker volume for persistent data storage. -
vmauth:
- Image:
victoriametrics/vmauth - Function: Provides authentication and authorization for the VictoriaMetrics cluster.
- Container Name:
vmauth - Ports: Exposes
8427. - Command: Starts with the flag
-auth.config=/root/victoria-metrics-data/authconfig.yml. - Dependencies: Starts after the
victoriametricsservice. - Volumes: Mounts
/root/victoria-metrics-datato access the authentication configuration.
All services are configured with the restart policy unless-stopped.
Proxy Servers¶
The deployment includes an Nginx reverse proxy managed by the jonasal/nginx-certbot container.
- SSL/TLS: Automatic SSL certificate generation and renewal are handled by Certbot within the Nginx container.
- Configuration: Custom Nginx rules are loaded from the
/data/nginx/user_conf.ddirectory. - Access: External traffic is routed through ports
80and443to the internal services.
Starting, Stopping, and Updating¶
The application stack is managed via Docker Compose commands executed from the /root/victoria-metrics-data directory.
-
Start the stack:
-
Stop the stack:
-
Update the stack: To apply changes to the configuration or pull new images, run:
-
View logs:
Permission Settings¶
The file system permissions are set as follows to ensure proper operation:
- The directory
/root/victoria-metrics-datais owned byroot:rootwith permissions0644. - The files
compose.ymlandauthconfig.ymlwithin this directory are also owned byroot:rootwith permissions0644. - Docker volumes
nginx_secretsandvictoriametricsare created as external volumes to persist data across container restarts.