Compose files, instructions and extras for using my automatic proxy containers
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

docker-compose.yml 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. ---
  2. # Sets up a series of containers to automatically provision SSL certificates
  3. # and configure nginx for reverse proxying. Containers that should be proxied
  4. # need to be labelled with the following:
  5. #
  6. # com.chameth.vhost="main.domain.com,alternate.domain.com,alt2.com,..."
  7. # com.chameth.proxy=80
  8. # com.chameth.proxy.protocol=http [optional, defaults to http]
  9. #
  10. # To prove ownership of domains to Let's Encrypt, we add a DNS entry when
  11. # required. This requires you to provide authentication details (e-mail
  12. # address, API key, password, etc). These should be specified in a
  13. # docker-compose.override.yml file.
  14. version: '2'
  15. services:
  16. # etcd is a key-value server. We use it to store meta-data about docker
  17. # containers which is then read by the service containers below.
  18. #
  19. # etcd can be distributed and accessed remotely, but this config is for
  20. # a single node instance.
  21. etcd:
  22. image: quay.io/coreos/etcd:v2.3.3
  23. container_name: autoproxy_etcd
  24. restart: always
  25. command: >-
  26. --name etcd0
  27. --initial-cluster etcd0=http://127.0.0.1:2380
  28. --initial-advertise-peer-urls http://127.0.0.1:2380
  29. --initial-cluster-state new
  30. --initial-cluster-token etcd-cluster-1
  31. --bind-addr 0.0.0.0:2379
  32. networks:
  33. - etcd-services
  34. # service-reporter interacts with docker (which is why it needs the
  35. # docker.sock mounted) to get a list of current containers, and
  36. # monitor when containers are added or removed. It keeps the information
  37. # in etcd up-to-date.
  38. reporter:
  39. image: csmith/service-reporter:latest
  40. container_name: autoproxy_reporter
  41. restart: always
  42. links:
  43. - etcd:etcd
  44. volumes:
  45. - /var/run/docker.sock:/var/run/docker.sock
  46. networks:
  47. - etcd-services
  48. depends_on:
  49. - etcd
  50. # service-letsencrypt reads a list of vhosts from container labels
  51. # (via etcd), and prepares a domains.txt file to send on to one of
  52. # the letsencrypt-* containers below.
  53. letsencrypt-updater:
  54. image: csmith/service-letsencrypt:latest
  55. container_name: autoproxy_letsencrypt-updater
  56. restart: always
  57. volumes:
  58. - letsencrypt-data:/letsencrypt
  59. networks:
  60. - etcd-services
  61. depends_on:
  62. - etcd
  63. # service-nginx reads proxy information and vhosts from etcd and
  64. # creates an nginx vhost config to enable SSL-terminated reverse
  65. # proxying to the containers.
  66. nginx-updater:
  67. image: csmith/service-nginx:latest
  68. container_name: autoproxy_nginx-updater
  69. restart: always
  70. volumes:
  71. - nginx-config:/nginx-config
  72. - letsencrypt-data:/letsencrypt
  73. networks:
  74. - etcd-services
  75. depends_on:
  76. - etcd
  77. # Finally, nginx is what actually does the SSL termination and
  78. # reverse proxying. Because it needs to connect to containers
  79. # on (potentially) many different networks, we set the
  80. # network_mode to host.
  81. nginx:
  82. image: nginx:1.13
  83. container_name: autoproxy_nginx
  84. restart: always
  85. volumes:
  86. - nginx-config:/etc/nginx/conf.d
  87. - letsencrypt-data:/letsencrypt
  88. ports:
  89. - 80:80
  90. - 443:443
  91. network_mode: host
  92. # We use this container to monitor for nginx config file and SSL cert changes
  93. # (using inotify) and send nginx a SIGHUP signal.
  94. nginx-config-hupper:
  95. image: pstauffer/inotify:latest
  96. container_name: autoproxy_nginx-config-hupper
  97. restart: always
  98. volumes:
  99. - nginx-config:/monitor/nginx
  100. - letsencrypt-data:/monitor/letsencrypt
  101. - /var/run/docker.sock:/var/run/docker.sock
  102. environment:
  103. - 'CONTAINER=autoproxy_nginx'
  104. - 'VOLUMES=/monitor'
  105. - 'INOTIFY_OPTONS=--monitor --exclude=*.sw[px] --recursive'
  106. volumes:
  107. letsencrypt-data:
  108. nginx-config:
  109. networks:
  110. etcd-services: