Skip to content

Commit

Permalink
Merge pull request #831 from Flowminder/remove-flowdb-services-env-var
Browse files Browse the repository at this point in the history
Remove FLOWDB_SERVICES env var
  • Loading branch information
mergify[bot] authored May 22, 2019
2 parents 5a9e836 + b7d6e05 commit eb6c52f
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- The `FLOWDB_DEBUG` environment variable used to have no effect. This has been fixed. [#811](https://github.com/Flowminder/FlowKit/issues/811)

### Removed
- The `FLOWDB_SERVICES` environment variable has been removed from the toplevel Makefile, so that now `DOCKER_SERVICES` is the only environment variable that controls which services are spun up when running `make up`. [#827](https://github.com/Flowminder/FlowKit/issues/827)

## [0.6.3]

Expand Down
24 changes: 15 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,27 @@
# `make flowapi-down` to tear down the docker container for flowapi
# only.
#
# By setting the variable FLOWDB_SERVICES you can choose which flowdb
# version or versions you'd like to use when running `make up`. Examples:
# By setting the variable DOCKER_SERVICES you can choose which services
# you'd like to use when running `make up`. Note that at most one flowdb
# service must be specified. Examples:
#
# FLOWDB_SERVICES=flowdb_testdata make up
# FLOWDB_SERVICES=flowdb_synthetic_data make up
# FLOWDB_SERVICES="flowdb_testdata flowdb_synthetic_data" make up
# DOCKER_SERVICES="flowdb_synthetic_data flowapi flowmachine flowauth flowmachine_query_locker" make up
# DOCKER_SERVICES="flowdb" make up
# DOCKER_SERVICES="flowdb_testdata flowetl flowetl_db" make up
#
# flowmachine and flowapi will connected to the first flowdb service in the list.

DOCKER_COMPOSE_FILE ?= docker-compose.yml
DOCKER_COMPOSE_FILE_BUILD ?= docker-compose-build.yml
FLOWDB_SERVICES ?= flowdb_testdata
DOCKER_SERVICES ?= $(FLOWDB_SERVICES) flowapi flowmachine flowauth flowmachine_query_locker flowetl flowetl_db worked_examples
export DOCKER_FLOWDB_HOST=$(word 1, $(FLOWDB_SERVICES))

DOCKER_SERVICES ?= flowdb_testdata flowapi flowmachine flowauth flowmachine_query_locker flowetl flowetl_db worked_examples

# Check that at most one flowdb service is present in DOCKER_SERVICES
NUM_SPECIFIED_FLOWDB_SERVICES=$(words $(filter flowdb%, $(DOCKER_SERVICES)))
ifneq ($(NUM_SPECIFIED_FLOWDB_SERVICES),0)
ifneq ($(NUM_SPECIFIED_FLOWDB_SERVICES),1)
$(error "At most one flowdb service must be specified in DOCKER_SERVICES, but found: $(filter flowdb%, $(DOCKER_SERVICES))")
endif
endif

all:

Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ services:
- FLOWMACHINE_LOG_LEVEL=${FLOWMACHINE_LOG_LEVEL:?Must set FLOWMACHINE_LOG_LEVEL env var}
- FLOWMACHINE_SERVER_DEBUG_MODE=${FLOWMACHINE_SERVER_DEBUG_MODE:?Must set FLOWMACHINE_SERVER_DEBUG_MODE env var}
- FLOWDB_PORT=5432
- FLOWDB_HOST=${DOCKER_FLOWDB_HOST:?Must set DOCKER_FLOWDB_HOST env var}
- FLOWDB_HOST=flowdb
- FLOWMACHINE_FLOWDB_USER=${FLOWMACHINE_FLOWDB_USER:?Must set FLOWMACHINE_FLOWDB_USER env var}
- FLOWMACHINE_FLOWDB_PASSWORD=${FLOWMACHINE_FLOWDB_PASSWORD:?Must set FLOWMACHINE_FLOWDB_PASSWORD env var}
- REDIS_HOST=flowmachine_query_locker
Expand All @@ -123,7 +123,7 @@ services:
stdin_open: true
environment:
- FLOWDB_PORT=5432
- FLOWDB_HOST=${DOCKER_FLOWDB_HOST:?Must set DOCKER_FLOWDB_HOST env var}
- FLOWDB_HOST=flowdb
- FLOWMACHINE_FLOWDB_USER=${FLOWMACHINE_FLOWDB_USER:?Must set FLOWMACHINE_FLOWDB_USER env var}
- FLOWMACHINE_FLOWDB_PASSWORD=${FLOWMACHINE_FLOWDB_PASSWORD:?Must set FLOWMACHINE_FLOWDB_PASSWORD env var}
- REDIS_HOST=flowmachine_query_locker
Expand All @@ -148,7 +148,7 @@ services:
- FLOWMACHINE_PORT=5555
- FLOWAPI_FLOWDB_USER=${FLOWAPI_FLOWDB_USER:?Must set FLOWAPI_FLOWDB_USER env var}
- FLOWAPI_FLOWDB_PASSWORD=${FLOWAPI_FLOWDB_PASSWORD:?Must set FLOWAPI_FLOWDB_PASSWORD env var}
- FLOWDB_HOST=${DOCKER_FLOWDB_HOST:?Must set DOCKER_FLOWDB_HOST env var}
- FLOWDB_HOST=flowdb
- FLOWDB_PORT=5432
- JWT_SECRET_KEY=${JWT_SECRET_KEY:?Must set JWT_SECRET_KEY env var}
- FLOWAPI_LOG_LEVEL=${FLOWAPI_LOG_LEVEL:?Must set FLOWAPI_LOG_LEVEL env var}
Expand Down
6 changes: 5 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ This will create any necessary Docker containers, run all notebooks, generate ma

For local development, you can also run `pipenv run serve`, which will build the docs, and then start a live reloading web server. You can view the docs at http://localhost:8000, and any changes you make to markdown files in the `build` directory will be reflected immediately.

Alternatively, you can build the docs by sourcing `development_environment` and running `FLOWDB_SERVICES="flowdb_synthetic_data" make up` in the project root to bring up the required containers, and then running `pipenv run mkdocs` directly.
Alternatively, you can build the docs by sourcing `development_environment` and running
```
DOCKER_SERVICES="flowdb_synthetic_data flowapi flowmachine flowmachine_query_locker" make up
```
in the project root to bring up the required containers, and then running `pipenv run mkdocs` directly.

### Editing

Expand Down
3 changes: 1 addition & 2 deletions docs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

set -e

export FLOWDB_SERVICES="flowdb_synthetic_data"
export DOCKER_SERVICES="flowdb_synthetic_data flowmachine_query_locker"

KillJobs() {
Expand All @@ -32,7 +31,7 @@ trap TrapQuit EXIT
if [ "$CI" != "true" ]; then
(pushd .. && make down && make up && popd)
echo "Waiting for flowdb to be ready"
docker exec ${FLOWDB_SERVICES} bash -c 'i=0; until [ $i -ge 24 ] || (pg_isready -h 127.0.0.1 -p 5432); do let i=i+1; echo Waiting 10s; sleep 10; done'
docker exec flowdb_synthetic_data bash -c 'i=0; until [ $i -ge 24 ] || (pg_isready -h 127.0.0.1 -p 5432); do let i=i+1; echo Waiting 10s; sleep 10; done'
fi

pipenv install
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ The test suite makes use of the environment variables defined in `development_en

### Running in PyCharm

To run the tests from within PyCharm, you will need to run `FLOWDB_SERVICES="flowdb_testdata" DOCKER_SERVICES="flowdb_testdata flowmachine_query_locker"` in the project root, and ensure you have provided the environment variables in the top level `development_environment` file to PyCharm (for example, by using the EnvFile plugin).
To run the tests from within PyCharm, you will need to run `DOCKER_SERVICES="flowdb_testdata flowmachine_query_locker"` in the project root, and ensure you have provided the environment variables in the top level `development_environment` file to PyCharm (for example, by using the EnvFile plugin).
3 changes: 1 addition & 2 deletions integration_tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

set -e

export FLOWDB_SERVICES="flowdb_testdata"
export DOCKER_SERVICES="flowdb_testdata flowmachine_query_locker"

TrapQuit() {
Expand All @@ -23,7 +22,7 @@ if [ "$CI" != "true" ]; then
echo "Bringing up new ones."
(pushd .. && make down && make up && popd)
echo "Waiting for flowdb to be ready"
docker exec ${FLOWDB_SERVICES} bash -c 'i=0; until [ $i -ge 24 ] || (pg_isready -h 127.0.0.1 -p 5432); do let i=i+1; echo Waiting 10s; sleep 10; done'
docker exec flowdb_testdata bash -c 'i=0; until [ $i -ge 24 ] || (pg_isready -h 127.0.0.1 -p 5432); do let i=i+1; echo Waiting 10s; sleep 10; done'
fi
echo "Installing."
pipenv install --deploy
Expand Down

0 comments on commit eb6c52f

Please sign in to comment.