Use packages for Hindsight

Change-Id: I44594235ff723ee5b50cbe212530e57aaf704180
This commit is contained in:
Éric Lemoine 2016-09-01 17:41:42 +02:00
parent 02af8cfcf6
commit 0fe1681f10
6 changed files with 23 additions and 101 deletions

View File

@ -1,12 +1,21 @@
FROM {{ namespace }}/base-tools:{{ tag }}
MAINTAINER {{ maintainer }}
# NOTE(elemoine) hindsight and lua_sandbox are built from sources (specific
# commits). In the future we may want to create and host Debian packages.
# We use MOS packages for hindsight, lua_sandbox and lua_sandbox_extensions
ADD install.sh /tmp/
RUN bash /tmp/install.sh \
&& rm /tmp/install.sh
ENV DEBIAN_FRONTEND noninteractive
COPY sources.mos.list /etc/apt/sources.list.d/
COPY mos.pref /etc/apt/preferences.d/
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1FA22B08 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
hindsight \
lua-sandbox-extensions \
&& cp /usr/share/luasandbox/sandboxes/heka/input/prune_input.lua \
/usr/share/luasandbox/sandboxes/heka/input/heka_tcp.lua \
/var/lib/hindsight/run/input/
ADD output/influxdb_tcp.lua /var/lib/hindsight/run/output/

View File

@ -1,91 +0,0 @@
#!/bin/bash
set -e
#
# Install build dependencies
#
BUILD_DEPS="git g++ make cmake"
apt-get update
apt-get install -y --no-install-recommends $BUILD_DEPS
#
# Build and install lua_sandbox
#
cd /tmp
git clone https://github.com/mozilla-services/lua_sandbox
cd lua_sandbox
git checkout v1.0.3
mkdir release
cd release
cmake -DCMAKE_BUILD_TYPE=release ..
make
make install
#
# Build and install the necessary lua_sandbox extensions
#
cd /tmp
git clone https://github.com/mozilla-services/lua_sandbox_extensions
cd lua_sandbox_extensions
# last tested commit
# https://github.com/mozilla-services/lua_sandbox_extensions/commit/98065e7627ebf7440363ad73024968b01a1d5c53
git checkout 98065e7627ebf7440363ad73024968b01a1d5c53
mkdir release
cd release
cmake -DCMAKE_BUILD_TYPE=release -DEXT_cjson=on -DEXT_heka=on -DEXT_lpeg=on -DEXT_socket=on ..
make
# make install does not work
make packages
tar --strip-components=1 -C / -xvzf luasandbox-cjson-*-Linux.tar.gz
tar --strip-components=1 -C / -xvzf luasandbox-heka-*-Linux.tar.gz
tar --strip-components=1 -C / -xvzf luasandbox-lpeg-*-Linux.tar.gz
tar --strip-components=1 -C / -xvzf luasandbox-socket-*-Linux.tar.gz
ldconfig
#
# Build Hindsight
#
cd /tmp
git clone https://github.com/trink/hindsight
cd hindsight
# last tested commit
# https://github.com/trink/hindsight/commit/d3b257a3eda7c3874e7cf9ac6f095bbb752a1026
git checkout d3b257a3eda7c3874e7cf9ac6f095bbb752a1026
mkdir release
cd release
cmake -DCMAKE_BUILD_TYPE=release ..
make
make install
#
# Create Hindsight dirs and copy lua_sandbox and Hindsight plugins
# into Hindsight's "run" directory
#
mkdir -p \
/etc/hindsight \
/var/lib/hindsight/output \
/var/lib/hindsight/load/analysis \
/var/lib/hindsight/load/input \
/var/lib/hindsight/load/output \
/var/lib/hindsight/run/analysis \
/var/lib/hindsight/run/input \
/var/lib/hindsight/run/output
cp /tmp/lua_sandbox_extensions/release/install/share/luasandbox/sandboxes/heka/input/heka_tcp.lua /var/lib/hindsight/run/input/
cp /tmp/hindsight/sandboxes/input/prune_input.lua /var/lib/hindsight/run/input/
#
# Remove build directories
#
rm -rf /tmp/lua_sandbox /tmp/lua_sandbox_extensions /tmp/hindsight
apt-get purge -y --auto-remove $BUILD_DEPS
apt-get clean
rm -rf /var/lib/apt/lists/*
exit 0

View File

@ -0,0 +1,3 @@
Package: *
Pin: origin "mirror.fuel-infra.org"
Pin-Priority: 500

View File

@ -0,0 +1 @@
deb http://mirror.fuel-infra.org/mos-repos/ubuntu/snapshots/9.0-2016-09-02-140322/ mos9.0-proposed main

View File

@ -1,10 +1,10 @@
output_path = "/var/lib/hindsight/output"
sandbox_load_path = "/var/lib/hindsight/load"
sandbox_run_path = "/var/lib/hindsight/run"
analysis_lua_path = "/lib/luasandbox/modules/?.lua"
analysis_lua_cpath = "/lib/luasandbox/modules/?.so"
io_lua_path = analysis_lua_path .. ";/lib/luasandbox/io_modules/?.lua"
io_lua_cpath = analysis_lua_cpath .. ";/lib/luasandbox/io_modules/?.so"
analysis_lua_path = "/usr/lib/x86_64-linux-gnu/luasandbox/modules/?.lua"
analysis_lua_cpath = "/usr/lib/x86_64-linux-gnu/luasandbox/modules/?.so"
io_lua_path = analysis_lua_path .. ";/usr/lib/x86_64-linux-gnu/luasandbox/io_modules/?.lua"
io_lua_cpath = analysis_lua_cpath .. ";/usr/lib/x86_64-linux-gnu/luasandbox/io_modules/?.so"
-- FIXME(elemoine) set "hostname"
-- hostname =

View File

@ -8,7 +8,7 @@ service:
readiness: "true"
liveness: "true"
daemon:
command: /usr/local/bin/hindsight /etc/hindsight/hindsight.cfg
command: /usr/bin/hindsight /etc/hindsight/hindsight.cfg
files:
- hindsight.cfg
- heka-tcp.cfg