Repository navigation
Expand file tree
/
Copy pathgenoring.pl
More file actions
executable file
·1545 lines (1104 loc) · 41.1 KB
/
Copy pathgenoring.pl
File metadata and controls
executable file
·1545 lines (1104 loc) · 41.1 KB
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
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env perl
=pod
=head1 NAME
genoring.pl - Manages GenoRing platform.
=head1 USAGE
=head2 Syntax
perl genoring.pl help [COMMAND | FLAG] | man
| start | stop | online | offline | backend | logs [-f] | status
| modules | services | volumes | alternatives <MODULE>
| moduledetails <MODULE>
| setup [-default | -minimal] [-reset]
| reset [-f] [-delete-containers] [-preserve-env]
| enable <MODULE>... | disable <MODULE> | uninstall <MODULE> [-preserve-env]
| enablealt <MODULE> <SERVICE> | disablealt <MODULE> <SERVICE>
| toexternal <SERVICE> <IP|host> | togenoring <SERVICE> [ALTERNATIVE]
| attach <DIRECTORY> | detach <PROJECT> | instances
| update [MODULE] | upgrade [MODULE]
| backup [BKNAME] | restore [BKNAME] | clearcache | build <MODULE> <SERVICE> [-no-cache]
| shell [SERVICE] [-cmd=<COMMAND>] [-local]
| exportvolume <VOLUME> [ARCHIVE.tar.gz]
| importvolume <VOLUME> <ARCHIVE.tar.gz | DIRECTORY>
| version [MODULE] [-all | -latest]
| diag | localhooks <HOOK> [MODULE] | containerhooks <HOOK> [MODULE]
[-debug] [-no-exposed-volumes | -exposed-volumes] [-no-backup]
[-port=<HTTP_PORT>] [-arm[=ARCH] | -platform=<ARCH>] [-health-timeout[=DELAYSEC]]
[-network=<NETWORK_NAME>[:[SERVICE_LIST]]]...
[-no-exposed-ports | -exposed-ports] [-path=<BASE_PATH>] [-managed]
[-yes|-no] [-verbose] [-quiet-build] [-skip-checks]
=head2 Example
./genoring.pl start
./genoring.pl stop
Multi-instances:
- Linux/Mac:
COMPOSE_PROJECT_NAME=instance_name ./genoring.pl start -port 8888
- Windows:
set COMPOSE_PROJECT_NAME=instance_name
perl genoring.pl start -port 8888
Use "man" for more details.
=head1 REQUIRES
Perl5
=head1 DESCRIPTION
Manages GenoRing platform. This script can be used to start, update, stop,
reinstall GenoRing, get informations on current GenoRing instance and build
GenoRing module containers.
=cut
require 5.010;
use strict;
use warnings;
use utf8;
use Cwd qw();
use File::Basename;
use File::Spec;
use FindBin;
use Pod::Usage;
use Time::Piece;
# Local libraries.
$ENV{'GENORING_RUNNING'} = 1;
use lib "$FindBin::Bin/perllib";
use Genoring;
++$|; #no buffering
# Script options
#################
=pod
=head1 OPTIONS
=head2 COMMANDS
=head3 help
=head4 Syntax
perl genoring.pl help [COMMAND | FLAG]
=head4 Description
Display help and exits. If a command or a flag (with its leading dash) is
given, only displays the help of that command or flag.
=head3 man
=head4 Syntax
perl genoring.pl man
=head4 Description
Prints the manual page and exits.
=head3 start
=head4 Syntax
perl genoring.pl start
=head4 Description
Starts GenoRing. For the first start, GenoRing is installed and initialized.
The "-network" flag can be used to manage the Docker networks of the instance
and the "-no-exposed-ports" and "-exposed-ports" flags to manage port
exposition.
=head3 stop
=head4 Syntax
perl genoring.pl stop
=head4 Description
Stops GenoRing.
=head3 online
=head4 Syntax
perl genoring.pl online
=head4 Description
Alias for "start". Starts GenoRing in "online" mode in opposit to "offline" or
"backend" modes. "Online" mode is the regular mode in which GenoRing should be
runned.
=head3 offline
=head4 Syntax
perl genoring.pl offline
=head4 Description
Starts GenoRing in "offline" mode, meaning that the web site displays a
maintenance message and returns a 503 HTTP status code (Service Unavailable).
The administration interface is *not* accessible and *no* web services are
available. It is suitable when you want to temporarily disable the site for any
reasons (technical maintainence, security issues).
=head3 backend
=head4 Syntax
perl genoring.pl backend
=head4 Description
Starts GenoRing in "backend" mode, meaning that the site *is accessible* but
displays a maintenance page and *no services* are available. The admin users can
still login and access the administration interface. It is suitable when admins
need to access the user interface to perform management tasks while regular
users should not access the site to avoid issues.
=head3 logs
=head4 Syntax
perl genoring.pl logs [-f]
=head4 Description
Display container logs. If the "-f" flag is used, logs are displayed in "follow"
mode (updated live until the GenoRing script is stopped).
=head3 status
=head4 Syntax
perl genoring.pl status
=head4 Description
Display current GenoRing status (ie. "running", "not running", "offline mode",
...).
=head3 modules
=head4 Syntax
perl genoring.pl modules [0|1]
=head4 Description
Displays all available modules by default. If 0 is used, only disabled modules
are listed and if 1 is used, only enabled modules are listed.
=head3 services
=head4 Syntax
perl genoring.pl services
=head4 Description
Displays the list of GenoRing services with their corresponding (enabled)
modules.
=head3 volumes
=head4 Syntax
perl genoring.pl volumes
=head4 Description
Displays the list of GenoRing volumes with their corresponding (enabled)
modules.
=head3 alternatives
=head4 Syntax
perl genoring.pl alternatives <MODULE>
=head4 Description
Displays the list of service alternatives for a given module.
=head3 moduledetails
=head4 Syntax
perl genoring.pl moduledetails <MODULE>
=head4 Description
Displays information on the given module.
=head3 setup
=head4 Syntax
perl genoring.pl setup [-default | -minimal] [-reset]
=head4 Description
Setups GenoRing environment and regenerates Docker Compose file.
If '-default' flag is used, all current or default settings are used (nb. the
"-yes" flag does not validate defaults.). If '-minimal' flag is used, only
non-optional environment values will be asked. If '-reset' flag is used, current
environment files are removed and need to be fully regenerated.
The "-network" flag can be used to manage the Docker networks of the instance
and the "-no-exposed-ports" and "-exposed-ports" flags to manage port
exposition.
=head3 reset
=head4 Syntax
perl genoring.pl reset [-f] [-delete-containers] [-preserve-env]
=head4 Description
Reinitializes GenoRing system and removes everything (except GenoRing backups
stored in "sysbackups/") to restart GenoRing from scratch. If the '-f' flag is used, no confirmation is asked. If
the '-delete-containers' flag is used, build containers are also removed.
If '-preserve-env' is used, current environment files are kept.
=head3 enable
=head4 Syntax
perl genoring.pl enable <MODULE>...
=head4 Description
Installs and enables the given GenoRing module and any required modules that
are available. Confirmation is requested before additional modules are enabled.
=head3 disable
=head4 Syntax
perl genoring.pl disable <MODULE>
=head4 Description
Disables the given GenoRing module.
=head3 uninstall
=head4 Syntax
perl genoring.pl uninstall <MODULE> [-preserve-env]
=head4 Description
Uninstalls the given GenoRing module. If -preserve-env flag is used, settings
are not removed.
=head3 enablealt
=head4 Syntax
perl genoring.pl enablealt <MODULE> <SERVICE>
=head4 Description
Enables the given GenoRing module service alternative.
=head3 disablealt
=head4 Syntax
perl genoring.pl disablealt <MODULE> <SERVICE>
=head4 Description
Disables the given GenoRing module service alternative and put back the default
service.
=head3 toexternal
=head4 Syntax
perl genoring.pl toexternal <SERVICE> <IP | host | host-gateway>
=head4 Description
Turns a Docker service SERVICE into a local service provided by the given IP.
The keywords "host", "host-gateway" or "localhost" can be used instead of an
IP to use a service running on the Docker host itself: Docker will then resolve
the service name to the host IP (on its "docker0" bridge) in the other
containers. Loopback IPs (127.x.x.x, ::1) are treated the same way since they
would otherwise designate each container itself.
Note: the host service must listen on that interface (and not only on
127.0.0.1).
=head3 togenoring
=head4 Syntax
perl genoring.pl togenoring <SERVICE> [ALTERNATIVE]
=head4 Description
Puts back the given Docker service that was replaced by a local service. If
ALTERNATIVE is specified, the given service alternative will be used.
=head3 attach
=head4 Syntax
perl genoring.pl attach <DIRECTORY>
=head4 Description
Serves another GenoRing instance (managed instance) through the proxy of current
(master) instance. DIRECTORY is the managed instance directory. It must be an
initialized GenoRing instance directory (with a "volumes" sub-directory, a
"config.yml" file and an "env" directory): the managed instance must have been
started at least once. The managed instance project name (COMPOSE_PROJECT_NAME,
used by "detach"), host name (GENORING_HOST) and base path (GENORING_BASE_PATH,
see "-path" flag) are read from that directory:
=over 4
=item * without base path, the managed instance is served with its own virtual
host: its host name must differ from current instance one (ie.
"https://itc.example.org/");
=item * with a base path, the managed instance is served under that path of
current instance virtual host: its host name must be current instance one (ie.
"https://example.org/itc/"). SECURITY WARNING: the managed instance then shares
the web origin of current site (same cookies domain, no browser isolation): an
administrator, a module or a security issue of the managed instance may affect
current site and its users. Using such a configuration means this risk is
accepted. Other GenoRing modules (ie. Gigwa, JBrowse) are not adapted to base
paths yet.
=back
The directory also allows current instance to start, stop or get the status of
its managed instances (see "-managed" flag). The managed instance should be
started with the "-no-exposed-ports" flag and both instances must share a
Docker network (see "-network" flag). If the "ssl" module is enabled on current
instance, HTTPS is also configured for managed instances with their own virtual
host (a self-signed certificate is generated for their host if missing), while
managed instances served under a base path use current site HTTPS settings.
Running the command again updates the managed instance configuration (ie. after
changing its host name or base path).
Ex.:
# Managed instance with its own host (GENORING_HOST=itc.example.org):
cd /srv/genoring/instances/itc
COMPOSE_PROJECT_NAME=itc perl /opt/genoring/genoring.pl start -network genoring-hub -no-exposed-ports
# Managed instance under a base path (GENORING_HOST=example.org):
cd /srv/genoring/instances/abc
COMPOSE_PROJECT_NAME=abc perl /opt/genoring/genoring.pl start -network genoring-hub -no-exposed-ports -path=/abc
# On the master instance (GENORING_HOST=example.org):
perl genoring.pl start -network genoring-hub
perl genoring.pl attach /srv/genoring/instances/itc
perl genoring.pl attach /srv/genoring/instances/abc
=head3 detach
=head4 Syntax
perl genoring.pl detach <PROJECT>
=head4 Description
Stops serving the given managed instance through the proxy of current instance.
=head3 instances
=head4 Syntax
perl genoring.pl instances
=head4 Description
Lists the instances managed by current instance with their URL, state and
directory.
=head3 backup
=head4 Syntax
perl genoring.pl backup [BACKUP_NAME [MODULE[,MODULE...]]]
=head4 Description
Performs a general backup of the GenoRing system into a backup directory
(sysbackups/[BACKUP_NAME]/), or backs up the Docker volumes and environment
files of one or more modules into the same archive.
Note: the "sysbackups" directory is not accessible from containers, contrary to
the "volumes/backups" directory which is only used by containers for their own
internal backups (ie. CMS or database backups).
=head3 restore
=head4 Syntax
perl genoring.pl restore [BACKUP_NAME [MODULE[,MODULE...]]]
=head4 Description
Restores a general GenoRing backup from the backup directory
(sysbackups/[BACKUP_NAME]/), or restores the Docker volumes and environment
files of one or more modules from that archive.
=head3 clearcache
=head4 Syntax
perl genoring.pl clearcache
=head4 Description
Clears caches managed by enabled modules by running their local and container
clearcache hooks. Container hooks are run only in running services.
=head3 update
=head4 Syntax
perl genoring.pl update
=head4 Description
Updates GenoRing or a given GenoRing module. "Update" will update the software
and the data managed by GenoRing or the given module. "update" deals with what
is managed by the GenoRing module itself while "upgrade" deals with the version
of the GenoRing module: for instance, "updating" GenoRing core will update
Drupal modules while upgrading will change the version of GenoRing used which
may bring new features or a different behavior of the GenoRing platform.
=head3 upgrade
=head4 Syntax
perl genoring.pl upgrade
=head4 Description
Upgrade GenoRing or a given GenoRing module. "Upgrade" will upgrade
GenoRing core and its modules or the given GenoRing module to a newer version.
Upgrading will also update the software and the data. "update" deals with what
is managed by the GenoRing module itself while "upgrade" deals with the version
of the GenoRing module: for instance, "updating" GenoRing core will update
Drupal modules while upgrading will change the version of GenoRing used which
may bring new features or a different behavior of the GenoRing platform.
=head3 build
=head4 Syntax
perl genoring.pl build <MODULE> <SERVICE> [-arm[=ARCH]] [-no-cache]
=head4 Description
Builds the Docker container corresponding to the given module service if
sources are available. For ARM systems, you must use the "-arm" flag. It is also
possible to provide a specific ARM architecture (ARCH). If a source
"Dockerfile.arm" is provided, it will be used (regardless the specified ARCH
parameter) and if not, it will be generated (either using the ARCH architecture
or the default 'linux/arm64' architecture).
If "-no-cache" flag is set, Docker cache is not used to build image and a
complete (re)build is done instead.
=head3 shell
=head4 Syntax
perl genoring.pl shell [SERVICE] [-cmd=<COMMAND>] [-local]
=head4 Description
Launches a bash shell in the main GenoRing container (the CMS container). If
SERVICE is specified, the corresponding service container will be used instead.
If COMMAND is specified, that command will be used instead of "bash".
If the "-local" flag is used, the shell (or COMMAND) is run on the local host
with the GenoRing environment variables instead of a container.
=head3 diag
=head4 Syntax
perl genoring.pl diag
=head4 Description
Displays diagnostic information: Docker and Docker Compose versions, running
containers, Docker volumes, instance config file, Docker Compose file and
GenoRing setup logs.
=head3 localhooks
=head4 Syntax
perl genoring.pl localhooks <HOOK> [MODULE]
=head4 Description
Runs the given local hook (ie. "init", "update", "clearcache") of all enabled
modules implementing it, or only of the given MODULE. Development and debugging
command.
=head3 containerhooks
=head4 Syntax
perl genoring.pl containerhooks <HOOK> [MODULE]
=head4 Description
Runs the given container hook (ie. "enable", "update", "clearcache") in the
running containers of all enabled modules implementing it, or only of the given
MODULE. Development and debugging command.
=head3 exportvolume
=head4 Syntax
perl genoring.pl exportvolume <VOLUME> [ARCHIVE.tar.gz]
=head4 Description
Exports the given Docker named volume to a tar.gz file in the GenoRing "volumes"
directory. An optional archive name can be provided by ARCHIVE.tar.gz,
otherwise a new name is generated (using "[volume name]_[date].tar.gz").
=head3 importvolume
=head4 Syntax
perl genoring.pl importvolume <VOLUME> [ARCHIVE.tar.gz | DIRECTORY]
=head4 Description
Imports the given tar.gz archive file or directory into the given Docker named
volume.
=head3 version
=head4 Syntax
perl genoring.pl version [MODULE] [-all | -latest]
=head4 Description
Displays current GenorRing version. If MODULE is specified, displays the current
module version. If "-latest" flag is used, displays the most recent available
version. If "-all" flag is used, displays all avaiable versions.
=head2 GLOBAL FLAGS
=head3 -arm
=head4 Syntax
... -arm[=ARCH] ...
=head4 Description
Use ARM versions for Docker compilation when available or run on ARM
architectures. You may specify an architecture, for example: "-arm=linux/arm64".
Default architecture is "linux/arm64". Using this flag excludes the "-platform"
flag.
=head3 -skip-checks
=head4 Syntax
... -skip-checks ...
=head4 Description
Bypasses Docker version checks.
=head3 -debug
=head4 Syntax
... -debug ...
=head4 Description
Enables debug mode (displays debug information).
=head3 -exposed-volumes
=head4 Syntax
... -exposed-volumes ...
=head4 Description
Forces Docker to use exposed named (shared) volumes. Must be used at
installation time to be stored in config and used every time.
=head3 -exposed-ports
=head4 Syntax
... -exposed-ports ...
=head4 Description
Exposes service ports on the host again (default behavior) when they have been
disabled using "-no-exposed-ports". Only supported by "start" and "setup"
commands.
=head3 -quiet-build
=head4 Syntax
... -quiet-build ...
=head4 Description
Use this flag to hide missing container compilation details.
=head3 -local
=head4 Syntax
... -local ...
=head4 Description
Only used by the "shell" command: runs the shell (or the command given by
"-cmd") on the local host with the GenoRing environment variables instead of
running it in a container.
=head3 -man
=head4 Syntax
... -man ...
=head4 Description
Prints the manual page and exits, like the "man" command. The command is not
run.
=head3 -managed
=head4 Syntax
... -managed ...
=head4 Description
Also applies the command to all the instances managed by current (master)
instance (see "attach" command). Supported by "start", "online", "offline",
"backend", "stop" and "status" commands. Managed instances are started (or
their status displayed) after current instance and stopped before it. The
"-yes", "-no", "-verbose", "-debug", "-quiet-build", "-skip-checks" and
"-health-timeout" flags are passed to managed instance commands. A failure on a
managed instance does not prevent processing the other ones but the command
exits with an error.
Ex.:
perl genoring.pl start -managed
perl genoring.pl status -managed
perl genoring.pl stop -managed
=head3 -network
=head4 Syntax
... -network=<NETWORK_NAME>[:[SERVICE_LIST]] ...
=head4 Description
Adds some GenoRing services to the given additional Docker network (in addition
to the instance default network) or removes the network from the instance. This
flag is only supported by the "start" and "setup" commands. The network settings
are saved in the instance config ("config.yml") and used every time the Docker
Compose file is generated. Missing Docker networks are automatically created as
they are managed as external networks. Removed networks are not deleted from
Docker as they may still be used by other GenoRing instances.
=over 4
=item -network=<NETWORK_NAME>
Adds the services flagged with "network: auto" in their module definition
(currently "genoring-proxy" or its "genoring-proxy-httpd" alternative) to the
given network. Services of modules enabled later are also added if they are
flagged that way.
=item -network=<NETWORK_NAME>:<SERVICE_LIST>
Only adds the given comma-separated list of services to the given network (ex.:
"-network=genoring-hub:genoring-proxy,genoring").
=item -network=<NETWORK_NAME>:
Removes the given network from the instance config.
=back
This flag can be used multiple times on the same command line to manage several
networks. If GenoRing is already running, network changes will only be applied
once GenoRing is restarted.
=head3 -no
=head4 Syntax
... -no ...
=head4 Description
Automatically answers confirmations with 'no'. '-no' and '-yes' are mutually
exclusive flags.
The validation of environment settings ("setup") is not answered by this flag:
the user is asked (see "-default").
=head3 -no-backup
=head4 Syntax
... -no-backup ...
=head4 Description
Disables the use of automatic backups when performing site operations such as
modifying modules.
=head3 -no-exposed-ports
=head4 Syntax
... -no-exposed-ports ...
=head4 Description
Removes service ports exposed on the host (including the proxy HTTP and HTTPS
ports). The setting is saved in the instance config. The instance can then only
be reached through the proxy of a master GenoRing instance (see "attach"
command) and Drupal is configured to trust that reverse proxy. Only supported
by "start" and "setup" commands.
=head3 -no-exposed-volumes
=head4 Syntax
... -no-exposed-volumes ...
=head4 Description
Disables Docker exposed named (shared) volumes. Must be used at installation
time to be stored in config and used every time.
=head3 -path
=head4 Syntax
... -path=<BASE_PATH> ...
=head4 Description
Sets the base path under which current instance is served (ie. "/itc" for
"https://example.org/itc/") when it is managed by a master instance using the
same host name (see "attach" command). The value is saved in the instance
environment (GENORING_BASE_PATH) and an empty value ("-path=") serves the
instance at the root of its host. Only supported by "start" and "setup"
commands. The master instance must run "attach" again after a change.
SECURITY WARNING: an instance served under a base path of a master instance
shares the web origin of the master site and may introduce security issues on
the master site (see "attach" command).
=head3 -platform
=head4 Syntax
... -platform=<ARCH> ...
=head4 Description
Use the given architecture for Docker compilation and execution. This flag can
not be used in conjunction with the "-arm" flag.
=head3 -port
=head4 Syntax
... -port=<HTTP_PORT> ...
=head4 Description
Specifies the HTTP port to use. Default: 8080.
=head3 -verbose
=head4 Syntax
... -verbose ...
=head4 Description
Enables verbose mode (more text output with details).
=head3 -health-timeout
=head4 Syntax
... -health-timeout[=DELAYSEC] ...
=head4 Description
Maximum waiting time in seconds to wait for system to be ready. If the system is
not ready during this time, genoring.pl script will just stop and let know the
system might be still loading, which is ok. Default to 300 (seconds = 5minutes).
Some systems may require more than 5 minutes to be started, especially when
installing or enabling modules or during updates, so that delay may need to be
increased according to the machine running GenoRing. It can be set high but
sometimes, some docker services are never ready because of an error and the
given delay ensure GenoRing ends gracefully and gives back the hand to the admin
in such cases in reasonable time.
=head3 -yes
=head4 Syntax
... -yes ...
=head4 Description
Automatically answers confirmations with 'yes'. '-no' and '-yes' are mutually
exclusive flags.
Environment settings values ("setup") are still asked to the user; only their
final validation is automatically accepted (see "-default").
=cut
# Get configuration.
my $config = GetConfig();
print "GenoRing script $Genoring::GENORING_VERSION (project instance: " . GetProjectName() . ")\n\n";
# Options processing.
my ($man, $help) = (0, 0);
my @argv = @ARGV;
my $command = shift(@argv);
if (!$command || ($command =~ m/^-?-?help$|^[-\/]-?\?$/i)) {
$help = shift(@argv) || 1;
}
elsif ($command =~ m/^-?-?man$/i) {
$man = 1;
}
elsif ($command =~ m/^-?-?v(?:ersion)?$/i) {
$command = 'version';
}
my @arguments;
my $arg = shift(@argv);
while (defined($arg)) {
if ($arg =~ m/^--?([\w\-]+)(?:=(.*))?$/i) {
my $flag = $1;
# Check flag exists.
if ($flag !~ m/^(?:all|arm|skip-checks|cmd|debug|default|delete-containers|exposed-ports|exposed-volumes|f|help|quiet-build|latest|local|man|managed|minimal|network|no|no-backups?|no-cache|no-exposed-ports|no-exposed-volumes|path|platform|port|preserve-env|reset|verbose|health-timeout|yes)$/) {
warn "ERROR: Invalid flag '-$flag'.\n\n";
pod2usage('-verbose' => 0, '-exitval' => 1);
}
# "-network" can be used multiple times: keep previous values.
my @previous_networks = ('network' eq $flag) ? @{$g_flags->{'network'} || []} : ();
$g_flags->{$flag} = defined($2) ? $2 : 1;
# Check flags that require a value. Flags with an optional value ("-arm" and
# "-health-timeout") only support the "-flag=value" syntax.
if (!defined($2)
&& ($flag =~ m/^(?:cmd|path|platform|port|network)$/i)
) {
# If no value was provided using the "=" syntax, try to use next argument.
if (scalar(@argv) && ($argv[0] !~ m/^--?[a-z]/i)) {
$g_flags->{$flag} = shift(@argv);
}
else {
warn "ERROR: Invalid flag syntax for flag '-$flag'.\n\n";
pod2usage('-verbose' => 0, '-exitval' => 1);