From f0c4c8dc3c30752a16d16e86e5848715830ac8a3 Mon Sep 17 00:00:00 2001 From: duanhongyi Date: Wed, 16 Feb 2022 14:26:45 +0800 Subject: [PATCH] chore(stacks): add fluentd --- stacks/fluentd/build.sh | 21 +++++++++++++++++++++ stacks/fluentd/make.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100755 stacks/fluentd/build.sh create mode 100755 stacks/fluentd/make.sh diff --git a/stacks/fluentd/build.sh b/stacks/fluentd/build.sh new file mode 100755 index 0000000..204c119 --- /dev/null +++ b/stacks/fluentd/build.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Load stack utils +. /usr/bin/stack-utils + +# Implement build function +function build() { + cat << EOF > ${PROFILE_DIR}/${STACK_NAME}.sh +export GEM_HOME=/opt/drycc/fluentd +export BUNDLE_SILENCE_ROOT_WARNING=1 +export BUNDLE_APP_CONFIG="$GEM_HOME" +export PATH=$GEM_HOME/bin:$PATH +EOF + . ${PROFILE_DIR}/${STACK_NAME}.sh + ./make.sh + echo "export LD_PRELOAD=/usr/lib/libjemalloc.so.2" >> ${PROFILE_DIR}/${STACK_NAME}.sh + cp -rf /opt/drycc/fluentd/* "${DATA_DIR}" +} + +# call build stack +build-stack "${1}" diff --git a/stacks/fluentd/make.sh b/stacks/fluentd/make.sh new file mode 100755 index 0000000..ffef0b7 --- /dev/null +++ b/stacks/fluentd/make.sh @@ -0,0 +1,27 @@ +install-stack ruby 3.1.0 +. /opt/drycc/ruby/profile.d/*.sh + + +apt-get update \ + && apt-get install -y --no-install-recommends \ + ca-certificates \ + && buildDeps=" \ + make gcc g++ libc-dev \ + wget bzip2 gnupg dirmngr \ + " \ + && apt-get install -y --no-install-recommends $buildDeps \ + && echo 'gem: --no-document' >> /etc/gemrc \ + && gem install oj -v 3.10.18 \ + && gem install json -v 2.4.1 \ + && gem install async-http -v 0.54.0 \ + && gem install fluentd -v 1.14.5 \ + && wget -O /tmp/jemalloc-4.5.0.tar.bz2 https://github.com/jemalloc/jemalloc/releases/download/4.5.0/jemalloc-4.5.0.tar.bz2 \ + && cd /tmp && tar -xjf jemalloc-4.5.0.tar.bz2 && cd jemalloc-4.5.0/ \ + && ./configure && make \ + && mkdir -p /opt/drycc/fluentd/lib \ + && mv lib/libjemalloc.so.2 /opt/drycc/fluentd/lib \ + && apt-get purge -y --auto-remove \ + -o APT::AutoRemove::RecommendsImportant=false \ + $buildDeps \ + && rm -rf /var/lib/apt/lists/* \ + && rm -rf /tmp/* /var/tmp/* \ No newline at end of file