Skip to content

Commit

Permalink
allow custom hostnames setting for db, elastic, rabbit with envvar (#554
Browse files Browse the repository at this point in the history
)

* allow custom hostnames setting for db, elastic, rabbit with envvar

You can not always assume the hostname of the remote services.

For example, in tezos-k8s, I am running everything in a pod, so
I need to set everything to `localhost`.

In order to not disrupt any existing workflow, we set these env
vars to standard values in the Dockerfile; they can be overridden
at runtime. See: https://stackoverflow.com/a/40334819/207209

* use default env in docker-compose instead of Dockerfile

* postgres => db
  • Loading branch information
nicolasochem authored Mar 20, 2021
1 parent 3d65afd commit 80eeff9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
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:9200
- http://elastic:9200
- http://${ELASTIC_HOSTNAME:-elastic}:9200
- http://${ELASTIC_HOSTNAME:-elastic}:9200
timeout: 10

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

db:
conn_string: "host=db 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
6 changes: 3 additions & 3 deletions configs/sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ rpc:

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

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

db:
conn_string: "host=db 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

share_path: ${HOME}/.bcd
Expand Down
6 changes: 3 additions & 3 deletions configs/you.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ tzkt:

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

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

db:
conn_string: "host=db 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

0 comments on commit 80eeff9

Please sign in to comment.