chore: docker compose works with published images

This commit is contained in:
geek 2017-06-28 17:11:04 -05:00 committed by Sérgio Ramos
parent 548c7f5f7e
commit da40ee11e8
10 changed files with 112 additions and 82 deletions

View File

@ -6,22 +6,26 @@
# turn this into an HA Consul raft.
#############################################################################
consul:
image: autopilotpattern/consul:latest
image: autopilotpattern/consul:0.7.2-r0.8
command: >
/usr/local/bin/containerpilot
/bin/consul agent -server
-bootstrap-expect 3
-config-dir=/etc/consul
-ui-dir /ui
-bootstrap-expect 1
-config-dir=/etc/consul
-ui-dir /ui
# Change "-bootstrap" to "-bootstrap-expect 3", then scale to 3 or more to
# turn this into an HA Consul raft.
restart: always
mem_limit: 128m
ports:
# As above, this port declaration should not be made for production.
- 8500
labels:
- triton.cns.services=copilot-consul
dns:
- 127.0.0.1
labels:
- triton.cns.services=consul-$CIRCLE_BRANCH
- com.docker.swarm.affinities=["container!=~*"]
env_file: _env
#############################################################################
# PROMETHEUS
@ -31,57 +35,82 @@ consul:
#############################################################################
prometheus:
image: autopilotpattern/prometheus:latest
labels:
# This label sets the CNS name, Triton's automatic DNS
# Learn more at https://docs.joyent.com/public-cloud/network/cns
- triton.cns.services=prometheus
# This label selects the proper Joyent resource package
# https://www.joyent.com/blog/optimizing-docker-on-triton#ram-cpu-and-disk-resources-for-your-containers
- com.joyent.package=g4-highcpu-1G
restart: always
mem_limit: 1g
ports:
# You may not want these port declarations for production. Without them, Prometheus will only
# listen on the private network. This will also result in a public prometheus CNS record being created,
# in the triton.zone domain.
- 9090
labels:
- triton.cns.services=prometheus-$CIRCLE_BRANCH
- com.docker.swarm.affinities=["container!=~*prometheus*"]
#############################################################################
# STYLEGUIDE
#############################################################################
styleguide:
image: quay.io/yldio/joyent-ui-toolkit:$CIRCLE_BRANCH
ports:
- 6060
mem_limit: 512m
labels:
- triton.cns.services=styleguide-$CIRCLE_BRANCH
- com.docker.swarm.affinities=["container!=~*styleguide*"]
env_file: _env
environment:
- CONSUL_AGENT=1
- PORT=6060
dns:
- 127.0.0.1
#############################################################################
# FRONTEND
#############################################################################
cp-frontend:
image: quay.io/yldio/joyent-cp-frontend:$CIRCLE_BRANCH
mem_limit: 512m
labels:
- triton.cns.services=cp-frontend-$CIRCLE_BRANCH
- com.docker.swarm.affinities=["container!=~*cp-frontend*"]
frontend:
image: d0cker/copilot-frontend
environment:
- CONSUL_AGENT=1
- PORT=3069
- REACT_APP_GQL_HOSTNAME=gql-mock-server-$CIRCLE_BRANCH.svc.f4b20699-b323-4452-9091-977895896da6.eu-ams-1.triton.zone
- REACT_APP_GQL_PORT=3000
- PORT=8080
- REACT_APP_GQL_PORT=80
expose:
- 8080
restart: always
traefik:
image: d0cker/traefik
labels:
- triton.cns.services=copilot
ports:
- 3069
- 80
- 8080
restart: always
#############################################################################
# BACKEND
#############################################################################
gql-mock-server:
image: quay.io/yldio/joyent-cp-gql-mock-server:$CIRCLE_BRANCH
mem_limit: 512m
labels:
- triton.cns.services=gql-mock-server-$CIRCLE_BRANCH
- com.docker.swarm.affinities=["container!=~*gql-mock-server*"]
api:
image: d0cker/copilot-api
links:
- rethinkdb:rethinkdb
env_file:
- _env
environment:
- CONSUL_AGENT=1
- PORT=3000
- PORT=8080
- RETHINK_HOST=rethinkdb
expose:
- 8080
restart: always
# Docker-compose wrapper
# Create _env file from running ./setup.sh
composeapi:
image: d0cker/compose-api
expose:
- 4242
env_file:
- _env
restart: always
rethinkdb:
image: rethinkdb
restart: always
mem_limit: 1g
# You may not want these port declarations for production. It
ports:
- 3000
- 8080
expose:
- 28015
- 29015
labels:
- triton.cns.services=copilot-rethinkdb

View File

@ -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 d06e289e6e0ca82156d77cea36ff0f0246fcca60
ENV CONTAINERPILOT_VERSION 3.1.0
ENV CP_SHA1 1f159207c7dc2b622f693754f6dda77c82a88263
ENV CONTAINERPILOT_VERSION 3.1.1
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 \

View File

@ -1,6 +1,6 @@
'use strict';
const Data = require('portal-data');
const Data = require('portal-api/lib/data');
const ifError = function (err) {

View File

@ -19,9 +19,9 @@
"hapi": "^16.1.0",
"hoek": "^4.1.1",
"joi": "^10.6.0",
"joyent-cp-gql-schema": "^1.0.4",
"joyent-cp-gql-schema": "^1.2.0",
"piloted": "^3.1.1",
"portal-api": "^1.1.0",
"portal-api": "^1.2.0",
"toppsy": "^1.1.0"
}
}

View File

@ -11,10 +11,10 @@ RUN export CONSUL_VERSION=0.7.0 \
&& mkdir /config
# Add Containerpilot and set its configuration
ENV CONTAINERPILOT_VERSION 3.1.0
ENV CONTAINERPILOT_VERSION 3.1.1
ENV CONTAINERPILOT /etc/containerpilot.json
RUN export CONTAINERPILOT_CHECKSUM=d06e289e6e0ca82156d77cea36ff0f0246fcca60 \
RUN export CONTAINERPILOT_CHECKSUM=1f159207c7dc2b622f693754f6dda77c82a88263 \
&& export archive=containerpilot-${CONTAINERPILOT_VERSION}.tar.gz \
&& curl -Lso /tmp/${archive} \
"https://github.com/joyent/containerpilot/releases/download/${CONTAINERPILOT_VERSION}/${archive}" \

View File

@ -19,8 +19,8 @@ RUN curl --retry 7 --fail -vo /tmp/consul.zip "https://releases.hashicorp.com/co
&& mkdir /config
# Install ContainerPilot
ENV CP_SHA1 d06e289e6e0ca82156d77cea36ff0f0246fcca60
ENV CONTAINERPILOT_VERSION 3.1.0
ENV CP_SHA1 1f159207c7dc2b622f693754f6dda77c82a88263
ENV CONTAINERPILOT_VERSION 3.1.1
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 \

View File

@ -41,30 +41,6 @@ prometheus:
dns:
- 127.0.0.1
# Docker-compose wrapper
# Create _env file from running ./setup.sh
compose-api:
build: ./docker/compose-api
links:
- consul:consul
expose:
- 4242
env_file:
- _env
environment:
- CONSUL=consul
restart: always
traefik:
image: d0cker/traefik
ports:
- "80:80"
- "8080:8080"
links:
- consul:consul
environment:
- CONSUL=consul
restart: always
#############################################################################
# FRONTEND
@ -83,6 +59,18 @@ frontend:
expose:
- 3069
traefik:
image: d0cker/traefik
ports:
- "80:80"
- "8080:8080"
links:
- consul:consul
environment:
- CONSUL=consul
restart: always
#############################################################################
# BACKEND
#############################################################################
@ -101,9 +89,20 @@ api:
expose:
- 3000
#############################################################################
# DATABASE
#############################################################################
# Docker-compose wrapper
# Create _env file from running ./setup.sh
compose-api:
build: docker/compose-api
links:
- consul:consul
expose:
- 4242
env_file:
- _env
environment:
- CONSUL=consul
restart: always
rethinkdb:
image: rethinkdb
restart: always

View File

@ -1,6 +1,6 @@
{
"name": "joyent-cp-gql-schema",
"version": "1.1.0",
"version": "1.2.0",
"license": "MPL-2.0",
"repository": "github:yldio/joyent-portal",
"main": "index.js",

View File

@ -1,6 +1,6 @@
{
"name": "portal-api",
"version": "1.1.0",
"version": "1.2.0",
"description": "",
"main": "./lib/index.js",
"scripts": {

View File

@ -61,6 +61,7 @@ check() {
TRITON_USER=$(triton profile get | awk -F": " '/account:/{print $2}')
TRITON_DC=$(triton profile get | awk -F"/" '/url:/{print $3}' | awk -F'.' '{print $1}')
TRITON_ACCOUNT=$(triton account get | awk -F": " '/id:/{print $2}')
echo '# docker-compose-client for Triton' > _env
TRITON_CREDS_PATH=/root/.triton
@ -75,6 +76,7 @@ check() {
echo SDC_KEY_ID=${SDC_KEY_ID} >> _env
echo TRITON_USER=${TRITON_USER} >> _env
echo TRITON_DC=${TRITON_DC} >> _env
echo CONSUL=copilot-consul.svc.${TRITON_ACCOUNT}.${TRITON_DC}.cns.joyent.com >> _env
echo TRITON_CA=$(cat "${DOCKER_CERT_PATH}"/ca.pem | tr '\n' '#') >> _env
echo TRITON_CA_PATH=${TRITON_CREDS_PATH}/ca.pem >> _env
echo TRITON_KEY=$(cat "${DOCKER_CERT_PATH}"/key.pem | tr '\n' '#') >> _env