Skip to content
This repository was archived by the owner on Nov 29, 2024. It is now read-only.

Commit 6780399

Browse files
authored
Merge pull request #229 from vimc/vimc-7064
Add support for new servers
2 parents 71bd72d + a521997 commit 6780399

File tree

5 files changed

+115
-1
lines changed

5 files changed

+115
-1
lines changed

settings/production-v2.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"password_group": "production",
3+
"vault_address": "https://vault.dide.ic.ac.uk:8200",
4+
"instance_name": "Production",
5+
"require_clean_git": false,
6+
"notify_channel": "montagu-deploy",
7+
"port": 443,
8+
"initial_data_source": "bb8_restore",
9+
"update_on_deploy": false,
10+
"bb8_backup": false,
11+
"certificate": "production2",
12+
"include_guidance_reports": true,
13+
"clone_reports": true,
14+
"persist_data": true,
15+
"add_test_user": false,
16+
"hostname": "production2.montagu.dide.ic.ac.uk",
17+
"open_browser": false,
18+
"copy_static_files": true,
19+
"use_production_db_config": true,
20+
"enable_db_replication": true,
21+
"orderly_web_api_url": "https://production2.montagu.dide.ic.ac.uk/reports/api/v2",
22+
"use_real_diagnostic_reports": true,
23+
"email_burden_estimate_uploader": false,
24+
"fake_smtp": false
25+
}

settings/production.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"require_clean_git": false,
66
"notify_channel": "montagu-deploy",
77
"port": 443,
8-
"initial_data_source": "restore",
8+
"initial_data_source": "bb8_restore",
99
"update_on_deploy": false,
1010
"bb8_backup": true,
1111
"certificate": "production",

settings/science-v2.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"add_test_user": true,
3+
"clone_reports": true,
4+
"bb8_backup": false,
5+
"open_browser": false,
6+
"hostname": "science.montagu.dide.ic.ac.uk",
7+
"enable_db_replication": false,
8+
"include_guidance_reports": true,
9+
"vault_address": "https://vault.dide.ic.ac.uk:8200",
10+
"port": 443,
11+
"require_clean_git": false,
12+
"instance_name": "science",
13+
"certificate": "science",
14+
"password_group": "science",
15+
"initial_data_source": "bb8_restore",
16+
"notify_channel": "montagu-deploy",
17+
"update_on_deploy": true,
18+
"copy_static_files": true,
19+
"use_production_db_config": true,
20+
"persist_data": true,
21+
"orderly_web_api_url": "https://science.montagu.dide.ic.ac.uk/reports/api/v2",
22+
"use_real_diagnostic_reports": true,
23+
"email_burden_estimate_uploader": false,
24+
"fake_smtp": true
25+
}

settings/uat-v2.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"add_test_user": true,
3+
"bb8_backup": false,
4+
"certificate": "uat",
5+
"clone_reports": true,
6+
"enable_db_replication": false,
7+
"hostname": "uat.montagu.dide.ic.ac.uk",
8+
"include_guidance_reports": true,
9+
"initial_data_source": "bb8_restore",
10+
"instance_name": "uat",
11+
"notify_channel": "montagu-deploy",
12+
"open_browser": false,
13+
"password_group": "fake",
14+
"persist_data": true,
15+
"port": 443,
16+
"require_clean_git": false,
17+
"update_on_deploy": false,
18+
"copy_static_files": true,
19+
"use_production_db_config": false,
20+
"vault_address": "https://vault.dide.ic.ac.uk:8200",
21+
"orderly_web_api_url": "https://uat.montagu.dide.ic.ac.uk/reports/api/v2",
22+
"use_real_diagnostic_reports": true,
23+
"email_burden_estimate_uploader": false,
24+
"fake_smtp": true
25+
}

src/certificates.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ def get_ssl_certificate(certificate_type: str):
1818
result = production()
1919
elif certificate_type == "support":
2020
result = support()
21+
elif certificate_type == "science":
22+
result = science()
23+
elif certificate_type == "uat":
24+
result = uat()
25+
elif certificate_type == "production2":
26+
result = production2()
2127
elif certificate_type == "self_signed_fresh":
2228
result = self_signed_fresh()
2329
elif certificate_type == "self_signed":
@@ -66,6 +72,21 @@ def support():
6672
return real_certificate("support", "support.montagu.crt", "ssl/v2/support/")
6773

6874

75+
def science():
76+
print("- Using science certificate (science.montagu.dide.ic.ac.uk)")
77+
return real_certificate2("science")
78+
79+
80+
def uat():
81+
print("- Using uat certificate (uat.montagu.dide.ic.ac.uk)")
82+
return real_certificate2("uat")
83+
84+
85+
def production2():
86+
print("- Using production2 certificate (production2.montagu.dide.ic.ac.uk)")
87+
return real_certificate2("production2")
88+
89+
6990
def real_certificate(local_folder, local_name, vault_path):
7091
copy(cert_path(local_folder, local_name), paths.ssl)
7192

@@ -80,3 +101,21 @@ def real_certificate(local_folder, local_name, vault_path):
80101
"key": key_path,
81102
"dhparam": dhparam_path
82103
}
104+
105+
def real_certificate2(instance_name):
106+
vault_path = f"ssl/v2/{instance_name}/"
107+
108+
cert_path = join(paths.ssl, "ssl.cert")
109+
save_secret_to_file(vault_path + "cert", field="value", output=cert_path)
110+
111+
key_path = join(paths.ssl, "ssl.key")
112+
save_secret_to_file(vault_path + "key", field="value", output=key_path)
113+
114+
dhparam_path = join(paths.ssl, "dhparam.pem")
115+
save_secret_to_file(vault_path + "dhparam", field="value", output=dhparam_path)
116+
117+
return {
118+
"certificate": cert_path,
119+
"key": key_path,
120+
"dhparam": dhparam_path
121+
}

0 commit comments

Comments
 (0)