Skip to content

LabID Production Deployment Guide

Legacy Documentation

This comprehensive deployment guide has been restructured into focused sections for better navigation and usability. While this page remains available for reference, we recommend following the new structured approach:

Quick Reference

Architecture Overview

LabID consists of several interconnected services:

[Nginx] → [Django/Gunicorn] → [PostgreSQL]
         [RabbitMQ] → [Celery Workers]
                    [Beat Scheduler]

Essential Commands

# Check service status
sudo systemctl status labid nginx postgresql rabbitmq-server

# Update LabID server
sudo -u labid -i
cd /opt/labid
git pull origin production
./scripts/migrations/update.sh
sudo systemctl restart labid

# Update LabID UI
sudo -u labid -i
cd /opt/labid-ui
git pull origin production
npm run build

Quick Troubleshooting

  • Service issues: Check journalctl -u service-name
  • Database problems: Verify sudo -u labid psql -h localhost -U labid -d labid_prod -c "SELECT 1;"
  • Static files: Run python manage.py collectstatic --noinput
  • SSL certificates: Use sudo certbot renew

Legacy Complete Guide

Complete Installation Guide (Legacy)

This section contains the original comprehensive deployment guide. For new installations, we recommend using the structured approach above.

Prerequisites

System Requirements

  • Linux server (tested on Ubuntu 20.04+ and RHEL/CentOS 8+)
  • Python 3.10+ with conda/mamba package manager
  • PostgreSQL 12+ database server
  • RabbitMQ message broker
  • Nginx web server (recommended)
  • At least 4GB RAM and 50GB disk space (varies by usage)

Network Requirements

  • HTTPS/SSL certificate for secure access
  • SMTP server for email notifications

Installation Steps

1. System Preparation

Create a dedicated user and directory structure:

sudo useradd -m -s /bin/bash labid
sudo mkdir -p /opt/labid
sudo chown labid:labid /opt/labid

Note: For environments where LabID needs to access network storage or move data across the network, consider using a technical/service user account that has appropriate network access permissions.

2. Database Setup

Install and configure PostgreSQL:

# Install PostgreSQL
sudo apt update
sudo apt install postgresql postgresql-contrib

# Create database and user
sudo -u postgres psql
CREATE DATABASE labid_prod;
CREATE USER labid WITH PASSWORD '<password>';
GRANT ALL PRIVILEGES ON DATABASE labid_prod TO labid;

\q

3. Application Installation

Clone and set up the application:

sudo -u labid -i
cd /opt/labid
git clone https://gitlab.com/lab-integrated-data/labid-server.git .

# we recommend using the production branch
git checkout production

# Install conda/mamba if not available
# Follow: https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html

# Create and activate environment
mamba env create --name labid -f requirements/environment.yml -c conda-forge
conda activate labid

4. Configuration

Create /opt/labid/labid/.env file:

DJANGO_SETTINGS_MODULE=labid.settings.production
DJANGO_SECRET_KEY=<your_very_long_secret_key_here>
DJANGO_DATABASE_URL=postgres://labid:<your_secure_password>@localhost:5432/labid_prod

5. Database Migration and Setup

Initialize the database:

cd /opt/labid/labid
./setup.sh -b -p -d admin admin@example.com 123456

[Continue with remaining steps as documented in the structured guides above...]

Support and Resources

For specific issues, use the dedicated sections above or refer to the Troubleshooting Guide.