-
Notifications
You must be signed in to change notification settings - Fork 0
Description
ITDE has an API for spawning a DockerDB:
Port-Forwards won't work with DockerDB Image of the AI-Lab.
Users might want to configure the parameters:
db_mem_size: str = "2 GiB",
db_disk_size: str = "2 GiB",
nameserver: Tuple[str, ...] = tuple(),
create_certificates: bool = False,
additional_db_parameter: Tuple[str, ...] = tuple(), # Maybe hidden
The API returns an EnvironmentInfo object, besides other things. The EnvironmentInfo object contains IP and Ports of the DB and the DB Credentials.
The bucketfs credentials are hard-coded to r:read and w:write.
What happens, if the user runs the start ITDE again. For example, he stopped all docker containers and restart them now.
We need to check during connect if the docker-db is running and, if not, start it. When the user uses the function for initial start, we need a warning that this will create a new docker-db and that data will get lost. The user confirms this before we proceed.
Checking if the dockerdb is running:
The EnvironmentInfo contains a DatabaseInfo which contains a ContainerInfo with the name of the docker container of the DB. We store the container-name in the secret store when creating the docker-db and during connect we get the container-name from the secret store, ask docker if the container with this name exists, if not error message. Then we ask if it is running, if not we restart.
start a docker-container from python: https://docker-py.readthedocs.io/en/stable/containers.html#docker.models.containers.Container.start
determine of a container exists: https://docker-py.readthedocs.io/en/stable/containers.html#docker.models.containers.ContainerCollection.get
found if it exists: https://docker-py.readthedocs.io/en/stable/containers.html#docker.models.containers.Container.status
Some diagrams: