Docker-compose self-hosted cloud services.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
2.9 KiB

  1. version: "3"
  2. # This Docker cluster spins up the following containers:
  3. #
  4. # - My web blog for Kirsle.net (which is a custom Go program)
  5. # - Redis as a cache for the blog to use.
  6. # - Gitea, a self-hosted Git server.
  7. # - PostgreSQL as the database for Gitea.
  8. # - nginx, a reverse web proxy that makes all of these services available.
  9. #
  10. # The services are mounted at my test domains in nginx:
  11. #
  12. # - https://blog.kirsle.lh for the web blog
  13. # - https://git.kirsle.lh for Gitea
  14. #
  15. # Exported ports:
  16. # - 444 (nginx SSL port 443)
  17. # - 22 (gitea-ssh)
  18. # Define named networks to isolate the apps from each other. Each app will
  19. # list the networks it needs to share with others.
  20. networks:
  21. default:
  22. driver: bridge
  23. gitea:
  24. driver: bridge
  25. nextcloud:
  26. driver: bridge
  27. # Named volumes to let the apps store their own data persistently on disk
  28. # between reboots. They end up somewhere at /var/lib/docker/volumes on the
  29. # host filesystem, useful for self-contained apps.
  30. volumes:
  31. gitea-db-data:
  32. driver: local
  33. gitea-data:
  34. driver: local
  35. nextcloud-db:
  36. driver: local
  37. nextcloud-data:
  38. driver: local
  39. services:
  40. # nginx reverse proxy in front of all the apps
  41. nginx:
  42. image: nginx
  43. restart: always
  44. ports:
  45. - "444:443" # SSL port, my router won't forward 443 inbound =(
  46. volumes:
  47. - "./nginx/sites-enabled:/etc/nginx/sites-enabled:z"
  48. - "./nginx/nginx.conf:/etc/nginx/nginx.conf:z"
  49. - "./nginx/ssl_params:/etc/nginx/ssl_params:z"
  50. - "./nginx/dhparam.pem:/etc/nginx/dhparam.pem:z"
  51. - "./ssl/snakeoil.key:/etc/nginx/certs/privkey.pem:z"
  52. - "./ssl/snakeoil.pem:/etc/nginx/certs/fullchain.pem:z"
  53. - "./nginx/default-www:/var/www/html:z"
  54. networks:
  55. - default
  56. - gitea
  57. links:
  58. - gitea
  59. - nextcloud
  60. # Postgres DB for gitea.
  61. gitea-postgres:
  62. image: postgres:11.5
  63. restart: always
  64. environment:
  65. - "POSTGRES_USER=gitea"
  66. - "POSTGRES_PASSWORD=gitea"
  67. - "POSTGRES_DB=gitea"
  68. volumes:
  69. - "gitea-db-data:/var/lib/postgresql/data"
  70. networks:
  71. - gitea
  72. # Gitea git server.
  73. gitea:
  74. image: gitea/gitea:latest
  75. hostname: gitea
  76. restart: always
  77. volumes:
  78. - "gitea-data:/data"
  79. expose:
  80. - 3000
  81. ports:
  82. - "22:22"
  83. networks:
  84. - gitea
  85. environment:
  86. - DISABLE_REGISTRATION=true
  87. depends_on:
  88. - gitea-postgres
  89. # MariaDB for Nextcloud.
  90. nextcloud-db:
  91. image: mariadb
  92. networks:
  93. - nextcloud
  94. volumes:
  95. - "nextcloud-db:/var/lib/mysql"
  96. - /etc/localtime:/etc/localtime:ro
  97. environment:
  98. - MYSQL_ROOT_PASSWORD=ncrootpw
  99. - MYSQL_PASSWORD=mysql
  100. - MYSQL_DATABASE=nextcloud
  101. - MYSQL_USER=nextcloud
  102. restart: unless-stopped
  103. # Nextcloud
  104. nextcloud:
  105. image: nextcloud:fpm
  106. hostname: nextcloud
  107. networks:
  108. - nextcloud
  109. depends_on:
  110. - nextcloud-db
  111. volumes:
  112. - "nextcloud-data:/var/www/html"
  113. restart: unless-stopped