From 7ba595b7de5d2de89dc651a9a5760c6ce2ed3b50 Mon Sep 17 00:00:00 2001 From: David Neudorfer Date: Wed, 25 Jan 2017 15:27:29 -0800 Subject: [PATCH] merges docker optimizations from develop branch --- docker-compose.development.yml | 20 ++++++++++++++++++++ docker-compose.production.yml | 13 ++++--------- docker-compose.staging.yml | 9 --------- docker-compose.yml | 20 ++++---------------- 4 files changed, 28 insertions(+), 34 deletions(-) create mode 100644 docker-compose.development.yml diff --git a/docker-compose.development.yml b/docker-compose.development.yml new file mode 100644 index 00000000..5f987f4b --- /dev/null +++ b/docker-compose.development.yml @@ -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 diff --git a/docker-compose.production.yml b/docker-compose.production.yml index 30d2aba5..e1e90f00 100644 --- a/docker-compose.production.yml +++ b/docker-compose.production.yml @@ -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 diff --git a/docker-compose.staging.yml b/docker-compose.staging.yml index 49e491db..9d6988b9 100644 --- a/docker-compose.staging.yml +++ b/docker-compose.staging.yml @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index b47d3ce3..228489e6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,20 +1,15 @@ 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 @@ -22,23 +17,16 @@ services: 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: