1
fundon 2015-05-15 18:49:04 +08:00
docker-compose nginx 代理
|
2
gDD 2015-05-15 18:59:46 +08:00 via iPhone
如果图里的 Proxy 是 Nginx,可以配成接受多个域名,然后每个域名反向代理到各个 Docker 端口,这样就可以避免使用端口,个人认为端口不如域名方便。
|
3
gDD 2015-05-15 19:01:54 +08:00 via iPhone
除了 docker-compose,也可以试试 Ansible,最近一次查过是直接支持 CoreOS 的。
|
4
nabla 2015-05-15 22:18:11 +08:00
直接用kubernetes?
|
5
rrrrutdk 2015-05-19 14:36:07 +08:00 1
redis:
image: redis postgres: image: postgres server1: image: testserver # test server镜像 env_file: # 定制test-server-1运行环境 - "server1.env" # REDIS_HOST=redis POSTGRES_HOST=postgres PROFILE=dev links: - "redis" - "postgres" expose: - "12345" # test server的监听端口 server2: image: testserver env_file: - "server2.env" # REDIS_HOST=redis POSTGRES_HOST=postgres PROFILE=staging links: - "redis" - "postgres" expose: - "123456" server3: image: testserver env_file: - "server3.env" # REDIS_HOST=redis POSTGRES_HOST=postgres PROFILE=production links: - "redis" - "postgres" expose: - "123456" nginx: image: nginx links: - "server1" - "server2" - "server3" ports: - "23456" # 为test server1准备的外部端口 - "13456" - "12456" volumes: # 为每个test server创建一个virtual host - "server1.site:/etc/nginx/sites-enabled/server1" # listen 23456; proxy_pass http://server1:123456; - "server2.site:/etc/nginx/sites-enabled/server2" # listen 13456; proxy_pass http://server2:123456; - "server3.site:/etc/nginx/sites-enabled/server3" # listen 12456; proxy_pass http://server3:123456; 只是写了手动配置这些环境, 实际上可以写个简单脚本接受开发人员提供的env, site配置自动新增docker container并重启nginx |