This directory contains a Dev Container configuration that provides a fully configured development environment with all services (PostgreSQL/PostGIS, Elasticsearch, Redis) running as companion containers.
- Docker Desktop (or a compatible Docker engine)
- VS Code with the Dev Containers extension
- Open this repository in VS Code
- When prompted, click "Reopen in Container" — or use the command palette:
Dev Containers: Reopen in Container - Wait for the container to build and the
postCreateCommandsetup script to finish (first run takes a few minutes) - You're ready to go!
| Service | Hostname | Port |
|---|---|---|
| PostgreSQL | postgresql |
5432 |
| Elasticsearch | elasticsearch |
9200 |
| Redis | redis |
6379 |
| API (when run) | localhost |
6543 |
All ports are forwarded to your host machine for convenience.
# Run the test suite
pytest
# Run a specific test file
pytest c2corg_api/tests/models/test_book.py
# Run the linter
flake8 c2corg_api es_migration
# Start the API server (with auto-reload)
pserve development.ini --reload
# Or use make targets
make test
make serve
make lintIf dependencies change, rebuild the container:
- Command palette →
Dev Containers: Rebuild Container
-
Database errors: The setup script creates both databases automatically. If you need to re-run:
PGPASSWORD=test PGUSER=postgres PGHOST=postgresql \ bash .devcontainer/setup.sh
-
Elasticsearch not ready: The setup script waits for ES, but if tests fail with connection errors, check:
curl http://elasticsearch:9200 -
Config out of date: Re-generate config files:
bash .devcontainer/setup.sh