Compose files, instructions and extras for using my automatic proxy containers
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.

docker-compose.yml 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. You will need to configure one of the letsencrypt-* services
  12. # below to make these changes.
  13. version: '2'
  14. services:
  15. # etcd is a key-value server. We use it to store meta-data about docker
  16. # containers which is then read by the service containers below.
  17. #
  18. # etcd can be distributed and accessed remotely, but this config is for
  19. # a single node instance.
  20. etcd:
  21. image: quay.io/coreos/etcd:v2.3.3
  22. command: >-
  23. --name etcd0
  24. --initial-cluster etcd0=http://127.0.0.1:2380
  25. --initial-advertise-peer-urls http://127.0.0.1:2380
  26. --initial-cluster-state new
  27. --initial-cluster-token etcd-cluster-1
  28. --bind-addr 0.0.0.0:2379
  29. networks:
  30. - etcd-services
  31. # service-reporter interacts with docker (which is why it needs the
  32. # docker.sock mounted) to get a list of current containers, and
  33. # monitor when containers are added or removed. It keeps the information
  34. # in etcd up-to-date.
  35. reporter:
  36. image: csmith/service-reporter:latest
  37. links:
  38. - etcd:etcd
  39. volumes:
  40. - /var/run/docker.sock:/var/run/docker.sock
  41. networks:
  42. - etcd-services
  43. depends_on:
  44. - etcd
  45. # service-letsencrypt reads a list of vhosts from container labels
  46. # (via etcd), and prepares a domains.txt file to send on to one of
  47. # the letsencrypt-* containers below.
  48. letsencrypt-updater:
  49. image: csmith/service-letsencrypt:latest
  50. volumes:
  51. - letsencrypt-data:/letsencrypt
  52. networks:
  53. - etcd-services
  54. depends_on:
  55. - etcd
  56. # letsencrypt-lexicon obtains Let's Encrypt certificates by modifying
  57. # DNS records. It supports several major cloud DNS providers. You
  58. # need to set the provider and auth tokens below.
  59. letsencrypt-lexicon:
  60. image: csmith/letsencrypt-lexicon:latest
  61. volumes:
  62. - letsencrypt-data:/letsencrypt
  63. environment:
  64. - STAGING=yes
  65. - EMAIL=your@email.addr
  66. - PROVIDER=cloudflare
  67. - LEXICON_CLOUDFLARE_USERNAME=your@email.addr
  68. - LEXICON_CLOUDFLARE_TOKEN=1234567890123456789012345678901234567890
  69. # letsencrypt-generic uses a user-defined hook to update DNS entries.
  70. # You need to supply your own hook, available at /dns/hook. See the
  71. # letsencrypt.sh repo for details about hook arguments.
  72. #letsencrypt-generic:
  73. # image: csmith/letsencrypt-generic:latest
  74. # volumes:
  75. # - letsencrypt-data:/letsencrypt
  76. # - /my/hook/script:/dns/hook
  77. # environment:
  78. # - STAGING=yes
  79. # - EMAIL=your@email.addr
  80. # service-nginx reads proxy information and vhosts from etcd and
  81. # creates an nginx vhost config to enable SSL-terminated reverse
  82. # proxying to the containers.
  83. nginx-updater:
  84. image: csmith/service-nginx:latest
  85. volumes:
  86. - nginx-config:/nginx-config
  87. networks:
  88. - etcd-services
  89. depends_on:
  90. - etcd
  91. # Finally, nginx is what actually does the SSL termination and
  92. # reverse proxying. If any containers to be proxied are on
  93. # non-default networks, you'll need to specify them here and
  94. # below in the top-level networks section.
  95. #
  96. # TODO: Automatically reload config when changed
  97. # TODO: Redirect HTTP and add proper SSL options
  98. nginx:
  99. image: nginx:1.9
  100. volumes:
  101. - nginx-config:/etc/nginx/conf.d
  102. - letsencrypt-data:/letsencrypt
  103. ports:
  104. - 80:80
  105. - 443:443
  106. networks:
  107. - default
  108. # - mynetwork
  109. volumes:
  110. letsencrypt-data:
  111. nginx-config:
  112. networks:
  113. etcd-services:
  114. # To add pre-existing networks, mark them as 'external':
  115. #mynetwork:
  116. # external: true