From 6846b2ab9178b2b5646707b4dfe87f63d590554f Mon Sep 17 00:00:00 2001 From: Sean Engelhardt Date: Wed, 17 Nov 2021 23:32:40 +0100 Subject: [PATCH] Add vote service to OS4 setup Integrate vote service, makes according changes to configuration Updates the client to integrate the vote service Updates the backend to integrate the vote service --- .gitmodules | 4 +++ Makefile | 5 ++++ docker/build.sh | 1 + docker/docker-compose.dev.yml | 24 ++++++++++++++++ docker/services.env | 8 ++++++ openslides-backend | 2 +- openslides-client | 2 +- openslides-vote-service | 1 + proxy/caddy_base.json | 54 +++++++++++++++++------------------ proxy/entrypoint | 1 + 10 files changed, 72 insertions(+), 30 deletions(-) create mode 160000 openslides-vote-service diff --git a/.gitmodules b/.gitmodules index ee68e6aee..161fe2271 100644 --- a/.gitmodules +++ b/.gitmodules @@ -30,3 +30,7 @@ path = openslides-icc-service url = https://github.com/OpenSlides/openslides-icc-service.git branch = main +[submodule "openslides-vote-service"] + path = openslides-vote-service + url = https://github.com/OpenSlides/openslides-vote-service.git + branch = main \ No newline at end of file diff --git a/Makefile b/Makefile index 09d9c87fa..8acb01b2d 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,11 @@ services-to-master: # [1] ...or main, or whatever branch the OS4 one is. See .gitmodules. git submodule foreach -q --recursive 'git checkout $(git config -f $$toplevel/.gitmodules submodule.$$name.branch || echo master); git pull upstream $$(git config -f $$toplevel/.gitmodules submodule.$$name.branch || echo master)' +submodules-origin-to-upstream: + # You may only use this one time after cloning this repository. + # Will set the upstream remote to "origin" + git submodule foreach -q --recursive 'git remote rename origin upstream' + cypress-open: cd integration; npm run cypress:open diff --git a/docker/build.sh b/docker/build.sh index 79d752bc6..1da4d254c 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -14,6 +14,7 @@ TARGETS=( [datastore-reader]="$HOME/../openslides-datastore-service/reader" [datastore-writer]="$HOME/../openslides-datastore-service/writer" [media]="$HOME/../openslides-media-service/" + [vote]="$HOME/../openslides-vote-service/" #[pgbouncer]="https://github.com/OpenSlides/openslides-docker-compose.git#:pgbouncer" #[postfix]="https://github.com/OpenSlides/openslides-docker-compose.git#:postfix" #[repmgr]="https://github.com/OpenSlides/openslides-docker-compose.git#:repmgr" diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml index 7799b780f..c305944bd 100644 --- a/docker/docker-compose.dev.yml +++ b/docker/docker-compose.dev.yml @@ -151,3 +151,27 @@ services: driver: "none" # disable saving logs ports: - "8025:8025" # web ui to check mails manually + + vote: + image: openslides-vote-dev + depends_on: + - auth + - message-bus + - datastore-reader + - postgres + environment: + - OPENSLIDES_DEVELOPMENT=true + - VOTE_HOST=vote + - VOTE_PORT=9013 + - DATASTORE_READER_HOST=datastore-reader + - MESSAGING=redis + - MESSAGE_BUS_HOST=message-bus + - VOTE_REDIS_HOST=cache + - VOTE_DATABASE_HOST=postgres + - VOTE_DATABASE_USER=openslides + - VOTE_DATABASE_PASSWORD=openslides + - VOTE_DATABASE_NAME=openslides + - AUTH=ticket + - AUTH_HOST=auth + ports: + - "9013:9013" diff --git a/docker/services.env b/docker/services.env index 1755ac55d..8d83dfa98 100644 --- a/docker/services.env +++ b/docker/services.env @@ -32,3 +32,11 @@ MEDIA_DATABASE_NAME=openslides MANAGE_HOST=manage MANAGE_PORT=9008 + +VOTE_HOST=vote +VOTE_PORT=9013 +VOTE_REDIS_HOST=cache +VOTE_DATABASE_HOST=postgres +VOTE_DATABASE_USER=openslides +VOTE_DATABASE_PASSWORD=openslides +VOTE_DATABASE_NAME=openslides \ No newline at end of file diff --git a/openslides-backend b/openslides-backend index 98055f773..7ff8bdbde 160000 --- a/openslides-backend +++ b/openslides-backend @@ -1 +1 @@ -Subproject commit 98055f773558121a11f5e0a5cd358fe8dc4a69c4 +Subproject commit 7ff8bdbde45f0d816dd9e471fe1bb650e8937cd0 diff --git a/openslides-client b/openslides-client index b9aa7037f..7db47d666 160000 --- a/openslides-client +++ b/openslides-client @@ -1 +1 @@ -Subproject commit b9aa7037fbc723a65674a636c665c69a9966c0d4 +Subproject commit 7db47d666ac1ef4289f427d1007c3fd23776c9df diff --git a/openslides-vote-service b/openslides-vote-service new file mode 160000 index 000000000..b0a9acaff --- /dev/null +++ b/openslides-vote-service @@ -0,0 +1 @@ +Subproject commit b0a9acaff79c76e7defcd5cec8b9e9ba4b7de48a diff --git a/proxy/caddy_base.json b/proxy/caddy_base.json index e1712b7df..b1fcb6be9 100644 --- a/proxy/caddy_base.json +++ b/proxy/caddy_base.json @@ -21,9 +21,7 @@ "http": { "servers": { "srv0": { - "listen": [ - ":8000" - ], + "listen": [":8000"], "allow_h2c": true, "routes": [ { @@ -40,9 +38,7 @@ ], "match": [ { - "path": [ - "/system/autoupdate*" - ] + "path": ["/system/autoupdate*"] } ] }, @@ -59,9 +55,7 @@ ], "match": [ { - "path": [ - "/system/presenter*" - ] + "path": ["/system/presenter*"] } ] }, @@ -78,9 +72,7 @@ ], "match": [ { - "path": [ - "/system/action*" - ] + "path": ["/system/action*"] } ] }, @@ -97,9 +89,7 @@ ], "match": [ { - "path": [ - "/system/media*" - ] + "path": ["/system/media*"] } ] }, @@ -116,9 +106,7 @@ ], "match": [ { - "path": [ - "/system/auth*" - ] + "path": ["/system/auth*"] } ] }, @@ -136,9 +124,7 @@ ], "match": [ { - "path": [ - "/system/icc*" - ] + "path": ["/system/icc*"] } ] }, @@ -149,10 +135,7 @@ "flush_interval": -1, "transport": { "protocol": "http", - "versions": [ - "2", - "h2c" - ] + "versions": ["2", "h2c"] }, "upstreams": [ { @@ -164,13 +147,28 @@ "match": [ { "header": { - "Content-Type": [ - "application/grpc" - ] + "Content-Type": ["application/grpc"] } } ] }, + { + "handle": [ + { + "handler": "reverse_proxy", + "upstreams": [ + { + "dial": "$VOTE_HOST:$VOTE_PORT" + } + ] + } + ], + "match": [ + { + "path": ["/system/vote*"] + } + ] + }, { "handle": [ { diff --git a/proxy/entrypoint b/proxy/entrypoint index 55ec66ee2..9d31956df 100755 --- a/proxy/entrypoint +++ b/proxy/entrypoint @@ -16,6 +16,7 @@ AUTH_HOST="${AUTH_HOST:-auth}" AUTH_PORT="${AUTH_PORT:-9004}" \ MEDIA_HOST="${MEDIA_HOST:-media}" MEDIA_PORT="${MEDIA_PORT:-9006}" \ MANAGE_HOST="${MANAGE_HOST:-manage}" MANAGE_PORT="${MANAGE_PORT:-9008}" \ CLIENT_HOST="${CLIENT_HOST:-client}" CLIENT_PORT="${CLIENT_PORT:-9001}" \ +VOTE_HOST="${VOTE_HOST:-vote}" VOTE_PORT="${VOTE_PORT:-9013}" \ envsubst < "$base" > "$base.out" && mv -f "$base.out" "$base" jq_write() {