# Containers (variants A and B) Install the whole suite with Docker: nothing but Docker is needed on the host. This page: choose a variant, check the requirements, install. Next pages: [Operations](Operations.md) (update, backup, rollback), [Reference](Reference.md) (`.env`, ports, volumes), [Troubleshooting](Troubleshooting.md). ## Quick start On a host with Docker (root or a member of the `docker` group): ```bash git clone && cd OpenVPN-Monitoring-Simple deploy/docker/install.sh --variant b # or --variant a, see the table below ``` The script prints the URL and the **administrator login and password (shown once)**. Open the URL, then follow [First steps](../First_Steps.md). ## Variants Two variants, both installed and updated by the scripts in `deploy/docker/`: | | Variant A: one container | Variant B: one container per component | |---|---|---| | Compose file | `docker-compose.allinone.yml` | `docker-compose.yml` | | Containers | `ovp-allinone` (nginx, gunicorn, gatherer, uvicorn, OpenVPN under `supervisord`) | `ovp-ui`, `ovp-api`, `ovp-gatherer`, `ovp-profiler` | | Image build | `deploy/allinone/Dockerfile` (build context: repository root) | one Dockerfile per component (`APP_UI`, `APP_CORE`, `APP_PROFILER`) | | Choose it when | one host, simplest operation, one thing to start/stop/back up | you want to restart, scale or inspect components separately, or follow the usual one-process-per-container practice | | Trade-off | a failing process is restarted by `supervisord`, the container stays up; one image to rebuild for any change | more moving parts, internal network `ovp-net` | Both variants use the **same five named volumes with the same in-container paths**, the same environment variables and the same published ports. Backups look identical. > **Only one variant can run per host.** Both publish the same host ports (`80/tcp`, `1194/udp` by default) and use fixed container names (`ovp-*`). The scripts refuse to start a variant while a container of the other one is running. ## Requirements - Docker Engine with the compose plugin (`docker compose`, v2, preferred) or `docker-compose`. - The Docker daemon running and usable by the user that runs the scripts (root, or a member of the `docker` group). - Access to `/dev/net/tun` on the host and the `NET_ADMIN` capability (already set in the compose files). - Free disk space: about 2 GB for images and builds, plus room for backups (the scripts check both). - Internet access for the first build (base images, npm, pip) and for the backup helper image (`alpine:3`). For offline hosts see [Troubleshooting](Troubleshooting.md). - `openssl` is optional (random secret otherwise comes from `/dev/urandom`). ## Install Clone the repository, change into it and run the script (as root or a docker user): ```bash # Variant B: one container per component deploy/docker/install.sh --variant b # Variant A: everything in one container deploy/docker/install.sh --variant a # Options deploy/docker/install.sh --variant b --project ovpmon --http-port 8080 --vpn-port 1194 --admin-user admin ``` | Option | Meaning | |---|---| | `--variant a\|b` | required | | `--project NAME` | compose project name = prefix of the volume names (default `ovpmon`: volumes `ovpmon_db_data`, ...) | | `--http-port N` | host port of the UI (written to `.env` as `OVPMON_HTTP_PORT`, default 80) | | `--vpn-port N` | host UDP port of OpenVPN (`OVPMON_VPN_PORT`, default 1194) | | `--admin-user NAME` | login of the first administrator (default `admin`) | What `install.sh` does: 1. **Preflight:** docker and compose, running daemon, the other variant is not running, no foreign container with the same names, ports free, free disk space. 2. **`.env`** next to the compose files, only if it does not exist: mode 600, random `JWT_SECRET`, initial administrator with a generated 24-character password. An existing `.env` is never overwritten (`--http-port` / `--vpn-port` only set their own keys in it). 3. **Build, start** (`docker compose up -d`), write the state file `.ovpmon-deploy` (variant and project; used by `update.sh`, `backup.sh`, `restore.sh`), wait up to 3 minutes for the health checks. 4. **Initial administrator:** when the users table is not empty, `OVPMON_INITIAL_ADMIN_*` are removed from `.env` and the container that reads them is recreated (variant B: `app-api`, variant A: `ovpmon`). If the table cannot be read or is empty, the lines stay in `.env` and a warning says so. 5. **Result:** URL, ports, and the administrator login and password. **The password is shown once** and stored nowhere else. `JWT_SECRET` is never printed. Running it again is safe: it rebuilds and starts, keeps `.env`, and makes no new administrator. Then follow [First steps](../First_Steps.md) (sign in, initialize the PKI, start the VPN server). Put TLS in front of the UI (see [Security](Troubleshooting.md#security)). ### Without the script ```bash cat > .env < EOT chmod 600 .env docker compose up -d --build # variant B docker compose -f docker-compose.allinone.yml up -d --build # variant A ``` After the first start remove the two `OVPMON_INITIAL_ADMIN_*` lines from `.env` and recreate `app-api` (B) or `ovpmon` (A). ## Next [First steps](../First_Steps.md) · [Operations](Operations.md) · [Reference](Reference.md) · [Troubleshooting](Troubleshooting.md) · [Choose another method](../README.md)