Install on TrueNAS SCALE
This guide provides step-by-step instructions for installing Lens on TrueNAS SCALE using Custom App Install via YAML.
Overview
The Lens App deploys a complete Lens stack on TrueNAS SCALE, including:
- Backend API - Main application server (port 30305)
- Frontend - Web interface (port 30306)
- MongoDB - Database (port 27018)
- Redis - Cache and message broker for workers
- FC Worker API - FreeCAD worker API
- FC Worker Celery - Background task processor
Prerequisites
Before installing, ensure you have:
- TrueNAS SCALE with Apps enabled
- Storage pool available for persistent data
- Network access to the TrueNAS host
Storage Setup
Determine Your Storage Path
You need to identify where to store persistent data. Common options:
- Apps pool (recommended):
/mnt/[pool-name]/ix-applications/lens/...- Find your Apps pool in: Apps > Settings > Advanced Settings > Pool
- Custom dataset:
/mnt/[pool-name]/[dataset-name]/lens/...
Create Required Directories
Open the TrueNAS Shell (System Settings > Shell) or SSH into your TrueNAS host:
# Replace /mnt/[your-pool] with your actual Apps pool path
# Example: /mnt/tank/ix-applications/lens
# Create MongoDB data directory
mkdir -p /mnt/[your-pool]/ix-applications/lens/mongodb_data
# Create uploads directory
mkdir -p /mnt/[your-pool]/ix-applications/lens/uploads_data
# Set MongoDB directory ownership (MongoDB runs as user 568:568)
chown -R 568:568 /mnt/[your-pool]/ix-applications/lens/mongodb_dataVerify Directory Permissions
# Check MongoDB directory
ls -la /mnt/[your-pool]/ix-applications/lens/mongodb_data
# Check uploads directory
ls -la /mnt/[your-pool]/ix-applications/lens/uploads_dataInstallation Steps
Open Custom App YAML Editor
- Log in to your TrueNAS SCALE web interface
- Navigate to Apps > Discover Apps
- Click the three-dot menu (⋮) next to Custom App
- Select Install via YAML from the menu
- A YAML editor will open
Paste Configuration
- Copy the contents of
lens-truenas-app.yaml - Paste it into the YAML editor
- Important: Before proceeding, you must update the configuration (see Configuration below)
Update Configuration
Before deploying, update the following in the YAML:
Storage Paths
Replace all instances of /mnt/[your-pool]/ix-applications/lens with your actual storage path:
volumes:
- /mnt/[your-pool]/ix-applications/lens/mongodb_data:/data/db
- /mnt/[your-pool]/ix-applications/lens/uploads_data:/app/uploadsNetwork Configuration
Update the HOSTNAME, FRONTEND_URL, and VITE_APP_API_URL environment variables:
environment:
- HOSTNAME=192.168.1.100 # Replace with your TrueNAS IP or hostname
- FRONTEND_URL=http://192.168.1.100:30306 # Update accordingly
- VITE_APP_API_URL=http://192.168.1.100:30305/ # Backend API URL (used by both frontend and backend)Admin Credentials
environment:
- DEFAULT_ADMIN_EMAIL=admin@local.test # Change this
- DEFAULT_ADMIN_USERNAME=admin # Change this
- DEFAULT_ADMIN_PASSWORD=admin@local.test # Change this
- DEFAULT_ADMIN_NAME=AdministratorSMTP Configuration (Optional)
If you want email functionality, configure SMTP:
environment:
- SMTP_HOST=smtp.example.com
- SMTP_PORT=465
- SMTP_USER=your-email@example.com
- SMTP_PASS=your-password
- SMTP_FROM=noreply@example.comPort Configuration
Adjust ports if they conflict with other services:
- Backend:
30305:30305(change this port if needed) - Frontend:
30306:80(change first number if needed) - MongoDB:
27018:27017(change first number if needed)
Deploy
- Review all configuration changes
- Click Save to deploy the application
- TrueNAS will start pulling images and creating containers
Monitor Deployment
- Navigate to Apps
- You will see all running instances listed
- Check the status of your Lens app
- Select the Lens app to view the status of all Lens services:
- Wait for all services to show “Running” status
- Check logs if any service fails to start
Configuration
Environment Variables Reference
Backend Service
| Variable | Description | Required | Default |
|---|---|---|---|
HOSTNAME | Server hostname or IP | Yes | - |
PORT | Backend API port | No | 30305 |
FRONTEND_URL | Frontend application URL | Yes | - |
VITE_APP_API_URL | Backend API URL (used by both frontend and backend) | Yes | - |
SMTP_HOST | SMTP server hostname | No | - |
SMTP_PORT | SMTP server port | No | 465 |
SMTP_USER | SMTP username | No | - |
SMTP_PASS | SMTP password | No | - |
SMTP_FROM | SMTP from address | No | - |
DEFAULT_ADMIN_EMAIL | Initial admin email | Yes | - |
DEFAULT_ADMIN_USERNAME | Initial admin username | Yes | - |
DEFAULT_ADMIN_PASSWORD | Initial admin password | Yes | - |
DEFAULT_ADMIN_NAME | Initial admin display name | Yes | - |
Frontend Service
| Variable | Description | Required | Default |
|---|---|---|---|
VITE_APP_API_URL | Backend API URL | Yes | - |
VITE_STRIPE_PURCHASE_PEER_URL | Stripe purchase URL | No | - |
PROXY_SCHEME_PREFIX | Proxy scheme prefix | No | http:// |
Volume Mounts
| Service | Host Path | Container Path | Purpose |
|---|---|---|---|
| MongoDB | /mnt/[pool]/.../mongodb_data | /data/db | Database files |
| Backend | /mnt/[pool]/.../uploads_data | /app/uploads | User uploads |
| Init Container | /mnt/[pool]/.../uploads_data | /mnt/uploads | Initial file copy |
Accessing Services
- Frontend:
http://[HOSTNAME]:30306 - Backend API:
http://[HOSTNAME]:30305 - MongoDB (external):
mongodb://[HOSTNAME]:27018