-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdd
executable file
·773 lines (707 loc) · 27.1 KB
/
pdd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
#!/bin/bash
# Help function that displays the usage of the script and available options.
show_help() {
echo "Usage: $0 [COMMAND] [OPTION]"
echo
echo "Available commands:"
echo " init [OPTION] Initialize the application with the specified option."
echo " Available options:"
echo " - default: Default configuration."
echo " - dev: Development configuration."
echo " - prod: Production configuration."
echo " - moodle: Moodle-specific configuration."
echo " - wordpress: Wordpress-specific development configuration."
echo " - wordpress_prod: Wordpress-specific production configuration."
echo " - laravel: Laravel-specific configuration."
echo " If no option is provided, 'dev' will be used by default."
echo " start [OPTION] Start the application with the specified option."
echo " Available options:"
echo " - default: Default configuration."
echo " - dev: Development configuration."
echo " - prod: Production configuration."
echo " - moodle: Moodle-specific configuration."
echo " - wordpress: Wordpress-specific development configuration."
echo " - wordpress_prod: Wordpress-specific configuration."
echo " - laravel: Laravel-specific configuration."
echo " If no option is provided, 'dev' will be used by default."
echo " stop [OPTION] Stop the application with the specified option."
echo " Available options:"
echo " - default: Default configuration."
echo " - dev: Development shutdown."
echo " - prod: Production shutdown."
echo " - moodle: Moodle-specific configuration."
echo " - wordpress: Wordpress-specific development configuration."
echo " - wordpress_prod: Wordpress-specific configuration."
echo " - laravel: Laravel-specific configuration."
echo " If no option is provided, 'dev' will be used by default."
echo " status [OPTION] Stop the application with the specified option."
echo " Available options:"
echo " - default: Default configuration."
echo " - dev: Development status."
echo " - prod: Production status."
echo " - moodle: Moodle-specific configuration."
echo " - wordpress: Wordpress-specific development configuration."
echo " - wordpress_prod: Wordpress-specific configuration."
echo " - laravel: Laravel-specific configuration."
echo " If no option is provided, 'dev' will be used by default."
echo " clean [OPTION]"
echo " : Execute a command into the selected container."
echo " Available options:"
echo " - all: clean code and database"
echo " - env: clean code"
echo " - code: clean code"
echo " - database: clean database data"
echo " - containers: clean containers"
echo " - help: Show this help and exit."
echo " container [OPTION] Clean the application with the specified container."
echo " Available options:"
echo " - help: Show this help and exit."
echo " - ls: List all running containers."
echo " - stop [CONTAINER_NAME]: Stop a running container."
echo " - start [CONTAINER_NAME]: Start a stopped container."
echo " - rm [CONTAINER_NAME]: Remove a stopped container."
echo " - exec [CONTAINER_NAME] [CMD]: Execute a command inside a container."
echo " help, -h, --help Show this help and exit."
}
copy_env_file(){
cp .env.example .env
}
create_logs_dirs(){
mkdir -p logs
mkdir -p logs/varnish
chmod -R 777 logs/varnish
}
delete_logs_dirs(){
rm -rf logs
}
# Function to initialize the application in development mode.
initialize_default() {
echo "Initializing the application in development mode."
# Place the code for initialization in development here.
copy_env_file
create_logs_dirs
}
# Function to initialize the application in development mode.
initialize_development() {
echo "Initializing the application in development mode."
# Place the code for initialization in development here.
copy_env_file
create_logs_dirs
}
# Function to initialize the application in production mode.
initialize_production() {
echo "Initializing the application in production mode."
# Place the code for initialization in production here.
copy_env_file
create_logs_dirs
}
# Function to initialize the application with Moodle-specific configuration.
initialize_moodle() {
echo "Initializing the application with Moodle-specific configuration."
copy_env_file
mkdir -p moodle
mkdir -p moodledata
cp src/phpinfo.php ./moodle/
rm -rf src
ln -s moodle src
create_logs_dirs
}
# Function to initialize the application with Moodle-specific configuration.
initialize_wordpress() {
copy_env_file
echo "Initializing the application with Wordpress-specific configuration."
mkdir -p wordpress
cp src/phpinfo.php ./wordpress/
rm -rf src
ln -s wordpress src
create_logs_dirs
# arranca el entorno
start_wordpress
# descarga wordpress
docker compose -f docker-compose-wordpress.yaml exec -it php wp core download --allow-root
# configura la bbdd
docker compose -f docker-compose-wordpress.yaml exec -it php /bin/bash -c 'wp core config --dbname=$MYSQL_DATABASE --dbuser=$MYSQL_USER --dbpass=$MYSQL_PASSWORD --dbhost=$MYSQL_HOST --allow-root'
# Crea al bbdd
# docker compose -f docker-compose-wordpress.yaml exec -it php wp db create --allow-root
}
# Function to initialize the application with Moodle-specific configuration.
initialize_wordpress_prod() {
echo "Initializing the application with Wordpress-specific configuration."
mkdir -p wordpress
cp src/phpinfo.php ./wordpress/
rm -rf src
ln -s wordpress src
create_logs_dirs
# arranca el entorno
start_wordpress_prod
# descarga wordpress
docker compose -f docker-compose-wordpress-prod.yaml exec -it php wp core download --allow-root
# configura la bbdd
docker compose -f docker-compose-wordpress-prod.yaml exec -it php /bin/bash -c 'wp core config --dbname=$MYSQL_DATABASE --dbuser=$MYSQL_USER --dbpass=$MYSQL_PASSWORD --dbhost=$MYSQL_HOST --allow-root'
# Crea al bbdd
# docker compose -f docker-compose-wordpress-prod.yaml exec -it php wp db create --allow-root
}
initialize_laravel(){
echo "Initializing the application with Laravel-specific configuration."
start_laravel
docker compose -f docker-compose-laravel.yaml exec -it php composer global require laravel/installer
docker compose -f docker-compose-laravel.yaml exec -it php sh -c "echo 'export PATH=$PATH:/root/.composer/vendor/bin' >> /root/.bashrc"
docker compose -f docker-compose-laravel.yaml exec -it php sh -c "chown -R www-data:www-data /var/www/html"
echo "Now you have composer and laravel command intro the container and available into the PATH"
}
install_wordpress(){
# Change permissions
docker compose -f docker-compose-wordpress.yaml exec -it php /bin/bash -c 'chown -R www-data:www-data /var/www/html'
# realiza la instalación
docker compose -f docker-compose-wordpress.yaml exec -it php /bin/bash -c 'wp core install --url=$WP_SITEURL_DEV --title="$SITE_TITLE" --admin_user=$ADMIN_USER --admin_password=$ADMIN_PASSWORD --admin_email=$ADMIN_EMAIL --allow-root'
# instalar el idioma
docker compose -f docker-compose-wordpress.yaml exec -it php /bin/bash -c 'wp language core install $WP_LANG --allow-root'
# Elegir idioma por defecto
docker compose -f docker-compose-wordpress.yaml exec -it php /bin/bash -c 'wp site switch-language $WP_LANG --allow-root'
# Actualizar traducciones de core
docker compose -f docker-compose-wordpress.yaml exec -it php /bin/bash -c 'wp language core update --allow-root'
# Actualizar plugins instalados
docker compose -f docker-compose-wordpress.yaml exec -it php /bin/bash -c 'wp plugin update --all --allow-root'
# Autoactualizar plugins instalados
docker compose -f docker-compose-wordpress.yaml exec -it php /bin/bash -c 'wp plugin auto-updates enable --all --allow-root'
# Config SiteURL
# docker compose -f docker-compose-wordpress.yaml exec -it php /bin/bash -c 'wp option update siteurl $WP_SITEURL_DEV --allow-root'
# Config SiteURL
# docker compose -f docker-compose-wordpress.yaml exec -it php /bin/bash -c 'wp option update home $WP_SITEURL_DEV --allow-root'
# Change permissions
docker compose -f docker-compose-wordpress.yaml exec -it php /bin/bash -c 'chown -R www-data:www-data /var/www/html'
}
install_wordpress_prod(){
# Change permissions
docker compose -f docker-compose-wordpress-prod.yaml exec -it php /bin/bash -c 'chown -R www-data:www-data /var/www/html'
# realiza la instalación
docker compose -f docker-compose-wordpress-prod.yaml exec -it php /bin/bash -c 'wp core install --url=$WP_SITEURL --title="$SITE_TITLE" --admin_user=$ADMIN_USER --admin_password=$ADMIN_PASSWORD --admin_email=$ADMIN_EMAIL --allow-root'
# instalar el idioma
docker compose -f docker-compose-wordpress-prod.yaml exec -it php /bin/bash -c 'wp language core install $WP_LANG --allow-root'
# Elegir idioma por defecto
docker compose -f docker-compose-wordpress-prod.yaml exec -it php /bin/bash -c 'wp site switch-language $WP_LANG --allow-root'
# Actualizar traducciones de core
docker compose -f docker-compose-wordpress-prod.yaml exec -it php /bin/bash -c 'wp language core update --allow-root'
# Actualizar plugins instalados
docker compose -f docker-compose-wordpress-prod.yaml exec -it php /bin/bash -c 'wp plugin update --all --allow-root'
# Autoactualizar plugins instalados
docker compose -f docker-compose-wordpress-prod.yaml exec -it php /bin/bash -c 'wp plugin auto-updates enable --all --allow-root'
# Config SiteURL
docker compose -f docker-compose-wordpress-prod.yaml exec -it php /bin/bash -c 'wp option update siteurl $WP_SITEURL --allow-root'
# Config SiteURL
docker compose -f docker-compose-wordpress-prod.yaml exec -it php /bin/bash -c 'wp option update home $WP_SITEURL --allow-root'
# Change permissions
docker compose -f docker-compose-wordpress-prod.yaml exec -it php /bin/bash -c 'chown -R www-data:www-data /var/www/html'
# change access to https wordpress
docker compose -f docker-compose-wordpress.yaml exec -it php /bin/bash -c "sed -i 's/require_once ABSPATH \. '\''wp-settings\.php'\'';/define('\''FORCE_SSL_ADMIN'\'', true);\\n\\nif( strpos(\$_SERVER['\''HTTP_X_FORWARDED_PROTO'\''], '\''https'\'') !== false )\\n \$_SERVER['\''HTTPS'\''] = '\''on'\'';\\nelse\\n \$_SERVER['\''HTTPS'\''] = '\''off'\'';\\n\\/\\*\\* Sets up WordPress vars and included files. \\*\\/\nrequire_once ABSPATH \. '\''wp-settings\.php'\'';/' \"wp-config.php\""
}
show_install_help(){
# Display help for the 'container' command.
echo "Usage: $0 install [COMMAND]"
echo
echo "Available commands:"
echo " help Show this help and exit."
echo " wordpress Install wordpress into the container."
echo " wordpress_prod Install wordpress into the container."
}
# Function to start the application in development mode.
start_default() {
echo "Starting the application in development mode."
docker compose up -d --force-recreate
}
# Function to start the application in development mode.
start_development() {
echo "Starting the application in development mode."
docker compose -f docker-compose-dev.yaml up -d --force-recreate
}
# Function to start the application in production mode.
start_production() {
echo "Starting the application in production mode."
docker compose -f docker-compose-prod.yaml up -d --force-recreate
}
# Function to start the application with Moodle-specific configuration.
start_moodle() {
echo "Starting the application with Moodle-specific configuration."
docker compose -f docker-compose-moodle.yaml up -d --force-recreate
}
# Function to start the application with Wordpress-specific configuration.
start_wordpress() {
echo "Starting the application with Wordpress-specific configuration."
docker compose -f docker-compose-wordpress.yaml up -d --force-recreate
}
# Function to start the application with Wordpress-specific configuration.
start_wordpress_prod() {
echo "Starting the application with Wordpress-specific configuration."
docker compose -f docker-compose-wordpress-prod.yaml up -d --force-recreate
}
# Function to start the application with Moodle-specific configuration.
start_laravel() {
echo "Starting the application with Moodle-specific configuration."
docker compose -f docker-compose-laravel.yaml up -d --force-recreate
}
# Function to stop the application in development mode.
stop_default() {
echo "Stopping the application in development mode."
docker compose down
}
# Function to stop the application in development mode.
stop_development() {
echo "Stopping the application in development mode."
docker compose -f docker-compose-dev.yaml down
}
# Function to stop the application in production mode.
stop_production() {
echo "Stopping the application in production mode."
docker compose -f docker-compose-prod.yaml down
}
stop_moodle() {
echo "Stopping the moodle in development mode."
docker compose -f docker-compose-moodle.yaml down
}
stop_wordpress() {
echo "Stopping the wordpress in development mode."
docker container stop wp-nginx
docker container rm wp-nginx
docker compose -f docker-compose-wordpress.yaml down
}
stop_wordpress_prod() {
echo "Stopping the wordpress in development mode."
docker compose -f docker-compose-wordpress-prod.yaml down
}
stop_laravel() {
echo "Stopping the application in laravel mode."
docker compose -f docker-compose-laravel.yaml down
}
# Function to stop the application in development mode.
status_default() {
echo "Status the application in development mode."
docker compose ps
}
# Function to status the application in development mode.
status_development() {
echo "Status the application in development mode."
docker compose -f docker-compose-dev.yaml ps
}
# Function to status the application in production mode.
status_production() {
echo "Status the application in production mode."
docker compose -f docker-compose-prod.yaml ps
}
status_moodle() {
echo "Status the moodle in development mode."
docker compose -f docker-compose-moodle.yaml ps
}
status_wordpress() {
echo "Status the wordpress in development mode."
docker compose -f docker-compose-wordpress.yaml ps
}
status_wordpress_prod() {
echo "Status the wordpress in development mode."
docker compose -f docker-compose-wordpress-prod.yaml ps
}
status_laravel() {
echo "Status the application in laravel mode."
docker compose -f docker-compose-laravel.yaml ps
}
status_show_help(){
# Display help for the 'container' command.
echo "Usage: $0 status [COMMAND]"
echo
echo "Available commands:"
echo " dev Development status."
echo " prod Production status."
echo " moodle moodle: Moodle-specific configuration."
echo " wordpress Wordpress-specific development configuration."
echo " wordpress_prod wordpress_prod: Wordpress-specific configuration."
echo " laravel Laravel-specific configuration."
echo " help Show this help and exit."
echo " If no option is provided, 'dev' will be used by default."
}
show_clean_help(){
# Display help for the 'container' command.
echo "Usage: $0 clean [COMMAND]"
echo
echo "Available commands:"
echo " help Show this help and exit."
echo " all Stop a running container."
echo " database Start a stopped container."
echo " src Remove a stopped container."
}
# Function to clean everything.
clean_all() {
echo "Cleaning everything: development, production, and Moodle."
#clean_env_file
clean_source_code
clean_database
clean_containers
delete_logs_dirs
}
clean_env_file(){
rm .env
}
# Function to clean the database.
clean_database() {
echo "Cleaning the database."
sudo rm -rf db-data/*
}
# Function to clean the source code.
clean_source_code() {
echo "Cleaning the source code."
sudo rm -rf src
sudo rm -rf wordpress
sudo rm -rf laravel
sudo rm -rf moodle
mkdir -p src
cp ./init/phpinfo.php src
}
clean_containers(){
echo "Cleaning PHP container image."
stop_wordpress
docker image rm php-dev-docker-php
docker image rm php-wordpress
}
run_inside_docker() {
local container_name="$1"
shift # Remove the container name from the arguments list
local command_to_run="$@" # Get the command to execute inside the container
if [ -z "$container_name" ]; then
echo "Please provide a container name as the first argument."
show_help
exit 1
fi
if [ -z "$command_to_run" ]; then
echo "Please provide a command to execute inside the Docker container."
show_help
exit 1
fi
local docker_command="docker exec $container_name $command_to_run"
echo "Running the command '$command_to_run' inside the Docker container '$container_name'."
# Execute the command inside the Docker container.
$docker_command
}
help_container(){
# Display help for the 'container' command.
echo "Usage: $0 container [COMMAND]"
echo
echo "Available commands:"
echo " help Show this help and exit."
echo " ls List all running containers."
echo " stop [CONTAINER_NAME] Stop a running container."
echo " start [CONTAINER_NAME] Start a stopped container."
echo " rm [CONTAINER_NAME] Remove a stopped container."
echo " exec [CONTAINER_NAME] [CMD] Execute a command inside a container with shell."
echo " unattended|un [CONTAINER_NAME] [CMD] Execute a command inside a container unattended."
}
run_inside_container() {
local container_name="$1"
local command_to_run="${2:-/bin/bash}" # Default to /bin/bash if no command is provided
if [ -z "$container_name" ]; then
echo "Please provide a container name as the first argument."
show_help
exit 1
fi
local docker_command="docker exec -it $container_name $command_to_run"
echo "Running the command '$command_to_run' inside the container '$container_name'."
# Execute the command inside the Docker container.
$docker_command
}
run_inside_container_unattended() {
local container_name="$1"
local command_to_run="${2:-/bin/bash}" # Default to /bin/bash if no command is provided
if [ -z "$container_name" ]; then
echo "Please provide a container name as the first argument."
show_help
exit 1
fi
local docker_command="docker exec $container_name $command_to_run"
echo "Running the command '$command_to_run' inside the container '$container_name'."
# Execute the command inside the Docker container.
$docker_command
}
# Function to start a Docker container.
start_container() {
local container_name="$1"
if [ -z "$container_name" ]; then
echo "Please provide a container name as the argument."
show_help
exit 1
fi
local docker_command="docker start $container_name"
echo "Starting the container '$container_name'."
# Start the Docker container.
$docker_command
}
# Function to stop a Docker container.
stop_container() {
local container_name="$1"
if [ -z "$container_name" ]; then
echo "Please provide a container name as the argument."
show_help
exit 1
fi
local docker_command="docker stop $container_name"
echo "Stopping the container '$container_name'."
# Stop the Docker container.
$docker_command
}
# Function to remove a Docker container.
remove_container() {
local container_name="$1"
if [ -z "$container_name" ]; then
echo "Please provide a container name as the argument."
show_help
exit 1
fi
local docker_command="docker rm $container_name"
echo "Removing the container '$container_name'."
# Remove the Docker container.
$docker_command
}
ls_container(){
docker compose ps
}
ENV_FILE=".env"
if [ ! -f "$ENV_FILE" ]; then
echo "El archivo $ENV_FILE no existe."
cp .env.example .env
fi
# carga el fichero .env
source "$ENV_FILE"
# Check if the script was invoked with no arguments or with the help option.
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
show_help
exit 0
fi
# Process the commands passed as arguments.
case "$1" in
init)
case "$2" in
dev)
initialize_development
;;
prod)
initialize_production
;;
wordpress)
initialize_wordpress
;;
wordpress_prod)
initialize_wordpress_prod
;;
moodle)
initialize_moodle
;;
laravel)
initialize_laravel
;;
"")
# If no option is provided, use 'dev' by default.
initialize_default
;;
*)
echo "Invalid option for 'init' command."
show_help
exit 1
;;
esac
;;
start)
case "$2" in
dev)
start_development
;;
prod)
start_production
;;
moodle)
start_moodle
;;
wordpress)
start_wordpress
;;
wordpress_prod)
start_wordpress_prod
;;
laravel)
start_laravel
;;
"")
# If no option is provided, use 'dev' by default.
start_default
;;
*)
echo "Invalid option for 'start' command."
show_help
exit 1
;;
esac
;;
stop)
case "$2" in
dev)
stop_development
;;
prod)
stop_production
;;
moodle)
stop_moodle
;;
wordpress)
stop_wordpress
;;
wordpress_prod)
stop_wordpress_prod
;;
laravel)
stop_laravel
;;
"")
# If no option is provided, use 'dev' by default.
stop_default
;;
*)
echo "Invalid option for 'stop' command."
show_help
exit 1
;;
esac
;;
status)
case "$2" in
dev)
status_development
;;
prod)
status_production
;;
moodle)
status_moodle
;;
wordpress)
status_wordpress
;;
wordpress_prod)
status_wordpress_prod
;;
laravel)
status_laravel
;;
"")
# If no option is provided, use 'dev' by default.
status_default
;;
*)
echo "Invalid option for 'start' command."
status_show_help
exit 1
;;
esac
;;
clean)
case "$2" in
all)
clean_all
;;
env)
clean_env_file
;;
database)
clean_database
;;
code)
clean_source_code
;;
containers)
clean_containers
;;
help)
show_clean_help
exit 0
;;
"")
echo "You must provide a suboption for the 'clean' command."
show_help
exit 1
;;
*)
echo "Invalid suboption for the 'clean' command."
show_help
exit 1
;;
esac
;;
container)
# Handle container-related commands.
case "$2" in
help)
help_container
exit 0
;;
ls)
# List all running containers.
ls_container
exit 0
;;
stop)
# Stop a running container.
stop_container "$3"
exit 0
;;
start)
# Start a stopped container.
start_container "$3"
exit 0
;;
rm)
# Remove a stopped container.
remove_container "$3"
exit 0
;;
unattended | un)
# Execute a command inside a container.
shift 2 # Remove 'container exec' from the arguments list.
run_inside_container_unattended "$@"
exit 0
;;
exec)
# Execute a command inside a container.
shift 2 # Remove 'container exec' from the arguments list.
run_inside_container "$@"
;;
*)
echo "Invalid option for 'container' command. Use '$0 container help' to see available options."
exit 1
;;
esac
;;
install)
case "$2" in
wordpress)
install_wordpress
exit 0
;;
wordpress_prod)
install_wordpress_prod
exit 0
;;
help)
show_install_help
exit 0
;;
*)
echo "Invalid option for 'install' command. Use '$0 container help' to see available options."
exit 1
;;
esac
;;
help | -h | --help)
show_help
exit 0
;;
*)
echo "Invalid command. Use '$0 help' to see available options."
exit 1
;;
esac
exit 0