Tools for creating and manipulating a database designed for Magnet simulations.
Data may be partly retreived from Lncmi control and monitoring website.
See python_magnetrun for more details
- Pre-requisites
- Certificates
On your host, set /etc/hosts:
echo "127.0.0.1 magnetdb-dev.local api.magnetdb-dev.local lemon.magnetdb-dev.local manager.lemon.magnetdb-dev.local auth.lemon.magnetdb-dev.local pgadmin.magnetdb-dev.local minio.magnetdb-dev.local traefik.magnetdb-dev.local" | sudo tee -a /etc/hostsCreate a self signed certificate for the magnetdb server:
mkdir -p certs
cd certs
mkcert -CAROOT
mkcert 'magnetdb-dev.local'
mkcert '*.magnetdb-dev.local'
mkcert -install
chmod 600 certs/*.key- Create and Fix the permissions for pgadmin-data
sudo chown -R 5050:0 pgadmin-data - Start dependencies with docker:
docker-compose -f docker-compose-dev-traefik-ssl.yml upNote: if you see error messages about pgadmin, try to fix permissions on pgadmin-data directory by running sudo chown -R 5050:5050 pgadmin-data
-
Configure LemonLDAP (https://github.com/LemonLDAPNG/lemonldap-ng-docker):
- Sign in to https://auth.lemon.magnetdb-dev.local/ with dwho/dwho
- Enable OpenID Connect in Administration > WebSSO Manager > General Parameters > Issuer modules > OpenID Connect
- Create OpenID relying party in Administration > WebSSO Manager > OpenID Connect Relying Parties > Add OpenID Relying Party
- Go in Administration > WebSSO Manager > OpenID Connect Relying Parties > "Name of the relying party" > Options > Basic
- Set Client ID to
testid - Set Client secret to
testsecret - Set Allowed redirection addresses for login to
https://magnetdb-dev.local/sign_in
-
Setup Minio bucket:
- Sign in to https://minio.magnetdb-dev.local/ with minio/minio123
- Create bucket on https://minio.magnetdb-dev.local/add-bucket
-
Run migrations:
Connect to magnetdb-api container
docker exec -it magnetdb-api bashpoetry run python3 manage.py migrate-
Run seeds:
To run this step you must have a '/data' directory. Connect to magnetdb-api container, check the directory is mounted, then
export DATA_DIR=/data
poetry run python3 -m python_magnetdb.seeds.seeds
poetry run python3 -m python_magnetdb.seeds.seed-again
poetry run python3 -m python_magnetdb.seeds.seed-records- PgAdmin setup
Load https://pgadmin.magnetdb-dev.local/ in your web browser
add a server for magnetdb
magnetdb ip DB server shall be: magnetdb-postgres