Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix production config & zero-config docker-compose setup #568

Merged
merged 2 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,15 @@ sandbox-down:

sandbox-clear:
COMPOSE_PROJECT_NAME=bcdbox docker-compose -f docker-compose.sandbox.yml down -v

gateway-images:
docker-compose -f docker-compose.gateway.yml build

gateway:
COMPOSE_PROJECT_NAME=bcdhub docker-compose -f docker-compose.gateway.yml up -d

gateway-down:
COMPOSE_PROJECT_NAME=bcdhub docker-compose -f docker-compose.gateway.yml down

gateway-clear:
COMPOSE_PROJECT_NAME=bcdhub docker-compose -f docker-compose.gateway.yml down -v
8 changes: 4 additions & 4 deletions configs/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ tzkt:

storage:
uri:
- http://${ELASTIC_HOSTNAME}:9200
- http://${ELASTIC_HOSTNAME}:9200
- http://${ELASTIC_HOSTNAME:-elastic}:9200
- http://${ELASTIC_HOSTNAME:-elastic}:9200
timeout: 10

rabbitmq:
uri: "amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@${RABBITMQ_HOSTNAME}:5672/"
uri: "amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@${RABBITMQ_HOSTNAME:-mq}:5672/"
timeout: 10

db:
conn_string: "host=${DB_HOSTNAME} port=5432 user=${POSTGRES_USER} dbname=${POSTGRES_DB} password=${POSTGRES_PASSWORD} sslmode=disable"
conn_string: "host=${DB_HOSTNAME:-db} port=5432 user=${POSTGRES_USER} dbname=${POSTGRES_DB} password=${POSTGRES_PASSWORD} sslmode=disable"
timeout: 10

oauth:
Expand Down
112 changes: 112 additions & 0 deletions docker-compose.gateway.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
version: "3.6"
services:
elastic:
image: bakingbad/bcdhub-elastic:${TAG:-latest}
build:
context: .
dockerfile: build/elastic/Dockerfile
restart: always
volumes:
- esdata:/usr/share/elasticsearch/data
environment:
- bootstrap.memory_lock=true
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms2g -Xmx2g" # CHANGEME: ElasticSearch RAM comsumption
logging: &my-logging
options:
max-size: 10m
max-file: "5"

mq:
image: rabbitmq:latest
restart: always
volumes:
- mqdata:/var/lib/rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
logging: *my-logging

db:
image: postgres:12
restart: always
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=root
- POSTGRES_DB=bcd
volumes:
- db:/var/lib/postgresql/data
logging: *my-logging

api:
restart: always
image: bakingbad/bcdhub-api:${TAG:-latest}
build:
context: .
dockerfile: build/api/Dockerfile
environment:
- BCD_ENV=production
- GIN_MODE=release
- POSTGRES_USER=root
- POSTGRES_PASSWORD=root
- POSTGRES_DB=bcd
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
depends_on:
- elastic
- db
- mq
ports:
- 127.0.0.1:14000:14000
volumes:
- bcdshare:/etc/bcd
logging: *my-logging

indexer:
restart: always
image: bakingbad/bcdhub-indexer:${TAG:-latest}
build:
context: .
dockerfile: build/indexer/Dockerfile
environment:
- BCD_ENV=production
- POSTGRES_USER=root
- POSTGRES_PASSWORD=root
- POSTGRES_DB=bcd
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
depends_on:
- elastic
- mq
- metrics
volumes:
- bcdshare:/etc/bcd
logging: *my-logging

metrics:
restart: always
image: bakingbad/bcdhub-metrics:${TAG:-latest}
build:
context: .
dockerfile: build/metrics/Dockerfile
environment:
- BCD_ENV=production
- POSTGRES_USER=root
- POSTGRES_PASSWORD=root
- POSTGRES_DB=bcd
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
depends_on:
- elastic
- mq
- db
volumes:
- bcdshare:/etc/bcd
logging: *my-logging

volumes:
esdata:
mqdata:
bcdshare:
db:
driver: local