new scripts which self-localenv, and a daemon web server
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
* Rewrite of the daemon to use Daemon::Control and MCE (cleaner netdisco
|
||||
code and fewer deps)
|
||||
* Added daemonized version of the web-app server also using Daemon::Control
|
||||
* Version bump so that we'll be releasing odd numbered beta dists
|
||||
|
||||
[BUG FIXES]
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
use Daemon::Control;
|
||||
BEGIN {
|
||||
eval "use Daemon::Control";
|
||||
if ($@) {
|
||||
exec("$ENV{HOME}/bin/localenv", $0, @ARGV);
|
||||
}
|
||||
}
|
||||
|
||||
my $program = "$ENV{HOME}/bin/netdisco-daemon-fg";
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ say ' * Internet access';
|
||||
say ' * Database added to PostgreSQL for Netdisco';
|
||||
say ' * User added to PostgreSQL with rights to the Netdisco Database';
|
||||
say ' * "environments/development.yml" file configured with Database dsn/user/pass';
|
||||
say ' * A full backup of any existing Netdisco database data';
|
||||
say '';
|
||||
say 'You will be asked to confirm all changes to your system.';
|
||||
say '';
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin/../lib";
|
||||
use App::Netdisco;
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
use Dancer;
|
||||
use App::Netdisco::Web;
|
||||
dance;
|
||||
BEGIN {
|
||||
eval "use Daemon::Control";
|
||||
if ($@) {
|
||||
exec("$ENV{HOME}/bin/localenv", $0, @ARGV);
|
||||
}
|
||||
}
|
||||
|
||||
Daemon::Control->new({
|
||||
name => 'Netdisco Web',
|
||||
program => 'plackup',
|
||||
program_args => ["$ENV{HOME}/bin/netdisco-web-fg"],
|
||||
pid_file => "$ENV{HOME}/netdisco-web.pid",
|
||||
})->run;
|
||||
|
||||
9
Netdisco/bin/netdisco-web-fg
Executable file
9
Netdisco/bin/netdisco-web-fg
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin/../lib";
|
||||
use App::Netdisco;
|
||||
|
||||
use Dancer;
|
||||
use App::Netdisco::Web;
|
||||
dance;
|
||||
@@ -93,7 +93,7 @@ e.g. C<~netdisco/bin>:
|
||||
Test the installation by running the following command, which should only
|
||||
produce a status message (and throw up no errors):
|
||||
|
||||
~/bin/localenv netdisco-daemon status
|
||||
~/bin/netdisco-daemon status
|
||||
|
||||
=head1 Configuration
|
||||
|
||||
@@ -126,16 +126,13 @@ from the current release of Netdisco, and apply it yourself:
|
||||
|
||||
=head1 Startup
|
||||
|
||||
Run the following command to start the web server:
|
||||
Run the following command to start the web-app server as a daemon:
|
||||
|
||||
DANCER_ENVDIR=~/environments ~/bin/localenv plackup ~/bin/netdisco-web
|
||||
DANCER_ENVDIR=~/environments ~/bin/netdisco-web start
|
||||
|
||||
Other ways to run and host the web application can be found in the
|
||||
L<Dancer::Deployment> page. See also the L<plackup> documentation.
|
||||
Run the following command to start the job control daemon (port control, etc):
|
||||
|
||||
Run the following command to start the daemon:
|
||||
|
||||
DANCER_ENVDIR=~/environments ~/bin/localenv netdisco-daemon start
|
||||
DANCER_ENVDIR=~/environments ~/bin/netdisco-daemon start
|
||||
|
||||
=head1 Tips and Tricks
|
||||
|
||||
@@ -143,25 +140,35 @@ The main black navigation bar has a search box which is smart enough to work
|
||||
out what you're looking for in most cases. For example device names, node IP
|
||||
or MAC addreses, VLAN numbers, and so on.
|
||||
|
||||
For SQL debugging try the following command:
|
||||
For SQL debugging try the following commands:
|
||||
|
||||
DBIC_TRACE_PROFILE=console DBIC_TRACE=1 \
|
||||
DANCER_ENVDIR=~/environments plackup ~/bin/netdisco-web
|
||||
DANCER_ENVDIR=~/environments ~/bin/localenv plackup ~/bin/netdisco-web-fg
|
||||
|
||||
To run the job daemon in the foreground, start the C<netdisco-daemon-fg>
|
||||
program instead of C<plackup netdisco-daemon>.
|
||||
DBIC_TRACE_PROFILE=console DBIC_TRACE=1 \
|
||||
DANCER_ENVDIR=~/environments ~/bin/localenv netdisco-daemon-fg
|
||||
|
||||
Other ways to run and host the web application can be found in the
|
||||
L<Dancer::Deployment> page. See also the L<plackup> documentation.
|
||||
|
||||
With the default configuration user authentication is disabled and the default
|
||||
"guest" user has no special privilege. To grant port and device control rights
|
||||
to this user, create a row in the C<users> table of the Netdisco database with
|
||||
a username of C<guest> and the C<port_control> flag set to true:
|
||||
|
||||
netdisco=> insert into users (username, port_control) values ('guest', true);
|
||||
|
||||
=head1 Future Work
|
||||
|
||||
Bundled with this app is a L<DBIx::Class> layer for the Netdisco database.
|
||||
This could be a starting point for an "official" DBIC layer. Helper functions
|
||||
and canned searches have been added to support the web interface.
|
||||
|
||||
The intention is to support "plugins" for additonal features, most notably
|
||||
columns in the Device Port listing, but also new menu items and tabs. The
|
||||
design of this is sketched out but not implemented. The goal is to avoid
|
||||
patching core code to add localizations or less widely used features.
|
||||
|
||||
Bundled with this app is a L<DBIx::Class> layer for the Netdisco database.
|
||||
This could be a starting point for an "official" DBIC layer. Helper functions
|
||||
and canned searches have been added to support the web interface.
|
||||
|
||||
=head1 Caveats
|
||||
|
||||
Some sections are not yet implemented, e.g. the I<Device Module> tab.
|
||||
|
||||
Reference in New Issue
Block a user