
version: '3.6'

services:

  affine:
    image: ghcr.io/toeverything/affine-graphql:stable
    command:
      ['sh', '-c', 'node ./scripts/self-host-predeploy && node ./dist/index.js']
    ports:
      - '3010:3010'
      - '5555:5555'
    volumes:
      # custom configurations
      - affine-config:/root/.affine/config
      # blob storage
      - affine-storage:/root/.affine/storage
    environment:
      - NODE_OPTIONS="--import=./scripts/register.js"
      - AFFINE_CONFIG_PATH=/root/.affine/config
      - REDIS_SERVER_HOST=redis
      - DATABASE_URL=postgres://affine:affine@postgres:5432/affine
      - NODE_ENV=production
      - AFFINE_ADMIN_EMAIL=313cokr@gmail.com
      - AFFINE_ADMIN_PASSWORD=qwe123
      # Telemetry allows us to collect data on how you use the affine. This data will helps us improve the app and provide better features.
      # Uncomment next line if you wish to quit telemetry.
      # - TELEMETRY_ENABLE=false
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.hostname == k8s3]
    networks: &allinoneNetwork
      - allinoneNetwork
    extra_hosts: &addhost
      - "313.co.kr:192.168.25.31"
      - "db.313.co.kr:192.168.25.40"
      - "nas.313.co.kr:192.168.25.42"
      - "ubuntu.313.co.kr:192.168.25.31"
      - "www.313.co.kr:192.168.25.31"
      - "www.a-rms.net:192.168.25.31"
      - "a-rms.net:192.168.25.31"
    logging:
      driver: fluentd
      options:
        fluentd-address: 192.168.25.33:24224
        fluentd-async-connect: "true"
        tag: affine

volumes:
  affine-config:
    driver: local
    driver_opts:
      type: "nfs"
      o: "addr=192.168.25.42,nolock,soft,rw,sync"
      device: ":/volume1/web/allinone/affine/config"

  affine-storage:
    driver: local
    driver_opts:
      type: "nfs"
      o: "addr=192.168.25.42,nolock,soft,rw,sync"
      device: ":/volume1/web/allinone/affine/storage"


networks:
  allinoneNetwork:
    driver: overlay
    attachable: true
