Files
2026-05-19 14:53:37 +02:00

3.6 KiB

Codex Context: Terraform VM + Docker Compose Test (Single Node)

Goal

Test a single-node Docker Compose deployment on a Terraform-provisioned VM (no k3s), using the same layout as swarm. Ensure backend + FE + proxies come up and healthcheck works. This is a throwaway, clean environment.

Current State

  • VM created via Terraform: terraform-testvm-1 on Proxmox node rbmk2.
  • IP: 10.1.50.125/24, gateway 10.1.50.1.
  • SSH: ssh devops@10.1.50.125 -p42315 (company policy non-22).
  • Docker installed via get.docker.com on the VM.
  • Compose location on VM: /webapps/wolkabout.
  • Volume/config location on VM: /mnt/docker-volumes/wolkabout.
  • HAProxy fixed by ensuring options.http ends with a blank line.

Files on laptop

  • New compose file with MySQL + Cassandra: /home/nikola/codex-cli/docker-compose.with-dbs.yml (version 2.4).
  • This file was copied to the VM as /webapps/wolkabout/docker-compose.yml.

Compose contents (high level)

  • Services: mysql8, cassandra, cloud-config, rabbitmq, mosquitto, backend, frontend, frontend-federated, http2amqp, mqtt2amqp, loki, haproxy.
  • Ordered startup using depends_on + healthchecks (DBs first, then base infra, then app/FE).
  • Network name: core-net (kept same name).
  • MySQL image: mysql:8.0.32-debian with:
    • root password password
    • DB swarm, user wolk, password Test1234
    • volumes: /mnt/docker-volumes/wolkabout/mysql8, init folder /mnt/docker-volumes/wolkabout/mysql8-init, config /mnt/docker-volumes/wolkabout/config/mysql-custom.cnf
  • Cassandra image: cassandra:4.1.2, volume /mnt/docker-volumes/wolkabout/cassandra, heap env.

Config changes still needed on VM

Update these to point to local DBs/containers:

  • /mnt/docker-volumes/wolkabout/config/wolk-commons.yml
    • spring.datasource.url -> jdbc:mysql://mysql8:3306/swarm?...
    • spring.datasource.username -> wolk
    • spring.datasource.password -> Test1234
    • spring.cassandra.contact-points -> cassandra
  • /mnt/docker-volumes/wolkabout/config/mosquitto.conf
    • auth_opt_host mysql8
    • auth_opt_dbname swarm
    • auth_opt_user wolk
    • auth_opt_pass Test1234

MySQL/Cassandra init

No dump yet. We want a clean environment. Create minimal init:

  • MySQL init dir: /mnt/docker-volumes/wolkabout/mysql8-init/init.sql
    • For now can just CREATE DATABASE IF NOT EXISTS swarm;.
  • Cassandra keyspace: swarm (from wolk-commons.yml).

Recommended scripts on VM (create in /webapps/wolkabout):

  • init-mysql.sh waits for mysql, applies init.sql if present.
  • init-cassandra.sh waits for cassandra, creates keyspace swarm.

Docker registry login

ECR images require login on the VM. On swarm1 there is ~/.aws/credentials and ~/.aws/config (region eu-west-1). Use those creds (copy from swarm1 or your internal source) and run:

  • aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 629307322585.dkr.ecr.eu-west-1.amazonaws.com

Known runtime issue

  • mosquitto fails if MySQL schema/tables do not exist (MosquittoUser, MosquittoTopic). Backend may not auto-create them. If needed, we must add minimal SQL schema later.

Healthcheck target

Backend is considered ready when:

  • https://<domain>.wolkabout.com/api/infos/server returns JSON.

Next Actions (expected)

  1. Create /mnt/docker-volumes/wolkabout/config/mysql-custom.cnf (utf8mb4 + mysql_native_password + max_connections + bind-address).
  2. Update wolk-commons.yml + mosquitto.conf to local DB hostnames.
  3. Create init scripts + minimal init.sql.
  4. docker compose down then up -d.
  5. Run init scripts and validate with docker compose ps.