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
git clone ...
git submodule update --init --recursive- Pre-requisites
On your server:
echo "127.0.0.1 handler.sso.lncmig.local api.manager.sso.lncmig.local manager.sso.lncmig.local sso.lncmig.local test.sso.lncmig.local" | sudo tee -a /etc/hosts
echo "127.0.0.1 magnetdb.lncmig.local" | sudo tee -a /etc/hosts
echo "127.0.0.1 magnetdb-api.lncmig.local" | sudo tee -a /etc/hosts
echo "127.0.0.1 magnetdb-worker.lncmig.local" | sudo tee -a /etc/hosts
echo "127.0.0.1 redis.lncmig.local" | sudo tee -a /etc/hosts
echo "127.0.0.1 postgres.lncmig.local" | sudo tee -a /etc/hosts
echo "127.0.0.1 pgadmin.lncmig.local" | sudo tee -a /etc/hosts
echo "127.0.0.1 minio.lncmig.local" | sudo tee -a /etc/hostsCreate a self signed certificate for the magnetdb server
mkdir -p certs
openssl req -new -x509 -days 365 -nodes -out certs/cert.pem -keyout certs/cert.key
chmod 600 certs/cert.perm certs.cert.keyNB: eventually remove poetry-cache data before starting the services
- Start the services
docker-compose upThe first time you run the service, you would need to:
- Fix the permissions for pgadmin-data
sudo chown -R 5050:0 pgadmin-data- Set timezone in nginx-proxy
docker exec -it magnetdb-nginx-proxythen run
ln -snf /usr/share/zoneinfo/Europe/Paris /etc/localtime
echo "Europe/Paris" > /etc/timezone- Create/Update Database
docker exec -it magnetdb-api /bin/bashIn the container, to perform database migration run:
poetry run python3 manage.py migrateEventually, run seeds to populate the database
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-
Configure LemonLDAP (https://github.com/LemonLDAPNG/lemonldap-ng-docker):
- Sign in to http://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
http://localhost:8080magnetdb-dev.local/sign_in
-
Setup pgadmin
Load localhost:5050/ in your web browser
add a server for magnetdb
Note: This may be needed to update the magnetdb IP after each restart of docker-compose
Check magnetdb ip server with: docker inspect postgres-app | grep IPAddress
- Custom LemonLDAP settings
docker exec -it lemonldap-app bash- To test
To change Lemonldap settings
firefox --private-window http://sso.lncmig.localTo change user role:
firefox --private-window http://localhost:5050/To start magnetdb:
firefox --private-window http://localhost:8080/To start magnetdb swagger UI:
firefox --private-window http://localhost:8000/docsNB: see https://fastapi.tiangolo.com/tutorial/metadata/ to custom swagger UI