Skip to content

Commit

Permalink
merges docker optimizations from develop branch
Browse files Browse the repository at this point in the history
  • Loading branch information
David Neudorfer committed Jan 25, 2017
1 parent a2ee1f7 commit 7ba595b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 34 deletions.
20 changes: 20 additions & 0 deletions docker-compose.development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '2'

services:

db:
cpu_shares: 2
cpuset: 0-1

app:
environment:
- VIRTUAL_HOST=tasks.dev

web:
image: jwilder/nginx-proxy
ports:
- 80:80
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- code_network
13 changes: 4 additions & 9 deletions docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,21 @@ version: '2'

services:

db:
cpu_shares: 8
cpuset: 0-8

app:
command: ["true"]

# https://github.com/vincetse/docker-compose-zero-downtime-deployment
app_green:
container_name: app_green
ports:
- 3000:6543
environment:
- VIRTUAL_PORT=3000
- VIRTUAL_HOST=tasks.hotosm.org,tasks-green.hotosm.org
extends:
service: app

app_blue:
container_name: app_blue
ports:
- 3001:6543
environment:
- VIRTUAL_PORT=3001
- VIRTUAL_HOST=tasks.hotosm.org,tasks-blue.hotosm.org
extends:
service: app
9 changes: 0 additions & 9 deletions docker-compose.staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,14 @@ services:
app:
command: ["true"]

# https://github.com/vincetse/docker-compose-zero-downtime-deployment
app_green:
container_name: app_green
ports:
- 3000:6543
environment:
- VIRTUAL_PORT=3000
- VIRTUAL_HOST=tasks-staging.hotosm.org,tasks-staging-green.hotosm.org
extends:
service: app

app_blue:
container_name: app_blue
ports:
- 3001:6543
environment:
- VIRTUAL_PORT=3001
- VIRTUAL_HOST=tasks-staging.hotosm.org,tasks-staging-blue.hotosm.org
extends:
service: app
20 changes: 4 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,32 @@
version: '2'

services:
# https://hub.docker.com/_/postgres/
# https://store.docker.com/images/022689bf-dfd8-408f-9e1c-19acac32e57b

db:
build:
context: ./
dockerfile: Dockerfile.db
container_name: db
restart: always
volumes:
- postgres-db-volume:/data/postgres
- /tmp:/srv
cpu_shares: 8
cpuset: 0-8
networks:
- database_network

app:
build:
context: ./
dockerfile: Dockerfile.app
container_name: app
environment:
- VIRTUAL_HOST=tasks-staging.hotosm.org
restart: always
# https://docs.docker.com/compose/startup-order/
command: ["./wait-for-postgres.sh", "db", "./startup-tm.sh"]
expose:
- 6543
environment:
- VIRTUAL_PORT=6543
networks:
- database_network
- code_network

# cpuset, such as `docker run –cpuset-cpus`, allows users to specify
# which CPUs to allow execution in. accepts a string that looks like
# 0
# 0,1
# 0-2
# cpu_shares

volumes:
postgres-db-volume:

Expand Down

0 comments on commit 7ba595b

Please sign in to comment.