This repository contains the files and script to configure a lab server.
✨ Gencovery is a software company that offers Constellab., the leading open and secure digital infrastructure designed to consolidate data and unlock its full potential in the life sciences industry. Gencovery's mission is to provide universal access to data to enhance people's health and well-being.
🌍 With our Fair Open Access offer, you can use Constellab for free. Sign up here. Find more information about the Open Access offer here (link to be defined).
Connect into the constellab (prod or pre-prod) and create a new lab instance with the correct information and the keys and token empty (they will be generated)
To deploy a lab, connect into the server in ssh.
cd /home/ubuntu
git clone https://github.com/Constellab/lab-configurer.git
cd lab-configurer/utils
bash prepare_server.sh
- Reboot server
sudo reboot
- Relog and go to lab-configurer
cd /home/ubuntu/lab-configurer
sudo bash utils/init.sh
- Logout and login for the env variable to be set, then
cd /home/ubuntu/lab-configurer
- Start the lab manager and reverse proxy. In lab-configurer folder
docker-compose up -d
Log into the constellab (prod or pre-prod). open the lab created ealier. There should be 2 containers running :
- Lab manager
- Rever proxy
The status should be containers down.
Configure the lab by adding the necessary bricks. gws_core
and gws_biota
are mandatory.
Clic on INIT ALL
. Refresh regularly and the lab should be up after some time.
That's it
To build the dev env image see gpm repository.
Create external volume for lab manager (required in the docker-compose file) :
docker volume create dev-env-app
docker volume create dev-env-data
docker volume create dev-env-logs
docker volume create lab-manager-home
docker volume create central-db
docker volume create hub-db
docker volume create lab-db
docker volume create lab-manager-app
docker volume create lab-manager-biota
docker volume create lab-manager-prod-db
docker volume create lab-manager-dev-db
docker volume create lab-manager-prod-lab
docker volume create lab-manager-prod-data
docker volume create lab-manager-dev-lab
docker volume create lab-manager-config
To create the containers :
- create a
.env
file in the local folder withOPENAI_API_KEY
- execute the docker-compose file under local folder :
docker compose --env-file ./.env up -d
In lab manager folder exec : docker build -t local-lab-manager .
execute the docker-compose file under local folder : docker compose --env-file ./.env up -d lab-manager
Pull the code of lab manager in the /home folder (saved in volume)
To build the executable to is used to configure and run the lab on desktop, do the following :
pip install pyinstaller
pip install requests
pyinstaller --onefile .\desktop\desktop-start.py
The result will be in the dist folder. To build exe for mac same command on mac.
To deploy the lab on premise, the lab manager and the reverse proxy should be deployed on the server. If the on premise lab is accessible from the internet, the default config can be used.
Otherwise the certificate must be generated manually and uploaded to the server so the reverse proxy can use it. In this can use the on-premise/docker-compose.yml
file.
- Create the on premise lab in Constellab
- Add your user to the lab
- Generate the certificate
- Connect to the server with ssh
- Upload the certicifate to the server in the
/certs
folder. The certificate file should have read access by the default user. The files should be named :/certs/fullchain.pem
/certs/privkey.pem
- Execute the prepare_server.sh script in the lab-configurer/utils folder :
sudo bash prepare_server.sh
- Reboot the server :
sudo reboot
- Clone the lab-configurer repository in the home folder :
git clone -b master https://github.com/Constellab/lab-configurer.git
- Go to the lab-configurer folder
- Execute the init file to setup default environment variables
sudo bash utils/init.sh
.Info can be found in constellab. - Exit the session and reconnect to the server to have the environment variables set
- Go to the lab-configurer folder
- Start the lab manager and the reverse proxy
docker-compose -f on-premise/docker-compose.yml up -d
- Check that the certificate is correctly used by the reverse proxy, the request
https://lab-manager.${VIRTUAL_HOST}/health-check
should return true. This can be tester directly on the server or from the another server (or a browser) that can access the on premise lab.
Now the lab manager is ready and can be configured. If constellab server can access the lab thourgh HTTP, you can configurue the lab directly from the constellab. Otherwise see next section 'Configure the lab manager manually'.
- Configure the brick of the lab
- Execute the following command :
curl -X PUT -H "Authorization: api-key ${LAB_MANAGER_API_KEY}" -H "Content-Type: application/json" -d @config.json https://lab-manager.${VIRTUAL_HOST}/lab/config
. Replace the values by the values set in the environment variables. - You can find an example of the config file in the lab-configurer repository
on-premise/config-file-example.json
- The config.json file should be create in
/app/config/config.json
.
- Execute the following command :
- Then start the lab
- Execute the following command :
curl -X POST -H "Authorization: api-key ${LAB_MANAGER_API_KEY}" -H "Content-Type: application/json" -d @lab.json https://lab-manager.${VIRTUAL_HOST}/lab/init-all
. Replace the values by the values set in the environment variables. - You can find an example of the lab file in the lab-configurer repository
on-premise/lab-file-example.json
- Check the logs of the lab manager :
docker logs lab-manager -f
. The lab should be starting, it can take some time. Once ready check the logs of the glab container to see if the lab is correctly started :docker logs glab -f
.
- Execute the following command :
- Test the lab connection by using your browser and connecting to the
https://lab.${VIRTUAL_HOST}
url. You should see the lab interface. Login with your constellab credentials.- If the login doesn't work, check that you've added your user to the lab in the constellab. Once added you will need to restart the lab by calling the init-all endpoint again. You can check the glab logs to see if the user is correctly added with the message (after the start) :
1 synchronized users from space
.
- If the login doesn't work, check that you've added your user to the lab in the constellab. Once added you will need to restart the lab by calling the init-all endpoint again. You can check the glab logs to see if the user is correctly added with the message (after the start) :
This repository is maintained with ❤️ by Gencovery.