-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate scenario configuration from JSON to TOML
- Loading branch information
Showing
7 changed files
with
107 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Credentials section | ||
# username - will be added to the variables | ||
# password - if not provided, will use the ssh-agent | ||
# [!] will not be added to the variables | ||
[credentials] | ||
username = "my_username" | ||
password = "my_password" | ||
|
||
[server] | ||
host = "localhost" | ||
port = "22" | ||
|
||
# Execute section with steps | ||
[[execute.steps]] | ||
task = "copy_jar_to_server" | ||
|
||
[[execute.steps]] | ||
task = "stop_service" | ||
|
||
[[execute.steps]] | ||
task = "create_backup" | ||
rollback = ["start_service"] | ||
|
||
[[execute.steps]] | ||
task = "remove_current_deploy" | ||
rollback = ["restore_backup", "start_service"] | ||
|
||
[[execute.steps]] | ||
task = "deploy_new_file" | ||
rollback = ["restore_backup", "start_service"] | ||
|
||
[[execute.steps]] | ||
task = "start_service" | ||
rollback = ["restore_backup", "start_service"] | ||
|
||
# Variables section | ||
[variables] | ||
|
||
# will be prompted for input | ||
[variables.required] | ||
"path:local_jar_path" = "Local JAR Path" | ||
some_variable = "Some Variable" | ||
"path:some_other_path" = "Some Other Path" | ||
|
||
# generated by the app | ||
[variables.special] | ||
timestamp = "%Y-%m-%dT%H%M%S%:z" | ||
|
||
# plain string variables defined in this file | ||
[variables.defined] | ||
service_name = "my_service" | ||
remote_service_script_path = "/usr/local/bin/{service_name}.sh" | ||
remote_deploy_path = "/usr/local/{service_name}/{service_name}.jar" | ||
backup_path = "/u01/backup/{service_name}/{service_name}-{timestamp}.jar" | ||
remote_base_path = "/home/{username}" | ||
|
||
# Tasks section | ||
[tasks.copy_jar_to_server] | ||
type = "SftpCopy" | ||
description = "Copying new deploy file to server" | ||
source_path = "{local_jar_path}" | ||
destination_path = "{remote_base_path}/{basename:local_jar_path}" | ||
error_message = "Failed to copy new deploy file to server." | ||
|
||
[tasks.stop_service] | ||
type = "RemoteSudo" | ||
description = "Stopping the service on remote server" | ||
command = "sudo {remote_service_script_path} stop" | ||
error_message = "Failed to stop the service on the remote server." | ||
|
||
[tasks.create_backup] | ||
type = "RemoteSudo" | ||
description = "Creating backup of current deployment" | ||
command = "sudo cp -a {remote_deploy_path} {backup_path}" | ||
error_message = "Failed to create backup of the current deployment." | ||
|
||
[tasks.remove_current_deploy] | ||
type = "RemoteSudo" | ||
description = "Removing current deployment" | ||
command = "sudo rm {remote_deploy_path} -f" | ||
error_message = "Failed to remove the current deployment." | ||
|
||
[tasks.deploy_new_file] | ||
type = "RemoteSudo" | ||
description = "Deploying the new file" | ||
command = "sudo mv {remote_base_path}/{basename:local_jar_path} {remote_deploy_path}" | ||
error_message = "Failed to deploy the new file." | ||
|
||
[tasks.start_service] | ||
type = "RemoteSudo" | ||
description = "Starting the service on remote server" | ||
command = "sudo {remote_service_script_path} start" | ||
error_message = "Failed to start the service on the remote server." | ||
|
||
[tasks.restore_backup] | ||
type = "RemoteSudo" | ||
description = "Restoring backup of current deployment" | ||
command = "sudo cp -a {backup_path} {remote_deploy_path}" | ||
error_message = "Failed to restore backup of the current deployment." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters