Deploy an ASGI server and API to receive and explore test results. When deployed, you can access the server's current API at the /docs route.
Create a local directory to store data posted to the server's host's file system.
mkdir "$HOME/data_server/results" -p- minimum 600 MiB RAM
- Python ^3.7.1 (translating caret requirements)
- poetry
- PostgreSQL service
- Current working directory is project root
poetry install --devDefine a .env with these environment variables.
-
DATA_SERVER_LOG_LVLDefault:
infoData server log level. Current Uvicorn server options: 'critical', 'error', 'warning', 'info', 'debug', 'trace'.
-
DATA_SERVER_PORTDefault:
7070This application's service port.
-
DATA_SERVER_PUBLIC_HOSTDefault:
localhostURL to public host of data server.
-
DATA_SERVER_SECRETSecret to encode passwords in database.
-
POSTGRES_PORTDocker: Empty string (i.e.
POSTGRES_PORT=)Podman:
5432Postgres service port.
-
POSTGRES_SERVERDocker: name of the database network alias, see
docker-compose.sh.Podman:
localhostDomain name, or IP address, hosting the postgres service.
-
POSTGRES_PASSWORDPostgresql database super user password.
-
FIRST_SUPERUSERUsername for the first super user, in the format of an e-mail.
-
FIRST_SUPERUSER_PASSWORDPassword for the first super user.
Var to enable or disable pruner
Configure the pruner_config.toml configuration file to add folders on which the pruner should be active. In the toml file you also need to set the days_to_live parameter, which will determine the number of days after which the files/folders in the path are pruned.
The pruner and server logs can be viewed by running the command podman logs snap_web on the machine/instance on which snappy server is deployed.
Make your changes in the snappy-data-server directory.
This will create a local podman image name snappy
podman build --tag snappy -f DockerfileIn the same directory as pod-compose.sh, create a .env configuration file.
Full example
POSTGRES_PASSWORD=barfoo
DATA_SERVER_SECRET=secretfoobar
DATA_SERVER_LOG_LVL=info
DATA_SERVER_PUBLIC_HOST=localhost
DATA_SERVER_PORT=7070
FIRST_SUPERUSER=foo@bar.com
FIRST_SUPERUSER_PASSWORD=foobarStart snappy server pod with the image you built locally.
./pod-compose.sh localhost/snappy-
Configure
.envfor PostgreSQL service and Snappy server application. -
Create a means of communication between the containers.
- Podman containers can easily communicate with
localhostwhen they're in the same pod. - Docker containers can easily communicate over the default
bridgenetwork when each service is given anetwork-alias.
- Podman containers can easily communicate with
-
Start a PostgreSQL database service.
-
Add usernames and passwords.
- Assign username and password to the
FIRST_SUPERUSERenvironment variables. Usernames must be a valid email regular expression, but do not have to be capable of receiving email. - Run the application's
inital_data.pyto seed the database with user accounts.
- Assign username and password to the
-
Execute the deployment's
start.shscript to get the server running.
- The bind mount volume is labeled as a shared directory with the host,
:z, to persist results and facilitate integration with other tools on the host.
Using the data server with the data server CLI