Multi Tenancy
هذا المحتوى غير متوفر بلغتك بعد.
Guide: Multi-Tenancy
Section titled “Guide: Multi-Tenancy”Run multiple independent ɳSelf projects on a single server. Each project is fully isolated with its own containers, network, and port range.
How It Works
Section titled “How It Works”Each nself init call creates a named project. Projects share the host OS but are separated by:
- Docker network isolation: each project gets its own bridge network (
{project}_default) - Port separation: each project is assigned a unique port range for internal services
- Nginx isolation: separate virtual host configs under
nginx/sites/ - Data isolation: separate Postgres instance and volume per project
Setting Up Multiple Projects
Section titled “Setting Up Multiple Projects”# Project 1cd /srv/project1nself init project1 --env prod# Edit .env.prod: set BASE_DOMAIN=project1.example.comnself build && nself start
# Project 2cd /srv/project2nself init project2 --env prod# Edit .env.prod: set BASE_DOMAIN=project2.example.comnself build && nself startPort Allocation
Section titled “Port Allocation”ɳSelf assigns unique ports per project to avoid conflicts. Check assigned ports:
nself urls # shows all service URLs for the current projectnself status # shows running services and their portsIf you initialise projects in separate directories, ɳSelf handles port selection automatically.
DNS Configuration
Section titled “DNS Configuration”Each project should have its own subdomain:
A project1.example.com → server IPA project2.example.com → server IPOr use path-based routing if your use case supports it.
Resource Considerations
Section titled “Resource Considerations”Each project runs its own Postgres, Hasura, and Auth containers. On a 4 GB server, 2 projects is the practical limit. For 3+ projects, use an 8 GB+ server.
See Also
Section titled “See Also”- Guide-Production-Deployment: single-project setup
- Guide-Security-Hardening: firewall rules per project
- Config-System: project configuration reference