aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2016-02-20 19:52:27 +0100
committerKristian Lyngstol <kristian@bohemians.org>2016-02-20 19:52:27 +0100
commitd635bcba6bad70f9373595ac7306043998b0bec4 (patch)
treeef09414c0ac98a725632e14c5942834ffc2f6ef2
parent39726f28fac37061224f11235973bae9a6b0509a (diff)
nms: Start docker-stuff
-rw-r--r--nms/.vimrc135
-rw-r--r--nms/Dockerfile.in55
-rwxr-xr-xnms/makedockerfiles.sh26
3 files changed, 216 insertions, 0 deletions
diff --git a/nms/.vimrc b/nms/.vimrc
new file mode 100644
index 0000000..489dfbf
--- /dev/null
+++ b/nms/.vimrc
@@ -0,0 +1,135 @@
+" vim configuration for Kristian Lyngstol <kristian@bohemians.org>
+" Basically just adjust for dark background, enable spell checking, and
+" load a compiz-vimrc if we're working on compiz.
+
+source /etc/vim/vimrc
+
+filetype plugin on
+
+" Hit "K" to look up something in man
+runtime! ftplugin/man.vim
+
+set helpheight=50
+"""""""""""""""""""" Look and feel
+" I'm almost always at a dark terminal. But meh.
+set t_Co=88
+set background=dark
+"set background=light
+" Make sure we have a sane amount of colors. Urxvt has 88 (normal 16,
+" rgb-cube from 17 to 79, shades of grey from 80 to 88).
+
+" Set tabs to show as normal, but add a visual indicator of trailing
+" whitespace. Set list to make this sane. (Testing)
+set lcs=tab:\ \ ,trail:.
+"set lcs=tab:ยป\ ,precedes:<,trail:.
+set list
+
+" Show line numbers. Ensures that I don't get lost.
+set nu
+
+" Set smart title (hopefully)
+" I don't use titles in screen, so pass them on to the terminal. (hack)
+if &term == "screen"
+ set t_ts=]2;
+ set t_fs=
+endif
+
+" Set the title if possible
+set title
+
+" Always show a status line. This ensures that I know what I'm editing and
+" always have column-numbers and general status ([+] etc).
+set laststatus=2
+
+set scrolloff=1
+
+" All-important syntax highlighting
+syntax on
+
+" Some historic color stuff
+hi DiffChange ctermbg=60
+hi DiffAdd ctermbg=17
+hi DiffText ctermbg=52
+hi clear TabLine
+hi TabLine cterm=reverse
+hi TabLineSel ctermbg=29 ctermfg=15
+
+" {} matching us ambiguous by default (in my head, at least)
+hi MatchParen ctermbg=blue
+
+
+
+"""""""""""""""""""" Coding style
+" Always use smartindent. Use :set paste for pasting.
+set smartindent
+
+" Defines how stuff is indented:
+" t = Auto-wrap at TW
+" c = Auto-wrap at TW for comments and insert comment-leader
+" q = Allow comment-formating with 'gq'
+" r = Insert comment-leader on manual enter/return.
+" o = Ditto for 'o'/'O' (do I even use that?)
+" l = Don't break lines when they were too big to begin with.
+set formatoptions=tcqrol
+
+" tw of 75 works wonders on 80char-terminals (or heavily vsplit terms)
+set tw=75
+
+" Use modelines(ie: vim: set foo). This is a tad dangerous, as some idiots
+" set all sorts of things. FIXME: Should fix this to only apply to certain
+" directories.
+set ml
+
+" Most projects I work with use two levels of depth, so make a top-level
+" tag-file. In other words:
+" bin/varnishd/, include/ and lib/libvcl/ has the same tagfile.
+set tag+=../../tags,../tags
+
+set path+=../include,include,../../include
+
+" Spell checking by default.
+set spell
+
+" Need to adjust the SpellBad hilight because I don't want it too
+" aggressive, since it's often mistaken (in code). An underline is nice
+" enough without being too obtrusive.
+hi SpellBad NONE
+hi SpellBad term=underline,undercurl cterm=undercurl
+hi clear SpellCap
+
+set cino=(0,t0
+""""" Automatic tag/preview lookup.
+" aka: insanity
+
+" Backup every 1sec - the cursorhold is on the same timer.
+set updatetime=1000
+
+" Makes it bearable to use on a 80x25
+set previewheight=5
+
+" Change this to stop the insanity
+let insanity = "ensue"
+
+" au! CursorHold *.[ch] nested exe "silent! ptag " . expand("<cword>")
+au! CursorHold *.{c,h,java} nested call PreviewWord()
+func! PreviewWord()
+ if &previewwindow " don't do this in the preview window
+ return
+ endif
+ if g:insanity != "ensue"
+ return
+ endif
+ exe "silent! ptag " . expand("<cword>")
+endfun
+
+" Complete using the spell checker too
+set complete+=kspell
+
+" Complete as much as is unique - shell-style - instead of blindly
+" completing the first match and requiring to re-issue commands.
+set cot+=longest
+
+" Ditto for menus (and list the alternatives) (and file browsing!) With
+" seven hundred thousand files, it's then easier to complete the one in the
+" middle.
+set wildmode=list:longest
diff --git a/nms/Dockerfile.in b/nms/Dockerfile.in
new file mode 100644
index 0000000..998b751
--- /dev/null
+++ b/nms/Dockerfile.in
@@ -0,0 +1,55 @@
+@template nms-base
+
+FROM debian:jessie
+
+ENV container docker
+MAINTAINER "Kristian" <kly@kly.no>
+RUN systemctl set-default basic.target
+RUN apt-get update && apt-get -y install \
+ wget \
+ vim \
+ man \
+ build-essential \
+ net-tools \
+ bash-completion \
+ git-core \
+ autoconf \
+ netcat \
+ libwww-perl \
+ libmicrohttpd-dev \
+ libcurl4-gnutls-dev \
+ libedit-dev \
+ libpcre3-dev \
+ libncurses5-dev \
+ python-demjson \
+ python-docutils \
+ libtool \
+ nodejs \
+ httpie \
+ locales \
+ screen \
+ pkg-config
+
+VOLUME [ "/sys/fs/cgroup" ]
+VOLUME [ "/run" ]
+VOLUME [ "/run/lock" ]
+RUN echo en_US.UTF8 UTF-8 > /etc/locale.gen
+RUN locale-gen
+RUN echo 'LANG="en_US.utf8"' > /etc/default/locale
+RUN echo . /etc/default/locale >> /root/.bashrc
+RUN echo export LANG >> /root/.bashrc
+RUN echo . /etc/bash_completion >> /root/.bashrc
+ENV TERM=rxvt-unicode
+ADD .vimrc /root/.vimrc
+RUN rm /etc/apt/apt.conf.d/docker-clean
+RUN systemctl mask dev-hugepages.mount sys-fs-fuse-connections.mount
+RUN git clone https://github.com/tech-server/tgmanage.git root/tgmanage
+
+CMD ["/sbin/init"]
+
+@template nms-front
+FROM nms-base
+RUN apt-get -y install libcapture-tiny-perl libcgi-pm-perl libcommon-sense-perl libdata-dumper-simple-perl libdbi-perl libdigest-perl libgd-perl libgeo-ip-perl libhtml-parser-perl libhtml-template-perl libimage-magick-perl libimage-magick-q16-perl libjson-perl libjson-xs-perl libnetaddr-ip-perl libnet-cidr-perl libnet-ip-perl libnet-openssh-perl libnet-oping-perl libnet-rawip-perl libnet-telnet-cisco-perl libnet-telnet-perl libsnmp-perl libsocket6-perl libsocket-perl libswitch-perl libtimedate-perl perl perl-base perl-modules
+
+RUN cd /root/tgmanage/ && tools/get_mibs.sh
+
diff --git a/nms/makedockerfiles.sh b/nms/makedockerfiles.sh
new file mode 100755
index 0000000..6c8e136
--- /dev/null
+++ b/nms/makedockerfiles.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+awk -v TARGET=/dev/null '
+BEGIN {
+ system("mkdir -p build")
+}
+/^@template/ {
+ TARGET="build/Dockerfile."$2;
+ TARGETS[ntargets++]=$2;
+ print "# Generated" > TARGET
+ next;
+}
+{
+ print > TARGET
+}
+END {
+ print "#! /bin/sh" > "build/build.sh"
+ print "set -e" > "build/build.sh"
+ for (x in TARGETS) {
+ a = TARGETS[x]
+ print "echo Building "a > "build/build.sh"
+ print "echo Logs: build/"a".log" > "build/build.sh"
+ print "docker build -t "a" -f build/Dockerfile."a" . > build/"a".log 2>&1 || cat build/"a".log" > "build/build.sh"
+ }
+ system("chmod +x build/build.sh")
+}' < Dockerfile.in
+build/build.sh