forked from lantanagroup/link
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwipe-single-fhir.yml
56 lines (49 loc) · 1.68 KB
/
wipe-single-fhir.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Wipes a Single Postgres Database.
trigger: none
pr: none
pool:
vmImage: ubuntu-latest
variables:
db: $(DATABASE)
db_user: $(DATABASE_USER)
db_pass: $(DATABASE_PASS)
ns: $(NAMESPACE)
deploy_fhir: $(DEPLOYMENT_FHIR)
steps:
- task: Kubernetes@1
displayName: Scale Down FHIR Server
inputs:
connectionType: 'Azure Resource Manager'
azureSubscriptionEndpoint: 'NHSNLink - Pay-As-You-Go(71125262-e1d6-4961-9803-8cb376d00871)'
azureResourceGroup: 'nhsnlink-rg'
kubernetesCluster: 'nhsnlink-aks'
command: 'scale'
arguments: 'deployment $(deploy_fhir) --replicas=0 -n $(ns)'
secretType: 'dockerRegistry'
containerRegistryType: 'Azure Container Registry'
- task: AzureCLI@2
displayName: Drop Database
inputs:
azureSubscription: 'postgres-connection'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
export PGPASSWORD=$(db_pass)
psql --host=nhsnlink-db.postgres.database.azure.com --username=$(db_user) --no-password --dbname=$(db) << EOF
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
GRANT ALL ON SCHEMA public TO it;
GRANT ALL ON SCHEMA public TO public;
COMMENT ON SCHEMA public IS 'standard public schema created by script';
EOF
- task: Kubernetes@1
displayName: Scale up FHIR server
inputs:
connectionType: 'Azure Resource Manager'
azureSubscriptionEndpoint: 'NHSNLink - Pay-As-You-Go(71125262-e1d6-4961-9803-8cb376d00871)'
azureResourceGroup: 'nhsnlink-rg'
kubernetesCluster: 'nhsnlink-aks'
command: 'scale'
arguments: 'deployment $(deploy_fhir) --replicas=1 -n $(ns)'
secretType: 'dockerRegistry'
containerRegistryType: 'Azure Container Registry'