Initializing and Restoring: Difference between revisions
No edit summary |
|||
| Line 16: | Line 16: | ||
Simply use the [[REST_Endpoints#GET_a_configuration | SystemRestore]] REST Endpoint or the [http://obsidianscheduler.com/obsidianapi/com/carfey/ops/api/embedded/SystemRestoreManager.html#getConfiguration() SystemRestoreManager.getConfiguration()] Embedded API to retrieve a [http://obsidianscheduler.com/obsidianapi/com/carfey/ops/api/bean/system/restore/SystemRestoreConfiguration.html SystemRestoreConfiguration]. Store the JSON representation in your backup media. | Simply use the [[REST_Endpoints#GET_a_configuration | SystemRestore]] REST Endpoint or the [http://obsidianscheduler.com/obsidianapi/com/carfey/ops/api/embedded/SystemRestoreManager.html#getConfiguration() SystemRestoreManager.getConfiguration()] Embedded API to retrieve a [http://obsidianscheduler.com/obsidianapi/com/carfey/ops/api/bean/system/restore/SystemRestoreConfiguration.html SystemRestoreConfiguration]. Store the JSON representation in your backup media. | ||
=== Transfer a configuration === | === Transfer a configuration === | ||
Follow the [Backup] instructions. Using the JSON, you can either place it on the filesystem with the invoke against the [[REST_Endpoints#PUT_a_configuration | SystemRestore]] REST Endpoint or the [http://obsidianscheduler.com/obsidianapi/com/carfey/ops/api/embedded/SystemRestoreManager.html#updateConfiguration() SystemRestoreManager.updateConfiguration()] Embedded API to retrieve a [http://obsidianscheduler.com/obsidianapi/com/carfey/ops/api/bean/system/restore/SystemRestoreConfiguration.html SystemRestoreConfiguration] | Follow the [[Backup]] instructions. Using the JSON, you can either place it on the filesystem with the invoke against the [[REST_Endpoints#PUT_a_configuration | SystemRestore]] REST Endpoint or the [http://obsidianscheduler.com/obsidianapi/com/carfey/ops/api/embedded/SystemRestoreManager.html#updateConfiguration() SystemRestoreManager.updateConfiguration()] Embedded API to retrieve a [http://obsidianscheduler.com/obsidianapi/com/carfey/ops/api/bean/system/restore/SystemRestoreConfiguration.html SystemRestoreConfiguration] | ||
== JSON Format / Configuration Items == | == JSON Format / Configuration Items == | ||
Revision as of 21:48, 29 January 2015
As of Obsidian 3.0.0
At times, you may wish to perform initialization, backup or restoration of an Obsidian configuration. For example, you may wish to take a known good configuration from a development environment and apply it to a test environment.
In Obsidian 3.0.0, we introduce an expansion of our Initializing Job Schedules support that leverages the System Restore functionality of our API.
The Obsidian API ( Embedded or REST) exposes individual functions for retrieving and updating the entire breadth of an Obsidian Configuration. Rather than require you to individually retrieve all the configuration items and then apply them elsewhere, we now introduce a system wide snapshot of an entire Obsidian Configuration combined with JSON formatted file-based initialization allowing for easy backups and restores.
By default, Obsidian will look for a file on the classpath named /obsidianInitialization.json. You may override the classpath resource name using the system property obsidianInitClasspath. For example, you could add the java system property -DobsidianInitClasspath=/com/mycompany/obsidianInit.json. You can also use a file-based resource by using the system property obsidianInitFile. For example, you could add the java system property -DobsidianInitFile=/var/obsidian-3.0.0/obsidianScheduleInitialization.json.
Note: Initialization only runs on scheduler instances. This means that a standalone Obsidian web application with no scheduler running will not do any initialization based on the presence of the appropriate JSON file.
Use Cases
Backup
Simply use the SystemRestore REST Endpoint or the SystemRestoreManager.getConfiguration() Embedded API to retrieve a SystemRestoreConfiguration. Store the JSON representation in your backup media.
Transfer a configuration
Follow the Backup instructions. Using the JSON, you can either place it on the filesystem with the invoke against the SystemRestore REST Endpoint or the SystemRestoreManager.updateConfiguration() Embedded API to retrieve a SystemRestoreConfiguration
JSON Format / Configuration Items
The file format is a JSON serialized version of the SystemRestoreConfiguration class. Here we will define each configuration item
Jobs
The "jobs" key has a list of JobSaveRequest classes. Each of these represents a configured job in Obsidian.
{
"jobs" : [
{
"jobClass": "com.carfey.ops.job.maint.LogCleanupJob",
"nickname": "Daily Debug Log Cleanup",
"recoveryType": "NONE",
"state": "ENABLED",
"schedule": "@daily",
"parameters": [
{
"name": "level",
"type": "STRING",
"value": "DEBUG"
},
{
"name": "maxAgeDays",
"type": "INTEGER",
"value": "7"
}
]
},
{
"jobClass": "com.carfey.ops.job.maint.LogCleanupJob",
"nickname": "Weekly Info Log Cleanup",
"recoveryType": "NONE",
"state": "ENABLED",
"schedule": "@weekly",
"parameters": [
{
"name": "level",
"type": "STRING",
"value": "INFO"
},
{
"name": "maxAgeDays",
"type": "INTEGER",
"value": "30"
}
]
}
]
}