|
1 | | -############################################################ |
2 | | -# Please check readme at: https://github.com/opencrvs/infrastructure/tree/develop |
3 | | -############################################################ |
4 | | - |
5 | | -############################################################ |
6 | | -# Variables declaration: |
7 | | -############################################################ |
8 | | -# Core images tag: usually "develop" or one of release name: |
9 | | -# - v1.7.0 |
10 | | -# - v1.7.1 |
11 | | -# NOTE: It could take any value from https://github.com/orgs/opencrvs/packages |
12 | | -# If you are under opencrvs-core repository, please use "local" tag |
13 | | -# Tilt will build new image every time when changes are made to repository |
14 | | -core_images_tag="local" |
| 1 | +########################################################################## |
| 2 | +# Tiltfile: OpenCRVS Core developer |
| 3 | +# For more information about variables, please check: |
| 4 | +# https://github.com/opencrvs/infrastructure/blob/develop/Tiltfile |
15 | 5 |
|
16 | | -# Countryconfig/Farajaland image repository and tag |
17 | | -# Usually image repository value is to your repository on DockerHub |
18 | | -# If for some reason you don't have DockerHub account yet, please create |
19 | | -# you local registry |
20 | | -# (see: https://medium.com/@ankitkumargupta/quick-start-local-docker-registry-35107038242e) |
| 6 | +core_images_tag = "local" |
21 | 7 | countryconfig_image_name="opencrvs/ocrvs-countryconfig" |
22 | | -# If you are under opencrvs-countryconfig or your own repository, please use "local" tag, |
23 | | -# Tilt will build new image every time when changes are made to repository |
24 | 8 | countryconfig_image_tag="develop" |
25 | 9 |
|
26 | | -# Namespaces: |
27 | | -opencrvs_namespace = 'opencrvs-dev' |
28 | | -dependencies_namespace = 'opencrvs-deps-dev' |
29 | | - |
30 | | -# Security enabled: |
31 | | -# Configure security for dependencies and OpenCRVS services: |
32 | | -# - Setup MinIO admin user and password |
33 | | -# - Configure Redis users |
34 | | -# - Sync passwords between dependencies and OpenCRVS services |
35 | | -security_enabled = True |
36 | | - |
37 | | -# Checkout infrastructure directory if not exists |
| 10 | +load('ext://git_resource', 'git_checkout') |
38 | 11 | if not os.path.exists('../infrastructure'): |
39 | | - local( "git clone [email protected]:opencrvs/infrastructure.git ../infrastructure") |
40 | | - |
41 | | -# Load extensions for namespace and helm operations |
42 | | -load('ext://helm_resource', 'helm_resource', 'helm_repo') |
43 | | -load('ext://namespace', 'namespace_create', 'namespace_inject') |
44 | | -load("../infrastructure/tilt/lib.tilt", "copy_secrets", "reset_environment", "seed_data") |
45 | | - |
46 | | -include('../infrastructure/tilt/common.tilt') |
47 | | - |
48 | | -# If your machine is powerful feel free to change parallel updates from default 3 |
49 | | -update_settings(max_parallel_updates=1) |
| 12 | + # FIXME: Replace ocrvs-10672 to develop after testing |
| 13 | + git_checkout( '[email protected]:opencrvs/infrastructure.git#ocrvs-10672', '../infrastructure') |
| 14 | +if not os.path.exists('../infrastructure/tilt/opencrvs.tilt'): |
| 15 | + fail('Something went wrong while cloning infrastructure repository!') |
| 16 | +load('../infrastructure/tilt/opencrvs.tilt', 'setup_opencrvs') |
50 | 17 |
|
51 | 18 | ############################################################ |
52 | 19 | # Build images: |
@@ -103,50 +70,12 @@ def build_services(): |
103 | 70 |
|
104 | 71 | build_services() |
105 | 72 |
|
106 | | -############################################################ |
107 | | -# Deploy workloads: |
108 | | -############################################################ |
109 | | - |
110 | | -# Create namespaces: |
111 | | -# - opencrvs-deps-dev, dependencies namespace |
112 | | -# - opencrvs-dev, main namespace |
113 | | -namespace_create(dependencies_namespace) |
114 | | -namespace_create(opencrvs_namespace) |
115 | 73 |
|
116 | | -###################################################### |
117 | | -# OpenCRVS Dependencies Deployment |
118 | | -# NOTE: This helm chart can be deployed as helm release |
119 | | -if security_enabled: |
120 | | - deps_configuration_file = '../infrastructure/examples/localhost/dependencies/values-dev-secure.yaml' |
121 | | - opencrvs_configuration_file = '../infrastructure/examples/localhost/opencrvs-services/values-dev-secure.yaml' |
122 | | -else: |
123 | | - deps_configuration_file = '../infrastructure/examples/localhost/dependencies/values-dev.yaml' |
124 | | - opencrvs_configuration_file = '../infrastructure/examples/localhost/opencrvs-services/values-dev.yaml' |
125 | | -k8s_yaml(helm('../infrastructure/charts/dependencies', |
126 | | - namespace=dependencies_namespace, |
127 | | - values=[deps_configuration_file])) |
128 | | - |
129 | | -###################################################### |
130 | | -# OpenCRVS Deployment |
131 | | -k8s_yaml( |
132 | | - helm('../infrastructure/charts/opencrvs-services', |
133 | | - namespace=opencrvs_namespace, |
134 | | - values=[opencrvs_configuration_file], |
135 | | - set=[ |
136 | | - "image.tag={}".format(core_images_tag), |
137 | | - "countryconfig.image.name={}".format(countryconfig_image_name), |
138 | | - "countryconfig.image.tag={}".format(countryconfig_image_tag) |
139 | | - ] |
140 | | - ) |
| 74 | +setup_opencrvs( |
| 75 | + infrastructure_path='../infrastructure', |
| 76 | + core_images_tag=core_images_tag, |
| 77 | + countryconfig_image_name=countryconfig_image_name, |
| 78 | + countryconfig_image_tag=countryconfig_image_tag, |
141 | 79 | ) |
142 | 80 |
|
143 | | -####################################################### |
144 | | -# Add Data Tasks to Tilt Dashboard |
145 | | -reset_environment(opencrvs_namespace, opencrvs_configuration_file) |
146 | | - |
147 | | -seed_data(opencrvs_namespace, opencrvs_configuration_file) |
148 | | - |
149 | | -if security_enabled: |
150 | | - copy_secrets(dependencies_namespace, opencrvs_namespace) |
151 | | - |
152 | 81 | print("✅ Tiltfile configuration loaded successfully.") |
0 commit comments