# Sequencing node operations - db, multiple apps

**URL:** <https://discourse.chef.io/t/sequencing-node-operations-db-multiple-apps/3084>\
**Category:** Chef Infra (archive)\
**Created:** [August 5, 2012, 5:42pm UTC](https://discourse.chef.io/t/sequencing-node-operations-db-multiple-apps/3084 "2012-08-05T17:42:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesse\_Campbell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jesse_campbell/32/251_2.png) [@Jesse\_Campbell](https://discourse.chef.io/u/Jesse_Campbell)\
**Post date:** [August 5, 2012, 5:42pm UTC](https://discourse.chef.io/t/sequencing-node-operations-db-multiple-apps/3084/1 "2012-08-05T17:42:17Z")

</div>

Hello again!  
This one has probably already been discussed, and apologies if that is  
the case, but I have a situation where I have a single DB master/slave  
cluster, and between 2 and 4 application nodes pointing at the DB  
cluster.

I can run DB updates/migrations from the DB server, or from one of the  
application servers, location doesn’t particularly matter.  
However… I need sequencing to be correct to avoid the app breaking  
itself or the DB.

1. Before the DB migrations start, _all_ of the app nodes need to have  
stopped (tomcat app)
2. Before the app servers start back up, _all_ of the db migrations  
need to have completed.

I can add something to the tomcat startup that causes it to wait for a  
schema version to show up in the database, which satisfies condition  
2… but it isn’t the cleanest method.  
I can have the db server run the migrations, refusing to do it until a  
search for app servers reveals that they are all running the expected  
version…

Or is there some newfangled cookbook that tracks things through  
attributes and search that automagically keeps everything in sync?  
It would need to only handle the sync, and not be like application  
that handles everything, as our app doesn’t currently fit the mold  
covered by application…

---

<div class="post-metadata">

**Author:** ![Ranjib\_Dey](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@Ranjib\_Dey](https://discourse.chef.io/u/Ranjib_Dey)\
**Post date:** [August 5, 2012, 8:29pm UTC](https://discourse.chef.io/t/sequencing-node-operations-db-multiple-apps/3084/2 "2012-08-05T20:29:19Z")

</div>

What you need is an orchestrator that can dispatch chef-client runs or  
special ssh commands across nodes in certain order. I'll suggest using  
mcollective or something similar (i use champu for the same  
[https://github.com/ranjibd/champu](https://github.com/ranjibd/champu), but its very primitive as of now).

On Sun, Aug 5, 2012 at 11:12 PM, Jesse Campbell [hikeit@gmail.com](mailto:hikeit@gmail.com) wrote:

> Hello again!  
> This one has probably already been discussed, and apologies if that is  
> the case, but I have a situation where I have a single DB master/slave  
> cluster, and between 2 and 4 application nodes pointing at the DB  
> cluster.
> 
> I can run DB updates/migrations from the DB server, or from one of the  
> application servers, location doesn't particularly matter.  
> However... I need sequencing to be correct to avoid the app breaking  
> itself or the DB.
> 
> 1. Before the DB migrations start, _all_ of the app nodes need to have  
> stopped (tomcat app)
> 2. Before the app servers start back up, _all_ of the db migrations  
> need to have completed.
> 
> I can add something to the tomcat startup that causes it to wait for a  
> schema version to show up in the database, which satisfies condition  
> 2... but it isn't the cleanest method.  
> I can have the db server run the migrations, refusing to do it until a  
> search for app servers reveals that they are all running the expected  
> version...
> 
> Or is there some newfangled cookbook that tracks things through  
> attributes and search that automagically keeps everything in sync?  
> It would need to only handle the sync, and not be like application  
> that handles everything, as our app doesn't currently fit the mold  
> covered by application...
