diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..6f6fce1 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,119 @@ +# Contributing Guide + +## Purpose +This repository is the standalone productized Workdock platform. + +Use this file as the quick-start guide for future coders. It complements: +- `DEPLOYMENT.md` +- `backend/workflows/templates/workflows/project_wiki.html` +- `backend/workflows/templates/workflows/developer_handbook.html` + +If you change architecture, deployment flow, or operational behavior, update the relevant documentation in the same branch. + +## Branch Policy +- `develop`: active integration branch +- `main`: stable branch for production promotion +- short-lived feature branches: branch from `develop`, merge back into `develop` + +Do not use `main` as the default development branch. + +## Current Delivery Model +- GitHub Actions is used for CI +- the current test server is local/LAN-only +- deployment to the test server is manual from a LAN-connected machine + +Standard test deployment command: + +```bash +./scripts/deploy_test_from_mac.sh +``` + +Why: +- GitHub-hosted runners cannot reliably reach the private LAN target at `192.168.2.55` + +## Architecture Summary +Main stack: +- Django +- Celery +- PostgreSQL +- Redis +- Caddy + +Important repository areas: +- `backend/config/`: Django configuration +- `backend/workflows/`: application code +- `backend/workflows/templates/workflows/`: templates and in-app documentation +- `backend/workflows/static/workflows/`: CSS and JS +- `backend/media/templates/`: PDF HTML templates + +Current backend modularization: +- `views.py`: thin route wrapper layer +- split view modules: + - `request_views.py` + - `account_views.py` + - `admin_config_views.py` + - `form_builder_views.py` + - `observability_views.py` + - `integration_admin_views.py` + - `welcome_email_views.py` + - `intro_builder_views.py` +- `tasks.py`: async task entrypoints/orchestration +- `pdf_rendering.py` and `pdf_sections.py`: PDF rendering +- `email_workflows.py` and `notification_dispatch.py`: mail/notification orchestration +- `models.py`: stable import facade over split model modules + +## Engineering Rules +1. Preserve runtime behavior while refactoring. +2. Prefer shared UI/system primitives over page-local one-off patterns. +3. Do not silently overwrite environment-specific configuration data. +4. Treat database-backed admin configuration as runtime state, not seed data. +5. Update docs when workflow or architecture changes. + +## Code vs Data +Not all visible behavior comes from code. + +Code-driven: +- page layout +- permissions +- routing +- task behavior +- deploy scripts + +Database-driven: +- app registry order and visibility +- branding and company config +- builder settings +- intro checklist items +- notification templates and rules + +If local UI and server UI differ, check the database-backed config before assuming a code drift. + +## Testing Rules +Minimum validation after non-trivial changes: + +```bash +docker compose exec -T web python manage.py check +docker compose exec -T web python manage.py test +``` + +Also verify specifically when changing: +- PDFs +- deployment/config +- templates/UI + +## Documentation Rules +Keep these current: +- `DEPLOYMENT.md` +- `PRODUCTIZATION_ROADMAP.md` +- `backend/workflows/templates/workflows/project_wiki.html` +- `backend/workflows/templates/workflows/developer_handbook.html` + +## Recommended Change Flow +1. Start from `develop` +2. Implement the change +3. Validate locally +4. Update docs if needed +5. Push to GitHub +6. Let CI run +7. Deploy from the Mac if runtime verification is needed +8. Promote `develop` to `main` when stable diff --git a/backend/workflows/templates/workflows/developer_handbook.html b/backend/workflows/templates/workflows/developer_handbook.html index 04d5474..01b9dea 100644 --- a/backend/workflows/templates/workflows/developer_handbook.html +++ b/backend/workflows/templates/workflows/developer_handbook.html @@ -23,9 +23,11 @@
workdock-platform (current local path; legacy compose project name may still be retained for runtime continuity)CONTRIBUTING.md/backend/config/: Django settings, WSGI, URL config/backend/workflows/: application logic, views, models, tasks, templates, static assets/backend/workflows/views.py: thin route wrapper layer; most view logic now lives in split modules by domain/backend/workflows/models.py: stable model import surface over split model modules/backend/workflows/tasks.py: async task entrypoints; PDF and notification logic were moved into dedicated modules/backend/workflows/templates/workflows/base_shell.html: standard page shell for new staff-facing pages/backend/workflows/roles.py: centralized role names, capability matrix, and template permission helpersbase_shell.html; do not rebuild topbar/frame logic in page-local templates./.github/workflows/i18n.yml: translation compile validation in CIdevelop is the active integration branch.main is the stable branch intended for production promotion.develop and merge back into develop.developdevelop into main when stablecd /path/to/workdock-platform
docker compose up -d --build
@@ -81,7 +109,7 @@ docker compose up -d --build
user_test / user12345docker compose up -d --build
docker compose restart web
docker compose restart worker
@@ -93,7 +121,7 @@ docker compose down -v
The source code is bind-mounted into the container. Most template/view/static changes only require a web restart, not a full rebuild. Image changes such as system packages require docker compose up -d --build.
- docker compose exec -T web python manage.py makemigrations
docker compose exec -T web python manage.py migrate
docker compose exec -T web python manage.py check
@@ -101,6 +129,7 @@ docker compose exec -T web python manage.py check
entrypoint-web.sh.roles.py, gate the view, and hide the UI affordance when the capability is absent.make i18n-update-en
make i18n-compile
@@ -134,11 +183,12 @@ docker compose exec -T web django-admin compilemessages
preferred_language is normalized in model save() and also has a DB default of de, so alternate creation paths cannot insert null values.xhtml2pdf.templates.pdf, but can now be replaced from Admin Apps → Branding.backend/workflows/tasks.py.backend/workflows/tasks.py.pdf_rendering.py and pdf_sections.py.preferred_language, with German fallback.DEFAULT_NOTIFICATION_TEMPLATES in tasks.py.NotificationTemplate and NotificationRule.preferred_language value.email_workflows.py and notification_dispatch.py.backend/workflows/services.py.PortalBranding.Branding.workflows/app_registry.py.PortalAppConfig./admin-tools/apps/ for Platform Owner.PortalTrialConfig./admin-tools/trial/ for Platform Owner.FormFieldConfig + FormOptionform_builder_config.py.form_builder_runtime.py.form_builder.py is the stable facade import path./admin-tools/backups/ for create, verify, and delete actions. Keep real restore CLI-only.docker compose exec -T web python manage.py check
docker compose exec -T web python manage.py test
docker compose exec -T web python manage.py run_staging_e2e_check
@@ -247,7 +301,7 @@ docker compose exec -T web python manage.py run_staging_e2e_check
submitted, and enqueue the appropriate Celery task again.make backup-create
make backup-verify BACKUP_DIR=backups/backup_YYYYmmdd_HHMMSS
Invalid HTTP_HOST header failure happens before normal page routing, so a broken hostname cannot render a custom error page on that same broken host. Use a working host or IP to access the runbook and fix the env file.DJANGO_DEBUG=1 in .env.test because the security checks correctly reject insecure cookie settings when DEBUG=0 and the deployment is still plain HTTP behind a local test topology. This is acceptable for the test box only. Production must run with HTTPS and DEBUG=0.
docker-compose.prod.ymlweb and hard-refresh browserchardet==5.2.0 is installed in the rebuilt image and restart web/workerapp user..env, not in tracked files.{% trans "Engineering documentation for architecture, local setup, Docker, migrations, translations, deployment, testing, and long-term maintenance." %}
+{% trans "Engineering runbook for architecture, branch workflow, deployment, CI/CD, code guidelines, and long-term maintenance." %}