Skip to main content

Plugin for collective.hostout that starts and stops supervisor during deployment

Project description

Installing

hostout.supervisor is a plugin for collective.hostout. Hostout is a zc.buildout recipe.

First you need a working buildout using supervisor. Here’s a really simple one:

>>> write('buildout.cfg',
... """
... [buildout]
... parts = helloworld
...
... [helloworld]
... recipe = zc.recipe.egg:scripts
... eggs = zc.recipe.egg
... initialization = import sys
...   main=lambda: sys.stdout.write('all your hosts are below to us')
... entry-points = helloworld=__main__:main
...
... [supervisor]
... recipe = collective.recipe.supervisor
... programs = 10 helloworld bin/helloworld
...
... """)
>>> print system('bin/buildout -N')
Installing helloworld.
Generated script '/sample-buildout/bin/helloworld'.
>>> print system('bin/helloworld')
all your hosts are belong to us

Google “buildout” and your favourite app framework to find out how to build it.

Next we add hostout to our buildout, and extend hostout by adding the hostout.supervisor plugin using the extends option.

>>> write('buildout.cfg',
... """
... [buildout]
... parts = helloworld host
...
... [helloworld]
... recipe = zc.recipe.egg:scripts
... eggs = zc.recipe.egg
... initialization = import sys
...   main=lambda: sys.stdout.write('all your hosts are below to us')
... entry-points = helloworld=__main__:main
...
... [supervisor]
... recipe = collective.recipe.supervisor
... programs = 10 helloworld bin/helloworld
...
... [host]
... recipe = collective.hostout
... host = 127.0.0.1:10022
... extends = hostout.supervisor
... parts = hellowworld supervisor
...
... """)
>>> print system('bin/buildout -N')
    Updating helloworld.
    Installing host.
    Generated script '/sample-buildout/bin/hostout'.
    ...

hostout.supervisor commands

>>> print system('bin/hostout host')
    cmdline is: bin/hostout host1 [host2...] [all] cmd1 [cmd2...] [arg1 arg2...]
    Valid commands are:
    ...
       supervisorboot     : Installs supervisor into your init.d scripts in order to ensure that supervisor is started on boot
    ...
       supervisorctl      : Takes command line arguments and runs supervisorctl on the remote host
       supervisorshutdown : Shutdown the supervisor daemon
       supervisorstartup  : Start the supervisor daemon
    ...

The following options may be used:

supervisor

The name of the supervisor part to stop and restart

init.d

If set, the supervisord script will be linked into init.d so any machine restart will also start supervisor.

Automatic startup and shutdown during deployment

In addition, the supervisor plugin will shutdown supervisor during pre-deployment and start up supervisor during post-deployment.

>>> print system('bin/hostout host1 deploy')
    Hostout: Running command 'predeploy' from 'hostout.supervisor.fabfile'
    Logging into the following hosts as :
        127.0.0.1
    [127.0.0.1] sudo: /var/lib/plone/host1/bin/supervisorctl shutdown || echo 'Failed to shutdown'
    ...
    Hostout: Running command 'postdeploy' from 'hostout.supervisor.fabfile'
    ...
    [127.0.0.1] sudo: /var/lib/plone/host1/bin/supervisord
    ...
    [127.0.0.1] sudo: /var/lib/plone/host1/bin/supervisorctl status
    ...
    Hostout: Running command 'postdeploy' from 'collective.hostout.fabfile'
    ...

Credits

Dylan Jay ( software at pretaweb dot com )

Release History

1.05 (2014-05-29)

  • tidy up readme [Jean Jordaan]

  • fixed bootstrip install/uninstall [Adam Terrey]

1.0a4 (2010-04-13)

  • allows buildout user only deploy

1.0a3 (2010-03-21)

  • new sudosupervisor for when you need to boot as root [Dylan Jay]

  • Made compatible with collective.hostout 1.0a5 [Dylan Jay]

  • Improved startup and shutdown so use only buildout-user + reload rather than “supervisor shutdown” [Dylan Jay]

1.0a2 (2010-06-03)

  • falfile entrypoint

  • better init.d script

1.0a1 (2010-02-13)

  • Moved out of collective.hostout

  • upgraded it to fabric 1.0 and python 2.6

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hostout.supervisor-1.0a5.tar.gz (6.2 kB view details)

Uploaded Source

File details

Details for the file hostout.supervisor-1.0a5.tar.gz.

File metadata

File hashes

Hashes for hostout.supervisor-1.0a5.tar.gz
Algorithm Hash digest
SHA256 6ef6bb09bc764f96a670757332f21fbf79cf843ba300c5b6d32cbd6edce03dd4
MD5 2fc457e7d7cf0aadcb88a0c8914c21f4
BLAKE2b-256 44db55951b0a97036099455acbc62a6e1b98d6c739e5f338db7a66c7ebce820d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page