Deployment Procedures
Deployment order and procedures for the DARE and SocraticBooks services.
dare-backend
Script: dare-backend/devops/deploy.sh
Use this sequence for a standard production update:
- Announce the deployment window if users may be affected.
- Pull the target commit or release tag.
- Activate the virtual environment.
- On native Debian/Ubuntu API and RQ hosts, run
bash devops/install_document_runtime.sh. Install Python dependencies:pip install -r requirements/prod.txt. - Using the workers’ Python environment, run
python devops/check_document_runtime.pybefore restarting services. Run Django checks:python manage.py check. - Run migrations:
python manage.py migrate. - Collect static files:
python manage.py collectstatic --noinput. - Restart the API and worker services.
- Verify health endpoints:
/api/health/and/api/ready/.
If a change includes database migrations, deploy the backend before any frontend that depends on the new API shape.
dare-frontend
Script: dare-frontend/devops/deploy.sh
- Set production
VITE_*values before building. - Build:
npm run build. - Upload
dist/to the static host. - Confirm the static host rewrites SPA routes to
index.html. - Confirm REST and Socket.IO requests reach the configured backend.
socraticbooks-backend
Uses Docker Compose for deployment:
docker compose up -d --build
docker compose exec web python /app/backend/manage.py migrateDeployment Order
When deploying changes that span multiple projects, deploy in this order:
- dare-backend (other services depend on it)
- socraticbooks-backend (depends on dare-backend API)
- dare-frontend (depends on dare-backend API)
- socraticbooks-react (depends on socraticbooks-backend API)
If there are breaking API changes, coordinate backend and frontend deployments to minimize downtime.
Rollback
For backend-only failures:
- Revert to the previous known-good commit or release tag.
- Reinstall dependencies if the lockset changed.
- Restart the API and worker services.
- Verify health endpoints and key user flows.
Database rollbacks are migration-specific. Prefer forward-fix migrations unless the migration was explicitly designed to reverse safely.
Document parsing runtime
opencv-python is also installed transitively by Docling → RapidOCR. Its Linux wheel links to libGL.so.1 even though parsing does not open a display. Do not install the headless wheel alongside it: both own cv2. Docker installs libgl1 and GLib and checks the runtime during the build. Native deployments must install these libraries on every worker host; external staging scripts such as deploy_be.sh must run the same install and check steps above. A successful API health check does not exercise the document worker’s native libraries.
After deploying, reprocess an affected file in Advanced mode and confirm its structure and image descriptions. The existing Basic fallback can preserve text after an Advanced parser error, but does not repair the missing runtime library.
Incomplete image descriptions
OpenAI-compatible enrichment responses that are empty, malformed JSON, or token-limited get at most one additional attempt. A token-limited response doubles the original output allowance for that retry; every returned attempt is metered and wallet credit is checked again before retrying. Refusals and content-filtered responses are not retried. Persistent failures remain available through the existing retry-image-descriptions action; successful descriptions stay cached. This does not change the parsing mode or replace the file's search index by itself.