From 8b537d32c0e7c7623a9217404e8688e0d0c5864a Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Fri, 19 Jun 2020 08:56:20 +0200 Subject: [PATCH] Fixed client startup --- .gitignore | 2 ++ Makefile | 3 ++ dc-dev.sh | 2 ++ docker-compose.dev.yml | 10 ++++-- docker-compose.prod.yml | 63 +++++++++++++++++++++++++++++++----- docker-compose.yml | 36 --------------------- openslides-client | 2 +- openslides-datastore-service | 2 +- services.env | 5 ++- 9 files changed, 73 insertions(+), 52 deletions(-) create mode 100755 dc-dev.sh diff --git a/.gitignore b/.gitignore index 01b1434d6..aee6694d3 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,6 @@ tests .venv/ .vscode/ package-lock.json +server/ +docker/ diff --git a/Makefile b/Makefile index 0eba1d0b6..5955a88e4 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,9 @@ build-dev: run-dev: | build-dev docker-compose -f docker-compose.yml -f docker-compose.dev.yml up +stop-dev: + docker-compose -f docker-compose.yml -f docker-compose.dev.yml down + copy-node-modules: docker-compose -f docker-compose.yml -f docker-compose.dev.yml exec client bash -c "cp -r /app/node_modules/ /app/src/" mv openslides-client/client/src/node_modules/ openslides-client/client/ diff --git a/dc-dev.sh b/dc-dev.sh new file mode 100755 index 000000000..30968a947 --- /dev/null +++ b/dc-dev.sh @@ -0,0 +1,2 @@ +#!/bin/bash +docker-compose -f docker-compose.yml -f docker-compose.dev.yml $@ \ No newline at end of file diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index f6d1b7c8d..54ac8ea68 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -10,7 +10,11 @@ services: volumes: - ./openslides-datastore-service/shared/shared:/app/shared - ./openslides-datastore-service/writer/writer:/app/writer - - ./cli:/app/cli + - ./openslides-datastore-service/cli:/app/cli + environment: + - DATASTORE_ENABLE_DEV_ENVIRONMENT=1 + - COMMAND=create_initial_data + - DATASTORE_INITIAL_DATA_FILE=https://raw.githubusercontent.com/OpenSlides/OpenSlides/openslides4-dev/docs/example-data.json client: image: openslides-client-dev volumes: @@ -22,8 +26,8 @@ services: autoupdate: image: openslides-autoupdate-dev volumes: - - ./openslides-autoupdate-service/cmd:/app/cmd - - ./openslides-autoupdate-service/internal:/app/internal + - ./openslides-autoupdate-service/cmd:/root/cmd + - ./openslides-autoupdate-service/internal:/root/internal haproxy: image: openslides-haproxy-dev volumes: diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 38d6c9f4f..8327e75eb 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,13 +1,5 @@ version: '3' services: - datastore-writer: - build: - context: "https://github.com/OpenSlides/openslides-datastore-service.git" - args: - GIT_CHECKOUT: "${OPENSLIDES_DATASTORE_SERVICE_COMMIT_HASH}" - MODULE: "writer" - PORT: "${OPENSLIDES_DATASTORE_WRITER_PORT}" - image: openslides-datastore-writer datastore-reader: build: context: "https://github.com/OpenSlides/openslides-datastore-service.git" @@ -16,12 +8,67 @@ services: MODULE: "reader" PORT: "${OPENSLIDES_DATASTORE_READER_PORT}" image: openslides-datastore-reader + networks: + - backend + - datastore-postgresql + + datastore-writer: + build: + context: "https://github.com/OpenSlides/openslides-datastore-service.git" + args: + GIT_CHECKOUT: "${OPENSLIDES_DATASTORE_SERVICE_COMMIT_HASH}" + MODULE: "writer" + PORT: "${OPENSLIDES_DATASTORE_WRITER_PORT}" + image: openslides-datastore-writer + networks: + - backend + - datastore-postgresql + - message-bus + + datastore-postgresql: + networks: + - datastore-postgresql + client: build: context: "https://github.com/OpenSlides/openslides-client.git" args: GIT_CHECKOUT: "${OPENSLIDES_CLIENT_COMMIT_HASH}" image: openslides-client + networks: + - frontend + + backend: + networks: + - frontend + - backend + + autoupdate: + networks: + - frontend + - backend + - message-bus + + message-bus: + networks: + - message-bus + haproxy: build: ./haproxy image: openslides-haproxy + networks: + - uplink + - frontend + +# Setup: host <-uplink-> haproxy <-frontend-> services that are reachable from the client <-backend-> services that are internal-only +# There are special networks for some services only, e.g. datastore-postgresql only for the postgresql, datastore reader and datastore writer +networks: + uplink: + frontend: + internal: true + backend: + internal: true + datastore-postgresql: + internal: true + message-bus: + internal: true \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index e5de08742..d76ef91f5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,18 +5,11 @@ services: depends_on: - datastore-postgresql env_file: services.env - networks: - - backend - - datastore-postgresql datastore-writer: depends_on: - datastore-postgresql - message-bus env_file: services.env - networks: - - backend - - datastore-postgresql - - message-bus datastore-postgresql: image: sameersbn/postgresql:10 labels: @@ -25,16 +18,12 @@ services: - DB_USER=openslides - DB_PASS=openslides - DB_NAME=openslides - networks: - - datastore-postgresql # CLIENT client: depends_on: - backend - autoupdate - networks: - - frontend # BACKEND backend: @@ -42,9 +31,6 @@ services: - datastore-reader - datastore-writer env_file: services.env - networks: - - frontend - - backend # AUTOUPDATE autoupdate: @@ -52,16 +38,10 @@ services: - datastore-reader - message-bus env_file: services.env - networks: - - frontend - - backend - - message-bus # SHARED message-bus: image: redis:alpine - networks: - - message-bus # UPLINK haproxy: @@ -71,19 +51,3 @@ services: - autoupdate ports: - "8000:8000" - networks: - - uplink - - frontend - -# Setup: host <-uplink-> haproxy <-frontend-> services that are reachable from the client <-backend-> services that are internal-only -# There are special networks for some services only, e.g. datastore-postgresql only for the postgresql, datastore reader and datastore writer -networks: - uplink: - frontend: - internal: true - backend: - internal: true - datastore-postgresql: - internal: true - message-bus: - internal: true \ No newline at end of file diff --git a/openslides-client b/openslides-client index 453ffe428..b7ed9c98b 160000 --- a/openslides-client +++ b/openslides-client @@ -1 +1 @@ -Subproject commit 453ffe428722da38cc6f06360726089b884d5c35 +Subproject commit b7ed9c98b13dd5f33f8d35a8a0ae9abf60f7ba0a diff --git a/openslides-datastore-service b/openslides-datastore-service index a0d8a2224..b4de8cf33 160000 --- a/openslides-datastore-service +++ b/openslides-datastore-service @@ -1 +1 @@ -Subproject commit a0d8a222429e7efd048730b823a3247d2f44a4ff +Subproject commit b4de8cf3362961fc4a3511ca63fea50308b35bab diff --git a/services.env b/services.env index 7e1335fc6..71a00f2ac 100644 --- a/services.env +++ b/services.env @@ -1,14 +1,13 @@ MESSAGE_BUS_HOST=message-bus MESSAGE_BUS_PORT=6379 -DATASTORE_DATABASE_HOST=datastore-postgresql -# see https://github.com/OpenSlides/openslides-datastore-service/issues/56 - DATASTORE_READER_HOST=datastore-reader DATASTORE_READER_PORT=9010 DATASTORE_WRITER_HOST=datastore-writer DATASTORE_WRITER_PORT=9011 +DATASTORE_DATABASE_HOST=datastore-postgresql + ACTION_HOST=backend ACTION_PORT=9002 PRESENTER_HOST=backend