Skip to content

Commit

Permalink
Set various remote path to main (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsiegleauq committed Feb 10, 2022
1 parent 844d7b1 commit b66f160
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Since 2011 Authors of OpenSlides, see https://github.com/OpenSlides/OpenSlides/blob/master/AUTHORS
Copyright (c) Since 2011 Authors of OpenSlides, see https://github.com/OpenSlides/OpenSlides/blob/main/AUTHORS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion dc.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
environment:
- OPENSLIDES_DEVELOPMENT=1
- COMMAND=create_initial_data
- DATASTORE_INITIAL_DATA_FILE=https://raw.githubusercontent.com/OpenSlides/OpenSlides/master/docs/example-data.json
- DATASTORE_INITIAL_DATA_FILE=https://raw.githubusercontent.com/OpenSlides/OpenSlides/main/docs/example-data.json
depends_on:
- postgresql
- redis
Expand Down
6 changes: 3 additions & 3 deletions dc.external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'
services:
reader:
build:
context: "https://github.com/OpenSlides/openslides-datastore-service.git"
context: "https://github.com/OpenSlides/openslides-datastore-service.git#main"
dockerfile: Dockerfile
args:
MODULE: "reader"
Expand All @@ -19,7 +19,7 @@ services:
- postgresql
writer:
build:
context: "https://github.com/OpenSlides/openslides-datastore-service.git"
context: "https://github.com/OpenSlides/openslides-datastore-service.git#main"
dockerfile: Dockerfile
args:
MODULE: "writer"
Expand All @@ -30,7 +30,7 @@ services:
environment:
- OPENSLIDES_DEVELOPMENT=1
- COMMAND=create_initial_data
- DATASTORE_INITIAL_DATA_FILE=https://raw.githubusercontent.com/OpenSlides/OpenSlides/master/docs/example-data.json
- DATASTORE_INITIAL_DATA_FILE=https://raw.githubusercontent.com/OpenSlides/OpenSlides/main/docs/example-data.json
depends_on:
- postgresql
- redis
Expand Down
6 changes: 3 additions & 3 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ If you want to do system tests in your service and need the datastore, use the `

You can issue commands to the datastore on startup via the docker variable `COMMAND` (has to be given as a build argument to the docker file). Currently only commands for the writer are supported.

- `create_initial_data`: this will load the file given in the environment variable `DATASTORE_INITIAL_DATA_FILE`, which may be a relative or absolute path to a file inside the docker container or an URL to a web resource (e.g. the [OpenSlides 4 example data](https://raw.githubusercontent.com/OpenSlides/openslides-backend/master/global/data/example-data.json)) and write it to the datastore. If any data is present already, the command will fail. Note that if a path is given, the respective file has to be mounted to this place in the container; if an URL is given, the internet has to be accessible from inside the docker container (which means that in a setup with isolated networks e.g. as in the main repository, this option will not work).
- `create_initial_data`: this will load the file given in the environment variable `DATASTORE_INITIAL_DATA_FILE`, which may be a relative or absolute path to a file inside the docker container or an URL to a web resource (e.g. the [OpenSlides 4 example data](https://raw.githubusercontent.com/OpenSlides/openslides-backend/main/global/data/example-data.json)) and write it to the datastore. If any data is present already, the command will fail. Note that if a path is given, the respective file has to be mounted to this place in the container; if an URL is given, the internet has to be accessible from inside the docker container (which means that in a setup with isolated networks e.g. as in the main repository, this option will not work).

Another possibility is to provide `initial-data:` as prefix followed by JSON encoded data as value of that environment variable if you do not want to provide a web ressource or mount a file into the container.

The script is also available from inside the container under `cli/create_initial_data.py`. Example setup to load initial data:

- set `COMMAND=create_initial_data` and `DATASTORE_INITIAL_DATA_FILE=https://raw.githubusercontent.com/OpenSlides/openslides-backend/master/global/data/example-data.json` <b>inside the docker container</b>, e.g. in your `docker-compose` file.
- set `COMMAND=create_initial_data` and `DATASTORE_INITIAL_DATA_FILE=https://raw.githubusercontent.com/OpenSlides/openslides-backend/main/global/data/example-data.json` <b>inside the docker container</b>, e.g. in your `docker-compose` file.

This will not work if the database is not empty. In this case, you can make use of the `truncate_db` route (see below). Example:

make run-dev
curl --header "Content-Type: application/json" -d '' http://localhost:9011/internal/datastore/writer/truncate_db
docker-compose -f dc.dev.yml exec writer ./entrypoint.sh bash
export DATASTORE_INITIAL_DATA_FILE=https://raw.githubusercontent.com/OpenSlides/openslides-backend/master/global/data/example-data.json
export DATASTORE_INITIAL_DATA_FILE=https://raw.githubusercontent.com/OpenSlides/openslides-backend/main/global/data/example-data.json
python cli/create_initial_data.py
exit

Expand Down

0 comments on commit b66f160

Please sign in to comment.