version: '3'

services:
  #############################
  # Trilium (Existing)
  #############################
  trilium:
    image: triliumnext/notes:latest
    restart: unless-stopped
    environment:
      - TRILIUM_DATA_DIR=/home/node/trilium-data
    ports:
      - '8081:8080'  # Only expose to localhost
    volumes:
      - /mnt/trilium_data:/home/node/trilium-data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    healthcheck:
      disable: true 
    privileged: true


  #############################
  # Vikunja Configuration
  #############################
  vikunja:
    image: vikunja/vikunja:latest
    container_name: vikunja
    restart: unless-stopped
    environment:
      # Set this to your machine's Tailscale hostname (or the machine's hostname in your Tailnet)
      VIKUNJA_SERVICE_PUBLICURL: http://lenovo:8082
      VIKUNJA_DATABASE_HOST: vikunja-db
      VIKUNJA_DATABASE_PASSWORD: changeme  # Use a strong password
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
      VIKUNJA_SERVICE_JWTSECRET: generate-a-random-secret  # Use a random string
    ports:
      - "8082:3456"  # Only expose to localhost
    volumes:
      - ./vikunja-files:/app/vikunja/files
    depends_on:
      vikunja-db:
        condition: service_healthy

  vikunja-db:
    image: mariadb:10
    container_name: vikunja-db
    restart: unless-stopped
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword  # Use a strong password
      MYSQL_USER: vikunja
      MYSQL_PASSWORD: changeme  # Use a strong password
      MYSQL_DATABASE: vikunja
    volumes:
      - ./vikunja-db:/var/lib/mysql
    healthcheck:
      test: ["CMD-SHELL", "mysqladmin ping -h localhost -u vikunja --password=changeme"]
      interval: 2s
      start_period: 30s


  #############################
  # NocoDB Configuration
  #############################


  nocodb:
    image: nocodb/nocodb:latest
    container_name: nocodb
    restart: unless-stopped
    ports:
      - "8083:8080"
    volumes:
      - ./nocodb-data:/usr/app/data   # persist SQLite DB
    environment:
      NC_ADMIN_EMAIL:    "jpressnell@matdads.com"
      NC_ADMIN_PASSWORD: "}iD243X#*~>'d" 
      
