Skip to content

Commit

Permalink
Merge pull request #25 from jonstout/routerproxy-docker
Browse files Browse the repository at this point in the history
add docker container
  • Loading branch information
jonstout authored Oct 11, 2021
2 parents 749560d + eeb1ae8 commit 5b3bd7b
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 26 deletions.
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
13 changes: 7 additions & 6 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ WriteMakefile(
NAME => 'grnoc-routerproxy',
AUTHOR => 'GRNOC Software Engineering <[email protected]>',
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(
Expand All @@ -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
6 changes: 6 additions & 0 deletions conf/globalnoc-public-el7.repo
Original file line number Diff line number Diff line change
@@ -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
14 changes: 9 additions & 5 deletions conf/logging.conf
Original file line number Diff line number Diff line change
@@ -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
9 changes: 1 addition & 8 deletions conf/mappings.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
<mappings version="1">

<map regexp="^\/.*iu-cni"
config_location="/etc/grnoc/routerproxy/iu-cni/config.yaml" />

<map regexp="^\/.*gigapop"
config_location="/etc/grnoc/routerproxy/gigapop/config.yaml" />

<map regexp="^\/" config_location="/etc/grnoc/routerproxy/routerproxy.yaml" />
</mappings>

6 changes: 2 additions & 4 deletions conf/routerproxy.conf
Original file line number Diff line number Diff line change
@@ -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/

<Directory /gnoc/routerproxy/webroot/>
<Directory /usr/share/grnoc/routerproxy/www>
Satisfy Any
Allow from all
AddHandler cgi-script .cgi
Expand Down
2 changes: 1 addition & 1 deletion conf/routerproxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions templates/index.tt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
[% FOREACH group IN groups %]
<div class="devices">
<table class="title">
<tr class="menu-title" onclick="toggle('[% group.name %]');"><td colspan="3">[% group.name %]</td></tr>
<tr class="menu-title" onclick="toggle('[% group.name %]');">
<td colspan="3" title="[% group.description %]">[% group.name %]</td>
</tr>
</table>
<table id='[% group.name %]' style='display: table'>
<table id='[% group.name %]' style='display: [% IF group.display == 1 %]table[% ELSE %]none[% END %]'>
[% FOREACH device = group.devices -%]
[% IF loop.index % 3 == 0 %]
<tr class="primary">
Expand Down

0 comments on commit 5b3bd7b

Please sign in to comment.