diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2d07e7c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM centos/httpd-24-centos7 + +USER 0 + +COPY conf/globalnoc-public-el7.repo /etc/yum.repos.d/globalnoc-public-el7.repo + +RUN yum makecache +RUN yum -y install epel-release + +RUN yum -y install perl-Template-Toolkit perl-XML-Parser perl-XML-Simple perl-CGI-Ajax perl-Time-ParseDate perl-Net-Telnet perl-Expect perl-GRNOC-TL1 perl-GRNOC-Config perl-Class-Accessor perl-YAML perl-JSON perl-Log-Log4perl +RUN yum -y install perl-GRNOC-WebService perl-GRNOC-WebService-Client perl-Test-Deep perl-Test-Exception perl-Test-Pod perl-Test-Pod-Coverage perl-Devel-Cover perl-Data-Dumper perl-Test-Harness perl-Test-Simple openssh-clients + +COPY conf/routerproxy.conf /etc/httpd/conf.d/routerproxy.conf +COPY conf/mappings.xml /etc/grnoc/routerproxy/mappings.xml +COPY conf/logging.conf /etc/grnoc/routerproxy/logging.conf +COPY conf/routerproxy.yaml /etc/grnoc/routerproxy/routerproxy.yaml + +COPY lib/GRNOC /usr/share/perl5/vendor_perl/GRNOC +COPY templates /usr/share/grnoc/routerproxy/templates +COPY webroot /usr/share/grnoc/routerproxy/www + +RUN mkdir -p /var/log/grnoc/routerproxy +RUN touch /var/log/grnoc/routerproxy/routerproxy.log +RUN chown 1001:1001 /var/log/grnoc/routerproxy/routerproxy.log + +USER 1001 + +# TODO Make ENTRYPOINT +CMD run-httpd diff --git a/Makefile.PL b/Makefile.PL index 93b926b..a33d05b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -8,12 +8,11 @@ WriteMakefile( NAME => 'grnoc-routerproxy', AUTHOR => 'GRNOC Software Engineering ', VERSION_FROM => 'lib/GRNOC/RouterProxy.pm', - PL_FILES => {}, - PREREQ_PM => { - }, - dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, - clean => { FILES => 'grnoc-routerproxy-*.gz' }, - ); + PL_FILES => {}, + PREREQ_PM => {}, + dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, + clean => { FILES => 'grnoc-routerproxy-*.gz' }, +); sub MY::test { q( @@ -34,4 +33,6 @@ BUILD_NUMBER ?= 1 rpm: dist rpmbuild -ta grnoc-routerproxy-$(VERSION).tar.gz --define="_buildno ${BUILD_NUMBER}" +container: + docker build . -f Dockerfile -t routerproxy:$(VERSION) END diff --git a/conf/globalnoc-public-el7.repo b/conf/globalnoc-public-el7.repo new file mode 100644 index 0000000..dc0f74b --- /dev/null +++ b/conf/globalnoc-public-el7.repo @@ -0,0 +1,6 @@ +[globalnoc-public-el7] +name=GlobalNOC Public el7 - $basearch +baseurl=https://repo-public.grnoc.iu.edu/repo/7/$basearch +enabled=1 +gpgcheck=1 +gpgkey=https://repo-public.grnoc.iu.edu/repo/RPM-GPG-KEY-GRNOC7 diff --git a/conf/logging.conf b/conf/logging.conf index c543bb7..065be51 100644 --- a/conf/logging.conf +++ b/conf/logging.conf @@ -1,11 +1,15 @@ -log4perl.logger.GRNOC.RouterProxy = INFO, SYSLOG -log4perl.logger.GRNOC.RouterProxy.Generator = INFO, SYSLOG -log4perl.logger = DEBUG, SYSLOG +log4perl.logger.GRNOC.RouterProxy = INFO, Screen +log4perl.logger.GRNOC.RouterProxy.Generator = INFO, Screen +log4perl.logger = DEBUG, Screen # Logs against only the most specific category log4perl.oneMessagePerAppender = 1 -log4perl.appender.SYSLOG = Log::Dispatch::Syslog +log4perl.appender.Screen = Log::Log4perl::Appender::Screen +log4perl.appender.Screen.stderr = 0 +log4perl.appender.Screen.layout = Log::Log4perl::Layout::SimpleLayout + +log4perl.appender.SYSLOG = Log::Dispatch::Syslog log4perl.appender.SYSLOG.facility = LOCAL0 -log4perl.appender.SYSLOG.layout = PatternLayout +log4perl.appender.SYSLOG.layout = PatternLayout log4perl.appender.SYSLOG.layout.ConversionPattern=[%d] %p %F %L %c - %m%n diff --git a/conf/mappings.xml b/conf/mappings.xml index 649cb4e..3ecc708 100755 --- a/conf/mappings.xml +++ b/conf/mappings.xml @@ -1,10 +1,3 @@ - - - - - + - diff --git a/conf/routerproxy.conf b/conf/routerproxy.conf index 8b2f699..73f71b9 100755 --- a/conf/routerproxy.conf +++ b/conf/routerproxy.conf @@ -1,8 +1,6 @@ -Alias /iu-cni /gnoc/routerproxy/webroot -Alias /gigapop /gnoc/routerproxy/webroot -Alias /routerproxy /gnoc/routerproxy/webroot +Alias / /usr/share/grnoc/routerproxy/www/ - + Satisfy Any Allow from all AddHandler cgi-script .cgi diff --git a/conf/routerproxy.yaml b/conf/routerproxy.yaml index 6b1b683..d06fd19 100644 --- a/conf/routerproxy.yaml +++ b/conf/routerproxy.yaml @@ -280,7 +280,7 @@ device_group: display: 1 name: Optical Gear frontend: - dropdown: 1 + dropdown: 0 help: 'Note: some text that does not contain greater/less than sign' network_name: My Network noc_mail: My Email Address diff --git a/templates/index.tt b/templates/index.tt index 31ce384..4f8f0ef 100644 --- a/templates/index.tt +++ b/templates/index.tt @@ -20,9 +20,11 @@ [% FOREACH group IN groups %]
- + + +
- +
[% FOREACH device = group.devices -%] [% IF loop.index % 3 == 0 %]