@bostonuniversity/buwp-local 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.buwp-local.examplejson +27 -0
- package/.buwp-local.json +27 -0
- package/IMPLEMENTATION_SUMMARY.md +385 -0
- package/MULTI_PROJECT_GUIDE.md +929 -0
- package/PROJECT_OVERVIEW.md +307 -0
- package/QUICK_REFERENCE.md +234 -0
- package/ROADMAP.md +362 -0
- package/SHARED_ENVIRONMENT_EXAMPLES.md +578 -0
- package/USAGE.md +258 -0
- package/bin/buwp-local.js +95 -0
- package/bostonuniversity-buwp-local-0.1.0.tgz +0 -0
- package/docker-compose.yml +106 -0
- package/lib/commands/config.js +131 -0
- package/lib/commands/destroy.js +96 -0
- package/lib/commands/logs.js +66 -0
- package/lib/commands/start.js +98 -0
- package/lib/commands/stop.js +62 -0
- package/lib/compose-generator.js +279 -0
- package/lib/config.js +292 -0
- package/lib/index.js +23 -0
- package/macos-keychain-notes.md +11 -0
- package/package.json +35 -0
- package/readme.md +3 -0
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
# Shared Environment - Practical Examples
|
|
2
|
+
|
|
3
|
+
## Example 1: Team Integration Sandbox
|
|
4
|
+
|
|
5
|
+
### Scenario
|
|
6
|
+
A team of 4 developers working on BU's WordPress site needs a shared local environment with:
|
|
7
|
+
- Custom theme (responsive-framework)
|
|
8
|
+
- Navigation plugin (bu-navigation)
|
|
9
|
+
- Analytics plugin (bu-custom-analytics)
|
|
10
|
+
- Slideshow plugin (bu-slideshow)
|
|
11
|
+
|
|
12
|
+
### Setup
|
|
13
|
+
|
|
14
|
+
**Step 1: Create Primary Configuration Repo**
|
|
15
|
+
```bash
|
|
16
|
+
mkdir -p ~/projects/bu-team-sandbox
|
|
17
|
+
cd ~/projects/bu-team-sandbox
|
|
18
|
+
|
|
19
|
+
# Initialize
|
|
20
|
+
buwp-local config --init
|
|
21
|
+
|
|
22
|
+
# Edit .buwp-local.json:
|
|
23
|
+
{
|
|
24
|
+
"projectName": "bu-team-sandbox",
|
|
25
|
+
"hostname": "buteam.local",
|
|
26
|
+
"multisite": true,
|
|
27
|
+
"services": {
|
|
28
|
+
"redis": true,
|
|
29
|
+
"s3proxy": true,
|
|
30
|
+
"shibboleth": true
|
|
31
|
+
},
|
|
32
|
+
"ports": {
|
|
33
|
+
"http": 80,
|
|
34
|
+
"https": 443,
|
|
35
|
+
"db": 3306,
|
|
36
|
+
"redis": 6379
|
|
37
|
+
},
|
|
38
|
+
"mappings": [],
|
|
39
|
+
"env": {
|
|
40
|
+
"WP_DEBUG": true,
|
|
41
|
+
"WP_DEBUG_LOG": true,
|
|
42
|
+
"XDEBUG": false
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Create .env.local with credentials
|
|
47
|
+
# Start environment
|
|
48
|
+
buwp-local start
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Step 2: Each Developer Adds Their Repo**
|
|
52
|
+
|
|
53
|
+
**Developer 1 - Theme:**
|
|
54
|
+
```bash
|
|
55
|
+
cd ~/projects/responsive-framework
|
|
56
|
+
buwp-local config --init --theme
|
|
57
|
+
|
|
58
|
+
# Edit .buwp-local.json to join shared sandbox:
|
|
59
|
+
{
|
|
60
|
+
"projectName": "bu-team-sandbox", # SHARED!
|
|
61
|
+
"hostname": "buteam.local",
|
|
62
|
+
"multisite": true,
|
|
63
|
+
"services": {
|
|
64
|
+
"redis": true,
|
|
65
|
+
"s3proxy": true,
|
|
66
|
+
"shibboleth": true
|
|
67
|
+
},
|
|
68
|
+
"ports": {
|
|
69
|
+
"http": 80,
|
|
70
|
+
"https": 443,
|
|
71
|
+
"db": 3306,
|
|
72
|
+
"redis": 6379
|
|
73
|
+
},
|
|
74
|
+
"mappings": [
|
|
75
|
+
{
|
|
76
|
+
"local": "./",
|
|
77
|
+
"container": "/var/www/html/wp-content/themes/responsive-framework"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"env": {
|
|
81
|
+
"WP_DEBUG": true
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
# Symlink shared credentials
|
|
86
|
+
ln -s ~/projects/bu-team-sandbox/.env.local .env.local
|
|
87
|
+
|
|
88
|
+
# Add theme to shared environment
|
|
89
|
+
buwp-local start
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Developer 2 - Navigation Plugin:**
|
|
93
|
+
```bash
|
|
94
|
+
cd ~/projects/bu-navigation
|
|
95
|
+
buwp-local config --init --plugin
|
|
96
|
+
|
|
97
|
+
# Edit .buwp-local.json (same projectName):
|
|
98
|
+
{
|
|
99
|
+
"projectName": "bu-team-sandbox",
|
|
100
|
+
"hostname": "buteam.local",
|
|
101
|
+
# ... same ports/services ...
|
|
102
|
+
"mappings": [
|
|
103
|
+
{
|
|
104
|
+
"local": "./",
|
|
105
|
+
"container": "/var/www/html/wp-content/plugins/bu-navigation"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
ln -s ~/projects/bu-team-sandbox/.env.local .env.local
|
|
111
|
+
buwp-local start
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Developers 3 & 4 repeat for their plugins...**
|
|
115
|
+
|
|
116
|
+
**Result:**
|
|
117
|
+
- All 4 developers access http://buteam.local
|
|
118
|
+
- All plugins and theme are active
|
|
119
|
+
- Shared database with realistic test data
|
|
120
|
+
- Each developer's file changes are live
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Example 2: Solo Developer - Isolated + Shared
|
|
125
|
+
|
|
126
|
+
### Scenario
|
|
127
|
+
One developer working on `bu-custom-analytics` needs:
|
|
128
|
+
- **Isolated environment** for feature development
|
|
129
|
+
- **Shared environment** for integration testing with other plugins
|
|
130
|
+
|
|
131
|
+
### Setup
|
|
132
|
+
|
|
133
|
+
**Isolated Configuration** (`.buwp-local.json`):
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"projectName": "bu-custom-analytics",
|
|
137
|
+
"hostname": "analytics.local",
|
|
138
|
+
"multisite": true,
|
|
139
|
+
"services": {
|
|
140
|
+
"redis": true,
|
|
141
|
+
"s3proxy": false,
|
|
142
|
+
"shibboleth": false
|
|
143
|
+
},
|
|
144
|
+
"ports": {
|
|
145
|
+
"http": 80,
|
|
146
|
+
"https": 443,
|
|
147
|
+
"db": 3306,
|
|
148
|
+
"redis": 6379
|
|
149
|
+
},
|
|
150
|
+
"mappings": [
|
|
151
|
+
{
|
|
152
|
+
"local": "./",
|
|
153
|
+
"container": "/var/www/html/wp-content/plugins/bu-custom-analytics"
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"env": {
|
|
157
|
+
"WP_DEBUG": true,
|
|
158
|
+
"XDEBUG": true
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Shared Configuration** (`.buwp-local.shared.json`):
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"projectName": "bu-integration",
|
|
167
|
+
"hostname": "buint.local",
|
|
168
|
+
"multisite": true,
|
|
169
|
+
"services": {
|
|
170
|
+
"redis": true,
|
|
171
|
+
"s3proxy": true,
|
|
172
|
+
"shibboleth": true
|
|
173
|
+
},
|
|
174
|
+
"ports": {
|
|
175
|
+
"http": 8080,
|
|
176
|
+
"https": 8443,
|
|
177
|
+
"db": 3307,
|
|
178
|
+
"redis": 6380
|
|
179
|
+
},
|
|
180
|
+
"mappings": [
|
|
181
|
+
{
|
|
182
|
+
"local": "./",
|
|
183
|
+
"container": "/var/www/html/wp-content/plugins/bu-custom-analytics"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"env": {
|
|
187
|
+
"WP_DEBUG": true,
|
|
188
|
+
"XDEBUG": false
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Workflow
|
|
194
|
+
|
|
195
|
+
**Morning - Feature Development (Isolated):**
|
|
196
|
+
```bash
|
|
197
|
+
cd ~/projects/bu-custom-analytics
|
|
198
|
+
|
|
199
|
+
# Use isolated config (default)
|
|
200
|
+
buwp-local start
|
|
201
|
+
|
|
202
|
+
# Develop at http://analytics.local
|
|
203
|
+
# Fast, isolated, clean environment
|
|
204
|
+
# Debug with Xdebug enabled
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Afternoon - Integration Testing (Shared):**
|
|
208
|
+
```bash
|
|
209
|
+
cd ~/projects/bu-custom-analytics
|
|
210
|
+
|
|
211
|
+
# Stop isolated
|
|
212
|
+
buwp-local stop
|
|
213
|
+
|
|
214
|
+
# Switch to shared config
|
|
215
|
+
cp .buwp-local.shared.json .buwp-local.json
|
|
216
|
+
|
|
217
|
+
# Join shared integration environment
|
|
218
|
+
buwp-local start
|
|
219
|
+
|
|
220
|
+
# Test at http://buint.local:8080
|
|
221
|
+
# Now running with other plugins/theme
|
|
222
|
+
# Test interactions and integration points
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**End of Day - Back to Isolated:**
|
|
226
|
+
```bash
|
|
227
|
+
# Restore isolated config
|
|
228
|
+
git checkout .buwp-local.json
|
|
229
|
+
|
|
230
|
+
# Back to isolated for tomorrow
|
|
231
|
+
buwp-local destroy # Clean up shared
|
|
232
|
+
buwp-local start # Start fresh isolated
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Example 3: Multi-Environment Matrix
|
|
238
|
+
|
|
239
|
+
### Scenario
|
|
240
|
+
Testing plugin compatibility across different configurations:
|
|
241
|
+
- Modern stack (latest everything)
|
|
242
|
+
- Legacy stack (older versions)
|
|
243
|
+
- Production replica
|
|
244
|
+
|
|
245
|
+
### Setup
|
|
246
|
+
|
|
247
|
+
**Create 3 Separate Environments:**
|
|
248
|
+
|
|
249
|
+
**Environment 1: Modern Stack**
|
|
250
|
+
```bash
|
|
251
|
+
cd ~/projects/bu-custom-analytics
|
|
252
|
+
|
|
253
|
+
# .buwp-local.modern.json:
|
|
254
|
+
{
|
|
255
|
+
"projectName": "modern-stack",
|
|
256
|
+
"hostname": "modern.local",
|
|
257
|
+
"image": "ghcr.io/bu-ist/bu-wp-docker-mod_shib:arm64-latest",
|
|
258
|
+
# ... modern settings ...
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
cp .buwp-local.modern.json .buwp-local.json
|
|
262
|
+
buwp-local start
|
|
263
|
+
# Test at http://modern.local
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**Environment 2: Legacy Stack**
|
|
267
|
+
```bash
|
|
268
|
+
# .buwp-local.legacy.json:
|
|
269
|
+
{
|
|
270
|
+
"projectName": "legacy-stack",
|
|
271
|
+
"hostname": "legacy.local",
|
|
272
|
+
"image": "ghcr.io/bu-ist/bu-wp-docker-mod_shib:legacy-tag",
|
|
273
|
+
"ports": {
|
|
274
|
+
"http": 8081,
|
|
275
|
+
"db": 3307
|
|
276
|
+
}
|
|
277
|
+
# ... legacy settings ...
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
cp .buwp-local.legacy.json .buwp-local.json
|
|
281
|
+
buwp-local start
|
|
282
|
+
# Test at http://legacy.local:8081
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Environment 3: Production Replica**
|
|
286
|
+
```bash
|
|
287
|
+
# .buwp-local.prod.json:
|
|
288
|
+
{
|
|
289
|
+
"projectName": "prod-replica",
|
|
290
|
+
"hostname": "prodlocal.local",
|
|
291
|
+
"ports": {
|
|
292
|
+
"http": 8082,
|
|
293
|
+
"db": 3308
|
|
294
|
+
}
|
|
295
|
+
# ... production-like settings ...
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
cp .buwp-local.prod.json .buwp-local.json
|
|
299
|
+
buwp-local start
|
|
300
|
+
# Test at http://prodlocal.local:8082
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Result:**
|
|
304
|
+
- All 3 environments running simultaneously
|
|
305
|
+
- Same plugin code in all 3
|
|
306
|
+
- Different WordPress/PHP versions
|
|
307
|
+
- Test compatibility across configurations
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Example 4: Department-Wide Shared Sandbox
|
|
312
|
+
|
|
313
|
+
### Scenario
|
|
314
|
+
Marketing department (10 people) needs shared sandbox with:
|
|
315
|
+
- Content editors
|
|
316
|
+
- Designers
|
|
317
|
+
- Developers
|
|
318
|
+
- QA testers
|
|
319
|
+
|
|
320
|
+
### Setup
|
|
321
|
+
|
|
322
|
+
**Central Configuration Repository:**
|
|
323
|
+
```bash
|
|
324
|
+
# Shared repo that everyone clones
|
|
325
|
+
git clone https://github.com/bu-ist/bu-marketing-sandbox.git
|
|
326
|
+
cd bu-marketing-sandbox
|
|
327
|
+
|
|
328
|
+
# .buwp-local.json:
|
|
329
|
+
{
|
|
330
|
+
"projectName": "bu-marketing",
|
|
331
|
+
"hostname": "marketing.local",
|
|
332
|
+
"multisite": true,
|
|
333
|
+
"services": {
|
|
334
|
+
"redis": true,
|
|
335
|
+
"s3proxy": true,
|
|
336
|
+
"shibboleth": true
|
|
337
|
+
},
|
|
338
|
+
"ports": {
|
|
339
|
+
"http": 80,
|
|
340
|
+
"https": 443,
|
|
341
|
+
"db": 3306,
|
|
342
|
+
"redis": 6379
|
|
343
|
+
},
|
|
344
|
+
"mappings": [
|
|
345
|
+
{
|
|
346
|
+
"local": "../responsive-framework",
|
|
347
|
+
"container": "/var/www/html/wp-content/themes/responsive-framework"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"local": "../bu-slideshow",
|
|
351
|
+
"container": "/var/www/html/wp-content/plugins/bu-slideshow"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"local": "../bu-analytics",
|
|
355
|
+
"container": "/var/www/html/wp-content/plugins/bu-analytics"
|
|
356
|
+
}
|
|
357
|
+
],
|
|
358
|
+
"env": {
|
|
359
|
+
"WP_DEBUG": false # Production-like for QA
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
# .env.local (shared credentials via 1Password/LastPass)
|
|
364
|
+
# Includes test user accounts for all team members
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**Each Team Member:**
|
|
368
|
+
```bash
|
|
369
|
+
# Clone central config
|
|
370
|
+
git clone https://github.com/bu-ist/bu-marketing-sandbox.git ~/projects/bu-marketing-sandbox
|
|
371
|
+
|
|
372
|
+
# Clone the repos to develop
|
|
373
|
+
cd ~/projects
|
|
374
|
+
git clone https://github.com/bu-ist/responsive-framework.git
|
|
375
|
+
git clone https://github.com/bu-ist/bu-slideshow.git
|
|
376
|
+
git clone https://github.com/bu-ist/bu-analytics.git
|
|
377
|
+
|
|
378
|
+
# Start shared environment
|
|
379
|
+
cd ~/projects/bu-marketing-sandbox
|
|
380
|
+
# Add .env.local with shared credentials
|
|
381
|
+
buwp-local start
|
|
382
|
+
|
|
383
|
+
# Access http://marketing.local
|
|
384
|
+
# All team members work in same environment
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
**Benefits:**
|
|
388
|
+
- Designers see live changes to theme
|
|
389
|
+
- Developers see plugin interactions
|
|
390
|
+
- Content editors have realistic environment
|
|
391
|
+
- QA tests actual configuration
|
|
392
|
+
- Everyone shares same database with test content
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## Example 5: Feature Branch Testing
|
|
397
|
+
|
|
398
|
+
### Scenario
|
|
399
|
+
Test a feature branch alongside main branch:
|
|
400
|
+
- `main` branch in production-like environment
|
|
401
|
+
- `feature/new-ui` branch in test environment
|
|
402
|
+
|
|
403
|
+
### Setup
|
|
404
|
+
|
|
405
|
+
**Main Branch Environment:**
|
|
406
|
+
```bash
|
|
407
|
+
cd ~/projects/bu-custom-analytics
|
|
408
|
+
git checkout main
|
|
409
|
+
|
|
410
|
+
# .buwp-local.json (default):
|
|
411
|
+
{
|
|
412
|
+
"projectName": "bu-analytics-main",
|
|
413
|
+
"hostname": "analytics-main.local",
|
|
414
|
+
"ports": {
|
|
415
|
+
"http": 80,
|
|
416
|
+
"db": 3306
|
|
417
|
+
},
|
|
418
|
+
"mappings": [
|
|
419
|
+
{
|
|
420
|
+
"local": "./",
|
|
421
|
+
"container": "/var/www/html/wp-content/plugins/bu-custom-analytics"
|
|
422
|
+
}
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
buwp-local start
|
|
427
|
+
# Test main at http://analytics-main.local
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
**Feature Branch Environment:**
|
|
431
|
+
```bash
|
|
432
|
+
cd ~/projects/bu-custom-analytics
|
|
433
|
+
git checkout feature/new-ui
|
|
434
|
+
|
|
435
|
+
# Change projectName in .buwp-local.json:
|
|
436
|
+
{
|
|
437
|
+
"projectName": "bu-analytics-feature",
|
|
438
|
+
"hostname": "analytics-feature.local",
|
|
439
|
+
"ports": {
|
|
440
|
+
"http": 8080,
|
|
441
|
+
"db": 3307
|
|
442
|
+
},
|
|
443
|
+
"mappings": [
|
|
444
|
+
{
|
|
445
|
+
"local": "./",
|
|
446
|
+
"container": "/var/www/html/wp-content/plugins/bu-custom-analytics"
|
|
447
|
+
}
|
|
448
|
+
]
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
buwp-local start
|
|
452
|
+
# Test feature at http://analytics-feature.local:8080
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
**Result:**
|
|
456
|
+
- Both branches running simultaneously
|
|
457
|
+
- Compare behavior side-by-side
|
|
458
|
+
- Separate databases for each
|
|
459
|
+
- No branch switching needed
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## Tips for Shared Environments
|
|
464
|
+
|
|
465
|
+
### 1. Use Configuration Management
|
|
466
|
+
```bash
|
|
467
|
+
# Store configs in version control
|
|
468
|
+
~/projects/
|
|
469
|
+
├── bu-team-sandbox/ # Primary config repo
|
|
470
|
+
│ ├── .buwp-local.json
|
|
471
|
+
│ ├── .env.local.example
|
|
472
|
+
│ └── README.md
|
|
473
|
+
├── plugin-a/
|
|
474
|
+
│ ├── .buwp-local.json # Points to shared
|
|
475
|
+
│ └── .env.local -> ../bu-team-sandbox/.env.local
|
|
476
|
+
└── plugin-b/
|
|
477
|
+
├── .buwp-local.json # Points to shared
|
|
478
|
+
└── .env.local -> ../bu-team-sandbox/.env.local
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
### 2. Document Your Shared Environments
|
|
482
|
+
Create a team wiki page:
|
|
483
|
+
```markdown
|
|
484
|
+
# Team Shared Environments
|
|
485
|
+
|
|
486
|
+
## bu-team-sandbox
|
|
487
|
+
- **URL:** http://buteam.local
|
|
488
|
+
- **Purpose:** Integration testing
|
|
489
|
+
- **Includes:** theme + all plugins
|
|
490
|
+
- **Managed by:** @teamlead
|
|
491
|
+
- **Config repo:** github.com/bu-ist/bu-team-sandbox
|
|
492
|
+
|
|
493
|
+
## bu-staging-replica
|
|
494
|
+
- **URL:** http://bustaging.local:8080
|
|
495
|
+
- **Purpose:** Pre-production testing
|
|
496
|
+
- **Includes:** Production plugins only
|
|
497
|
+
- **Managed by:** @qa-lead
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
### 3. Use Consistent Naming
|
|
501
|
+
```bash
|
|
502
|
+
# Good naming convention:
|
|
503
|
+
bu-team-sandbox # Team shared environment
|
|
504
|
+
bu-integration # Integration testing
|
|
505
|
+
bu-staging-replica # Staging mirror
|
|
506
|
+
bu-prod-replica # Production mirror
|
|
507
|
+
|
|
508
|
+
# Avoid:
|
|
509
|
+
sandbox
|
|
510
|
+
test
|
|
511
|
+
local
|
|
512
|
+
dev
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
### 4. Regular Cleanup
|
|
516
|
+
```bash
|
|
517
|
+
# Weekly: Clean shared environments
|
|
518
|
+
buwp-local destroy
|
|
519
|
+
buwp-local start
|
|
520
|
+
# Fresh start with clean database
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
### 5. Backup Shared Databases
|
|
524
|
+
```bash
|
|
525
|
+
# Before major changes:
|
|
526
|
+
docker exec bu-team-sandbox-db-1 mysqldump -u wordpress -ppassword wordpress > backup-$(date +%Y%m%d).sql
|
|
527
|
+
|
|
528
|
+
# Restore if needed:
|
|
529
|
+
docker exec -i bu-team-sandbox-db-1 mysql -u wordpress -ppassword wordpress < backup-20251110.sql
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
---
|
|
533
|
+
|
|
534
|
+
## Troubleshooting Common Issues
|
|
535
|
+
|
|
536
|
+
### Issue: "Port already in use"
|
|
537
|
+
**Cause:** Another shared environment using same ports
|
|
538
|
+
**Solution:** Use different ports in shared config:
|
|
539
|
+
```json
|
|
540
|
+
{
|
|
541
|
+
"ports": {
|
|
542
|
+
"http": 8081,
|
|
543
|
+
"db": 3307
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
### Issue: "My changes don't appear"
|
|
549
|
+
**Cause:** Wrong repo's mapping is active
|
|
550
|
+
**Solution:** Check which repo last ran `start`:
|
|
551
|
+
```bash
|
|
552
|
+
docker compose -p bu-team-sandbox ps
|
|
553
|
+
# See which volumes are mounted
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
### Issue: "Database has wrong data"
|
|
557
|
+
**Cause:** Another developer made changes
|
|
558
|
+
**Solution:** Communicate or use separate environments
|
|
559
|
+
|
|
560
|
+
### Issue: "Config out of sync"
|
|
561
|
+
**Cause:** Repos have different settings
|
|
562
|
+
**Solution:** Use symlinks or central config repo
|
|
563
|
+
|
|
564
|
+
---
|
|
565
|
+
|
|
566
|
+
## Summary
|
|
567
|
+
|
|
568
|
+
Shared environments enable:
|
|
569
|
+
- ✅ Team collaboration on integrated stack
|
|
570
|
+
- ✅ Integration testing without deploy
|
|
571
|
+
- ✅ Multiple development strategies
|
|
572
|
+
- ✅ Flexible workflows (solo + team)
|
|
573
|
+
- ✅ Realistic production-like testing
|
|
574
|
+
|
|
575
|
+
Use the right tool for the job:
|
|
576
|
+
- **Isolated** = Solo development, fast iteration
|
|
577
|
+
- **Shared** = Integration, team collaboration
|
|
578
|
+
- **Both** = Maximum flexibility
|