Migration Guide#
This guide is for system administrators, and will help you migrate your NexusLIMS installation from v1.4.3 to v2.5.0.
What Changed#
The major changes you need to know about:
Package Manager: Poetry →
uv(faster, simpler installation)Environment Variables: All variables now use
NX_prefixMetadata System: New Pydantic schemas with EM Glossary integration and validation
Configuration: Better validation with helpful error messages
Transition to uv#
The project has transitioned from Poetry to uv for Python package and environment management. uv is a fast, modern package installer and resolver written in Rust that provides:
Significantly faster dependency resolution and installation
Better reproducibility with lock files
Simpler workflow for both development and deployment
Direct Python version management (no need for separate tools like pyenv)
Installing uv#
Install uv using the official installation script:
# Unix/macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
For alternative installation methods, see the uv documentation.
Environment Variable Changes#
Environment variable naming has been standardized for better consistency. You must update your .env file to use the new variable names.
Renamed Variables#
The following variables have been renamed:
Old Name (v1.x) |
New Name (v2.0+) |
Required |
|---|---|---|
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
Yes |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
No |
|
|
If using NEMO |
|
|
If using NEMO |
|
|
No |
|
|
No |
|
|
No |
Note
v2.3.0+ Authentication Change: CDCS authentication has changed from username/password (NX_CDCS_USER and NX_CDCS_PASS) to token-based authentication (NX_CDCS_TOKEN). Replace your username and password with an API token obtained from the CDCS admin panel. See NX_CDCS_TOKEN for details.
New Variables#
The following variables are new in v2.0:
Variable |
Purpose |
Required |
|---|---|---|
|
Custom directory for application logs |
No |
|
Custom directory for generated XML records |
No |
|
Directory for site-specific instrument profiles |
No |
|
SMTP server hostname |
If using email |
|
SMTP server port (default: 587) |
No |
|
SMTP username for authentication |
No |
|
SMTP password for authentication |
No |
|
Use TLS encryption (default: true) |
No |
|
Email address to send from |
If using email |
|
Comma-separated recipient addresses |
If using email |
Removed Variables#
The following variables from v1.x are no longer used:
Variable |
Reason for Removal |
|---|---|
|
Tests now run as independent unit tests and integration tests against a Docker-deployed instance created on demand |
|
SharePoint harvester has been removed |
|
Replaced by enhanced email configuration ( |
|
Replaced by enhanced email configuration ( |
Complete Environment Variable Reference#
General Configuration#
Variable |
Description |
Example |
|---|---|---|
|
File inclusion strategy: |
|
|
JSON array of glob patterns to ignore |
|
|
Root path to centralized instrument data (read-only mount) |
|
|
Writable parallel path for metadata and previews |
|
|
Path to NexusLIMS SQLite database |
|
|
Maximum days to wait for files (can be fractional) |
|
|
Optional: Directory for logs (defaults to |
|
|
Optional: Directory for records (defaults to |
|
|
Optional: Directory for site-specific instrument profiles |
|
CDCS Authentication#
Variable |
Description |
Example |
|---|---|---|
|
API token for CDCS authentication |
|
|
Root URL of NexusLIMS CDCS instance (with trailing slash) |
|
|
Optional: Path to SSL certificate bundle |
|
|
Optional: SSL certificate bundle as string |
|
NEMO Harvester Configuration#
Multiple NEMO harvesters can be configured using numbered suffixes (_1, _2, etc.):
Variable |
Description |
Example |
|---|---|---|
|
Full path to NEMO API root (with trailing slash) |
|
|
Authentication token for NEMO server |
|
|
Optional: Format for sending datetimes to API |
|
|
Optional: Format for parsing datetimes from API |
|
|
Optional: IANA timezone for API datetimes |
|
Email Notification Configuration#
Email notifications are sent by nexuslims build-records when errors are detected:
Variable |
Description |
Example |
|---|---|---|
|
SMTP server hostname |
|
|
Optional: SMTP port (default: 587) |
|
|
Optional: SMTP username for authentication |
|
|
Optional: SMTP password for authentication |
|
|
Optional: Use TLS encryption (default: true) |
|
|
Email address to send from |
|
|
Comma-separated list of recipient addresses |
|
Centralized Configuration Module#
To improve maintainability and type safety, all environment variable access is centralized in the nexusLIMS.config module using pydantic-settings.
For complete configuration documentation, see Configuration.
What This Means for Users#
No file structure changes required: Continue defining variables in your
.envfile or system environmentAutomatic validation: The application validates configuration at startup and provides clear error messages
Type safety: Configuration values are automatically converted to appropriate Python types
Default values: Sensible defaults are provided where applicable
Mocking for tests: The design of the system allows for a fully mocked setup for use in the test suite, ensuring more reliable code quality testing.
What This Means for Developers#
Instead of accessing environment variables directly:
# Old approach (v1.x) - Don't use
import os
path = os.environ.get("nexusLIMS_path")
Use the centralized config module:
# New approach (v2.0+)
from nexusLIMS.config import settings
path = settings.NX_DATA_PATH
This provides:
Type hints and autocomplete in IDEs
Validation at import time
Consistent defaults throughout the application
Easier testing with
refresh_settings()
Step-by-Step Migration Instructions#
Follow these steps to migrate your NexusLIMS installation from v1.x to v2.5.0:
1. Backup Your Current Installation#
Important
Database migrations required: The database schema has changed since v1.4.3. You will need to run migrations to:
Add the
upload_logtable (for tracking record exports)Update
session_logCHECK constraints (to support new record statuses)
Note: Database migrations automatically create timestamped backups before making changes. However, it’s still good practice to create your own backups of critical files before major upgrades.
# Backup your .env file (always recommended)
cp .env .env.v1.backup
# Optional: Create manual database backup (migrations create automatic backups)
cp /path/to/nexuslims_db.sqlite /path/to/nexuslims_db.sqlite.backup
2. Install uv#
curl -LsSf https://astral.sh/uv/install.sh | sh
# Verify installation
uv --version
3. Update Your .env File#
Create a new .env file based on .env.example:
# Copy the example file
cp .env.example .env
# Edit with your settings
nano .env # or your preferred editor
Map your old variables to new names using the table in the “Renamed Variables” section above.
Key changes to make:
Rename
mmfnexus_path→NX_INSTRUMENT_DATA_PATHRename
nexusLIMS_path→NX_DATA_PATHRename
nexusLIMS_db_path→NX_DB_PATHReplace
nexusLIMS_userandnexusLIMS_pass→NX_CDCS_TOKEN(obtain token from CDCS admin panel)Rename
cdcs_url→NX_CDCS_URLRename
NexusLIMS_cert_bundle_file→NX_CERT_BUNDLE_FILE(if used)Rename
NexusLIMS_cert_bundle→NX_CERT_BUNDLE(if used)Rename
NexusLIMS_file_strategy→NX_FILE_STRATEGY(if customized)Rename
NexusLIMS_ignore_patterns→NX_IGNORE_PATTERNS(if customized)Rename
nexusLIMS_file_delay_days→NX_FILE_DELAY_DAYS(if customized)Rename
NEMO_address_*→NX_NEMO_ADDRESS_*(if using NEMO)Rename
NEMO_token_*→NX_NEMO_TOKEN_*(if using NEMO)Remove
test_cdcs_url,sharepoint_root_url,email_sender,email_recipientsAdd new email configuration variables (
NX_EMAIL_*) if you want email notifications
4. Remove Old Virtual Environment#
# If you have an old Poetry or pyenv environment
rm -rf .venv
# Remove Poetry lock file
rm poetry.lock # if it exists
5. Create New Environment with uv#
# Install NexusLIMS with dependencies (this will create the virtualenvironment as necessary)
uv sync
6. Mark Database as Migrated and Apply Updates#
Added in version 2.2.0: NexusLIMS now uses Alembic for database schema version control. You need to mark your existing database as migrated to the baseline schema, then apply updates.
# Mark database as at the baseline schema version (v1.4.3 schema)
nexuslims db alembic stamp v1_4_3
# Apply pending migrations (adds upload_log table and updated CHECK constraints)
nexuslims db upgrade
What this does:
stamp v1_4_3- Marks your v1.4.3 database as having the baseline schema (instruments+session_logtables)upgrade- Applies migration (database update) commands that have updated the schema since v1.4.3:Migration
v2_4_0a: Adds theupload_logtable for tracking record exportsMigration
v2_4_0b: Updatessession_logCHECK constraints to include new statuses (NO_CONSENT,NO_RESERVATION,BUILT_NOT_EXPORTED)
Note
If you’re running from a source checkout (not an installed package), prefix commands with uv run:
uv run nexuslims db alembic stamp v1_4_3
uv run nexuslims db upgrade
Note
Automatic backups: The migration system automatically creates timestamped backups before making changes to your database (e.g., database_backup_20260207_143216.sqlite). These are created in the same directory as your database file.
If you prefer to create your own backup first, you can:
cp /path/to/nexuslims_db.sqlite /path/to/nexuslims_db.sqlite.backup
7. Verify Installation#
# Test configuration loading
uv run python -c "from nexusLIMS.config import settings; print(settings.NX_DATA_PATH)"
# Run unit tests (not necessary, but will provide confidence things are working)
uv run pytest tests/unit
# Check database connection and list instruments
uv run python -c "from nexusLIMS.instruments import instrument_db; print(f'{len(instrument_db)} instruments found:'); [print(f' - {pid}') for pid in instrument_db.keys()]"
8. Update Deployment Scripts#
If you have cron jobs or systemd services running NexusLIMS:
Old command style (v1.x):
# Using Poetry
cd /path/to/NexusLIMS
poetry run python -m nexusLIMS.builder.record_builder
New command style (v2.0+):
# Using uv
cd /path/to/NexusLIMS
uv run nexuslims build-records
9. Test Record Building#
Run a test record build to verify everything works:
# Dry run mode (find files but don't build records)
uv run nexuslims build-records -n
# Verbose mode (with detailed logging)
uv run nexuslims build-records -vv -n
Common Migration Issues#
Database Path Not Found#
Error: ValidationError: NX_DB_PATH ... does not exist
Solution: Ensure your database file exists at the path specified in NX_DB_PATH. If you migrated the path, update it in your .env file.
Directory Does Not Exist#
Error: ValidationError: NX_INSTRUMENT_DATA_PATH ... does not exist
Solution: Pydantic validates that paths exist. Ensure all directory paths in your .env file point to existing directories:
mkdir -p /path/to/nexuslims/data
mkdir -p /path/to/nexuslims/logs
SSL Certificate Errors#
Error: SSLError: certificate verify failed
Solution: If your CDCS or NEMO servers use custom SSL certificates, configure NX_CERT_BUNDLE_FILE:
NX_CERT_BUNDLE_FILE=/etc/ssl/certs/custom-ca-bundle.pem
NEMO Harvester Not Found#
Error: No NEMO reservations being harvested
Solution: Verify your NEMO configuration uses the new NX_ prefix:
NX_NEMO_ADDRESS_1=https://nemo.example.com/api/
NX_NEMO_TOKEN_1=your-token-here
Getting Help#
If you encounter issues during migration:
Review the error message carefully - Pydantic provides detailed validation errors
Check the example file: Compare your
.envwith.env.exampleConsult the logs: Check
NX_LOG_PATH(orNX_DATA_PATH/logs/) for detailsOpen an issue: datasophos/NexusLIMS#issues
For professional migration support, deployment assistance, or custom development:
Contact Datasophos: https://datasophos.co/#contact
Further Reading#
Getting Started - Fresh installation guide for v2.0
Record building workflow - Understanding the record building workflow
nexusLIMS.config- Configuration module API documentationuv documentation - Learn more about uv