Database Upgradability
The MSF introduces the APPINIT component to support database upgradability.
Install
If the MS is a new installation for the client, the APPINIT component helps create the tables in the database. All the scripts that create tables are available as part of the package under the database/scripts/install folder.
Upgrade
The below versions support the upgrade to 202301 and higher versions:
- 202110-202204
- 202204-202207
- 202207-202210
- 202210-202301
The client can upgrade from 202110 , 202204 , 202207 , 202210 to 202301 and higher versions. All the scripts in database upgrades are committed to the source and are part of the package under the database/scripts/migration folder.
The APPINIT Component identifies whether it is a new installation or an existing database upgrade using the environment property.
K8/AKS/EKS
A new Container – the APPINIT, is introduced in 202301 to upgrade the client's existing database. The APPINIT pod supports the following properties:
env:
- name: database.key
value: {{ .Values.env.sqlinit.databaseKey }}
- name: database.name
value: {{ .Values.env.sqlinit.databaseName }}
- name: db.driver.name
value: {{ .Values.env.sqlinit.dbdriver }}
- name: db.dialect
value: {{ .Values.env.sqlinit.dbdialect }}
- name: db.connection.url
value: {{ .Values.env.sqlinit.dbconnectionurl }}
- name: db.auto.upgrade
value: {{ .Values.env.sqlinit.dbautoupgrade | quote }}
- name: temn.msf.database.auto.upgrade
value: {{ .Values.env.sqlinit.dbautoupgrade | quote }}
- name: temn.msf.logger.exportType
value: {{ .Values.env.sqlinit.exportType }}
- name: temn.msf.logger.socketHost
value: {{ .Values.env.sqlinit.socketHost | quote }}
- name: temn.msf.logger.socketPort
value: {{ .Values.env.sqlinit.socketPort | quote }}
- name: spring.profiles.active
value: {{ .Values.env.sqlinit.springProfile }}
{{- if eq .Values.env.dbcred "Y" }}
- name: db.username
valueFrom:
secretKeyRef:
name: appinitsecret
key: USER_NAME
- name: db.password
valueFrom:
secretKeyRef:
name: appinitsecret
key: PASSWORD
{{ else }}
- name: db.username
value: {{ .Values.env.sqlinit.dbusername }}
- name: db.password
value: {{ .Values.env.sqlinit.dbpassword }}
{{- end }}
restartPolicy: {{ .Values.restartPolicy }}
Azure
A new APP function, is introduced for the APPINIT component.
Run the below APP function to upgrade the database.
https://${APPINIT_NAME}.azurewebsites.net/api/v1.0.0/dbmigration?code=${MASTER_KEY}
The APP function supports the following properties:
--settings DATABASE_NAME=$DATABASE_NAME DB_CONNECTION_URL=$DB_CONNECTION_URL DRIVER_NAME=$DRIVER_NAME DIALECT=$DIALECT DB_PASSWORD=$DB_PASSWORD DB_USERNAME=$DB_USERNAME DATABASE_KEY="sql" temn_msf_name=$MSF_NAME tem_msf_disableInbox=$TEM_APPINIT_DISABLEINBOX temn_msf_security_authz_enabled=$APPINIT_AUTHZ_ENABLED temn_msf_database_auto_upgrade=$DB_AUTO_UPGRADE JPA_ENABLED=$JPA_ENABLED MIN_POOL_SIZE=1 MAX_POOL_SIZE=10
AWS
The APPINIT component creates the Lambda function and the API Gateway for the campaign-initiate-db and campaign-get-app init-status.
Run the below API to upgrade the database.
https://${restAPIId}.execute-api.$AWS_REGION.amazonaws.com/ms-campaign-api/v2.0.0/migration -H "x-api-key: ${apiKeyValue}"
The Lamda function supports the following properties:
--environment Variables=\{DRIVER_NAME=com.mysql.jdbc.Driver,DIALECT=org.hibernate.dialect.MySQL5InnoDBDialect,HOST=${host},PORT=${port},DATABASE_NAME=${dbname},DB_USERNAME=root,DB_PASSWORD=campaignroot,DB_CONNECTION_URL=jdbc:mysql://${host}:${port}/campaign,DATABASE_KEY=sql,temn_msf_security_authz_enabled=false,className_initiateDbMigration=com.temenos.microservice.framework.dbmigration.core.InitiateDbMigrationImpl,class_inbox_dao=com.temenos.microservice.framework.core.inbox.InboxDaoImpl,class_outbox_dao=com.temenos.microservice.framework.core.outbox.OutboxDaoImpl,tem_msf_disableInbox=true,temn_msf_database_auto_upgrade=N,MIN_POOL_SIZE=5,MAX_POOL_SIZE=10,JPA_ENABLED=none\}
In this topic