---
version: "3.8"

services:
  app:
    image: decentral1se/beta.lumbung.space:latest
    networks:
      - proxy
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:1313"]
      interval: 10s
      timeout: 10s
      retries: 10
      start_period: 15s
    volumes:
      - content:/src/content
    command: |
      server
      --appendPort='false'
      --bind 0.0.0.0
      --baseUrl='https://beta.lumbung.space'
      --port='1313'
      --buildFuture
      --watch
    deploy:
      update_config:
        failure_action: rollback
        order: start-first
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.coop-cloud-site.rule=Host(`beta.lumbung.space`)"
        - "traefik.http.routers.coop-cloud-site.entrypoints=web-secure"
        - "traefik.http.services.coop-cloud-site.loadbalancer.server.port=1313"
        - "traefik.http.routers.coop-cloud-site.tls.certresolver=production"

  peertube:
    image: decentral1se/beta.lumbung.space-scripts:latest
    volumes:
      - content:/src/content
    environment:
      OUTPUT_DIR: /src/content/video
    command: |
      bash -c "
        while true
        do
          echo 'generating peertube posts...'
          lumbunglib-vid
          echo 'going to sleep for 5 minutes...'
          sleep 300
        done
      "

  calendar:
    image: decentral1se/beta.lumbung.space-scripts:latest
    volumes:
      - content:/src/content
    environment:
      OUTPUT_DIR: /src/content/calendar
      CALENDAR_URL: "https://cloud.lumbung.space/remote.php/dav/public-calendars/WbnHM8YdCkKT6bcT?export"
    command: |
      bash -c "
        while true
        do
          echo 'generating calendar posts...'
          lumbunglib-cal
          echo 'going to sleep for 5 minutes...'
          sleep 300
        done
      "

  feed:
    image: decentral1se/beta.lumbung.space-scripts:latest
    volumes:
      - content:/src/content
    configs:
      - source: feeds_list
        target: /src/feeds_list.txt
    environment:
      OUTPUT_DIR: /src/content/feed
    command: |
      bash -c "
        while true
        do
          echo 'generating feed posts...'
          lumbunglib-feed
          echo 'going to sleep for 5 minutes...'
          sleep 300
        done
      "

volumes:
  content:

networks:
  proxy:
    external: true

configs:
  feeds_list:
    name: beta_lumbung_space_feeds_list_v1
    file: feeds_list.txt