Prerequisites¶
Python 3.12+
uv package manager
Redis 6.2+ (for job queue and UWS state)
A mission source file (see Building a Source)
Installation¶
From source¶
git clone https://github.com/nasa-fornax/fornax-cutouts
cd fornax-cutouts
uv syncAs a library dependency¶
Add fornax-cutouts to your project’s dependencies. If you are developing against a local clone side-by-side with your service:
# pyproject.toml
[tool.uv.sources]
fornax-cutouts = { path = "../fornax-cutouts", editable = true }Then run:
uv syncMinimum Configuration¶
Fornax Cutouts requires at minimum two environment variables to start:
export CUTOUTS__SOURCE_PATH=/path/to/your/sources
export CUTOUTS__REDIS__HOST=localhostAll other settings have sensible defaults. See Configuration for the full reference.
Using a .env file¶
The service reads a .env file from the working directory automatically:
# .env
CUTOUTS__SOURCE_PATH=/path/to/your/sources
CUTOUTS__REDIS__HOST=localhost
CUTOUTS__STORAGE__PREFIX=s3://my-bucket/cutouts
CUTOUTS__LOG__LEVEL=infoStarting Redis¶
If you don’t have Redis running locally, the quickest way is via Docker:
docker run -d -p 6379:6379 valkey/valkey-bundle:9.1Running the API¶
fornax-cutouts apiThe API will start on http://localhost:8000 by default. Visit http://localhost:8000/docs for the interactive Swagger UI.
For development with auto-reload:
fornax-cutouts api --reloadRunning the Worker¶
In a separate terminal:
fornax-cutouts workerThe worker connects to Redis and begins consuming from the cutouts and high_mem queues.
Verifying the Setup¶
Check the health endpoint:
curl http://localhost:8000/api/healthExpected response:
{
"status": "ok",
"details": "Redis connection successful",
"timestamp": "2024-01-01T00:00:00Z",
"environment": "dev"
}List registered missions (requires at least one source file in CUTOUTS__SOURCE_PATH):
curl http://localhost:8000/api/v0/missionsProject Layout¶
When using fornax-cutouts as a library, a typical project structure looks like:
my-cutouts-service/
├── sources/ # Mission source files (CUTOUTS__SOURCE_PATH)
│ └── my_mission.py
├── .env # Local environment config
└── pyproject.tomlEach .py file under CUTOUTS__SOURCE_PATH is automatically discovered and executed at startup. Any file that uses @cutout_registry.register_source(...) will register its source with the service.
Next Steps¶
Configuration — tune Redis, worker, and storage settings
CLI Reference — all
fornax-cutoutscommand optionsBuilding a Source — implement your first mission source
API Reference — explore the REST endpoints