Closed Bug 475403 Opened 15 years ago Closed 15 years ago

A RHEL SysV Init Script for jobqueue.pl

Categories

(Bugzilla :: Administration, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.4

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

(Whiteboard: [es-gnome])

Attachments

(1 file, 4 obsolete files)

It would be nice to have a SysV init script for jobqueue.pl, so that it could be started as a daemon on startup and controlled by the normal sysv init tools, and all.

I can write one for RHEL, I may do that, and it could go into contrib/
Assignee: administration → mkanat
Status: NEW → ASSIGNED
Target Milestone: Bugzilla 4.0 → Bugzilla 3.4
Depends on: 509328
Attached patch v1 (obsolete) — Splinter Review
Okay, here we go! Tested this on landfill.
Attachment #393449 - Flags: review?(justdave)
Comment on attachment 393449 [details] [diff] [review]
v1

>+# chkconfig: 2345 15 85
>+# description: Bugzilla queue runner

This ^^ (for RHEL)

>+### BEGIN INIT INFO
>+# Default-Start: 3 5
>+# Default-Stop: 0 1 2 6
>+# Short-Description: Start and stop the Bugzilla queue runner.
>+# Description: The Bugzilla queue runner (jobqueue.pl) sends any mail
>+#	that Bugzilla has queued to be sent in the background. If you
>+#	have enabled the use_mailer_queue parameter in Bugzilla, you
>+#	must run this daemon.
>+### END INIT INFO

Doesn't match this ^^ (for Fedora)

I assume both still use the same runlevels, so the configs for such should probably match, too.  Upstart is dependency based, so we probably want to tell Upstart that we depend on an MTA and mysqld, and document that MTA can be removed if you use remote SMTP, and mysqld should be changed to postgres if you use Pg locally, or removed if you use a remote DB.

Start/stop order numbers for RHEL/sysvinit (the 15 and 85 above) should also be changed to start after sendmail/postfix/mysqld/postgres, and shut down before those.

>+#################
>+# Configuration #
>+#################
>+
>+# This should be the path to your Bugzilla
>+BUGZILLA=/var/www/html/bugzilla
>+# Who owns the Bugzilla directory and files?
>+USER=root
>+# If you want to pass any options to the daemon (like -d for debugging)
>+# specify it here.
>+OPTIONS=""

Probably be useful to let people override these cleanly without having to edit the script (as an assistance to packagers)

if [ -r /etc/sysconfig/bugzilla-queue ]; then
   . /etc/sysconfig/bugzilla-queue
fi
Attachment #393449 - Flags: review?(justdave) → review-
Attached patch v2 (obsolete) — Splinter Review
Okay, this addresses all the comments.
Attachment #393449 - Attachment is obsolete: true
Attachment #393456 - Flags: review?(justdave)
Comment on attachment 393456 [details] [diff] [review]
v2

>+    reload) RETVAL=3 ;;

reload is a no-op?
Attached patch v3 (obsolete) — Splinter Review
Ah yeah, thanks for catching that. :-)
Attachment #393456 - Attachment is obsolete: true
Attachment #393534 - Flags: review?(justdave)
Attachment #393456 - Flags: review?(justdave)
Comment on attachment 393534 [details] [diff] [review]
v3

- seems to be missing the documentation patch on this one that was included in the last one.

- Just realized that the pidfile usage here will break the way we have it set up on b.m.o... $BUGZILLA/data is an NFS mount shared by all of the webheads.  We run a queue runner on each webhead.  They would overwrite each others' PIDFILEs.  Probably better to drop the PIDFILE in /var/run/$NAME.pid instead
The documentation in the v2 patch also doesn't mention the potential need to remove MTA or to remove or alter mysqld depending on your system setup when using Upstart, either.
(In reply to comment #6)
> - Just realized that the pidfile usage here will break the way we have it set
> up on b.m.o... $BUGZILLA/data is an NFS mount shared by all of the webheads. 
> We run a queue runner on each webhead.  They would overwrite each others'
> PIDFILEs.  Probably better to drop the PIDFILE in /var/run/$NAME.pid instead

  The pidfile is being created by jobqueue.pl, not by bugzilla-queue. If you have that setup, it's already broken in that way.
(In reply to comment #8)
>   The pidfile is being created by jobqueue.pl, not by bugzilla-queue. If you
> have that setup, it's already broken in that way.

But the initscript is telling it where to put the pid file and could easily change the location.  And we're not using jobqueue.pl (yet), we're still using theschwartz-worker.pl from the old hack.
Depends on: 509539
Attached patch v4 (obsolete) — Splinter Review
Okay, in order to have all the functionality of jobqueue.pl, it has to be able to read its own pid file, and sometimes it has to run as a user who isn't root. With all of these requirements combined, I made a system that works. (It stores the PID in /var/run if you're root, and in Bugzilla's data/ directory if you're not.)

Also, I added an "install" and "uninstall" command to jobqueue.pl that automatically install and configure the system service for you on RHEL/Fedora.
Attachment #393534 - Attachment is obsolete: true
Attachment #393654 - Flags: review?(justdave)
Attachment #393534 - Flags: review?(justdave)
Whiteboard: [es-gnome]
Comment on attachment 393654 [details] [diff] [review]
v4

Okay, wait. I realized that I can always store the PIDFILE in /var/run, and I just have to chown it to $USER.
Attachment #393654 - Flags: review?(justdave) → review-
Attached patch v5Splinter Review
Okay, here we go. :-) I'm pretty happy with this one.
Attachment #393654 - Attachment is obsolete: true
Attachment #394629 - Flags: review?(dkl)
(In reply to comment #12)
> Created an attachment (id=394629) [details]
> v5
> 
> Okay, here we go. :-) I'm pretty happy with this one.

I have just returned from a week off so I should be able to look at this on
Monday EDT.

Dave
Comment on attachment 394629 [details] [diff] [review]
v5

Sorry, I cannot get this patch to apply cleanly in my CVS checkout. Please create new patch.

Dave
Attachment #394629 - Flags: review?(dkl) → review-
Comment on attachment 394629 [details] [diff] [review]
v5

It's dependent upon the patch from bug 509539.
Attachment #394629 - Flags: review- → review?(dkl)
Comment on attachment 394629 [details] [diff] [review]
v5

Ok, I have now had time to extensively test this and it looks good to me. I have put it through the different chkconfig tests, jobqueue.pl install/uninstall and played with the different options of /etc/sysconfig/bugzilla-queue. All functions worked as expected and queued email properly.

r=dkl
Attachment #394629 - Flags: review?(dkl) → review+
Awesome, thank you. :-)
Flags: approval3.4+
Flags: approval+
tip:

Checking in jobqueue.pl;
/cvsroot/mozilla/webtools/bugzilla/jobqueue.pl,v  <--  jobqueue.pl
new revision: 1.4; previous revision: 1.3
done
Checking in Bugzilla/JobQueue/Runner.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/JobQueue/Runner.pm,v  <--  Runner.pm
new revision: 1.5; previous revision: 1.4
done
RCS file: /cvsroot/mozilla/webtools/bugzilla/contrib/bugzilla-queue,v
done
Checking in contrib/bugzilla-queue;
/cvsroot/mozilla/webtools/bugzilla/contrib/bugzilla-queue,v  <--  bugzilla-queue
initial revision: 1.1
done


3.4:

Checking in jobqueue.pl;
/cvsroot/mozilla/webtools/bugzilla/jobqueue.pl,v  <--  jobqueue.pl
new revision: 1.2.2.2; previous revision: 1.2.2.1
done
Checking in Bugzilla/JobQueue/Runner.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/JobQueue/Runner.pm,v  <--  Runner.pm
new revision: 1.2.2.3; previous revision: 1.2.2.2
done
Checking in contrib/bugzilla-queue;
/cvsroot/mozilla/webtools/bugzilla/contrib/bugzilla-queue,v  <--  bugzilla-queue
new revision: 1.1.2.2; previous revision: 1.1.2.1
done
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.