You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add SQLite database isolation by branch and documentation
Extend branch isolation to SQLite databases for local development
and add comprehensive documentation for the branch isolation feature.
Changes to SQLite isolation:
- Modify dev.py to use branch-specific SQLite files (db-{branch}.sqlite3)
- Add *.sqlite3 to .gitignore to exclude database files
- Remove debug print statement from dev.py
- Each branch now has isolated SQLite data without requiring worktrees
Documentation improvements:
- Add complete "Docker Branch Isolation" section to README.md
- Document all branch:* commands (info, verify, volumes, clean)
- Add examples for multi-branch development and branch switching
- Add troubleshooting section for database configuration issues
- Update DOCKER-BRANCHES.md to mention SQLite isolation
- Add note in local setup about GIT_BRANCH export
New Taskfile command:
- task branch:verify - Comprehensive verification of branch configuration
Shows git branch, expected database, .env file, and PostgreSQL databases
This ensures complete data isolation between branches whether using
Docker (PostgreSQL) or local development (SQLite), preventing data
loss when switching branches.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+84-1Lines changed: 84 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,8 @@ Website for Python Ireland (python.ie / pycon.ie) community, built with Django 6
12
12
13
13
## Quick Start (Docker - Recommended)
14
14
15
+
**Note**: Each git branch automatically gets its own isolated database and Docker environment. See [Docker Branch Isolation](#docker-branch-isolation) below.
16
+
15
17
1. Build the Docker image:
16
18
```bash
17
19
task docker:build
@@ -20,7 +22,7 @@ Website for Python Ireland (python.ie / pycon.ie) community, built with Django 6
20
22
21
23
2. Start supporting services:
22
24
```bash
23
-
docker compose up -d postgres redis minio
25
+
docker compose up -d postgres redis
24
26
```
25
27
26
28
3. Run database migrations:
@@ -48,10 +50,79 @@ Website for Python Ireland (python.ie / pycon.ie) community, built with Django 6
48
50
7. Visit http://127.0.0.1:8000/ to see the site with sample content
49
51
8. Access Wagtail admin at http://127.0.0.1:8000/admin/
50
52
53
+
## Docker Branch Isolation
54
+
55
+
The project automatically isolates Docker environments by git branch, allowing you to work on multiple branches simultaneously without conflicts.
# Clean up volumes for current branch (DESTRUCTIVE!)
79
+
task branch:clean
80
+
```
81
+
82
+
### Working on Multiple Branches
83
+
84
+
**Scenario**: Work on `main` and `feature/new-auth` simultaneously.
85
+
86
+
```bash
87
+
# Terminal 1: Main branch on default ports
88
+
git checkout main
89
+
task run # Uses pythonie_main database on port 8000
90
+
91
+
# Terminal 2: Feature branch on custom ports
92
+
git checkout feature/new-auth
93
+
WEB_PORT=8001 PG_PORT=5433 task run # Uses pythonie_feature-new-auth on port 8001
94
+
```
95
+
96
+
### Switching Branches
97
+
98
+
When you switch branches, the system automatically uses the correct environment:
99
+
100
+
```bash
101
+
git checkout main
102
+
task run # Automatically uses main database
103
+
104
+
git checkout feature/xyz
105
+
task run # Automatically uses feature-xyz database (isolated from main)
106
+
```
107
+
108
+
**Note**: Rebuild the Docker image after switching branches if dependencies changed:
109
+
```bash
110
+
git checkout feature/new-dependencies
111
+
task docker:build
112
+
task run
113
+
```
114
+
115
+
For detailed documentation, see [DOCKER-BRANCHES.md](DOCKER-BRANCHES.md).
116
+
51
117
## Local Setup (Without Docker)
52
118
53
119
If you prefer to develop without Docker:
54
120
121
+
**Note**: When developing locally, each git branch automatically uses its own SQLite database (`db-{branch}.sqlite3`). Export `GIT_BRANCH` for automatic isolation:
122
+
```bash
123
+
export GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's/[^a-zA-Z0-9._-]/-/g'| tr '[:upper:]''[:lower:]')
124
+
```
125
+
55
126
1. Fork the repository into your own personal GitHub account
56
127
2. Clone your fork: `git clone git@github.com:YourGitHubName/website.git`
57
128
3. Ensure you are running Python 3.13: `python -V` should output `Python 3.13.x`
@@ -134,6 +205,12 @@ task heroku:releases # Show deployment history
134
205
task heroku:rollback # Rollback to previous release
0 commit comments