Compose files, instructions and extras for using my automatic proxy containers
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

docker-compose.yml 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. # letsencrypt-lexicon obtains Let's Encrypt certificates by modifying
  64. # DNS records. It supports several major cloud DNS providers.
  65. letsencrypt-lexicon:
  66. image: csmith/letsencrypt-lexicon:latest
  67. container_name: autoproxy_letsencrypt-lexicon
  68. restart: always
  69. volumes:
  70. - letsencrypt-data:/letsencrypt
  71. # letsencrypt-generic uses a user-defined hook to update DNS entries.
  72. # You need to supply your own hook, available at /dns/hook. See the
  73. # letsencrypt.sh repo for details about hook arguments.
  74. #letsencrypt-generic:
  75. # image: csmith/letsencrypt-generic:latest
  76. # container_name: autoproxy_letsencrypt-generic
  77. # restart: always
  78. # volumes:
  79. # - letsencrypt-data:/letsencrypt
  80. # - /my/hook/script:/dns/hook
  81. # service-nginx reads proxy information and vhosts from etcd and
  82. # creates an nginx vhost config to enable SSL-terminated reverse
  83. # proxying to the containers.
  84. nginx-updater:
  85. image: csmith/service-nginx:latest
  86. container_name: autoproxy_nginx-updater
  87. restart: always
  88. volumes:
  89. - nginx-config:/nginx-config
  90. networks:
  91. - etcd-services
  92. depends_on:
  93. - etcd
  94. # Finally, nginx is what actually does the SSL termination and
  95. # reverse proxying. Because it needs to connect to containers
  96. # on (potentially) many different networks, we set the
  97. # network_mode to host.
  98. nginx:
  99. image: nginx:1.11
  100. container_name: autoproxy_nginx
  101. restart: always
  102. volumes:
  103. - nginx-config:/etc/nginx/conf.d
  104. - letsencrypt-data:/letsencrypt
  105. ports:
  106. - 80:80
  107. - 443:443
  108. network_mode: host
  109. # We use this container to monitor for nginx config file and SSL cert changes
  110. # (using inotify) and send nginx a SIGHUP signal.
  111. nginx-config-hupper:
  112. image: pstauffer/inotify:latest
  113. container_name: autoproxy_nginx-config-hupper
  114. restart: always
  115. volumes:
  116. - nginx-config:/monitor/nginx
  117. - letsencrypt-data:/monitor/letsencrypt
  118. - /var/run/docker.sock:/var/run/docker.sock
  119. environment:
  120. - 'CONTAINER=autoproxy_nginx'
  121. - 'VOLUMES=/monitor'
  122. - 'INOTIFY_OPTONS=--monitor --exclude=*.sw[px] --recursive'
  123. volumes:
  124. letsencrypt-data:
  125. nginx-config:
  126. networks:
  127. etcd-services: