Skip to content

UI and server version matching

often

Update LabID server

This guide provides step-by-step instructions on how to update the LabID Server

1. Prepare for Deployment

We typically deploy from the production branch. Ensure you have the latest changes on this branch. If you need to deploy a specific version, checkout to that tag. For example, to deploy version 24.2.0, use the following command:

$ git checkout tags/24.2.0

2. Backup the Database (Pre-Update)

To prevent data loss during the update, it's recommended to create a backup of the database before the update. Use the following command to create a backup:

$ pg_dump labid | gzip -c - > labid.2024-02-01.bfupdate.backup.gz

3. Update Conda Environment (If Necessary)

If there are changes in requirements/environment.yml which suggest that we need to update the conda environment

# It is recommended to stop related services before updating the Conda environment.
$ systemctl stop labid-*
# Update conda env
$ conda env update -n labid-server -f requirements/environment.yml --prune

4. Run the Migration

Some manual operations are required along with running migrations. To simplify this process, we've created a script. Set the Django settings module to 'labid.settings.production' and activate the conda environment before run the update script as follows:

$ DJANGO_SETTINGS_MODULE=labid.settings.production ./scripts/migrations/update.sh

5. Backup the Database (Post-Update)

After running the migrations, it's a good practice to take another database dump. This will serve as a backup of the updated database state.Use the following command to create a post-update backup:

$ pg_dump labid | gzip -c - > labid.2024-02-01.afupdate.backup.gz

6. Reload and Restart Services

After the migration, reload the systemd unit file for gunicorn and restart the celery workers and beat with the following commands:

$ systemctl reload labid-gunicorn
$ systemctl restart labid-celery-worker labid-celery-worker_archive labid-celery-worker_ingestion labid-celery-beat

Update LabID UI

When the UI is installed conjointly with the server (running the server ./setup.sh), the UI repository is cloned inside the server repository, and the production branch is checked out, then built. Conjointly with a server update, it may be necessary to manually update the UI.

To do so, you can run the ./update_ui.sh script on the server repo. This will fetch and pull the latest changes (for the production branch) and rebuild the UI component.

Pull a specific UI version

When it is necessary to pull a specific version of the UI, you can rely on published version tags, and use the following command:

git checkout tags/<version> -b release_tag-<version>

This will create a branch release_tag-<version> that can be built running npm run build.