Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Commit

Permalink
Init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nmred committed Jul 6, 2017
1 parent e5e1cae commit ea18965
Show file tree
Hide file tree
Showing 63 changed files with 8,391 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/*
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PROJECT(aidt)
ADD_SUBDIRECTORY(src bin)
INSTALL(DIRECTORY conf DESTINATION adinf/aidt PATTERN ".git" EXCLUDE)
30 changes: 30 additions & 0 deletions adbase.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[project]
ADINF_PROJECT_NAME=aidt
ADINF_PROJECT_SUMMARY=Weibo adinf data transfer
ADINF_PROJECT_URL=https://github.com/weiboad/aidt
ADINF_PROJECT_VENDOR=nmred <nmred_2008@126.com>
ADINF_PROJECT_PACKAGER=nmred <nmred_2008@126.com>

[module]
adserver=yes
timer=yes
kafkac=no
kafkap=yes
logging=yes

[params]
timers=syncOffset
http_controllers=Index,Config,Topic,Message
kafka_consumers=StatusDelete,StatusUpdate,UserUpdate
kafka_consumers_topics=fa_status_delete,fa_status_update,fa_user_update
kafka_consumers_groups=fr_test,fr_test,fr_test
kafka_producers=In
kafka_producers_topics=in

[files]
src/main.cpp=src/@ADINF_PROJECT_NAME@.cpp
rpm/main.spec.in=rpm/@ADINF_PROJECT_NAME@.spec.in

[execs]
cmake.sh=1
build_rpm.in=1
61 changes: 61 additions & 0 deletions cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash
#{{{ options

echo "Start cmake configure....."
echo -e "\033[31m\033[05mCompile debug level [Debug(D)|Release(R)]: \033[0m\c"
read makelevel
case $makelevel in
Debug | D )
CMAKE_BUILD_TYPE="Debug";;
Release | R )
CMAKE_BUILD_TYPE="Release";;
*)
CMAKE_BUILD_TYPE="Debug";;
esac
# }}}
# {{{ function opversion()

############################
# Operating system version #
############################
function opversion()
{
MAIN_VERSION=`lsb_release -a |grep 'Release' | cut -f2 | cut -d '.' -f 1`
SUB_VERSION=`lsb_release -a |grep 'Release' | cut -f2 | cut -d '.' -f 2`
case $1 in
"main")
echo $MAIN_VERSION
;;
"sub")
echo $SUB_VERSION
;;
"int")
echo ${MAIN_VERSION}${SUB_VERSION}
;;
*)
echo ${MAIN_VERSION}.${SUB_VERSION}
;;
esac
}

# }}}

# 计算版本号
LAST_TAG=`git tag|tail -n 1`
VERSION=${LAST_TAG/v/}

GIT_SHA1=`(git show-ref --head --hash=8 2> /dev/null || echo 00000000) | head -n1`
GIT_DIRTY=`git diff --no-ext-diff 2> /dev/null | wc -l`
BUILD_ID=`uname -n`"-"`date +%s`
OPVERSION="el"`opversion`

CMD="cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DADINFVERSION=$VERSION -DGIT_SHA1=$GIT_SHA1 -DGIT_DIRTY=$GIT_DIRTY -DBUILD_ID=$BUILD_ID -DOPVERSION=$OPVERSION .."

if [ -d ./build ]; then
echo "mkdir build.";
else
mkdir ./build;
fi
cd ./build;
echo $CMD
eval $CMD
19 changes: 19 additions & 0 deletions conf/aidt.yml.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# aidt config

transfers:
-
path: /tmp/test1
is_dir: true
is_binary: false
is_recursive: false
time_wait: 3
format: '%s'
topic_name: test
-
path: /tmp/test2
is_dir: true
is_binary: false
is_recursive: false
time_wait: 3
format: %s
topic_name: test
65 changes: 65 additions & 0 deletions conf/system.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[system]
appid=0
macid=0
daemon=no
pidFile=./aidt.pid
aidtConfig=../../conf/aidt.yml

[logging]
logsDir=logs/
; 日志分卷大小
logRollSize=52428800
; 1: LOG_TRACE 2: LOG_DEBUG 3: LOG_INFO
logLevel=1
isAsync=no

[adserver]
; 是否启动 mc server
mc=yes
; 是否启动 http server
http=yes
; 是否启动 head server
head=no

[mc]
host=0.0.0.0
port=40011
threadNum=4
serverName=mc-server

[http]
host=0.0.0.0
port=40010
timeout=3
threadNum=4
serverName=adinf-adserver
accessLogDir=logs/
accesslogRollSize=52428800
defaultController=index
defaultAction=index

[head]
host=0.0.0.0
port=10012
threadNum=4
serverName=head-server

[kafkap_in]
topicNameIn=test
brokerListIn=10.13.4.162:9192
debugIn=none
queueLengthIn=10000

[timer]
; 单位ms
intervalSyncOffset = 2000

[message]
sendError=error
queueLimit=1000

[reader]
maxLines=1000
maxfd=512
maxLineBytes=1048576
offsetFile=./agent.offset
57 changes: 57 additions & 0 deletions rpm/aidt.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
Summary: Weibo adinf data transfer
Name: aidt
Version:
Release:el6.5
Group:Development/Tools
License:BSD
URL: https://github.com/weiboad/aidt
Vendor: nmred <nmred_2008@126.com>
Packager: nmred <nmred_2008@126.com>
Distribution: Weibo adinf data transfer
Source:%{name}-%{version}.tar
Buildroot:%{_tmppath}/%{name}-%{version}
Prefix:/usr/local/adinf/aidt
Requires:sudo
%define debug_packages %{nil}
%define debug_package %{nil}
%define _topdir /usr/home/zhongxiu/rpmbuild
%description
-------------------------------------
- Everything in order to facilitate -
-------------------------------------

%prep
%setup -q
%build

%pre
if test -d %{prefix}; then
echo ""
echo "Install dir \'%{prefix}\' exists. You need resolve it manually before install aidt. Exit now."
echo ""
# return !0 for exit.
test ""
fi
%install
#rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}
cp -r * $RPM_BUILD_ROOT%{prefix}

%clean
#rm -rf $RPM_BUILD_ROOT

%post
# build install
echo ""
echo "Build: START"
echo -e "Build: DONE"
%preun
echo -n "unrpm ... "
SW_TMP_BAK_PATH=%{prefix}-backup-$(date +%%Y%%m%%d-%%H%%M%%S)
mv %{prefix} $SW_TMP_BAK_PATH
echo "Old version '%{prefix}' backup to '$SW_TMP_BAK_PATH'"
%postun
%files
%{prefix}

%changelog
57 changes: 57 additions & 0 deletions rpm/aidt.spec.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
Summary: Weibo adinf data transfer
Name: aidt
Version:${ADINFVERSION}
Release:${OPVERSION}
Group:Development/Tools
License:BSD
URL: https://github.com/weiboad/aidt
Vendor: nmred <nmred_2008@126.com>
Packager: nmred <nmred_2008@126.com>
Distribution: Weibo adinf data transfer
Source:%{name}-%{version}.tar
Buildroot:%{_tmppath}/%{name}-%{version}
Prefix:/usr/local/adinf/aidt
Requires:sudo
%define debug_packages %{nil}
%define debug_package %{nil}
%define _topdir /usr/home/zhongxiu/rpmbuild
%description
-------------------------------------
- Everything in order to facilitate -
-------------------------------------

%prep
%setup -q
%build

%pre
if test -d %{prefix}; then
echo ""
echo "Install dir \'%{prefix}\' exists. You need resolve it manually before install aidt. Exit now."
echo ""
# return !0 for exit.
test ""
fi
%install
#rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}
cp -r * $RPM_BUILD_ROOT%{prefix}

%clean
#rm -rf $RPM_BUILD_ROOT

%post
# build install
echo ""
echo "Build: START"
echo -e "Build: DONE"
%preun
echo -n "unrpm ... "
SW_TMP_BAK_PATH=%{prefix}-backup-$(date +%%Y%%m%%d-%%H%%M%%S)
mv %{prefix} $SW_TMP_BAK_PATH
echo "Old version '%{prefix}' backup to '$SW_TMP_BAK_PATH'"
%postun
%files
%{prefix}

%changelog
Loading

0 comments on commit ea18965

Please sign in to comment.