docker-compose.yml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. services:
  2. # Reverse Proxy with Auto-TLS
  3. traefik:
  4. image: traefik:v2.11
  5. container_name: waouw_traefik
  6. restart: unless-stopped
  7. ports:
  8. - "80:80"
  9. - "443:443"
  10. volumes:
  11. - /var/run/docker.sock:/var/run/docker.sock:ro
  12. - /etc/waouw/traefik:/config:ro
  13. - traefik_certificates:/certificates
  14. - traefik_logs:/var/log/traefik
  15. environment:
  16. - ACME_EMAIL=${ACME_EMAIL}
  17. command:
  18. - --configFile=/config/traefik.yml
  19. - --entrypoints.web.address=:80
  20. - --entrypoints.websecure.address=:443
  21. - --providers.docker=true
  22. - --providers.docker.endpoint=unix:///var/run/docker.sock
  23. - --api.dashboard=true
  24. - --api.insecure=true
  25. - --providers.file.filename=/config/dynamic.yml
  26. - --providers.file.watch=true
  27. - --ping=true
  28. - --providers.docker.network=waouw_traefik
  29. - --accesslog=true
  30. - --accesslog.filepath=/var/log/traefik/access.log
  31. - --accesslog.bufferingsize=100
  32. - --certificatesresolvers.letsencrypt.acme.email=${ACME_EMAIL}
  33. - --certificatesresolvers.letsencrypt.acme.storage=/certificates/acme.json
  34. - --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web
  35. labels:
  36. - "traefik.enable=true"
  37. - "traefik.http.routers.api.rule=Host(`traefik.${WAOUW_DOMAIN:-localhost}`)"
  38. - "traefik.http.routers.api.tls.certresolver=letsencrypt"
  39. networks:
  40. - traefik
  41. healthcheck:
  42. test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/ping"]
  43. interval: 30s
  44. timeout: 10s
  45. retries: 3
  46. postgres:
  47. image: postgres:15-alpine
  48. container_name: waouw_postgres
  49. restart: unless-stopped
  50. environment:
  51. POSTGRES_DB: waouw
  52. POSTGRES_USER: waouw
  53. POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
  54. POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
  55. volumes:
  56. - postgres_data:/var/lib/postgresql/data
  57. - ./init-db.sql:/docker-entrypoint-initdb.d/init-db.sql:ro
  58. networks:
  59. - backend
  60. healthcheck:
  61. test: ["CMD-SHELL", "pg_isready -U waouw"]
  62. interval: 30s
  63. timeout: 10s
  64. retries: 3
  65. deploy:
  66. resources:
  67. limits:
  68. memory: 256M
  69. cpus: '0.5'
  70. reservations:
  71. memory: 128M
  72. redis:
  73. image: redis:7-alpine
  74. container_name: waouw_redis
  75. restart: unless-stopped
  76. command: redis-server --maxmemory 64mb --maxmemory-policy allkeys-lru
  77. volumes:
  78. - redis_data:/data
  79. networks:
  80. - backend
  81. healthcheck:
  82. test: ["CMD", "redis-cli", "ping"]
  83. interval: 30s
  84. timeout: 10s
  85. retries: 3
  86. deploy:
  87. resources:
  88. limits:
  89. memory: 128M
  90. cpus: '0.25'
  91. backend:
  92. build:
  93. context: ../BACKEND
  94. dockerfile: Dockerfile
  95. args:
  96. - BUILDPLATFORM=${BUILDPLATFORM:-linux/arm64}
  97. container_name: waouw_backend
  98. restart: unless-stopped
  99. environment:
  100. - DATABASE_URL=${DATABASE_URL}
  101. - REDIS_URL=${REDIS_URL}
  102. - JWT_SECRET_KEY=${JWT_SECRET_KEY}
  103. - DEVICE_HMAC_SECRET=${DEVICE_HMAC_SECRET}
  104. - WAOUW_DOMAIN=${WAOUW_DOMAIN:-waouw.local}
  105. - WAOUW_CLOUD_DOMAIN=${WAOUW_CLOUD_DOMAIN:-}
  106. - WAOUW_ADMIN_URL=${WAOUW_ADMIN_URL}
  107. - NEXTCLOUD_ADMIN_PASSWORD=${NEXTCLOUD_ADMIN_PASSWORD}
  108. - WAOUW_SUPPORT_SSH_USER=${WAOUW_SUPPORT_SSH_USER:-waouw}
  109. - WAOUW_SUPPORT_SSH_ROTATE=${WAOUW_SUPPORT_SSH_ROTATE:-1}
  110. - WAOUW_LAN_IP=${WAOUW_LAN_IP:-}
  111. - WAOUW_GATEWAY_IP=${WAOUW_GATEWAY_IP:-}
  112. - LOG_LEVEL=${LOG_LEVEL:-INFO}
  113. - MAIL_MYSQL_HOST=maildb
  114. - MAIL_MYSQL_USER=mailuser
  115. - MAIL_MYSQL_PASSWORD=${MAIL_MYSQL_PASSWORD}
  116. - MAIL_MYSQL_DATABASE=mailserver
  117. - SMTP_FROM_EMAIL=${SMTP_FROM_EMAIL:-waouwbox@waouw.tech}
  118. - SYNCTHING_URL=http://syncthing:8384
  119. - SYNCTHING_API_KEY=${SYNCTHING_API_KEY:-}
  120. - MAIL_MYSQL_ROOT_PASSWORD=${MAIL_MYSQL_ROOT_PASSWORD}
  121. group_add:
  122. - "${DOCKER_GID:-985}" # docker group GID on host — gives access to /var/run/docker.sock
  123. cap_add:
  124. - SYS_ADMIN
  125. volumes:
  126. - /var/run/docker.sock:/var/run/docker.sock
  127. - /etc/waouw:/etc/waouw:rw
  128. - /opt/waouw/sites-data:/opt/waouw/sites-data:rw
  129. - /opt/waouw/VERSION.json:/app/VERSION.json:ro
  130. - backend_logs:/app/logs
  131. - sync_db_dumps:/data/sync-dumps
  132. - backup_data:/data/backups
  133. - dovecot_data:/data/dovecot:ro
  134. - nextcloud_storage:/data/nextcloud:ro
  135. networks:
  136. - backend
  137. - traefik
  138. - mail
  139. depends_on:
  140. postgres:
  141. condition: service_healthy
  142. redis:
  143. condition: service_healthy
  144. labels:
  145. - "traefik.enable=true"
  146. - "traefik.docker.network=waouw_traefik"
  147. - "traefik.http.routers.backend.rule=PathPrefix(`/api`)"
  148. - "traefik.http.routers.backend.entrypoints=web,websecure"
  149. - "traefik.http.routers.backend.tls=true"
  150. - "traefik.http.routers.backend.priority=100"
  151. - "traefik.http.services.backend.loadbalancer.server.port=8000"
  152. healthcheck:
  153. test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
  154. interval: 30s
  155. timeout: 10s
  156. retries: 3
  157. deploy:
  158. resources:
  159. limits:
  160. memory: 512M
  161. cpus: '1.0'
  162. reservations:
  163. memory: 256M
  164. worker:
  165. build:
  166. context: ../BACKEND
  167. dockerfile: Dockerfile
  168. container_name: waouw_worker
  169. restart: unless-stopped
  170. command: celery -A app.tasks worker --loglevel=info --concurrency=2
  171. environment:
  172. - DATABASE_URL=${DATABASE_URL}
  173. - REDIS_URL=${REDIS_URL}
  174. - CELERY_BROKER_URL=redis://redis:6379/1
  175. - CELERY_RESULT_BACKEND=redis://redis:6379/2
  176. - JWT_SECRET_KEY=${JWT_SECRET_KEY}
  177. - WAOUW_ADMIN_URL=${WAOUW_ADMIN_URL}
  178. - LOG_LEVEL=${LOG_LEVEL:-INFO}
  179. volumes:
  180. - /var/run/docker.sock:/var/run/docker.sock:ro
  181. - /etc/waouw:/etc/waouw:rw
  182. - worker_logs:/app/logs
  183. networks:
  184. - backend
  185. depends_on:
  186. postgres:
  187. condition: service_healthy
  188. redis:
  189. condition: service_healthy
  190. healthcheck:
  191. test: ["CMD", "celery", "-A", "app.tasks", "inspect", "ping"]
  192. interval: 60s
  193. timeout: 30s
  194. retries: 3
  195. deploy:
  196. resources:
  197. limits:
  198. memory: 256M
  199. cpus: '0.5'
  200. frontend:
  201. build:
  202. context: ../UI
  203. dockerfile: Dockerfile
  204. args:
  205. VITE_API_URL: ${VITE_API_URL:-/api/v1}
  206. container_name: waouw_frontend
  207. restart: unless-stopped
  208. depends_on:
  209. backend:
  210. condition: service_healthy
  211. networks:
  212. - traefik
  213. labels:
  214. - 'traefik.enable=true'
  215. - 'traefik.docker.network=waouw_traefik'
  216. - 'traefik.http.routers.frontend.rule=PathPrefix(`/`)'
  217. - 'traefik.http.routers.frontend.priority=1'
  218. - 'traefik.http.routers.frontend.entrypoints=web,websecure'
  219. - 'traefik.http.routers.frontend.tls=true'
  220. - 'traefik.http.services.frontend.loadbalancer.server.port=80'
  221. healthcheck:
  222. test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:80/"]
  223. interval: 30s
  224. timeout: 10s
  225. retries: 3
  226. deploy:
  227. resources:
  228. limits:
  229. memory: 128M
  230. cpus: '0.25'
  231. mosquitto:
  232. image: eclipse-mosquitto:2.0
  233. container_name: waouw_mosquitto
  234. restart: unless-stopped
  235. ports:
  236. - "1883:1883"
  237. volumes:
  238. - ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
  239. - mosquitto_data:/mosquitto/data
  240. - mosquitto_logs:/mosquitto/log
  241. networks:
  242. - backend
  243. profiles:
  244. - mqtt
  245. healthcheck:
  246. test: ["CMD", "mosquitto_pub", "-h", "localhost", "-t", "test", "-m", "health"]
  247. interval: 30s
  248. timeout: 10s
  249. retries: 3
  250. # ==== EMAIL STACK ====
  251. maildb:
  252. image: mariadb:10.11
  253. container_name: waouw_maildb
  254. restart: unless-stopped
  255. environment:
  256. MYSQL_ROOT_PASSWORD: ${MAIL_MYSQL_ROOT_PASSWORD}
  257. MYSQL_DATABASE: mailserver
  258. MYSQL_USER: mailuser
  259. MYSQL_PASSWORD: ${MAIL_MYSQL_PASSWORD}
  260. volumes:
  261. - maildb_data:/var/lib/mysql
  262. - ./mail-init.sql:/docker-entrypoint-initdb.d/init.sql:ro
  263. networks:
  264. - mail
  265. healthcheck:
  266. test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
  267. interval: 30s
  268. timeout: 10s
  269. retries: 3
  270. deploy:
  271. resources:
  272. limits:
  273. memory: 256M
  274. cpus: '0.5'
  275. postfix:
  276. image: boky/postfix:latest
  277. container_name: waouw_postfix
  278. restart: unless-stopped
  279. environment:
  280. HOSTNAME: ${WAOUW_DOMAIN:-waouw.local}
  281. ALLOWED_SENDER_DOMAINS: ${WAOUW_DOMAIN:-waouw.local} waouw.tech
  282. POSTFIX_myhostname: ${WAOUW_DOMAIN:-waouw.local}
  283. POSTFIX_mydestination: ${WAOUW_DOMAIN:-waouw.local}
  284. ports:
  285. - "25:25"
  286. - "587:587"
  287. volumes:
  288. - postfix_data:/var/lib/postfix
  289. - postfix_logs:/var/log
  290. networks:
  291. - mail
  292. - traefik
  293. depends_on:
  294. maildb:
  295. condition: service_healthy
  296. healthcheck:
  297. test: ["CMD", "nc", "-z", "localhost", "587"]
  298. interval: 30s
  299. timeout: 10s
  300. retries: 3
  301. dovecot:
  302. image: dovecot/dovecot:latest-root
  303. container_name: waouw_dovecot
  304. restart: unless-stopped
  305. ports:
  306. - "143:143"
  307. - "993:993"
  308. - "110:110"
  309. - "995:995"
  310. volumes:
  311. - dovecot_data:/var/lib/dovecot
  312. - dovecot_config:/etc/dovecot
  313. networks:
  314. - mail
  315. depends_on:
  316. maildb:
  317. condition: service_healthy
  318. healthcheck:
  319. test: ["CMD", "nc", "-z", "localhost", "143"]
  320. interval: 30s
  321. timeout: 10s
  322. retries: 3
  323. roundcube:
  324. image: roundcube/roundcubemail:latest-apache
  325. container_name: waouw_roundcube
  326. restart: unless-stopped
  327. environment:
  328. ROUNDCUBEMAIL_DB_TYPE: mysql
  329. ROUNDCUBEMAIL_DB_HOST: maildb
  330. ROUNDCUBEMAIL_DB_NAME: roundcube
  331. ROUNDCUBEMAIL_DB_USER: mailuser
  332. ROUNDCUBEMAIL_DB_PASSWORD: ${MAIL_MYSQL_PASSWORD}
  333. ROUNDCUBEMAIL_DEFAULT_HOST: dovecot
  334. ROUNDCUBEMAIL_SMTP_SERVER: postfix
  335. volumes:
  336. - roundcube_data:/var/www/html
  337. networks:
  338. - mail
  339. - traefik
  340. depends_on:
  341. dovecot:
  342. condition: service_healthy
  343. postfix:
  344. condition: service_healthy
  345. labels:
  346. - "traefik.enable=true"
  347. - "traefik.http.routers.roundcube.rule=Host(`mail.${WAOUW_DOMAIN:-localhost}`) || PathPrefix(`/webmail`)"
  348. - "traefik.http.routers.roundcube.tls.certresolver=letsencrypt"
  349. - "traefik.http.services.roundcube.loadbalancer.server.port=80"
  350. healthcheck:
  351. test: ["CMD", "curl", "-f", "http://localhost:80"]
  352. interval: 30s
  353. timeout: 10s
  354. retries: 3
  355. mailadmin:
  356. image: postfixadmin:apache
  357. container_name: waouw_mailadmin
  358. restart: unless-stopped
  359. environment:
  360. POSTFIXADMIN_DB_TYPE: mysqli
  361. POSTFIXADMIN_DB_HOST: maildb
  362. POSTFIXADMIN_DB_NAME: mailserver
  363. POSTFIXADMIN_DB_USER: mailuser
  364. POSTFIXADMIN_DB_PASSWORD: ${MAIL_MYSQL_PASSWORD}
  365. volumes:
  366. - mailadmin_data:/var/www/html
  367. networks:
  368. - mail
  369. - traefik
  370. depends_on:
  371. maildb:
  372. condition: service_healthy
  373. labels:
  374. - "traefik.enable=true"
  375. - "traefik.http.routers.mailadmin.rule=Host(`mailadmin.${WAOUW_DOMAIN:-localhost}`) || PathPrefix(`/mailadmin`)"
  376. - "traefik.http.routers.mailadmin.tls.certresolver=letsencrypt"
  377. - "traefik.http.services.mailadmin.loadbalancer.server.port=80"
  378. healthcheck:
  379. test: ["CMD", "curl", "-f", "http://localhost:80"]
  380. interval: 30s
  381. timeout: 10s
  382. retries: 3
  383. # ==== CLOUD & STORAGE ====
  384. nextcloud_db:
  385. image: mariadb:10.11
  386. container_name: waouw_nextcloud_db
  387. restart: unless-stopped
  388. environment:
  389. MYSQL_ROOT_PASSWORD: ${NEXTCLOUD_MYSQL_ROOT_PASSWORD}
  390. MYSQL_DATABASE: nextcloud
  391. MYSQL_USER: nextcloud
  392. MYSQL_PASSWORD: ${NEXTCLOUD_MYSQL_PASSWORD}
  393. volumes:
  394. - nextcloud_db_data:/var/lib/mysql
  395. networks:
  396. - nextcloud
  397. healthcheck:
  398. test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
  399. interval: 30s
  400. timeout: 10s
  401. retries: 3
  402. nextcloud:
  403. image: nextcloud:30-apache
  404. container_name: waouw_nextcloud
  405. restart: unless-stopped
  406. environment:
  407. MYSQL_HOST: nextcloud_db
  408. MYSQL_DATABASE: nextcloud
  409. MYSQL_USER: nextcloud
  410. MYSQL_PASSWORD: ${NEXTCLOUD_MYSQL_PASSWORD}
  411. NEXTCLOUD_ADMIN_USER: admin
  412. NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PASSWORD}
  413. NEXTCLOUD_TRUSTED_DOMAINS: ${WAOUW_DOMAIN:-localhost} ${WAOUW_CLOUD_DOMAIN:-cloud.${WAOUW_DOMAIN:-localhost}}
  414. REDIS_HOST: redis
  415. volumes:
  416. - nextcloud_data:/var/www/html
  417. - nextcloud_config:/var/www/html/config
  418. - nextcloud_storage:/var/www/html/data
  419. networks:
  420. - nextcloud
  421. - backend
  422. - traefik
  423. depends_on:
  424. nextcloud_db:
  425. condition: service_healthy
  426. redis:
  427. condition: service_healthy
  428. labels:
  429. - "traefik.enable=true"
  430. - "traefik.http.routers.nextcloud.rule=Host(`${WAOUW_CLOUD_DOMAIN:-cloud.${WAOUW_DOMAIN:-localhost}}`) || PathPrefix(`/nextcloud`)"
  431. - "traefik.http.routers.nextcloud.tls.certresolver=letsencrypt"
  432. - "traefik.http.services.nextcloud.loadbalancer.server.port=80"
  433. - "traefik.http.middlewares.nextcloud.headers.customrequestheaders.X-Forwarded-Proto=https"
  434. - "traefik.http.routers.nextcloud.middlewares=nextcloud"
  435. healthcheck:
  436. test: ["CMD", "curl", "-f", "http://localhost:80/status.php"]
  437. interval: 30s
  438. timeout: 10s
  439. retries: 3
  440. deploy:
  441. resources:
  442. limits:
  443. memory: 512M
  444. cpus: '1.0'
  445. # ==== SYSTEM MANAGEMENT ====
  446. # webmin: désactivé (pas d'image Docker ARM64 fiable)
  447. # Installer webmin directement sur l'hôte si nécessaire :
  448. # curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh && sh setup-repos.sh && apt-get install -y webmin
  449. webmin:
  450. image: alpine:3.19
  451. container_name: waouw_webmin
  452. entrypoint: ["sh", "-c", "echo 'Webmin placeholder - install on host instead' && sleep infinity"]
  453. restart: unless-stopped
  454. networks:
  455. - traefik
  456. labels:
  457. - "traefik.enable=true"
  458. - "traefik.http.routers.webmin.rule=Host(`admin.${WAOUW_DOMAIN:-localhost}`) && PathPrefix(`/webmin`)"
  459. - "traefik.http.routers.webmin.tls.certresolver=letsencrypt"
  460. - "traefik.http.services.webmin.loadbalancer.server.port=10000"
  461. - "traefik.http.services.webmin.loadbalancer.server.scheme=https"
  462. healthcheck:
  463. test: ["CMD", "nc", "-z", "localhost", "10000"]
  464. interval: 30s
  465. timeout: 10s
  466. retries: 3
  467. phpmyadmin:
  468. image: phpmyadmin:latest
  469. container_name: waouw_phpmyadmin
  470. restart: unless-stopped
  471. environment:
  472. PMA_ARBITRARY: 1
  473. PMA_HOSTS: maildb,nextcloud_db
  474. PMA_USER: root
  475. PMA_PASSWORD: ${PHPMYADMIN_PASSWORD}
  476. networks:
  477. - backend
  478. - mail
  479. - nextcloud
  480. - traefik
  481. depends_on:
  482. postgres:
  483. condition: service_healthy
  484. labels:
  485. - "traefik.enable=true"
  486. - "traefik.http.routers.phpmyadmin.rule=Host(`db.${WAOUW_DOMAIN:-localhost}`) || PathPrefix(`/phpmyadmin`)"
  487. - "traefik.http.routers.phpmyadmin.tls.certresolver=letsencrypt"
  488. - "traefik.http.services.phpmyadmin.loadbalancer.server.port=80"
  489. healthcheck:
  490. test: ["CMD", "curl", "-f", "http://localhost:80"]
  491. interval: 30s
  492. timeout: 10s
  493. retries: 3
  494. # ==== SECURITY & VPN ====
  495. fail2ban:
  496. image: crazymax/fail2ban:latest
  497. container_name: waouw_fail2ban
  498. restart: unless-stopped
  499. environment:
  500. TZ: Europe/Paris
  501. F2B_LOG_TARGET: STDOUT
  502. F2B_LOG_LEVEL: INFO
  503. SSMTP_HOST: postfix
  504. SSMTP_PORT: 587
  505. SSMTP_TLS: "YES"
  506. volumes:
  507. - fail2ban_data:/data
  508. - /var/log:/var/log
  509. - ./fail2ban/jail.d:/data/jail.d:ro
  510. - ./fail2ban/filter.d:/data/filter.d:ro
  511. - traefik_logs:/var/log/traefik:ro
  512. networks:
  513. - mail
  514. - traefik
  515. cap_add:
  516. - NET_ADMIN
  517. - NET_RAW
  518. healthcheck:
  519. test: ["CMD", "fail2ban-client", "ping"]
  520. interval: 30s
  521. timeout: 10s
  522. retries: 3
  523. openvpn:
  524. image: lunderhage/openvpn-rpi:latest
  525. container_name: waouw_openvpn
  526. restart: unless-stopped
  527. ports:
  528. - "1194:1194/udp"
  529. volumes:
  530. - openvpn_data:/etc/openvpn
  531. - openvpn_config:/tmp/openvpn
  532. networks:
  533. - vpn
  534. cap_add:
  535. - NET_ADMIN
  536. devices:
  537. - /dev/net/tun
  538. environment:
  539. OVPN_SERVER_URL: udp://${WAOUW_DOMAIN:-waouw.local}:1194
  540. profiles:
  541. - vpn
  542. healthcheck:
  543. test: ["CMD", "nc", "-zu", "localhost", "1194"]
  544. interval: 30s
  545. timeout: 10s
  546. retries: 3
  547. # ==== RELAY TUNNEL (WireGuard client) ====
  548. wg-tunnel:
  549. image: linuxserver/wireguard:latest
  550. container_name: waouw_wg_tunnel
  551. restart: unless-stopped
  552. cap_add:
  553. - NET_ADMIN
  554. - SYS_MODULE
  555. sysctls:
  556. - net.ipv4.conf.all.src_valid_mark=1
  557. volumes:
  558. - wg_tunnel_config:/config
  559. - /lib/modules:/lib/modules:ro
  560. environment:
  561. PUID: 1000
  562. PGID: 1000
  563. TZ: Europe/Paris
  564. networks:
  565. - traefik
  566. profiles:
  567. - relay
  568. healthcheck:
  569. test: ["CMD", "wg", "show", "wg0"]
  570. interval: 30s
  571. timeout: 10s
  572. retries: 3
  573. # ==== BACKUP & SYNC ====
  574. syncthing:
  575. image: syncthing/syncthing:latest
  576. container_name: waouw_syncthing
  577. restart: unless-stopped
  578. hostname: waouw-syncthing
  579. environment:
  580. STNODEFAULTFOLDER: "true"
  581. STGUIADDRESS: "0.0.0.0:8384"
  582. PUID: "1000"
  583. PGID: "1000"
  584. ports:
  585. - "22000:22000/tcp"
  586. - "22000:22000/udp"
  587. volumes:
  588. - syncthing_config:/var/syncthing
  589. - /var/www:/sync/sites:ro
  590. - dovecot_data:/sync/dovecot:ro
  591. - postfix_data:/sync/postfix:ro
  592. - nextcloud_storage:/sync/nextcloud:ro
  593. - /etc/waouw:/sync/waouw-config:ro
  594. - sync_db_dumps:/sync/db-dumps:ro
  595. networks:
  596. - backend
  597. healthcheck:
  598. test: ["CMD", "curl", "-f", "http://localhost:8384/rest/noauth/health"]
  599. interval: 30s
  600. timeout: 10s
  601. retries: 3
  602. deploy:
  603. resources:
  604. limits:
  605. memory: 256M
  606. cpus: '0.5'
  607. # ==== MONITORING & LOGS ====
  608. # Graylog + OpenSearch + MongoDB : désactivés sur Raspberry Pi
  609. # (4-6 Go de RAM requis, OpenSearch incompatible ARM RPi4)
  610. # Réactiver sur serveur x86 avec plus de RAM si nécessaire
  611. prometheus:
  612. image: prom/prometheus:v2.52.0
  613. container_name: waouw_prometheus
  614. volumes:
  615. - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
  616. networks:
  617. - backend
  618. - traefik
  619. labels:
  620. - "traefik.enable=true"
  621. - "traefik.http.routers.prom.rule=Host(`metrics.${WAOUW_DOMAIN:-localhost}`) || PathPrefix(`/prom`)"
  622. - "traefik.http.routers.prom.tls.certresolver=letsencrypt"
  623. - "traefik.http.services.prom.loadbalancer.server.port=9090"
  624. healthcheck:
  625. test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:9090/-/healthy"]
  626. interval: 30s
  627. timeout: 10s
  628. retries: 3
  629. grafana:
  630. image: grafana/grafana:10.4.2
  631. container_name: waouw_grafana
  632. environment:
  633. - GF_SECURITY_ADMIN_USER=admin
  634. - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
  635. networks:
  636. - traefik
  637. - backend
  638. depends_on:
  639. prometheus:
  640. condition: service_healthy
  641. labels:
  642. - "traefik.enable=true"
  643. - "traefik.http.routers.grafana.rule=Host(`dashboard.${WAOUW_DOMAIN:-localhost}`) || PathPrefix(`/dashboard`)"
  644. - "traefik.http.routers.grafana.tls.certresolver=letsencrypt"
  645. - "traefik.http.services.grafana.loadbalancer.server.port=3000"
  646. healthcheck:
  647. test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:3000/api/health"]
  648. interval: 30s
  649. timeout: 10s
  650. retries: 3
  651. volumes:
  652. postgres_data: { name: waouw_postgres_data }
  653. redis_data: { name: waouw_redis_data }
  654. traefik_certificates: { name: waouw_traefik_certificates }
  655. traefik_logs: { name: waouw_traefik_logs }
  656. backend_logs: { name: waouw_backend_logs }
  657. worker_logs: { name: waouw_worker_logs }
  658. mosquitto_data: { name: waouw_mosquitto_data }
  659. mosquitto_logs: { name: waouw_mosquitto_logs }
  660. maildb_data: { name: waouw_maildb_data }
  661. postfix_data: { name: waouw_postfix_data }
  662. postfix_logs: { name: waouw_postfix_logs }
  663. dovecot_data: { name: waouw_dovecot_data }
  664. dovecot_config: { name: waouw_dovecot_config }
  665. mail_storage: { name: waouw_mail_storage }
  666. roundcube_data: { name: waouw_roundcube_data }
  667. mailadmin_data: { name: waouw_mailadmin_data }
  668. nextcloud_db_data: { name: waouw_nextcloud_db_data }
  669. nextcloud_data: { name: waouw_nextcloud_data }
  670. nextcloud_config: { name: waouw_nextcloud_config }
  671. nextcloud_storage: { name: waouw_nextcloud_storage }
  672. wg_tunnel_config: { name: waouw_wg_tunnel_config }
  673. fail2ban_data: { name: waouw_fail2ban_data }
  674. openvpn_data: { name: waouw_openvpn_data }
  675. openvpn_config: { name: waouw_openvpn_config }
  676. syncthing_config: { name: waouw_syncthing_config }
  677. sync_db_dumps: { name: waouw_sync_db_dumps }
  678. backup_data: { name: waouw_backup_data }
  679. # graylog/opensearch/mongo désactivés sur Pi
  680. networks:
  681. traefik: { name: waouw_traefik, driver: bridge }
  682. backend: { name: waouw_backend, driver: bridge, internal: true }
  683. mail: { name: waouw_mail, driver: bridge, internal: true }
  684. nextcloud: { name: waouw_nextcloud, driver: bridge, internal: true }
  685. vpn: { name: waouw_vpn, driver: bridge }