Skip to content

Commit d88787d

Browse files
committed
Merge branch 'refactor/docker-compose' into dev
2 parents 523c120 + a03da8a commit d88787d

21 files changed

Lines changed: 199 additions & 429 deletions

.env.example

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ NEO_URI=bolt://neo4j:7687
22
NEO_USERNAME=neo4j
33
NEO_PASSWORD=sourcedata
44
NEO4J_AUTH=neo4j/sourcedata
5-
NEO4J_dbms_memory_pagecache_size=2G
6-
NEO4J_dbms_memory_heap_max__size=1G
5+
NEO4J_MEMORY_LIMIT=2G
6+
7+
NEO4J_dbms_checkpoint_interval_time=120s
8+
NEO4J_dbms_checkpoint_interval_tx=10000
9+
NEO4J_dbms_checkpoint_iops_limit=-1
10+
NEO4J_dbms_jvm_additional=-Dlog4j2.formatMsgNoLookups=True
11+
NEO4J_dbms_memory_heap_initial__size=500M
12+
NEO4J_dbms_memory_heap_max__size=500M
13+
NEO4J_dbms_memory_pagecache_size=1G
714
NEO4J_dbms_security_procedures_unrestricted=gds.*
15+
NEO4J_dbms_tx__log_rotation_retention__policy=keep_none
816

917
SD_API_URL=https://api.sourcedata.io/
1018
SD_API_USERNAME=
@@ -15,15 +23,23 @@ EEB_PUBLIC_API=https://eeb.embo.org/api/
1523

1624
SMTAG_WORKING_DIRECTORY=./resources
1725
SMTAG_PRODUCTION_DIRECTORY=./rack
18-
NBITS=8
1926

2027
HYPOTHESIS_USER=
2128
HYPOTHESIS_API_KEY=
29+
OPENAI_API_TOKEN=
2230

23-
TRAEFIK_HOSTNAME=
24-
TRAEFIK_HOSTNAME_OLD=
31+
BIORXIV_PATH=./data/dgx/biorxiv
32+
MECADOI_PATH=./data/dgx/mecadoi
2533

26-
IMAGE_TAG=dev
34+
SMTP_HOST=
35+
SMTP_STARTTLS_PORT=
36+
SMTP_USERNAME=
37+
SMTP_PASSWORD=
38+
NOTIFICATIONS_RECIPIENT=
39+
NOTIFICATIONS_SENDER=
2740

2841
FLOW_BATCH_SIZE=100
29-
DB_DEPLOY_EMAILS=user@example.com
42+
43+
COMPOSE_HTTP_TIMEOUT=600
44+
IMAGE_TAG=dev
45+
DB_DEPLOY_EMAILS=user@example.com

.env.example.prod

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
NEO_URI=
2+
NEO_USERNAME=
3+
NEO_PASSWORD=
4+
NEO4J_AUTH=
5+
NEO4J_dbms_memory_heap_initial__size=
6+
NEO4J_dbms_memory_heap_max__size=
7+
NEO4J_dbms_memory_pagecache_size=
8+
NEO4J_dbms_security_procedures_unrestricted=gds.*
9+
NEO4J_dbms_jvm_additional=-Dlog4j2.formatMsgNoLookups=True
10+
NEO4J_dbms_allow__upgrade=true
11+
12+
EEB_HOSTNAME=eeb.embo.org
13+
EEB_HOSTNAME_OLD=eeb.sourcedata.io

.github/workflows/ci.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
6969
strategy:
7070
matrix:
71-
image: ['flask_deploy', 'flask', 'traefik', 'vuejs']
71+
image: ['flask', 'traefik', 'vuejs']
7272
needs: test
7373
runs-on: ubuntu-latest
7474

@@ -88,8 +88,7 @@ jobs:
8888
password: ${{ secrets.GITHUB_TOKEN }}
8989

9090
- name: Build the Docker images
91-
run: docker compose -f docker-compose.ci.yml build ${{ matrix.image }}
91+
run: docker compose -f docker-compose.yml -f docker-compose.prod.yml build ${{ matrix.image }}
9292

9393
- name: Push the Docker images
94-
# retry up to 3 times
95-
run: docker compose -f docker-compose.ci.yml push ${{ matrix.image }} || docker compose -f docker-compose.ci.yml push ${{ matrix.image }} || docker compose -f docker-compose.ci.yml push ${{ matrix.image }}
94+
run: docker compose -f docker-compose.yml -f docker-compose.prod.yml push ${{ matrix.image }}

README.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,26 @@ docker-compose down --volumes # to clean the content of the volumes
2222

2323
This can solve some issues, for example if you run `build` with a wrong config file.
2424

25+
### Compose files
26+
27+
This repository contains multiple docker-compose files that are [merged together](https://docs.docker.com/compose/how-tos/multiple-compose-files/merge/) to define the services and their configurations for different environments (production, testing). The files are:
28+
29+
- `docker-compose.yml`: the main compose file that defines the services and their dependencies. This file is used as the base configuration for all environments.
30+
- `docker-compose.override.yml`: the override compose file that extends the main compose file with additional configurations for development. It is automatically used by Docker Compose if present and no other compose files are specified. This file is used both for local development and for running the database deployment.
31+
- `docker-compose.prod.yml`: the production compose file that extends the main compose file with production-specific configurations.
32+
- `docker-compose.tests.yml`: the tests compose file that extends the main compose file with configurations for running tests. Used in `scripts/run-tests.sh` and CI.
33+
34+
If you run `docker-compose up` (or any other sub-command) without specifying a compose file, `docker-compose` will use the `docker-compose.yml` and `docker-compose.override.yml` files by default. If you want to run the production setup, use this command:
35+
36+
```bash
37+
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
38+
```
39+
2540
### First time setup:
2641

2742
```bash
43+
# copy the example .env file and edit with your desired config
44+
# .env.example.prod is for the production webserver
2845
cp .env.example .env
2946
docker-compose build
3047
docker-compose up
@@ -145,7 +162,7 @@ docker run --rm \
145162

146163
```bash
147164
# Make sure you dont have your neo4j running:
148-
docker-compose -f production.yml down
165+
docker-compose -f docker-compose.yml -f docker-compose.prod.yml down
149166

150167
sudo mkdir dumps
151168
sudo chown 7474:7474 dumps
@@ -188,7 +205,7 @@ wget https://oc.embl.de/index.php/s/<token>/download
188205

189206

190207
# build docker
191-
docker-compose -f production.yml build
208+
docker-compose -f docker-compose.yml -f docker-compose.prod.yml build
192209

193210
# force load the database with the dump
194211
# THIS WILL OVERWRITE THE EXISTING DB
@@ -201,8 +218,8 @@ docker run --rm \
201218
bin/neo4j-admin load --from=/app/download --database=neo4j --force # WILL OVERWRITE!
202219

203220
# start the services
204-
docker-compose -f production.yml up -d --remove-orphans
205-
docker-compose -f production.yml run --rm flask python -m neoflask.cache_warm_up # warm up cache
221+
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --remove-orphans
222+
docker-compose -f docker-compose.yml -f docker-compose.prod.yml run --rm flask python -m neoflask.cache_warm_up # warm up cache
206223
```
207224

208225

@@ -211,6 +228,6 @@ Something like this will (generally) be enough, but really depends on your chang
211228

212229
```bash
213230
git pull
214-
docker-compose -f production.yml build
215-
docker-compose -f production.yml up -d --remove-orphans
231+
docker-compose -f docker-compose.yml -f docker-compose.prod.yml build
232+
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --remove-orphans
216233
```

compose/local/flask/Dockerfile

Lines changed: 0 additions & 40 deletions
This file was deleted.

compose/local/flask/start

Lines changed: 0 additions & 12 deletions
This file was deleted.

compose/production/flask/Dockerfile

Lines changed: 0 additions & 50 deletions
This file was deleted.

compose/production/flask/entrypoint

Lines changed: 0 additions & 7 deletions
This file was deleted.

compose/production/flask/start

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)