Orange County Lettings - CI/CD¶
This page documents the CI/CD workflow: local helpers (Makefile), GitHub Actions pipeline, and deployment to Render.
Makefile¶
Targets overview:
build: build local Docker image (IMAGE_NAME/TAG)run-dev/run-prod: run the image mapping port 8000 and binding the SQLite DB filepull-run: pull from Docker Hub then run locallytest: run tests with coverage (outside Docker)push: build and push multi-arch image to Docker Hub (linux/amd64andlinux/arm64)clean: remove local image
Key variables:
IMAGE_NAME:dgggl88/oc_lettingsTAG:latestENV_FILE:.env(source forDJANGO_SECRET_KEYin run targets)DB_FILE:oc-lettings-site.sqlite3(bind-mounted into the container)
GitHub Actions¶
Workflow file: .github/workflows/ci.yml
Jobs:
Lint - Setup Python 3.13 - Install
requirements.txt- Runflake8Tests - Needs: Lint - Setup Python 3.13 - Install dependencies - Run coverage with threshold (
--fail-under=80)Build and push Docker image (multi-arch) - Needs: Tests - Only on
main- Login to Docker Hub - Build and push tags:latestand<sha>for platformslinux/amd64, linux/arm64Deploy to Render - Needs: Build and push - Only on
main- UsesJorgeLNJunior/render-deploywithRENDER_SERVICE_IDandRENDER_API_KEY
Read the Docs documentation deployment¶
The documentation is built with Sphinx and deployed on Read the Docs. Builds are triggered automatically on every push via a GitHub → Read the Docs webhook.
Project configuration¶
The Read the Docs config lives at the repository root:
.readthedocs.yaml. Minimal excerpt:version: 2 build: os: ubuntu-22.04 tools: python: "3.12" sphinx: configuration: docs/conf.py fail_on_warning: true python: install: - requirements: docs/requirements.txt
Sphinx configuration:
docs/conf.pyDocumentation dependencies:
docs/requirements.txt
GitHub ↔ Read the Docs integration¶
To enable automatic builds on push:
On Read the Docs (project Admin): - Go to
Admin→Integrations→Add integration. - ChooseGitHub incoming webhookand copy the generatedPayload URL.On GitHub (repository Settings): -
Settings→Webhooks→Add webhook. - Paste thePayload URLfrom Read the Docs. - Content type:application/json. - Events: selectJust the push event. - Save the webhook.Push to any branch. Read the Docs should receive the event and schedule a build using
.readthedocs.yamlanddocs/conf.py.
Troubleshooting¶
Ensure
docsbuilds locally:sphinx-build -b html docs docs/_build/html.Check that the webhook deliveries in GitHub show
200responses.In Read the Docs, verify build logs and that the environment matches the YAML (Ubuntu 22.04, Python 3.12) and that dependencies from
docs/requirements.txtare installed.
Required secrets:
DJANGO_SECRET_KEY(tests)DOCKER_USERNAME,DOCKERHUB_TOKEN(Docker Hub)RENDER_SERVICE_ID,RENDER_API_KEY(Render)
Generate secrets with Clinkey (recommended)¶
Web UI: see Orange County Lettings - Clinkey
CLI example to generate a strong secret for GitHub Actions or Render:
pip install clinkey-cli clinkey -t super_strong -l 64 -s - --lower
Render deployment¶
Production URL:
https://oc-lettings-x670.onrender.comRender fetches the Docker image produced by CI and redeploys the service.
Environment variables to set in Render:
ENV_MODE=prodDJANGO_SECRET_KEY(strong secret)SENTRY_DSN(optional)
Local quick commands¶
# Build and run in dev
make run-dev
# Run tests with coverage
make test
# Push image to Docker Hub
make push
Orange County Lettings