From e9357b2c106cac84d4021d52bb1b06886512b405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 24 Apr 2021 10:20:12 +0200 Subject: [PATCH 1/3] New production setup with Docker Compose Updated openslides-manage-service and changed README.md Added GitHub workflow. --- .github/workflows/build_images.yml | 79 ++++++++++++++++++++++++++++++ README.md | 69 +++++++++++++++----------- openslides-manage-service | 2 +- 3 files changed, 120 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/build_images.yml diff --git a/.github/workflows/build_images.yml b/.github/workflows/build_images.yml new file mode 100644 index 000000000..5046d16a9 --- /dev/null +++ b/.github/workflows/build_images.yml @@ -0,0 +1,79 @@ +--- +name: Build Docker images for all OpenSlides services +on: push +env: + IMAGE_VERSION: 4.0.0-dev +jobs: + build: + name: Builds Docker images + runs-on: ubuntu-latest + strategy: + matrix: + service: + - name: openslides-proxy + directory: proxy + + - name: openslides-client + directory: openslides-client + + - name: openslides-backend + directory: openslides-backend + + - name: openslides-datastore-reader + directory: openslides-datastore-service + args: + MODULE: reader + PORT: 9010 + + - name: openslides-datastore-writer + directory: openslides-datastore-service + args: + MODULE: writer + PORT: 9011 + + - name: openslides-autoupdate + directory: openslides-autoupdate-service + + - name: openslides-auth + directory: openslides-auth-service + + - name: openslides-media + directory: openslides-media-service + + - name: openslides-manage + directory: openslides-manage-service + + - name: openslides-permission + directory: openslides-permission-service + + steps: + - name: Check out code + uses: actions/checkout@v2 + with: + submodules: true + + - name: Build image + working-directory: ${{ matrix.service.directory }} + env: + DOCKER_BUILDKIT=1 + run: | + if [ ${{ matrix.service.args }} != "" ] + then + export BUILD_ARGS="--build-arg MODULE=${{ matrix.service.args.MODULE }} + --build-arg PORT=${{ matrix.service.args.PORT }}" + fi + docker build . --tag ${{ matrix.service.name }} $BUILD_ARGS + + - name: Log into registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | + docker login docker.pkg.github.com --username ${{ github.actor }} --password-stdin + + - name: Push image + run: | + IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/${{ matrix.service.name }} + + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + + docker tag ${{ matrix.service.name }} $IMAGE_ID:$IMAGE_VERSION + docker push $IMAGE_ID:$IMAGE_VERSION diff --git a/README.md b/README.md index bbc145129..0abce5ae9 100644 --- a/README.md +++ b/README.md @@ -8,50 +8,61 @@ https://openslides.com for more information. __Note: OpenSlides 4 is currently under development.__ -### Architecture of OpenSlides 4 + +## Architecture of OpenSlides 4 ![System architecture of OpenSlides 4](docs/OpenSlides4-systemarchitecture.png) - Read more about our [concept of OpenSlides 4.0](https://github.com/OpenSlides/OpenSlides/wiki/DE%3A-Konzept-OpenSlides-4). ## Installation -NOTE: Do not use prod at the moment. It will not work. Please refer to the DEVELOPMENT.md! +### Requirements -Required software: Docker, docker-compose, make, git +You need [Docker](https://docs.docker.com/engine/install/) and [Docker +Compose](https://docs.docker.com/compose/install/). -For a non-development setup, clone this repo and run it via docker compose. The make command is a handy shortcut for this: +### Setup OpenSlides - $ git clone git@github.com:OpenSlides/OpenSlides.git - $ cd OpenSlides - $ git checkout openslides4-dev # needed, until OS4 is released - $ make run-prod +Go to a nice place in your filesystem and get the [OpenSlides manage +tool](https://github.com/OpenSlides/openslides-manage-service/releases/tag/latest). + +Create configuration files: + + $ ./manage setup --cwd # TODO: Provide instruction using XDG_DATA_PATH. + +Build and start Docker containers. According to your Docker installation you may +have to run this as root: + + $ docker-compose up --build --detach + +Setup initial-data: + + $ ./manage initial-data + +Now you can open http://localhost:8000 and use OpenSlides. + +To stop OpenSlides run: + + $ docker-compose stop + +To remove all containers including the complete database run: + + $ docker-compose rm + + +## Installation with ... + +TODO: Provide a short instruction for setup with Docker Swarm or Kubernetes or +something else. + + +## Development setup For a development setup, refer to [the development docs](DEVELOPMENT.md) -## Productive environment - -Setup the repository (may be already done) - - $ git clone git@github.com:OpenSlides/OpenSlides.git - $ cd OpenSlides - $ git checkout openslides4-dev - $ git submodule update --init - -Prod setup. `./build.sh` may take a while. - - $ cd docker - $ m4 docker-compose.yml.m4 > docker-compose.yml - $ ./build.sh - $ ./setup-prod.sh - $ docker-compose up - -Navigate to https://localhost:8000 - - ## Used software OpenSlides uses the following projects or parts of them: diff --git a/openslides-manage-service b/openslides-manage-service index 6ab94da8d..2982c8880 160000 --- a/openslides-manage-service +++ b/openslides-manage-service @@ -1 +1 @@ -Subproject commit 6ab94da8debbd0367a34f173ccc1ddee5a701863 +Subproject commit 2982c8880184cfab59a9792e79c62435ffc46f8d From b4a034d900ca79d3b8cacf56b130a5f15c3b0c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Fri, 30 Apr 2021 11:19:21 +0200 Subject: [PATCH 2/3] Switched to GitHub Container Registry. --- .github/workflows/build_images.yml | 8 ++++---- .github/workflows/models.yml | 6 ++++-- README.md | 2 +- openslides-manage-service | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_images.yml b/.github/workflows/build_images.yml index 5046d16a9..5b061f316 100644 --- a/.github/workflows/build_images.yml +++ b/.github/workflows/build_images.yml @@ -55,9 +55,9 @@ jobs: - name: Build image working-directory: ${{ matrix.service.directory }} env: - DOCKER_BUILDKIT=1 + DOCKER_BUILDKIT: 1 run: | - if [ ${{ matrix.service.args }} != "" ] + if [ "${{ matrix.service.args }}" != "" ] then export BUILD_ARGS="--build-arg MODULE=${{ matrix.service.args.MODULE }} --build-arg PORT=${{ matrix.service.args.PORT }}" @@ -66,11 +66,11 @@ jobs: - name: Log into registry run: echo "${{ secrets.GITHUB_TOKEN }}" | - docker login docker.pkg.github.com --username ${{ github.actor }} --password-stdin + docker login ghcr.io --username ${{ github.actor }} --password-stdin - name: Push image run: | - IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/${{ matrix.service.name }} + IMAGE_ID=ghcr.io/${{ github.repository }}/${{ matrix.service.name }} # Change all uppercase to lowercase IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') diff --git a/.github/workflows/models.yml b/.github/workflows/models.yml index 874cb7c43..c9c28f56c 100644 --- a/.github/workflows/models.yml +++ b/.github/workflows/models.yml @@ -1,7 +1,9 @@ -name: Validate models.yml +--- +name: Validate models.yml and initial and example data on: [push, pull_request] env: PYTHON_VERSION: 3.8.5 + GO_VERSION: 1.15 jobs: validate-models: name: Validate models.yml @@ -10,7 +12,7 @@ jobs: - name: Set up Go 1.15 uses: actions/setup-go@v1 with: - go-version: 1.15 + go-version: ${{ env.GO_VERSION }} - name: Check out code uses: actions/checkout@v2 diff --git a/README.md b/README.md index 0abce5ae9..0779c268d 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Create configuration files: Build and start Docker containers. According to your Docker installation you may have to run this as root: - $ docker-compose up --build --detach + $ docker-compose up --detach Setup initial-data: diff --git a/openslides-manage-service b/openslides-manage-service index 2982c8880..d1bd16193 160000 --- a/openslides-manage-service +++ b/openslides-manage-service @@ -1 +1 @@ -Subproject commit 2982c8880184cfab59a9792e79c62435ffc46f8d +Subproject commit d1bd161936e304c18336e3c1cc94609c8b39e952 From e99eb0bf0b133b1a2d43d8a0c22103eec1e7c4c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 1 May 2021 11:15:03 +0200 Subject: [PATCH 3/3] Review --- .github/workflows/models.yml | 4 ++-- README.md | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/models.yml b/.github/workflows/models.yml index c9c28f56c..41c3e2c25 100644 --- a/.github/workflows/models.yml +++ b/.github/workflows/models.yml @@ -3,13 +3,13 @@ name: Validate models.yml and initial and example data on: [push, pull_request] env: PYTHON_VERSION: 3.8.5 - GO_VERSION: 1.15 + GO_VERSION: 1.16 jobs: validate-models: name: Validate models.yml runs-on: ubuntu-latest steps: - - name: Set up Go 1.15 + - name: Set up Go uses: actions/setup-go@v1 with: go-version: ${{ env.GO_VERSION }} diff --git a/README.md b/README.md index 0779c268d..c5e5daa5b 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,12 @@ Compose](https://docs.docker.com/compose/install/). ### Setup OpenSlides -Go to a nice place in your filesystem and get the [OpenSlides manage -tool](https://github.com/OpenSlides/openslides-manage-service/releases/tag/latest). +Go to a nice place in your filesystem, get the [OpenSlides manage +tool](https://github.com/OpenSlides/openslides-manage-service/releases/tag/latest) +from GitHub and make it executable. E. g. run: + + $ wget https://github.com/OpenSlides/openslides-manage-service/releases/download/latest/manage + $ chmod +x manage Create configuration files: