version: "3.7"

name: nx-tianji
services:
  nx-tianji:
    container_name: nx-tianji
    image: moonrailgun/tianji:1.31.8@sha256:86b58556fa9ff5454cb4eeddc2330124244733820a56b5491c8c0e4399880c68
    restart: unless-stopped
    environment:
      DATABASE_URL: postgresql://tianji-user:227453b7-1286-48cc-b471-1c269495c5fc@nx-tianji-db:5432/tianji
      JWT_SECRET: replace-me-with-a-random-string
      ALLOW_REGISTER: "false"
      ALLOW_OPENAPI: "true"
    ports:
      - "12345:12345"
    networks:
      - nx_tianji_network
    depends_on:
      - nx-tianji-db
  nx-tianji-db:
    container_name: nx-tianji-db
    image: postgres:15.4-alpine
    environment:
      POSTGRES_DB: tianji
      POSTGRES_USER: tianji-user
      POSTGRES_PASSWORD: 227453b7-1286-48cc-b471-1c269495c5fc
    volumes:
      - tianji_pgdata:/var/lib/postgresql/data
    restart: always
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}" ]
      interval: 5s
      timeout: 5s
      retries: 5
    networks:
      - nx_tianji_network
networks:
  nx_tianji_network:
    driver: bridge
volumes:
  tianji_pgdata:
    name: tianji_pgdata
    driver: local
