Installation¶
This guide covers how to install and run Ospobox in different environments.
Requirements¶
- Python 3.12 or higher
- uv (recommended) or pip for package management
- SQLite (development) or PostgreSQL 14+ (production)
- Redis, for the background worker's job queue. Rate limiting uses it where it is available and falls back to an in-memory window where it is not
Development setup¶
With make¶
The easiest way to get started is using the provided Makefile:
# Clone the repository
git clone https://git.sr.ht/~sfermigier/ospobox
cd ospobox
# Install all dependencies (uses uv)
make dev
# Copy and configure environment
cp .env.example .env
# Run database migrations — required, the app does not create tables
make migrate
# Start the development server
make run
The application will be available at http://localhost:8000.
By hand¶
If you prefer manual installation:
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -e ".[dev]"
# Configure environment
cp .env.example .env
# Run migrations — the only thing that creates the schema
alembic upgrade head
# Start server
litestar run --reload
Production deployment¶
Environment variables¶
For production, you must configure these environment variables:
# Required
SECRET_KEY=<generate-a-secure-key>
DATABASE_URL=postgresql+asyncpg://user:pass@host:5432/ospobox
DEBUG=false
# Recommended
REDIS_URL=redis://localhost:6379/0
BASE_URL=https://your-domain.com
Secret Key
Generate a secure secret key for production:
With Docker¶
The repository includes a production-ready multi-stage Dockerfile:
# Build the image
docker build -t ospobox .
# Run with environment file
docker run -p 8000:8000 --env-file .env.production ospobox
The image includes:
- Multi-stage build for minimal size
- Non-root user for security
- Health check endpoint
- Optimized for production
With Docker Compose¶
Production needs PostgreSQL and Redis:
# Copy and configure environment
cp .env.production.example .env
# Set a real SECRET_KEY: compose refuses to start without one
python -c "import secrets; print('SECRET_KEY=' + secrets.token_urlsafe(32))" >> .env
# Start all services
docker compose up -d
# If port 8000 is already taken, publish elsewhere and say so:
# APP_PORT=8010 BASE_URL=http://localhost:8010 docker compose up -d
# View logs
docker compose logs -f
The docker-compose.yml brings up:
- PostgreSQL database
- Redis for the queue and rate limiting
- The application, which runs
alembic upgrade headbefore serving - The background worker, which is what syncs, scores, raises alerts and sends digests. Nothing happens without it, so it starts by default
- Health checks and persistent volumes
Then create the first account. Either register at /auth/register, or,
for an instance where no one reaching the site should be able to sign
themselves up, set ALLOW_REGISTRATION=false in .env and run:
It prints a generated password once. See the first user.
Both containers read the same environment, so anything the worker needs
is set once. That matters for SMTP_* and BASE_URL, which the worker
uses to send digests and to write the links inside them, and for
LLM_API_KEY, which it reads when it builds a report.
Local development¶
make run starts Redis, the web server with hot reload, and the worker
together through honcho:
There was a docker-compose.dev.yml for this. It is gone: it omitted Redis
and the worker, and overrode the image's command so migrations never
ran, so it could not work. make run does the same job and does work.
Seeing a digest without an SMTP account¶
Scheduled digests are the product's own north star and the easiest thing to leave untested, because sending one needs a mail server. There is a local catcher behind a profile:
Then point the application at it. Sending is gated on all three values being set, and the catcher ignores the credentials:
SMTP_HOST=mailpit # localhost, if the worker runs outside Docker
SMTP_PORT=1025 # 2025 in that case: see below
SMTP_USERNAME=any
SMTP_PASSWORD=any
SMTP_USE_TLS=false
Mail arrives at http://localhost:8025. Swap SMTP_HOST for a real
provider when you want to prove deliverability.
The catcher's SMTP port is published on 2025, although inside the
Docker network it is 1025. Proton Mail Bridge and several other local
mail agents hold 1025 on a developer's machine, so publishing it there
either refuses to bind or points a digest at somebody's real mail
account. A worker started with make run therefore wants
SMTP_HOST=localhost and SMTP_PORT=2025.
Database migrations¶
Run migrations before starting the application:
To create a new migration after model changes:
Verifying the installation¶
After starting the application, verify it's working:
- Open http://localhost:8000/health - should return
{"status": "ok"}and the version - Open http://localhost:8000 - should show the home page
- Check the API docs at http://localhost:8000/docs
Troubleshooting¶
Common problems¶
Port 8000 already in use
Another application is using port 8000. Either stop that application or run Ospobox on a different port:
Database connection failed
Verify your DATABASE_URL is correct and the database server is running:
SECRET_KEY error on startup
In production (DEBUG=false), you must set a secure SECRET_KEY. Generate one with:
Migration errors
If migrations fail, check that:
- The database exists and is accessible
- You have the latest code (
git pull) - Try resetting migrations (development only):
Next steps¶
- Configuration - Configure OAuth, email, and other settings
- First steps - Add your first organization