Created
May 7, 2013 15:16
-
-
Save BlackMaria/5533417 to your computer and use it in GitHub Desktop.
This is an example of the Makefile that I am using. I have git bits, auto dl of logstash if required version. AND this can build packages too. But you need a spec file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Name: my_logstash | |
Version: 1.1.9 | |
Release: monolithic | |
License: 2013 by me, All Rights Reserved. | |
Packager: [email protected] | |
Vendor: MyCompany | |
BuildRoot: /tmp/logstash_package | |
Summary: Bablefish for logs | |
Group: Applications | |
Provides: logstash | |
Requires: jdk | |
%description | |
http://logstash.net | |
%files | |
%attr(644,root,root) /usr/local/operations/logstash/Makefile | |
%attr(644,root,root) /usr/local/operations/logstash/configs/indexer.conf | |
%attr(644,root,root) /usr/local/operations/logstash/configs/logstash.dispatcher.conf | |
%attr(644,root,root) /usr/local/operations/logstash/configs/shipper.conf | |
%attr(644,root,root) /usr/local/operations/logstash/grok_patterns/my_patterns | |
%attr(644,root,root) /usr/local/operations/logstash/JAR/logstash-1.1.9-monolithic.jar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################## | |
# DEFAULTS FOR TESTING | |
########################################## | |
# | |
# First we set our defaults for our config tests | |
# We have been testing with logstash monolithic 1.1.9 | |
# When testing the default is "-v" but you can try "make indexer LSFLAGS=--v" etc... | |
# We are using monolithic, unless we can work with the flatjar then use "make indexer LSTYPE=flatjar " | |
# | |
LSVERS=1.1.9 | |
LSTYPE=monolithic | |
# monolithic flatjar | |
JAR=JAR/logstash-${LSVERS}-${LSTYPE}.jar | |
LSFLAGS=-v | |
CONFIG_ROOT=/tmp/logstash_package | |
########################################## | |
# GIT RELATED STUFF | |
########################################## | |
# | |
# A hand full of git bits for ease of use or noobs | |
# | |
GIT_SERVER=git | |
GIT_ROOT=/home/repo/GIT_ROOT | |
PACKAGE=logstash | |
status: clean | |
git status | |
pull: | |
git pull operations master | |
remote: | |
git remote add operations ${USER}@${GIT_SERVER}:${GIT_ROOT}/${PACKAGE}.git | |
push: | |
git push operations master | |
mkremote: | |
ssh "${USER}@${GIT_SERVER}" " mkdir -p ${GIT_ROOT}/${PACKAGE}.git ; cd ${GIT_ROOT}/${PACKAGE}.git ; git --bare init " | |
clean: | |
find ./ -name .DS_Store -delete | |
########################################## | |
# LOGSTASH BITS | |
########################################## | |
# | |
# Here we set up the testing for configs and test cases | |
# | |
indexer: ${JAR} | |
java -jar ${JAR} agent ${LSFLAGS} -f etc/indexer.conf & | |
lumber: ${JAR} | |
> /tmp/test_logs.log | |
java -jar ${JAR} agent ${LSFLAGS} -f etc/lumberjack.conf & | |
web: | |
cd /opt/Kibana && ruby kibana.rb & | |
# if the jar you are looking for is not already there, flash! | |
${JAR}: | |
wget https://logstash.objects.dreamhost.com/release/logstash-${LSVERS}-${LSTYPE}.jar -O ${JAR} | |
########################################## | |
# TEST CASES | |
########################################## | |
# | |
# | |
# Fill up logs with test case | |
# | |
tc: | |
gunzip -dc TEST_CASES/test_logs.log.* >> /tmp/test_logs.log | |
# | |
# yeah I am that lazy! | |
ps: | |
ps -ef|egrep "java|ruby" | |
# | |
# | |
# we assume these tests are taking place on a stateless system where there, noone else is working :) | |
killall: | |
killall java | |
echo "" > /tmp/test_logs.log | |
# | |
# If you think the config is good, then make a package | |
# | |
package: clean | |
# create base dirs for makeing package in chroot | |
mkdir -p ${CONFIG_ROOT}/tmp ${CONFIG_ROOT}/RPMS/x86_64 ${CONFIG_ROOT}/BUILD | |
# | |
# create required dirs for package | |
mkdir -p ${CONFIG_ROOT}/usr/local/operations/logparser/ | |
# Copy files to chroot ( best praactice, specifiy each file in spec file ) | |
rsync -rva Makefile ./JAR ./configs ./grok_patterns ${CONFIG_ROOT}/usr/local/operations/logstash/ | |
# Get git commit sha and update spec file with new version | |
git-commit2versions logstash.spec | |
# make package | |
rpmbuild -bb --nodeps --buildroot ${CONFIG_ROOT} --target x86_64 logstash.spec | |
# Dont forget to update the repo | |
# NB ln -s /package_root/web ~/rpmbuild | |
# -This way your package bot places file directly in you page root | |
make -C /package_root/web/RPMS/x86_64/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment