Skip to content

Commit

Permalink
Change initial data creation (#6755)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsangmeister committed Apr 24, 2024
1 parent e351e21 commit 33575b5
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 33 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/test-integration.yml
Expand Up @@ -12,14 +12,21 @@ jobs:
with:
submodules: recursive

- name: Copy example data
run: cp openslides-backend/global/data/example-data.json openslides-datastore-service/cli/
- name: Build local openslides tool
working-directory: "./openslides-manage-service"
run: |
go build ./cmd/openslides
cp openslides ../dev/localprod/.
- name: Use example data instead of initial data
working-directory: "./openslides-backend/global/data/"
run: cp example-data.json initial-data.json

- name: Start setup
working-directory: "./dev/localprod"
run: |
./setup.sh
sed -i '/x-default-environment/a \ \ DATASTORE_INITIAL_DATA_FILE: cli/example-data.json' docker-compose.yml
echo -n "admin" > secrets/superadmin
docker compose build --parallel
docker compose up -d
Expand All @@ -29,10 +36,6 @@ jobs:
resource: https://localhost:8000
timeout: 30000

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

- name: Start tests
working-directory: "./openslides-client"
run: make run-playwright
Expand Down
13 changes: 3 additions & 10 deletions INSTALL.md
Expand Up @@ -62,18 +62,11 @@ Then run:
$ docker compose pull
$ docker compose up --detach


### Initialize database

Now all services are starting. Wait until they are ready. Maybe you have to
increase the `--timeout` flag:

$ ./openslides check-server

Then initialize database:

$ ./openslides initial-data

Now open https://localhost:8000, login with superuser credentials (default
username and password: `superadmin`) and have fun.

Expand Down Expand Up @@ -225,16 +218,16 @@ setup configuration YAML file.

enableLocalHTTPS: false

Note, that some commands of the manage tool require the `--no-ssl` flag when SSL encryption is disbaled, e.g:
Note, that some commands of the manage tool require the `--no-ssl` flag when SSL encryption is disabled, e.g:

$ ./openslides initial-data --no-ssl
$ ./openslides create-user --no-ssl

To find out, which commands require the `--no-ssl` flag use the commands help:
To find out which commands require the `--no-ssl` flag use the commands help:

$ ./openslides <COMMAND> -h

If you run OpenSlides behind a publicly accessible domain, you can use caddys
If you run OpenSlides behind a publicly accessible domain, you can use caddy's
integrated certificate retrieval. Add the following lines to your setup
configuration YAML file and of course use your own domain instead of the
example:
Expand Down
4 changes: 1 addition & 3 deletions dev/docker/docker-compose.dev.yml
Expand Up @@ -23,10 +23,7 @@ services:
volumes:
- ../../openslides-datastore-service/datastore:/app/datastore
- ../../openslides-datastore-service/cli:/app/cli
- ../../openslides-backend/global/data:/app/data
environment:
- COMMAND=create_initial_data
- DATASTORE_INITIAL_DATA_FILE=/app/data/example-data.json
- OPENSLIDES_DEVELOPMENT=1
ports:
- 9011:9011
Expand Down Expand Up @@ -70,6 +67,7 @@ services:
- EMAIL_TIMEOUT=5
- EMAIL_ACCEPT_SELF_SIGNED_CERTIFICATE=false
- DEFAULT_FROM_EMAIL=noreply@example.com
- OPENSLIDES_BACKEND_CREATE_INITIAL_DATA=1
volumes:
- ../../openslides-backend/openslides_backend:/app/openslides_backend
- ../../openslides-backend/tests:/app/tests
Expand Down
16 changes: 6 additions & 10 deletions dev/localprod/README.md
Expand Up @@ -20,6 +20,9 @@ Now run

docker compose up --build

This will add the superadmin account with the password provided from
`secrets/superadmin`.

If you run into problems, they may be related to a newer docker(-compose)
version. Try running the following before running the build command again:

Expand All @@ -29,16 +32,9 @@ version. Try running the following before running the build command again:
If this fixes the problem, consider adding it to your `.bashrc` or similar to
not have to re-export it every time.

After all services are up initial data needs to be set to be able to login.
In a different terminal run

./openslides initial-data

This will add the superadmin account with the password provided from
`secrets/superadmin` (default: superadmin)

Access https://localhost:8000/ as you would expect.
Finally, access https://localhost:8000/ as you would expect and login with the
default username (`superadmin`) and your chosen password.

To clear the database run
To clear the database, run

docker compose down --volumes
2 changes: 2 additions & 0 deletions dev/localprod/config.yml
Expand Up @@ -19,6 +19,8 @@ services:
backendManage:
additionalContent:
build: ../../openslides-backend/
environment:
OPENSLIDES_BACKEND_CREATE_INITIAL_DATA: 1
datastoreReader:
additionalContent: {
build: {
Expand Down

0 comments on commit 33575b5

Please sign in to comment.