[AB-xxx] restructuring installer module to be outside of maven

split liquibase and template deployment
adding various features to the deployment images
This commit is contained in:
Sheldan
2023-08-27 19:18:12 +02:00
parent b7c427026d
commit bba0a2ace6
23 changed files with 186 additions and 164 deletions

View File

@@ -0,0 +1,50 @@
import json
import os
import sys
import templates_deploy
from zipfile import ZipFile
use_folder = False
local_folder = None
config_dir = sys.argv[1]
if len(sys.argv) == 3:
use_folder = True
local_folder = sys.argv[2]
class DbConfig:
def __init__(self):
self.host = os.getenv('DB_HOST')
self.port = os.getenv('DB_PORT')
self.database = os.getenv('DB_NAME')
self.user = os.getenv('DB_USER')
self.password = os.getenv('DB_PASS')
self.scheme = os.getenv('DB_SCHEME')
db_config = DbConfig()
if not use_folder:
print("Not deploying with folder.")
print("Loading versions.")
with open(config_dir + 'artifact_versions.json') as artifact_config_file:
artifact_config = json.load(artifact_config_file)
print("Deploying templates.")
for template_artifact in artifact_config['template_artifacts']:
folder_name = config_dir + '/' + template_artifact + "-templates"
os.mkdir(folder_name)
with ZipFile(config_dir + 'templates/' + template_artifact + '.zip', 'r') as template_zip:
template_zip.extractall(folder_name)
templates_deploy.deploy_template_folder(db_config, folder_name)
print("Deploying translation templates")
for template_artifact in artifact_config['translation_artifacts']:
folder_name = config_dir + '/' + template_artifact + "-translations"
with ZipFile(config_dir + 'translations/' + template_artifact + '.zip', 'r') as template_zip:
template_zip.extractall(folder_name)
templates_deploy.deploy_template_folder(db_config, folder_name)
if use_folder:
print("Only deploying folder.")
templates_deploy.deploy_template_folder(db_config, local_folder)