Skip to content

Commit

Permalink
chore: refactor start-stack (DEV-2397) (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Jun 29, 2023
1 parent 70b38b0 commit 679a267
Show file tree
Hide file tree
Showing 6 changed files with 305 additions and 134 deletions.
12 changes: 8 additions & 4 deletions docs/developers/start-stack-command.md
Expand Up @@ -8,12 +8,16 @@ in the version that is running on [https://admin.dasch.swiss](https://admin.dasc
In addition to the containers,
a number of files from the DSP-API GitHub repository is necessary.
The version of the docker images and these files must be the same.
The version is hardcoded at the following places in the code:
The version is configured in the following files in `src/dsp_tools/resources/start-stack/`:

- `src/dsp_tools/docker/docker-compose.yml`:
- `docker-compose.yml`:
The 4 variables `services/{app,db,sipi,api}/image`
must point to the DockerHub image of the last deployed version.
- `src/dsp_tools/utils/stack_handling.py`:
The variable `commit_of_used_api_version`
The versions can be found in the
[ops-deploy repo](https://github.com/dasch-swiss/ops-deploy/blob/main/roles/dsp-deploy/files/RELEASE.json)
- `start-stack-config.yml`:
The variable `DSP-API commit`
must be the commit hash of DSP-API
of the version that is running on [https://admin.dasch.swiss](https://admin.dasch.swiss/help).
Just take the commit hash of the latest DSP-API release
from the [DSP-API GitHub repo](https://github.com/dasch-swiss/dsp-api/commits/main)
13 changes: 12 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion pyproject.toml
Expand Up @@ -34,6 +34,7 @@ networkx = "^3.1.0"
pandas = { version = "^2.0.1", extras = ["excel"] } # extra package that contains xlrd that is necessary for reading old .xls Excel files
regex = "^2023.5.5"
docker = "^6.1.2"
pyyaml = "^6.0"


[tool.poetry.group.dev.dependencies]
Expand All @@ -50,6 +51,7 @@ types-jsonschema = "^4.17.0.8"
types-openpyxl = "^3.1.0.7"
types-regex = "^2023.5.5.0"
pre-commit = "^3.3.3"
types-pyyaml = "^6.0.12.10"


[tool.poetry.scripts]
Expand All @@ -63,7 +65,8 @@ check-links = """
markdown-link-validator \
./docs \
-i \\.\\/assets\\/.+ \
-i .+github\\.com\\/dasch\\-swiss\\/dsp-tools\\/settings\
-i .+github\\.com\\/dasch\\-swiss\\/dsp-tools\\/settings \
-i .+github\\.com\\/dasch\\-swiss\\/ops-deploy\\/.+
"""


Expand Down
8 changes: 5 additions & 3 deletions src/dsp_tools/dsp_tools.py
Expand Up @@ -24,7 +24,7 @@
from dsp_tools.utils.project_validate import validate_project
from dsp_tools.utils.rosetta import upload_rosetta
from dsp_tools.utils.shared import validate_xml_against_schema
from dsp_tools.utils.stack_handling import start_stack, stop_stack
from dsp_tools.utils.stack_handling import StackHandling
from dsp_tools.utils.xml_upload import xml_upload

logger = get_logger(__name__)
Expand Down Expand Up @@ -433,13 +433,15 @@ def call_requested_action(
default_ontology=args.ontology_name,
)
elif args.action == "start-stack":
success = start_stack(
stack_handler = StackHandling()
success = stack_handler.start_stack(
max_file_size=args.max_file_size,
enforce_docker_system_prune=args.prune,
suppress_docker_system_prune=args.no_prune,
)
elif args.action == "stop-stack":
success = stop_stack()
stack_handler = StackHandling()
success = stack_handler.stop_stack()
elif args.action == "template":
success = generate_template_repo()
elif args.action == "rosetta":
Expand Down
4 changes: 4 additions & 0 deletions src/dsp_tools/resources/start-stack/start-stack-config.yml
@@ -0,0 +1,4 @@
---

# take commit hash of latest DSP-API release from https://github.com/dasch-swiss/dsp-api/commits/main
DSP-API commit: e3a19dd975425ca75fca9f5841952fa9429837a7

0 comments on commit 679a267

Please sign in to comment.