Skip to content

Commit

Permalink
Merge branch 'main' into initial-data
Browse files Browse the repository at this point in the history
  • Loading branch information
jsangmeister committed Apr 23, 2024
2 parents c450938 + 3de292e commit 8ebff50
Show file tree
Hide file tree
Showing 24 changed files with 304 additions and 152 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test-integration.yml
Expand Up @@ -20,8 +20,8 @@ jobs:
run: |
./setup.sh
sed -i '/x-default-environment/a \ \ DATASTORE_INITIAL_DATA_FILE: cli/example-data.json' docker-compose.yml
docker-compose build --parallel
docker-compose up -d
docker compose build --parallel
docker compose up -d
- name: Wait for dev setup
uses: iFaxity/wait-on-action@v1.1.0
Expand All @@ -31,7 +31,7 @@ jobs:

- name: Setup initial data
working-directory: "./dev/localprod"
run: docker-compose exec -T datastoreWriter python cli/create_initial_data.py
run: docker compose exec -T datastoreWriter python cli/create_initial_data.py

- name: Start tests
working-directory: "./openslides-client"
Expand All @@ -47,4 +47,4 @@ jobs:
- name: Shut down setup
if: always()
working-directory: "./dev/localprod"
run: docker-compose down --volumes --remove-orphans
run: docker compose down --volumes --remove-orphans
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -44,3 +44,4 @@ Authors of OpenSlides in chronological order of first contribution:
Bastian Rihm <brihm@intevation.de>
Abdullah Şevik <a.alveolus@icloud.com>
Loki Elble <loki.elble@intevation.de>
Danny Reichelt <dreichelt@intevation.de>
4 changes: 2 additions & 2 deletions DEVELOPMENT.md
Expand Up @@ -2,9 +2,9 @@

## Requirements

You need git, bash, docker, docker-compose, make and openssl installed.
You need `git`, `bash`, `docker`, `docker compose` (v2), `make` and `openssl` installed.

Go is needed to install https://github.com/FiloSottile/mkcert (but Go is not a requirement to start the development server). The development setup uses HTTPS per default. OpenSlides does not work with HTTP anymore since features are required (like http2) that only work in a secure environment.
`go` is needed to install https://github.com/FiloSottile/mkcert (but it is not a requirement to start the development server). The development setup uses HTTPS per default. OpenSlides does not work with HTTP anymore since features are required (like http2) that only work in a secure environment.

## Before starting the development

Expand Down
22 changes: 11 additions & 11 deletions INSTALL.md
Expand Up @@ -59,8 +59,8 @@ but for most cases this is not recommended.

Then run:

$ docker-compose pull
$ docker-compose up --detach
$ docker compose pull
$ docker compose up --detach

Now all services are starting. Wait until they are ready. Maybe you have to
increase the `--timeout` flag:
Expand Down Expand Up @@ -92,15 +92,15 @@ have several options to achieve this:

To stop the instance, run:

$ docker-compose stop
$ docker compose stop

To remove all containers and networks, run:

$ docker-compose down
$ docker compose down

To remove also the database (and lose all your data), run:

$ docker-compose down --volumes
$ docker compose down --volumes



Expand Down Expand Up @@ -163,7 +163,7 @@ To update to the new version, set the new tag, regenerate the compose file and
apply the changes to the containers:

$ ./openslides config --config my-config.yml .
$ docker-compose up --detach
$ docker compose up --detach

Regenerating the compose file is an important step that should be done for every
update. This will ensure that all services will be provided with all necessary
Expand Down Expand Up @@ -278,15 +278,15 @@ are sufficient for you.

To get a dump of your (PostgreSQL) database, run:

$ docker-compose exec --user postgres postgres pg_dump -U openslides --clean > dump.sql
$ docker compose exec --user postgres postgres pg_dump -U openslides --clean > dump.sql

To restore your dump, shut down your instance if it is running, start only the
postgres container and upload your dump:

$ docker-compose down
$ docker-compose up --detach postgres
$ docker-compose exec --no-TTY --user postgres postgres psql -U openslides < dump.sql
$ docker compose down
$ docker compose up --detach postgres
$ docker compose exec --no-TTY --user postgres postgres psql -U openslides < dump.sql

Then restart your instance:

$ docker-compose up --detach
$ docker compose up --detach
6 changes: 3 additions & 3 deletions Makefile
@@ -1,6 +1,6 @@
DC_PATH=dev/docker
SCRIPT_PATH=dev/scripts
DC=docker-compose -f $(DC_PATH)/docker-compose.dev.yml
DC=docker compose -f $(DC_PATH)/docker-compose.dev.yml

# Main command: start the dev server
run-dev: | build-dev
Expand All @@ -22,13 +22,13 @@ run-service-tests:
# interfering with your dev database
switch-to-test:
$(DC) stop postgres
docker-compose -f $(DC_PATH)/docker-compose.test.yml up -d postgres-test
docker compose -f $(DC_PATH)/docker-compose.test.yml up -d postgres-test
$(DC) -f $(DC_PATH)/docker-compose.backend.yml up -d backend
$(DC) restart datastore-writer datastore-reader autoupdate vote

# Execute while run-dev is running: Switch back to your dev database
switch-to-dev:
docker-compose -f $(DC_PATH)/docker-compose.test.yml stop postgres-test
docker compose -f $(DC_PATH)/docker-compose.test.yml stop postgres-test
$(DC) up -d postgres backend
$(DC) restart datastore-writer datastore-reader autoupdate vote

Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
4.1.3
4.1.7-dev
4 changes: 2 additions & 2 deletions dev/localprod/README.md
Expand Up @@ -18,7 +18,7 @@ the `config.yml`.

Now run

docker-compose up --build
docker compose up --build

This will add the superadmin account with the password provided from
`secrets/superadmin`.
Expand All @@ -37,4 +37,4 @@ default username (`superadmin`) and your chosen password.

To clear the database, run

docker-compose down --volumes
docker compose down --volumes
4 changes: 2 additions & 2 deletions dev/scripts/README.md
Expand Up @@ -17,8 +17,8 @@ Shorthand to get to a psql shell inside the postgres container.
## `dc-dev.sh`

Shorthand script to not have to type out the whole docker compose command every time one wants to
access a container. Is not a standalone program - supply docker compose commmand and options as args
as you would to `docker-compose`.
access a container. It is not a standalone program - supply docker compose commmand and options as args
as you would to `docker compose`.

## `export-ds.sh`

Expand Down
2 changes: 1 addition & 1 deletion dev/scripts/db.sh
@@ -1,3 +1,3 @@
#!/bin/bash
cd "$(dirname $0)"
docker-compose -f ../docker/docker-compose.dev.yml exec datastore-writer psql postgresql://openslides:openslides@postgres/openslides
docker compose -f ../docker/docker-compose.dev.yml exec datastore-writer psql postgresql://openslides:openslides@postgres/openslides
2 changes: 1 addition & 1 deletion dev/scripts/dc-dev.sh
@@ -1,3 +1,3 @@
#!/bin/bash
cd "$(dirname $0)"
docker-compose -f ../docker/docker-compose.dev.yml $@
docker compose -f ../docker/docker-compose.dev.yml $@
7 changes: 4 additions & 3 deletions dev/scripts/set-ds.sh
Expand Up @@ -4,7 +4,8 @@ set -e
cd "$(dirname $0)"

# first argument is the example data
DATA=$(cat ${1:-../../openslides-backend/global/data/example-data.json})
DATA=${1:-../../openslides-backend/global/data/example-data.json}
./clear-ds.sh
docker-compose -f ../docker/docker-compose.dev.yml exec datastore-writer \
bash -c "source export-database-variables.sh; echo '$DATA' > /data.json; export DATASTORE_INITIAL_DATA_FILE=/data.json; python cli/create_initial_data.py"
docker compose -f ../docker/docker-compose.dev.yml cp $DATA datastore-writer:/data.json
docker compose -f ../docker/docker-compose.dev.yml exec datastore-writer \
bash -c "source export-database-variables.sh; export DATASTORE_INITIAL_DATA_FILE=/data.json; python cli/create_initial_data.py"

0 comments on commit 8ebff50

Please sign in to comment.