mirror of
https://github.com/yldio/copilot.git
synced 2024-11-14 15:20:06 +02:00
chore: docker compose works with published images
This commit is contained in:
parent
548c7f5f7e
commit
da40ee11e8
@ -6,22 +6,26 @@
|
|||||||
# turn this into an HA Consul raft.
|
# turn this into an HA Consul raft.
|
||||||
#############################################################################
|
#############################################################################
|
||||||
consul:
|
consul:
|
||||||
image: autopilotpattern/consul:latest
|
image: autopilotpattern/consul:0.7.2-r0.8
|
||||||
command: >
|
command: >
|
||||||
/usr/local/bin/containerpilot
|
/usr/local/bin/containerpilot
|
||||||
/bin/consul agent -server
|
/bin/consul agent -server
|
||||||
-bootstrap-expect 3
|
-bootstrap-expect 1
|
||||||
-config-dir=/etc/consul
|
-config-dir=/etc/consul
|
||||||
-ui-dir /ui
|
-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
|
restart: always
|
||||||
mem_limit: 128m
|
mem_limit: 128m
|
||||||
ports:
|
ports:
|
||||||
|
# As above, this port declaration should not be made for production.
|
||||||
- 8500
|
- 8500
|
||||||
|
labels:
|
||||||
|
- triton.cns.services=copilot-consul
|
||||||
dns:
|
dns:
|
||||||
- 127.0.0.1
|
- 127.0.0.1
|
||||||
labels:
|
env_file: _env
|
||||||
- triton.cns.services=consul-$CIRCLE_BRANCH
|
|
||||||
- com.docker.swarm.affinities=["container!=~*"]
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# PROMETHEUS
|
# PROMETHEUS
|
||||||
@ -31,57 +35,82 @@ consul:
|
|||||||
#############################################################################
|
#############################################################################
|
||||||
prometheus:
|
prometheus:
|
||||||
image: autopilotpattern/prometheus:latest
|
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
|
restart: always
|
||||||
mem_limit: 1g
|
|
||||||
ports:
|
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
|
- 9090
|
||||||
labels:
|
env_file: _env
|
||||||
- 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*"]
|
|
||||||
environment:
|
environment:
|
||||||
- CONSUL_AGENT=1
|
- CONSUL_AGENT=1
|
||||||
- PORT=6060
|
dns:
|
||||||
|
- 127.0.0.1
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# FRONTEND
|
# FRONTEND
|
||||||
#############################################################################
|
#############################################################################
|
||||||
cp-frontend:
|
frontend:
|
||||||
image: quay.io/yldio/joyent-cp-frontend:$CIRCLE_BRANCH
|
image: d0cker/copilot-frontend
|
||||||
mem_limit: 512m
|
|
||||||
labels:
|
|
||||||
- triton.cns.services=cp-frontend-$CIRCLE_BRANCH
|
|
||||||
- com.docker.swarm.affinities=["container!=~*cp-frontend*"]
|
|
||||||
environment:
|
environment:
|
||||||
- CONSUL_AGENT=1
|
- PORT=8080
|
||||||
- PORT=3069
|
- REACT_APP_GQL_PORT=80
|
||||||
- REACT_APP_GQL_HOSTNAME=gql-mock-server-$CIRCLE_BRANCH.svc.f4b20699-b323-4452-9091-977895896da6.eu-ams-1.triton.zone
|
expose:
|
||||||
- REACT_APP_GQL_PORT=3000
|
- 8080
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
traefik:
|
||||||
|
image: d0cker/traefik
|
||||||
|
labels:
|
||||||
|
- triton.cns.services=copilot
|
||||||
ports:
|
ports:
|
||||||
- 3069
|
- 80
|
||||||
|
- 8080
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# BACKEND
|
# BACKEND
|
||||||
#############################################################################
|
#############################################################################
|
||||||
gql-mock-server:
|
api:
|
||||||
image: quay.io/yldio/joyent-cp-gql-mock-server:$CIRCLE_BRANCH
|
image: d0cker/copilot-api
|
||||||
mem_limit: 512m
|
links:
|
||||||
labels:
|
- rethinkdb:rethinkdb
|
||||||
- triton.cns.services=gql-mock-server-$CIRCLE_BRANCH
|
env_file:
|
||||||
- com.docker.swarm.affinities=["container!=~*gql-mock-server*"]
|
- _env
|
||||||
environment:
|
environment:
|
||||||
- CONSUL_AGENT=1
|
- PORT=8080
|
||||||
- PORT=3000
|
- 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:
|
ports:
|
||||||
- 3000
|
- 8080
|
||||||
|
expose:
|
||||||
|
- 28015
|
||||||
|
- 29015
|
||||||
|
labels:
|
||||||
|
- triton.cns.services=copilot-rethinkdb
|
||||||
|
@ -17,8 +17,8 @@ RUN curl --retry 7 --fail -vo /tmp/consul.zip "https://releases.hashicorp.com/co
|
|||||||
&& mkdir /config
|
&& mkdir /config
|
||||||
|
|
||||||
# Install ContainerPilot
|
# Install ContainerPilot
|
||||||
ENV CP_SHA1 d06e289e6e0ca82156d77cea36ff0f0246fcca60
|
ENV CP_SHA1 1f159207c7dc2b622f693754f6dda77c82a88263
|
||||||
ENV CONTAINERPILOT_VERSION 3.1.0
|
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" \
|
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 \
|
&& echo "${CP_SHA1} /tmp/containerpilot.tar.gz" | sha1sum -c \
|
||||||
&& tar zxf /tmp/containerpilot.tar.gz -C /bin \
|
&& tar zxf /tmp/containerpilot.tar.gz -C /bin \
|
||||||
|
2
docker/api/bootstrap-data.js
vendored
2
docker/api/bootstrap-data.js
vendored
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Data = require('portal-data');
|
const Data = require('portal-api/lib/data');
|
||||||
|
|
||||||
|
|
||||||
const ifError = function (err) {
|
const ifError = function (err) {
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
"hapi": "^16.1.0",
|
"hapi": "^16.1.0",
|
||||||
"hoek": "^4.1.1",
|
"hoek": "^4.1.1",
|
||||||
"joi": "^10.6.0",
|
"joi": "^10.6.0",
|
||||||
"joyent-cp-gql-schema": "^1.0.4",
|
"joyent-cp-gql-schema": "^1.2.0",
|
||||||
"piloted": "^3.1.1",
|
"piloted": "^3.1.1",
|
||||||
"portal-api": "^1.1.0",
|
"portal-api": "^1.2.0",
|
||||||
"toppsy": "^1.1.0"
|
"toppsy": "^1.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,10 @@ RUN export CONSUL_VERSION=0.7.0 \
|
|||||||
&& mkdir /config
|
&& mkdir /config
|
||||||
|
|
||||||
# Add Containerpilot and set its configuration
|
# Add Containerpilot and set its configuration
|
||||||
ENV CONTAINERPILOT_VERSION 3.1.0
|
ENV CONTAINERPILOT_VERSION 3.1.1
|
||||||
ENV CONTAINERPILOT /etc/containerpilot.json
|
ENV CONTAINERPILOT /etc/containerpilot.json
|
||||||
|
|
||||||
RUN export CONTAINERPILOT_CHECKSUM=d06e289e6e0ca82156d77cea36ff0f0246fcca60 \
|
RUN export CONTAINERPILOT_CHECKSUM=1f159207c7dc2b622f693754f6dda77c82a88263 \
|
||||||
&& export archive=containerpilot-${CONTAINERPILOT_VERSION}.tar.gz \
|
&& export archive=containerpilot-${CONTAINERPILOT_VERSION}.tar.gz \
|
||||||
&& curl -Lso /tmp/${archive} \
|
&& curl -Lso /tmp/${archive} \
|
||||||
"https://github.com/joyent/containerpilot/releases/download/${CONTAINERPILOT_VERSION}/${archive}" \
|
"https://github.com/joyent/containerpilot/releases/download/${CONTAINERPILOT_VERSION}/${archive}" \
|
||||||
|
@ -19,8 +19,8 @@ RUN curl --retry 7 --fail -vo /tmp/consul.zip "https://releases.hashicorp.com/co
|
|||||||
&& mkdir /config
|
&& mkdir /config
|
||||||
|
|
||||||
# Install ContainerPilot
|
# Install ContainerPilot
|
||||||
ENV CP_SHA1 d06e289e6e0ca82156d77cea36ff0f0246fcca60
|
ENV CP_SHA1 1f159207c7dc2b622f693754f6dda77c82a88263
|
||||||
ENV CONTAINERPILOT_VERSION 3.1.0
|
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" \
|
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 \
|
&& echo "${CP_SHA1} /tmp/containerpilot.tar.gz" | sha1sum -c \
|
||||||
&& tar zxf /tmp/containerpilot.tar.gz -C /bin \
|
&& tar zxf /tmp/containerpilot.tar.gz -C /bin \
|
||||||
|
@ -41,30 +41,6 @@ prometheus:
|
|||||||
dns:
|
dns:
|
||||||
- 127.0.0.1
|
- 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
|
# FRONTEND
|
||||||
@ -83,6 +59,18 @@ frontend:
|
|||||||
expose:
|
expose:
|
||||||
- 3069
|
- 3069
|
||||||
|
|
||||||
|
traefik:
|
||||||
|
image: d0cker/traefik
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
- "8080:8080"
|
||||||
|
links:
|
||||||
|
- consul:consul
|
||||||
|
environment:
|
||||||
|
- CONSUL=consul
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# BACKEND
|
# BACKEND
|
||||||
#############################################################################
|
#############################################################################
|
||||||
@ -101,9 +89,20 @@ api:
|
|||||||
expose:
|
expose:
|
||||||
- 3000
|
- 3000
|
||||||
|
|
||||||
#############################################################################
|
# Docker-compose wrapper
|
||||||
# DATABASE
|
# 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:
|
rethinkdb:
|
||||||
image: rethinkdb
|
image: rethinkdb
|
||||||
restart: always
|
restart: always
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "joyent-cp-gql-schema",
|
"name": "joyent-cp-gql-schema",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"repository": "github:yldio/joyent-portal",
|
"repository": "github:yldio/joyent-portal",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "portal-api",
|
"name": "portal-api",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./lib/index.js",
|
"main": "./lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
2
setup.sh
2
setup.sh
@ -61,6 +61,7 @@ check() {
|
|||||||
|
|
||||||
TRITON_USER=$(triton profile get | awk -F": " '/account:/{print $2}')
|
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_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
|
echo '# docker-compose-client for Triton' > _env
|
||||||
TRITON_CREDS_PATH=/root/.triton
|
TRITON_CREDS_PATH=/root/.triton
|
||||||
@ -75,6 +76,7 @@ check() {
|
|||||||
echo SDC_KEY_ID=${SDC_KEY_ID} >> _env
|
echo SDC_KEY_ID=${SDC_KEY_ID} >> _env
|
||||||
echo TRITON_USER=${TRITON_USER} >> _env
|
echo TRITON_USER=${TRITON_USER} >> _env
|
||||||
echo TRITON_DC=${TRITON_DC} >> _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=$(cat "${DOCKER_CERT_PATH}"/ca.pem | tr '\n' '#') >> _env
|
||||||
echo TRITON_CA_PATH=${TRITON_CREDS_PATH}/ca.pem >> _env
|
echo TRITON_CA_PATH=${TRITON_CREDS_PATH}/ca.pem >> _env
|
||||||
echo TRITON_KEY=$(cat "${DOCKER_CERT_PATH}"/key.pem | tr '\n' '#') >> _env
|
echo TRITON_KEY=$(cat "${DOCKER_CERT_PATH}"/key.pem | tr '\n' '#') >> _env
|
||||||
|
Loading…
Reference in New Issue
Block a user