-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.py
43 lines (34 loc) · 1.34 KB
/
deploy.py
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
import os
import subprocess
# Login to Docker registry
subprocess.run(['docker', 'login', '-u', 'ajayrajqure', '-p', 'zpsbS8BR2Q'])
# Backup PostgreSQL databases
print("taking backups of cxr and apihub")
# subprocess.run(['bash', 'pgbackup.sh'])
# Change YAML and ENV files
print("changing yml and env files")
# os.chdir('/qureupdate/misc')
# subprocess.run(['python3', 'envchange.py'])
# subprocess.run(['python3', 'ymlchange.py'])
# Remove previous Docker containers
print("removing previous dockers")
# ps_output = subprocess.run(['docker', 'ps', '-a'], stdout=subprocess.PIPE)
# for container_id in ps_output.stdout.decode().split('\n')[1:-1]:
# subprocess.run(['docker', 'rm', '-f', container_id.split()[0]])
# Deploy Docker containers
# os.chdir('/qureupdate')
print("deploying containers")
# subprocess.run(['bash', 'deploy-cxr.sh'])
# subprocess.run(['bash', 'deploy-gateway.sh'])
# subprocess.run(['bash', 'deploy-monitoring.sh'])
# Restore PostgreSQL databases
print("restoring database")
# os.chdir('/qureupdate/misc')
# subprocess.run(['bash', 'pgrestore.sh'])
# os.chdir('/qureupdate')
# subprocess.run(['bash', 'migrations-commit.sh'])
# subprocess.run(['docker', 'logout'])
# Send notification about installation completion
# os.chdir('/qureupdate')
# subprocess.run(['python3', 'notification.py', 'installation completed'])
print("sucess")