chore: setup docker-compose.yml

This commit is contained in:
Sérgio Ramos 2017-05-30 18:52:10 +01:00
parent c957d419ee
commit fdbfeb2e37
10 changed files with 440 additions and 9 deletions

163
.dockerignore Normal file
View File

@ -0,0 +1,163 @@
### Bower ###
bower_components
.bower-cache
.bower-registry
.bower-tmp
### Git ###
*.orig
### macOS ###
*.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Node ###
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules
jspm_packages
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
### SublimeText ###
# cache files for sublime text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
# workspace files are user-specific
*.sublime-workspace
# project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using SublimeText
# *.sublime-project
# sftp configuration file
sftp-config.json
# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
bh_unicode_properties.cache
# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings
### Vim ###
# swap
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
# session
Session.vim
# temporary
.netrwhist
*~
# auto-generated tag files
tags
### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
### Application Specific ###
.env
# PostCSS
*.postcss.js
/cloudapi-graphql/credentials.json
/docker-graphql/config.json
tap-xunit
/ui/dist
_todo
packages/*/dist
packages/*/buid
packages/ui-toolkit/styleguide
packages/*/node_modules
legacy

4
.gitignore vendored
View File

@ -155,4 +155,6 @@ tap-xunit
/ui/dist
_todo
packages/*/dist
packages/*/dist
packages/*/buid
packages/ui-toolkit/styleguide

View File

@ -37,14 +37,12 @@ test:
# test
- yarn run test
# deployment:
# development:
# branch: master
# commands:
# - ./bin/docker-login
# - make -j2 build
# - make -j2 push
# - ./bin/deploy
deployment:
development:
branch: master
commands:
- ./bin/docker-login
- ./bin/deploy
# production:
# tag: /production-*/
# commands:

94
docker-compose.yml Normal file
View File

@ -0,0 +1,94 @@
version: "2"
services:
#############################################################################
# CONSUL
#
# Consul is the service catalog that helps discovery between the components
# Change "-bootstrap" to "-bootstrap-expect 3", then scale to 3 or more to
# turn this into an HA Consul raft.
#############################################################################
consul:
image: autopilotpattern/consul:latest
command: >
/usr/local/bin/containerpilot
/bin/consul agent -server
-bootstrap-expect 3
-config-dir=/etc/consul
-ui-dir /ui
restart: always
mem_limit: 128m
ports:
- 8500
dns:
- 127.0.0.1
labels:
- triton.cns.services=consul-$CIRCLE_BRANCH
- com.docker.swarm.affinities=["container!=~*"]
#############################################################################
# PROMETHEUS
#
# Prometheus is an open source performance monitoring tool
# it is included here for demo purposes and is not required
#############################################################################
prometheus:
image: autopilotpattern/prometheus:latest
restart: always
mem_limit: 1g
ports:
- 9090
labels:
- triton.cns.services=prometheus-$CIRCLE_BRANCH
- com.docker.swarm.affinities=["container!=~*prometheus*"]
#############################################################################
# STYLEGUIDE
#############################################################################
styleguide:
build:
context: .
dockerfile: ./packages/ui-toolkit/Dockerfile
ports:
- 6060:6060
mem_limit: 512m
labels:
- triton.cns.services=ui-$CIRCLE_BRANCH
- com.docker.swarm.affinities=["container!=~*styleguide*"]
environment:
- CONSUL_AGENT=1
- PORT=6060
#############################################################################
# FRONTEND
#############################################################################
cp-frontend:
build:
context: .
dockerfile: ./packages/cp-frontend/Dockerfile
mem_limit: 512m
labels:
- triton.cns.services=frontend-$CIRCLE_BRANCH
- com.docker.swarm.affinities=["container!=~*cp-frontend*"]
environment:
- CONSUL_AGENT=1
- PORT=3069
ports:
- 3069:3069
#############################################################################
# BACKEND
#############################################################################
gql-mock-server:
build:
context: .
dockerfile: ./packages/cp-gql-mock-server/Dockerfile
mem_limit: 512m
labels:
- triton.cns.services=frontend-$CIRCLE_BRANCH
- com.docker.swarm.affinities=["container!=~*gql-mock-server*"]
environment:
- CONSUL_AGENT=1
- PORT=3000
ports:
- 3000:3000

View File

@ -0,0 +1,12 @@
# todo change to 7
FROM quay.io/yldio/alpine-node-containerpilot:latest
RUN npm install lerna@^2.0.0-rc.5 \
&& ./node_modules/.bin/lerna clean --yes --scope joyent-cp-frontend --include-filtered-dependencies \
&& ./node_modules/.bin/lerna bootstrap --scope joyent-cp-frontend --include-filtered-dependencies
WORKDIR /home/node/app/packages/cp-frontend
COPY packages/cp-frontend/etc/containerpilot.json /etc/
EXPOSE 3069
CMD ["/bin/containerpilot", "yarn", "run", "start"]

View File

@ -0,0 +1,46 @@
{
"consul": "0.0.0.0:8500",
"services": [
{
"name": "cp-frontend",
"port": 3069,
"health": "/usr/bin/curl -o /dev/null --fail -s http://0.0.0.0:3069/",
"poll": 3,
"ttl": 10
}
],
"backends": [],
"telemetry": {
"port": 9090,
"sensors": [
{
"name": "frontend_memory_percent",
"help": "percentage of memory used",
"type": "gauge",
"poll": 5,
"check": ["/bin/sensors", "memory"]
},
{
"name": "frontend_cpu_load",
"help": "cpu load",
"type": "gauge",
"poll": 5,
"check": ["/bin/sensors", "cpu"]
},
{
"name": "frontend_disk_capacity",
"help": "disk capacity",
"type": "gauge",
"poll": 60,
"check": ["/bin/sensors", "diskcapacity"]
},
{
"name": "frontend_disk_usage",
"help": "disk usage",
"type": "gauge",
"poll": 60,
"check": ["/bin/sensors", "diskusage"]
}
]
}
}

View File

@ -0,0 +1,12 @@
# todo change to 7
FROM quay.io/yldio/alpine-node-containerpilot:latest
RUN npm install lerna@^2.0.0-rc.5 \
&& ./node_modules/.bin/lerna clean --yes --scope joyent-cp-gql-mock-server --include-filtered-dependencies \
&& ./node_modules/.bin/lerna bootstrap --scope joyent-cp-gql-mock-server --include-filtered-dependencies
WORKDIR /home/node/app/packages/cp-gql-mock-server
COPY packages/cp-gql-mock-server/etc/containerpilot.json /etc/
EXPOSE 3000
CMD ["/bin/containerpilot", "yarn", "run", "start"]

View File

@ -0,0 +1,46 @@
{
"consul": "0.0.0.0:8500",
"services": [
{
"name": "cp-gql-mock-server",
"port": 3000,
"health": "/usr/bin/curl -o /dev/null --fail -s http://0.0.0.0:3000/",
"poll": 3,
"ttl": 10
}
],
"backends": [],
"telemetry": {
"port": 9090,
"sensors": [
{
"name": "frontend_memory_percent",
"help": "percentage of memory used",
"type": "gauge",
"poll": 5,
"check": ["/bin/sensors", "memory"]
},
{
"name": "frontend_cpu_load",
"help": "cpu load",
"type": "gauge",
"poll": 5,
"check": ["/bin/sensors", "cpu"]
},
{
"name": "frontend_disk_capacity",
"help": "disk capacity",
"type": "gauge",
"poll": 60,
"check": ["/bin/sensors", "diskcapacity"]
},
{
"name": "frontend_disk_usage",
"help": "disk usage",
"type": "gauge",
"poll": 60,
"check": ["/bin/sensors", "diskusage"]
}
]
}
}

View File

@ -0,0 +1,12 @@
# todo change to 7
FROM quay.io/yldio/alpine-node-containerpilot:latest
RUN npm install lerna@^2.0.0-rc.5 \
&& ./node_modules/.bin/lerna clean --yes --scope joyent-ui-toolkit --include-filtered-dependencies \
&& ./node_modules/.bin/lerna bootstrap --scope joyent-ui-toolkit --include-filtered-dependencies
WORKDIR /home/node/app/packages/ui-toolkit
COPY packages/ui-toolkit/etc/containerpilot.json /etc/
EXPOSE 6060
CMD ["/bin/containerpilot", "yarn", "run", "styleguide"]

View File

@ -0,0 +1,46 @@
{
"consul": "0.0.0.0:8500",
"services": [
{
"name": "ui-toolkit",
"port": 6060,
"health": "/usr/bin/curl -o /dev/null --fail -s http://0.0.0.0:6060/",
"poll": 3,
"ttl": 10
}
],
"backends": [],
"telemetry": {
"port": 9090,
"sensors": [
{
"name": "frontend_memory_percent",
"help": "percentage of memory used",
"type": "gauge",
"poll": 5,
"check": ["/bin/sensors", "memory"]
},
{
"name": "frontend_cpu_load",
"help": "cpu load",
"type": "gauge",
"poll": 5,
"check": ["/bin/sensors", "cpu"]
},
{
"name": "frontend_disk_capacity",
"help": "disk capacity",
"type": "gauge",
"poll": 60,
"check": ["/bin/sensors", "diskcapacity"]
},
{
"name": "frontend_disk_usage",
"help": "disk usage",
"type": "gauge",
"poll": 60,
"check": ["/bin/sensors", "diskusage"]
}
]
}
}