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
|
* Rewrite of the daemon to use Daemon::Control and MCE (cleaner netdisco
|
||||||
code and fewer deps)
|
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
|
* Version bump so that we'll be releasing odd numbered beta dists
|
||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|||||||
@@ -3,7 +3,12 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings FATAL => 'all';
|
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";
|
my $program = "$ENV{HOME}/bin/netdisco-daemon-fg";
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ say ' * Internet access';
|
|||||||
say ' * Database added to PostgreSQL for Netdisco';
|
say ' * Database added to PostgreSQL for Netdisco';
|
||||||
say ' * User added to PostgreSQL with rights to the Netdisco Database';
|
say ' * User added to PostgreSQL with rights to the Netdisco Database';
|
||||||
say ' * "environments/development.yml" file configured with Database dsn/user/pass';
|
say ' * "environments/development.yml" file configured with Database dsn/user/pass';
|
||||||
|
say ' * A full backup of any existing Netdisco database data';
|
||||||
say '';
|
say '';
|
||||||
say 'You will be asked to confirm all changes to your system.';
|
say 'You will be asked to confirm all changes to your system.';
|
||||||
say '';
|
say '';
|
||||||
|
|||||||
@@ -1,9 +1,18 @@
|
|||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
use FindBin;
|
use strict;
|
||||||
use lib "$FindBin::Bin/../lib";
|
use warnings FATAL => 'all';
|
||||||
use App::Netdisco;
|
|
||||||
|
|
||||||
use Dancer;
|
BEGIN {
|
||||||
use App::Netdisco::Web;
|
eval "use Daemon::Control";
|
||||||
dance;
|
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
|
Test the installation by running the following command, which should only
|
||||||
produce a status message (and throw up no errors):
|
produce a status message (and throw up no errors):
|
||||||
|
|
||||||
~/bin/localenv netdisco-daemon status
|
~/bin/netdisco-daemon status
|
||||||
|
|
||||||
=head1 Configuration
|
=head1 Configuration
|
||||||
|
|
||||||
@@ -126,16 +126,13 @@ from the current release of Netdisco, and apply it yourself:
|
|||||||
|
|
||||||
=head1 Startup
|
=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
|
Run the following command to start the job control daemon (port control, etc):
|
||||||
L<Dancer::Deployment> page. See also the L<plackup> documentation.
|
|
||||||
|
|
||||||
Run the following command to start the daemon:
|
DANCER_ENVDIR=~/environments ~/bin/netdisco-daemon start
|
||||||
|
|
||||||
DANCER_ENVDIR=~/environments ~/bin/localenv netdisco-daemon start
|
|
||||||
|
|
||||||
=head1 Tips and Tricks
|
=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
|
out what you're looking for in most cases. For example device names, node IP
|
||||||
or MAC addreses, VLAN numbers, and so on.
|
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 \
|
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>
|
DBIC_TRACE_PROFILE=console DBIC_TRACE=1 \
|
||||||
program instead of C<plackup netdisco-daemon>.
|
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
|
=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
|
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
|
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
|
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.
|
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
|
=head1 Caveats
|
||||||
|
|
||||||
Some sections are not yet implemented, e.g. the I<Device Module> tab.
|
Some sections are not yet implemented, e.g. the I<Device Module> tab.
|
||||||
|
|||||||
Reference in New Issue
Block a user