diff --git a/Netdisco/MANIFEST b/Netdisco/MANIFEST index 86ca37f3..cdcd40dd 100644 --- a/Netdisco/MANIFEST +++ b/Netdisco/MANIFEST @@ -108,8 +108,8 @@ Makefile.PL MANIFEST This list of files META.yml share/config.yml +share/environments/deployment.yml share/environments/development.yml -share/environments/production.yml share/public/500.html share/public/css/bootstrap.min.css share/public/css/font-awesome.css diff --git a/Netdisco/MANIFEST.SKIP b/Netdisco/MANIFEST.SKIP index bbb358c5..9a8949a2 100644 --- a/Netdisco/MANIFEST.SKIP +++ b/Netdisco/MANIFEST.SKIP @@ -3,7 +3,7 @@ \.pid$ \.swp$ -^share/environments/(?!production|development) +^share/environments/(?!production|development|deployment) test.pl logs/.* ^lib/auto/App/Netdisco diff --git a/Netdisco/META.yml b/Netdisco/META.yml index 436886f8..dbe531dd 100644 --- a/Netdisco/META.yml +++ b/Netdisco/META.yml @@ -19,6 +19,8 @@ no_index: - inc - share requires: + App::cpanminus: 0 + App::local::lib::helper: 0 DBD::Pg: 0 DBD::SQLite: 0 DBIx::Class: 0 @@ -31,15 +33,17 @@ requires: HTTP::Tiny: 0 JSON: 0 List::MoreUtils: 0 - MCE: 1.305 + MCE: 1.405 Net::MAC: 0 NetAddr::IP: 0 Path::Class: 0 - Plack: 0 + Plack: 1.0006 + Plack::Middleware::Expires: 0 Role::Tiny: 0 SNMP::Info: 2.11 SQL::Translator: 0 Socket6: 0 + Starman: 0 Template: 0 YAML: 0 namespace::clean: 0 diff --git a/Netdisco/Makefile.PL b/Netdisco/Makefile.PL index c668ae66..414f22d0 100644 --- a/Netdisco/Makefile.PL +++ b/Netdisco/Makefile.PL @@ -18,10 +18,11 @@ requires 'HTML::Entities' => 0; requires 'HTTP::Tiny' => 0; requires 'JSON' => 0; requires 'List::MoreUtils' => 0; -requires 'MCE' => 1.305; +requires 'MCE' => 1.405; requires 'Net::MAC' => 0; requires 'NetAddr::IP' => 0; requires 'Path::Class' => 0; +requires 'Plack' => 1.0006; requires 'Plack::Middleware::Expires' => 0; requires 'Role::Tiny' => 0; requires 'Socket6' => 0; diff --git a/Netdisco/bin/netdisco-daemon-fg b/Netdisco/bin/netdisco-daemon-fg index ecd0fdad..e00b5fb8 100755 --- a/Netdisco/bin/netdisco-daemon-fg +++ b/Netdisco/bin/netdisco-daemon-fg @@ -22,8 +22,9 @@ use App::Netdisco::Daemon::Queue ':all'; # needed to quench AF_INET6 symbol errors use NetAddr::IP::Lite ':lower'; -use MCE; use Role::Tiny::With; +use MCE::Signal '-setpgrp'; +use MCE; # set temporary MCE files' location in home directory my $home = ($ENV{NETDISCO_HOME} || $ENV{HOME}); diff --git a/Netdisco/bin/netdisco-web b/Netdisco/bin/netdisco-web index ee9ebc38..938f2d18 100755 --- a/Netdisco/bin/netdisco-web +++ b/Netdisco/bin/netdisco-web @@ -32,8 +32,8 @@ mkdir $log_dir if ! -d $log_dir; Daemon::Control->new({ name => 'Netdisco Web', - program => 'plackup', - program_args => [@args, $netdisco->stringify], + program => 'starman', + program_args => ['--disable-keepalive', @args, $netdisco->stringify], pid_file => file($home, 'netdisco-web.pid'), stderr_file => file($log_dir, 'netdisco-web.log'), stdout_file => file($log_dir, 'netdisco-web.log'), diff --git a/Netdisco/lib/App/Netdisco.pm b/Netdisco/lib/App/Netdisco.pm index 6870b745..b6a8b05c 100644 --- a/Netdisco/lib/App/Netdisco.pm +++ b/Netdisco/lib/App/Netdisco.pm @@ -19,11 +19,11 @@ BEGIN { $ENV{DANCER_APPDIR} ||= $auto->stringify; $ENV{DANCER_CONFDIR} ||= $auto->stringify; - my $test_envdir = dir($home, 'environments'); - $ENV{DANCER_ENVDIR} ||= (-f $test_envdir - ? $test_envdir->stringify : $auto->subdir('environments')->stringify); + my $test_envdir = dir($home, 'environments')->stringify; + $ENV{DANCER_ENVDIR} ||= (-d $test_envdir + ? $test_envdir : $auto->subdir('environments')->stringify); - $ENV{PLACK_ENV} ||= 'deployment'; + $ENV{DANCER_ENVIRONMENT} ||= 'deployment'; $ENV{DANCER_PUBLIC} ||= $auto->subdir('public')->stringify; $ENV{DANCER_VIEWS} ||= $auto->subdir('views')->stringify; @@ -171,8 +171,8 @@ or MAC addreses, VLAN numbers, and so on. For SQL debugging try the following commands: - DBIC_TRACE_PROFILE=console DBIC_TRACE=1 ~/bin/netdisco-web-fg - DBIC_TRACE_PROFILE=console DBIC_TRACE=1 ~/bin/netdisco-daemon-fg + DBIC_TRACE_PROFILE=console DBIC_TRACE=1 ~/bin/localenv ~/bin/netdisco-web-fg + DBIC_TRACE_PROFILE=console DBIC_TRACE=1 ~/bin/localenv ~/bin/netdisco-daemon-fg =head2 Deployment diff --git a/Netdisco/lib/App/Netdisco/Web/AuthN.pm b/Netdisco/lib/App/Netdisco/Web/AuthN.pm index 8ee84cea..e051071e 100644 --- a/Netdisco/lib/App/Netdisco/Web/AuthN.pm +++ b/Netdisco/lib/App/Netdisco/Web/AuthN.pm @@ -28,7 +28,7 @@ post '/login' => sub { my $user = schema('netdisco')->resultset('User')->find(param('username')); if ($user) { my $sum = Digest::MD5::md5_hex(param('password')); - if ($sum and $sum eq $user->password) { + if (($sum and $user->password) and ($sum eq $user->password)) { session(user => $user->username); header(Location => uri_for('/inventory')->path_query()); return; diff --git a/Netdisco/share/environments/production.yml b/Netdisco/share/environments/deployment.yml similarity index 78% rename from Netdisco/share/environments/production.yml rename to Netdisco/share/environments/deployment.yml index 81e4f52a..4a86ea43 100644 --- a/Netdisco/share/environments/production.yml +++ b/Netdisco/share/environments/deployment.yml @@ -23,7 +23,7 @@ plugins: schema_class: 'App::Netdisco::DB' dsn: 'dbi:Pg:dbname=netdisco;host=localhost' user: 'changeme' - pass: 'netdisco' + pass: 'changeme' options: RaiseError: 1 AutoCommit: 1 @@ -35,3 +35,14 @@ plugins: # also, do not forget the leading dot # domain_suffix: '.example.com' +# local settings for Netdisco poller and port changes + +mibhome: '/home/netdisco/netdisco-mibs' +mibdirs: + - cisco + - rfc + - net-snmp + +community: ['public'] +community_rw: ['private'] +