From 7a1a890f1a525dab2d8e452ef6d31f54b5160dc4 Mon Sep 17 00:00:00 2001 From: geek Date: Mon, 7 Aug 2017 13:32:32 -0500 Subject: [PATCH] feat: triton docker deployment support --- docker/api/Dockerfile | 4 ++-- docker/frontend/etc/nginx.conf.tmpl | 3 ++- triton-compose.yml | 17 ++++++----------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/docker/api/Dockerfile b/docker/api/Dockerfile index c77ab775..bf701b6f 100644 --- a/docker/api/Dockerfile +++ b/docker/api/Dockerfile @@ -17,8 +17,8 @@ RUN curl --retry 7 --fail -vo /tmp/consul.zip "https://releases.hashicorp.com/co && mkdir /config # Install ContainerPilot -ENV CP_SHA1 e27c1b9cd1023e622f77bb19914606dee3c9b22c -ENV CONTAINERPILOT_VERSION 3.3.1 +ENV CP_SHA1 056d45f728e9b9c61793d6f994da291d5eebeabd +ENV CONTAINERPILOT_VERSION 3.3.2 RUN curl -Lo /tmp/containerpilot.tar.gz "https://github.com/joyent/containerpilot/releases/download/${CONTAINERPILOT_VERSION}/containerpilot-${CONTAINERPILOT_VERSION}.tar.gz" \ && echo "${CP_SHA1} /tmp/containerpilot.tar.gz" | sha1sum -c \ && tar zxf /tmp/containerpilot.tar.gz -C /bin \ diff --git a/docker/frontend/etc/nginx.conf.tmpl b/docker/frontend/etc/nginx.conf.tmpl index e0a2e475..1d6bb333 100644 --- a/docker/frontend/etc/nginx.conf.tmpl +++ b/docker/frontend/etc/nginx.conf.tmpl @@ -58,6 +58,7 @@ http { location / { try_files $uri /index.html; } + {{ if service "api" }} location /api { rewrite /api/(.*) /$1 break; proxy_pass http://api_hosts; @@ -65,7 +66,7 @@ http { proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Client-Dn $ssl_client_s_dn; - } + }{{ end }} } # Includes mapping of file name extensions to MIME types of responses diff --git a/triton-compose.yml b/triton-compose.yml index e07d46b3..d44293bd 100644 --- a/triton-compose.yml +++ b/triton-compose.yml @@ -20,8 +20,6 @@ consul: - triton.cns.services=copilot-consul ports: - 8500:8500 - dns: - - 127.0.0.1 ############################################################################# # PROMETHEUS @@ -44,8 +42,8 @@ prometheus: - com.joyent.package=g4-highcpu-1G environment: - CONSUL_AGENT=1 - dns: - - 127.0.0.1 + env_file: + - _env ############################################################################# @@ -54,6 +52,8 @@ prometheus: frontend: image: joyent/copilot-frontend mem_limit: 512m + labels: + - triton.cns.services=copilot env_file: - _env environment: @@ -61,8 +61,6 @@ frontend: ports: - "80:80" - "443:443" - dns: - - 127.0.0.1 ############################################################################# @@ -70,7 +68,7 @@ frontend: ############################################################################# api: image: joyent/copilot-api - mem_limit: 512m + mem_limit: 1g links: - rethinkdb:rethinkdb env_file: @@ -95,10 +93,7 @@ rethinkdb: image: rethinkdb restart: always mem_limit: 1g - labels: - - triton.cns.services=copilot-rethinkdb - ports: - - 8080:8080 expose: - 28015 - 29015 + - 8080