8000 GitHub - ukaea/fair-mast: A data management system for Tokamak data
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ukaea/fair-mast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

License Build Status

FAIR MAST Data Management System

FAIR MAST is a data management system designed for fusion research, enabling efficient storage, retrieval, and management of experimental data.

πŸ“Œ Development Setup

Prerequisites

  • Mac Users

    If you are using Mac for development, use podman instead of docker. Follow the installation guide to set it up, then follow the below set up. Also install podman-mac-helper, which provides a compatibility layer that allows you to use most Docker commands with Podman on macOS.

    Linux/Windows Users

    If using Linux or Windows, you need to make sure you have docker and docker-compose installed on your system.

Getting Started

  1. Clone the repository:
git clone git@github.com:ukaea/fair-mast.git
cd fair-mast
  1. Start the development environment:

    • Mac Users

    podman compose \
    --env-file dev/docker/.env.dev  \
    -f dev/docker/docker-compose.yml \
    up \
    --build
    • Linux/Windows Users

    docker-compose \
    --env-file dev/docker/.env.dev  \
    -f dev/docker/docker-compose.yml \
    up \
    --build

    The following services will be started:

    • FastAPI REST & GraphQL Server - will start running at http://localhost:8081.
      • The REST API documentation is at http://localhost:8081/redoc.
      • The GraphQL API documentation is at http://localhost:8081/graphql.
    • Postgres Database Server - will start running at http://localhost:5432
    • Postgres Admin Server - will start running at http://localhost:5050
  2. Shutting Down:

    • Mac Users

    podman compose -f dev/docker/docker-compose.yml down   
    podman volume rm --all
    • Linux/Windows Users

    docker-compose -f dev/docker/docker-compose.yml down

πŸ“¦ Populating the Database

Retrieve and ingest the metadata files using s5cmd:

s5cmd --no-sign-request --endpoint-url https://s3.echo.stfc.ac.uk cp "s3://mast/dev/mock_data*" ./tests

Create the database and ingest data using the following command:

  • Mac Users

podman exec -it mast-api python -m src.api.create /test_data/index/  
  • Linux/Windows Users

docker exec -it mast-api python -m src.api.create /test_data/index/  

βœ… Running Unit Tests

Verify everything is setup correctly by running the unit tests.

Follow the below instructions to set up the environment.

uv run pytest

πŸ”§ Production Deployment

First time deployment

When deploying for the first time (I.e. with no ssl certificates yet generated) you will need to follow some additional steps:

Rename the file "nginx.conf" to "nginx-final.conf" (or anything else so long as you remember what it is) Then rename: "nginx-initial.conf" to "nginx.conf"

(This is so that nginx can run without ssl certiifcates while they are being generated)

Proceed with the full deployment proceedure (As detailed below)

Now switch the nginx config files back to their original names and run the command:

docker exec reverse-proxy nginx -s reload

(This reloads nginx to use the full configuration now inculding https with the generated certificates)

Deployment procedure

When deploying the full production stack (Either for testing or production) please check the .env.dev file in ./dev/docker and ensure the enviromental variables NGINX_CONFIG_PATH and CERTBOT_COMMAND are set to their correct varients for your use case (More information on this in the ./dev/docker README).

To run the production container which starts the postgres database, fastapi, nginx reverse proxy and certbot ssl certificate generator, run the following command:

docker-compose --env-file dev/docker/.env.dev  -f dev/docker/docker-compose.yml -f dev/docker/docker-compose-prod.yml up --build --force-recreate --remove-orphans -d

You'll need to download and ingest the production data like so:

mkdir -p data/mast/meta
rsync -vaP <CSD3-USERNAME>@login.hpc.cam.ac.uk:/rds/project/rds-sPGbyCAPsJI/archive/metadata data/
docker exec -it mast-api python -m src.api.create /test_data/index

Shutdown procedure

To shut down the production deployment, run the following command:

docker-compose --env-file dev/docker/.env.dev  -f dev/docker/docker-compose.yml -f dev/docker/docker-compose-prod.yml down

To also destory the volumes (including the metadatabase) you may add the volumes parameter:

docker-compose --env-file dev/docker/.env.dev  -f dev/docker/docker-compose.yml -f dev/docker/docker-compose-prod.yml down --volumes

Building Documentation

See the documentation guide for more details.

Citation

If you would like to reference this work, please cite the followig publication.

Samuel Jackson, Saiful Khan, Nathan Cummings, James Hodson, Shaun de Witt, Stanislas Pamela, Rob Akers, Jeyan Thiyagalingam, FAIR-MAST: A fusion device data management system, SoftwareX, Volume 27, 2024,101869,ISSN 2352-7110, https://doi.org/10.1016/j.softx.2024.101869.

In BibTex format:

@article{jackson_fair-mast_2024,
	title = {{FAIR}-{MAST}: {A} fusion device data management system},
	volume = {27},
	issn = {23527110},
	shorttitle = {{FAIR}-{MAST}},
	url = {https://linkinghub.elsevier.com/retrieve/pii/S2352711024002395},
	doi = {10.1016/j.softx.2024.101869},
	language = {en},
	urldate = {2025-01-17},
	journal = {SoftwareX},
	author = {Jackson, Samuel and Khan, Saiful and Cummings, Nathan and Hodson, James and De Witt, Shaun and Pamela, Stanislas and Akers, Rob and Thiyagalingam, Jeyan},
	month = sep,
	year = {2024},
	pages = {101869},
}

About

A data management system for Tokamak data

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 8

0