services:
  caddy:
    image: caddy:2.8.4
    container_name: homelab_caddy
    restart: unless-stopped
    network_mode: host
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - ./caddy/data:/data
      - ./caddy/config:/config
    environment:
      - EMAIL=nkh@ik.me

  authelia:
    image: authelia/authelia:latest
    container_name: homelab_authelia
    restart: unless-stopped
    ports:
      - "9091:9091"
    volumes:
      - ./authelia/config:/config
    environment:
      - TZ=Europe/Paris
    depends_on:
      - redis
    networks:
      - homelab

  redis:
    image: redis:7-alpine
    container_name: homelab_redis
    restart: unless-stopped
    volumes:
      - ./redis:/data
    networks:
      - homelab

  wireguard:
    image: ghcr.io/wg-easy/wg-easy:14
    container_name: homelab_wireguard
    restart: unless-stopped
    ports:
      - "51820:51820/udp"
      - "51821:51821/tcp"
    volumes:
      - ./wireguard:/etc/wireguard
    environment:
      - WG_HOST=192.168.1.97
      - PASSWORD_HASH=\b\2\.Vb.nG2IOE7EELn.exnaKbmIA2eQeBX00vDkJbiu
      - WG_PORT=51820
      - WG_DEFAULT_DNS=172.20.0.3
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    networks:
      - homelab

  adguard:
    image: adguard/adguardhome:latest
    container_name: homelab_adguard
    restart: unless-stopped
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "3003:80"
    volumes:
      - ./adguard/work:/opt/adguardhome/work
      - ./adguard/conf:/opt/adguardhome/conf
    networks:
      - homelab
  vaultwarden:
    image: vaultwarden/server:latest
    container_name: vaultwarden
    restart: unless-stopped
    networks:
      homelab:
        ipv4_address: 172.20.0.25
    volumes:
      - ./vaultwarden:/data
    environment:
      - DOMAIN=https://vault.nkhproxy.duckdns.org
      - SIGNUPS_ALLOWED=false  
      - ADMIN_TOKEN=$argon2id$v=19$m=19456,t=2,p=1$4R5KhUc6QEtAyQ5t3ya6We6ogrHpT86ZctDRkv7HPik$Z0j2tn21diXk5VZSZYp4gvvtbG1SGWMKoodbuCMU2jk
      - SMTP_HOST=smtp.gmail.com
      - SMTP_FROM=nkh.server@gmail.com
      - SMTP_PORT=587
      - SMTP_SECURITY=starttls
      - SMTP_USERNAME=nkh.server@gmail.com
      - SMTP_PASSWORD=oxmq nqfb chaz mnou
  portainer:
    image: portainer/portainer-ce:latest
    container_name: homelab_portainer
    networks:
      homelab:
        ipv4_address: 172.20.0.16
    restart: unless-stopped
    ports:
      - "9000:9000"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./portainer:/data

  grafana:
    image: grafana/grafana:latest
    container_name: homelab_grafana
    restart: unless-stopped
    ports:
      - "3001:3000"
    volumes:
      - ./grafana:/var/lib/grafana
    environment:
      - GF_SECURITY_ADMIN_USER=NKH
      - GF_SECURITY_ADMIN_PASSWORD=Nihilisme1158
      - GF_SERVER_ROOT_URL=https://grafana.nkhproxy.duckdns.org
      
    networks:
      - homelab

  uptime_kuma:
    image: louislam/uptime-kuma:latest
    container_name: homelab_uptime_kuma
    restart: unless-stopped
    ports:
      - "3001:3001"
    volumes:
      - ./uptime_kuma:/app/data
    networks:
      - homelab

  mailhog:
    image: mailhog/mailhog:latest
    container_name: homelab_mailhog
    restart: unless-stopped
    ports:
      - "1025:1025"
      - "8025:8025"
    networks:
      - homelab

  nextcloud_db:
    image: mariadb:10.11
    container_name: homelab_nextcloud_db
    restart: unless-stopped
    volumes:
      - ./database/nextcloud:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=Nihilisme1158#@
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=Nihilisme1158#@
    networks:
      - homelab

  nextcloud:
    image: nextcloud:latest
    container_name: homelab_nextcloud
    restart: unless-stopped
    ports:
      - "8081:80"
    volumes:
      - ./nextcloud:/var/www/html
    environment:
      - MYSQL_HOST=nextcloud_db
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=Nihilisme1158#@
      - NEXTCLOUD_ADMIN_USER=admin
      - NEXTCLOUD_ADMIN_PASSWORD=Nihilisme1158#@
    depends_on:
      - nextcloud_db
    networks:
      - homelab

  prometheus:
    image: prom/prometheus:latest
    container_name: homelab_prometheus
    restart: unless-stopped
    ports:
      - "9090:9090"
    volumes:
      - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - ./prometheus/data:/prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.retention.time=30d'
    networks:
      - homelab
  node_exporter:
    image: prom/node-exporter:latest
    container_name: homelab_node_exporter
    restart: unless-stopped
    pid: host
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
    command:
      - '--path.procfs=/host/proc'
      - '--path.sysfs=/host/sys'
      - '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
    networks:
      - homelab

  collabora:
    image: collabora/code:latest
    container_name: collabora
    restart: unless-stopped
    cap_add:
      - MKNOD
    networks:
      homelab:
        ipv4_address: 172.20.0.22
    environment:
      - domain=nextcloud\\.nkhproxy\\.duckdns\\.org
      - username=admin
      - password=Nihilisme1158
      - extra_params=--o:ssl.enable=false --o:ssl.termination=true


  opencanary:
    image: cowrie/cowrie:latest
    container_name: opencanary
    restart: unless-stopped
    networks:
      homelab:
        ipv4_address: 172.20.0.27
    volumes:
      - ./opencanary:/etc/opencanary
    ports:
      - "2222:22"
      - "8880:80"
      - "2121:21"


  loki:
    image: grafana/loki:latest
    container_name: loki
    restart: unless-stopped
    networks:
      homelab:
        ipv4_address: 172.20.0.28
    volumes:
      - ./loki:/etc/loki
      - loki-data:/loki

  promtail:
    image: grafana/promtail:latest
    container_name: promtail
    restart: unless-stopped
    networks:
      homelab:
        ipv4_address: 172.20.0.29
    volumes:
      - ./promtail:/etc/promtail
      - /var/lib/docker/volumes/8291b62a6cb651a1f4b495052c51286c9faccd9cc64088d85c9cab5dcbd83f35/_data/log/cowrie:/cowrie-logs:ro


  watchtower:
    image: containrrr/watchtower:latest
    container_name: watchtower
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WATCHTOWER_SCHEDULE=0 0 3 * * 0
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_INCLUDE_STOPPED=false
      - WATCHTOWER_NOTIFICATIONS=shoutrrr
      - WATCHTOWER_NOTIFICATION_URL=telegram://1986587968:AAHSa_SUZcrmuMkXOhw4OWDEwoUSscNmwBM@telegram?channels=658369739
    networks:
      - homelab

networks:
  homelab:
    external: true

volumes:
  loki-data:
