-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathopencrvs.tilt
More file actions
93 lines (84 loc) · 3.42 KB
/
opencrvs.tilt
File metadata and controls
93 lines (84 loc) · 3.42 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
# Shared OpenCRVS Tilt configuration
# Load extensions
infrastructure_path = '.'
load('ext://namespace', 'namespace_create', 'namespace_inject')
load("./lib.tilt",
"copy_secrets", "reset_environment", "seed_data", "reindex_environment")
include('./common.tilt')
def setup_opencrvs(
core_images_tag,
countryconfig_image_tag,
countryconfig_image_name="opencrvs/ocrvs-countryconfig",
dependencies_namespace='opencrvs-deps-dev',
opencrvs_namespace='opencrvs-dev',
security_enabled=False,
monitoring_enabled=False,
infrastructure_path='.',
):
"""
Common OpenCRVS setup function
Args:
infrastructure_path: Path to infrastructure directory (relative)
"""
# Create namespaces
namespace_create(dependencies_namespace)
namespace_create(opencrvs_namespace)
# Select configuration files
if security_enabled:
print("🔑 Deploying OpenCRVS and Dependencies in secure mode")
deps_configuration_file = '{}/examples/localhost/dependencies/values-secure.yaml'.format(infrastructure_path)
opencrvs_configuration_file = '{}/examples/localhost/opencrvs-services/values-secure.yaml'.format(infrastructure_path)
else:
print("""🔑 Deploying OpenCRVS and Dependencies in non-secure mode
- Minio admin user/password: minioadmin/minioadmin
- Postgres admin user/password: postgres/postgres
- Authentication for Redis, MongoDB and Elasticsearch is disabled""")
deps_configuration_file = '{}/examples/localhost/dependencies/values.yaml'.format(infrastructure_path)
opencrvs_configuration_file = '{}/examples/localhost/opencrvs-services/values.yaml'.format(infrastructure_path)
# Deploy dependencies
print("🚀 Deploying dependencies: mongo, minio, elasticsearch...")
dependencies_chart_path = '../charts/charts/dependencies'.format(infrastructure_path)
k8s_yaml(helm(dependencies_chart_path,
namespace=dependencies_namespace,
values=[deps_configuration_file],
set=["monitoring.enabled={}".format(monitoring_enabled).lower()]
))
# Deploy OpenCRVS services
print("🚀 Deploying services: auth, events, gateway...")
opencrvs_chart_path = '../charts/charts/opencrvs-services'.format(infrastructure_path)
k8s_yaml(
helm(opencrvs_chart_path,
namespace=opencrvs_namespace,
values=[opencrvs_configuration_file],
set=[
"image.tag={}".format(core_images_tag),
"countryconfig.image.name={}".format(countryconfig_image_name),
"countryconfig.image.tag={}".format(countryconfig_image_tag),
"data_seed.enabled={}".format(False) # Disable data seeding on helm install for tilt
]
)
)
# Add data tasks
reset_environment(
opencrvs_namespace,
opencrvs_configuration_file,
core_images_tag,
countryconfig_image_name,
countryconfig_image_tag
)
seed_data(
opencrvs_namespace,
opencrvs_configuration_file,
core_images_tag,
countryconfig_image_name,
countryconfig_image_tag
)
reindex_environment(
opencrvs_namespace,
opencrvs_configuration_file,
core_images_tag,
countryconfig_image_name,
countryconfig_image_tag
)
if security_enabled:
copy_secrets(dependencies_namespace, opencrvs_namespace)