@opencrvs/toolkit 2.1.0-rc.d1b9774 → 2.1.0-rc.d235243
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 +2 -12
- package/build.sh +15 -5
- package/create-countryconfig/index.js +164 -4
- package/dist/application-config/index.js +36 -25
- package/dist/authentication/index.d.ts +8 -9
- package/dist/authentication/index.js +23 -8
- package/dist/cli.js +1981 -2823
- package/dist/commons/api/router.d.ts +252 -290
- 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 +19 -4
- package/dist/commons/events/ActionConfig.d.ts +5 -14
- package/dist/commons/events/ActionDocument.d.ts +30 -4
- package/dist/commons/events/AdvancedSearchConfig.d.ts +24 -12
- package/dist/commons/events/AuditLog.d.ts +1 -0
- package/dist/commons/events/Draft.d.ts +1 -21
- package/dist/commons/events/EventDocument.d.ts +4 -4
- package/dist/commons/events/FieldConfig.d.ts +26 -15
- package/dist/commons/events/FieldTypeMapping.d.ts +10 -10
- package/dist/commons/events/FieldValue.d.ts +1 -0
- package/dist/commons/events/FormConfig.d.ts +6 -0
- package/dist/commons/events/PageConfig.d.ts +4 -0
- package/dist/commons/events/locations.d.ts +4 -0
- package/dist/commons/events/scopes.d.ts +21 -1
- package/dist/commons/events/test.utils.d.ts +71 -22
- package/dist/commons/events/utils.d.ts +37 -2
- package/dist/conditionals/index.js +21 -7
- package/dist/environment/derived-variables.d.ts +18 -0
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +21 -0
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +2 -1
- package/dist/environment/manage-users.js +1 -1
- package/dist/environment/questions.d.ts +16 -0
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +27 -2
- 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 +633 -560
- 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 +3 -8
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +6 -1
- 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 +2115 -1884
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +4 -4
- package/dist/migrations/v2.1/add-translations.d.ts.map +1 -1
- package/dist/migrations/v2.1/add-translations.js +4 -68
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -1
- package/dist/migrations/v2.1/enable-telemetry.js +30 -13
- package/dist/migrations/v2.1/index.d.ts.map +1 -1
- package/dist/migrations/v2.1/index.js +35 -1261
- 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/rename-api-paths.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/migrations/v2.2/add-e2e-tests.d.ts +19 -0
- package/dist/migrations/v2.2/add-e2e-tests.d.ts.map +1 -0
- package/dist/migrations/v2.2/add-e2e-tests.js +143 -0
- package/dist/migrations/v2.2/index.d.ts +6 -0
- package/dist/migrations/v2.2/index.d.ts.map +1 -0
- package/dist/migrations/v2.2/index.js +279 -0
- package/dist/migrations/v2.2/template-files.d.ts +8 -0
- package/dist/migrations/v2.2/template-files.d.ts.map +1 -0
- package/dist/migrations/v2.2/template-files.js +49 -0
- package/dist/migrations/v2.2/upgrade-tilt.d.ts +8 -0
- package/dist/migrations/v2.2/upgrade-tilt.d.ts.map +1 -0
- package/dist/migrations/v2.2/upgrade-tilt.js +139 -0
- package/dist/notification/index.js +249 -207
- package/dist/scopes/index.d.ts +288 -5
- package/dist/scopes/index.js +22 -7
- package/dist/telemetry/index.js +4 -0
- package/dist/templates/charts-values/dependencies/values.yaml +8 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +6 -0
- package/dist/templates/charts-values/opentelemetry/values.yaml +7 -0
- package/dist/templates/charts-values/traefik/values.yaml +2 -3
- 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/e2e/README.md +36 -0
- package/dist/templates/countryconfig-template/e2e/constants.ts +28 -0
- package/dist/templates/countryconfig-template/e2e/login.e2e.ts +59 -0
- package/dist/templates/countryconfig-template/package.json +153 -0
- package/dist/templates/countryconfig-template/playwright.config.ts +42 -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 +159 -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/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.map +1 -1
- package/dist/verify/endpoints.js +180 -15
- package/opencrvs-toolkit-2.1.0-rc.d235243.tgz +0 -0
- package/package.json +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- 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 +0 -3
- 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/translations/check.d.ts +0 -19
- package/dist/translations/check.d.ts.map +0 -1
- package/dist/translations/check.js +0 -127
- package/opencrvs-toolkit-2.1.0-rc.d1b9774.tgz +0 -0
|
@@ -33,8 +33,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
33
33
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
34
|
};
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.runSetupEnvironment = runSetupEnvironment;
|
|
36
37
|
const core_1 = require("@octokit/core");
|
|
37
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
38
38
|
const kleur_1 = __importDefault(require("kleur"));
|
|
39
39
|
const prompts_1 = __importDefault(require("prompts"));
|
|
40
40
|
function confirm(options) {
|
|
@@ -49,12 +49,19 @@ function select(options) {
|
|
|
49
49
|
return inquirer.select(options);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
+
function input(options) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const inquirer = yield import('@inquirer/prompts');
|
|
55
|
+
return inquirer.input(options);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
52
58
|
const github_1 = require("./github");
|
|
53
59
|
const derived_variables_1 = require("./derived-variables");
|
|
54
60
|
const utils_1 = require("./utils");
|
|
55
61
|
const logger_1 = require("./logger");
|
|
56
62
|
const templates_1 = require("./templates");
|
|
57
63
|
const ssh_keygen_1 = require("./ssh-keygen");
|
|
64
|
+
const update_workflows_1 = require("./update-workflows");
|
|
58
65
|
const questions_1 = require("./questions");
|
|
59
66
|
const editor_questions_1 = require("./editor-questions");
|
|
60
67
|
const questions_helper_1 = require("./questions-helper");
|
|
@@ -105,7 +112,7 @@ function getAnswers(existingValues) {
|
|
|
105
112
|
});
|
|
106
113
|
});
|
|
107
114
|
}
|
|
108
|
-
function promptAndStoreAnswer(
|
|
115
|
+
function promptAndStoreAnswer(questions, existingValues) {
|
|
109
116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
117
|
(0, logger_1.log)('');
|
|
111
118
|
const processedQuestions = questions.flatMap((question) => {
|
|
@@ -158,7 +165,6 @@ function promptAndStoreAnswer(environment, questions, existingValues) {
|
|
|
158
165
|
}
|
|
159
166
|
});
|
|
160
167
|
ALL_ANSWERS.push(result);
|
|
161
|
-
(0, utils_1.storeSecrets)(environment, getAnswers(existingValues));
|
|
162
168
|
const existingValuesForQuestions = questions
|
|
163
169
|
// Only variables can have previous values we can use
|
|
164
170
|
.filter((question) => question.valueType === 'VARIABLE')
|
|
@@ -169,590 +175,655 @@ function promptAndStoreAnswer(environment, questions, existingValues) {
|
|
|
169
175
|
return Object.assign(Object.assign({}, Object.fromEntries(existingValuesForQuestions)), result);
|
|
170
176
|
});
|
|
171
177
|
}
|
|
172
|
-
ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOtherQuestions, ...questions_1.dockerhubQuestions, ...questions_1.diskQuestions, ...questions_1.infrastructureQuestions, ...questions_1.backupQuestions, ...questions_1.countryQuestions, ...questions_1.databaseAndMonitoringQuestions, ...questions_1.emailQuestions, ...questions_1.sentryQuestions, ...derived_variables_1.derivedVariables, ...questions_1.metabaseAdminQuestions);
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
const { githubToken } = yield promptAndStoreAnswer('', questions_1.githubTokenQuestion, []);
|
|
182
|
-
const octokit = new core_1.Octokit({
|
|
183
|
-
auth: githubToken
|
|
184
|
-
});
|
|
185
|
-
(0, logger_1.log)(kleur_1.default.green('\nSuccessfully logged in to Github\n'));
|
|
186
|
-
const existingEnvironments = yield (0, github_1.getRepositoryEnvironments)(octokit, githubOrganisation, githubRepository);
|
|
187
|
-
const defaultChoices = [
|
|
188
|
-
{ name: 'Development', value: 'development' },
|
|
189
|
-
{ name: 'Quality assurance (no PII data)', value: 'qa' },
|
|
190
|
-
{
|
|
191
|
-
name: 'Staging (hosts PII data, no backups)',
|
|
192
|
-
value: 'staging'
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
name: 'Production (hosts PII data, requires frequent backups)',
|
|
196
|
-
value: 'production'
|
|
197
|
-
}
|
|
198
|
-
];
|
|
199
|
-
// Add only environments that are not already present
|
|
200
|
-
const choices = [
|
|
201
|
-
...defaultChoices,
|
|
202
|
-
...existingEnvironments
|
|
203
|
-
.filter((env) => !defaultChoices.some((choice) => choice.value === env))
|
|
204
|
-
.map((env) => ({
|
|
205
|
-
name: env,
|
|
206
|
-
value: env
|
|
207
|
-
}))
|
|
208
|
-
];
|
|
209
|
-
const environment = yield (0, questions_helper_1.selectWithCustom)({
|
|
210
|
-
message: 'Choose a name and purpose for the environment?',
|
|
211
|
-
choices: choices
|
|
212
|
-
});
|
|
213
|
-
let environment_type = 'non-production';
|
|
214
|
-
if (['development', 'qa'].includes(environment)) {
|
|
215
|
-
environment_type = 'non-production';
|
|
216
|
-
}
|
|
217
|
-
else if (['staging', 'production'].includes(environment)) {
|
|
218
|
-
environment_type = 'production';
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
environment_type = yield select({
|
|
222
|
-
message: 'Purpose for the environment?',
|
|
223
|
-
choices: [
|
|
224
|
-
{
|
|
225
|
-
name: 'Development/Quality assurance/Testing (no PII data)',
|
|
226
|
-
value: 'non-production'
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
name: 'Staging/Production (hosts PII data, requires frequent backups)',
|
|
230
|
-
value: 'production'
|
|
231
|
-
}
|
|
232
|
-
]
|
|
178
|
+
ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOtherQuestions, ...questions_1.dockerhubQuestions, ...questions_1.diskQuestions, ...questions_1.infrastructureQuestions, ...questions_1.backupQuestions, ...questions_1.countryQuestions, ...questions_1.databaseAndMonitoringQuestions, ...questions_1.emailQuestions, ...questions_1.sentryQuestions, ...derived_variables_1.derivedVariables, ...questions_1.metabaseAdminQuestions, ...questions_1.e2eQuestions);
|
|
179
|
+
function runSetupEnvironment() {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
var _a, _b, _c, _d;
|
|
182
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Github'), '\n');
|
|
183
|
+
const { githubOrganisation, githubRepository } = yield (0, prompts_1.default)(questions_1.githubQuestions.map(questionToPrompt), {
|
|
184
|
+
onCancel: () => {
|
|
185
|
+
process.exit(1);
|
|
186
|
+
}
|
|
233
187
|
});
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
path: `${process.cwd()}/.env.${environment}`
|
|
244
|
-
});
|
|
245
|
-
yield (0, github_1.createEnvironment)(octokit, environment, githubOrganisation, githubRepository);
|
|
246
|
-
const repositoryId = yield (0, github_1.getRepositoryId)(octokit, githubOrganisation, githubRepository);
|
|
247
|
-
const existingRepositorySecrets = yield (0, github_1.listRepositorySecrets)(octokit, githubOrganisation, githubRepository);
|
|
248
|
-
const existingRepositoryVariables = yield (0, github_1.listRepositoryVariables)(octokit, githubOrganisation, githubRepository);
|
|
249
|
-
const existingEnvironmentVariables = yield (0, github_1.listEnvironmentVariables)(octokit, repositoryId, environment);
|
|
250
|
-
const existingEnvironmentSecrets = yield (0, github_1.listEnvironmentSecrets)(octokit, githubOrganisation, repositoryId, environment);
|
|
251
|
-
const existingValues = [
|
|
252
|
-
...existingEnvironmentVariables,
|
|
253
|
-
...existingRepositoryVariables,
|
|
254
|
-
...existingRepositorySecrets,
|
|
255
|
-
...existingEnvironmentSecrets
|
|
256
|
-
];
|
|
257
|
-
if (existingEnvironmentVariables.length > 0 ||
|
|
258
|
-
existingEnvironmentSecrets.length > 0) {
|
|
259
|
-
(0, logger_1.log)('\nEnvironment with the name', environment, 'already exists in Github.', '\nFound', existingEnvironmentVariables.length, 'existing variables and', existingEnvironmentSecrets.length, 'secrets');
|
|
260
|
-
}
|
|
261
|
-
if (environment_type === 'production') {
|
|
262
|
-
(0, logger_1.log)('\n', kleur_1.default
|
|
263
|
-
.yellow()
|
|
264
|
-
.bold('WARNING! You are setting up a production environment.\n Make sure you have read the deployment guide carefully before proceeding.\n'));
|
|
265
|
-
yield promptAndStoreAnswer(environment, questions_1.githubOtherQuestions, existingValues);
|
|
266
|
-
}
|
|
267
|
-
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Docker Hub'));
|
|
268
|
-
yield promptAndStoreAnswer(environment, questions_1.dockerhubQuestions, existingValues);
|
|
269
|
-
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Kubernetes & Runtime'));
|
|
270
|
-
const infrastructure = yield promptAndStoreAnswer(environment, questions_1.infrastructureQuestions, existingValues);
|
|
271
|
-
const kubeWorkerNodes = infrastructure.kubeWorkerNodes
|
|
272
|
-
? infrastructure.kubeWorkerNodes.split(',').map((ip) => ip.trim())
|
|
273
|
-
: [];
|
|
274
|
-
(0, logger_1.log)('\n', kleur_1.default.bold().underline('SSH Users'), '\n');
|
|
275
|
-
const users = yield (0, manage_users_1.manageUsers)((0, paths_1.getEnvironmentInventoryPath)(environment));
|
|
276
|
-
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Traefik SSL Certificate'), '\n');
|
|
277
|
-
const sslCertExists = (0, utils_1.findExistingValue)('SSL_CRT', 'SECRET', 'ENVIRONMENT', existingValues);
|
|
278
|
-
let ssl_answers = [];
|
|
279
|
-
const traefikConfOption = (yield (0, prompts_1.default)([
|
|
280
|
-
{
|
|
281
|
-
name: 'traefikConfOption',
|
|
282
|
-
type: 'select',
|
|
283
|
-
message: 'Choose option to configure Traefik SSL Certificate',
|
|
284
|
-
choices: [
|
|
285
|
-
{ title: "Let's Encrypt certificate", value: 'lets_encrypt' },
|
|
286
|
-
{ title: 'Static SSL certificate', value: 'static_ssl' },
|
|
287
|
-
{ title: 'Custom configuration', value: 'custom' }
|
|
288
|
-
],
|
|
289
|
-
initial: sslCertExists ? 1 : 0
|
|
290
|
-
}
|
|
291
|
-
])).traefikConfOption;
|
|
292
|
-
if (traefikConfOption === 'static_ssl') {
|
|
293
|
-
ssl_answers = yield (0, editor_questions_1.askQuestionWithEditor)(questions_1.staticSSLCertQuestions, existingEnvironmentSecrets);
|
|
294
|
-
}
|
|
295
|
-
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Storage'), '\n');
|
|
296
|
-
let enableEncryption = false;
|
|
297
|
-
const encryption_key_defined = (0, utils_1.findExistingValue)('ENCRYPTION_KEY', 'SECRET', 'ENVIRONMENT', existingValues);
|
|
298
|
-
if (!encryption_key_defined && !environment_exists) {
|
|
299
|
-
const answers_enable_encryption = yield (0, prompts_1.default)([
|
|
188
|
+
const { githubToken } = yield promptAndStoreAnswer(questions_1.githubTokenQuestion, []);
|
|
189
|
+
const octokit = new core_1.Octokit({
|
|
190
|
+
auth: githubToken
|
|
191
|
+
});
|
|
192
|
+
(0, logger_1.log)(kleur_1.default.green('\nSuccessfully logged in to Github\n'));
|
|
193
|
+
const existingEnvironments = yield (0, github_1.getRepositoryEnvironments)(octokit, githubOrganisation, githubRepository);
|
|
194
|
+
const defaultChoices = [
|
|
195
|
+
{ name: 'Development', value: 'development' },
|
|
196
|
+
{ name: 'Quality assurance (no PII data)', value: 'qa' },
|
|
300
197
|
{
|
|
301
|
-
name: '
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
198
|
+
name: 'Staging (hosts PII data, no backups)',
|
|
199
|
+
value: 'staging'
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: 'Production (hosts PII data, requires frequent backups)',
|
|
203
|
+
value: 'production'
|
|
306
204
|
}
|
|
307
|
-
]
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
205
|
+
];
|
|
206
|
+
// Add only environments that are not already present
|
|
207
|
+
const choices = [
|
|
208
|
+
...defaultChoices,
|
|
209
|
+
...existingEnvironments
|
|
210
|
+
.filter((env) => !defaultChoices.some((choice) => choice.value === env))
|
|
211
|
+
.map((env) => ({
|
|
212
|
+
name: env,
|
|
213
|
+
value: env
|
|
214
|
+
}))
|
|
215
|
+
];
|
|
216
|
+
const environment = yield (0, questions_helper_1.selectWithCustom)({
|
|
217
|
+
message: 'Choose a name and purpose for the environment?',
|
|
218
|
+
choices: choices
|
|
219
|
+
});
|
|
220
|
+
let environment_type = 'non-production';
|
|
221
|
+
if (['development', 'qa'].includes(environment)) {
|
|
222
|
+
environment_type = 'non-production';
|
|
223
|
+
}
|
|
224
|
+
else if (['staging', 'production'].includes(environment)) {
|
|
225
|
+
environment_type = 'production';
|
|
323
226
|
}
|
|
324
227
|
else {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}
|
|
346
|
-
let backupHostPrivateKey = '';
|
|
347
|
-
let backupHostPublicKey = '';
|
|
348
|
-
if (configureBackup) {
|
|
349
|
-
const backupAnswers = yield promptAndStoreAnswer(environment, questions_1.backupQuestions, existingValues);
|
|
350
|
-
const backupHostPrivateKeyExists = (0, utils_1.findExistingValue)('BACKUP_HOST_PRIVATE_KEY', 'SECRET', 'ENVIRONMENT', existingValues);
|
|
351
|
-
backupType = backupAnswers.backupType;
|
|
352
|
-
backupHost = backupAnswers.backupHost || backupHost;
|
|
353
|
-
if (!backupHostPrivateKeyExists) {
|
|
354
|
-
const { publicKey, privateKey } = (0, ssh_keygen_1.generateSSHKeyPair)();
|
|
355
|
-
backupHostPublicKey = publicKey;
|
|
356
|
-
backupHostPrivateKey = privateKey;
|
|
357
|
-
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default
|
|
358
|
-
.bold()
|
|
359
|
-
.yellow(`Generated new SSH key pair for backup host: ${backupHost}`));
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
else {
|
|
363
|
-
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default.bold().yellow('Backup is disabled'));
|
|
364
|
-
}
|
|
365
|
-
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Restore'));
|
|
366
|
-
let configureRestore = restoreEnvironmentName ? true : false;
|
|
367
|
-
if (!restoreEnvironmentName && !configureBackup) {
|
|
368
|
-
configureRestore = yield confirm({
|
|
369
|
-
message: 'Do you want to configure restore?',
|
|
370
|
-
default: Boolean(process.env.CONFIGURE_RESTORE)
|
|
228
|
+
environment_type = yield select({
|
|
229
|
+
message: 'Purpose for the environment?',
|
|
230
|
+
choices: [
|
|
231
|
+
{
|
|
232
|
+
name: 'Development/Quality assurance/Testing (no PII data)',
|
|
233
|
+
value: 'non-production'
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: 'Staging/Production (hosts PII data, requires frequent backups)',
|
|
237
|
+
value: 'production'
|
|
238
|
+
}
|
|
239
|
+
]
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Two-factor authentication (2FA)'));
|
|
243
|
+
const two_fa_enabled = yield confirm({
|
|
244
|
+
message: 'Enable two-factor authentication (2FA)? This should be enabled for any environment that hosts PII data.',
|
|
245
|
+
default: process.env.TWO_FA_ENABLED
|
|
246
|
+
? process.env.TWO_FA_ENABLED === 'true'
|
|
247
|
+
: environment_type === 'production'
|
|
371
248
|
});
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
249
|
+
if (!two_fa_enabled && ['production', 'staging'].includes(environment_type)) {
|
|
250
|
+
(0, logger_1.warn)('2FA is disabled on a production-like environment. Logins will accept the fixed test code 000000, exposing real citizen data. Only do this if you know what you are doing.');
|
|
251
|
+
}
|
|
252
|
+
const environment_exists = existingEnvironments
|
|
253
|
+
.map((e) => e.trim())
|
|
254
|
+
.includes(environment);
|
|
255
|
+
if (!environment) {
|
|
256
|
+
process.exit(1);
|
|
257
|
+
}
|
|
258
|
+
yield (0, github_1.createEnvironment)(octokit, environment, githubOrganisation, githubRepository);
|
|
259
|
+
const repositoryId = yield (0, github_1.getRepositoryId)(octokit, githubOrganisation, githubRepository);
|
|
260
|
+
const existingRepositorySecrets = yield (0, github_1.listRepositorySecrets)(octokit, githubOrganisation, githubRepository);
|
|
261
|
+
const existingRepositoryVariables = yield (0, github_1.listRepositoryVariables)(octokit, githubOrganisation, githubRepository);
|
|
262
|
+
const existingEnvironmentVariables = yield (0, github_1.listEnvironmentVariables)(octokit, repositoryId, environment);
|
|
263
|
+
const existingEnvironmentSecrets = yield (0, github_1.listEnvironmentSecrets)(octokit, githubOrganisation, repositoryId, environment);
|
|
264
|
+
const existingValues = [
|
|
265
|
+
...existingEnvironmentVariables,
|
|
266
|
+
...existingRepositoryVariables,
|
|
267
|
+
...existingRepositorySecrets,
|
|
268
|
+
...existingEnvironmentSecrets
|
|
269
|
+
];
|
|
270
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('End-to-end (E2E) tests'));
|
|
271
|
+
const existingE2EEnabled = (0, utils_1.findExistingValue)('E2E_ENABLED', 'VARIABLE', 'ENVIRONMENT', existingValues);
|
|
272
|
+
const e2e_enabled = yield confirm({
|
|
273
|
+
message: 'Would you like to configure e2e tests for this environment? Tests run after every deployment and create test records.',
|
|
274
|
+
default: process.env.E2E_ENABLED
|
|
275
|
+
? process.env.E2E_ENABLED === 'true'
|
|
276
|
+
: (existingE2EEnabled === null || existingE2EEnabled === void 0 ? void 0 : existingE2EEnabled.value) === 'true'
|
|
382
277
|
});
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
278
|
+
if (e2e_enabled) {
|
|
279
|
+
if (environment_type === 'production') {
|
|
280
|
+
(0, logger_1.warn)('E2E tests are enabled on a production-like environment. Tests will create records alongside real citizen data. Only do this if you know what you are doing.');
|
|
281
|
+
}
|
|
282
|
+
if (two_fa_enabled) {
|
|
283
|
+
(0, logger_1.warn)('E2E tests usually sign in with the fixed 2FA code 000000, which is only accepted when 2FA is disabled.');
|
|
284
|
+
}
|
|
285
|
+
const countryconfigRepository = (0, utils_1.findExistingValue)('COUNTRYCONFIG_REPOSITORY', 'VARIABLE', 'REPOSITORY', existingValues);
|
|
286
|
+
if (countryconfigRepository) {
|
|
287
|
+
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default
|
|
288
|
+
.bold()
|
|
289
|
+
.grey(`E2E tests will run from repository ${countryconfigRepository.value} (COUNTRYCONFIG_REPOSITORY)`));
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
yield promptAndStoreAnswer(questions_1.e2eQuestions, existingValues);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (existingEnvironmentVariables.length > 0 ||
|
|
296
|
+
existingEnvironmentSecrets.length > 0) {
|
|
297
|
+
(0, logger_1.log)('\nEnvironment with the name', environment, 'already exists in Github.', '\nFound', existingEnvironmentVariables.length, 'existing variables and', existingEnvironmentSecrets.length, 'secrets');
|
|
298
|
+
}
|
|
299
|
+
if (environment_type === 'production') {
|
|
300
|
+
(0, logger_1.log)('\n', kleur_1.default
|
|
301
|
+
.yellow()
|
|
302
|
+
.bold('WARNING! You are setting up a production environment.\n Make sure you have read the deployment guide carefully before proceeding.\n'));
|
|
303
|
+
yield promptAndStoreAnswer(questions_1.githubOtherQuestions, existingValues);
|
|
304
|
+
}
|
|
305
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Docker Hub'));
|
|
306
|
+
yield promptAndStoreAnswer(questions_1.dockerhubQuestions, existingValues);
|
|
307
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Kubernetes & Runtime'));
|
|
308
|
+
const infrastructure = yield promptAndStoreAnswer(questions_1.infrastructureQuestions, existingValues);
|
|
309
|
+
const kubeWorkerNodes = infrastructure.kubeWorkerNodes
|
|
310
|
+
? infrastructure.kubeWorkerNodes.split(',').map((ip) => ip.trim())
|
|
311
|
+
: [];
|
|
312
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('SSH Users'), '\n');
|
|
313
|
+
const users = yield (0, manage_users_1.manageUsers)((0, paths_1.getEnvironmentInventoryPath)(environment));
|
|
314
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Traefik SSL Certificate'), '\n');
|
|
315
|
+
const sslCertExists = (0, utils_1.findExistingValue)('SSL_CRT', 'SECRET', 'ENVIRONMENT', existingValues);
|
|
316
|
+
let ssl_answers = [];
|
|
317
|
+
const traefikConfOption = (yield (0, prompts_1.default)([
|
|
318
|
+
{
|
|
319
|
+
name: 'traefikConfOption',
|
|
320
|
+
type: 'select',
|
|
321
|
+
message: 'Choose option to configure Traefik SSL Certificate',
|
|
322
|
+
choices: [
|
|
323
|
+
{ title: "Let's Encrypt certificate", value: 'lets_encrypt' },
|
|
324
|
+
{ title: 'Static SSL certificate', value: 'static_ssl' },
|
|
325
|
+
{ title: 'Custom configuration', value: 'custom' }
|
|
326
|
+
],
|
|
327
|
+
initial: sslCertExists ? 1 : 0
|
|
328
|
+
}
|
|
329
|
+
])).traefikConfOption;
|
|
330
|
+
if (traefikConfOption === 'static_ssl') {
|
|
331
|
+
ssl_answers = yield (0, editor_questions_1.askQuestionWithEditor)(questions_1.staticSSLCertQuestions, existingEnvironmentSecrets);
|
|
332
|
+
}
|
|
333
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Storage'), '\n');
|
|
334
|
+
let enableEncryption = false;
|
|
335
|
+
const encryption_key_defined = (0, utils_1.findExistingValue)('ENCRYPTION_KEY', 'SECRET', 'ENVIRONMENT', existingValues);
|
|
336
|
+
if (!encryption_key_defined && !environment_exists) {
|
|
337
|
+
const answers_enable_encryption = yield (0, prompts_1.default)([
|
|
386
338
|
{
|
|
387
|
-
name: '
|
|
388
|
-
|
|
389
|
-
|
|
339
|
+
name: 'enableEncryption',
|
|
340
|
+
type: 'confirm',
|
|
341
|
+
message: 'Do you want to enable disk encryption?',
|
|
342
|
+
scope: 'ENVIRONMENT',
|
|
343
|
+
initial: Boolean(process.env.ENABLE_ENCRYPTION)
|
|
344
|
+
}
|
|
345
|
+
].map(questionToPrompt));
|
|
346
|
+
enableEncryption = answers_enable_encryption.enableEncryption;
|
|
347
|
+
}
|
|
348
|
+
if (enableEncryption && !encryption_key_defined && !environment_exists) {
|
|
349
|
+
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default.bold().yellow(' Disk encryption is enabled'));
|
|
350
|
+
yield promptAndStoreAnswer(questions_1.diskQuestions, existingValues);
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
if (!enableEncryption && !encryption_key_defined && environment_exists) {
|
|
354
|
+
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default
|
|
355
|
+
.bold()
|
|
356
|
+
.grey(`Environment ${environment} is already configured, skipping disk encryption question`));
|
|
357
|
+
}
|
|
358
|
+
const DISK_SPACE = (0, utils_1.findExistingValue)('DISK_SPACE', 'VARIABLE', 'ENVIRONMENT', existingValues);
|
|
359
|
+
if (!DISK_SPACE) {
|
|
360
|
+
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default.bold().grey('All available disk space at /data will be used'));
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default
|
|
364
|
+
.bold()
|
|
365
|
+
.yellow('Variable DISK_SPACE is read-only, allocated space:'), DISK_SPACE === null || DISK_SPACE === void 0 ? void 0 : DISK_SPACE.value);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
// Backup and restore configuration
|
|
369
|
+
let backupHost = ((_a = (0, utils_1.findExistingValue)('BACKUP_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _a === void 0 ? void 0 : _a.value) || '';
|
|
370
|
+
let backupType = '';
|
|
371
|
+
let restoreEnvironmentName = (_b = (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_NAME', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _b === void 0 ? void 0 : _b.value;
|
|
372
|
+
let restoreHost = ((_c = (0, utils_1.findExistingValue)('RESTORE_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _c === void 0 ? void 0 : _c.value) || '';
|
|
373
|
+
let restoreType = ((_d = (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_MODE', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _d === void 0 ? void 0 : _d.value) ||
|
|
374
|
+
process.env.RESTORE_ENVIRONMENT_MODE ||
|
|
375
|
+
'dump';
|
|
376
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Backup'));
|
|
377
|
+
let configureBackup = backupHost ? true : false;
|
|
378
|
+
// Ask question only if backup and restore are not configured
|
|
379
|
+
if (!configureBackup && !restoreEnvironmentName) {
|
|
380
|
+
configureBackup = yield confirm({
|
|
381
|
+
message: 'Do you want to configure backup?',
|
|
382
|
+
default: Boolean(process.env.CONFIGURE_BACKUP)
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
let backupHostPrivateKey = '';
|
|
386
|
+
let backupHostPublicKey = '';
|
|
387
|
+
if (configureBackup) {
|
|
388
|
+
const backupAnswers = yield promptAndStoreAnswer(questions_1.backupQuestions, existingValues);
|
|
389
|
+
const backupHostPrivateKeyExists = (0, utils_1.findExistingValue)('BACKUP_HOST_PRIVATE_KEY', 'SECRET', 'ENVIRONMENT', existingValues);
|
|
390
|
+
backupType = backupAnswers.backupType;
|
|
391
|
+
backupHost = backupAnswers.backupHost || backupHost;
|
|
392
|
+
if (!backupHostPrivateKeyExists) {
|
|
393
|
+
const { publicKey, privateKey } = (0, ssh_keygen_1.generateSSHKeyPair)();
|
|
394
|
+
backupHostPublicKey = publicKey;
|
|
395
|
+
backupHostPrivateKey = privateKey;
|
|
396
|
+
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default
|
|
397
|
+
.bold()
|
|
398
|
+
.yellow(`Generated new SSH key pair for backup host: ${backupHost}`));
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default.bold().yellow('Backup is disabled'));
|
|
403
|
+
}
|
|
404
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Restore'));
|
|
405
|
+
let configureRestore = restoreEnvironmentName ? true : false;
|
|
406
|
+
if (!restoreEnvironmentName && !configureBackup) {
|
|
407
|
+
configureRestore = yield confirm({
|
|
408
|
+
message: 'Do you want to configure restore?',
|
|
409
|
+
default: Boolean(process.env.CONFIGURE_RESTORE)
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
if (configureRestore) {
|
|
413
|
+
const env_list_filtered = existingEnvironments.filter((env) => env !== environment);
|
|
414
|
+
restoreEnvironmentName = yield (0, questions_helper_1.selectWithCustom)({
|
|
415
|
+
message: 'What is the name of your environment to restore?',
|
|
416
|
+
choices: env_list_filtered.map((env) => ({
|
|
417
|
+
name: env,
|
|
418
|
+
value: env
|
|
419
|
+
})),
|
|
420
|
+
initial: restoreEnvironmentName
|
|
421
|
+
});
|
|
422
|
+
restoreType = yield select({
|
|
423
|
+
message: `Select ${kleur_1.default.yellow().bold(restoreEnvironmentName)} environment backup mode`,
|
|
424
|
+
default: restoreType,
|
|
425
|
+
choices: [
|
|
426
|
+
{
|
|
427
|
+
name: 'Full dump (daily full database backup)',
|
|
428
|
+
value: 'dump'
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
name: 'Differential (weekly full, daily diff backup)',
|
|
432
|
+
value: 'differential'
|
|
433
|
+
}
|
|
434
|
+
]
|
|
435
|
+
});
|
|
436
|
+
restoreHost = yield input({
|
|
437
|
+
message: 'What is the host/IP address of the restore backup server?',
|
|
438
|
+
default: restoreHost
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default.bold().yellow('Restore is disabled'));
|
|
443
|
+
}
|
|
444
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Monitoring'));
|
|
445
|
+
yield promptAndStoreAnswer(questions_1.databaseAndMonitoringQuestions, existingValues);
|
|
446
|
+
const sentryDSNExists = (0, utils_1.findExistingValue)('SENTRY_DSN', 'SECRET', 'ENVIRONMENT', existingValues);
|
|
447
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Sentry'));
|
|
448
|
+
if (sentryDSNExists) {
|
|
449
|
+
yield promptAndStoreAnswer(questions_1.sentryQuestions, existingValues);
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
const { useSentry } = yield (0, prompts_1.default)([
|
|
390
453
|
{
|
|
391
|
-
name: '
|
|
392
|
-
|
|
454
|
+
name: 'useSentry',
|
|
455
|
+
type: 'confirm',
|
|
456
|
+
message: 'Do you want to use Sentry?',
|
|
457
|
+
initial: Boolean(process.env.SENTRY_DNS)
|
|
393
458
|
}
|
|
394
|
-
]
|
|
459
|
+
]);
|
|
460
|
+
if (useSentry) {
|
|
461
|
+
yield promptAndStoreAnswer(questions_1.sentryQuestions, existingValues);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('METABASE ADMIN'));
|
|
465
|
+
yield promptAndStoreAnswer(questions_1.metabaseAdminQuestions, existingValues);
|
|
466
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('SMTP'));
|
|
467
|
+
yield promptAndStoreAnswer(questions_1.emailQuestions, existingValues);
|
|
468
|
+
const allAnswers = ALL_ANSWERS.reduce((acc, answer) => {
|
|
469
|
+
return Object.assign(Object.assign({}, acc), answer);
|
|
395
470
|
});
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
}
|
|
407
|
-
else {
|
|
408
|
-
const { useSentry } = yield (0, prompts_1.default)([
|
|
471
|
+
/*
|
|
472
|
+
* Variables the user doesn't need to set manually
|
|
473
|
+
*/
|
|
474
|
+
const answerOrExisting = (variable, existingValue, fn) => fn(variable || (existingValue === null || existingValue === void 0 ? void 0 : existingValue.value)) || '';
|
|
475
|
+
function findExistingOrDefine(name, type, scope, newValue) {
|
|
476
|
+
return (0, utils_1.findExistingValue)(name, type, scope, existingValues)
|
|
477
|
+
? null
|
|
478
|
+
: process.env[name] || newValue;
|
|
479
|
+
}
|
|
480
|
+
const derivedUpdates = [
|
|
409
481
|
{
|
|
410
|
-
name: '
|
|
411
|
-
type: '
|
|
412
|
-
|
|
413
|
-
|
|
482
|
+
name: 'GH_ENCRYPTION_PASSWORD',
|
|
483
|
+
type: 'SECRET',
|
|
484
|
+
didExist: (0, utils_1.findExistingValue)('GH_ENCRYPTION_PASSWORD', 'SECRET', 'REPOSITORY', existingValues),
|
|
485
|
+
value: findExistingOrDefine('GH_ENCRYPTION_PASSWORD', 'SECRET', 'REPOSITORY', (0, utils_1.generateLongPassword)()),
|
|
486
|
+
scope: 'REPOSITORY'
|
|
414
487
|
}
|
|
415
|
-
]
|
|
416
|
-
if (useSentry) {
|
|
417
|
-
yield promptAndStoreAnswer(environment, questions_1.sentryQuestions, existingValues);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
(0, logger_1.log)('\n', kleur_1.default.bold().underline('METABASE ADMIN'));
|
|
421
|
-
yield promptAndStoreAnswer(environment, questions_1.metabaseAdminQuestions, existingValues);
|
|
422
|
-
(0, logger_1.log)('\n', kleur_1.default.bold().underline('SMTP'));
|
|
423
|
-
yield promptAndStoreAnswer(environment, questions_1.emailQuestions, existingValues);
|
|
424
|
-
const allAnswers = ALL_ANSWERS.reduce((acc, answer) => {
|
|
425
|
-
return Object.assign(Object.assign({}, acc), answer);
|
|
426
|
-
});
|
|
427
|
-
/*
|
|
428
|
-
* Variables the user doesn't need to set manually
|
|
429
|
-
*/
|
|
430
|
-
const answerOrExisting = (variable, existingValue, fn) => fn(variable || (existingValue === null || existingValue === void 0 ? void 0 : existingValue.value)) || '';
|
|
431
|
-
function findExistingOrDefine(name, type, scope, newValue) {
|
|
432
|
-
return (0, utils_1.findExistingValue)(name, type, scope, existingValues)
|
|
433
|
-
? null
|
|
434
|
-
: process.env[name] || newValue;
|
|
435
|
-
}
|
|
436
|
-
const derivedUpdates = [
|
|
437
|
-
{
|
|
438
|
-
name: 'GH_ENCRYPTION_PASSWORD',
|
|
439
|
-
type: 'SECRET',
|
|
440
|
-
didExist: (0, utils_1.findExistingValue)('GH_ENCRYPTION_PASSWORD', 'SECRET', 'REPOSITORY', existingValues),
|
|
441
|
-
value: findExistingOrDefine('GH_ENCRYPTION_PASSWORD', 'SECRET', 'REPOSITORY', (0, utils_1.generateLongPassword)()),
|
|
442
|
-
scope: 'REPOSITORY'
|
|
443
|
-
}
|
|
444
|
-
];
|
|
445
|
-
derivedUpdates.push({
|
|
446
|
-
name: 'NOTIFICATION_TRANSPORT',
|
|
447
|
-
type: 'VARIABLE',
|
|
448
|
-
didExist: (0, utils_1.findExistingValue)('NOTIFICATION_TRANSPORT', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
449
|
-
value: findExistingOrDefine('NOTIFICATION_TRANSPORT', 'VARIABLE', 'ENVIRONMENT', 'email'),
|
|
450
|
-
scope: 'ENVIRONMENT'
|
|
451
|
-
});
|
|
452
|
-
derivedUpdates.push(...ssl_answers);
|
|
453
|
-
if (configureBackup) {
|
|
488
|
+
];
|
|
454
489
|
derivedUpdates.push({
|
|
455
|
-
name: '
|
|
456
|
-
type: 'SECRET',
|
|
457
|
-
didExist: (0, utils_1.findExistingValue)('BACKUP_ENCRYPTION_PASSPHRASE', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
458
|
-
value: findExistingOrDefine('BACKUP_ENCRYPTION_PASSPHRASE', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
459
|
-
scope: 'ENVIRONMENT'
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
const applicationServerUpdates = [
|
|
463
|
-
{
|
|
464
|
-
name: 'ELASTICSEARCH_SUPERUSER_PASSWORD',
|
|
465
|
-
type: 'SECRET',
|
|
466
|
-
didExist: (0, utils_1.findExistingValue)('ELASTICSEARCH_SUPERUSER_PASSWORD', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
467
|
-
value: findExistingOrDefine('ELASTICSEARCH_SUPERUSER_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
468
|
-
scope: 'ENVIRONMENT'
|
|
469
|
-
},
|
|
470
|
-
{
|
|
471
|
-
name: 'KIBANA_SYSTEM_PASSWORD',
|
|
472
|
-
type: 'SECRET',
|
|
473
|
-
didExist: (0, utils_1.findExistingValue)('KIBANA_SYSTEM_PASSWORD', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
474
|
-
value: findExistingOrDefine('KIBANA_SYSTEM_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
475
|
-
scope: 'ENVIRONMENT'
|
|
476
|
-
},
|
|
477
|
-
{
|
|
478
|
-
name: 'MINIO_ROOT_USER',
|
|
479
|
-
type: 'SECRET',
|
|
480
|
-
didExist: (0, utils_1.findExistingValue)('MINIO_ROOT_USER', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
481
|
-
value: findExistingOrDefine('MINIO_ROOT_USER', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
482
|
-
scope: 'ENVIRONMENT'
|
|
483
|
-
},
|
|
484
|
-
{
|
|
485
|
-
name: 'MINIO_ROOT_PASSWORD',
|
|
486
|
-
type: 'SECRET',
|
|
487
|
-
didExist: (0, utils_1.findExistingValue)('MINIO_ROOT_PASSWORD', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
488
|
-
value: findExistingOrDefine('MINIO_ROOT_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
489
|
-
scope: 'ENVIRONMENT'
|
|
490
|
-
},
|
|
491
|
-
{
|
|
492
|
-
name: 'POSTGRES_USER',
|
|
493
|
-
type: 'SECRET',
|
|
494
|
-
didExist: (0, utils_1.findExistingValue)('POSTGRES_USER', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
495
|
-
value: findExistingOrDefine('POSTGRES_USER', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
496
|
-
scope: 'ENVIRONMENT'
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
name: 'POSTGRES_PASSWORD',
|
|
500
|
-
type: 'SECRET',
|
|
501
|
-
didExist: (0, utils_1.findExistingValue)('POSTGRES_PASSWORD', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
502
|
-
value: findExistingOrDefine('POSTGRES_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
503
|
-
scope: 'ENVIRONMENT'
|
|
504
|
-
},
|
|
505
|
-
{
|
|
506
|
-
name: 'SUPER_USER_PASSWORD',
|
|
507
|
-
type: 'SECRET',
|
|
508
|
-
didExist: (0, utils_1.findExistingValue)('SUPER_USER_PASSWORD', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
509
|
-
value: findExistingOrDefine('SUPER_USER_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
510
|
-
scope: 'ENVIRONMENT'
|
|
511
|
-
},
|
|
512
|
-
{
|
|
513
|
-
type: 'VARIABLE',
|
|
514
|
-
name: 'ACTIVATE_USERS',
|
|
515
|
-
value: 'production' === environment_type ? 'false' : 'true',
|
|
516
|
-
didExist: (0, utils_1.findExistingValue)('ACTIVATE_USERS', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
517
|
-
scope: 'ENVIRONMENT'
|
|
518
|
-
},
|
|
519
|
-
{
|
|
490
|
+
name: 'NOTIFICATION_TRANSPORT',
|
|
520
491
|
type: 'VARIABLE',
|
|
521
|
-
|
|
522
|
-
value:
|
|
523
|
-
didExist: (0, utils_1.findExistingValue)('COUNTRY_CONFIG_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
524
|
-
scope: 'ENVIRONMENT'
|
|
525
|
-
},
|
|
526
|
-
{
|
|
527
|
-
type: 'VARIABLE',
|
|
528
|
-
name: 'GATEWAY_HOST',
|
|
529
|
-
value: answerOrExisting(allAnswers.domain, (0, utils_1.findExistingValue)('DOMAIN', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => `https://gateway.${val}`),
|
|
530
|
-
didExist: (0, utils_1.findExistingValue)('GATEWAY_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
531
|
-
scope: 'ENVIRONMENT'
|
|
532
|
-
},
|
|
533
|
-
{
|
|
534
|
-
type: 'VARIABLE',
|
|
535
|
-
name: 'CONTENT_SECURITY_POLICY_WILDCARD',
|
|
536
|
-
value: answerOrExisting(allAnswers.domain, (0, utils_1.findExistingValue)('DOMAIN', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => `*.${val}`),
|
|
537
|
-
didExist: (0, utils_1.findExistingValue)('CONTENT_SECURITY_POLICY_WILDCARD', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
538
|
-
scope: 'ENVIRONMENT'
|
|
539
|
-
},
|
|
540
|
-
{
|
|
541
|
-
type: 'VARIABLE',
|
|
542
|
-
name: 'CLIENT_APP_URL',
|
|
543
|
-
value: answerOrExisting(allAnswers.domain, (0, utils_1.findExistingValue)('DOMAIN', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => `https://register.${val}`),
|
|
544
|
-
didExist: (0, utils_1.findExistingValue)('CLIENT_APP_URL', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
545
|
-
scope: 'ENVIRONMENT'
|
|
546
|
-
},
|
|
547
|
-
{
|
|
548
|
-
type: 'VARIABLE',
|
|
549
|
-
name: 'LOGIN_URL',
|
|
550
|
-
value: answerOrExisting(allAnswers.domain, (0, utils_1.findExistingValue)('DOMAIN', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => `https://login.${val}`),
|
|
551
|
-
didExist: (0, utils_1.findExistingValue)('LOGIN_URL', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
552
|
-
scope: 'ENVIRONMENT'
|
|
553
|
-
},
|
|
554
|
-
{
|
|
555
|
-
type: 'VARIABLE',
|
|
556
|
-
name: 'RESTORE_ENVIRONMENT_NAME',
|
|
557
|
-
value: answerOrExisting(restoreEnvironmentName, (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_NAME', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => val || ''),
|
|
558
|
-
didExist: (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_NAME', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
559
|
-
scope: 'ENVIRONMENT'
|
|
560
|
-
}
|
|
561
|
-
];
|
|
562
|
-
if (enableEncryption) {
|
|
563
|
-
applicationServerUpdates.push({
|
|
564
|
-
name: 'ENCRYPTION_KEY',
|
|
565
|
-
type: 'SECRET',
|
|
566
|
-
didExist: (0, utils_1.findExistingValue)('ENCRYPTION_KEY', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
567
|
-
value: findExistingOrDefine('ENCRYPTION_KEY', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
492
|
+
didExist: (0, utils_1.findExistingValue)('NOTIFICATION_TRANSPORT', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
493
|
+
value: findExistingOrDefine('NOTIFICATION_TRANSPORT', 'VARIABLE', 'ENVIRONMENT', 'email'),
|
|
568
494
|
scope: 'ENVIRONMENT'
|
|
569
495
|
});
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
value: backupHostPrivateKey,
|
|
577
|
-
scope: 'ENVIRONMENT'
|
|
578
|
-
});
|
|
579
|
-
applicationServerUpdates.push({
|
|
580
|
-
name: 'BACKUP_HOST_PUBLIC_KEY',
|
|
581
|
-
type: 'SECRET',
|
|
582
|
-
didExist: undefined,
|
|
583
|
-
value: backupHostPublicKey,
|
|
496
|
+
derivedUpdates.push({
|
|
497
|
+
name: 'E2E_ENABLED',
|
|
498
|
+
type: 'VARIABLE',
|
|
499
|
+
didExist: existingE2EEnabled,
|
|
500
|
+
// Only store 'false' to switch off an environment that previously had e2e enabled
|
|
501
|
+
value: e2e_enabled ? 'true' : existingE2EEnabled ? 'false' : null,
|
|
584
502
|
scope: 'ENVIRONMENT'
|
|
585
503
|
});
|
|
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
|
-
|
|
504
|
+
derivedUpdates.push(...ssl_answers);
|
|
505
|
+
if (configureBackup) {
|
|
506
|
+
derivedUpdates.push({
|
|
507
|
+
name: 'BACKUP_ENCRYPTION_PASSPHRASE',
|
|
508
|
+
type: 'SECRET',
|
|
509
|
+
didExist: (0, utils_1.findExistingValue)('BACKUP_ENCRYPTION_PASSPHRASE', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
510
|
+
value: findExistingOrDefine('BACKUP_ENCRYPTION_PASSPHRASE', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
511
|
+
scope: 'ENVIRONMENT'
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
const applicationServerUpdates = [
|
|
515
|
+
{
|
|
516
|
+
name: 'ELASTICSEARCH_SUPERUSER_PASSWORD',
|
|
517
|
+
type: 'SECRET',
|
|
518
|
+
didExist: (0, utils_1.findExistingValue)('ELASTICSEARCH_SUPERUSER_PASSWORD', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
519
|
+
value: findExistingOrDefine('ELASTICSEARCH_SUPERUSER_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
520
|
+
scope: 'ENVIRONMENT'
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
name: 'KIBANA_SYSTEM_PASSWORD',
|
|
524
|
+
type: 'SECRET',
|
|
525
|
+
didExist: (0, utils_1.findExistingValue)('KIBANA_SYSTEM_PASSWORD', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
526
|
+
value: findExistingOrDefine('KIBANA_SYSTEM_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
527
|
+
scope: 'ENVIRONMENT'
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
name: 'MINIO_ROOT_USER',
|
|
531
|
+
type: 'SECRET',
|
|
532
|
+
didExist: (0, utils_1.findExistingValue)('MINIO_ROOT_USER', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
533
|
+
value: findExistingOrDefine('MINIO_ROOT_USER', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
534
|
+
scope: 'ENVIRONMENT'
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
name: 'MINIO_ROOT_PASSWORD',
|
|
538
|
+
type: 'SECRET',
|
|
539
|
+
didExist: (0, utils_1.findExistingValue)('MINIO_ROOT_PASSWORD', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
540
|
+
value: findExistingOrDefine('MINIO_ROOT_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
541
|
+
scope: 'ENVIRONMENT'
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
name: 'POSTGRES_USER',
|
|
545
|
+
type: 'SECRET',
|
|
546
|
+
didExist: (0, utils_1.findExistingValue)('POSTGRES_USER', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
547
|
+
value: findExistingOrDefine('POSTGRES_USER', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
548
|
+
scope: 'ENVIRONMENT'
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
name: 'POSTGRES_PASSWORD',
|
|
552
|
+
type: 'SECRET',
|
|
553
|
+
didExist: (0, utils_1.findExistingValue)('POSTGRES_PASSWORD', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
554
|
+
value: findExistingOrDefine('POSTGRES_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
555
|
+
scope: 'ENVIRONMENT'
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
name: 'SUPER_USER_PASSWORD',
|
|
559
|
+
type: 'SECRET',
|
|
560
|
+
didExist: (0, utils_1.findExistingValue)('SUPER_USER_PASSWORD', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
561
|
+
value: findExistingOrDefine('SUPER_USER_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
562
|
+
scope: 'ENVIRONMENT'
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
type: 'VARIABLE',
|
|
566
|
+
name: 'ACTIVATE_USERS',
|
|
567
|
+
value: 'production' === environment_type ? 'false' : 'true',
|
|
568
|
+
didExist: (0, utils_1.findExistingValue)('ACTIVATE_USERS', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
569
|
+
scope: 'ENVIRONMENT'
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
type: 'VARIABLE',
|
|
573
|
+
name: 'COUNTRY_CONFIG_HOST',
|
|
574
|
+
value: answerOrExisting(allAnswers.domain, (0, utils_1.findExistingValue)('DOMAIN', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => `https://countryconfig.${val}`),
|
|
575
|
+
didExist: (0, utils_1.findExistingValue)('COUNTRY_CONFIG_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
576
|
+
scope: 'ENVIRONMENT'
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
type: 'VARIABLE',
|
|
580
|
+
name: 'GATEWAY_HOST',
|
|
581
|
+
value: answerOrExisting(allAnswers.domain, (0, utils_1.findExistingValue)('DOMAIN', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => `https://gateway.${val}`),
|
|
582
|
+
didExist: (0, utils_1.findExistingValue)('GATEWAY_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
583
|
+
scope: 'ENVIRONMENT'
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
type: 'VARIABLE',
|
|
587
|
+
name: 'CONTENT_SECURITY_POLICY_WILDCARD',
|
|
588
|
+
value: answerOrExisting(allAnswers.domain, (0, utils_1.findExistingValue)('DOMAIN', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => `*.${val}`),
|
|
589
|
+
didExist: (0, utils_1.findExistingValue)('CONTENT_SECURITY_POLICY_WILDCARD', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
590
|
+
scope: 'ENVIRONMENT'
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
type: 'VARIABLE',
|
|
594
|
+
name: 'CLIENT_APP_URL',
|
|
595
|
+
value: answerOrExisting(allAnswers.domain, (0, utils_1.findExistingValue)('DOMAIN', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => `https://register.${val}`),
|
|
596
|
+
didExist: (0, utils_1.findExistingValue)('CLIENT_APP_URL', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
597
|
+
scope: 'ENVIRONMENT'
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
type: 'VARIABLE',
|
|
601
|
+
name: 'LOGIN_URL',
|
|
602
|
+
value: answerOrExisting(allAnswers.domain, (0, utils_1.findExistingValue)('DOMAIN', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => `https://login.${val}`),
|
|
603
|
+
didExist: (0, utils_1.findExistingValue)('LOGIN_URL', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
604
|
+
scope: 'ENVIRONMENT'
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
type: 'VARIABLE',
|
|
608
|
+
name: 'RESTORE_ENVIRONMENT_NAME',
|
|
609
|
+
value: answerOrExisting(restoreEnvironmentName, (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_NAME', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => val || ''),
|
|
610
|
+
didExist: (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_NAME', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
611
|
+
scope: 'ENVIRONMENT'
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
type: 'VARIABLE',
|
|
615
|
+
name: 'RESTORE_HOST',
|
|
616
|
+
value: answerOrExisting(restoreHost, (0, utils_1.findExistingValue)('RESTORE_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues), (val) => val || ''),
|
|
617
|
+
didExist: (0, utils_1.findExistingValue)('RESTORE_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
618
|
+
scope: 'ENVIRONMENT'
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
type: 'VARIABLE',
|
|
622
|
+
name: 'RESTORE_ENVIRONMENT_MODE',
|
|
623
|
+
// Only persist the mode when restore is configured
|
|
624
|
+
value: restoreEnvironmentName ? restoreType : '',
|
|
625
|
+
didExist: (0, utils_1.findExistingValue)('RESTORE_ENVIRONMENT_MODE', 'VARIABLE', 'ENVIRONMENT', existingValues),
|
|
626
|
+
scope: 'ENVIRONMENT'
|
|
627
|
+
}
|
|
628
|
+
];
|
|
629
|
+
if (enableEncryption) {
|
|
630
|
+
applicationServerUpdates.push({
|
|
631
|
+
name: 'ENCRYPTION_KEY',
|
|
632
|
+
type: 'SECRET',
|
|
633
|
+
didExist: (0, utils_1.findExistingValue)('ENCRYPTION_KEY', 'SECRET', 'ENVIRONMENT', existingValues),
|
|
634
|
+
value: findExistingOrDefine('ENCRYPTION_KEY', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
|
|
635
|
+
scope: 'ENVIRONMENT'
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
if (configureBackup && backupHostPrivateKey && backupHostPublicKey) {
|
|
639
|
+
applicationServerUpdates.push({
|
|
640
|
+
name: 'BACKUP_HOST_PRIVATE_KEY',
|
|
641
|
+
type: 'SECRET',
|
|
642
|
+
didExist: undefined,
|
|
643
|
+
value: backupHostPrivateKey,
|
|
644
|
+
scope: 'ENVIRONMENT'
|
|
645
|
+
});
|
|
646
|
+
applicationServerUpdates.push({
|
|
647
|
+
name: 'BACKUP_HOST_PUBLIC_KEY',
|
|
648
|
+
type: 'SECRET',
|
|
649
|
+
didExist: undefined,
|
|
650
|
+
value: backupHostPublicKey,
|
|
651
|
+
scope: 'ENVIRONMENT'
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
derivedUpdates.push(...applicationServerUpdates);
|
|
655
|
+
const updates = getAnswers(existingValues)
|
|
656
|
+
.concat(...derivedUpdates.filter((update) => update.value !== null))
|
|
657
|
+
.filter((variable) => { var _a; return Boolean(variable.value) &&
|
|
658
|
+
// Only update values that changed
|
|
659
|
+
(variable.type !== 'VARIABLE' ||
|
|
660
|
+
variable.value !== ((_a = variable.didExist) === null || _a === void 0 ? void 0 : _a.value)); });
|
|
661
|
+
/*
|
|
662
|
+
* List out all updates to the variables and confirm with the user
|
|
663
|
+
*/
|
|
664
|
+
const newSecrets = updates.filter((update) => update.type === 'SECRET' && !update.didExist);
|
|
665
|
+
const updatedSecrets = updates.filter((update) => update.type === 'SECRET' && Boolean(update.didExist));
|
|
666
|
+
const newVariables = updates.filter((update) => update.type === 'VARIABLE' && !update.didExist);
|
|
667
|
+
const updatedVariables = updates.filter((update) => update.type === 'VARIABLE' && Boolean(update.didExist));
|
|
668
|
+
const unknownVariables = existingValues.filter((value) => {
|
|
669
|
+
return !ALL_QUESTIONS.find((question) => question.valueLabel === value.name &&
|
|
670
|
+
question.valueType === value.type &&
|
|
671
|
+
question.scope === value.scope);
|
|
661
672
|
});
|
|
662
673
|
(0, logger_1.log)('');
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
process.exit(0);
|
|
679
|
-
}
|
|
680
|
-
for (const newSecret of newSecrets) {
|
|
681
|
-
(0, logger_1.log)(`Creating secret ${newSecret.name} with value ${newSecret.value}`);
|
|
682
|
-
if (newSecret.scope === 'ENVIRONMENT') {
|
|
683
|
-
yield (0, github_1.createEnvironmentSecret)(octokit, repositoryId, environment, newSecret.name, newSecret.value, githubOrganisation, githubRepository);
|
|
674
|
+
if (newSecrets.length > 0) {
|
|
675
|
+
(0, logger_1.log)(kleur_1.default.yellow(`The following secrets will be added to Github for environment ${environment}:`));
|
|
676
|
+
newSecrets
|
|
677
|
+
.filter(({ scope }) => scope === 'ENVIRONMENT')
|
|
678
|
+
.forEach((secret) => {
|
|
679
|
+
(0, logger_1.log)(secret.name, '=', secret.value);
|
|
680
|
+
});
|
|
681
|
+
(0, logger_1.log)('');
|
|
682
|
+
(0, logger_1.log)(kleur_1.default.yellow(`The following secrets will be added to Github repository:`));
|
|
683
|
+
newSecrets
|
|
684
|
+
.filter(({ scope }) => scope === 'REPOSITORY')
|
|
685
|
+
.forEach((secret) => {
|
|
686
|
+
(0, logger_1.log)(secret.name, '=', secret.value);
|
|
687
|
+
});
|
|
688
|
+
(0, logger_1.log)('');
|
|
684
689
|
}
|
|
685
|
-
|
|
686
|
-
|
|
690
|
+
if (updatedSecrets.length > 0) {
|
|
691
|
+
(0, logger_1.log)(kleur_1.default.yellow(`The following secrets will be updated in Github for environment ${environment}:`));
|
|
692
|
+
updatedSecrets.forEach((secret) => {
|
|
693
|
+
(0, logger_1.log)(secret.name, '=', secret.value);
|
|
694
|
+
});
|
|
695
|
+
(0, logger_1.log)('');
|
|
687
696
|
}
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
697
|
+
if (newVariables.length > 0) {
|
|
698
|
+
(0, logger_1.log)(kleur_1.default.yellow(`The following variables will be added to Github for environment ${environment}:`));
|
|
699
|
+
newVariables.forEach((variable) => {
|
|
700
|
+
(0, logger_1.log)(variable.name, '=', variable.value);
|
|
701
|
+
});
|
|
702
|
+
(0, logger_1.log)('');
|
|
693
703
|
}
|
|
694
|
-
|
|
695
|
-
|
|
704
|
+
if (updatedVariables.length > 0) {
|
|
705
|
+
(0, logger_1.log)(kleur_1.default.yellow(`The following variables will be updated in Github for environment ${environment}:`));
|
|
706
|
+
updatedVariables.forEach((variable) => {
|
|
707
|
+
var _a;
|
|
708
|
+
(0, logger_1.log)(variable.name, '=', variable.value, `(was ${(_a = variable.didExist) === null || _a === void 0 ? void 0 : _a.value})`);
|
|
709
|
+
});
|
|
710
|
+
(0, logger_1.log)('');
|
|
696
711
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
712
|
+
if (unknownVariables.length > 0) {
|
|
713
|
+
(0, logger_1.log)(kleur_1.default.yellow(`The following unknown variables/secrets were stored in Github are not managed by this script:`));
|
|
714
|
+
(0, logger_1.log)('');
|
|
715
|
+
(0, logger_1.log)(kleur_1.default.blue(`Repository:`));
|
|
716
|
+
unknownVariables
|
|
717
|
+
.filter(({ scope }) => scope === 'REPOSITORY')
|
|
718
|
+
.forEach((variable) => {
|
|
719
|
+
(0, logger_1.log)(kleur_1.default.cyan(variable.type) + ':', variable.name);
|
|
720
|
+
});
|
|
721
|
+
(0, logger_1.log)('');
|
|
722
|
+
(0, logger_1.log)(kleur_1.default.blue(`Environment:`));
|
|
723
|
+
unknownVariables
|
|
724
|
+
.filter(({ scope }) => scope === 'ENVIRONMENT')
|
|
725
|
+
.forEach((variable) => {
|
|
726
|
+
(0, logger_1.log)(kleur_1.default.cyan(variable.type) + ':', variable.name);
|
|
727
|
+
});
|
|
728
|
+
(0, logger_1.log)('');
|
|
729
|
+
(0, logger_1.log)(kleur_1.default.yellow(`These variables will not be updated by this script. If you want to update them, you will need to do so manually.`));
|
|
730
|
+
(0, logger_1.log)('');
|
|
702
731
|
}
|
|
703
|
-
|
|
704
|
-
|
|
732
|
+
if ([]
|
|
733
|
+
.concat(newSecrets)
|
|
734
|
+
.concat(updatedSecrets)
|
|
735
|
+
.concat(newVariables)
|
|
736
|
+
.concat(updatedVariables).length === 0) {
|
|
737
|
+
process.exit(0);
|
|
705
738
|
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
739
|
+
(0, logger_1.log)(kleur_1.default
|
|
740
|
+
.bold()
|
|
741
|
+
.red("⚠️ COPY THESE NOW INTO A PASSWORD MANAGER — YOU WON'T SEE THEM AGAIN"));
|
|
742
|
+
(0, logger_1.log)('');
|
|
743
|
+
const saveChanges = yield confirm({
|
|
744
|
+
message: 'Do you want to continue?',
|
|
745
|
+
default: true
|
|
746
|
+
});
|
|
747
|
+
if (!saveChanges) {
|
|
748
|
+
process.exit(0);
|
|
711
749
|
}
|
|
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
|
-
|
|
750
|
+
for (const newSecret of newSecrets) {
|
|
751
|
+
(0, logger_1.log)(`Creating secret ${newSecret.name} with value ${newSecret.value}`);
|
|
752
|
+
if (newSecret.scope === 'ENVIRONMENT') {
|
|
753
|
+
yield (0, github_1.createEnvironmentSecret)(octokit, repositoryId, environment, newSecret.name, newSecret.value, githubOrganisation, githubRepository);
|
|
754
|
+
}
|
|
755
|
+
else {
|
|
756
|
+
yield (0, github_1.createRepositorySecret)(octokit, repositoryId, newSecret.name, newSecret.value, githubOrganisation, githubRepository);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
for (const updatedSecret of updatedSecrets) {
|
|
760
|
+
(0, logger_1.log)(`Updating secret ${updatedSecret.name} with value ${updatedSecret.value}`);
|
|
761
|
+
if (updatedSecret.scope === 'ENVIRONMENT') {
|
|
762
|
+
yield (0, github_1.createEnvironmentSecret)(octokit, repositoryId, environment, updatedSecret.name, updatedSecret.value, githubOrganisation, githubRepository);
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
yield (0, github_1.createRepositorySecret)(octokit, repositoryId, updatedSecret.name, updatedSecret.value, githubOrganisation, githubRepository);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
for (const newVariable of newVariables) {
|
|
769
|
+
(0, logger_1.log)(`Creating variable ${newVariable.name} with value ${newVariable.value}`);
|
|
770
|
+
if (newVariable.scope === 'ENVIRONMENT') {
|
|
771
|
+
yield (0, github_1.createEnvironmentVariable)(octokit, repositoryId, environment, newVariable.name, newVariable.value);
|
|
772
|
+
}
|
|
773
|
+
else {
|
|
774
|
+
yield (0, github_1.createRepositoryVariable)(octokit, repositoryId, newVariable.name, newVariable.value);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
for (const updatedVariable of updatedVariables) {
|
|
778
|
+
(0, logger_1.log)(`Updating variable ${updatedVariable.name} with value ${updatedVariable.value}`);
|
|
779
|
+
if (updatedVariable.scope === 'ENVIRONMENT') {
|
|
780
|
+
yield (0, github_1.updateEnvironmentVariable)(octokit, repositoryId, environment, updatedVariable.name, updatedVariable.value);
|
|
781
|
+
}
|
|
782
|
+
else {
|
|
783
|
+
yield (0, github_1.updateRepositoryVariable)(octokit, repositoryId, updatedVariable.name, updatedVariable.value);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
(0, logger_1.log)(kleur_1.default.green(`Successfully updated Github secrets and variables for environment ${environment}`));
|
|
787
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Running configuration files updates'));
|
|
788
|
+
(0, templates_1.generateInventory)(environment, {
|
|
789
|
+
kube_worker_nodes: kubeWorkerNodes,
|
|
790
|
+
kube_api_host: infrastructure.kubeApiHost || '',
|
|
791
|
+
backup_host: backupHost || '',
|
|
792
|
+
users: users
|
|
793
|
+
});
|
|
794
|
+
(0, templates_1.copyChartsValues)(environment, {
|
|
795
|
+
env: environment,
|
|
796
|
+
environment_type: environment_type,
|
|
797
|
+
two_fa_enabled,
|
|
798
|
+
traefik_mode: traefikConfOption,
|
|
799
|
+
restore_enabled: restoreEnvironmentName ? true : false,
|
|
800
|
+
restore_environment_name: restoreEnvironmentName || '',
|
|
801
|
+
restore_type: restoreType,
|
|
802
|
+
restore_host: restoreHost || '',
|
|
803
|
+
backup_enabled: configureBackup ? true : false,
|
|
804
|
+
backup_type: backupType,
|
|
805
|
+
backup_host: backupHost || ''
|
|
806
|
+
});
|
|
807
|
+
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Updating workflow files'));
|
|
808
|
+
yield (0, update_workflows_1.updateWorkflowEnvironments)();
|
|
809
|
+
let addon_message = kubeWorkerNodes.length > 0 || configureBackup
|
|
810
|
+
? '--------------------------------------------------------------------------------------------\n' +
|
|
811
|
+
`\n➡️ ${kleur_1.default.bold().yellow('COPY the SSH public key from the master VM to your clipboard')}\n` +
|
|
812
|
+
'--------------------------------------------------------------------------------------------\n'
|
|
813
|
+
: '';
|
|
814
|
+
addon_message +=
|
|
815
|
+
kubeWorkerNodes.length > 0
|
|
816
|
+
? `➡️ ${kleur_1.default.bold().yellow('Run following command on Kubernetes worker VM to create provision user and setup SSH key:')}\n` +
|
|
817
|
+
'\n' +
|
|
818
|
+
'curl -sfL https://raw.githubusercontent.com/opencrvs/infrastructure/refs/heads/develop/scripts/bootstrap/opencrvs-bootstrap.sh -o opencrvs-bootstrap.sh && \\ \n' +
|
|
819
|
+
`bash opencrvs-bootstrap.sh --ssh-public-key "${kleur_1.default.bold('[PUT PROVISION USER PUBLIC KEY FROM MASTER NODE]')}"\n`
|
|
820
|
+
: '';
|
|
821
|
+
addon_message += configureBackup
|
|
822
|
+
? `\n➡️ ${kleur_1.default.bold().yellow('Run following command on backup server to create provision user and setup SSH key:')}\n` +
|
|
747
823
|
'curl -sfL https://raw.githubusercontent.com/opencrvs/infrastructure/refs/heads/develop/scripts/bootstrap/opencrvs-bootstrap.sh -o opencrvs-bootstrap.sh && \\ \n' +
|
|
748
|
-
`bash opencrvs-bootstrap.sh --ssh-public-key "${kleur_1.default.bold('[PUT PROVISION USER PUBLIC KEY FROM MASTER NODE]')}"
|
|
824
|
+
`bash opencrvs-bootstrap.sh --ssh-public-key "${kleur_1.default.bold('[PUT PROVISION USER PUBLIC KEY FROM MASTER NODE]')}"`
|
|
749
825
|
: '';
|
|
750
|
-
|
|
751
|
-
? `\n➡️ ${kleur_1.default.bold().yellow('Run following command on backup server to create provision user and setup SSH key:')}\n` +
|
|
752
|
-
'curl -sfL https://raw.githubusercontent.com/opencrvs/infrastructure/refs/heads/develop/scripts/bootstrap/opencrvs-bootstrap.sh -o opencrvs-bootstrap.sh && \\ \n' +
|
|
753
|
-
`bash opencrvs-bootstrap.sh --ssh-public-key "${kleur_1.default.bold('[PUT PROVISION USER PUBLIC KEY FROM MASTER NODE]')}"`
|
|
754
|
-
: '';
|
|
755
|
-
(0, logger_1.log)(`
|
|
826
|
+
(0, logger_1.log)(`
|
|
756
827
|
${kleur_1.default.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')}
|
|
757
828
|
Follow the steps below to complete the setup of your environment:
|
|
758
829
|
${kleur_1.default.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')}
|
|
@@ -770,6 +841,8 @@ ${addon_message}
|
|
|
770
841
|
${kleur_1.default.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')}
|
|
771
842
|
${kleur_1.default.yellow('Please KINDLY read hints above')}
|
|
772
843
|
`);
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
844
|
+
(0, logger_1.log)('\nAll secrets and variables were printed above.', kleur_1.default
|
|
845
|
+
.bold()
|
|
846
|
+
.yellow('Store them in a password manager — they are not saved to disk.'));
|
|
847
|
+
});
|
|
848
|
+
}
|