services:
  postgres:
    networks:
      - internal
    image: postgres:16-alpine
    env_file: .env
    restart: always
    volumes:
      - /srv/linkwarden/pgdata:/var/lib/postgresql/data
  linkwarden:
    networks:
      - traefik
      - internal
    env_file: .env
    environment:
      - DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgres:5432/postgres
    restart: always
    # build: . # uncomment to build from source
    image: ghcr.io/linkwarden/linkwarden:latest # comment to build from source
#    ports:
#     - 3223:3000
    volumes:
      - /srv/linkwarden/data:/data/data
    depends_on:
      - postgres
      - meilisearch
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.linkwarden.tls=true"
      - "traefik.http.routers.linkwarden.entrypoints=websecure"
      - "traefik.http.routers.linkwarden.rule=Host(`links.knast.cc`)"
      - "traefik.http.routers.linkwarden.tls.certresolver=letsencr"
      - "traefik.http.services.linkwarden.loadbalancer.server.port=3000"
  meilisearch:
    networks:
      - internal
    image: getmeili/meilisearch:v1.12.8
    restart: always
    env_file:
      - .env
    volumes:
      - /srv/linkwarden/meili_data:/meili_data


networks:
  internal:
    external: false
  traefik:
    external: true
