@fishawack/lab-env 1.17.0 → 2.0.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/CHANGELOG.md +15 -0
- package/README.md +297 -0
- package/_Test/boilerplate-craftcms.js +29 -0
- package/_Test/boilerplate-drupal.js +3 -3
- package/_Test/boilerplate-laravel.js +3 -3
- package/_Test/boilerplate-wordpress.js +3 -3
- package/_Test/boilerplate.js +3 -3
- package/cli.js +9 -1
- package/commands/artisan.js +1 -1
- package/commands/check.js +2 -2
- package/commands/clean.js +2 -2
- package/commands/craft.js +15 -0
- package/commands/create/libs/vars.js +4 -0
- package/commands/deploy.js +1 -1
- package/commands/docker/build.js +8 -3
- package/commands/docker/rebuild.js +8 -3
- package/commands/docker/volumes.js +3 -3
- package/commands/regenerate.js +2 -2
- package/commands/reinstall.js +1 -1
- package/commands/setup.js +2 -2
- package/commands/start.js +1 -1
- package/commands/wp.js +15 -0
- package/craftcms/3/docker-compose.yml +44 -0
- package/craftcms/3/nginx/nginx.conf +37 -0
- package/craftcms/3/php/Dockerfile +17 -0
- package/craftcms/3/php/custom.conf +9 -0
- package/drupal/9/docker-compose.yml +2 -1
- package/drupal/9/php/Dockerfile +3 -0
- package/drupal/9/php/policy.xml +99 -0
- package/globals.js +21 -4
- package/intercept.sh +11 -1
- package/laravel/8/docker-compose.yml +6 -2
- package/laravel/8/php/Dockerfile +17 -0
- package/laravel/8/php/custom.conf +2 -0
- package/laravel/8/php/policy.xml +99 -0
- package/package.json +2 -2
- package/wordpress/5.7.2/docker-compose.yml +20 -10
- package/wordpress/5.7.2/wordpress/Dockerfile +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 2.0.0 (2022-04-05)
|
|
4
|
+
* [Feature] Craftcms now an option in `fw new` command
|
|
5
|
+
* [Change] Wordpress repos now works differently and will flag unsupported unless they change their folder structure - see [migration guide](https://demo.fishawack.solutions/Lab/Doc/#lab-env-migrating-200)
|
|
6
|
+
* [Docs] Wordpress migration guide
|
|
7
|
+
|
|
8
|
+
### 1.18.1 (2022-03-30)
|
|
9
|
+
* [Bug] Craftcms now correctly calls reinstall and deploy commands
|
|
10
|
+
|
|
11
|
+
### 1.18.0 (2022-02-28)
|
|
12
|
+
* [Feature] Can now pass container name to rebuild/build commands
|
|
13
|
+
* [Feature] Craftcms now a supported tech stack
|
|
14
|
+
* [Change] Laravel now installs ghostscript and imagemagick by default
|
|
15
|
+
* [Change] Drupal now installs ghostscript and imagemagick by default
|
|
16
|
+
* [Misc] No longer rename clone folders when testing lab-env itself
|
|
17
|
+
|
|
3
18
|
### 1.17.0 (2022-01-27)
|
|
4
19
|
* [Feature] Drupals php image now contains imagemagick and imagick
|
|
5
20
|
* [Change] Drupals php image is now labelled and tagged
|
package/README.md
CHANGED
|
@@ -195,3 +195,300 @@ Or you can target specific node_modules and hand pick which ones to remove. For
|
|
|
195
195
|
```bash
|
|
196
196
|
docker volume rm boilerplate_node_modules
|
|
197
197
|
```
|
|
198
|
+
|
|
199
|
+
## Migrating
|
|
200
|
+
|
|
201
|
+
### 2.0.0
|
|
202
|
+
|
|
203
|
+
Wordpress repo's are now structured slightly differently to better match laravel, drupal and craftcms setups. Follow these steps to upgrade a wordpress build and get lab-env working again.
|
|
204
|
+
|
|
205
|
+
#### Reset repository
|
|
206
|
+
|
|
207
|
+
Before starting this migration ensure all code is committed so you don't run the risk of losing anything afterwhich run one of the following.
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
fw nuke
|
|
211
|
+
|
|
212
|
+
# or
|
|
213
|
+
|
|
214
|
+
Remove / Re-clone repository
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### wp-content
|
|
218
|
+
|
|
219
|
+
Move the plugins, themes and uploads folder a new wp-content folder at the root of the project.
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
# Old way
|
|
223
|
+
./themes
|
|
224
|
+
./plugins
|
|
225
|
+
./uploads
|
|
226
|
+
|
|
227
|
+
# New way
|
|
228
|
+
./wp-content/themes
|
|
229
|
+
./wp-content/plugins
|
|
230
|
+
./wp-content/uploads
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
#### .env.example
|
|
234
|
+
|
|
235
|
+
Replace the contents of the .env.example with the following.
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Old way
|
|
239
|
+
DB_DATABASE=wordpress
|
|
240
|
+
DB_USERNAME=wordpress
|
|
241
|
+
DB_PASSWORD=password
|
|
242
|
+
JWT_SECRET=
|
|
243
|
+
|
|
244
|
+
# New way
|
|
245
|
+
DEBUG=true
|
|
246
|
+
|
|
247
|
+
DB_DATABASE=wordpress
|
|
248
|
+
DB_USERNAME=wordpress
|
|
249
|
+
DB_PASSWORD=password
|
|
250
|
+
DB_HOST=mysql
|
|
251
|
+
DB_CHARSET=utf8
|
|
252
|
+
DB_COLLATE=
|
|
253
|
+
|
|
254
|
+
TABLE_PREFIX=wp_
|
|
255
|
+
|
|
256
|
+
AUTH_KEY=5c94a709b751faeed445f29b92f8513b8bce1652
|
|
257
|
+
SECURE_AUTH=09e370e7bfc34b17fc96d80cda1a281427053afd
|
|
258
|
+
LOGGED_IN=405de7e577398c86b6975fc4a8bba1df179666dd
|
|
259
|
+
NONCE_KEY=10c232cb86bb257af4c0434a7e3b9f993f18ba11
|
|
260
|
+
AUTH_SALT=07a08cb5a6c3318633c505fcf1ffffa4d01ab375
|
|
261
|
+
SECURE_AUTH=df11e32128f8d5403a7c681d0e5cc4145be2b2ab
|
|
262
|
+
LOGGED_IN=a99860e8150b15e11caada875f56421165659a7d
|
|
263
|
+
NONCE_SALT=51c6eba59477027e612fc13e38a53acaa2b73d92
|
|
264
|
+
|
|
265
|
+
CONFIG_EXTRA="
|
|
266
|
+
define( 'WP_HOME', 'http://localhost:3000' );
|
|
267
|
+
define( 'WP_SITEURL', 'http://localhost:3000' );
|
|
268
|
+
"
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
#### .gitignore
|
|
272
|
+
|
|
273
|
+
There's a new more complex gitignore now that takes into account the wordpress files that are reverse mounted back to the host machine.
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
# Old way
|
|
277
|
+
# These are some examples of commonly ignored file patterns.
|
|
278
|
+
# You should customize this list as applicable to your project.
|
|
279
|
+
# Learn more about .gitignore:
|
|
280
|
+
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
|
|
281
|
+
|
|
282
|
+
# Node artifact files
|
|
283
|
+
node_modules/
|
|
284
|
+
dist/
|
|
285
|
+
|
|
286
|
+
# Compiled Java class files
|
|
287
|
+
*.class
|
|
288
|
+
|
|
289
|
+
# Compiled Python bytecode
|
|
290
|
+
*.py[cod]
|
|
291
|
+
|
|
292
|
+
# Log files
|
|
293
|
+
*.log
|
|
294
|
+
|
|
295
|
+
# Package files
|
|
296
|
+
*.jar
|
|
297
|
+
|
|
298
|
+
# Maven
|
|
299
|
+
target/
|
|
300
|
+
dist/
|
|
301
|
+
|
|
302
|
+
# JetBrains IDE
|
|
303
|
+
.idea/
|
|
304
|
+
|
|
305
|
+
# Unit test reports
|
|
306
|
+
TEST*.xml
|
|
307
|
+
|
|
308
|
+
# Generated by MacOS
|
|
309
|
+
.DS_Store
|
|
310
|
+
|
|
311
|
+
# Generated by Windows
|
|
312
|
+
Thumbs.db
|
|
313
|
+
|
|
314
|
+
# Applications
|
|
315
|
+
*.app
|
|
316
|
+
*.exe
|
|
317
|
+
*.war
|
|
318
|
+
|
|
319
|
+
# Large media files
|
|
320
|
+
*.mp4
|
|
321
|
+
*.tiff
|
|
322
|
+
*.avi
|
|
323
|
+
*.flv
|
|
324
|
+
*.mov
|
|
325
|
+
*.wmv
|
|
326
|
+
.env
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
.tmp/
|
|
330
|
+
generated/
|
|
331
|
+
_Zips/
|
|
332
|
+
_Pdfs/
|
|
333
|
+
coverage/
|
|
334
|
+
**/generated/**/*
|
|
335
|
+
_Build/**/pulled/**/*
|
|
336
|
+
_Output
|
|
337
|
+
_Login
|
|
338
|
+
_Packages
|
|
339
|
+
_Build/content
|
|
340
|
+
_Build/media/content
|
|
341
|
+
_App
|
|
342
|
+
_Electron
|
|
343
|
+
_Node/stats
|
|
344
|
+
ssh-*
|
|
345
|
+
.ftppass
|
|
346
|
+
id_rsa
|
|
347
|
+
misc.json
|
|
348
|
+
.cache/
|
|
349
|
+
themes/twenty*
|
|
350
|
+
themes/thirty*
|
|
351
|
+
themes/*/css
|
|
352
|
+
themes/*/js
|
|
353
|
+
plugins/akismet
|
|
354
|
+
plugins/hello.php
|
|
355
|
+
uploads
|
|
356
|
+
|
|
357
|
+
# New way
|
|
358
|
+
# These are some examples of commonly ignored file patterns.
|
|
359
|
+
# You should customize this list as applicable to your project.
|
|
360
|
+
# Learn more about .gitignore:
|
|
361
|
+
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
|
|
362
|
+
|
|
363
|
+
# Node artifact files
|
|
364
|
+
node_modules/
|
|
365
|
+
dist/
|
|
366
|
+
|
|
367
|
+
# Compiled Java class files
|
|
368
|
+
*.class
|
|
369
|
+
|
|
370
|
+
# Compiled Python bytecode
|
|
371
|
+
*.py[cod]
|
|
372
|
+
|
|
373
|
+
# Log files
|
|
374
|
+
*.log
|
|
375
|
+
|
|
376
|
+
# Package files
|
|
377
|
+
*.jar
|
|
378
|
+
|
|
379
|
+
# Maven
|
|
380
|
+
target/
|
|
381
|
+
dist/
|
|
382
|
+
|
|
383
|
+
# JetBrains IDE
|
|
384
|
+
.idea/
|
|
385
|
+
|
|
386
|
+
# Unit test reports
|
|
387
|
+
TEST*.xml
|
|
388
|
+
|
|
389
|
+
# Generated by Windows
|
|
390
|
+
Thumbs.db
|
|
391
|
+
|
|
392
|
+
# Applications
|
|
393
|
+
*.app
|
|
394
|
+
*.exe
|
|
395
|
+
*.war
|
|
396
|
+
|
|
397
|
+
# Large media files
|
|
398
|
+
*.mp4
|
|
399
|
+
*.tiff
|
|
400
|
+
*.avi
|
|
401
|
+
*.flv
|
|
402
|
+
*.mov
|
|
403
|
+
*.wmv
|
|
404
|
+
.env
|
|
405
|
+
|
|
406
|
+
.tmp/
|
|
407
|
+
generated/
|
|
408
|
+
_Zips/
|
|
409
|
+
_Pdfs/
|
|
410
|
+
coverage/
|
|
411
|
+
**/generated/**/*
|
|
412
|
+
_Build/**/pulled/**/*
|
|
413
|
+
_Output
|
|
414
|
+
_Login
|
|
415
|
+
_Packages
|
|
416
|
+
_Build/content
|
|
417
|
+
_Build/media/content
|
|
418
|
+
_App
|
|
419
|
+
_Electron
|
|
420
|
+
_Node/stats
|
|
421
|
+
ssh-*
|
|
422
|
+
.ftppass
|
|
423
|
+
id_rsa
|
|
424
|
+
misc.json
|
|
425
|
+
.cache/
|
|
426
|
+
|
|
427
|
+
# Wordpress docker image files
|
|
428
|
+
.htaccess
|
|
429
|
+
license.txt
|
|
430
|
+
readme.html
|
|
431
|
+
index.php
|
|
432
|
+
xmlrpc.php
|
|
433
|
+
wp-*
|
|
434
|
+
!wp-content**/*
|
|
435
|
+
wp-content/index.php
|
|
436
|
+
wp-content/plugins/index.php
|
|
437
|
+
wp-content/themes/index.php
|
|
438
|
+
wp-content/themes/twenty*
|
|
439
|
+
wp-content/themes/thirty*
|
|
440
|
+
wp-content/themes/fishawack/css
|
|
441
|
+
wp-content/themes/fishawack/js
|
|
442
|
+
wp-content/plugins/akismet
|
|
443
|
+
wp-content/plugins/hello.php
|
|
444
|
+
wp-content/uploads
|
|
445
|
+
|
|
446
|
+
# Generated by MacOS
|
|
447
|
+
.DS_Store
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
#### Default theme location
|
|
451
|
+
|
|
452
|
+
The default root attribute needs updating to take into account the new folder structure.
|
|
453
|
+
|
|
454
|
+
```json
|
|
455
|
+
// Old way
|
|
456
|
+
"attributes": {
|
|
457
|
+
"root": "themes/fishawack",
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
// New way
|
|
461
|
+
"attributes": {
|
|
462
|
+
"root": "wp-content/themes/fishawack",
|
|
463
|
+
}
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
#### Deploy files
|
|
467
|
+
|
|
468
|
+
The deploy paths also need updating to take into account the new folder structure.
|
|
469
|
+
|
|
470
|
+
```json
|
|
471
|
+
// Old way
|
|
472
|
+
"paths": [
|
|
473
|
+
{
|
|
474
|
+
"src": "plugins",
|
|
475
|
+
"dest": "wp-content/plugins"
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
"src": "themes",
|
|
479
|
+
"dest": "wp-content/themes"
|
|
480
|
+
}
|
|
481
|
+
]
|
|
482
|
+
|
|
483
|
+
// New way
|
|
484
|
+
"paths": [
|
|
485
|
+
{
|
|
486
|
+
"src": "wp-content/plugins",
|
|
487
|
+
"dest": "wp-content/plugins"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
"src": "wp-content/themes",
|
|
491
|
+
"dest": "wp-content/themes"
|
|
492
|
+
}
|
|
493
|
+
]
|
|
494
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const repo = `boilerplate-craftcms`;
|
|
4
|
+
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: `_Test/_fixtures/${repo}`};
|
|
5
|
+
|
|
6
|
+
const expect = require('chai').expect;
|
|
7
|
+
const execSync = require('child_process').execSync;
|
|
8
|
+
|
|
9
|
+
describe('deploy', () => {
|
|
10
|
+
before(function(){
|
|
11
|
+
this.timeout(60000 * 10);
|
|
12
|
+
|
|
13
|
+
execSync(`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`, {encoding: 'utf8', stdio: 'inherit'});
|
|
14
|
+
|
|
15
|
+
execSync('fw setup', opts);
|
|
16
|
+
|
|
17
|
+
execSync('fw prod', opts);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it(`All ${repo} tests should pass`, async () => {
|
|
21
|
+
expect(execSync('fw test', opts)).to.not.equal(Error);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
after(() => {
|
|
25
|
+
execSync('fw nuke', opts)
|
|
26
|
+
|
|
27
|
+
execSync(`rm -rf _Test/_fixtures/${repo}`, {encoding: 'utf8', stdio: 'inherit'});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const repo = `
|
|
3
|
+
const repo = `boilerplate-drupal`;
|
|
4
4
|
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: `_Test/_fixtures/${repo}`};
|
|
5
5
|
|
|
6
6
|
const expect = require('chai').expect;
|
|
@@ -10,14 +10,14 @@ describe('deploy', () => {
|
|
|
10
10
|
before(function(){
|
|
11
11
|
this.timeout(60000 * 10);
|
|
12
12
|
|
|
13
|
-
execSync(`git clone git@bitbucket.org:fishawackdigital
|
|
13
|
+
execSync(`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`, {encoding: 'utf8', stdio: 'inherit'});
|
|
14
14
|
|
|
15
15
|
execSync('fw setup', opts);
|
|
16
16
|
|
|
17
17
|
execSync('fw prod', opts);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
it(
|
|
20
|
+
it(`All ${repo} tests should pass`, async () => {
|
|
21
21
|
expect(execSync('fw test', opts)).to.not.equal(Error);
|
|
22
22
|
});
|
|
23
23
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const repo = `
|
|
3
|
+
const repo = `boilerplate-laravel`;
|
|
4
4
|
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: `_Test/_fixtures/${repo}`};
|
|
5
5
|
|
|
6
6
|
const expect = require('chai').expect;
|
|
@@ -10,14 +10,14 @@ describe('deploy', () => {
|
|
|
10
10
|
before(function(){
|
|
11
11
|
this.timeout(60000 * 10);
|
|
12
12
|
|
|
13
|
-
execSync(`git clone git@bitbucket.org:fishawackdigital
|
|
13
|
+
execSync(`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`, {encoding: 'utf8', stdio: 'inherit'});
|
|
14
14
|
|
|
15
15
|
execSync('fw setup', opts);
|
|
16
16
|
|
|
17
17
|
execSync('fw prod', opts);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
it(
|
|
20
|
+
it(`All ${repo} tests should pass`, async () => {
|
|
21
21
|
expect(execSync('fw test', opts)).to.not.equal(Error);
|
|
22
22
|
});
|
|
23
23
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const repo = `
|
|
3
|
+
const repo = `boilerplate-wordpress`;
|
|
4
4
|
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: `_Test/_fixtures/${repo}`};
|
|
5
5
|
|
|
6
6
|
const expect = require('chai').expect;
|
|
@@ -10,14 +10,14 @@ describe('deploy', () => {
|
|
|
10
10
|
before(function(){
|
|
11
11
|
this.timeout(60000 * 10);
|
|
12
12
|
|
|
13
|
-
execSync(`git clone git@bitbucket.org:fishawackdigital
|
|
13
|
+
execSync(`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`, {encoding: 'utf8', stdio: 'inherit'});
|
|
14
14
|
|
|
15
15
|
execSync('fw setup', opts);
|
|
16
16
|
|
|
17
17
|
execSync('fw prod', opts);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
it(
|
|
20
|
+
it(`All ${repo} tests should pass`, async () => {
|
|
21
21
|
expect(execSync('fw test', opts)).to.not.equal(Error);
|
|
22
22
|
});
|
|
23
23
|
|
package/_Test/boilerplate.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const repo = `
|
|
3
|
+
const repo = `boilerplate`;
|
|
4
4
|
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: `_Test/_fixtures/${repo}`};
|
|
5
5
|
|
|
6
6
|
const expect = require('chai').expect;
|
|
@@ -10,14 +10,14 @@ describe('deploy', () => {
|
|
|
10
10
|
before(function(){
|
|
11
11
|
this.timeout(60000 * 10);
|
|
12
12
|
|
|
13
|
-
execSync(`git clone git@bitbucket.org:fishawackdigital
|
|
13
|
+
execSync(`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`, {encoding: 'utf8', stdio: 'inherit'});
|
|
14
14
|
|
|
15
15
|
execSync('fw setup', opts);
|
|
16
16
|
|
|
17
17
|
execSync('fw prod', opts);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
it(
|
|
20
|
+
it(`All ${repo} tests should pass`, async () => {
|
|
21
21
|
expect(execSync('fw test', opts)).to.not.equal(Error);
|
|
22
22
|
});
|
|
23
23
|
|
package/cli.js
CHANGED
|
@@ -36,12 +36,20 @@ if(!_.services && !(args[0] === 'origin' || args[0] === '--version')) return;
|
|
|
36
36
|
if(_.platform === "laravel"){
|
|
37
37
|
commands.push('artisan');
|
|
38
38
|
}
|
|
39
|
+
|
|
40
|
+
if(_.platform === "craftcms"){
|
|
41
|
+
commands.push('craft');
|
|
42
|
+
}
|
|
39
43
|
|
|
40
44
|
if(_.platform === "drupal"){
|
|
41
45
|
commands.push('drush');
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
if(_.platform === "
|
|
48
|
+
if(_.platform === "wordpress"){
|
|
49
|
+
commands.push('wp');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
45
53
|
commands.push('composer', 'php');
|
|
46
54
|
}
|
|
47
55
|
|
package/commands/artisan.js
CHANGED
package/commands/check.js
CHANGED
|
@@ -15,8 +15,8 @@ module.exports = [
|
|
|
15
15
|
argv => {
|
|
16
16
|
execSync(`${_.docker} ${_.run}c "check-dependencies ${argv.v ? '' : '&>/dev/null'} && echo -e '\\033[0;32mNpm deps OK\\033[0m' || { echo -e '\\033[0;31mNpm deps missing or outdated\\033[0m'; }"`, _.opts);
|
|
17
17
|
|
|
18
|
-
if(_.platform === "laravel" || _.platform === "drupal"){
|
|
18
|
+
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
19
19
|
execSync(`${_.docker} ${_.method} php bash -lc "composer install --dry-run ${argv.v ? '' : '2>&1'} | grep -q 'Nothing to install, update or remove' && echo -e '\\033[0;32mComposer deps OK\\033[0m' || echo -e '\\033[0;31mComposer deps missing or outdated\\033[0m'"`, _.opts);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
];
|
|
22
|
+
];
|
package/commands/clean.js
CHANGED
|
@@ -9,8 +9,8 @@ module.exports = [
|
|
|
9
9
|
argv => {
|
|
10
10
|
execSync(`${_.docker} ${_.run}c "git clean -xfd node_modules/ 2>/dev/null || true"`, _.opts);
|
|
11
11
|
|
|
12
|
-
if(_.platform === "laravel" || _.platform === "drupal"){
|
|
12
|
+
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
execSync(`${_.docker} ${_.method} php bash -lc "git clean -xfd vendor/ 2>/dev/null || true"`, _.opts);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
];
|
|
16
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const _ = require('../globals.js');
|
|
2
|
+
|
|
3
|
+
const execSync = require('child_process').execSync;
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
['craft [command...]', 'craft'],
|
|
7
|
+
'run craft command',
|
|
8
|
+
yargs => {
|
|
9
|
+
yargs.positional('command', {
|
|
10
|
+
describe: 'command to run',
|
|
11
|
+
default: ''
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
argv => _.up(() => execSync(`${_.docker} ${_.exec} php bash -lc "php craft ${argv.command.join(' ')}"`, _.opts))
|
|
15
|
+
];
|
package/commands/deploy.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = [
|
|
|
7
7
|
'deploys the repo',
|
|
8
8
|
yargs => {},
|
|
9
9
|
argv => {
|
|
10
|
-
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal"){
|
|
10
|
+
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
11
11
|
_.up(() => execSync(`source ${__dirname}/../intercept.sh && /bin/bash ./_Scripts/deploy.sh`, _.opts));
|
|
12
12
|
} else {
|
|
13
13
|
execSync(`${_.docker} ${_.run}c "xvfb-run npm run deploy"`, _.opts);
|
package/commands/docker/build.js
CHANGED
|
@@ -3,8 +3,13 @@ const _ = require('../../globals.js');
|
|
|
3
3
|
const execSync = require('child_process').execSync;
|
|
4
4
|
|
|
5
5
|
module.exports = [
|
|
6
|
-
'build',
|
|
6
|
+
'build [image]',
|
|
7
7
|
false,
|
|
8
|
-
yargs => {
|
|
9
|
-
|
|
8
|
+
yargs => {
|
|
9
|
+
yargs.positional('image', {
|
|
10
|
+
describe: 'image to build',
|
|
11
|
+
default: ''
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
argv => execSync(`${_.docker} build ${argv.image}`, _.opts)
|
|
10
15
|
];
|
|
@@ -3,8 +3,13 @@ const _ = require('../../globals.js');
|
|
|
3
3
|
const execSync = require('child_process').execSync;
|
|
4
4
|
|
|
5
5
|
module.exports = [
|
|
6
|
-
'rebuild',
|
|
6
|
+
'rebuild [image]',
|
|
7
7
|
false,
|
|
8
|
-
yargs => {
|
|
9
|
-
|
|
8
|
+
yargs => {
|
|
9
|
+
yargs.positional('image', {
|
|
10
|
+
describe: 'image to rebuild',
|
|
11
|
+
default: ''
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
argv => execSync(`${_.docker} build ${argv.image} --no-cache`, _.opts)
|
|
10
15
|
];
|
|
@@ -9,7 +9,7 @@ module.exports = [
|
|
|
9
9
|
'node_modules'
|
|
10
10
|
];
|
|
11
11
|
|
|
12
|
-
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal"){
|
|
12
|
+
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
volumes.push(
|
|
14
14
|
'mysql'
|
|
15
15
|
);
|
|
@@ -27,7 +27,7 @@ module.exports = [
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
if(_.platform === "laravel" || _.platform === "drupal"){
|
|
30
|
+
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
31
31
|
volumes.push(
|
|
32
32
|
'vendor'
|
|
33
33
|
);
|
|
@@ -35,4 +35,4 @@ module.exports = [
|
|
|
35
35
|
|
|
36
36
|
console.log(`${volumes.map(d => `${_.repo_safe}_${d}`).join('\n')}`);
|
|
37
37
|
}
|
|
38
|
-
];
|
|
38
|
+
];
|
package/commands/regenerate.js
CHANGED
|
@@ -9,8 +9,8 @@ module.exports = [
|
|
|
9
9
|
argv => {
|
|
10
10
|
execSync(`${_.docker} ${_.run}c "rm package-lock.json; git clean -xfd node_modules/ 2>/dev/null || true; npm install"`, _.opts);
|
|
11
11
|
|
|
12
|
-
if(_.platform === "laravel" || _.platform === "drupal"){
|
|
12
|
+
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
execSync(`${_.docker} ${_.method} php bash -lc "rm composer.lock; git clean -xfd vendor/ 2>/dev/null || true; composer install"`, _.opts)
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
];
|
|
16
|
+
];
|
package/commands/reinstall.js
CHANGED
|
@@ -9,7 +9,7 @@ module.exports = [
|
|
|
9
9
|
argv => {
|
|
10
10
|
execSync(`${_.docker} ${_.run}c "npm ci || npm i"`, _.opts);
|
|
11
11
|
|
|
12
|
-
if(_.platform === "laravel" || _.platform === "drupal"){
|
|
12
|
+
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
execSync(`${_.docker} ${_.method} php bash -lc "composer install"`, _.opts);
|
|
14
14
|
}
|
|
15
15
|
}
|
package/commands/setup.js
CHANGED
|
@@ -7,10 +7,10 @@ module.exports = [
|
|
|
7
7
|
'runs the initial setup',
|
|
8
8
|
yargs => {},
|
|
9
9
|
argv => {
|
|
10
|
-
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal"){
|
|
10
|
+
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
11
11
|
_.up(() => execSync(`source ${__dirname}/../intercept.sh && /bin/bash ./_Scripts/setup.sh`, _.opts));
|
|
12
12
|
} else {
|
|
13
13
|
execSync(`${_.docker} ${_.run}c "npm run setup"`, _.opts);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
];
|
|
16
|
+
];
|
package/commands/start.js
CHANGED
|
@@ -14,7 +14,7 @@ module.exports = [
|
|
|
14
14
|
argv => {
|
|
15
15
|
_.ports.get();
|
|
16
16
|
|
|
17
|
-
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal"){
|
|
17
|
+
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
18
18
|
_.up(() => execSync(`${_.docker} ${_.exec} core bash -lc "npm start -- -- ${argv.flags.join(' ')}" 2>/dev/null`, _.opts));
|
|
19
19
|
} else {
|
|
20
20
|
execSync(`${_.docker} ${_.run}c "npm start -- -- ${argv.flags.join(' ')}" 2>/dev/null`, _.opts);
|
package/commands/wp.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const _ = require('../globals.js');
|
|
2
|
+
|
|
3
|
+
const execSync = require('child_process').execSync;
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
['wp [command...]', 'wordpress'],
|
|
7
|
+
'run wp-cli command',
|
|
8
|
+
yargs => {
|
|
9
|
+
yargs.positional('command', {
|
|
10
|
+
describe: 'command to run',
|
|
11
|
+
default: ''
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
argv => _.up(() => execSync(`${_.docker} ${_.exec} wordpress bash -lc "wp ${argv.command.join(' ')} --allow-root"`, _.opts))
|
|
15
|
+
];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
services:
|
|
2
|
+
mysql:
|
|
3
|
+
image: mysql:5.7
|
|
4
|
+
networks:
|
|
5
|
+
- default
|
|
6
|
+
environment:
|
|
7
|
+
- MYSQL_ROOT_PASSWORD=password
|
|
8
|
+
- MYSQL_DATABASE=${DB_DATABASE}
|
|
9
|
+
- MYSQL_USER=${DB_USER}
|
|
10
|
+
- MYSQL_PASSWORD=${DB_PASSWORD}
|
|
11
|
+
ports:
|
|
12
|
+
- "${PORT_DB:-3306}:3306"
|
|
13
|
+
volumes:
|
|
14
|
+
- mysql:/var/lib/mysql
|
|
15
|
+
nginx:
|
|
16
|
+
image: nginx:1.19
|
|
17
|
+
networks:
|
|
18
|
+
- default
|
|
19
|
+
volumes:
|
|
20
|
+
- $CWD/:/app
|
|
21
|
+
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
|
|
22
|
+
ports:
|
|
23
|
+
- "${PORT_WEB:-8000}:80"
|
|
24
|
+
php:
|
|
25
|
+
build:
|
|
26
|
+
context: ./php/
|
|
27
|
+
dockerfile: Dockerfile
|
|
28
|
+
image: lab-env/craftcms/3/php:0.0.1
|
|
29
|
+
init: true
|
|
30
|
+
working_dir: /app
|
|
31
|
+
networks:
|
|
32
|
+
- default
|
|
33
|
+
volumes:
|
|
34
|
+
- $CWD/:/app
|
|
35
|
+
- ./php/custom.conf:/opt/bitnami/php/etc/custom.conf
|
|
36
|
+
- vendor:/app/vendor
|
|
37
|
+
networks:
|
|
38
|
+
default:
|
|
39
|
+
driver: "bridge"
|
|
40
|
+
volumes:
|
|
41
|
+
vendor:
|
|
42
|
+
driver: "local"
|
|
43
|
+
mysql:
|
|
44
|
+
driver: "local"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
server {
|
|
2
|
+
listen 80 default_server;
|
|
3
|
+
listen [::]:80 default_server;
|
|
4
|
+
root /app/web;
|
|
5
|
+
|
|
6
|
+
add_header X-Frame-Options "SAMEORIGIN";
|
|
7
|
+
add_header X-XSS-Protection "1; mode=block";
|
|
8
|
+
add_header X-Content-Type-Options "nosniff";
|
|
9
|
+
|
|
10
|
+
index index.php;
|
|
11
|
+
|
|
12
|
+
charset utf-8;
|
|
13
|
+
|
|
14
|
+
location / {
|
|
15
|
+
try_files $uri $uri/ /index.php?$query_string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
location = /favicon.ico { access_log off; log_not_found off; }
|
|
19
|
+
location = /robots.txt { access_log off; log_not_found off; }
|
|
20
|
+
|
|
21
|
+
error_page 404 /index.php;
|
|
22
|
+
|
|
23
|
+
location ~ \.php$ {
|
|
24
|
+
fastcgi_pass php:9000;
|
|
25
|
+
include fastcgi_params;
|
|
26
|
+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
27
|
+
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
location ~ \.(bmp|cur|gif|ico|jpe?g|png|svgz?|webp|pdf|dzi)$ {
|
|
31
|
+
add_header Access-Control-Allow-Origin *;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
location ~ /\.(?!well-known).* {
|
|
35
|
+
deny all;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
FROM chialab/php:7.4-fpm
|
|
2
|
+
|
|
3
|
+
MAINTAINER Mike Mellor
|
|
4
|
+
|
|
5
|
+
# Install mysql client
|
|
6
|
+
RUN apt-get update && \
|
|
7
|
+
apt-get install -y mariadb-client
|
|
8
|
+
|
|
9
|
+
# Install Imagemagick
|
|
10
|
+
RUN apt-get install -y libmagickwand-dev --no-install-recommends
|
|
11
|
+
|
|
12
|
+
# PHP Imagick ext
|
|
13
|
+
RUN pecl install imagick && docker-php-ext-enable imagick
|
|
14
|
+
|
|
15
|
+
# Cleanup apt-get install folders
|
|
16
|
+
RUN apt-get clean && \
|
|
17
|
+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
@@ -33,7 +33,7 @@ services:
|
|
|
33
33
|
build:
|
|
34
34
|
context: ./php/
|
|
35
35
|
dockerfile: Dockerfile
|
|
36
|
-
image: lab-env/drupal/9/php:0.0.
|
|
36
|
+
image: lab-env/drupal/9/php:0.0.2
|
|
37
37
|
init: true
|
|
38
38
|
working_dir: /app
|
|
39
39
|
networks:
|
|
@@ -43,6 +43,7 @@ services:
|
|
|
43
43
|
volumes:
|
|
44
44
|
- $CWD/:/app
|
|
45
45
|
- ./php/custom.ini:/usr/local/etc/php/conf.d/custom.ini
|
|
46
|
+
- ./php/policy.xml:/etc/ImageMagick-6/policy.xml
|
|
46
47
|
- $CWD/themes:/app/web/themes
|
|
47
48
|
- $CWD/modules:/app/web/modules
|
|
48
49
|
- $CWD/sites:/app/web/sites
|
package/drupal/9/php/Dockerfile
CHANGED
|
@@ -12,6 +12,9 @@ RUN apt-get install -y libmagickwand-dev --no-install-recommends
|
|
|
12
12
|
# PHP Imagick ext
|
|
13
13
|
RUN pecl install imagick && docker-php-ext-enable imagick
|
|
14
14
|
|
|
15
|
+
# Install ghostscript
|
|
16
|
+
RUN apt-get install -y ghostscript
|
|
17
|
+
|
|
15
18
|
# Cleanup apt-get install folders
|
|
16
19
|
RUN apt-get clean && \
|
|
17
20
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE policymap [
|
|
3
|
+
<!ELEMENT policymap (policy)*>
|
|
4
|
+
<!ATTLIST policymap xmlns CDATA #FIXED ''>
|
|
5
|
+
<!ELEMENT policy EMPTY>
|
|
6
|
+
<!ATTLIST policy xmlns CDATA #FIXED '' domain NMTOKEN #REQUIRED
|
|
7
|
+
name NMTOKEN #IMPLIED pattern CDATA #IMPLIED rights NMTOKEN #IMPLIED
|
|
8
|
+
stealth NMTOKEN #IMPLIED value CDATA #IMPLIED>
|
|
9
|
+
]>
|
|
10
|
+
<!--
|
|
11
|
+
Configure ImageMagick policies.
|
|
12
|
+
|
|
13
|
+
Domains include system, delegate, coder, filter, path, or resource.
|
|
14
|
+
|
|
15
|
+
Rights include none, read, write, execute and all. Use | to combine them,
|
|
16
|
+
for example: "read | write" to permit read from, or write to, a path.
|
|
17
|
+
|
|
18
|
+
Use a glob expression as a pattern.
|
|
19
|
+
|
|
20
|
+
Suppose we do not want users to process MPEG video images:
|
|
21
|
+
|
|
22
|
+
<policy domain="delegate" rights="none" pattern="mpeg:decode" />
|
|
23
|
+
|
|
24
|
+
Here we do not want users reading images from HTTP:
|
|
25
|
+
|
|
26
|
+
<policy domain="coder" rights="none" pattern="HTTP" />
|
|
27
|
+
|
|
28
|
+
The /repository file system is restricted to read only. We use a glob
|
|
29
|
+
expression to match all paths that start with /repository:
|
|
30
|
+
|
|
31
|
+
<policy domain="path" rights="read" pattern="/repository/*" />
|
|
32
|
+
|
|
33
|
+
Lets prevent users from executing any image filters:
|
|
34
|
+
|
|
35
|
+
<policy domain="filter" rights="none" pattern="*" />
|
|
36
|
+
|
|
37
|
+
Any large image is cached to disk rather than memory:
|
|
38
|
+
|
|
39
|
+
<policy domain="resource" name="area" value="1GP"/>
|
|
40
|
+
|
|
41
|
+
Use the default system font unless overwridden by the application:
|
|
42
|
+
|
|
43
|
+
<policy domain="system" name="font" value="/usr/share/fonts/favorite.ttf"/>
|
|
44
|
+
|
|
45
|
+
Define arguments for the memory, map, area, width, height and disk resources
|
|
46
|
+
with SI prefixes (.e.g 100MB). In addition, resource policies are maximums
|
|
47
|
+
for each instance of ImageMagick (e.g. policy memory limit 1GB, -limit 2GB
|
|
48
|
+
exceeds policy maximum so memory limit is 1GB).
|
|
49
|
+
|
|
50
|
+
Rules are processed in order. Here we want to restrict ImageMagick to only
|
|
51
|
+
read or write a small subset of proven web-safe image types:
|
|
52
|
+
|
|
53
|
+
<policy domain="delegate" rights="none" pattern="*" />
|
|
54
|
+
<policy domain="filter" rights="none" pattern="*" />
|
|
55
|
+
<policy domain="coder" rights="none" pattern="*" />
|
|
56
|
+
<policy domain="coder" rights="read|write" pattern="{GIF,JPEG,PNG,WEBP}" />
|
|
57
|
+
-->
|
|
58
|
+
<policymap>
|
|
59
|
+
<!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
|
|
60
|
+
<policy domain="resource" name="memory" value="256MiB"/>
|
|
61
|
+
<policy domain="resource" name="map" value="512MiB"/>
|
|
62
|
+
<policy domain="resource" name="width" value="16KP"/>
|
|
63
|
+
<policy domain="resource" name="height" value="16KP"/>
|
|
64
|
+
<!-- <policy domain="resource" name="list-length" value="128"/> -->
|
|
65
|
+
<policy domain="resource" name="area" value="128MP"/>
|
|
66
|
+
<policy domain="resource" name="disk" value="1GiB"/>
|
|
67
|
+
<!-- <policy domain="resource" name="file" value="768"/> -->
|
|
68
|
+
<!-- <policy domain="resource" name="thread" value="4"/> -->
|
|
69
|
+
<!-- <policy domain="resource" name="throttle" value="0"/> -->
|
|
70
|
+
<!-- <policy domain="resource" name="time" value="3600"/> -->
|
|
71
|
+
<!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
|
|
72
|
+
<!-- <policy domain="module" rights="none" pattern="{PS,PDF,XPS}" /> -->
|
|
73
|
+
<!-- <policy domain="path" rights="none" pattern="@*" /> -->
|
|
74
|
+
<!-- <policy domain="cache" name="memory-map" value="anonymous"/> -->
|
|
75
|
+
<!-- <policy domain="cache" name="synchronize" value="True"/> -->
|
|
76
|
+
<!-- <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/> -->
|
|
77
|
+
<!-- <policy domain="system" name="max-memory-request" value="256MiB"/> -->
|
|
78
|
+
<!-- <policy domain="system" name="shred" value="2"/> -->
|
|
79
|
+
<!-- <policy domain="system" name="precision" value="6"/> -->
|
|
80
|
+
<!-- <policy domain="system" name="font" value="/path/to/font.ttf"/> -->
|
|
81
|
+
<!-- <policy domain="system" name="pixel-cache-memory" value="anonymous"/> -->
|
|
82
|
+
<!-- <policy domain="system" name="shred" value="2"/> -->
|
|
83
|
+
<!-- <policy domain="system" name="precision" value="6"/> -->
|
|
84
|
+
<!-- not needed due to the need to use explicitly by mvg: -->
|
|
85
|
+
<!-- <policy domain="delegate" rights="none" pattern="MVG" /> -->
|
|
86
|
+
<!-- use curl -->
|
|
87
|
+
<policy domain="delegate" rights="none" pattern="URL" />
|
|
88
|
+
<policy domain="delegate" rights="none" pattern="HTTPS" />
|
|
89
|
+
<policy domain="delegate" rights="none" pattern="HTTP" />
|
|
90
|
+
<!-- in order to avoid to get image with password text -->
|
|
91
|
+
<policy domain="path" rights="none" pattern="@*"/>
|
|
92
|
+
<!-- disable ghostscript format types -->
|
|
93
|
+
<!-- <policy domain="coder" rights="none" pattern="PS" />
|
|
94
|
+
<policy domain="coder" rights="none" pattern="PS2" />
|
|
95
|
+
<policy domain="coder" rights="none" pattern="PS3" />
|
|
96
|
+
<policy domain="coder" rights="none" pattern="EPS" />
|
|
97
|
+
<policy domain="coder" rights="none" pattern="PDF" />
|
|
98
|
+
<policy domain="coder" rights="none" pattern="XPS" /> -->
|
|
99
|
+
</policymap>
|
package/globals.js
CHANGED
|
@@ -3,6 +3,7 @@ const path = require('path');
|
|
|
3
3
|
const { lstatSync, readdirSync, copyFileSync, existsSync } = require('fs');
|
|
4
4
|
const semver = require('semver');
|
|
5
5
|
const getPort = require('get-port');
|
|
6
|
+
const utilities = require('./commands/create/libs/utilities');
|
|
6
7
|
|
|
7
8
|
process.env.DIRNAME = __dirname;
|
|
8
9
|
|
|
@@ -31,15 +32,25 @@ try{ pkg = require(path.join(process.cwd(), 'package.json')); } catch(e){}
|
|
|
31
32
|
|
|
32
33
|
try{ composer = require(path.join(process.cwd(), 'composer.json')); } catch(e){}
|
|
33
34
|
|
|
34
|
-
try{ wordpress = existsSync(path.join(process.cwd(), '
|
|
35
|
+
try{ wordpress = existsSync(path.join(process.cwd(), 'wp-content/')); } catch(e){}
|
|
35
36
|
|
|
36
37
|
if(composer && composer.require && composer.require['laravel/framework']){
|
|
37
38
|
platform = 'laravel';
|
|
38
39
|
} else if(composer && composer.require && composer.require['drupal/core-recommended']){
|
|
39
40
|
platform = 'drupal';
|
|
41
|
+
} else if(composer && composer.require && composer.require['craftcms/cms']){
|
|
42
|
+
platform = 'craftcms';
|
|
40
43
|
} else if(wordpress) {
|
|
41
44
|
platform = 'wordpress';
|
|
42
45
|
} else {
|
|
46
|
+
// Check for old wordpress repo stucture and show warning
|
|
47
|
+
try{
|
|
48
|
+
if(existsSync(path.join(process.cwd(), 'themes/'))){
|
|
49
|
+
console.log(`This wordpress repo needs migrating to the new repo structure: \n${utilities.colorize(`https://demo.fishawack.solutions/Lab/Doc/#lab-env-migrating-200`, 'title')}`)
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
} catch(e){}
|
|
53
|
+
|
|
43
54
|
platform = 'core';
|
|
44
55
|
}
|
|
45
56
|
|
|
@@ -78,6 +89,12 @@ if(platform === 'laravel'){
|
|
|
78
89
|
}
|
|
79
90
|
|
|
80
91
|
docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/drupal/9/docker-compose.yml ${core} -p ${repo}`;
|
|
92
|
+
} else if(platform === "craftcms"){
|
|
93
|
+
if(!existsSync(path.join(process.cwd(), '.env'))){
|
|
94
|
+
copyFileSync(path.join(process.cwd(), '.env.example'), path.join(process.cwd(), '.env'));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/craftcms/3/docker-compose.yml ${core} -p ${repo}`;
|
|
81
98
|
} else {
|
|
82
99
|
docker = `docker-compose ${core} -p ${repo}`;
|
|
83
100
|
}
|
|
@@ -110,7 +127,7 @@ module.exports = {
|
|
|
110
127
|
process.env.PORT = await getPort({port: getPort.makeRange(3000, 3100)});
|
|
111
128
|
process.env.PORT_OPT = +process.env.PORT + 1;
|
|
112
129
|
|
|
113
|
-
if(platform === "laravel" || platform === "wordpress" || platform === "drupal"){
|
|
130
|
+
if(platform === "laravel" || platform === "wordpress" || platform === "drupal" || platform === "craftcms"){
|
|
114
131
|
process.env.PORT_WEB = await getPort({port: getPort.makeRange(8000, 8100)});
|
|
115
132
|
process.env.PORT_DB = await getPort({port: getPort.makeRange(3306, 3406)});
|
|
116
133
|
}
|
|
@@ -122,7 +139,7 @@ module.exports = {
|
|
|
122
139
|
process.env.PORT = ports.PORT;
|
|
123
140
|
process.env.PORT_OPT = ports.PORT_OPT;
|
|
124
141
|
|
|
125
|
-
if(platform === "laravel" || platform === "wordpress" || platform === "drupal"){
|
|
142
|
+
if(platform === "laravel" || platform === "wordpress" || platform === "drupal" || platform === "craftcms"){
|
|
126
143
|
process.env.PORT_WEB = ports.PORT_WEB;
|
|
127
144
|
process.env.PORT_DB = ports.PORT_DB;
|
|
128
145
|
}
|
|
@@ -153,4 +170,4 @@ module.exports = {
|
|
|
153
170
|
if(!running) execSync(`lab-env down`, opts);
|
|
154
171
|
}
|
|
155
172
|
}
|
|
156
|
-
};
|
|
173
|
+
};
|
package/intercept.sh
CHANGED
|
@@ -16,6 +16,14 @@ artisan(){
|
|
|
16
16
|
command lab-env artisan "$@"
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
craft(){
|
|
20
|
+
command lab-env craft "$@"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
wp(){
|
|
24
|
+
command lab-env wp "$@"
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
php(){
|
|
20
28
|
command lab-env php "$@"
|
|
21
29
|
}
|
|
@@ -36,7 +44,9 @@ export -f npm;
|
|
|
36
44
|
export -f composer;
|
|
37
45
|
export -f drush;
|
|
38
46
|
export -f artisan;
|
|
47
|
+
export -f craft;
|
|
48
|
+
export -f wp;
|
|
39
49
|
export -f php;
|
|
40
50
|
export -f chown;
|
|
41
51
|
export -f chmod;
|
|
42
|
-
export -f sed;
|
|
52
|
+
export -f sed;
|
|
@@ -22,7 +22,10 @@ services:
|
|
|
22
22
|
ports:
|
|
23
23
|
- "${PORT_WEB:-8000}:80"
|
|
24
24
|
php:
|
|
25
|
-
|
|
25
|
+
build:
|
|
26
|
+
context: ./php/
|
|
27
|
+
dockerfile: Dockerfile
|
|
28
|
+
image: lab-env/laravel/8/php:0.0.1
|
|
26
29
|
init: true
|
|
27
30
|
working_dir: /app
|
|
28
31
|
networks:
|
|
@@ -30,6 +33,7 @@ services:
|
|
|
30
33
|
volumes:
|
|
31
34
|
- $CWD/:/app
|
|
32
35
|
- ./php/custom.conf:/opt/bitnami/php/etc/custom.conf
|
|
36
|
+
- ./php/policy.xml:/etc/ImageMagick-6/policy.xml
|
|
33
37
|
- vendor:/app/vendor
|
|
34
38
|
redis:
|
|
35
39
|
image: redis:alpine
|
|
@@ -46,4 +50,4 @@ volumes:
|
|
|
46
50
|
mysql:
|
|
47
51
|
driver: "local"
|
|
48
52
|
redis:
|
|
49
|
-
driver: "local"
|
|
53
|
+
driver: "local"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
FROM chialab/php:7.4-fpm
|
|
2
|
+
|
|
3
|
+
MAINTAINER Mike Mellor
|
|
4
|
+
|
|
5
|
+
# Install Imagemagick
|
|
6
|
+
RUN apt-get update && \
|
|
7
|
+
apt-get install -y libmagickwand-dev --no-install-recommends
|
|
8
|
+
|
|
9
|
+
# PHP Imagick ext
|
|
10
|
+
RUN pecl install imagick && docker-php-ext-enable imagick
|
|
11
|
+
|
|
12
|
+
# Install ghostscript
|
|
13
|
+
RUN apt-get install -y ghostscript
|
|
14
|
+
|
|
15
|
+
# Cleanup apt-get install folders
|
|
16
|
+
RUN apt-get clean && \
|
|
17
|
+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE policymap [
|
|
3
|
+
<!ELEMENT policymap (policy)*>
|
|
4
|
+
<!ATTLIST policymap xmlns CDATA #FIXED ''>
|
|
5
|
+
<!ELEMENT policy EMPTY>
|
|
6
|
+
<!ATTLIST policy xmlns CDATA #FIXED '' domain NMTOKEN #REQUIRED
|
|
7
|
+
name NMTOKEN #IMPLIED pattern CDATA #IMPLIED rights NMTOKEN #IMPLIED
|
|
8
|
+
stealth NMTOKEN #IMPLIED value CDATA #IMPLIED>
|
|
9
|
+
]>
|
|
10
|
+
<!--
|
|
11
|
+
Configure ImageMagick policies.
|
|
12
|
+
|
|
13
|
+
Domains include system, delegate, coder, filter, path, or resource.
|
|
14
|
+
|
|
15
|
+
Rights include none, read, write, execute and all. Use | to combine them,
|
|
16
|
+
for example: "read | write" to permit read from, or write to, a path.
|
|
17
|
+
|
|
18
|
+
Use a glob expression as a pattern.
|
|
19
|
+
|
|
20
|
+
Suppose we do not want users to process MPEG video images:
|
|
21
|
+
|
|
22
|
+
<policy domain="delegate" rights="none" pattern="mpeg:decode" />
|
|
23
|
+
|
|
24
|
+
Here we do not want users reading images from HTTP:
|
|
25
|
+
|
|
26
|
+
<policy domain="coder" rights="none" pattern="HTTP" />
|
|
27
|
+
|
|
28
|
+
The /repository file system is restricted to read only. We use a glob
|
|
29
|
+
expression to match all paths that start with /repository:
|
|
30
|
+
|
|
31
|
+
<policy domain="path" rights="read" pattern="/repository/*" />
|
|
32
|
+
|
|
33
|
+
Lets prevent users from executing any image filters:
|
|
34
|
+
|
|
35
|
+
<policy domain="filter" rights="none" pattern="*" />
|
|
36
|
+
|
|
37
|
+
Any large image is cached to disk rather than memory:
|
|
38
|
+
|
|
39
|
+
<policy domain="resource" name="area" value="1GP"/>
|
|
40
|
+
|
|
41
|
+
Use the default system font unless overwridden by the application:
|
|
42
|
+
|
|
43
|
+
<policy domain="system" name="font" value="/usr/share/fonts/favorite.ttf"/>
|
|
44
|
+
|
|
45
|
+
Define arguments for the memory, map, area, width, height and disk resources
|
|
46
|
+
with SI prefixes (.e.g 100MB). In addition, resource policies are maximums
|
|
47
|
+
for each instance of ImageMagick (e.g. policy memory limit 1GB, -limit 2GB
|
|
48
|
+
exceeds policy maximum so memory limit is 1GB).
|
|
49
|
+
|
|
50
|
+
Rules are processed in order. Here we want to restrict ImageMagick to only
|
|
51
|
+
read or write a small subset of proven web-safe image types:
|
|
52
|
+
|
|
53
|
+
<policy domain="delegate" rights="none" pattern="*" />
|
|
54
|
+
<policy domain="filter" rights="none" pattern="*" />
|
|
55
|
+
<policy domain="coder" rights="none" pattern="*" />
|
|
56
|
+
<policy domain="coder" rights="read|write" pattern="{GIF,JPEG,PNG,WEBP}" />
|
|
57
|
+
-->
|
|
58
|
+
<policymap>
|
|
59
|
+
<!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
|
|
60
|
+
<policy domain="resource" name="memory" value="256MiB"/>
|
|
61
|
+
<policy domain="resource" name="map" value="512MiB"/>
|
|
62
|
+
<policy domain="resource" name="width" value="16KP"/>
|
|
63
|
+
<policy domain="resource" name="height" value="16KP"/>
|
|
64
|
+
<!-- <policy domain="resource" name="list-length" value="128"/> -->
|
|
65
|
+
<policy domain="resource" name="area" value="128MP"/>
|
|
66
|
+
<policy domain="resource" name="disk" value="1GiB"/>
|
|
67
|
+
<!-- <policy domain="resource" name="file" value="768"/> -->
|
|
68
|
+
<!-- <policy domain="resource" name="thread" value="4"/> -->
|
|
69
|
+
<!-- <policy domain="resource" name="throttle" value="0"/> -->
|
|
70
|
+
<!-- <policy domain="resource" name="time" value="3600"/> -->
|
|
71
|
+
<!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
|
|
72
|
+
<!-- <policy domain="module" rights="none" pattern="{PS,PDF,XPS}" /> -->
|
|
73
|
+
<!-- <policy domain="path" rights="none" pattern="@*" /> -->
|
|
74
|
+
<!-- <policy domain="cache" name="memory-map" value="anonymous"/> -->
|
|
75
|
+
<!-- <policy domain="cache" name="synchronize" value="True"/> -->
|
|
76
|
+
<!-- <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/> -->
|
|
77
|
+
<!-- <policy domain="system" name="max-memory-request" value="256MiB"/> -->
|
|
78
|
+
<!-- <policy domain="system" name="shred" value="2"/> -->
|
|
79
|
+
<!-- <policy domain="system" name="precision" value="6"/> -->
|
|
80
|
+
<!-- <policy domain="system" name="font" value="/path/to/font.ttf"/> -->
|
|
81
|
+
<!-- <policy domain="system" name="pixel-cache-memory" value="anonymous"/> -->
|
|
82
|
+
<!-- <policy domain="system" name="shred" value="2"/> -->
|
|
83
|
+
<!-- <policy domain="system" name="precision" value="6"/> -->
|
|
84
|
+
<!-- not needed due to the need to use explicitly by mvg: -->
|
|
85
|
+
<!-- <policy domain="delegate" rights="none" pattern="MVG" /> -->
|
|
86
|
+
<!-- use curl -->
|
|
87
|
+
<policy domain="delegate" rights="none" pattern="URL" />
|
|
88
|
+
<policy domain="delegate" rights="none" pattern="HTTPS" />
|
|
89
|
+
<policy domain="delegate" rights="none" pattern="HTTP" />
|
|
90
|
+
<!-- in order to avoid to get image with password text -->
|
|
91
|
+
<policy domain="path" rights="none" pattern="@*"/>
|
|
92
|
+
<!-- disable ghostscript format types -->
|
|
93
|
+
<!-- <policy domain="coder" rights="none" pattern="PS" />
|
|
94
|
+
<policy domain="coder" rights="none" pattern="PS2" />
|
|
95
|
+
<policy domain="coder" rights="none" pattern="PS3" />
|
|
96
|
+
<policy domain="coder" rights="none" pattern="EPS" />
|
|
97
|
+
<policy domain="coder" rights="none" pattern="PDF" />
|
|
98
|
+
<policy domain="coder" rights="none" pattern="XPS" /> -->
|
|
99
|
+
</policymap>
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishawack/lab-env",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Docker manager for FW",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "rm -rf _Test/_fixtures && mocha _Test/*.js --timeout 120s --bail",
|
|
7
|
+
"test": "rm -rf _Test/_fixtures && mkdir _Test/_fixtures && mocha _Test/*.js --timeout 120s --bail",
|
|
8
8
|
"preversion": "npm test",
|
|
9
9
|
"postversion": "git push && git push --tags && npm publish",
|
|
10
10
|
"postpublish": "git checkout development && git merge master && git push"
|
|
@@ -13,22 +13,32 @@ services:
|
|
|
13
13
|
volumes:
|
|
14
14
|
- mysql:/var/lib/mysql
|
|
15
15
|
wordpress:
|
|
16
|
-
|
|
16
|
+
build:
|
|
17
|
+
context: ./wordpress/
|
|
18
|
+
dockerfile: Dockerfile
|
|
19
|
+
image: lab-env/wordpress/5.7.2/wordpress:0.0.1
|
|
17
20
|
networks:
|
|
18
21
|
- default
|
|
19
22
|
environment:
|
|
20
|
-
|
|
23
|
+
WORDPRESS_DB_NAME: ${DB_DATABASE}
|
|
21
24
|
WORDPRESS_DB_USER: ${DB_USERNAME}
|
|
22
25
|
WORDPRESS_DB_PASSWORD: ${DB_PASSWORD}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
WORDPRESS_DB_HOST: ${DB_HOST}
|
|
27
|
+
WORDPRESS_DB_CHARSET: ${DB_CHARSET}
|
|
28
|
+
WORDPRESS_DB_COLLATE: ${DB_COLLATE}
|
|
29
|
+
WORDPRESS_AUTH_KEY: ${AUTH_KEY}
|
|
30
|
+
WORDPRESS_SECURE_AUTH: ${SECURE_AUTH}
|
|
31
|
+
WORDPRESS_LOGGED_IN: ${LOGGED_IN}
|
|
32
|
+
WORDPRESS_NONCE_KEY: ${NONCE_KEY}
|
|
33
|
+
WORDPRESS_AUTH_SALT: ${AUTH_SALT}
|
|
34
|
+
WORDPRESS_SECURE_AUTH: ${SECURE_AUTH}
|
|
35
|
+
WORDPRESS_LOGGED_IN: ${LOGGED_IN}
|
|
36
|
+
WORDPRESS_NONCE_SALT: ${NONCE_SALT}
|
|
37
|
+
WORDPRESS_TABLE_PREFIX: ${TABLE_PREFIX}
|
|
38
|
+
WORDPRESS_DEBUG: ${DEBUG}
|
|
39
|
+
WORDPRESS_CONFIG_EXTRA: ${CONFIG_EXTRA}
|
|
28
40
|
volumes:
|
|
29
|
-
- $CWD
|
|
30
|
-
- $CWD/plugins:/var/www/html/wp-content/plugins
|
|
31
|
-
- $CWD/uploads:/var/www/html/wp-content/uploads
|
|
41
|
+
- $CWD/:/var/www/html
|
|
32
42
|
- ./apache/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
|
|
33
43
|
- ./apache/.htaccess:/var/www/html/.htaccess
|
|
34
44
|
ports:
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
FROM wordpress:5.7.2
|
|
2
|
+
|
|
3
|
+
MAINTAINER Mike Mellor
|
|
4
|
+
|
|
5
|
+
# Install mysql client
|
|
6
|
+
RUN apt-get update && \
|
|
7
|
+
apt-get install -y mariadb-client
|
|
8
|
+
|
|
9
|
+
# Install wordpress cli
|
|
10
|
+
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
|
|
11
|
+
chmod +x wp-cli.phar && \
|
|
12
|
+
mv wp-cli.phar /usr/local/bin/wp
|
|
13
|
+
|
|
14
|
+
# Cleanup apt-get install folders
|
|
15
|
+
RUN apt-get clean && \
|
|
16
|
+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|