version: '3'

volumes:
  nodecache: {}
  redisdata: {}
  mgpassdata: {}
  postgresdata: {}

networks:
  metager:
    name: metager_net
    ipam:
      driver: default
      config:
        - subnet: "192.168.5.0/24"

services:
  express:
    build:
      context: ./build/pass
      target: development
    networks:
      metager:
        ipv4_address: 192.168.5.100
    working_dir: /app
    volumes:
      - ./pass:/app
      - mgpassdata:/data
    ports:
      - 8085:3000
      - 9229:9229
    ulimits:
      nofile: 65535
    depends_on:
      - express_postgres
  express_cron:
    build:
      context: ./build/pass
      target: development
    entrypoint: "/usr/local/bin/node"
    command: "./bin/cron"
    networks:
      - metager
    working_dir: /app
    volumes:
      - ./pass:/app
      - mgpassdata:/data
    depends_on:
      - express_postgres
  express_redis:
    build:
      context: ./build/redis
    networks:
      - metager
    volumes:
      - redisdata:/data
    restart: unless-stopped
  express_postgres:
    image: postgres:15.2-bullseye
    ports:
      - 5432:5432
    volumes:
      - postgresdata:/var/lib/postgresql/data
    networks:
      - metager
    environment:
      POSTGRES_PASSWORD: secure
      POSTGRES_USER: metager
      POSTGRES_DB: metager
