Shutdown / Startup Scripts


Matt Reider
 

Hi there,

My friend Mike and I are going to be shutting down a handful of bosh delployments in a lab tomorrow, and bringing them back to life on Monday.

We're going to bring each job down individually using

$ bosh -n stop $jobId $instanceId --hard

One by one.

We were going to use Merlin Glynn's script as a base. It shuts down and brings down CF. It is particular about the order, which is smart. We are thinking of expanding the script outwards for the deployments of Redis, MySQL, Cassandra, etc.

The script is here:

https://github.com/pivotalservices/pcf-start-stop/blob/master/pcf-start-stop.sh

Before we expand upon it, we are curious if anyone out there has already done what we are thinking and would like to share it? A crude approach that does not consider the order of the VMs, but simply loops over the output of BOSH deployments / BOSH VMs is less favorable, but might be ok in this case.


Dmitriy Kalinin
 

Related story in tracker:
https://www.pivotaltracker.com/story/show/100244046 to make bosh
stop/start/restart work on the whole deployment.

On Thu, Oct 15, 2015 at 10:53 AM, Matt Reider <mreider(a)pivotal.io> wrote:

Hi there,

My friend Mike and I are going to be shutting down a handful of bosh
delployments in a lab tomorrow, and bringing them back to life on Monday.

We're going to bring each job down individually using

$ bosh -n stop $jobId $instanceId --hard

One by one.

We were going to use Merlin Glynn's script as a base. It shuts down and
brings down CF. It is particular about the order, which is smart. We are
thinking of expanding the script outwards for the deployments of Redis,
MySQL, Cassandra, etc.

The script is here:


https://github.com/pivotalservices/pcf-start-stop/blob/master/pcf-start-stop.sh

Before we expand upon it, we are curious if anyone out there has already
done what we are thinking and would like to share it? A crude approach that
does not consider the order of the VMs, but simply loops over the output of
BOSH deployments / BOSH VMs is less favorable, but might be ok in this case.


David Ehringer
 

I recently started building something to tackle this exact same thing.
Building off java-bosh-client,
https://github.com/davidehringer/bosh-java-client, I was looking at
starting/stopping full BOSH deployments and specifically CF on a schedule
as well as a few other things. I don't have something fully baked yet but
this gist more or less shows how to do what you are looking using the
java-bosh-client directly:
https://gist.github.com/davidehringer/97dd6c6af7c57b69577d

I'm not sure if that helps you or if a Java solution meets your needs but I
thought I would share.

On Thu, Oct 15, 2015 at 1:53 PM, Matt Reider <mreider(a)pivotal.io> wrote:

Hi there,

My friend Mike and I are going to be shutting down a handful of bosh
delployments in a lab tomorrow, and bringing them back to life on Monday.

We're going to bring each job down individually using

$ bosh -n stop $jobId $instanceId --hard

One by one.

We were going to use Merlin Glynn's script as a base. It shuts down and
brings down CF. It is particular about the order, which is smart. We are
thinking of expanding the script outwards for the deployments of Redis,
MySQL, Cassandra, etc.

The script is here:


https://github.com/pivotalservices/pcf-start-stop/blob/master/pcf-start-stop.sh

Before we expand upon it, we are curious if anyone out there has already
done what we are thinking and would like to share it? A crude approach that
does not consider the order of the VMs, but simply loops over the output of
BOSH deployments / BOSH VMs is less favorable, but might be ok in this case.
--
David Ehringer
david.ehringer(a)gmail.com
603-498-9617


Matt Reider
 

Thanks David. Appreciate your sharing. Looks similar to the bash script I
shared. Also glad that BOSH tracker has a story for this.

Best,

M

On Fri, Oct 16, 2015 at 7:30 AM, David Ehringer <david.ehringer(a)gmail.com>
wrote:

I recently started building something to tackle this exact same thing.
Building off java-bosh-client,
https://github.com/davidehringer/bosh-java-client, I was looking at
starting/stopping full BOSH deployments and specifically CF on a schedule
as well as a few other things. I don't have something fully baked yet but
this gist more or less shows how to do what you are looking using the
java-bosh-client directly:
https://gist.github.com/davidehringer/97dd6c6af7c57b69577d

I'm not sure if that helps you or if a Java solution meets your needs but
I thought I would share.

On Thu, Oct 15, 2015 at 1:53 PM, Matt Reider <mreider(a)pivotal.io> wrote:

Hi there,

My friend Mike and I are going to be shutting down a handful of bosh
delployments in a lab tomorrow, and bringing them back to life on Monday.

We're going to bring each job down individually using

$ bosh -n stop $jobId $instanceId --hard

One by one.

We were going to use Merlin Glynn's script as a base. It shuts down and
brings down CF. It is particular about the order, which is smart. We are
thinking of expanding the script outwards for the deployments of Redis,
MySQL, Cassandra, etc.

The script is here:


https://github.com/pivotalservices/pcf-start-stop/blob/master/pcf-start-stop.sh

Before we expand upon it, we are curious if anyone out there has already
done what we are thinking and would like to share it? A crude approach that
does not consider the order of the VMs, but simply loops over the output of
BOSH deployments / BOSH VMs is less favorable, but might be ok in this case.


--
David Ehringer
david.ehringer(a)gmail.com
603-498-9617


--

Matthew Reider
PCF Product Manager
Pivotal
875 Howard St. 5th Fl
San Francisco CA 94103
mreider(a)pivotal.io
415.990.3740


Sean Keery <skeery@...>
 

FYI, we were recently testing Merlin's script on AWS with PCF 1.5. The
bosh stop <JOB> --hard terminates the instance as opposed to stopping it.
Using no options or --soft do not shut the vm down either.

Sean

On Mon, Oct 19, 2015 at 1:33 PM, Matt Reider <mreider(a)pivotal.io> wrote:

Thanks David. Appreciate your sharing. Looks similar to the bash script I
shared. Also glad that BOSH tracker has a story for this.

Best,

M

On Fri, Oct 16, 2015 at 7:30 AM, David Ehringer <david.ehringer(a)gmail.com>
wrote:

I recently started building something to tackle this exact same thing.
Building off java-bosh-client,
https://github.com/davidehringer/bosh-java-client, I was looking at
starting/stopping full BOSH deployments and specifically CF on a schedule
as well as a few other things. I don't have something fully baked yet but
this gist more or less shows how to do what you are looking using the
java-bosh-client directly:
https://gist.github.com/davidehringer/97dd6c6af7c57b69577d

I'm not sure if that helps you or if a Java solution meets your needs but
I thought I would share.

On Thu, Oct 15, 2015 at 1:53 PM, Matt Reider <mreider(a)pivotal.io> wrote:

Hi there,

My friend Mike and I are going to be shutting down a handful of bosh
delployments in a lab tomorrow, and bringing them back to life on Monday.

We're going to bring each job down individually using

$ bosh -n stop $jobId $instanceId --hard

One by one.

We were going to use Merlin Glynn's script as a base. It shuts down and
brings down CF. It is particular about the order, which is smart. We are
thinking of expanding the script outwards for the deployments of Redis,
MySQL, Cassandra, etc.

The script is here:


https://github.com/pivotalservices/pcf-start-stop/blob/master/pcf-start-stop.sh

Before we expand upon it, we are curious if anyone out there has already
done what we are thinking and would like to share it? A crude approach that
does not consider the order of the VMs, but simply loops over the output of
BOSH deployments / BOSH VMs is less favorable, but might be ok in this case.


--
David Ehringer
david.ehringer(a)gmail.com
603-498-9617


--

Matthew Reider
PCF Product Manager
Pivotal
875 Howard St. 5th Fl
San Francisco CA 94103
mreider(a)pivotal.io
415.990.3740
--
*Sean Keery | Advisory Solutions Architect | Pivotal Cloud Foundry
Solutions*
Mobile: 970.274.1285 | skeery(a)pivotal.io
LinkedIn: @zgrinch <http://www.linkedin.com/in/zgrinch> | Twitter: @zgrinch
<https://twitter.com/zgrinch> | Github: @skibum55
<https://github.com/skibum55>

[image: Pivotal] <http://pivotal.io>


David Ehringer
 

I believe the BOSH CPI only has operations for creating, deleting/terminating, and restarting VMs. You should end up with the same result for what you are trying to do though. It just probably takes a bit longer.