version: "3.8"

services:
  client:
    image: ghcr.io/vertex-center/client:main
    networks:
      - external
      - internal
    ports:
      - "7518:80"
    environment:
      VERTEX_SQL_ADDR: http://localhost:7512/api
      VERTEX_REVERSE_PROXY_ADDR: http://localhost:7508/api
      VERTEX_SERVICE_EDITOR_ADDR: http://localhost:7510/api
      VERTEX_CONTAINERS_ADDR: http://localhost:7504/api
      VERTEX_ADMIN_ADDR: http://localhost:7500/api
      VERTEX_AUTH_ADDR: http://localhost:7502/api
      VERTEX_TUNNELS_ADDR: http://localhost:7514/api
      VERTEX_MONITORING_ADDR: http://localhost:7506/api

  admin:
    image: ghcr.io/vertex-center/vertex-admin:main
    networks:
      - internal
      - external
    ports:
      - "7500:8080"
    environment:
      - VERTEX_LOGS_ADDR=http://logs:8080/api
      - VERTEX_AUTH_ADDR=http://auth:8080/api
      - VERTEX_DB_HOST=admin-postgres
      - VERTEX_DB_PORT=5432
      - VERTEX_DB_USER=postgres
      - VERTEX_DB_PASS=vx-pg-pass

  admin-postgres:
    image: postgres:16.1-alpine3.19
    networks:
      - internal
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=vx-pg-pass
      - POSTGRES_DB=admin
    volumes:
      - admin_postgres:/var/lib/postgresql/data

  auth:
    image: ghcr.io/vertex-center/vertex-auth:main
    networks:
      - internal
      - external
    ports:
      - "7502:8080"
    environment:
      - VERTEX_LOGS_ADDR=http://logs:8080/api
      - VERTEX_DB_HOST=auth-postgres
      - VERTEX_DB_PORT=5432
      - VERTEX_DB_USER=postgres
      - VERTEX_DB_PASS=vx-pg-pass

  auth-postgres:
    image: postgres:16.1-alpine3.19
    networks:
      - internal
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=vx-pg-pass
      - POSTGRES_DB=auth
    volumes:
      - auth_postgres:/var/lib/postgresql/data

  containers:
    image: ghcr.io/vertex-center/vertex-containers:main
    networks:
      - internal
      - external
    ports:
      - "7504:8080"
    environment:
      - VERTEX_LOGS_ADDR=http://logs:8080/api
      - VERTEX_AUTH_ADDR=http://auth:8080/api
      - VERTEX_CONTAINERS_KERNEL_ADDR=http://containers-kernel:8080/api
      - VERTEX_DB_HOST=containers-postgres
      - VERTEX_DB_PORT=5432
      - VERTEX_DB_USER=postgres
      - VERTEX_DB_PASS=vx-pg-pass

  containers-postgres:
    image: postgres:16.1-alpine3.19
    networks:
      - internal
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=vx-pg-pass
      - POSTGRES_DB=containers
    volumes:
      - containers_postgres:/var/lib/postgresql/data

  containers-kernel:
    image: ghcr.io/vertex-center/vertex-containers-kernel:main
    networks:
      - internal
    environment:
      - VERTEX_LOGS_ADDR=http://logs:8080/api
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  monitoring:
    image: ghcr.io/vertex-center/vertex-monitoring:main
    networks:
      - internal
      - external
    ports:
      - "7506:8080"
    environment:
      - VERTEX_LOGS_ADDR=http://logs:8080/api
      - VERTEX_AUTH_ADDR=http://auth:8080/api
      - VERTEX_CONTAINERS_ADDR=http://containers:8080/api

  reverseproxy:
    image: ghcr.io/vertex-center/vertex-reverseproxy:main
    networks:
      - internal
      - external
    ports:
      - "7508:8080"
    environment:
      - VERTEX_LOGS_ADDR=http://logs:8080/api
      - VERTEX_AUTH_ADDR=http://auth:8080/api

  sql:
    image: ghcr.io/vertex-center/vertex-sql:main
    networks:
      - internal
      - external
    ports:
      - "7512:8080"
    environment:
      - VERTEX_LOGS_ADDR=http://logs:8080/api
      - VERTEX_AUTH_ADDR=http://auth:8080/api
      - VERTEX_CONTAINERS_ADDR=http://containers:8080/api

  tunnels:
    image: ghcr.io/vertex-center/vertex-tunnels:main
    networks:
      - internal
      - external
    ports:
      - "7514:8080"
    environment:
      - VERTEX_LOGS_ADDR=http://logs:8080/api
      - VERTEX_AUTH_ADDR=http://auth:8080/api
      - VERTEX_CONTAINERS_ADDR=http://containers:8080/api

  logs:
    image: ghcr.io/vertex-center/vertex-logs:main
    networks:
      - internal
    volumes:
      - logs:/live/logs

networks:
  external:
  internal:

volumes:
  admin_postgres:
  auth_postgres:
  containers_postgres:
  logs: