rename daemon to backend in code
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package App::Netdisco::Daemon::Worker::Common;
|
||||
package App::Netdisco::Backend::Worker::Common;
|
||||
|
||||
use Dancer qw/:moose :syntax :script/;
|
||||
|
||||
use Try::Tiny;
|
||||
use App::Netdisco::Util::Daemon;
|
||||
use App::Netdisco::Util::Backend;
|
||||
|
||||
use Role::Tiny;
|
||||
use namespace::clean;
|
||||
@@ -18,7 +18,7 @@ sub worker_body {
|
||||
my $wid = $self->wid;
|
||||
|
||||
while (1) {
|
||||
prctl sprintf 'netdisco-daemon: worker #%s poller: idle', $wid;
|
||||
prctl sprintf 'netdisco-backend: worker #%s poller: idle', $wid;
|
||||
|
||||
my $job = $self->{queue}->dequeue(1);
|
||||
next unless defined $job;
|
||||
@@ -26,7 +26,7 @@ sub worker_body {
|
||||
|
||||
try {
|
||||
$job->started(scalar localtime);
|
||||
prctl sprintf 'netdisco-daemon: worker #%s poller: working on #%s: %s',
|
||||
prctl sprintf 'netdisco-backend: worker #%s poller: working on #%s: %s',
|
||||
$wid, $job->job, $job->summary;
|
||||
info sprintf "pol (%s): starting %s job(%s) at %s",
|
||||
$wid, $action, $job->job, $job->started;
|
||||
@@ -50,7 +50,7 @@ sub close_job {
|
||||
my ($self, $job) = @_;
|
||||
my $now = scalar localtime;
|
||||
|
||||
prctl sprintf 'netdisco-daemon: worker #%s poller: wrapping up %s #%s: %s',
|
||||
prctl sprintf 'netdisco-backend: worker #%s poller: wrapping up %s #%s: %s',
|
||||
$self->wid, $job->action, $job->job, $job->status;
|
||||
info sprintf "pol (%s): wrapping up %s job(%s) - status %s at %s",
|
||||
$self->wid, $job->action, $job->job, $job->status, $now;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package App::Netdisco::Daemon::Worker::Manager;
|
||||
package App::Netdisco::Backend::Worker::Manager;
|
||||
|
||||
use Dancer qw/:moose :syntax :script/;
|
||||
|
||||
use List::Util 'sum';
|
||||
use App::Netdisco::Util::Daemon;
|
||||
use App::Netdisco::Util::Backend;
|
||||
|
||||
use Role::Tiny;
|
||||
use namespace::clean;
|
||||
@@ -35,12 +35,12 @@ sub worker_body {
|
||||
my $wid = $self->wid;
|
||||
|
||||
if (setting('workers')->{'no_manager'}) {
|
||||
prctl sprintf 'netdisco-daemon: worker #%s manager: inactive', $wid;
|
||||
prctl sprintf 'netdisco-backend: worker #%s manager: inactive', $wid;
|
||||
return debug "mgr ($wid): no need for manager... quitting"
|
||||
}
|
||||
|
||||
while (1) {
|
||||
prctl sprintf 'netdisco-daemon: worker #%s manager: gathering', $wid;
|
||||
prctl sprintf 'netdisco-backend: worker #%s manager: gathering', $wid;
|
||||
my $num_slots = 0;
|
||||
|
||||
$num_slots = parse_max_workers( setting('workers')->{tasks} )
|
||||
@@ -78,7 +78,7 @@ sub worker_body {
|
||||
}
|
||||
|
||||
debug "mgr ($wid): sleeping now...";
|
||||
prctl sprintf 'netdisco-daemon: worker #%s manager: idle', $wid;
|
||||
prctl sprintf 'netdisco-backend: worker #%s manager: idle', $wid;
|
||||
sleep( setting('workers')->{sleep_time} || 1 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package App::Netdisco::Daemon::Worker::Scheduler;
|
||||
package App::Netdisco::Backend::Worker::Scheduler;
|
||||
|
||||
use Dancer qw/:moose :syntax :script/;
|
||||
|
||||
use Algorithm::Cron;
|
||||
use App::Netdisco::Util::Daemon;
|
||||
use App::Netdisco::Util::Backend;
|
||||
|
||||
use Role::Tiny;
|
||||
use namespace::clean;
|
||||
@@ -39,7 +39,7 @@ sub worker_body {
|
||||
my $wid = $self->wid;
|
||||
|
||||
unless (setting('schedule')) {
|
||||
prctl sprintf 'netdisco-daemon: worker #%s scheduler: inactive', $wid;
|
||||
prctl sprintf 'netdisco-backend: worker #%s scheduler: inactive', $wid;
|
||||
return debug "sch ($wid): no need for scheduler... quitting"
|
||||
}
|
||||
|
||||
@@ -47,11 +47,11 @@ sub worker_body {
|
||||
# sleep until some point in the next minute
|
||||
my $naptime = 60 - (time % 60) + int(rand(45));
|
||||
|
||||
prctl sprintf 'netdisco-daemon: worker #%s scheduler: idle', $wid;
|
||||
prctl sprintf 'netdisco-backend: worker #%s scheduler: idle', $wid;
|
||||
debug "sched ($wid): sleeping for $naptime seconds";
|
||||
|
||||
sleep $naptime;
|
||||
prctl sprintf 'netdisco-daemon: worker #%s scheduler: queueing', $wid;
|
||||
prctl sprintf 'netdisco-backend: worker #%s scheduler: queueing', $wid;
|
||||
|
||||
# NB next_time() returns the next *after* win_start
|
||||
my $win_start = time - (time % 60) - 1;
|
||||
|
||||
@@ -7,7 +7,7 @@ App::Netdisco::Manual::Deployment - Tips and Tricks for Deployment
|
||||
The Netdisco applications will generate RC scripts suitable for Linux systems:
|
||||
|
||||
bin/netdisco-web get_init_file
|
||||
bin/netdisco-daemon get_init_file
|
||||
bin/netdisco-backend get_init_file
|
||||
|
||||
On C<systemd>-based systems please see L<our systemd
|
||||
guide|App::Netdisco::Manual::Systemd>.
|
||||
|
||||
@@ -51,14 +51,14 @@ directory
|
||||
You might also want to set C<check_userlog> to C<false> in your config to
|
||||
quieten some of the web client callbacks.
|
||||
|
||||
For the daemon, it's very similar:
|
||||
For the backend daemon, it's very similar:
|
||||
|
||||
DBIC_TRACE=1 ~/bin/localenv bin/netdisco-daemon-fg
|
||||
DBIC_TRACE=1 ~/bin/localenv bin/netdisco-backend-fg
|
||||
|
||||
You can point at a different database without editing C<deployment.yml>:
|
||||
|
||||
NETDISCO_DBNAME=testdb DBIC_TRACE=1 ~/bin/localenv plackup -R share,lib -p 5001 bin/netdisco-web-fg
|
||||
NETDISCO_DBNAME=testdb DBIC_TRACE=1 ~/bin/localenv bin/netdisco-daemon-fg
|
||||
NETDISCO_DBNAME=testdb DBIC_TRACE=1 ~/bin/localenv bin/netdisco-backend-fg
|
||||
|
||||
It's recommended to delete the "C<~/perl5/lib/perl5/App/Netdisco>"
|
||||
directory to avoid accidentally picking up old Netdisco code. For working on
|
||||
@@ -398,7 +398,7 @@ database connection management features mentioned above.
|
||||
|
||||
The job daemon is backwards compatible with the old Netdisco database job
|
||||
requests table. All code for the job daemon lives under the
|
||||
L<App::Netdisco::Daemon> namespace and like the rest of Netdisco is broken
|
||||
L<App::Netdisco::Backend> namespace and like the rest of Netdisco is broken
|
||||
down into manageable chunks.
|
||||
|
||||
=head2 Running the Job Daemon
|
||||
@@ -407,10 +407,10 @@ Like the web application, the job daemon is fully self contained and runs via
|
||||
two simple scripts shipped with the distribution - one for foreground and one
|
||||
for background execution (see the user docs for instructions).
|
||||
|
||||
The C<netdisco-daemon> script uses L<Daemon::Control> to daemonize so you can
|
||||
The C<netdisco-backend> script uses L<Daemon::Control> to daemonize so you can
|
||||
fire-and-forget the Netdisco job daemon without much trouble at all. This
|
||||
script in turn calls C<netdisco-daemon-fg> which is the real application, that
|
||||
runs in the foreground if called on its own.
|
||||
script in turn calls C<netdisco-backend-fg> which is the real application,
|
||||
that runs in the foreground if called on its own.
|
||||
|
||||
=head2 Daemon Engineering
|
||||
|
||||
|
||||
@@ -10,21 +10,21 @@ instructions apply to your local installation and use at your own risk.
|
||||
|
||||
=head1 Files
|
||||
|
||||
=head2 C<< /etc/systemd/system/netdisco-daemon.service >>
|
||||
=head2 C<< /etc/systemd/system/netdisco-backend.service >>
|
||||
|
||||
This should be set mode 644 and owned by user and group C<root>.
|
||||
|
||||
[Unit]
|
||||
Description=Netdisco Daemon Service
|
||||
AssertFileIsExecutable=/home/netdisco/bin/netdisco-daemon
|
||||
Description=Netdisco Backend Service
|
||||
AssertFileIsExecutable=/home/netdisco/bin/netdisco-backend
|
||||
After=syslog.target network-online.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
User=netdisco
|
||||
Group=netdisco
|
||||
ExecStart=/home/netdisco/bin/netdisco-daemon start
|
||||
ExecStop=/home/netdisco/bin/netdisco-daemon stop
|
||||
ExecStart=/home/netdisco/bin/netdisco-backend start
|
||||
ExecStop=/home/netdisco/bin/netdisco-backend stop
|
||||
Restart=on-failure
|
||||
RestartSec=60
|
||||
|
||||
@@ -38,7 +38,7 @@ This should be set mode 644 and owned by user and group C<root>.
|
||||
[Unit]
|
||||
Description=Netdisco Web Service
|
||||
AssertFileIsExecutable=/home/netdisco/bin/netdisco-web
|
||||
After=syslog.target network-online.target netdisco-daemon.service
|
||||
After=syslog.target network-online.target netdisco-backend.service
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
@@ -56,15 +56,15 @@ This should be set mode 644 and owned by user and group C<root>.
|
||||
|
||||
To enable Netdisco in systemd:
|
||||
|
||||
systemctl enable netdisco-daemon.service
|
||||
systemctl enable netdisco-backend.service
|
||||
systemctl enable netdisco-web.service
|
||||
|
||||
To start Netdisco:
|
||||
|
||||
systemctl start netdisco-daemon.service
|
||||
systemctl start netdisco-backend.service
|
||||
systemctl start netdisco-web.service
|
||||
|
||||
May also need to run C<systemctl daemon-reload> depending on the order you do
|
||||
these steps.
|
||||
May also need to run C<systemctl netdisco-backend reload> depending on the
|
||||
order you do these steps.
|
||||
|
||||
=cut
|
||||
|
||||
Reference in New Issue
Block a user