TrustRide is an ASGI-first Django application. In production it runs under Daphne to support both HTTP and WebSocket connections (used by the real-time chat and notification features). Nginx sits in front as a reverse proxy, PostgreSQL stores relational data, Redis powers the Celery task queue, and Celery Beat handles all scheduled jobs. This guide walks through every step — from a fresh Ubuntu server to a fully running deployment.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Muhammadbugaje/trustride/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, confirm the following are available on your target server:| Requirement | Minimum version | Notes |
|---|---|---|
| Ubuntu | 20.04 LTS | 22.04 recommended |
| Python | 3.10 | Required by pyproject.toml target |
| PostgreSQL | 14 | Connection managed via dj-database-url |
| Redis | 7 | Celery broker and optional channel layer |
| Node.js | 18 | Required to build Tailwind CSS assets |
| Nginx | Any current | Reverse proxy and WebSocket termination |
Server Preparation
Create a dedicated system user
Run TrustRide under its own non-root user to limit the blast radius of any security issue.
Install system dependencies
Install Python, PostgreSQL client libraries, Redis, Nginx, and Node.js in one pass.Enable and start Redis so it is available before the app boots:
Install Python dependencies
Build Tailwind CSS assets
TrustRide uses Tailwind CSS 4 via the
@tailwindcss/cli package. Run the Node.js build step before collecting static files.The
package.json does not define a build script by default. Run the npx tailwindcss command directly. Tailwind scans ./templates/**/*.html, ./apps/**/templates/**/*.html, and ./static/**/*.js as defined in tailwind.config.js.Database Setup
Create a PostgreSQL database and user, then run Django’s migrations to build the schema.Static Files
WhiteNoise (whitenoise.middleware.WhiteNoiseMiddleware) is already wired into the middleware stack and uses CompressedManifestStaticFilesStorage, so Django serves compressed, cache-busted static assets without a separate CDN.
Collect all static files into STATIC_ROOT:
STATIC_ROOT = '/home/trustrid/public_html/static'. Adjust this path to match your server layout, then update the Nginx alias directive accordingly.
Daphne ASGI Server
TrustRide’s ASGI entrypoint (trust_ride/asgi.py) uses Django Channels’ ProtocolTypeRouter to route HTTP traffic to the standard Django app and WebSocket connections to the chat consumer. Daphne understands both protocols natively.
Start Daphne manually to verify the setup before configuring systemd:
Bind to
127.0.0.1 (loopback), not 0.0.0.0, in production. Nginx handles the public-facing connection and proxies inward. Direct exposure of Daphne to the internet is not recommended.Systemd Service Files
Create systemd units so that Daphne, the Celery worker, and Celery Beat all start automatically on boot and restart after failures.Daphne web process
Celery worker
Celery Beat scheduler
Nginx Configuration
Nginx terminates TLS, forwards regular HTTP requests to Daphne, and upgrades/ws/ paths to WebSocket connections (used by the live chat feature in apps/chat).
SSL with Let’s Encrypt
Install Certbot and obtain a certificate. Certbot will automatically update the Nginx config to listen on port 443 and redirect HTTP to HTTPS.SECURE_SSL_REDIRECT=True and the other HTTPS security headers in your .env file. TrustRide’s settings already configure SECURE_HSTS_SECONDS, SECURE_HSTS_INCLUDE_SUBDOMAINS, and SECURE_HSTS_PRELOAD when DEBUG=False.
TrustRide ships with Sentry (
sentry-sdk==2.63.0) in its dependencies. To enable error tracking, initialise Sentry in trust_ride/settings.py with your project DSN — for example, add sentry_sdk.init(dsn=os.getenv("SENTRY_DSN")) near the top of the file after installing sentry-sdk. See the Configuration reference for details.