Marine data catalog for internal usage at IPMA
-
Clone this repo
-
Make a symlink to the directory where you have your sample data into a
sample-datadirectory under the root of the project - For example:# assuming your sample-data directory lives at `~/my-seis-lab-data-sample-data` ln -s ~/my-seis-lab-data-sample-data sample-data
-
Create a Python virtualenv and install the project dependencies into it with:
cd seis-lab-data uv sync --group dev --locked -
Install the included pre-commit hooks:
uv run pre-commit install
-
Setup your favorite IDE for working on the project
-
Launch the services with docker compose:
docker compose -f docker/compose.dev.yaml up -d
-
Ensure the database is up to date by running:
docker compose -f docker/compose.dev.yaml exec -ti webapp uv run seis-lab-data db upgrade -
Add default data:
docker compose -f docker/compose.dev.yaml exec -ti webapp uv run seis-lab-data bootstrap all -
Optionally, load sample records into the DB:
docker compose -f docker/compose.dev.yaml exec -ti webapp uv run seis-lab-data dev load-all-samples -
You should now be able to access the webapp at
-
Additional relevant URLs:
- http://localhost:8887 - the traefik dashboard
- http://localhost:8887/auth/ - the authentik landing page
Note
Most of the time you will be using a prebuilt docker image. However, there is a special case where you will need to build it locally. This case is when you add a new python dependency to the project. In this case, build the image with:
docker build \
--tag ghcr.io/naturalgis/seis-lab-data/seis-lab-data:$(git branch --show-current) \
--file docker/Dockerfile \
.Then stand up the docker compose stack with:
CURRENT_GIT_BRANCH=$(git branch --show-current) docker compose -f docker/compose.dev.yaml up -d --force-recreateNote
Because the docker compose file used for dev bind mounts the entire src directory, it will
mask the container's own compiled *.mo files. This means that after running
seis-lab-data translations compile you need to restart the webapp service for the changes to take effect.
Normal tests can be run from inside the webapp compose container, after installing the required dependencies:
docker compose --file docker/compose.dev.yaml exec webapp uv sync --locked --group dev
docker compose --file docker/compose.dev.yaml exec webapp uv run pytestIntegration tests can be run with the following incantation:
docker compose --file docker/compose.dev.yaml exec webapp uv run pytest -m integrationEnd to end tests are run from outside the docker stack. They require that playwright is installed locally. You can do this with:
uv run playwright install --with-deps chromiumThen tests can be run with:
uv run pytest \
tests/e2e/ \
-m e2e \
--confcutdir tests/e2e \
--user-email [email protected] \
--user-password admin123 \
--base-url http://localhost:8888The previous incantation will run all end to end tests in headless mode. To run them in headed mode, you can use:
uv run pytest \
tests/e2e/ \
-m e2e \
--confcutdir tests/e2e \
--user-email [email protected] \
--user-password admin123 \
--base-url http://localhost:8888 \
--headed \
--slowmo 1500Note
Run an interactive shell with ipython. Start the browser in headed mode:
# when using ipython, playwright must be used in async mode
from playwright.async_api import (
async_playwright,
expect,
)
async with async_playwright() as p:
browser = await p.chromium.launch(headless=False, slow_mo=1500)
page = await browser.new_page()
await page.goto("http://localhost:8888")