docker-compose.yml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. version: '3'
  2. # Environment variables are replaced with definitions in .env, when run with:
  3. #
  4. # env $(cat .env | grep ^[A-Z] | xargs) docker stack deploy --compose-file docker-compose.yml server
  5. networks:
  6. default:
  7. driver: overlay
  8. services:
  9. traefik:
  10. image: traefik:v2.2
  11. ports:
  12. - 80:80
  13. - 443:443
  14. deploy:
  15. #replicas: 2 # https://youtu.be/btHpHjabRcc
  16. placement:
  17. constraints:
  18. - node.role == manager
  19. labels:
  20. - traefik.enable=true
  21. # Enable the dashboard UI
  22. - traefik.http.routers.api.rule=Host(`board.${DOMAIN}`)
  23. - traefik.http.routers.api.service=api@internal
  24. - traefik.http.routers.api.middlewares=auth
  25. - traefik.http.routers.api.tls=true
  26. - "traefik.http.middlewares.auth.basicauth.users=${TRAEFIK_API_USERS}"
  27. # Dummy service for Swarm port detection. The port can be any valid integer value.
  28. - traefik.http.services.dummy-svc.loadbalancer.server.port=9999
  29. - traefik.http.routers.traefik.tls=true
  30. # Use LS to get/renew certs for the TLD & subdomains
  31. - traefik.http.routers.traefik.tls.certresolver=le
  32. - traefik.http.routers.traefik.tls.domains[0].main=${DOMAIN}
  33. - traefik.http.routers.traefik.tls.domains[1].sans=*.${DOMAIN}
  34. volumes:
  35. - /var/run/docker.sock:/var/run/docker.sock:ro
  36. - ${CONTAINERS_DIR}/traefik/static.toml:/certificates/static.toml
  37. command:
  38. # Require a "traefik.enable=true" label
  39. - --providers.docker.exposedbydefault=false
  40. - --providers.docker.swarmmode=true
  41. # HTTP redirects to HTTPS
  42. - --entrypoints.web.address=:80
  43. - --entrypoints.web.http.redirections.entrypoint.permanent=false
  44. - --entrypoints.web.http.redirections.entryPoint.to=websecure
  45. - --entrypoints.web.http.redirections.entryPoint.scheme=https
  46. - --entrypoints.websecure.address=:443
  47. # Auto cert renewal via cloudflare
  48. - --certificatesresolvers.le.acme.email=${LETSENCRYPT_EMAIL}
  49. - --certificatesresolvers.le.acme.storage=/certificates/acme.json
  50. - --certificatesresolvers.le.acme.dnschallenge.provider=cloudflare
  51. - --certificatesresolvers.le.acme.dnschallenge.resolvers=1.1.1.1:53,8.8.8.8:53
  52. # Uncomment for testing
  53. #- --certificatesresolvers.le.acme.caServer=https://acme-staging-v02.api.letsencrypt.org/directory
  54. - --accesslog=true
  55. - --log=true
  56. # Enable the traefik dashboard
  57. - --api=true
  58. - --providers.file.filename=/certificates/static.toml
  59. environment:
  60. - CLOUDFLARE_EMAIL=${CLOUDFLARE_EMAIL}
  61. - CLOUDFLARE_API_KEY=${CLOUDFLARE_API_KEY}
  62. jekyll:
  63. image: jibby0/docker-jekyll-webhook
  64. deploy:
  65. replicas: 2
  66. labels:
  67. - traefik.enable=true
  68. - traefik.http.routers.jekyll.tls=true
  69. - traefik.http.routers.jekyll.rule=Host(`${DOMAIN}`)
  70. - traefik.http.services.jekyll.loadbalancer.server.port=80
  71. environment:
  72. - TZ=America/New_York
  73. - WEBHOOK_SECRET=${WEBHOOK_SECRET}
  74. - REPO=https://github.com/jibby0/blog.git
  75. restart: always
  76. volumes:
  77. - ${CONTAINERS_DIR}/jekyll/vendor_cache:/vendor
  78. postgres:
  79. image: postgres:10.5
  80. volumes:
  81. - ${CONTAINERS_DIR}/postgres/data:/var/lib/postgresql/data
  82. - ${CONTAINERS_DIR}/postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
  83. environment:
  84. - POSTGRES_USER=${POSTGRES_USER}
  85. - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
  86. restart: always
  87. nextcloud:
  88. image: nextcloud:20.0.4
  89. deploy:
  90. labels:
  91. - traefik.enable=true
  92. - traefik.http.routers.nextcloud.tls=true
  93. - traefik.http.routers.nextcloud.rule=Host(`nextcloud.${DOMAIN}`)
  94. - traefik.http.services.nextcloud.loadbalancer.server.port=80
  95. expose:
  96. - "80"
  97. links:
  98. - postgres
  99. volumes:
  100. - ${CONTAINERS_DIR}/nextcloud:/var/www/html
  101. restart: always
  102. gogs:
  103. image: gogs/gogs:0.12.0
  104. deploy:
  105. labels:
  106. - traefik.enable=true
  107. - traefik.http.routers.gogs.tls=true
  108. - traefik.http.routers.gogs.rule=Host(`gogs.${DOMAIN}`)
  109. - traefik.http.services.gogs.loadbalancer.server.port=3000
  110. expose:
  111. - "3000"
  112. volumes:
  113. - ${CONTAINERS_DIR}/gogs:/data
  114. # NOTE: My gogs instance isn't happy with postgres. For now, it's a small server
  115. # and sqlite is fine, but I should fix this eventually.
  116. #links:
  117. # - postgres
  118. restart: always
  119. matrix:
  120. image: matrixdotorg/synapse:v1.25.0
  121. deploy:
  122. labels:
  123. - traefik.enable=true
  124. - traefik.http.routers.matrix.tls=true
  125. - traefik.http.routers.matrix.rule=Host(`matrix.${DOMAIN}`)
  126. - traefik.http.services.matrix.loadbalancer.server.port=8008
  127. expose:
  128. - "8008"
  129. links:
  130. - postgres
  131. # NOTE: These don't directly configure anything anymore.
  132. # They can be used with `migrate_config` to build
  133. # homeserver.yaml
  134. # environment:
  135. # - SYNAPSE_SERVER_NAME=matrix.${DOMAIN}
  136. # - SYNAPSE_REPORT_STATS=no
  137. # - SYNAPSE_NO_TLS=true
  138. # - SYNAPSE_ENABLE_REGISTRATION=no
  139. # - SYNAPSE_LOG_LEVEL=INFO
  140. # - SYNAPSE_REGISTRATION_SHARED_SECRET=${POSTGRES_PASSWORD}
  141. # - POSTGRES_DB=synapse
  142. # - POSTGRES_HOST=postgres
  143. # - POSTGRES_USER=synapse
  144. # - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
  145. volumes:
  146. - ${CONTAINERS_DIR}/matrix:/data
  147. restart: always
  148. selfoss:
  149. image: hardware/selfoss
  150. deploy:
  151. labels:
  152. - traefik.enable=true
  153. - traefik.http.routers.selfoss.tls=true
  154. - traefik.http.routers.selfoss.rule=Host(`selfoss.${DOMAIN}`)
  155. - traefik.http.services.selfoss.loadbalancer.server.port=8888
  156. expose:
  157. - "8888"
  158. links:
  159. - postgres
  160. volumes:
  161. - ${CONTAINERS_DIR}/selfoss:/selfoss/data
  162. environment:
  163. - CRON_PERIOD=5m
  164. restart: always
  165. jellyfin:
  166. # 10.6.4 can't use Chromecasts properly: https://github.com/jellyfin/jellyfin/issues/3852
  167. # The "jellyfixer" service below fixes that for now. Assumes jellyfin's
  168. # baseURL is set to the default of `/jellyfin`
  169. image: jellyfin/jellyfin:10.6.4
  170. deploy:
  171. placement:
  172. constraints:
  173. - node.labels.media-encoding == true
  174. labels:
  175. - traefik.enable=true
  176. - traefik.http.routers.jellyfin.tls=true
  177. - traefik.http.routers.jellyfin.rule=Host(`jellyfin.${DOMAIN}`)
  178. - traefik.http.services.jellyfin.loadbalancer.server.port=8096
  179. expose:
  180. - "8096"
  181. volumes:
  182. - ${CONTAINERS_DIR}/jellyfin:/config
  183. - ${MEDIA_DIR}:/media
  184. restart: always
  185. jellyfixer:
  186. image: quay.io/xsteadfastx/jellyfixer:latest
  187. deploy:
  188. labels:
  189. - traefik.enable=true
  190. - traefik.http.routers.jellyfixer-secured.tls=true
  191. - traefik.http.routers.jellyfixer-secured.rule=Host(`jellyfin.${DOMAIN}`) && Path(`/jellyfin/System/Info/Public`)
  192. - traefik.http.services.jellyfixer-secured.loadbalancer.server.port=8088
  193. command: http://jellyfin:8096/jellyfin
  194. environment:
  195. - JELLYFIXER_INTERNAL_URL=http://jellyfin:8096/jellyfin
  196. - JELLYFIXER_EXTERNAL_URL=https://jellyfin.${DOMAIN}/jellyfin