-
Notifications
You must be signed in to change notification settings - Fork 1
Deploy
This page guides you how to deploy a release.
The drm-cli deployment has two types of deployment logs styles, decided when running the install.py:
- JSON style
- SQLite style
Note!!! for SQLite UI experience, you can install & use any client you wish.
- Storing encryption key in memory
- Deploy a release
- View deployment logs
- Exception handling
- Videos
- Next steps
In case the drm-cli was installed using encryption key, the drm_deploy.py utility can be executed only if the exact encryption key is provided.
The Encryption key can be inline provided, but can also be stored in the user account environment variables.
This way, only the user can executed the drm_deploy.py without the need to explicitly provide it inline.
To store the encryption key in a user account memory run the following command:
PowerShell
[System.Environment]::SetEnvironmentVariable("DRM_SECRET", "{enter the encryption key}", "User")Example:
[System.Environment]::SetEnvironmentVariable("DRM_SECRET", "MySecret123!", "User")
bash
Open bashrc for edit.
nano ~/.bashrcAdd the following line, save & close the file
export DRM_SECRET={enter the encryption key}Example:
export DRM_SECRET=MySecret123!
Apply the changes
source ~/.bashrcTo run the deploy, run script drm_deploy.py
python3 ./drm_deploy.pyThe drm_deploy.py does not supports an interactive mode.
This means that all of the deployment parameters are declared inline as parameters options.
This provides you the ability to automate deployments.
For instance, inline options are used in pipeline executions.
To see all optional parameters, use the -help option.
python3 ./drm_deploy.py -help-
Connection (-c, -connection)
Specifies the connection name that directs to the target instance. -
Release ID (-r, -release)
Specifies the Release ID you want to deploy. -
Encryption key (-p, -encryption_key)
Specifies the encryption key. Note!!! If the encryption key is stored in the memory, or thedrm-cliis not encrypted, no need to use this parameter option.
Nevertheless, If you wish to bypass the encryption key defined in the memory, you can use define it explicitly.
This is often used when installed more than onedrm-clion the host. -
Dryrun execution mode flag (--dryrun)
This is an optional flag that generates upgrade scripts only and does not actually runs them against the target databases. -
Deploy execution mode flag (--deploy)
This is an optional flag that generates upgrade scripts but also runs them against the target databases. -
Database alignment execution mode flag (--align)
This is an optional flag that generates upgrade script for each target database & runs it against the target database. -
Trace mode flag (--trace)
This is an optional flag that generates trace file for deep technical information of the execution.
Deployment succeeded verification
INFO - DRM {execution_mode} finished successfully!!!
INFO - ==================================
That's it! it's simple as that :)
JSON style
- In the
drm-clidirectory, browse into "deployments" folder - Identify & open the deployment log file.
The deployment log file naming convention is:
{Execution mode}_{Deployment GUID}_C{Connection name}_R{Release ID}.json - In the Root level, See the deployment final status in value of key "deployment_status_name".
- Drilldown & investigate each step to understand the deployment actions.
Note!!! The order of "start_time" & "end_time" in the json in each level represent the exact order of the deployment execution. This is important to understand since some of the actions are running asynchronously (in parallel).
To get more details on deployment fields & hierarchy, see deployment tables structure.
SQLite style
- Browse to the
drm-cliinstalled folder. - Browse into
dbfolder. - Using any SQLite client, open file
drm_db.sqlite. - Query to see the deployment final status.
SELECT d.*, ds.name
FROM deployments AS d
INNER JOIN deployment_statuses AS ds
ON ds.id = d.deployment_status_id
ORDER BY d.start_time DESC
LIMIT 1;- Drilldown & investigate deployment table to understand the deployment actions.
Note!!! The order of "start_time" & "end_time" in the json in each level represent the exact order of the deployment execution. This is important to understand since some of the actions are running asynchronously (in parallel).
To get more details on deployment fields & hierarchy, see deployment tables structure.
In case the deployment finished with an error, the drm-cli prompts a deployment failure massage.
INFO - DRM {execution_mode} failed!!!
INFO - ==================================
JSON style
Most of the time, the failure occurs due local environmental reasons, such as wrong configuration, connectivity issues to targets, etc.
In such cases, the reason can be found when investigating the drm-cli deployment logs.
- In the deployment log file, see the deployment final status in value of key "deployment_status_name".
- Also, see the value of key "error_message".
- Drilldown & investigate, in which step the error occurred.
Note!!! The error messaged is recursively sent back from target deployment in project level, up to solution level, up to deployment try level, up to deployment. This way you can know, where is the root cause for the failure & what caused it.
When the drm_deploy.py utility is executed for the first time, its drm_deploy.config has no mapping in object "locations".
"locations": []This object stores paths of 3rd' party utilities that the drm-cli utility uses under your own existing licenses.
- For Microsoft SQL Server:
-
sqlpackage.exe: Used for generating upgrade scripts (comparison-based). -
sqlcmd.exe: Used for running generated scripts.
-
- For Oracle:
-
LiquibaseorRedgate Flyway: Used for generating upgrade scripts. -
sqlplus.exe: Used for running generated scripts.
-
- For PostgreSQL:
-
LiquibaseorRedgate Flyway: Used for generating upgrade scripts. -
psql.exe: Used for running generated scripts.
-
Sometimes, the drm-cli host can have more that one version of those utilities installed.
If the drm_deploy.config has no mapping in object "locations", it runs an auto-detection of those utilities on the host recursively from root (/).
If it won't find one of them or won't have privileges, it will throw a failure message, that claims that the 3rd' party utility was not found and the deployment will not run.
Similar case, can occur, when the auto-detection detects a 3rd' party utility mismatching target instance version.
In those cases, you can manually configure the correct paths directly in the drm_deploy.config file.
To do so, replace the "locations" objects with the following JSON:
"locations": [
{
"sqlpackage_path": "{enter path}/sqlpackage.exe"
},
{
"sqlcmd_path": "{enter path}/sqlcmd"
},
{
"liquibase_path": "{enter path}/liquibase.bat"
},
{
"flyway_path": "{enter path}/flyway.cmd"
},
{
"psql_path": "{enter path}/psql.exe"
},
{
"sqlplus_path": "{enter path}/sqlplus.exe"
}
]In case the system crashes of log some technical info:
- Contact the support.
- Follow its instructions.
SQLite style
Most of the time, the failure occurs due local environmental reasons, such as wrong configuration, connectivity issues to targets, etc.
In such cases, the reason can be found when investigating the drm-cli deployment logs.
- In the deployments table, see the deployment final status.
- Also, see the value of field "error_message".
- Drilldown & investigate, in which step the error occurred.
Note!!! The error messaged is recursively sent back from target deployment in project level, up to solution level, up to deployment try level, up to deployment. This way you can know, where is the root cause for the failure & what caused it.
When the drm_deploy.py utility is executed for the first time, its drm_deploy.config has no mapping in object "locations".
"locations": []This object stores paths of 3rd' party utilities that the drm-cli utility uses under your own existing licenses.
- For Microsoft SQL Server:
-
sqlpackage.exe: Used for generating upgrade scripts (comparison-based). -
sqlcmd.exe: Used for running generated scripts.
-
- For Oracle:
-
LiquibaseorRedgate Flyway: Used for generating upgrade scripts. -
sqlplus.exe: Used for running generated scripts.
-
- For PostgreSQL:
-
LiquibaseorRedgate Flyway: Used for generating upgrade scripts. -
psql.exe: Used for running generated scripts.
-
Sometimes, the drm-cli host can have more that one version of those utilities installed.
If the drm_deploy.config has no mapping in object "locations", it runs an auto-detection of those utilities on the host recursively from root (/).
If it won't find one of them or won't have privileges, it will throw a failure message, that claims that the 3rd' party utility was not found and the deployment will not run.
Similar case, can occur, when the auto-detection detects a 3rd' party utility mismatching target instance version.
In those cases, you can manually configure the correct paths directly in the drm_deploy.config file.
To do so, replace the "locations" objects with the following JSON:
"locations": [
{
"sqlpackage_path": "{enter path}/sqlpackage.exe"
},
{
"sqlcmd_path": "{enter path}/sqlcmd"
},
{
"liquibase_path": "{enter path}/liquibase.bat"
},
{
"flyway_path": "{enter path}/flyway.cmd"
},
{
"psql_path": "{enter path}/psql.exe"
},
{
"sqlplus_path": "{enter path}/sqlplus.exe"
}
]In case the system crashes of log some technical info:
- Contact the support.
- Follow its instructions.