-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathstand_it_up.py
75 lines (58 loc) · 2.79 KB
/
stand_it_up.py
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
# grown-up modules
import compose.cli.command
import docker
import logging
import os
# local modules
from irods_testing_environment import context
from irods_testing_environment import services
from irods_testing_environment import ssl_setup
if __name__ == "__main__":
import argparse
import textwrap
import cli
from irods_testing_environment import logs
parser = argparse.ArgumentParser(description='Stand up an iRODS zone.')
cli.add_common_args(parser)
cli.add_compose_args(parser)
cli.add_database_config_args(parser)
cli.add_irods_package_args(parser)
parser.add_argument('--consumer-instance-count',
metavar='IRODS_CATALOG_SERVICE_CONSUMER_INSTANCE_COUNT',
dest='consumer_count', type=int, default=0,
help=textwrap.dedent('''\
Number of iRODS Catalog Service Consumer service instances.'''))
parser.add_argument('--use-ssl',
dest='use_ssl', action='store_true',
help=textwrap.dedent('''\
Indicates that SSL should be configured and enabled in the Zone.\
'''))
args = parser.parse_args()
if not args.package_version and not args.install_packages:
print('--irods-package-version is required when using --use-static-image')
exit(1)
if args.package_directory and args.package_version:
print('--irods-package-directory and --irods-package-version are incompatible')
exit(1)
project_directory = os.path.abspath(args.project_directory or os.getcwd())
if not args.install_packages:
os.environ['dockerfile'] = 'release.Dockerfile'
if args.package_version:
os.environ['irods_package_version'] = args.package_version
ctx = context.context(docker.from_env(use_ssh_client=True),
compose.cli.command.get_project(
project_dir=project_directory,
project_name=args.project_name))
logs.configure(args.verbosity)
logging.debug(f'environment variables:[{os.environ}]')
# Bring up the services
logging.debug('bringing up project [{}]'.format(ctx.compose_project.name))
services.create_topology(ctx,
externals_directory=args.irods_externals_package_directory,
package_directory=args.package_directory,
package_version=args.package_version,
odbc_driver=args.odbc_driver,
consumer_count=args.consumer_count,
install_packages=args.install_packages)
if args.use_ssl:
ssl_setup.configure_ssl_in_zone(ctx.docker_client, ctx.compose_project)