From e4b7550937274790e671ae50f8ab0daae3f3f443 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Wed, 4 Nov 2009 09:24:08 +0100 Subject: [PATCH] daemons/repod -> jobd/jobd, daemons/cloned -> taskd/taskd --- INSTALL | 7 ++++--- README | 8 +++++--- daemons/README | 6 ------ install.sh | 10 +++++----- jobd/README | 5 +++++ {daemons => jobd}/gc.sh | 0 daemons/repod.sh => jobd/jobd.sh | 18 +++++++++--------- {daemons => jobd}/update.sh | 0 jobs/README | 6 +++--- {daemons => taskd}/Girocco | 0 taskd/README | 4 ++++ {daemons => taskd}/clone.sh | 2 +- daemons/cloned.pl => taskd/taskd.pl | 6 +++--- 13 files changed, 39 insertions(+), 33 deletions(-) delete mode 100644 daemons/README create mode 100644 jobd/README rename {daemons => jobd}/gc.sh (100%) rename daemons/repod.sh => jobd/jobd.sh (72%) rename {daemons => jobd}/update.sh (100%) rename {daemons => taskd}/Girocco (100%) create mode 100644 taskd/README rename {daemons => taskd}/clone.sh (97%) rename daemons/cloned.pl => taskd/taskd.pl (92%) diff --git a/INSTALL b/INSTALL index 2476437..bf0596c 100644 --- a/INSTALL +++ b/INSTALL @@ -20,10 +20,11 @@ Now, you can do the installation itself: will then install Girocco according to Girocco::Config (you might need to be root, depending on the exact settings). -If you use the mirror mode, you must make sure cloned.pl is kept running. +If you use the mirror mode or want to use the push notifications, you must +make sure taskd.pl is kept running. -At any rate, you will need to periodically call repod maintenance job that +At any rate, you will need to periodically call jobd maintenance job that will refresh mirrored repositories, but also repack all repositories. You -can either just keep repod.sh running (good if you have large amount +can either just keep jobd.sh running (good if you have large amount of repositories), or add a special invocation (advised by make install) to your crontab. diff --git a/README b/README index ace181b..4d8d2f4 100644 --- a/README +++ b/README @@ -66,12 +66,14 @@ errors. See INSTALL for details. The installation procedure (especially chroot setup) is tuned for Debian systems, elsewhere you might need to adjust few things. -You should be running repod.sh at all times - it will periodically check +You should be running jobd.sh at all times - it will periodically check all the repositories and check if any need garbage collection, but also update them if the mirroring mode is enabled. -If you enable mirror support, you must also be running cloned.pl which -will listen to clone requests and perform the actual clone operations. +If you enable mirror support or want to have push notifications, you must +also be running taskd.pl - it will listen to clone requests and perform +the actual clone operations, and listen to notification messages from +repository post-receive hooks and perform notifications. If you enable push support, you will have to run sshd as root from within the chroot setup by make install; no special setup of the sshd diff --git a/daemons/README b/daemons/README deleted file mode 100644 index c6771e7..0000000 --- a/daemons/README +++ /dev/null @@ -1,6 +0,0 @@ -Girocco-related "daemons" - programs that should be running permanently. -There are currently two daemons, other executables are helper scripts: - -* cloned.pl: Handles clone requests from the web interface -* repod.sh: Periodically updates mirrored repositories and repacks - all repositories diff --git a/install.sh b/install.sh index 68fdafd..e8e01f5 100755 --- a/install.sh +++ b/install.sh @@ -17,26 +17,26 @@ perl -I. -M$GIROCCO_CONF -e '' echo "*** Setting up basedir..." rm -fr "$cfg_basedir" mkdir -p "$cfg_basedir" -cp -a Girocco daemons gitweb html jobs toolbox apache.conf shlib.sh update-hook "$cfg_basedir" +cp -a Girocco jobd taskd gitweb html jobs toolbox apache.conf shlib.sh update-hook "$cfg_basedir" # Put the correct Config in place [ "$GIROCCO_CONF" = "Girocco::Config" ] || cp "$(echo "$GIROCCO_CONF" | sed 's#::#/#g; s/$/.pm/')" "$cfg_basedir/Girocco/Config.pm" echo "*** Preprocessing scripts..." -perl -I. -M$GIROCCO_CONF -i -pe 's/\@basedir\@/"$Girocco::Config::basedir"/g' "$cfg_basedir"/jobs/*.sh "$cfg_basedir"/daemons/*.sh "$cfg_basedir"/gitweb/*.sh "$cfg_basedir"/shlib.sh "$cfg_basedir"/update-hook +perl -I. -M$GIROCCO_CONF -i -pe 's/\@basedir\@/"$Girocco::Config::basedir"/g' "$cfg_basedir"/jobs/*.sh "$cfg_basedir"/jobd/*.sh "$cfg_basedir"/taskd/*.sh "$cfg_basedir"/gitweb/*.sh "$cfg_basedir"/shlib.sh "$cfg_basedir"/update-hook if [ -n "$cfg_mirror" ]; then - echo "--- Remember to start $cfg_basedir/daemons/cloned.pl" + echo "--- Remember to start $cfg_basedir/taskd/taskd.pl" fi if [ -n "$cfg_push" -a "$cfg_permission_control" = "Group" ]; then echo "--- Recommended crontab for root:" echo "*/2 * * * * /usr/bin/nice -n 18 /root/fixupcheck.sh # adjust frequency based on number of repos" fi -echo "--- Also remember to either start $cfg_basedir/daemons/repod.sh, or add this" +echo "--- Also remember to either start $cfg_basedir/jobd/jobd.sh, or add this" echo "--- to the crontab of $cfg_mirror_user (adjust frequency on number of repos):" -echo "*/30 * * * * /usr/bin/nice -n 18 $cfg_basedir/daemons/repod.sh -q --all-once" +echo "*/30 * * * * /usr/bin/nice -n 18 $cfg_basedir/jobd/jobd.sh -q --all-once" echo "*** Setting up repository root..." diff --git a/jobd/README b/jobd/README new file mode 100644 index 0000000..e315849 --- /dev/null +++ b/jobd/README @@ -0,0 +1,5 @@ +Girocco "job daemon" - it can either be periodically ran from crontab +(see jobs/README, fine for smaller sites) or running standalone; it +does not communicate with the outer word and simply periodically +performs various house-keeping tasks - repacking any repositories and +updating mirrored repositories. diff --git a/daemons/gc.sh b/jobd/gc.sh similarity index 100% rename from daemons/gc.sh rename to jobd/gc.sh diff --git a/daemons/repod.sh b/jobd/jobd.sh similarity index 72% rename from daemons/repod.sh rename to jobd/jobd.sh index ffc4a56..5b83a9e 100755 --- a/daemons/repod.sh +++ b/jobd/jobd.sh @@ -1,8 +1,8 @@ #!/bin/bash # -# repod - Perform Girocco maintenance jobs +# jobd - Perform Girocco maintenance jobs # -# repod is Girocco repositories maintenance servant; it periodically +# jobd is Girocco repositories maintenance servant; it periodically # checks all the repositories and updates mirrored repositories and # repacks push-repositories when needed. # @@ -20,12 +20,12 @@ export show_progress=1 # Lock setup -if [ -e /tmp/repod.lock ]; then - echo "Locked! Stale /tmp/repod.lock?" >&2 +if [ -e /tmp/jobd.lock ]; then + echo "Locked! Stale /tmp/jobd.lock?" >&2 exit 1 fi -echo $$ >/tmp/repod.lock -trap "rm /tmp/repod.lock" SIGINT SIGTERM EXIT +echo $$ >/tmp/jobd.lock +trap "rm /tmp/jobd.lock" SIGINT SIGTERM EXIT ## Single-project routine @@ -34,12 +34,12 @@ check_one_proj() { proj="$1" if [ ! -e "$cfg_reporoot/$proj.git"/.nofetch ]; then - "$cfg_basedir"/daemons/update.sh "$proj" + "$cfg_basedir"/jobd/update.sh "$proj" fi if [ -n "$show_progress" ]; then - "$cfg_basedir"/daemons/gc.sh "$proj" + "$cfg_basedir"/jobd/gc.sh "$proj" else - "$cfg_basedir"/daemons/gc.sh "$proj" 2>&1 | grep -v '^Pack.*created\.$' + "$cfg_basedir"/jobd/gc.sh "$proj" 2>&1 | grep -v '^Pack.*created\.$' fi } diff --git a/daemons/update.sh b/jobd/update.sh similarity index 100% rename from daemons/update.sh rename to jobd/update.sh diff --git a/jobs/README b/jobs/README index dade466..7fa10fb 100644 --- a/jobs/README +++ b/jobs/README @@ -10,6 +10,6 @@ to crontab and usually run the main scripts iteratively per-repository. list takes too long time when it's not cached; you should call this in an interval of about a half of the cache lifetime (by default 10min). -* daemons/repod.sh -q --all-once: You should call this to avoid - infinitely growing repositories and refresh mirrored projects if you - are not running repod all the time. +* jobd/jobd.sh -q --all-once: You should call this to avoid infinitely + growing repositories and refresh mirrored projects if you are not + running jobd all the time. diff --git a/daemons/Girocco b/taskd/Girocco similarity index 100% rename from daemons/Girocco rename to taskd/Girocco diff --git a/taskd/README b/taskd/README new file mode 100644 index 0000000..d21033e --- /dev/null +++ b/taskd/README @@ -0,0 +1,4 @@ +Girocco "task daemon" - you need to run this if you either enabled +mirroring or want to use push notifications. It listens on a socket +for requests from the CGI scripts and post-receive hooks and performs +tasks based on that. diff --git a/daemons/clone.sh b/taskd/clone.sh similarity index 97% rename from daemons/clone.sh rename to taskd/clone.sh index 193a49a..49d217c 100755 --- a/daemons/clone.sh +++ b/taskd/clone.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Invoked from daemons/cloned.pl +# Invoked from taskd/taskd.pl . @basedir@/shlib.sh diff --git a/daemons/cloned.pl b/taskd/taskd.pl similarity index 92% rename from daemons/cloned.pl rename to taskd/taskd.pl index 8678515..609537b 100755 --- a/daemons/cloned.pl +++ b/taskd/taskd.pl @@ -1,8 +1,8 @@ #!/usr/bin/perl # -# cloned - Clone repositories on request +# taskd - Clone repositories on request # -# cloned is Girocco mirroring servant; it processes requests for clones +# taskd is Girocco mirroring servant; it processes requests for clones # of given URLs received over its socket. # # When a request is received, new process is spawned that sets up @@ -93,7 +93,7 @@ while (1) { open STDOUT, ">".$Girocco::Config::reporoot."/".$name."/.clonelog" or die "cannot open clonelog: $!"; open STDERR, ">&STDOUT"; open STDIN, "