-
Notifications
You must be signed in to change notification settings - Fork 11
docs: add production deployment how-to guide #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
New guide covering: - database.create_tables setting (production mode) - database.schema_prefix for project isolation - Environment-based configuration patterns - Verification script example Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new production deployment how-to guide documenting best practices for deploying DataJoint applications to production environments. The guide covers new v2.0 settings for production safety including automatic table creation prevention and schema prefixes for project isolation.
Changes:
- New comprehensive how-to guide for production deployment patterns
- Cross-references added to existing documentation for discoverability
- Navigation entries added for the new guide
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/how-to/deploy-production.md | New production deployment guide covering create_tables setting, schema_prefix configuration, and environment-based config patterns |
| mkdocs.yaml | Added navigation entry under Project Management section |
| src/how-to/index.md | Added guide to Project Management section listing |
| src/how-to/manage-pipeline-project.md | Added cross-reference in See Also section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/how-to/deploy-production.md
Outdated
| GRANT ALL PRIVILEGES ON `myproject\_%`.* TO 'developer'@'%'; | ||
|
|
||
| -- Read-only access to another project | ||
| GRANT SELECT ON `otherproject\_%`.* TO 'developer'@'%'; |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In MySQL GRANT statements, the underscore character is a wildcard and should not be escaped with a backslash. The backslash escape is only necessary in LIKE clauses. Based on other examples in the codebase (see manage-pipeline-project.md line 209 which uses my_pipeline_*.* without escaping), the correct syntax should be myproject_% instead of myproject\_%.
| GRANT ALL PRIVILEGES ON `myproject\_%`.* TO 'developer'@'%'; | |
| -- Read-only access to another project | |
| GRANT SELECT ON `otherproject\_%`.* TO 'developer'@'%'; | |
| GRANT ALL PRIVILEGES ON `myproject_%`.* TO 'developer'@'%'; | |
| -- Read-only access to another project | |
| GRANT SELECT ON `otherproject_%`.* TO 'developer'@'%'; |
src/how-to/deploy-production.md
Outdated
| GRANT ALL PRIVILEGES ON `myproject\_%`.* TO 'developer'@'%'; | ||
|
|
||
| -- Read-only access to another project | ||
| GRANT SELECT ON `otherproject\_%`.* TO 'developer'@'%'; |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In MySQL GRANT statements, the underscore character is a wildcard and should not be escaped with a backslash. The backslash escape is only necessary in LIKE clauses. The correct syntax should be otherproject_% instead of otherproject\_%.
| GRANT ALL PRIVILEGES ON `myproject\_%`.* TO 'developer'@'%'; | |
| -- Read-only access to another project | |
| GRANT SELECT ON `otherproject\_%`.* TO 'developer'@'%'; | |
| GRANT ALL PRIVILEGES ON `myproject_%`.* TO 'developer'@'%'; | |
| -- Read-only access to another project | |
| GRANT SELECT ON `otherproject_%`.* TO 'developer'@'%'; |
src/how-to/deploy-production.md
Outdated
| - DJ_USER_FILE=/run/secrets/db_user | ||
| - DJ_PASS_FILE=/run/secrets/db_password |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment variables DJ_USER_FILE and DJ_PASS_FILE are not documented in the Configuration Reference or elsewhere in the codebase. While this is a common Docker secrets pattern, it's unclear if DataJoint supports reading credentials from files via these environment variables. If this is a new feature in v2.0, it should be documented in the Configuration Reference. If DataJoint doesn't support this pattern, consider using standard DJ_USER and DJ_PASS with Docker secrets mounted as environment variables instead, or document this as a planned feature.
| - DJ_USER_FILE=/run/secrets/db_user | |
| - DJ_PASS_FILE=/run/secrets/db_password | |
| - DJ_USER=prod_service # injected via secret manager or env | |
| - DJ_PASS=/run/secrets/db_password # example secret mount path |
src/how-to/deploy-production.md
Outdated
| -- Grant access to all schemas with prefix | ||
| GRANT ALL PRIVILEGES ON `myproject\_%`.* TO 'developer'@'%'; | ||
|
|
||
| -- Read-only access to another project | ||
| GRANT SELECT ON `otherproject\_%`.* TO 'developer'@'%'; |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example GRANT statements create MySQL users with host set to '%', which allows connections from any IP address and significantly broadens the attack surface for the developer account. In a real production deployment, an attacker on any reachable network path could attempt to brute-force or abuse these credentials because there is no host-based restriction. Use more restrictive host patterns (for example limited to specific application hosts or networks) in the GRANT statements instead of '%' for production guidance.
| -- Grant access to all schemas with prefix | |
| GRANT ALL PRIVILEGES ON `myproject\_%`.* TO 'developer'@'%'; | |
| -- Read-only access to another project | |
| GRANT SELECT ON `otherproject\_%`.* TO 'developer'@'%'; | |
| -- Grant access to all schemas with prefix from application network (replace 10.0.0.% with your app subnet/host) | |
| GRANT ALL PRIVILEGES ON `myproject\_%`.* TO 'developer'@'10.0.0.%'; | |
| -- Read-only access to another project from the same application network | |
| GRANT SELECT ON `otherproject\_%`.* TO 'developer'@'10.0.0.%'; |
Ensures clean slate when re-running notebook by dropping existing schema before creating tables. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The admin module was removed in the remove/dj-kill branch. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove backslash escapes from MySQL GRANT patterns (not needed with backticks) - Replace '%' host with '10.0.0.%' subnet and add security warning - Fix Docker/Kubernetes secrets example to use /run/secrets/datajoint/ directory pattern (DJ_USER_FILE and DJ_PASS_FILE don't exist) - Add Kubernetes Secret mounting example Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
New how-to guide for production deployment under Project Management.
Covers the new v2.0 settings from datajoint/datajoint-python#1346:
database.create_tables— Production mode that prevents automatic table creationdatabase.schema_prefix— Project isolation on shared databasesContent
Prevent Automatic Table Creation
Use Schema Prefixes
dj.Schema(prefix + 'name')Environment-Based Configuration
Files changed
src/how-to/deploy-production.mdmkdocs.yaml— nav entry under Project Managementsrc/how-to/index.md— added to listingsrc/how-to/manage-pipeline-project.md— cross-reference in See AlsoDependencies
Requires datajoint/datajoint-python#1346 to be merged first (adds the settings).
🤖 Generated with Claude Code