docker-compose.yml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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:/certificates
  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. - --accesslog=true
  52. - --log=true
  53. # Enable the traefik dashboard
  54. - --api=true
  55. - --providers.file.filename=/certificates/static.toml
  56. environment:
  57. - CLOUDFLARE_EMAIL=${CLOUDFLARE_EMAIL}
  58. - CLOUDFLARE_API_KEY=${CLOUDFLARE_API_KEY}
  59. jekyll:
  60. image: jibby0/docker-jekyll-webhook
  61. deploy:
  62. replicas: 2
  63. labels:
  64. - traefik.enable=true
  65. - traefik.http.routers.jekyll.tls=true
  66. - traefik.http.routers.jekyll.rule=Host(`${DOMAIN}`)
  67. - traefik.http.services.jekyll.loadbalancer.server.port=80
  68. environment:
  69. - TZ=America/New_York
  70. - WEBHOOK_SECRET=${WEBHOOK_SECRET}
  71. - REPO=https://github.com/jibby0/blog.git
  72. restart: always
  73. volumes:
  74. - ${CONTAINERS_DIR}/jekyll/vendor_cache:/vendor
  75. postgres:
  76. image: postgres:10.5
  77. volumes:
  78. - ${CONTAINERS_DIR}/postgres/data:/var/lib/postgresql/data
  79. - ${CONTAINERS_DIR}/postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
  80. environment:
  81. - POSTGRES_USER=${POSTGRES_USER}
  82. - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
  83. restart: always
  84. nextcloud:
  85. image: nextcloud:20.0.4
  86. deploy:
  87. labels:
  88. - traefik.enable=true
  89. - traefik.http.routers.nextcloud.tls=true
  90. - traefik.http.routers.nextcloud.rule=Host(`nextcloud.${DOMAIN}`)
  91. - traefik.http.services.nextcloud.loadbalancer.server.port=80
  92. expose:
  93. - "80"
  94. links:
  95. - postgres
  96. volumes:
  97. - ${CONTAINERS_DIR}/nextcloud:/var/www/html
  98. restart: always
  99. gogs:
  100. image: gogs/gogs:0.12.0
  101. deploy:
  102. labels:
  103. - traefik.enable=true
  104. - traefik.http.routers.gogs.tls=true
  105. - traefik.http.routers.gogs.rule=Host(`gogs.${DOMAIN}`)
  106. - traefik.http.services.gogs.loadbalancer.server.port=3000
  107. expose:
  108. - "3000"
  109. volumes:
  110. - ${CONTAINERS_DIR}/gogs:/data
  111. # NOTE: My gogs instance isn't happy with postgres. For now, it's a small server
  112. # and sqlite is fine, but I should fix this eventually.
  113. #links:
  114. # - postgres
  115. restart: always
  116. matrix:
  117. image: matrixdotorg/synapse:v1.25.0
  118. deploy:
  119. labels:
  120. - traefik.enable=true
  121. - traefik.http.routers.matrix.tls=true
  122. - traefik.http.routers.matrix.rule=Host(`matrix.${DOMAIN}`)
  123. - traefik.http.services.matrix.loadbalancer.server.port=8008
  124. expose:
  125. - "8008"
  126. links:
  127. - postgres
  128. # NOTE: These don't directly configure anything anymore.
  129. # They can be used with `migrate_config` to build
  130. # homeserver.yaml
  131. # environment:
  132. # - SYNAPSE_SERVER_NAME=matrix.jibby.org
  133. # - SYNAPSE_REPORT_STATS=no
  134. # - SYNAPSE_NO_TLS=true
  135. # - SYNAPSE_ENABLE_REGISTRATION=no
  136. # - SYNAPSE_LOG_LEVEL=INFO
  137. # - SYNAPSE_REGISTRATION_SHARED_SECRET=${POSTGRES_PASSWORD}
  138. # - POSTGRES_DB=synapse
  139. # - POSTGRES_HOST=postgres
  140. # - POSTGRES_USER=synapse
  141. # - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
  142. volumes:
  143. - ${CONTAINERS_DIR}/matrix:/data
  144. restart: always
  145. selfoss:
  146. image: hardware/selfoss
  147. deploy:
  148. labels:
  149. - traefik.enable=true
  150. - traefik.http.routers.selfoss.tls=true
  151. - traefik.http.routers.selfoss.rule=Host(`selfoss.${DOMAIN}`)
  152. - traefik.http.services.selfoss.loadbalancer.server.port=8888
  153. expose:
  154. - "8888"
  155. links:
  156. - postgres
  157. volumes:
  158. - ${CONTAINERS_DIR}/selfoss:/selfoss/data
  159. environment:
  160. - CRON_PERIOD=5m
  161. restart: always
  162. jellyfin:
  163. # 10.6.4 can't use Chromecasts properly: https://github.com/jellyfin/jellyfin/issues/3852
  164. # The "jellyfixer" service below fixes that for now. Assumes jellyfin's
  165. # baseURL is set to the default of `/jellyfin`
  166. image: jellyfin/jellyfin:10.6.4
  167. deploy:
  168. placement:
  169. constraints:
  170. - node.labels.media-encoding == true
  171. labels:
  172. - traefik.enable=true
  173. - traefik.http.routers.jellyfin.tls=true
  174. - traefik.http.routers.jellyfin.rule=Host(`jellyfin.${DOMAIN}`)
  175. - traefik.http.services.jellyfin.loadbalancer.server.port=8096
  176. expose:
  177. - "8096"
  178. volumes:
  179. - ${CONTAINERS_DIR}/jellyfin:/config
  180. - ${MEDIA_DIR}:/media
  181. #- /dev/shm/jellyfin-transcodes:/transcodes
  182. #- /dev/shm/jellyfin-cache:/cache
  183. restart: always
  184. jellyfixer:
  185. image: quay.io/xsteadfastx/jellyfixer:latest
  186. deploy:
  187. labels:
  188. - traefik.enable=true
  189. - traefik.http.routers.jellyfixer-secured.tls=true
  190. - traefik.http.routers.jellyfixer-secured.rule=Host(`jellyfin.${DOMAIN}`) && Path(`/jellyfin/System/Info/Public`)
  191. - traefik.http.services.jellyfixer-secured.loadbalancer.server.port=8088
  192. command: http://jellyfin:8096/jellyfin
  193. environment:
  194. - JELLYFIXER_INTERNAL_URL=http://jellyfin:8096/jellyfin
  195. - JELLYFIXER_EXTERNAL_URL=https://jellyfin.${DOMAIN}/jellyfin
  196. # An example of a static HTTP file hosting site
  197. #camera:
  198. # image: nginx
  199. # deploy:
  200. # labels:
  201. # - traefik.enable=true
  202. # - traefik.http.routers.camera.tls=true
  203. # - traefik.http.routers.camera.rule=Host(`camera.${DOMAIN}`)
  204. # - traefik.http.services.camera.loadbalancer.server.port=80
  205. # volumes:
  206. # - ${MEDIA_DIR}/Camera:/home/app:ro
  207. # - ./conf.d/static.conf:/etc/nginx/sites-enabled/default
  208. # - ./conf.d/static.conf:/etc/nginx/conf.d/default.conf
  209. # restart: always