@bostonuniversity/buwp-local 0.6.3 → 0.7.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.
@@ -1,106 +0,0 @@
1
- # Complete local development environment for BU WordPress
2
- # Includes database, WordPress, S3 proxy, and Redis services
3
-
4
- services:
5
- db:
6
- image: mariadb:latest
7
- restart: always
8
- volumes:
9
- - db_data:/var/lib/mysql
10
- environment:
11
- MYSQL_DATABASE: wordpress
12
- MYSQL_USER: wordpress
13
- MYSQL_PASSWORD: ${WORDPRESS_DB_PASSWORD:-password}
14
- MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-rootpassword}
15
- ports:
16
- - "3306:3306"
17
- networks:
18
- - wp-network
19
-
20
- wordpress:
21
- # If DOCKER_REGISTRY is set, pull the image from there; otherwise, use the locally built image
22
- image: ghcr.io/bu-ist/bu-wp-docker-mod_shib:arm64-latest
23
- depends_on:
24
- - db
25
- - s3proxy
26
- - redis
27
- restart: always
28
- ports:
29
- - "80:80"
30
- - "443:443"
31
- hostname: ${WP_HOSTNAME:-wordpress.local}
32
- environment:
33
- WORDPRESS_DB_HOST: db:3306
34
- WORDPRESS_DB_USER: wordpress
35
- WORDPRESS_DB_PASSWORD: ${WORDPRESS_DB_PASSWORD:-password}
36
- WORDPRESS_DB_NAME: wordpress
37
- WORDPRESS_DEBUG: ${WORDPRESS_DEBUG:-0}
38
- SERVER_NAME: ${WP_HOSTNAME:-wordpress.local}
39
- HTTP_HOST: ${WP_HOSTNAME:-wordpress.local}
40
- SP_ENTITY_ID: ${SP_ENTITY_ID:-https://*.kualitest.research.bu.edu/shibboleth}
41
- IDP_ENTITY_ID: ${IDP_ENTITY_ID:-https://shib-test.bu.edu/idp/shibboleth}
42
- SHIB_IDP_LOGOUT: ${SHIB_IDP_LOGOUT:-https://shib-test.bu.edu/idp/logout.jsp}
43
- SHIB_SP_KEY: ${SHIB_SP_KEY}
44
- SHIB_SP_CERT: ${SHIB_SP_CERT}
45
- S3PROXY_HOST: http://s3proxy:8080
46
- FORWARDED_FOR_HOST: ${FORWARDED_FOR_HOST:-localhost}
47
- REDIS_HOST: redis
48
- REDIS_PORT: 6379
49
- TZ: America/New_York
50
- MULTISITE: true
51
- XDEBUG: ${XDEBUG:-false}
52
- WP_CLI_ALLOW_ROOT: true
53
- # S3 WordPress config
54
- WORDPRESS_CONFIG_EXTRA: |
55
- define('MULTISITE', true);
56
- define('SUBDOMAIN_INSTALL', false);
57
- define( 'S3_UPLOADS_BUCKET', '${S3_UPLOADS_BUCKET}');
58
- define( 'S3_UPLOADS_REGION', '${S3_UPLOADS_REGION}');
59
- define( 'S3_UPLOADS_SECRET', '${S3_UPLOADS_SECRET_ACCESS_KEY}');
60
- define( 'S3_UPLOADS_KEY', '${S3_UPLOADS_ACCESS_KEY_ID}');
61
- define( 'ACCESS_RULES_TABLE', '${ACCESS_RULES_TABLE}');
62
- define( 'S3_UPLOADS_OBJECT_ACL', null);
63
- define( 'S3_UPLOADS_AUTOENABLE', true );
64
- define( 'S3_UPLOADS_DISABLE_REPLACE_UPLOAD_URL', true);
65
- define( 'BU_INCLUDES_PATH', '/var/www/html/bu-includes' );
66
- volumes:
67
- - wp_build:/var/www/html
68
- - /Users/jaydub/CodeProjects/github/bu-media-s3:/var/www/html/wp-content/mu-plugins/bu-media-s3
69
- networks:
70
- - wp-network
71
-
72
- s3proxy:
73
- image: public.ecr.aws/bostonuniversity-nonprod/aws-sigv4-proxy
74
- restart: always
75
- command:
76
- - "-v"
77
- - "--name"
78
- - "s3-object-lambda"
79
- - "--region"
80
- - "${OLAP_REGION:-us-east-1}"
81
- - "--no-verify-ssl"
82
- - "--host"
83
- - "${OLAP}-${OLAP_ACCT_NBR}.s3-object-lambda.${OLAP_REGION:-us-east-1}.amazonaws.com"
84
- environment:
85
- healthcheck_path: '/s3proxy-healthcheck'
86
- AWS_ACCESS_KEY_ID: ${S3_UPLOADS_ACCESS_KEY_ID}
87
- AWS_SECRET_ACCESS_KEY: ${S3_UPLOADS_SECRET_ACCESS_KEY}
88
- REGION: ${S3_UPLOADS_REGION:-us-east-1}
89
- networks:
90
- - wp-network
91
-
92
- redis:
93
- image: redis:alpine
94
- restart: always
95
- ports:
96
- - "6379:6379"
97
- networks:
98
- - wp-network
99
-
100
- networks:
101
- wp-network:
102
- driver: bridge
103
-
104
- volumes:
105
- db_data:
106
- wp_build:
@@ -1,516 +0,0 @@
1
- # Multi-Project Support
2
-
3
- Learn how to run multiple buwp-local projects simultaneously, either isolated or integrated.
4
-
5
- ## Overview
6
-
7
- buwp-local supports two multi-project strategies:
8
-
9
- 1. **Isolated Environments** - Each project runs independently with its own database and WordPress
10
- 2. **Shared Environments** - Multiple repositories share one WordPress instance for integration testing
11
-
12
- ## Isolated Environments
13
-
14
- ### How It Works
15
-
16
- Each project gets a unique name (based on directory name) and isolated Docker volumes:
17
-
18
- - **Database volume:** `{projectName}_db_data`
19
- - **WordPress volume:** `{projectName}_wp_build`
20
- - **Container names:** `{projectName}-wordpress-1`, `{projectName}-db-1`, etc.
21
-
22
- This means:
23
- ✅ Each project has its own database
24
- ✅ Each project has its own WordPress installation
25
- ✅ Projects don't interfere with each other
26
- ✅ You can run multiple projects simultaneously
27
-
28
- ### Setting Up Multiple Projects
29
-
30
- **Step 1: Initialize each project**
31
-
32
- ```bash
33
- # Plugin A
34
- cd ~/projects/bu-custom-analytics
35
- npx buwp-local init --plugin
36
-
37
- # Plugin B
38
- cd ~/projects/bu-slideshow
39
- npx buwp-local init --plugin
40
-
41
- # Theme
42
- cd ~/projects/responsive-framework
43
- npx buwp-local init --theme
44
- ```
45
-
46
- **Step 2: Configure different ports (optional)**
47
-
48
- Edit `.buwp-local.json` in each project to avoid port conflicts:
49
-
50
- ```json
51
- // bu-custom-analytics
52
- {
53
- "ports": {
54
- "http": 8080,
55
- "https": 8443
56
- }
57
- }
58
-
59
- // bu-slideshow
60
- {
61
- "ports": {
62
- "http": 8081,
63
- "https": 8444
64
- }
65
- }
66
-
67
- // responsive-framework
68
- {
69
- "ports": {
70
- "http": 8082,
71
- "https": 8445
72
- }
73
- }
74
- ```
75
-
76
- **Step 3: Add hostnames to /etc/hosts**
77
-
78
- ```bash
79
- sudo bash -c 'cat >> /etc/hosts << EOF
80
- 127.0.0.1 bu-custom-analytics.local
81
- 127.0.0.1 bu-slideshow.local
82
- 127.0.0.1 responsive-framework.local
83
- EOF'
84
- ```
85
-
86
- **Step 4: Start all projects**
87
-
88
- ```bash
89
- cd ~/projects/bu-custom-analytics && npx buwp-local start
90
- cd ~/projects/bu-slideshow && npx buwp-local start
91
- cd ~/projects/responsive-framework && npx buwp-local start
92
- ```
93
-
94
- **Step 5: Access your sites**
95
-
96
- - http://bu-custom-analytics.local:8080
97
- - http://bu-slideshow.local:8081
98
- - http://responsive-framework.local:8082
99
-
100
- ### Managing Multiple Projects
101
-
102
- **View running projects in Docker Desktop:**
103
-
104
- ```
105
- Containers:
106
- ├─ bu-custom-analytics
107
- │ ├─ bu-custom-analytics-wordpress-1
108
- │ ├─ bu-custom-analytics-db-1
109
- │ └─ bu-custom-analytics-redis-1
110
-
111
- ├─ bu-slideshow
112
- │ ├─ bu-slideshow-wordpress-1
113
- │ ├─ bu-slideshow-db-1
114
- │ └─ bu-slideshow-redis-1
115
-
116
- └─ responsive-framework
117
- ├─ responsive-framework-wordpress-1
118
- ├─ responsive-framework-db-1
119
- └─ responsive-framework-redis-1
120
- ```
121
-
122
- **Stop a specific project:**
123
-
124
- ```bash
125
- cd ~/projects/bu-custom-analytics
126
- npx buwp-local stop
127
- ```
128
-
129
- **View logs for a specific project:**
130
-
131
- ```bash
132
- cd ~/projects/bu-slideshow
133
- npx buwp-local logs -f
134
- ```
135
-
136
- ---
137
-
138
- ## Shared Environments
139
-
140
- > **💡 Looking for volume mapping patterns?**
141
- > This section covers the legacy "shared environment" approach. For modern multi-repo development, see [Volume Mapping Patterns](VOLUME_MAPPINGS.md), especially [Pattern B: Sandbox Coordination](VOLUME_MAPPINGS.md#pattern-b-sandbox-coordination) which provides a cleaner architecture.
142
-
143
- ### When to Use Shared Environments
144
-
145
- Use a shared environment when you need to:
146
- - ✅ Test how multiple plugins work together
147
- - ✅ Develop theme + plugins simultaneously
148
- - ✅ Mirror production configuration locally
149
- - ✅ Test plugin interactions with real data
150
- - ✅ Collaborate on integrated features
151
-
152
- ### How It Works
153
-
154
- By giving multiple repositories the **same `projectName`**, they join the same Docker Compose project and share:
155
- - Database (one shared MySQL instance)
156
- - WordPress installation (one shared wp_build volume)
157
- - Services (Redis, S3 proxy, etc.)
158
-
159
- ### Setup: Primary + Secondary Pattern
160
-
161
- This is the recommended approach for shared environments.
162
-
163
- #### Primary Repository
164
-
165
- Create a "primary" repository that owns the base configuration:
166
-
167
- ```bash
168
- mkdir ~/projects/bu-sandbox-primary
169
- cd ~/projects/bu-sandbox-primary
170
- npx buwp-local init
171
- ```
172
-
173
- Edit `.buwp-local.json`:
174
-
175
- ```json
176
- {
177
- "projectName": "bu-sandbox",
178
- "hostname": "bu-sandbox.local",
179
- "multisite": true,
180
- "services": {
181
- "redis": true,
182
- "s3proxy": true,
183
- "shibboleth": true
184
- },
185
- "ports": {
186
- "http": 80,
187
- "https": 443,
188
- "db": 3306
189
- },
190
- "mappings": [],
191
- "env": {
192
- "WP_DEBUG": true
193
- }
194
- }
195
- ```
196
-
197
- Create shared credentials:
198
-
199
- ```bash
200
- # Either use Keychain (recommended)
201
- npx buwp-local keychain setup --file ~/Downloads/credentials.json
202
-
203
- # Or create .env.local
204
- cp .env.local.example .env.local
205
- # Edit with credentials
206
- ```
207
-
208
- Start the base environment:
209
-
210
- ```bash
211
- npx buwp-local start
212
- ```
213
-
214
- #### Secondary Repositories
215
-
216
- Add your plugin/theme repositories to the shared environment:
217
-
218
- ```bash
219
- cd ~/projects/bu-custom-analytics
220
- npx buwp-local init --plugin
221
- ```
222
-
223
- Edit `.buwp-local.json` to use the **same projectName**:
224
-
225
- ```json
226
- {
227
- "projectName": "bu-sandbox", // Same as primary!
228
- "hostname": "bu-sandbox.local",
229
- "multisite": true,
230
- "services": {
231
- "redis": true,
232
- "s3proxy": true,
233
- "shibboleth": true
234
- },
235
- "ports": {
236
- "http": 80,
237
- "https": 443,
238
- "db": 3306
239
- },
240
- "mappings": [
241
- {
242
- "local": "./",
243
- "container": "/var/www/html/wp-content/plugins/bu-custom-analytics"
244
- }
245
- ],
246
- "env": {
247
- "WP_DEBUG": true
248
- }
249
- }
250
- ```
251
-
252
- Link or copy credentials:
253
-
254
- ```bash
255
- # Option 1: Use Keychain (already global, nothing to do)
256
-
257
- # Option 2: Symlink to primary .env.local
258
- ln -s ~/projects/bu-sandbox-primary/.env.local .env.local
259
- ```
260
-
261
- Add this plugin to the shared environment:
262
-
263
- ```bash
264
- npx buwp-local start
265
- ```
266
-
267
- Now your plugin is mounted into the shared WordPress instance!
268
-
269
- #### Add More Repositories
270
-
271
- Repeat for additional plugins/themes:
272
-
273
- ```bash
274
- # Plugin B
275
- cd ~/projects/bu-slideshow
276
- npx buwp-local init --plugin
277
- # Edit .buwp-local.json with projectName: "bu-sandbox"
278
- npx buwp-local start
279
-
280
- # Theme
281
- cd ~/projects/responsive-framework
282
- npx buwp-local init --theme
283
- # Edit .buwp-local.json with projectName: "bu-sandbox"
284
- npx buwp-local start
285
- ```
286
-
287
- ### Accessing the Shared Environment
288
-
289
- All repositories share the same URL:
290
-
291
- ```
292
- http://bu-sandbox.local
293
- ```
294
-
295
- All plugins and themes are mounted:
296
- - `/wp-content/plugins/bu-custom-analytics/` → `~/projects/bu-custom-analytics/`
297
- - `/wp-content/plugins/bu-slideshow/` → `~/projects/bu-slideshow/`
298
- - `/wp-content/themes/responsive-framework/` → `~/projects/responsive-framework/`
299
-
300
- ### Managing Shared Environments
301
-
302
- **Start the environment (from any repository):**
303
-
304
- ```bash
305
- cd ~/projects/bu-custom-analytics
306
- npx buwp-local start
307
- ```
308
-
309
- **Stop the environment (from any repository):**
310
-
311
- ```bash
312
- cd ~/projects/bu-sandbox-primary
313
- npx buwp-local stop
314
- ```
315
-
316
- **View logs (from any repository):**
317
-
318
- ```bash
319
- cd ~/projects/bu-slideshow
320
- npx buwp-local logs -f
321
- ```
322
-
323
- **Destroy and rebuild:**
324
-
325
- ```bash
326
- cd ~/projects/bu-sandbox-primary
327
- npx buwp-local destroy
328
- npx buwp-local start
329
- ```
330
-
331
- ---
332
-
333
- ## Configuration Consistency
334
-
335
- ### ⚠️ Important: Keep Configs Synchronized
336
-
337
- All repositories sharing a `projectName` must have **matching configuration**:
338
-
339
- | Setting | Must Match | Why |
340
- |---------|-----------|-----|
341
- | `projectName` | ✅ Yes | Determines which project containers join |
342
- | `hostname` | ✅ Yes | All repos should access same URL |
343
- | `ports` | ✅ Yes | Port conflicts cause failures |
344
- | `services` | ✅ Yes | Enables/disables Redis, S3, Shibboleth |
345
- | `env` vars | ⚠️ Should | Avoid conflicting environment variables |
346
- | `mappings` | ❌ No | Each repo adds its own mappings |
347
-
348
- ### Best Practices
349
-
350
- 1. **Use primary repository as source of truth**
351
- - Make configuration changes in primary repo
352
- - Copy settings to secondary repos
353
- - Document which repo is primary
354
-
355
- 2. **Keep secondary repos minimal**
356
- - Only add `mappings` section
357
- - Copy all other settings from primary
358
-
359
- 3. **Use symlinks for shared files**
360
- ```bash
361
- ln -s ~/projects/bu-sandbox-primary/.env.local .env.local
362
- ```
363
-
364
- 4. **Document the setup**
365
- - Add README.md in primary repo
366
- - List all participating repositories
367
- - Note any special configuration
368
-
369
- ---
370
-
371
- ## Comparison: Isolated vs Shared
372
-
373
- | Aspect | Isolated | Shared |
374
- |--------|----------|--------|
375
- | **Use Case** | Solo development | Integration testing |
376
- | **Databases** | Separate per project | One shared database |
377
- | **WordPress** | Separate per project | One shared instance |
378
- | **URLs** | Different per project | Same for all repos |
379
- | **Ports** | Can differ | Must be identical |
380
- | **Data Isolation** | Complete | Shared |
381
- | **Setup Complexity** | Low | Medium |
382
- | **Best For** | Independent work | Team collaboration |
383
-
384
- ### When to Use Isolated Environments
385
-
386
- ✅ Developing one plugin/theme independently
387
- ✅ Need clean slate for testing
388
- ✅ Don't need other plugins active
389
- ✅ Want to test different WordPress versions
390
- ✅ Working on experimental features
391
- ✅ Need different PHP/MySQL settings per project
392
-
393
- ### When to Use Shared Environments
394
-
395
- ✅ Testing plugin interactions
396
- ✅ Developing theme + plugins together
397
- ✅ Mimicking production setup locally
398
- ✅ Team collaborating on same codebase
399
- ✅ Need persistent test data across plugins
400
- ✅ Integration/acceptance testing
401
- ✅ Want single URL for all development
402
-
403
- ---
404
-
405
- ## Troubleshooting
406
-
407
- ### Port Conflicts
408
-
409
- **Problem:** Can't start second project due to port conflicts
410
-
411
- **Solution:** Use different ports in `.buwp-local.json`:
412
-
413
- ```json
414
- {
415
- "ports": {
416
- "http": 8081,
417
- "https": 8444,
418
- "db": 3307
419
- }
420
- }
421
- ```
422
-
423
- ### Shared Environment Config Drift
424
-
425
- **Problem:** Repos have different configurations causing issues
426
-
427
- **Solution:** Standardize configuration across all repos:
428
-
429
- 1. Update primary repo with correct config
430
- 2. Copy settings to all secondary repos
431
- 3. Run `destroy` and `start` from primary
432
-
433
- ### Can't Remove Plugin from Shared Environment
434
-
435
- **Problem:** Need to remove a plugin from shared WordPress
436
-
437
- **Solution:** Destroy and rebuild without that plugin:
438
-
439
- ```bash
440
- cd ~/projects/bu-sandbox-primary
441
- npx buwp-local destroy
442
-
443
- # Don't start from the plugin you want to remove
444
- cd ~/projects/other-plugin
445
- npx buwp-local start
446
- ```
447
-
448
- ### Database Confusion
449
-
450
- **Problem:** Not sure which project's database you're using
451
-
452
- **Solution:** Check Docker volumes:
453
-
454
- ```bash
455
- docker volume ls | grep db_data
456
- ```
457
-
458
- Each isolated project has its own: `{projectName}_db_data`
459
-
460
- ### Start Order Issues
461
-
462
- **Problem:** Last repo to start "wins" configuration
463
-
464
- **Solution:** Always start from primary repo first:
465
-
466
- ```bash
467
- cd ~/projects/bu-sandbox-primary
468
- npx buwp-local start
469
-
470
- cd ~/projects/plugin-a
471
- npx buwp-local start
472
- ```
473
-
474
- ---
475
-
476
- ## Advanced: Hybrid Approach
477
-
478
- You can use **both strategies** for different workflows:
479
-
480
- ```bash
481
- # Isolated environment for experimentation
482
- cd ~/projects/bu-custom-analytics
483
- # .buwp-local.json has projectName: "bu-custom-analytics"
484
- npx buwp-local start
485
- # Test independently at http://bu-custom-analytics.local
486
-
487
- # Later: Test in shared environment
488
- # Edit .buwp-local.json, change projectName to "bu-sandbox"
489
- npx buwp-local start
490
- # Now part of shared sandbox at http://bu-sandbox.local
491
-
492
- # Switch back to isolated
493
- # Restore original projectName
494
- npx buwp-local destroy # Clean up shared
495
- npx buwp-local start # Back to isolated
496
- ```
497
-
498
- **Tip:** Keep two config files:
499
-
500
- ```bash
501
- .buwp-local.json # Isolated (default)
502
- .buwp-local.shared.json # Shared environment
503
-
504
- # Switch between them
505
- cp .buwp-local.shared.json .buwp-local.json # Use shared
506
- cp .buwp-local.isolated.json .buwp-local.json # Use isolated
507
- ```
508
-
509
- ---
510
-
511
- ## See Also
512
-
513
- - [Getting Started](GETTING_STARTED.md) - Initial setup guide
514
- - [Commands Reference](COMMANDS.md) - Full command list
515
- - [Credentials Management](CREDENTIALS.md) - Managing credentials across projects
516
- - [Architecture](ARCHITECTURE.md) - Technical implementation details
@@ -1,16 +0,0 @@
1
- feedback from 0.6.1
2
-
3
- For volume mapped sandbox flavor, make a new directory for the sandbox project.
4
-
5
- Next, use npm init to create a package.json file if you don't have one already:
6
-
7
- ```bash
8
- npm init -y
9
- ```
10
-
11
- Then install buwp-local as a development dependency:
12
-
13
- ```bash
14
- npm install --save-dev @bostonuniversity/buwp-local
15
- ```
16
-