On 5/19/17 8:40 AM, Martijn wrote:
> Hi all,
>
> Looking for advice.
>
> We're about to deploy queue-workers, which are essentially a
> shell-script which calls the PHP binary which keeps running and polling
> the jobqueue for jobs. Each website that we deploy to a server will get
> a queue-worker. These workers (there will be multiple per server) need
> to be kept running and should be started on boot, etc.
>
> Sound like an init-script for each worker would do the trick. My goal is
> to make it easy for developers to deploy new workers, i.e. they should
> be able to create a new init-script, pointing to the location of their
> shell-script, and be able to count on it getting deployed and started on
> the server.
>
> In other words:
> 1. The developer writes a shell-script called queue.sh and deploys it in
> the root of the website's directory. The shell-script starts the php cli
> binary which keeps running until it's stopped or dies for some reason.
> 2. They call a single define in our Puppet code that takes the path to
> queue.sh as a parameter and ensures the init-script is created from a
> template.
> 3. The server picks up the init-script and starts managing the service.
> 3. The init-script takes care of running the queue.sh script at boot and
> can stop/restart it when needed.
> 4. Repeat for each website.
>
> For the moment, we're on Ubuntu 14.04 so Upstart scripts would be a
> logical choice. In the future we'll move to Ubuntu 16.04, with systemd.
>
> I created a define that we can add to a node manifest. Here's an example
> of how I imagine calling this define:
>
> |
> site::queueworker {'website01':path =>'/var/www/website01/queue.sh'}
> |
>
> This drops a new Upstart init-script in /etc/init/ based on a template:
> |
> /etc/init/queue-website01.conf
> |
>
> I'm unsure if/how I can immediately use this new Upstart service in a
> service, e.g.: service {'queue-website01': ensure => running, enable =>
> true}. I mean, how do Puppet and the init system know about the new service?
>
> Will that work, or am I going about this completely the wrong way?
> Should I be using supervised or something else instead?
>
> Thanks for any advice you can give.
> Martijn
>
Hi Martin,
Suggest that you package your software. This way the init script lives
next to the other shell scripts and software necessary and not separated
between repos. You can setup a pipeline tool like Jenkins to monitor
your repo and then create and deploy packages automatically with FPM[1],
which makes creating packages really simple. This would simplify your
code quite a bit such that your queueworker define is just managing a
package and a service.
[1] - https://github.com/jordansissel/fpm/
Best regards,
-g
--
Garrett Honeycutt
@learnpuppet
Puppet Training with LearnPuppet.com
Mobile: +1.206.414.8658
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/84bf0c53-d92b-ce10-2a19-b34e15acb267%40garretthoneycutt.com.
For more options, visit https://groups.google.com/d/optout.