Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Opsautomator Jira Start/Stop #19

Open
maniviswa opened this issue Mar 18, 2019 · 7 comments
Open

Opsautomator Jira Start/Stop #19

maniviswa opened this issue Mar 18, 2019 · 7 comments

Comments

@maniviswa
Copy link

We have a issue in start/stop jira server. It is said that the jira service were not shutdown properly because of that we are facing issues wil reboot. Help us to resolve it

@arieleeuw
Copy link

Does jira require to stop proceses before shutting down an instance?
Any data on ephemeral volume?
Starting after a stop is technically not a reboot. The ephemeral drive has been replaced.

@maniviswa
Copy link
Author

maniviswa commented Mar 19, 2019

Yes before shutting down all process should be a graceful shutdown and volume is EBS. Its a weekly shutdown to save cost for some servers.

Note: We are shutting down the Jira server through opsautomator.

@arieleeuw
Copy link

When stopping an instance EC2 will shutdown the server and I expect that the shutdown of Jira might not have been completed in time. As the EC2 does not have insight on what applications running on your instance it is not aware of if the application has been shutdown in time. In Ops Automator 2 we have an action that can execute commands on LInux/Windows host and then based on the result it can set a tag on that instance when it has successfully completed the (shutdown) script. The event of setting this tag can then trigger the task to stop the instance.

@maniviswa
Copy link
Author

Thanks, Could you please let me know how to do that please?

@arieleeuw
Copy link

First you have to create a task, for example with the name StopMyApplications, for the SsmRunCommand action, that has a cron expression in the task interval parameter that runs the action when you want to initiate the stop of the instance.
In the Linux or PowerShell commands parameter specify the command or scripts you need to execute to stop your applications. See https://docs.aws.amazon.com/systems-manager/latest/userguide/execute-remote-commands.html on how to setup the SSM agent on your instance. Make sure that the command returns an error if the applications were not stopped successfully.
In the tagging section, set the I stance tags success" parameter to a value like "StopTime={datetime},StoppedBy={task}
These tags will be set on the instance if the script that stops (and checks) you application executed without errors.

Create a tag OpsAutomatorTaskList=StopMyApplications, now the task runs at the specified time, and when the command are executed successfully it tags the instance with the specified tags
(optionally you could add the name of task to the list like StartMyInstance that refers to a task that will start your server at a specific time)

The create a task for the Ec2StopInstance Action, for example with a name StopMyInstance.
Do NOT set an interval for this Task interval for this task. Set the Tag Filter to (StopTime=*)&(StoppedBy=StopMyApplications)
This tag filter expression makes the action select instances that have a tag named "StoppedBy" with a value of "StopMyApplications" AND do have a tag named "StopTime" with any value. (it is not using the list of tasks in the OpsAutomatorTaskList value, instead it is using the tag filter to select the instance)

In the section Ec2 tag change events set the value of parameter "Tag changed for EC2 instance" to "Yes"
This task will react to the event when the tags on that instance are modified, and will execute if the tags of the instance match the tags as specified in the tag filter expression. This event will happen when the StopMyApplications task did successfully ran the tasks to stop the applications on your instance.

StopMyApplications->Runs scripts->Sets Tags if successfully stoped applications
StopMyInstance->Reacts to modified tags->Filters on tag values -> Stops instance

Hope this helps

@maniviswa
Copy link
Author

Many Thanks, Let me check and update you.

@maniviswa
Copy link
Author

Hello...Did we get the release of opsautomator? Any idea when it will get released...Thanks for your help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants