@@ -6,6 +6,17 @@ function _m2d_display_help_main ()
6
6
echo "
7
7
Usage: ./bin/m2d COMMAND [OPTIONS]
8
8
9
+ Examples:
10
+ - initial setup:
11
+ ./bin/m2d setup init
12
+
13
+ - build and start containers:
14
+ ./bin/m2d up --build
15
+
16
+ - stop and remove containers and networks:
17
+ ./bin/m2d down
18
+
19
+
9
20
Options:
10
21
-h, --help Disply help for command
11
22
@@ -14,6 +25,7 @@ Commands:
14
25
disable Disable selected service or tool
15
26
down Stop and remove containers and networks
16
27
enable Enable selected service or tool
28
+ go Enters a running container
17
29
logs View logs from containers
18
30
set Sets configuration value
19
31
setup Configure project
@@ -29,11 +41,20 @@ function _m2d_display_help_set ()
29
41
echo "
30
42
Usage: ./bin/m2d set [OPTIONS] PARAMETER VALUE
31
43
44
+ Sets configuration value.
45
+
46
+ Examples:
47
+ ./bin/m2d set M2D_XDEBUG_IDE_KEY VSCODE
48
+ ./bin/m2d set es 8.4
49
+
32
50
Options:
33
51
-h, --help Disply help for command
34
52
35
53
Parameters:
54
+ es Alias for setting Elasticsearch as the search engine. It will set M2D_SEARCH_ENGINE_VENDOR to 'elasticsearch',
55
+ and M2D_SEARCH_ENGINE_VERSION to '7' if expected version is not provided as a value
36
56
php Alias for parameter M2D_WEB_SERVER_PHP_VERSION
57
+ suffix Alias for parameter M2D_PROJECT_SUFFIX
37
58
[M2D_*] Parameter name. List of possible parameters and their values is in .env.example
38
59
"
39
60
}
@@ -43,6 +64,11 @@ function _m2d_display_help_show ()
43
64
echo "
44
65
Usage: ./bin/m2d show [OPTIONS] PARAMETER
45
66
67
+ Shows configuration value.
68
+
69
+ Example:
70
+ ./bin/m2d show M2D_SOURCE_DIRECTORY
71
+
46
72
Options:
47
73
-h, --help Disply help for command
48
74
@@ -56,6 +82,11 @@ function _m2d_display_help_setup ()
56
82
echo "
57
83
Usage: ./bin/m2d setup [OPTIONS] [COMMAND] [PROJECT_ID]
58
84
85
+ Configure project.
86
+
87
+ Example:
88
+ ./bin/m2d setup init
89
+
59
90
Options:
60
91
-h, --help Disply help for command
61
92
@@ -68,27 +99,35 @@ Commands:
68
99
69
100
function _m2d_display_help_enable_disable ()
70
101
{
102
+ local command=$1
103
+ local Command=${1^}
104
+
71
105
echo "
72
- Usage: ./bin/m2d $1 [OPTIONS] COMMAND
106
+ Usage: ./bin/m2d $command [OPTIONS] COMMAND
107
+
108
+ $Command selected service or tool.
109
+
110
+ Example:
111
+ ./bin/m2d $command mailcatcher
73
112
74
113
Options:
75
114
-h, --help Disply help for command
76
115
77
116
Commands:
78
- blackfire ${1^} blackfire container
79
- db-cache ${1^} db-cache container
117
+ blackfire $Command blackfire container
118
+ db-cache $Command db-cache container
80
119
elastic Alias for 'search-engine ' command
81
120
m Alias for 'mailcatcher' command
82
- mailcatcher ${1^} mailcatcher container
83
- message-broker ${1^} message broker container
121
+ mailcatcher $Command mailcatcher container
122
+ message-broker $Command message broker container
84
123
rabbit Alias for 'message-broker' command
85
124
redis Alias for 'db-cache' command
86
- search-engine ${1^} search engine container
87
- selenium ${1^} selenium container
125
+ search-engine $Command search engine container
126
+ selenium $Command selenium container
88
127
varnish Alias for 'web-cache' command
89
- web-cache ${1^} web-cache container
128
+ web-cache $Command web-cache container
90
129
91
- After container is $1 it must be rebuild with: \` ./bin/m2d build\` or \` ./bin/m2d up --build\`
130
+ After container is $command it must be rebuild with: \` ./bin/m2d build\` or \` ./bin/m2d up --build\`
92
131
"
93
132
}
94
133
@@ -97,6 +136,8 @@ function _m2d_display_help_up ()
97
136
echo "
98
137
Usage: ./bin/m2d up [OPTIONS]
99
138
139
+ Create and start containers.
140
+
100
141
Options:
101
142
-h, --help Disply help for command
102
143
-b, --build Build images before starting containers.
@@ -118,6 +159,11 @@ function _m2d_display_help_go ()
118
159
echo "
119
160
Usage: ./bin/m2d go [OPTIONS] CONTAINER_NAME
120
161
162
+ Enters a running container.
163
+
164
+ Example:
165
+ ./bin/m2d go web
166
+
121
167
Options:
122
168
-h, --help Disply help for command
123
169
@@ -134,6 +180,8 @@ function _m2d_display_help_logs ()
134
180
echo "
135
181
Usage: ./bin/m2d logs [OPTIONS] CONTAINER_NAME
136
182
183
+ View logs from containers.
184
+
137
185
Options:
138
186
-h, --help Disply help for command
139
187
@@ -147,6 +195,8 @@ function _m2d_display_help_sync ()
147
195
echo "
148
196
Usage: ./bin/m2d sync [OPTIONS] ACTION
149
197
198
+ Manage data sync from between host an containers.
199
+
150
200
Options:
151
201
-h, --help Disply help for command
152
202
@@ -292,14 +342,14 @@ function _m2d_sync ()
292
342
local sync_type=$( _m2d_env_get_parameter " $env_file " M2D_SOURCE_DIRECTORY_SYNC_TYPE)
293
343
local sync_dir=$( _m2d_env_get_parameter " $env_file " M2D_SOURCE_DIRECTORY)
294
344
local server_vendor=$( _m2d_env_get_parameter " $env_file " M2D_WEB_SERVER_VENDOR)
295
- local ssh_port=$( _m2d_env_get_parameter " $env_file " M2D_PORT_FOR_WEB_SERVER_SSH)
296
345
local project_path=" $3 "
297
346
298
347
case $sync_type in
299
348
' bind' )
300
349
echo " Nothing to do for '$action ' in '$sync_type ' sync type"
301
350
;;
302
351
' sshfs' )
352
+ local ssh_port=$( _m2d_env_get_parameter " $env_file " M2D_PORT_FOR_WEB_SERVER_SSH)
303
353
case $action in
304
354
' start' )
305
355
local identity_file=" $project_path /services/web-servers/$server_vendor /etc/ssh/magento2docker"
@@ -321,12 +371,14 @@ function _m2d_sync ()
321
371
esac
322
372
;;
323
373
' mutagen' )
374
+ local sync_name=" m2d-sync$( _m2d_env_get_parameter $env_file M2D_PROJECT_SUFFIX) "
375
+ local sync_web=" m2d-web$( _m2d_env_get_parameter $env_file M2D_PROJECT_SUFFIX) "
324
376
case $action in
325
377
' start' )
326
- if [[ -n $( mutagen sync list | grep m2d-sync ) ]]; then
327
- mutagen sync resume m2d-sync
378
+ if [[ -n $( mutagen sync list | grep $sync_name ) ]]; then
379
+ mutagen sync resume $sync_name
328
380
else
329
- mutagen sync create --name=magento2web \
381
+ mutagen sync create --name=$sync_name \
330
382
--default-group-beta=magento \
331
383
--default-owner-beta=magento \
332
384
--sync-mode=two-way-resolved \
@@ -344,17 +396,17 @@ function _m2d_sync ()
344
396
--ignore=/** /.DS_Store \
345
397
--symlink-mode=posix-raw \
346
398
" $sync_dir " \
347
- docker://magento@m2d-web /var/www/html/
399
+ " docker://magento@$sync_web /var/www/html/"
348
400
fi
349
401
;;
350
402
' pause' )
351
- mutagen sync pause m2d-sync
403
+ mutagen sync pause $sync_name
352
404
;;
353
405
' stop' )
354
- mutagen sync terminate m2d-sync
406
+ mutagen sync terminate $sync_name
355
407
;;
356
408
' status' )
357
- mutagen sync monitor m2d-sync
409
+ mutagen sync monitor $sync_name
358
410
;;
359
411
' restart' )
360
412
_m2d_sync stop " $env_file "
@@ -374,20 +426,23 @@ function _m2d_sync ()
374
426
375
427
M2D_SCRIPT_DIRECTORY=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd)
376
428
M2D_PROJECT_PATH=" $( realpath $M2D_SCRIPT_DIRECTORY /../) "
377
- M2D_ENV_FILE=" $( realpath $ M2D_PROJECT_PATH /.env) "
429
+ M2D_ENV_FILE=" $M2D_PROJECT_PATH /.env"
378
430
379
431
case $1 in
380
432
' set' )
381
433
case $2 in
382
434
' -h' |' --help' )
383
435
_m2d_display_help_set
384
436
;;
437
+ ' suffix' )
438
+ _m2d_env_set_parameter " $M2D_ENV_FILE " M2D_PROJECT_SUFFIX " $3 "
439
+ ;;
385
440
' php' )
386
441
_m2d_env_set_parameter " $M2D_ENV_FILE " " M2D_WEB_SERVER_PHP_VERSION" " $3 "
387
442
;;
388
443
' es' )
389
444
_m2d_env_set_parameter " $M2D_ENV_FILE " " M2D_SEARCH_ENGINE_VENDOR" elasticsearch
390
- _m2d_env_set_parameter " $M2D_ENV_FILE " " M2D_SEARCH_ENGINE_VERSION" " $3 "
445
+ _m2d_env_set_parameter " $M2D_ENV_FILE " " M2D_SEARCH_ENGINE_VERSION" " ${3 :- 7} "
391
446
;;
392
447
* )
393
448
_m2d_env_set_parameter " $M2D_ENV_FILE " " $2 " " $3 "
0 commit comments