@opencrvs/toolkit 2.1.0-rc.ff27df4 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -12
- package/build.sh +22 -4
- package/create-countryconfig/index.js +441 -59
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +362 -284
- package/dist/authentication/index.d.ts +66 -0
- package/dist/authentication/index.d.ts.map +1 -0
- package/dist/authentication/index.js +765 -0
- package/dist/cli.js +3751 -1232
- package/dist/commons/api/router.d.ts +940 -363
- package/dist/commons/application-config/index.d.ts +0 -2
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +34 -8
- package/dist/commons/events/ActionConfig.d.ts +5 -14
- package/dist/commons/events/ActionDocument.d.ts +35 -15
- package/dist/commons/events/ActionInput.d.ts +4 -4
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +48 -12
- package/dist/commons/events/AuditLog.d.ts +148 -0
- package/dist/commons/events/Draft.d.ts +1 -21
- package/dist/commons/events/EventConfig.d.ts +3 -0
- package/dist/commons/events/EventDocument.d.ts +472 -4
- package/dist/commons/events/EventIndex.d.ts +3 -26
- package/dist/commons/events/EventMetadata.d.ts +1 -11
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +109 -63
- package/dist/commons/events/FieldTypeMapping.d.ts +17 -17
- package/dist/commons/events/FieldValue.d.ts +3 -2
- package/dist/commons/events/Flag.d.ts +42 -0
- package/dist/commons/events/FormConfig.d.ts +6 -0
- package/dist/commons/events/PageConfig.d.ts +4 -0
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +17 -14
- package/dist/commons/events/event.d.ts +12 -0
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +169 -26
- package/dist/commons/events/mocks.test.utils.d.ts +30 -0
- package/dist/commons/events/scopes.d.ts +21 -1
- package/dist/commons/events/test.utils.d.ts +78 -25
- package/dist/commons/events/utils.d.ts +39 -4
- package/dist/commons/notification/UserNotifications.d.ts +28 -13
- package/dist/commons/notification/dispatch.d.ts +10 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +349 -65
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- package/dist/environment/index.d.ts +1 -0
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +12 -1
- package/dist/environment/logger.d.ts +15 -3
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/manage-users.js +1 -1
- package/dist/environment/paths.d.ts +7 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +72 -0
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +20 -14
- package/dist/environment/setup-environment.d.ts +1 -1
- package/dist/environment/setup-environment.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +594 -562
- package/dist/environment/swarm-to-k8s.js +3 -4
- package/dist/environment/templates.d.ts +0 -1
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +5 -9
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +21 -5
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +82 -0
- package/dist/environment/users.js +11 -13
- package/dist/environment/utils.d.ts +0 -12
- package/dist/environment/utils.d.ts.map +1 -1
- package/dist/environment/utils.js +1 -28
- package/dist/events/index.js +7689 -7063
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
- package/dist/migrations/v2.1/add-translations.d.ts +9 -0
- package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-translations.js +149 -0
- package/dist/migrations/{v2.0/rename-api-paths.d.ts → v2.1/enable-telemetry.d.ts} +1 -1
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
- package/dist/migrations/v2.1/enable-telemetry.js +455 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -1
- package/dist/migrations/v2.1/index.js +1952 -0
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +14 -0
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +1 -0
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +348 -0
- package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +2 -0
- package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +1 -0
- package/dist/migrations/v2.1/remove-metabase-package-installs.js +161 -0
- package/dist/migrations/{v2.0/migrate-scopes.d.ts → v2.1/remove-sentry.d.ts} +1 -1
- package/dist/migrations/v2.1/remove-sentry.d.ts.map +1 -0
- package/dist/migrations/v2.1/remove-sentry.js +354 -0
- package/dist/migrations/{v2.0/create-events-index.d.ts → v2.1/rename-trigger-paths.d.ts} +1 -1
- package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +1 -0
- package/dist/migrations/{v2.0/rename-api-paths.js → v2.1/rename-trigger-paths.js} +69 -40
- package/dist/migrations/v2.1/template-files.d.ts +8 -0
- package/dist/migrations/v2.1/template-files.d.ts.map +1 -0
- package/dist/migrations/v2.1/template-files.js +49 -0
- package/dist/migrations/v2.1/upgrade-tilt.d.ts +8 -0
- package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +1 -0
- package/dist/migrations/v2.1/upgrade-tilt.js +139 -0
- package/dist/notification/index.js +1887 -1438
- package/dist/scopes/index.d.ts +614 -36
- package/dist/scopes/index.js +351 -65
- package/dist/telemetry/index.d.ts +45 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +43 -0
- package/dist/templates/charts-values/dependencies/values.yaml +8 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +10 -3
- package/dist/templates/charts-values/opentelemetry/values.yaml +102 -0
- package/dist/templates/charts-values/traefik/values.yaml +23 -9
- package/dist/templates/countryconfig-template/.tiltignore +1 -0
- package/dist/templates/countryconfig-template/Dockerfile.assets +7 -0
- package/dist/templates/countryconfig-template/Tiltfile +112 -0
- package/dist/templates/countryconfig-template/assets/README.md +1 -0
- package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +61 -0
- package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +455 -0
- package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +168 -0
- package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +67 -0
- package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +168 -0
- package/dist/templates/countryconfig-template/assets/metabase/README.md +34 -0
- package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +36 -0
- package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +46 -0
- package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +27737 -0
- package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +21 -0
- package/dist/templates/countryconfig-template/assets/metabase/package.json +13 -0
- package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +108 -0
- package/dist/templates/countryconfig-template/assets/metabase/run.sh +120 -0
- package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +40 -0
- package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +135 -0
- package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +108 -0
- package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +50 -0
- package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +35 -0
- package/dist/templates/countryconfig-template/tilt/common.tilt +145 -0
- package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +15 -0
- package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +56 -0
- package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +21 -0
- package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +38 -0
- package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +17 -0
- package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +16 -0
- package/dist/templates/countryconfig-template/tilt/lib.tilt +95 -0
- package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +136 -0
- package/dist/templates/inventory/inventory.template.yml +1 -3
- package/dist/translations/template.d.ts +11 -0
- package/dist/translations/template.d.ts.map +1 -0
- package/dist/translations/template.js +100 -0
- package/dist/verify/endpoints.d.ts +2 -0
- package/dist/verify/endpoints.d.ts.map +1 -0
- package/dist/verify/endpoints.js +510 -0
- package/opencrvs-toolkit-2.1.0.tgz +0 -0
- package/package.json +13 -7
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +0 -3
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +0 -1
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +0 -429
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +0 -3
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +0 -1
- package/dist/migrations/v2.0/add-resend-invite-notification.js +0 -373
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +0 -22
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +0 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +0 -146
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +0 -2
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +0 -1
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +0 -838
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +0 -3
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +0 -1
- package/dist/migrations/v2.0/convert-paragraph-to-heading.js +0 -158
- package/dist/migrations/v2.0/create-events-index.d.ts.map +0 -1
- package/dist/migrations/v2.0/create-events-index.js +0 -325
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +0 -11
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +0 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +0 -123
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +0 -3
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +0 -1
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +0 -110
- package/dist/migrations/v2.0/index.d.ts +0 -13
- package/dist/migrations/v2.0/index.d.ts.map +0 -1
- package/dist/migrations/v2.0/index.js +0 -103
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +0 -3
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +0 -1
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +0 -432
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +0 -13
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +0 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +0 -222
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts +0 -3
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +0 -1
- package/dist/migrations/v2.0/migrate-application-config-url.js +0 -343
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +0 -1
- package/dist/migrations/v2.0/migrate-scopes.js +0 -305
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +0 -3
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +0 -1
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +0 -267
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +0 -3
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +0 -1
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +0 -317
- package/dist/migrations/v2.0/remove-delete-actions.d.ts +0 -3
- package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-delete-actions.js +0 -156
- package/dist/migrations/v2.0/remove-demo-scope.d.ts +0 -3
- package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-demo-scope.js +0 -74
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +0 -3
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-deprecated-imports.js +0 -96
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +0 -3
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-fhir-url-helpers.js +0 -163
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +0 -3
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-hearth-migrations.js +0 -87
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +0 -3
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-old-statistics-service.js +0 -356
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +0 -3
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-pending-certification-flag.js +0 -109
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +0 -3
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-review-from-register-action.js +0 -163
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +0 -3
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +0 -1
- package/dist/migrations/v2.0/remove-unused-environment-variables.js +0 -186
- package/dist/migrations/v2.0/rename-api-paths.d.ts.map +0 -1
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts +0 -3
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +0 -1
- package/dist/migrations/v2.0/rename-location-parent-id.js +0 -180
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +0 -3
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +0 -1
- package/dist/migrations/v2.0/simplify-analytics-precalculations.js +0 -195
- package/dist/migrations/v2.0/update-package-json.d.ts +0 -3
- package/dist/migrations/v2.0/update-package-json.d.ts.map +0 -1
- package/dist/migrations/v2.0/update-package-json.js +0 -105
- package/dist/templates/inventory/production.example.yml +0 -77
- package/dist/templates/inventory/qa.example.yml +0 -48
- package/opencrvs-toolkit-2.1.0-rc.ff27df4.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
#
|
|
5
|
+
# OpenCRVS is also distributed under the terms of the Civil Registration
|
|
6
|
+
# & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
9
|
+
|
|
10
|
+
############################################################
|
|
11
|
+
# What common Tiltfile does?:
|
|
12
|
+
# - Traefik deployment
|
|
13
|
+
# - Group resources by label on UI: http://localhost:10350/
|
|
14
|
+
|
|
15
|
+
########################################################
|
|
16
|
+
# Load extensions for namespace and helm operations
|
|
17
|
+
load('ext://namespace', 'namespace_create', 'namespace_inject')
|
|
18
|
+
load('ext://helm_resource', 'helm_resource', 'helm_repo')
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
secret_settings(disable_scrub=True)
|
|
22
|
+
########################################################
|
|
23
|
+
# Traefik Deployment
|
|
24
|
+
print("🚀 Deploying traefik...")
|
|
25
|
+
namespace_create('traefik')
|
|
26
|
+
traefik_tilt_label = '5.Traefik'
|
|
27
|
+
|
|
28
|
+
# Which local Kubernetes you're running Tilt against:
|
|
29
|
+
# "orbstack" (default) - OrbStack/Docker Desktop expose LoadBalancer
|
|
30
|
+
# services on localhost automatically.
|
|
31
|
+
# "minikube" - minikube doesn't expose LoadBalancer/NodePort
|
|
32
|
+
# services to the host on its own (EXTERNAL-IP stays
|
|
33
|
+
# <pending> without a separate `minikube tunnel` /
|
|
34
|
+
# `minikube service` process), so we deploy Traefik
|
|
35
|
+
# with a NodePort values file instead
|
|
36
|
+
|
|
37
|
+
current_k8s_context = k8s_context()
|
|
38
|
+
detected_local_k8s = "minikube" if "minikube" in current_k8s_context else "orbstack"
|
|
39
|
+
local_k8s = os.getenv("LOCAL_K8S", detected_local_k8s)
|
|
40
|
+
print("☸️ Kubernetes context: {} (local_k8s={})".format(current_k8s_context, local_k8s))
|
|
41
|
+
|
|
42
|
+
# values-minikube.yaml only contains what differs from values.yaml (NodePort
|
|
43
|
+
# instead of LoadBalancer, a pinned port). Helm merges multiple --values files
|
|
44
|
+
# in order, so on minikube we layer both instead of duplicating the file.
|
|
45
|
+
traefik_values_files = ["values.yaml"]
|
|
46
|
+
if local_k8s == "minikube":
|
|
47
|
+
traefik_values_files.append("values-minikube.yaml")
|
|
48
|
+
|
|
49
|
+
override_values_file = os.getenv("TRAEFIK_VALUES_FILE", "")
|
|
50
|
+
if override_values_file:
|
|
51
|
+
traefik_values_files = [override_values_file]
|
|
52
|
+
|
|
53
|
+
print("🔀 Using traefik values file(s): {}".format(", ".join(traefik_values_files)))
|
|
54
|
+
|
|
55
|
+
# Install Traefik GW
|
|
56
|
+
helm_repo('traefik-repo', 'https://traefik.github.io/charts', labels=[traefik_tilt_label])
|
|
57
|
+
helm_resource(
|
|
58
|
+
'traefik',
|
|
59
|
+
'traefik-repo/traefik',
|
|
60
|
+
namespace='traefik',
|
|
61
|
+
resource_deps=['traefik-repo'],
|
|
62
|
+
flags=[
|
|
63
|
+
'--version=39.0.0',
|
|
64
|
+
'--create-namespace',
|
|
65
|
+
] + ['--values=./examples/traefik/{}'.format(f) for f in traefik_values_files],
|
|
66
|
+
)
|
|
67
|
+
# OpenCRVS application has traefik CRDs IngressRoute
|
|
68
|
+
# and Middleware, so we need to add traefik as dependency
|
|
69
|
+
# to all workloads that use them
|
|
70
|
+
traefik_deps = [
|
|
71
|
+
'client',
|
|
72
|
+
'countryconfig',
|
|
73
|
+
'gateway',
|
|
74
|
+
'login',
|
|
75
|
+
'minio'
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
k8s_resource("traefik", labels=[traefik_tilt_label])
|
|
79
|
+
|
|
80
|
+
# Add labels to traefik resources
|
|
81
|
+
traefik_ingress_objects = ["{}-route:ingressroute".format(dep) for dep in traefik_deps] + ['internal-routes:ingressroute']
|
|
82
|
+
traefik_middleware_objects = ["sts-and-basic-response-headers:middleware", "enable-compression:middleware", "block-internal-routes:middleware"]
|
|
83
|
+
k8s_resource(
|
|
84
|
+
objects=traefik_ingress_objects,
|
|
85
|
+
new_name='traefik-ingress-routes',
|
|
86
|
+
resource_deps=['traefik'],
|
|
87
|
+
labels=[traefik_tilt_label]
|
|
88
|
+
)
|
|
89
|
+
k8s_resource(
|
|
90
|
+
objects=traefik_middleware_objects,
|
|
91
|
+
new_name='traefik-middleware',
|
|
92
|
+
resource_deps=['traefik'],
|
|
93
|
+
labels=[traefik_tilt_label]
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
######################################################
|
|
97
|
+
# Add labels to resources to OpenCRVS services
|
|
98
|
+
tilt_label = '4.Dependencies'
|
|
99
|
+
dependencies = [
|
|
100
|
+
'elasticsearch',
|
|
101
|
+
'minio',
|
|
102
|
+
'redis',
|
|
103
|
+
'postgres',
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
for workload in dependencies:
|
|
107
|
+
k8s_resource(workload, labels=[tilt_label])
|
|
108
|
+
|
|
109
|
+
######################################################
|
|
110
|
+
# Add labels to resources to OpenCRVS services
|
|
111
|
+
tilt_label = '1.OpenCRVS'
|
|
112
|
+
|
|
113
|
+
opensrvs_predeploy_jobs = [
|
|
114
|
+
'postgres-on-deploy',
|
|
115
|
+
'data-migration',
|
|
116
|
+
'data-migration-analytics'
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
opensrvs_services = [
|
|
120
|
+
'auth',
|
|
121
|
+
'client',
|
|
122
|
+
'countryconfig',
|
|
123
|
+
'documents',
|
|
124
|
+
'events',
|
|
125
|
+
'gateway',
|
|
126
|
+
'login',
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
opensrvs_postdeploy_jobs = [
|
|
130
|
+
'elasticsearch-reindex',
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
job_label = '3.Jobs'
|
|
134
|
+
previous_jobs = []
|
|
135
|
+
for job in opensrvs_predeploy_jobs:
|
|
136
|
+
if previous_jobs:
|
|
137
|
+
k8s_resource(job, labels=[job_label], resource_deps=dependencies + previous_jobs)
|
|
138
|
+
else:
|
|
139
|
+
k8s_resource(job, labels=[job_label], resource_deps=dependencies + previous_jobs)
|
|
140
|
+
previous_jobs.append(job)
|
|
141
|
+
|
|
142
|
+
for workload in opensrvs_services:
|
|
143
|
+
k8s_resource(workload, labels=[tilt_label], resource_deps=dependencies + opensrvs_predeploy_jobs)
|
|
144
|
+
for job in opensrvs_postdeploy_jobs:
|
|
145
|
+
k8s_resource(job, labels=[job_label], resource_deps=opensrvs_services)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
#
|
|
5
|
+
# OpenCRVS is also distributed under the terms of the Civil Registration
|
|
6
|
+
# & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
9
|
+
|
|
10
|
+
hostname: opencrvs.localhost
|
|
11
|
+
|
|
12
|
+
ingress:
|
|
13
|
+
ssl_enabled: false
|
|
14
|
+
|
|
15
|
+
storage_type: host_path
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
#
|
|
5
|
+
# OpenCRVS is also distributed under the terms of the Civil Registration
|
|
6
|
+
# & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
9
|
+
|
|
10
|
+
ingress:
|
|
11
|
+
ssl_enabled: false
|
|
12
|
+
|
|
13
|
+
env:
|
|
14
|
+
OPENCRVS_ENVIRONMENT: development
|
|
15
|
+
|
|
16
|
+
credentials:
|
|
17
|
+
super_user_password: password
|
|
18
|
+
|
|
19
|
+
# OpenCRVS core image tag:
|
|
20
|
+
platform:
|
|
21
|
+
tag: v2.0.0
|
|
22
|
+
|
|
23
|
+
countryconfig:
|
|
24
|
+
image:
|
|
25
|
+
tag: v2.0.0
|
|
26
|
+
|
|
27
|
+
# Horizontal Pod Autoscaler (HPA) configuration:
|
|
28
|
+
# Disabled by default for local environment.
|
|
29
|
+
hpa:
|
|
30
|
+
enabled: false
|
|
31
|
+
|
|
32
|
+
# Pod Disruption Budget (PDB) configuration:
|
|
33
|
+
# Disabled by default for local environment.
|
|
34
|
+
pdb:
|
|
35
|
+
enabled: false
|
|
36
|
+
|
|
37
|
+
# Dashboards is disabled by default to allow easy deployment on Apple Silicon
|
|
38
|
+
# If you are using x86 device, feel free to enable:
|
|
39
|
+
dashboards:
|
|
40
|
+
enabled: false
|
|
41
|
+
|
|
42
|
+
# Expose services on Node port
|
|
43
|
+
service_type: NodePort
|
|
44
|
+
|
|
45
|
+
data_seed:
|
|
46
|
+
enabled: false
|
|
47
|
+
env:
|
|
48
|
+
ACTIVATE_USERS: true
|
|
49
|
+
|
|
50
|
+
auth:
|
|
51
|
+
env:
|
|
52
|
+
TWO_FA_ENABLED: false
|
|
53
|
+
|
|
54
|
+
events:
|
|
55
|
+
env:
|
|
56
|
+
TWO_FA_ENABLED: false
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
#
|
|
5
|
+
# OpenCRVS is also distributed under the terms of the Civil Registration
|
|
6
|
+
# & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
9
|
+
#
|
|
10
|
+
# Minikube-only overrides, layered on top of values.yaml (see tilt/common.tilt,
|
|
11
|
+
# which passes both --values files to helm when the active context is minikube).
|
|
12
|
+
#
|
|
13
|
+
# minikube doesn't expose LoadBalancer services to the host on its own, so we
|
|
14
|
+
# switch to NodePort here, pinned to what
|
|
15
|
+
# `minikube start --ports=80:30080` publishes onto the host.
|
|
16
|
+
service:
|
|
17
|
+
type: NodePort
|
|
18
|
+
|
|
19
|
+
ports:
|
|
20
|
+
web:
|
|
21
|
+
nodePort: 30080
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
#
|
|
5
|
+
# OpenCRVS is also distributed under the terms of the Civil Registration
|
|
6
|
+
# & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
9
|
+
|
|
10
|
+
# Overwriting https://github.com/traefik/traefik-helm-chart/blob/master/traefik/values.yaml
|
|
11
|
+
namespaceOverride: "traefik"
|
|
12
|
+
logs:
|
|
13
|
+
general:
|
|
14
|
+
level: "INFO"
|
|
15
|
+
format: "common"
|
|
16
|
+
access:
|
|
17
|
+
enabled: true
|
|
18
|
+
ingressRoute:
|
|
19
|
+
dashboard:
|
|
20
|
+
enabled: false
|
|
21
|
+
|
|
22
|
+
tlsStore: {}
|
|
23
|
+
|
|
24
|
+
providers:
|
|
25
|
+
kubernetesCRD:
|
|
26
|
+
enabled: true
|
|
27
|
+
kubernetesIngress:
|
|
28
|
+
enabled: true
|
|
29
|
+
kubernetesGateway:
|
|
30
|
+
enabled: false
|
|
31
|
+
service:
|
|
32
|
+
enabled: true
|
|
33
|
+
single: false
|
|
34
|
+
|
|
35
|
+
ports:
|
|
36
|
+
web:
|
|
37
|
+
port: 8000
|
|
38
|
+
protocol: TCP
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
#
|
|
5
|
+
# OpenCRVS is also distributed under the terms of the Civil Registration
|
|
6
|
+
# & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
9
|
+
|
|
10
|
+
##################################################################################
|
|
11
|
+
# Use this file to customize helm chart behavior
|
|
12
|
+
# Please make sure your custom changes doesn't conflict with values.yaml
|
|
13
|
+
##################################################################################
|
|
14
|
+
|
|
15
|
+
# Country specific overrides for the dependencies chart in local Tilt development.
|
|
16
|
+
# Applied on top of tilt/examples/dependencies/values.yaml and never overwritten by
|
|
17
|
+
# 'opencrvs upgrade'.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
#
|
|
5
|
+
# OpenCRVS is also distributed under the terms of the Civil Registration
|
|
6
|
+
# & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
9
|
+
|
|
10
|
+
##################################################################################
|
|
11
|
+
# Use this file to customize helm chart behavior
|
|
12
|
+
# Please make sure your custom changes doesn't conflict with values.yaml
|
|
13
|
+
##################################################################################
|
|
14
|
+
# Country specific overrides for the opencrvs-services chart in local Tilt development.
|
|
15
|
+
# Applied on top of tilt/examples/opencrvs-services/values.yaml and never overwritten by
|
|
16
|
+
# 'opencrvs upgrade'.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
#
|
|
5
|
+
# OpenCRVS is also distributed under the terms of the Civil Registration
|
|
6
|
+
# & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def copy_secrets(dependencies_namespace, opencrvs_namespace):
|
|
12
|
+
|
|
13
|
+
secrets_to_copy = [
|
|
14
|
+
"elasticsearch-admin-user",
|
|
15
|
+
"redis-opencrvs-users",
|
|
16
|
+
"minio-opencrvs-users",
|
|
17
|
+
"mongodb-admin-user",
|
|
18
|
+
"postgres-admin-user",
|
|
19
|
+
]
|
|
20
|
+
k8s_resource(
|
|
21
|
+
new_name="deps-secrets",
|
|
22
|
+
objects=["{}:secret".format(secret) for secret in secrets_to_copy],
|
|
23
|
+
labels=['3.Dependencies']
|
|
24
|
+
)
|
|
25
|
+
local_resource(
|
|
26
|
+
"copy-secrets",
|
|
27
|
+
cmd="""kubectl get secret {2} -n {0} -o yaml \
|
|
28
|
+
| sed "s#namespace: {0}#namespace: {1}#" | grep -v 'resourceVersion\\|uid\\|creationTimestamp' \
|
|
29
|
+
| kubectl apply -n {1} -f -""".format(dependencies_namespace, opencrvs_namespace, " ".join(secrets_to_copy)),
|
|
30
|
+
resource_deps=["deps-secrets"],
|
|
31
|
+
labels=['2.Data-tasks'])
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def data_cleanup(
|
|
35
|
+
opencrvs_namespace,
|
|
36
|
+
opencrvs_configuration_file,
|
|
37
|
+
core_images_tag,
|
|
38
|
+
countryconfig_image_name,
|
|
39
|
+
countryconfig_image_tag,
|
|
40
|
+
opencrvs_tools_chart_path
|
|
41
|
+
):
|
|
42
|
+
job_yaml = local("""
|
|
43
|
+
helm template {opencrvs_tools_chart_path} \
|
|
44
|
+
--namespace {opencrvs_namespace} \
|
|
45
|
+
-f {opencrvs_configuration_file} \
|
|
46
|
+
--set platform.tag={core_images_tag} \
|
|
47
|
+
--set data_cleanup.enabled=true \
|
|
48
|
+
--set countryconfig.image.name={countryconfig_image_name} \
|
|
49
|
+
--set countryconfig.image.tag={countryconfig_image_tag} \
|
|
50
|
+
--show-only templates/data-cleanup-job.yaml
|
|
51
|
+
""".format(
|
|
52
|
+
opencrvs_namespace=opencrvs_namespace,
|
|
53
|
+
opencrvs_configuration_file=opencrvs_configuration_file,
|
|
54
|
+
core_images_tag=core_images_tag,
|
|
55
|
+
countryconfig_image_name=countryconfig_image_name,
|
|
56
|
+
countryconfig_image_tag=countryconfig_image_tag,
|
|
57
|
+
opencrvs_tools_chart_path=opencrvs_tools_chart_path
|
|
58
|
+
),
|
|
59
|
+
quiet=True
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
k8s_yaml(job_yaml)
|
|
63
|
+
k8s_resource(
|
|
64
|
+
'data-cleanup',
|
|
65
|
+
labels=['2.Data-tasks'],
|
|
66
|
+
auto_init=False
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
def seed_data(
|
|
70
|
+
opencrvs_namespace,
|
|
71
|
+
opencrvs_configuration_file,
|
|
72
|
+
core_images_tag,
|
|
73
|
+
countryconfig_image_name,
|
|
74
|
+
countryconfig_image_tag,
|
|
75
|
+
opencrvs_tools_chart_path
|
|
76
|
+
):
|
|
77
|
+
job_yaml = local("""
|
|
78
|
+
helm template -f {opencrvs_configuration_file} \
|
|
79
|
+
--set platform.tag={core_images_tag} \
|
|
80
|
+
--set data_seed.enabled=true -s templates/data-seed-job.yaml --namespace {opencrvs_namespace} {opencrvs_tools_chart_path}
|
|
81
|
+
""".format(
|
|
82
|
+
opencrvs_namespace=opencrvs_namespace,
|
|
83
|
+
opencrvs_configuration_file=opencrvs_configuration_file,
|
|
84
|
+
core_images_tag=core_images_tag,
|
|
85
|
+
opencrvs_tools_chart_path=opencrvs_tools_chart_path
|
|
86
|
+
),
|
|
87
|
+
quiet=True
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
k8s_yaml(job_yaml)
|
|
91
|
+
k8s_resource(
|
|
92
|
+
'data-seed',
|
|
93
|
+
labels=['2.Data-tasks'],
|
|
94
|
+
auto_init=False
|
|
95
|
+
)
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
#
|
|
5
|
+
# OpenCRVS is also distributed under the terms of the Civil Registration
|
|
6
|
+
# & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
7
|
+
#
|
|
8
|
+
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# Shared OpenCRVS Tilt configuration
|
|
12
|
+
# Load extensions
|
|
13
|
+
load('ext://namespace', 'namespace_create', 'namespace_inject')
|
|
14
|
+
load("./lib.tilt",
|
|
15
|
+
"copy_secrets", "data_cleanup", "seed_data")
|
|
16
|
+
include('./common.tilt')
|
|
17
|
+
|
|
18
|
+
def setup_opencrvs(
|
|
19
|
+
core_images_tag,
|
|
20
|
+
countryconfig_image_tag,
|
|
21
|
+
countryconfig_image_name="opencrvs/ocrvs-countryconfig",
|
|
22
|
+
dependencies_namespace='opencrvs-deps-dev',
|
|
23
|
+
opencrvs_namespace='opencrvs-dev',
|
|
24
|
+
security_enabled=False,
|
|
25
|
+
monitoring_enabled=False,
|
|
26
|
+
opencrvs_chart_repo='.'
|
|
27
|
+
):
|
|
28
|
+
"""
|
|
29
|
+
Common OpenCRVS setup function
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
core_images_tag: OpenCRVS core images tag to use for deployment
|
|
33
|
+
countryconfig_image_name: Countryconfig image repository (e.g. your DockerHub repository or Farajaland demo repository)
|
|
34
|
+
countryconfig_image_tag: Countryconfig image tag to use for deployment
|
|
35
|
+
dependencies_namespace: Kubernetes namespace for dependencies (e.g. MongoDB, MinIO, Elasticsearch)
|
|
36
|
+
opencrvs_namespace: Kubernetes namespace for OpenCRVS services
|
|
37
|
+
security_enabled: If true, OpenCRVS and dependencies will be deployed in secure mode with authentication enabled. If false, OpenCRVS and dependencies will be deployed in non-secure mode with default passwords and no authentication.
|
|
38
|
+
monitoring_enabled: If true, monitoring components like Kibana will be deployed together with dependencies
|
|
39
|
+
opencrvs_chart_repo: Path to OpenCRVS charts directory (relative)
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
# Create namespaces
|
|
43
|
+
namespace_create(dependencies_namespace)
|
|
44
|
+
namespace_create(opencrvs_namespace)
|
|
45
|
+
|
|
46
|
+
# Select configuration files
|
|
47
|
+
if security_enabled:
|
|
48
|
+
print("🔑 Deploying OpenCRVS and Dependencies in secure mode")
|
|
49
|
+
deps_configuration_file = './tilt/examples/dependencies/values-secure.yaml'
|
|
50
|
+
opencrvs_configuration_file = './tilt/examples/opencrvs-services/values-secure.yaml'
|
|
51
|
+
else:
|
|
52
|
+
print("""🔑 Deploying OpenCRVS and Dependencies in non-secure mode
|
|
53
|
+
- Minio admin user/password: minioadmin/minioadmin
|
|
54
|
+
- Postgres admin user/password: postgres/postgres
|
|
55
|
+
- Authentication for Redis, MongoDB and Elasticsearch is disabled""")
|
|
56
|
+
deps_configuration_file = './tilt/examples/dependencies/values.yaml'
|
|
57
|
+
opencrvs_configuration_file = './tilt/examples/opencrvs-services/values.yaml'
|
|
58
|
+
|
|
59
|
+
# Country specific overrides, layered on top of the examples above.
|
|
60
|
+
# tilt/examples/ is replaced on every upgrade, tilt/helm/ is left alone.
|
|
61
|
+
deps_values = [deps_configuration_file]
|
|
62
|
+
if os.path.exists('./tilt/helm/dependencies/values.yaml'):
|
|
63
|
+
deps_values.append('./tilt/helm/dependencies/values.yaml')
|
|
64
|
+
opencrvs_values = [opencrvs_configuration_file]
|
|
65
|
+
if os.path.exists('./tilt/helm/opencrvs-services/values.yaml'):
|
|
66
|
+
opencrvs_values.append('./tilt/helm/opencrvs-services/values.yaml')
|
|
67
|
+
|
|
68
|
+
# Deploy dependencies
|
|
69
|
+
print("🚀 Deploying dependencies: mongo, minio, elasticsearch...")
|
|
70
|
+
dependencies_chart_path = '{}/charts/dependencies'.format(opencrvs_chart_repo)
|
|
71
|
+
k8s_yaml(helm(dependencies_chart_path,
|
|
72
|
+
namespace=dependencies_namespace,
|
|
73
|
+
values=deps_values,
|
|
74
|
+
set=["monitoring.enabled={}".format(monitoring_enabled).lower()]
|
|
75
|
+
))
|
|
76
|
+
opencrvs_chart_path = '{}/charts/opencrvs-services'.format(opencrvs_chart_repo)
|
|
77
|
+
certs_dir = '{opencrvs_chart_path}/certs'.format(opencrvs_chart_path=opencrvs_chart_path)
|
|
78
|
+
if not os.path.exists("{certs_dir}/tls.crt".format(certs_dir=certs_dir)):
|
|
79
|
+
local("""
|
|
80
|
+
mkdir -p {certs_dir}
|
|
81
|
+
openssl req -x509 -nodes -days 365 \
|
|
82
|
+
-newkey rsa:2048 \
|
|
83
|
+
-keyout {certs_dir}/tls.key \
|
|
84
|
+
-out {certs_dir}/tls.crt \
|
|
85
|
+
-subj "/CN=local.dev"
|
|
86
|
+
""".format(certs_dir=certs_dir))
|
|
87
|
+
|
|
88
|
+
# Deploy OpenCRVS services
|
|
89
|
+
print("🚀 Deploying services: auth, events, gateway...")
|
|
90
|
+
k8s_yaml(
|
|
91
|
+
helm(opencrvs_chart_path,
|
|
92
|
+
namespace=opencrvs_namespace,
|
|
93
|
+
values=opencrvs_values,
|
|
94
|
+
set=[
|
|
95
|
+
"platform.tag={}".format(core_images_tag),
|
|
96
|
+
"countryconfig.image.name={}".format(countryconfig_image_name),
|
|
97
|
+
"countryconfig.image.tag={}".format(countryconfig_image_tag),
|
|
98
|
+
"data_seed.enabled=false", # Disable data seeding on helm install for tilt
|
|
99
|
+
"certs.crt_file=certs/tls.crt",
|
|
100
|
+
"certs.key_file=certs/tls.key"
|
|
101
|
+
]
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
cleanup_cmd = "./scripts/cleanup.sh"
|
|
105
|
+
|
|
106
|
+
if os.name == "nt":
|
|
107
|
+
cleanup_cmd = "powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\\scripts\\cleanup.ps1"
|
|
108
|
+
|
|
109
|
+
local_resource(
|
|
110
|
+
name="clean-&-seed",
|
|
111
|
+
auto_init=False,
|
|
112
|
+
labels="2.Data-tasks",
|
|
113
|
+
cmd="./tilt/clear-all-data.sh",
|
|
114
|
+
allow_parallel=True,
|
|
115
|
+
)
|
|
116
|
+
# Add data tasks
|
|
117
|
+
data_cleanup(
|
|
118
|
+
opencrvs_namespace,
|
|
119
|
+
opencrvs_configuration_file,
|
|
120
|
+
core_images_tag,
|
|
121
|
+
countryconfig_image_name,
|
|
122
|
+
countryconfig_image_tag,
|
|
123
|
+
opencrvs_chart_path
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
seed_data(
|
|
127
|
+
opencrvs_namespace,
|
|
128
|
+
opencrvs_configuration_file,
|
|
129
|
+
core_images_tag,
|
|
130
|
+
countryconfig_image_name,
|
|
131
|
+
countryconfig_image_tag,
|
|
132
|
+
opencrvs_chart_path
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
if security_enabled:
|
|
136
|
+
copy_secrets(dependencies_namespace, opencrvs_namespace)
|
|
@@ -13,10 +13,8 @@ all:
|
|
|
13
13
|
# - If you are behind VPN, use private IP address
|
|
14
14
|
# - If your server is exposed (not recommeded), use public IP address
|
|
15
15
|
# - If you would like to run kubectl commands from the remote server, leave this field empty
|
|
16
|
-
#
|
|
17
|
-
|
|
16
|
+
# kube_api_host: ''
|
|
18
17
|
# IMPORTANT: If master VM has multiple ethernet interfaces, put private IP address at kube_api_host
|
|
19
|
-
# kube_api_host: 10.10.10.10
|
|
20
18
|
kube_api_host: {{kube_api_host}}
|
|
21
19
|
|
|
22
20
|
# Default ansible provision user, keep as is
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where to read the template from, most specific first: the newest release
|
|
3
|
+
* branch of the given version, then its newest tag, then `develop` for anyone
|
|
4
|
+
* running before the version has been cut.
|
|
5
|
+
*/
|
|
6
|
+
export declare function candidateRefs(version: string): Promise<string[]>;
|
|
7
|
+
export declare function fetchTemplate(refs: string[], application: string): Promise<{
|
|
8
|
+
ref: string;
|
|
9
|
+
contents: string;
|
|
10
|
+
} | undefined>;
|
|
11
|
+
//# sourceMappingURL=template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/translations/template.ts"],"names":[],"mappings":"AAgEA;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,qBAMlD;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM;;;eAoBtE"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
6
|
+
*
|
|
7
|
+
* OpenCRVS is also distributed under the terms of the Civil Registration
|
|
8
|
+
* & Healthcare Disclaimer located at http://opencrvs.org/license.
|
|
9
|
+
*
|
|
10
|
+
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
|
|
11
|
+
*/
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.candidateRefs = candidateRefs;
|
|
23
|
+
exports.fetchTemplate = fetchTemplate;
|
|
24
|
+
/**
|
|
25
|
+
* Reads the country config template's translation files off GitHub.
|
|
26
|
+
*
|
|
27
|
+
* The template is the record of the copy core requires: a pull request that
|
|
28
|
+
* introduces a translation key has to add it to
|
|
29
|
+
* `packages/countryconfig-template/src/translations/`, which the
|
|
30
|
+
* check-missing-translation workflow makes it do anyway. Two things read it —
|
|
31
|
+
* the `add-translations` codemod, which adds the new rows to a country config's
|
|
32
|
+
* own files, and `verify-endpoints`, which checks a running country config
|
|
33
|
+
* actually serves them — so the ref resolution lives here rather than in
|
|
34
|
+
* either.
|
|
35
|
+
*/
|
|
36
|
+
const REPOSITORY = 'opencrvs/opencrvs-core';
|
|
37
|
+
const TEMPLATE_TRANSLATIONS = 'packages/countryconfig-template/src/translations';
|
|
38
|
+
/**
|
|
39
|
+
* The refs matching a prefix, newest patch first.
|
|
40
|
+
*
|
|
41
|
+
* Every patch gets its own release branch — `release/2.1.0`, `release/2.1.1` —
|
|
42
|
+
* and a translation key added in a patch only exists on that patch's branch, so
|
|
43
|
+
* the newest one is the one worth reading.
|
|
44
|
+
*/
|
|
45
|
+
function matchingRefs(namespace, prefix) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const url = `https://api.github.com/repos/${REPOSITORY}/git/matching-refs/${namespace}/${prefix}`;
|
|
48
|
+
const response = yield fetch(url, {
|
|
49
|
+
headers: { accept: 'application/vnd.github+json' }
|
|
50
|
+
});
|
|
51
|
+
/*
|
|
52
|
+
* An empty list and a failed request are not the same thing: GitHub answers
|
|
53
|
+
* 200 with `[]` for a prefix nothing matches, so anything else is the request
|
|
54
|
+
* failing rather than the version having no release branch. Swallowing it
|
|
55
|
+
* would leave `develop` as the only candidate left, and an unauthenticated
|
|
56
|
+
* api.github.com allows 60 requests an hour per IP — a country upgrading from
|
|
57
|
+
* a shared network or a CI runner would quietly get unreleased copy.
|
|
58
|
+
*/
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
throw new Error(`GitHub answered ${response.status} ${response.statusText} for ${url}`);
|
|
61
|
+
}
|
|
62
|
+
const refs = (yield response.json());
|
|
63
|
+
const patchOf = (ref) => Number(ref.split('.').pop()) || 0;
|
|
64
|
+
return refs
|
|
65
|
+
.map(({ ref }) => ref.replace(/^refs\/(heads|tags)\//, ''))
|
|
66
|
+
.sort((a, b) => patchOf(b) - patchOf(a));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Where to read the template from, most specific first: the newest release
|
|
71
|
+
* branch of the given version, then its newest tag, then `develop` for anyone
|
|
72
|
+
* running before the version has been cut.
|
|
73
|
+
*/
|
|
74
|
+
function candidateRefs(version) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
return [
|
|
77
|
+
...(yield matchingRefs('heads', `release/${version}.`)),
|
|
78
|
+
...(yield matchingRefs('tags', `v${version}.`)),
|
|
79
|
+
'develop'
|
|
80
|
+
];
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function fetchTemplate(refs, application) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
for (const ref of refs) {
|
|
86
|
+
const url = `https://raw.githubusercontent.com/${REPOSITORY}/${ref}/${TEMPLATE_TRANSLATIONS}/${application}.csv`;
|
|
87
|
+
const response = yield fetch(url);
|
|
88
|
+
if (response.ok) {
|
|
89
|
+
return { ref, contents: yield response.text() };
|
|
90
|
+
}
|
|
91
|
+
// 404 means this ref does not carry the file and the next one is worth a
|
|
92
|
+
// try. Anything else is the request failing, and moving on would read the
|
|
93
|
+
// template from a ref older than the one that was asked for.
|
|
94
|
+
if (response.status !== 404) {
|
|
95
|
+
throw new Error(`GitHub answered ${response.status} ${response.statusText} for ${url}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
});
|
|
100
|
+
}
|