version: '3.9'

services:
  silverbullet:
    image: zefhemel/silverbullet:0.7.0
    container_name: 'silverbullet'
    restart: unless-stopped
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ${APP_DATA_DIR}/space:/space
    environment:
      - SB_USER=${SB_USER}:${SB_PASSWORD}
    ports:
      - ${APP_PORT}:3000
    networks:
      - tipi_main_network
    labels:
      # Main
      traefik.enable: true
      traefik.http.middlewares.silverbullet-web-redirect.redirectscheme.scheme: https
      traefik.http.services.silverbullet.loadbalancer.server.port: 3000
      # Web
      traefik.http.routers.silverbullet-insecure.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.silverbullet-insecure.entrypoints: web
      traefik.http.routers.silverbullet-insecure.service: silverbullet
      traefik.http.routers.silverbullet-insecure.middlewares: silverbullet-web-redirect
      # Websecure
      traefik.http.routers.silverbullet.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.silverbullet.entrypoints: websecure
      traefik.http.routers.silverbullet.service: silverbullet
      traefik.http.routers.silverbullet.tls.certresolver: myresolver
      # Local domain
      traefik.http.routers.silverbullet-local-insecure.rule: Host(`silverbullet.${LOCAL_DOMAIN}`)
      traefik.http.routers.silverbullet-local-insecure.entrypoints: web
      traefik.http.routers.silverbullet-local-insecure.service: silverbullet
      traefik.http.routers.silverbullet-local-insecure.middlewares: silverbullet-web-redirect
      # Local domain secure
      traefik.http.routers.silverbullet-local.rule: Host(`silverbullet.${LOCAL_DOMAIN}`)
      traefik.http.routers.silverbullet-local.entrypoints: websecure
      traefik.http.routers.silverbullet-local.service: silverbullet
      traefik.http.routers.silverbullet-local.tls: true
