Commit d077e697 authored by Heinz N. Gies's avatar Heinz N. Gies

Merge branch 'test' into dev

parents 170e9e5d 6ea0a624
......@@ -27,3 +27,4 @@ TEST-*
rebar3.crashdump
apps/dalmatiner_frontend/src/event_query_lexer.xrl
apps/dalmatiner_frontend/src/event_query_parser.yrl
compile_commands.json
......@@ -30,3 +30,6 @@ deb-prepare:
deb-package: deb-prepare
make -C rel/deb package
version_header: version
true
VERSION=0.3.3
COMPONENT_INTERNAL=dfe
COMPONENT=dalmatinerfe
REBAR = $(shell pwd)/rebar3
PKG_VSN = $(shell head -n1 rel/pkg/Makefile | sed 's/[^0-9.p]//g')
REBAR_VSN = $(shell erl -noshell -eval '{ok, F} = file:consult("rebar.config"), [{release, {_, Vsn}, _}] = [O || {relx, [O | _]} <- F], io:format("~s", [Vsn]), init:stop().')
VARS_VSN = $(shell grep 'bugsnag_app_version' rel/vars.config | sed -e 's/.*,//' -e 's/[^0-9.p]//g' -e 's/[.]$$//')
APP_VSN = $(shell grep vsn apps/$(APP)/src/$(APP).app.src | sed 's/[^0-9.p]//g')
include config.mk
compile: $(REBAR) .git/hooks/pre-commit
$(REBAR) compile
......@@ -31,13 +32,16 @@ $(REBAR):
cp `which rebar3` $(REBAR)
upgrade: $(REBAR)
$(REBAR) upgrade
make tree
$(REBAR) upgrade
$(MAKE) tree
update: $(REBAR)
$(REBAR) update
tree: $(REBAR)
rebar.lock: rebar.config $(REBAR)
$(REBAR) compile
tree: $(REBAR) rebar.lock
$(REBAR) tree | grep -v '=' | sed 's/ (.*//' > tree
tree-diff: tree
......@@ -46,6 +50,64 @@ tree-diff: tree
update-fifo.mk:
cp _build/default/lib/fifo_utils/priv/fifo.mk .
###
### Packaging
###
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_V6 := $(shell sh -c 'uname -v 2>/dev/null | cut -c-6 || echo not')
ifeq ($(uname_S),Darwin)
PLATFORM = darwin
REBARPROFILE = darwin
export REBARPROFILE
endif
ifeq ($(uname_S),FreeBSD)
PLATFORM = freebsd
REBARPROFILE = freebsd
export REBARPROFILE
endif
ifeq ($(uname_V6),joyent)
PLATFORM = smartos
REBARPROFILE = smartos
export REBARPROFILE
endif
dist: ${PLATFORM} ;
generic/rel: version_header
$(REBAR) as ${REBARPROFILE} compile
$(REBAR) as ${REBARPROFILE} release
freebsd: ${PLATFORM}/rel
$(MAKE) -C rel/pkgng package
smartos: ${PLATFORM}/rel
$(MAKE) -C rel/pkg package
darwin: ${PLATFORM}/rel
freebsd/rel: generic/rel
smartos/rel: generic/rel
darwin/rel: generic/rel
dist-help:
@echo "FiFo dist tool"
@echo "You are running this on: ${PLATFORM}"
@echo
@echo "Currently supported platforms are: FreeBSD, SmartOS, Darwin/OSX"
@echo
@echo "SmartOS:"
@echo " rebar profile: smartos $(shell if grep profiles -A12 rebar.config | grep smartos > /dev/null; then echo OK; else echo MISSING; fi)"
@echo " packaging makefile: rel/pkg/Makefile $(shell if [ -f rel/pkg/Makefile ]; then echo OK; else echo MISSING; fi)"
@echo "FreeBSD:"
@echo " rebar profile: freebsd $(shell if grep profiles -A12 rebar.config | grep freebsd > /dev/null; then echo OK; else echo MISSING; fi)"
@echo " packaging makefile: rel/pkgng/Makefile $(shell if [ -f rel/pkgng/Makefile ]; then echo OK; else echo MISSING; fi)"
@echo "Darwin:"
@echo " rebar profile: darwin $(shell if grep profiles -A12 rebar.config | grep darwin > /dev/null; then echo OK; else echo MISSING; fi)"
@echo " packaging makefile: - no packaing -"
###
### Docs
......@@ -60,8 +122,8 @@ docs:
build-vsn:
@echo "$(REBAR_VSN)"
vsn:
@echo "## rel/pkg/Makefile"
@echo "$(PKG_VSN)"
@echo "## Config:"
@echo "$(VERSION)"
@echo "## apps/$(APP)/src/$(APP).app.src"
@echo "$(APP_VSN)"
@echo "## rebar.config"
......@@ -70,7 +132,7 @@ vsn:
@echo "$(VARS_VSN)"
test-vsn:
@echo "Testing against package version: $(REBAR_VSN)"
@[ "$(REBAR_VSN)" = "$(APP_VSN)" ] && echo " - App version ok: $(APP_VSN)" || (echo "App version out of date" && false)
@[ "$(REBAR_VSN)" = "$(PKG_VSN)" ] && echo " - Package version ok: $(PKG_VSN)" || (echo "Package version out of date" && false)
@[ "$(REBAR_VSN)" = "$(VARS_VSN)" ] && echo " - Vars version ok: $(VARS_VSN)" || (echo "Vars version out of date" && false)
@echo "Testing against package version: $(VERSION)"
@[ "$(VERSION)" = "$(APP_VSN)" ] && echo " - App version ok: $(APP_VSN)" || (echo "App version out of date" && false)
@[ "$(VERSION)" = "$(REBAR_VSN)" ] && echo " - Rebar version ok: $(PKG_VSN)" || (echo "Package version out of date" && false)
@[ "$(VERSION)" = "$(VARS_VSN)" ] && echo " - Vars version ok: $(VARS_VSN)" || (echo "Vars version out of date" && false)
......@@ -56,7 +56,9 @@
%%-------------------------------------------------------------------
{profiles,
[{prod, [{relx, [{dev_mode, false}]}]},
[{smartos, [{relx, [{dev_mode, false}]}]},
{freebsd, [{relx, [{dev_mode, false}]}]},
{darwin, [{relx, [{dev_mode, false}]}]},
{shell, [{deps, [sync]}]},
{deb, [{relx, [{dev_mode, false}, {overlay_vars, "rel/vars/deb.config"}]}]},
{lint,
......
......@@ -19,7 +19,7 @@
{<<"epgsql">>,{pkg,<<"epgsql">>,<<"3.3.0">>},3},
{<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"1.0.0">>},0},
{<<"fifo_lager">>,{pkg,<<"fifo_lager">>,<<"0.1.6">>},0},
{<<"fifo_utils">>,{pkg,<<"fifo_utils">>,<<"0.1.39">>},0},
{<<"fifo_utils">>,{pkg,<<"fifo_utils">>,<<"0.1.44">>},0},
{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1},
{<<"hdr_histogram">>,{pkg,<<"hdr_histogram">>,<<"0.2.0">>},1},
{<<"ibrowse">>,{pkg,<<"ibrowse">>,<<"4.4.0">>},1},
......@@ -65,7 +65,7 @@
{<<"epgsql">>, <<"974A578340E52012CBAB820CE756E7ED1DF1BAF0110C59A6753D8337A2CF9454">>},
{<<"erlware_commons">>, <<"087467DE5833C0BB5B3CCDD387F9E9C1FB816A75B7A709629BF24B5ED3246C51">>},
{<<"fifo_lager">>, <<"5D350A2C85F27F776B28E022A731B1B2F4A8C0D1703416C2553C4046AA09E837">>},
{<<"fifo_utils">>, <<"04151D9F840A6DC1430269C8AD65135ADB21212AC386DFD5D0955C74D3D1A87D">>},
{<<"fifo_utils">>, <<"5BAB235DF3B80F7EBA7C64D0C5077C8FE35D40342E822065A54AA9925181D2A6">>},
{<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>},
{<<"hdr_histogram">>, <<"95A7EC3C8FA354E4CFBFC8F4168EE8F07BD3965CA22B9C45B2A2C9D13B03DCEC">>},
{<<"ibrowse">>, <<"2D923325EFE0D2CB09B9C6A047B2835A5EDA69D8A47ED6FF8BC03628B764E991">>},
......
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: dalmatinerdb
# REQUIRE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name="dalmatinerdb"
rcvar=dalmatinerdb_enable
load_rc_config $name
: ${dalmatinerdb="NO"}
start_cmd="${name}_start"
stop_cmd="${name}_stop"
dalmatinerdb_start()
{
if checkyesno ${rcvar}; then
echo "* starting dalmatiner db... "
/usr/local/bin/sudo -u dalmatinerdb /usr/ddb/bin/ddb start
fi
}
dalmatinerdb_stop()
{
if checkyesno ${rcvar}; then
echo "* stopping dalmatiner db... "
/usr/local/bin/sudo -u dalmatinerdb /usr/ddb/bin/ddb stop
fi
}
run_rc_command "$1"
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: dalmatinerfe
# REQUIRE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name="dalmatinerfe"
rcvar=dalmatinerfe_enable
load_rc_config $name
: ${dalmatinerfe="NO"}
start_cmd="${name}_start"
stop_cmd="${name}_stop"
dalmatinerfe_start()
{
if checkyesno ${rcvar}; then
echo "* starting dalmatiner db... "
/usr/local/bin/sudo -u dalmatinerfe /usr/ddb/bin/ddb start
fi
}
dalmatinerfe_stop()
{
if checkyesno ${rcvar}; then
echo "* stopping dalmatiner db... "
/usr/local/bin/sudo -u dalmatinerfe /usr/ddb/bin/ddb stop
fi
}
run_rc_command "$1"
%%
%% etc/vm.args
%%
{run_user, "dalmatinerdb"}.
\ No newline at end of file
name: dalmatinerfe
version: "__VNS__"
origin: projectfifo/dalmatinerfe
comment: "Dalmatiner TS Frontend"
desc: "Dalmatiner TS Frontend"
maintainer: info@project-fifo.net
www: https://project-fifo.net
prefix: /
#!/usr/bin/bash
USER=dalmatinerfe
GROUP=$USER
echo Creating group ...
getent group $GROUP >/dev/null 2>&1 || pw groupadd $GROUP
echo Creating user ...
id $USER >/dev/null 2>&1 || pw useradd $USER -g $GROUP -d /data/$USER -s /usr/sbin/nologin
echo Creating directories ...
mkdir -p /data/$USER/fe/ring
mkdir -p /data/$USER/etc
mkdir -p /data/$USER/log/sasl
chown -R $USER:$GROUP /data/$USER
mkdir -p /tmp/$USER
chown -R $USER:$GROUP /tmp/$USER/
echo Trying to guess configuration ...
IP=$(ifconfig $(netstat -r | grep default | awk '{ print $4 }') | grep 'inet' | awk -F ' ' '{ print $2 }')
DISTCONFFILE=/usr/dfe/etc/dfe.conf
CONFFILE=/data/dalmatinerfe/etc/dfe.conf
if [ ! -f "${CONFFILE}" ]
then
echo "Creating new configuration from example file."
cp ${DISTCONFFILE} ${CONFFILE}.example
cp ${CONFFILE}.example ${CONFFILE}
/usr/bin/sed -i bak -e "s/127.0.0.1/${IP}/g" ${CONFFILE}
else
echo "Please make sure you update your config according to the update manual!"
fi
OT=/data/dalmatinerfe/etc/rules.ot
if [ ! -f "${OT}" ]
then
echo "none() -> drop." > ${OT}
fi
INSTALL_DIR=usr
DEPS="coreutils" "sudo"
REBARPROFILE ?= default
include ../../config.mk
include ../../_build/${REBARPROFILE}/lib/fifo_utils/priv/pkgng.mk
.PHONY: package prepare clean
prepare:
-rm -r $(STAGE_DIR)
mkdir -p $(STAGE_DIR)/$(INSTALL_DIR)
cp -r ../../_build/${REBARPROFILE}/rel/$(COMPONENT_INTERNAL) $(STAGE_DIR)/$(INSTALL_DIR)
rm -rf $(STAGE_DIR)/$(INSTALL_DIR)/lib/*/c_src
mkdir -p $(STAGE_DIR)/etc/rc.d
cp ../freebsd/dalmatinerdb $(STAGE_DIR)/etc/rc.d/
......@@ -27,7 +27,7 @@
│ ├─ lager_graylog─0.1.3
│ └─ lager_logstash_backend─0.1.3
│ └─ jsx─2.8.2
├─ fifo_utils─0.1.39
├─ fifo_utils─0.1.44
│ ├─ quickrand─1.7.1
│ └─ uuid─1.7.1
├─ jsone─1.2.6
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment