services:
#    db:
#        image: postgres:16
#        volumes:
#            - ./data/postgres:/var/lib/postgresql/data
#        ports:
#            - "5432:5432"
#        restart: unless-stopped
#        environment:
#            - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
#            - POSTGRES_USER=${POSTGRES_USER}
#            - POSTGRES_DB=${POSTGRES_DATABASE}
    app:
        container_name: joplinsrv
        image: joplin/server:latest
#        depends_on:
#            - db
#        ports:
#            - "22300:22300"
        restart: unless-stopped
        environment:
            - APP_PORT=22300
            #- APP_BASE_URL=http://10.0.6.177:22300
            - APP_BASE_URL=https://joplin.lab.gurulandia.eu
            - DB_CLIENT=pg
            - POSTGRES_PASSWORD=joplinsrv
            - POSTGRES_DATABASE=joplin
            - POSTGRES_USER=joplinsrv
            - POSTGRES_PORT=5432
            - POSTGRES_HOST=10.0.6.178
            #- STORAGE_DRIVER=Type=S3; Region=us-east-1; Path=http://192.168.55.30:53008; AccessKeyId=joplinsrv; SecretAccessKeyId=joplinsrv; Bucket=joplin
            - MAILER_ENABLED=1
            - MAILER_HOST=mailrise.lab.gurulandia.eu
            - MAILER_PORT=465
            - MAILER_SECURITY=tls
            - MAILER_AUTH_USER=gurulandia
            - MAILER_AUTH_PASSWORD=gurulandia
            - MAILER_NOREPLY_NAME=JoplinServer
            - MAILER_NOREPLY_EMAIL=my_email_address
        networks:
            - proxy
        labels:
            traefik.enable: true
            ## HTTP Routers
            traefik.http.routers.joplin-server-rtr.entrypoints: https
            traefik.http.routers.joplin-server-rtr.rule: Host(`joplin.lab.gurulandia.eu`)
            ## Middlewares
            #- "traefik.http.routers.${GOTIFY_HOST_NAME}-rtr.middlewares=chain-authelia@file"
            traefik.http.routers.joplinserver-rtr.middlewares: chain-no-auth@file
            ## HTTP Services
            traefik.http.routers.joplin-server-rtr.service: joplin-server-svc
            traefik.http.services.joplin-server-svc.loadbalancer.server.port: 22300
#        one:
#            label_file: ./app.labels
#
#        two:
#            label_file:
#            - ./app.labels
#            - ./additional.labels
services:
  crowdsec:
    image: ${CROWDSEC_IMAGE}:${CROWDSEC_VERSION}
    container_name: ${CROWDSEC_CONTAINER_NAME}
    restart: ${CROWDSEC_RESTART_POLICY}
    security_opt:
      - no-new-privileges:true
    networks:
      - proxy
    environment:
      GID: "${GID-1000}"
    env_file:
      - path: ./crowdsec.env
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ${DOCKERDIR}/crowdsec/acquis.d:/etc/crowdsec/acquis.d
      #- ${DOCKERDIR}/crowdsec/acquis.yaml:/etc/crowdsec/acquis.yaml
      - ${DOCKERDIR}/crowdsec/db:/var/lib/crowdsec/data/
      - ${DOCKERDIR}/crowdsec/config:/etc/crowdsec/
      - ${DOCKERDIR}/traefik/logs:/var/log/traefik/:ro
      - /var/log/auth.log:/logs/auth.log:ro
      - /var/log/syslog.log:/logs/syslog.log:ro

##### Joplin Server Container
JOPLIN_CONTAINER_NAME=traefik
JOPLIN_IMAGE=traefik
JOPLIN_TAG=latest
JOPLIN_RESTART_POLICY=unless-stopped

##### Joplin Server DB Container
JOPLINDB_CONTAINER_NAME=socket-proxy
JOPLINDB_IMAGE=ghcr.io/tecnativa/docker-socket-proxy
JOPLINDB_TAG=latest
JOPLINDB_RESTART_POLICY=always            
