[Glass] Monit scripts [WAS] Re: Is anyone using upstart to launch stones via tODE?

Mariano Martinez Peck via Glass glass at lists.gemtalksystems.com
Tue Nov 24 18:07:29 PST 2015


I attach an example of a monit script I use. Some notes:

1) Not everybody likes to automatically restart stone if it crashed (I do
it). Some prefer a simply allow monit to throw a notification (email?) and
then take human action (recover from tranlogs?  analyze logs?  recover from
backup?  run object audit? etc etc).

2) I use my own scripts for starting/stopping a seaside gem at a given port.

3) You must change the timeout of the FastCGI parts of the monit file to
match the one in your webserver  configuration timeout for FastCGI.

4) Again, I try to keep monit file in the directory of the stone and do a
symlink to the monit directory in /etc.

5) I autogenerate these monit files as part of my "site building scripts"

6) You can change the start/stop program of the stone to use gsDevKit
`startStone` and `stopStone` and also the pid file to point to
$GS_HOME/server/stones/stoneXXX/
mmmmmmm  `startStone` does not create a pid file??? else I cannot find it...

7) There could be times where you want to put gems down (maybe for a
scheduled cleanup/maintenance) or even the stone (upgradeStone for
example). For this cases, killing monit may not be the best path. So for
all those cases, what I use is code like this:

monit unmonitor -g ${GEMSTONE_NAME} >>
$GEMSTONE_LOGDIR/${GEMSTONE_NAME}_backup.log 2>&1

The key there is "monit unmonitor -g ${GEMSTONE_NAME}"  (-g is for group).
So with the groups you can unmonitor and monitor again after you finished
doing what you wanted to do.


Cheers,

On Tue, Nov 24, 2015 at 6:23 PM, Jupiter Jones <jupiter.jones at mail.com>
wrote:

> Hi Mariano,
>
> That would be great, thanks. I have sysV and monit scripts from years ago,
> however they re pre-tODE and very application specific. Having followed
> your discussions with Dale, I’m sure your scripts will be far better
> thought out than mine :)
>
> Would you mind having them become part of the GsDevKit repo?
>
> Cheers,
>
> Jupiter
>
> On 25 Nov 2015, at 12:01 AM, Mariano Martinez Peck <marianopeck at gmail.com>
> wrote:
>
> Hi Jupiter,
>
> I have init System V (not upstart) and monit scripts. If you think this
> can help you let me know and I share them with you.
>
> Best,
>
>
> On Tue, Nov 24, 2015 at 2:18 AM, Jupiter Jones via Glass <
> glass at lists.gemtalksystems.com> wrote:
>
>> Hi All,
>>
>> I’ve been asked to setup an AWS image with GemStone and Seaside and I’m
>> planning on using tODE.
>>
>> Everything is setup, however, I’m wondering if anyone has gone through
>> the process of configuring upstart to start and stone stones?
>>
>> I’m thinking something like:
>>
>> initictl start gemstone STONE=myStoneName
>>
>> …to run the script:
>>
>> /opt/git/GsDevKit_home/startServer -b $STONE
>>
>> If anyone has had a go at this, I’d appreciate any advice, help, scripts,
>> whatever. Perhaps an addition to GsDevKit_home for those working with
>> upstart would be the place to keep these. I’ll set one up if no one has
>> done this already.
>>
>> Thanks in advance.
>>
>> Cheers,
>>
>> Jupiter
>> _______________________________________________
>> Glass mailing list
>> Glass at lists.gemtalksystems.com
>> http://lists.gemtalksystems.com/mailman/listinfo/glass
>>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
>
>


-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20151124/a72b5095/attachment.html>
-------------- next part --------------
check process stone_debrisTesting with pidfile /quuve/sites/debrisTesting/gemstone/data/debrisTesting.pid
                start program = "/quuve/sites/debrisTesting/gemstone/debrisTesting start"
                stop program = "/quuve/sites/debrisTesting/gemstone/debrisTesting stop"
                GROUP debrisTesting

check process fastcgi_40110_debrisTesting with pidfile /quuve/sites/debrisTesting/gemstone/data/FastCGI_server-40110.pid
        start program = "/quuve/sites/debrisTesting/gemstone/scripts/startSeasideGems.sh -p 40110"
        stop program = "/quuve/sites/debrisTesting/gemstone/scripts/stopSeasideGems.sh -p 40110"
                DEPENDS on stone_debrisTesting
                GROUP debrisTesting
                # Empty FastCGI request
                if failed port 40110
                  # Send FastCGI packet: version 1 (0x01), cmd FCGI_GET_VALUES (0x09)
                  # padding 8 bytes (0x08), followed by 8xNULLs padding
                  send "\0x01\0x09\0x00\0x00\0x00\0x00\0x08\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00"
                  # Expect FastCGI packet: version 1 (0x01), resp FCGI_GET_VALUES_RESULT (0x0A)
                  expect "\0x01\0x0A"
                  timeout 600 seconds
                then restart
check process fastcgi_40111_debrisTesting with pidfile /quuve/sites/debrisTesting/gemstone/data/FastCGI_server-40111.pid
        start program = "/quuve/sites/debrisTesting/gemstone/scripts/startSeasideGems.sh -p 40111"
        stop program = "/quuve/sites/debrisTesting/gemstone/scripts/stopSeasideGems.sh -p 40111"
                DEPENDS on stone_debrisTesting
                GROUP debrisTesting
                # Empty FastCGI request
                if failed port 40111
                  # Send FastCGI packet: version 1 (0x01), cmd FCGI_GET_VALUES (0x09)
                  # padding 8 bytes (0x08), followed by 8xNULLs padding
                  send "\0x01\0x09\0x00\0x00\0x00\0x00\0x08\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00"
                  # Expect FastCGI packet: version 1 (0x01), resp FCGI_GET_VALUES_RESULT (0x0A)
                  expect "\0x01\0x0A"
                  timeout 600 seconds
                then restart
check process fastcgi_40112_debrisTesting with pidfile /quuve/sites/debrisTesting/gemstone/data/FastCGI_server-40112.pid
        start program = "/quuve/sites/debrisTesting/gemstone/scripts/startSeasideGems.sh -p 40112"
        stop program = "/quuve/sites/debrisTesting/gemstone/scripts/stopSeasideGems.sh -p 40112"
                DEPENDS on stone_debrisTesting
                GROUP debrisTesting
                # Empty FastCGI request
                if failed port 40112
                  # Send FastCGI packet: version 1 (0x01), cmd FCGI_GET_VALUES (0x09)
                  # padding 8 bytes (0x08), followed by 8xNULLs padding
                  send "\0x01\0x09\0x00\0x00\0x00\0x00\0x08\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00"
                  # Expect FastCGI packet: version 1 (0x01), resp FCGI_GET_VALUES_RESULT (0x0A)
                  expect "\0x01\0x0A"
                  timeout 600 seconds
                then restart


More information about the Glass mailing list