Code Monkey home page Code Monkey logo

fluent-package-builder's Introduction

fluent-package-builder

About fluent-package-builder

fluent-package-builder (formerly known as td-agent-builder, it was renamed at Aug, 2021) is a new build system for td-agent which aims to replace the traditional build system omnibus-td-agent since it has several problems due to Omnibus's limitations.

NOTE: Discussed why re-branding is required Rebranding td-agent-builder

Changes from Treasure Agent 4

  • td-agent was renamed to fluent-package
    • The content of fluent-package was changed to install under /opt/fluent
    • /usr/sbin/td-agent and /usr/sbin/td-agent-gem was changed to /usr/sbin/fluentd and /usr/sbin/fluent-gem
    • Changed the path of example default configuration file to /opt/fluent/share/fluentd.conf
  • Debian 12 (bookworm) has been supported
  • Removed Ubuntu 16.04 (xenial), Ubuntu 18.04 (bionic) support
  • Amazon Linux 2023 has been supported
  • Introduced new package signing key. The new key will be used in the future release. we still use using old signing key for a while
  • fluentd-apt-source was renamed to fluent-apt-source deb package for maintaining apt-line and keyring

Changes from Treasure Agent 3

  • Use system libraries: e.g. openssl
  • Remove libraries for 3rd party gems: e.g. postgresql
  • Remove embedded directory by omnibus
    • Use /opt/td-agent/bin/fluent-cat instead of /opt/td-agent/embedded/bin/fluent-cat
  • Update core components: ruby, jemalloc and more
  • Add td-agent-apt-source deb package for maintaining apt-line and keyring
    • Download it and install by apt install, then you can install td-agent via apt install td-agent.
    • td-agent-apt-source deb package is created to install td-agent easily. Currently it points to td-agent 4 apt-line.

See also this issue for omnibus problems.

Prerequisites

For building .rpm & .deb packages

  • Any host OS that is supported by Docker
    • Debian buster or Ubuntu 18.04 are recommended
  • Docker
  • Ruby 2.5 or later
  • Bundler 2.2.0 or later
  • Git

For building Windows package (.msi)

After installed above software, you need to enable additional features from powershell (as admin).

dism.exe /online /enable-feature /featurename:Microsoft-Hyper-V /all /norestart
dism.exe /online /enable-feature /featurename:Containers /all /norestart

Then restart Windows.

For building macOS package (.dmg)

  • macOS 10.15 (Catalina)
  • Ruby 2.5 or later
  • Bundler 2.2.0 or later
  • Builder gem
  • Git
  • CMake
  • Rust to enable Ruby's YJIT feature

How to build .rpm package

% rake yum:build

By default, yum repositories for following platforms will be built under fluent-package/yum/repositories/ directory:

  • RHEL/CentOS 7 (x86_64)
  • RHEL/CentOS 8 (x86_64) - Built on Rocky Linux 8
  • RHEL/CentOS 9 (x86_64) - Built on AlmaLinux 9
  • Amazon Linux 2 (x86_64)
  • Amazon Linux 2023 (x86_64)

You can choose target platforms by YUM_TARGETS environment variable like this:

% rake yum:build YUM_TARGETS="centos-7,rockylinux-8,almalinux-9"

You can find other supported platforms under fluent-package/yum directory.

Note for AArch64 platforms

You can also build packages for AArch64 platforms like this:

% rake yum:build YUM_TARGETS="amazonlinux-2023-aarch64"

But if you use older GNU/Linux platforms (e.g. Ubuntu 18.04 or before) as your host OS, you need to copy qemu-aarch64-static into the base directory of the target:

% export TARGET_BASE="centos-8"
% sudo apt install qemu-user-static
% cd /path/to/fluent-package-builder
% cp /usr/bin/qemu-aarch64-static fluent-package/yum/${TARGET_BASE}
% rake yum:build YUM_TARGETS="${TARGET_BASE}-aarch64"

Note for ppc64le platform

You can also build packages for ppc64le platform like this:

% rake yum:build YUM_TARGETS="centos-8-ppc64le"

But if you use older GNU/Linux platforms (e.g. Ubuntu 18.04 or before) as your host OS, you need to copy qemu-ppc64le-static into the base directory of the target:

% export TARGET_BASE="centos-8"
% sudo apt install qemu-user-static
% cd /path/to/fluent-package-builder
% cp /usr/bin/qemu-ppc64le-static fluent-package/yum/${TARGET_BASE}
% rake yum:build YUM_TARGETS="${TARGET_BASE}-ppc64le"

How to build .deb package

% rake apt:build

By default, apt repositories for following platforms will be built under fluent-package/apt/repositories/ directory:

  • Debian 11 "Bullseye" (x86_64)
  • Debian 12 "Bookworm" (x86_64)
  • Ubuntu 20.04 LTS "Focal Fossa" (x86_64)
  • Ubuntu 22.04 LTS "Jammy Jellyfish" (x86_64)

You can choose target platforms by APT_TARGETS environment variable like this:

% rake apt:build APT_TARGETS="debian-bookworm,ubuntu-jammy"

You can find other supported platforms under fluent-package/apt directory.

Note for AArch64 platforms

You can also built packages for AArch64 platforms like this:

% rake apt:build APT_TARGETS="ubuntu-jammy-arm64"

But if you use older GNU/Linux platforms (e.g. Ubuntu 18.04 or before) as your host OS, you need to copy qemu-aarch64-static into the base directory of the target:

% export TARGET_BASE="ubuntu-bionic"
% sudo apt install qemu-user-static
% cd /path/to/fluent-package-builder
% cp /usr/bin/qemu-aarch64-static fluent-package/apt/${TARGET_BASE}
% rake apt:build APT_TARGETS="${TARGET_BASE}-arm64"

How to build .msi package

% rake msi:build

A fluent-package-${version}-x64.msi package will be built under fluent-package/msi directory.

Note for Windows package

You can use with MSYS2 for C extension gem building.

MSI included Ruby can detect MSYS2 environment. So, you can install C extension included gem with MSYS2.

e.g.)

Prepare C extension gem building environment:

cmd> ridk install 2
...
cmd> ridk install 3

Install gem via ridk exec fluent-gem install:

cmd> ridk exec fluent-gem install winevt_c

How to build .dmg package

% sudo mkdir /opt/fluent
% sudo chown $(whoami) /opt/fluent
% rake dmg:selfbuild

A fluent-package-${version}.dmg package will be built under fluent-package/dmg directory.

Note for macOS package

GitHub Actions' built package is ready to run on macOS 10.15 (Catalina).

Be sure to permit to be authorized for for assistive access. In System Preferences > Security & Privacy > Privacy > Accessibility, you should permit Terminal.app there.

NOTE: Since authorization is at the application level on Terminal.app, it allows any script run from Terminal.app to perform GUI scripting.

How to bump up the package version

  • Edit fluent-package/config.rb to choose Ruby & Fluentd versions
  • Edit Gemfile and update .lock files
    • cd fluent-package && rake lockfile:update
  • Bump up the versions of rpm & deb packages by the following command:
% cd fluent-package
% rake version:update
% git diff  # Check the change log
% git commit -a
  • Build packages
% rake apt:build
% rake yum:build
% rake msi:build

Note for bump up the package version

It assumes that Gemfile works with Bundler's multiplatform feature, so bundler must be 2.2.0 or later.

fluent-package-builder's People

Contributors

ashie avatar cosmo0920 avatar daipom avatar eagletmt avatar fujimotos avatar kenhys avatar kou avatar kuroponzu avatar rahulbpatil avatar repeatedly avatar sriramana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fluent-package-builder's Issues

Nightly package support

Problem

td-agent is released every 3 months (maybe), so it may be a case that it was already fixed in upstream.

Expected

For evaluation purpose, nightly package is available.

Actual

Wait until new release or build on yourown.

Use appropriate Gemfile.lock for each build environment

Probrem

Until bundler 2.2.0?, Automultiplatform is not work as expected, so we can not
use correct .lock file for each build environment

Expected

Don't remove .lock file and use proper .lock file separately.

Actual

Currently, we remove .lock file

Additional information

This issue was fixed in upstream, but not released yet.
rubygems/bundler#7580

ubuntu-bionic-arm64 build failed with "175 errors, 61 warnings"

Problem

Build "ubuntu-bionic-arm64" target failed, with logs "175 errors, 61 warnings" at last.
I aslo checked td-agent/apt/repositories/ directory, it's empty.
The builder (container) is still running at last.

Build environment

my vps host is ubuntu bionic on x86_64 platform, 1CPU and 1 GB RAM.

How to reproduce

Follow the instructions in Readme to build

export TARGET_BASE="ubuntu-bionic"
sudo apt install qemu-user-static
cd /path/to/td-agent-builder
cp /usr/bin/qemu-aarch64-static td-agent/apt/${TARGET_BASE}
rake apt:build APT_TARGETS="${TARGET_BASE}-arm64"

Expected

Build successfully

Actual

Build failed

Builder logs

I check the builder logs using "docker logs -f 860a5cd80e74" and find there are some ruby extensions failed.
C)K9B@3V5J`TSL_6LYPIF
ACCQ4ZVHAX)UHQBM 34H)}8
At last, it failed with "175 errors, 61 warnings"
WYA4)U N{~1XRIN_K4}Z4IK
This is the log file dumped by "docker logs 860a5cd80e74 > td-agent-builder.log "
td-agent-builder.log

lintian error "dir-or-file-in-opt"

We got the following error on building debian package:

E: td-agent: dir-or-file-in-opt opt/td-agent/
E: td-agent: dir-or-file-in-opt opt/td-agent/bin/
E: td-agent: dir-or-file-in-opt opt/td-agent/bin/bundle
E: td-agent: dir-or-file-in-opt opt/td-agent/bin/bundler

Unfortunately, they can't be suppressed by package's .override file.
I think we have two options.

  • Move files to standard directories
  • Create a custom lintian's vendor profile and use it by --lintian-opts of debuild command
$ cat ~/.lintian/profiles/td-agent/ubuntu.profile 
Profile: td-agent/ubuntu
Extends: ubuntu/main
Disable-Tags: dir-or-file-in-opt

ubuntu focal arm64: rake build stalls because of lintian

Problem

rake apt:build doesn't finish.

How to reproduce

rake apt:build APT_TARGETS="ubuntu-focal-arm64"

Expected

lintian doesn't stall.

Actual

build process stalls because of lintian.

   dh_builddeb
dpkg-deb: building package 'td-agent' in '../td-agent_3.7.1-1_arm64.deb'.
dpkg-deb: building package 'td-agent-dbgsym' in 'debian/.debhelper/scratch-space/build-td-agent/td-agent-dbgsym_3.7.1-1_arm64.deb'.
        Renaming td-agent-dbgsym_3.7.1-1_arm64.deb to td-agent-dbgsym_3.7.1-1_arm64.ddeb
 dpkg-genbuildinfo
 dpkg-genchanges  >../td-agent_3.7.1-1_arm64.changes
dpkg-genchanges: info: including full source code in upload
 dpkg-source --after-build .
dpkg-buildpackage: info: full upload (original source is included)
Now running lintian --debug --verbose --profile td-agent/ubuntu td-agent_3.7.1-1_arm64.changes ...

pstree on host:

├─dockerd─┬─docker-containe─┬─docker-containe─┬─build.sh─┬─debuild─┬─lintian─┬─nproc                                                                 
│         │                 │                 │          │         │         └─{lintian}                                                             
│         │                 │                 │          │         ├─tee───{tee}                                                                     
│         │                 │                 │          │         └─{debuild}                                                                       
│         │                 │                 │          └─{build.sh}
│         │                 │                 └─8*[{docker-containe}]
│         │                 └─18*[{docker-containe}]
│         └─19*[{dockerd}] 

Additional Information.

ref. #62

rake yum:build A brief survey:

https://packages.ubuntu.com/search?suite=focal&arch=arm64&searchon=names&keywords=lintian
lintian 2.62 is used.
https://bugs.launchpad.net/ubuntu/+source/lintian
It seems that it is not already known issue.
https://bugs.debian.org/cgi-bin/pkgreport.cgi?archive=both;repeatmerged=on;src=lintian
It seems that it is not already known issue even though archive.(I've expected something to do with 2.62-2.76)

UPDATE: 2020/11/01, This issue will be fixed in Ubuntu 21.04. (lintian 2.92.0 or later version)

Shouldn't use /opt directory

Since td-agent-builder is based on omnibu-td-agent, it installs most of files into /opt. But it's not recommended on Debian:

dir-or-file-in-opt errors can't be suppress by package's .lintian-overrides file.
Currently we suppress it forcedly by user's lintian configuration because a lot of such errors make it hard that we find other errors or warnings, but it's not desired way.

We should consider put files into standard locations on GNU/Linux.

In addition, C:\opt isn't familiar on Windows.

Integrate Gemfile and Gemfile.lock under gemfiles/

Probrem

We need Gemfile integration for simplicity

Expected

maintain Single Gemfile and Gemfile.lock for simplicity

Actual

There are two Gemfile depend on environment.

gemfiles/linux/Gemfile
gemfile/windows/Gemfile

Action

After bundler 2.2.0 is released, auto multiplatform is enabled, so we can start to integrate Gemfile.

Question: Should we use different UpgradeCode for td-agent4?

Currently, we use the same UpgradeCode for MSI package.

This should be valid but td-agent 3 and 4 will not be incomplatible due to upgrading Ruby version and such incompatible changes.

How do we treat it?

CI: Need activesupport 6.1 to back to normal AArch64 package building on Travis-CI

Problem

Because of gem dependency, td-agent requires tzinfo 2.x but , travis gem requires tzinfo 1.x.
As a result, CI can't work as expected.

Expected

CI on Travis works as expected.

Actual

CI on Travis always fails.

Action

We need to wait until activesupport 6.1 release.

Automultiplatform again
rubygems/bundler#7580

was merged, it will be shipped as 6.1.0. we wait https://github.com/rails/rails/milestone/69 6.1.0 milestone.

Failed to start td-agent with aarch64

Summary

Failed to start td-agent 4.0.0 on CentOS 8 and 7.

# cat /var/log/messages

Aug 13 18:18:00 ip-10-105-44-194 fluentd[15556]: <jemalloc>: Unsupported system page size
Aug 13 18:18:00 ip-10-105-44-194 fluentd[15556]: <jemalloc>: Unsupported system page size
Aug 13 18:18:00 ip-10-105-44-194 fluentd[15556]: [FATAL] failed to allocate memory

Reproduce

# yum install http://packages.treasuredata.com.s3.amazonaws.com/4/redhat/8/aarch64/td-agent-4.0.0-1.el8.aarch64.rpm -y
# systemctl start td-agent

Environnment

  • CentOS Linux release 8.2.2004 (Core)
  • aarch64
  • AWS EC2 ARM instance (M6g)

Please let me know if any of this information is missing, as I may be missing some of it.

Fail to build docker container for Windows

Although we don't changes Dockerfile for Windows, docker build on GitHub Actions fails since yesterday.

https://github.com/clear-code/td-agent-builder/runs/736916721

Install MSYS2 and MINGW development toolchain succeeded
 _____       _           _____           _        _ _         ___  
|  __ \     | |         |_   _|         | |      | | |       |__ \ 
| |__) |   _| |__  _   _  | |  _ __  ___| |_ __ _| | | ___ _ __ ) |
|  _  / | | | '_ \| | | | | | | '_ \/ __| __/ _` | | |/ _ \ '__/ / 
| | \ \ |_| | |_) | |_| |_| |_| | | \__ \ || (_| | | |  __/ | / /_ 
|_|  \_\__,_|_.__/ \__, |_____|_| |_|___/\__\__,_|_|_|\___|_||____|
                    __/ |           _                              
                   |___/          _|_ _  __   | | o __  _| _     _ 
                                   | (_) |    |^| | | |(_|(_)\^/_> 

re-exec error: exit status 1: output: time="2020-06-04T02:31:07Z" level=error msg="hcsshim::ImportLayer - failed failed in Win32: The system cannot find the path specified. (0x3)" error="hcsshim::ImportLayer - failed failed in Win32: The system cannot find the path specified. (0x3)" importFolderPath="C:\\ProgramData\\docker\\tmp\\hcs403266603" path="\\\\?\\C:\\ProgramData\\docker\\windowsfilter\\2961a824bef1e7df5eedfe4d3e33fde61d6396f0abf0b24601adc418cda42486"
hcsshim::ImportLayer - failed failed in Win32: The system cannot find the path specified. (0x3)
rake aborted!
Command failed with status (1): [docker build --tag td-agent-windows-x64 ms...]
D:/a/td-agent-builder/td-agent-builder/td-agent/Rakefile:902:in `run_docker'
D:/a/td-agent-builder/td-agent-builder/td-agent/Rakefile:822:in `block (2 levels) in define'
D:/a/td-agent-builder/td-agent-builder/td-agent/Rakefile:812:in `block (2 levels) in define'
Tasks: TOP => msi:dockerbuild
(See full trace by running task with --trace)

MSI: Fix td-agent.conf default configuration path

Problem

Default configuration file contains inappropriate path.

Expected

Fixed path by default

Actual

For example, /var/log/td-agent/td exists.

# This section matches events whose tag is td.DATABASE.TABLE
<match td.*.*>
  @type tdlog
  @id output_td
  apikey YOUR_API_KEY

  auto_create_table
  <buffer>
    @type file
    path /var/log/td-agent/buffer/td
  </buffer>

Missing dependencies

I compared dependency of librdkafka in both omnibus-td-agent and td-agent-builder.
I found td-agent-builder version lacks some dependencies:

omnibus-td-agent:

$ ldd ./embedded/lib/ruby/gems/2.4.0/gems/rdkafka-0.7.0/ext/librdkafka.so:
        linux-vdso.so.1 =>  (0x00007ffbffffe000)
        libm.so.6 => /lib64/libm.so.6 (0x00007efbf77ae000)
        libsasl2.so.3 => /lib64/libsasl2.so.3 (0x00007efbf7591000)
        libssl.so.1.0.0 => /opt/td-agent/embedded/lib/libssl.so.1.0.0 (0x00007efbf7325000)
        libcrypto.so.1.0.0 => /opt/td-agent/embedded/lib/libcrypto.so.1.0.0 (0x00007efbf6eec000)
        libz.so.1 => /opt/td-agent/embedded/lib/libz.so.1 (0x00007efbf6cd5000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007efbf6ad1000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007efbf68b5000)
        librt.so.1 => /lib64/librt.so.1 (0x00007efbf66ad000)
        libc.so.6 => /lib64/libc.so.6 (0x00007efbf62df000)
        /lib64/ld-linux-x86-64.so.2 (0x00007efbf7ddd000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007efbf60c6000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007efbf5e8f000)
        libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007efbf5c42000)
        libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007efbf5959000)
        libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007efbf5726000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007efbf5522000)
        libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007efbf5312000)
        libfreebl3.so => /lib64/libfreebl3.so (0x00007efbf510f000)
        libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007efbf4f0b000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007efbf4ce4000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007efbf4a82000)

td-agent-builder:

$ ldd ./lib/ruby/gems/2.4.0/gems/rdkafka-0.7.0/ext/
        linux-vdso.so.1 =>  (0x00007ffbffffe000)
        liblz4.so.1 => /lib64/liblz4.so.1 (0x00007efbf78b2000)
        libm.so.6 => /lib64/libm.so.6 (0x00007efbf75b0000)
        libzstd.so.1 => /lib64/libzstd.so.1 (0x00007efbf730c000)
        libssl.so.10 => /lib64/libssl.so.10 (0x00007efbf709a000)
        libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007efbf6c37000)
        libz.so.1 => /lib64/libz.so.1 (0x00007efbf6a21000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007efbf681d000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007efbf6601000)
        librt.so.1 => /lib64/librt.so.1 (0x00007efbf63f9000)
        libc.so.6 => /lib64/libc.so.6 (0x00007efbf602b000)
        /lib64/ld-linux-x86-64.so.2 (0x00007efbf7ddd000)
        libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007efbf5dde000)
        libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007efbf5af5000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007efbf58f1000)
        libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007efbf56be000)
        libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007efbf54ae000)
        libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007efbf52aa000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007efbf5091000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007efbf4e6a000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007efbf4c08000)

Following dependencies are missing:

  • libsasl
  • libfreebl3.so

In addition, CentOS 8 package lacks more dependencies:

$ ldd lib/ruby/gems/2.4.0/gems/rdkafka-0.7.0/ext/librdkafka.so
        linux-vdso.so.1 (0x00007ffc00100000)
        liblz4.so.1 => /lib64/liblz4.so.1 (0x00007efbfefa9000)
        libm.so.6 => /lib64/libm.so.6 (0x00007efbfec27000)
        libzstd.so.1 => /lib64/libzstd.so.1 (0x00007efbfe983000)
        libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007efbfe6ef000)
        libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007efbfe211000)
        libz.so.1 => /lib64/libz.so.1 (0x00007efbfdffa000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007efbfddf6000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007efbfdbd6000)
        librt.so.1 => /lib64/librt.so.1 (0x00007efbfd9cd000)
        libc.so.6 => /lib64/libc.so.6 (0x00007efbfd60a000)
        /lib64/ld-linux-x86-64.so.2 (0x00007efbff4d6000)

Bundle jemalloc

#24 (comment)

@ashie How about including jemalloc in td-agent?
jemalloc changes internal memory management, so using same version is better for trouble-shooting.

MSI: Failed to execute rake msi:build

Problem

rake msi:build fails to build.

Expected

rake msi:build succeeds.

Actual

ref. #24 (comment)

Fetching fluent-plugin-parser-winevt_xml-0.2.2.gem
Successfully installed mini_portile2-2.4.0
ERROR:  Error installing C:/td-agent-4.0.0.rc1/td-agent/downloads/plugin_gems/26-fluent-plugin-windows-eventlog-0.5.4.gem:
        The last version of nokogiri (>= 1.10, < 1.12) to support your Ruby & RubyGems was 1.10.9. Try installing it with `gem install nokogiri -v 1.10.9` and then running the current command again
        nokogiri requires Ruby version >= 2.3, < 2.7.dev. The current ruby version is 2.7.1.83.
rake aborted!

deb: Failed to re-intall td-agent 4.0.0 when an old config file exists

https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/fluentd/zBr5slN3HQU/7K0LJTEpBgAJ

---INITIAL INSTALL OF TD-AGENT4---

ubuntu@ip-10-0-1-167:~$ curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-bionic-td-agent4.sh | sh  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   851  100   851    0     0   4052      0 --:--:-- --:--:-- --:--:--  4071
==============================
 td-agent Installation Script
==============================
This script requires superuser access to install apt packages.
You will be prompted for your password by sudo.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3157  100  3157    0     0  33585      0 --:--:-- --:--:-- --:--:-- 33585
OK
Hit:1 http://us-west-2.ec2.ports.ubuntu.com/ubuntu-ports bionic InRelease
Hit:2 http://us-west-2.ec2.ports.ubuntu.com/ubuntu-ports bionic-updates InRelease
Hit:3 http://us-west-2.ec2.ports.ubuntu.com/ubuntu-ports bionic-backports InRelease
Get:4 http://packages.treasuredata.com/4/ubuntu/bionic bionic InRelease [7692 B]
Hit:5 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease
Get:6 http://packages.treasuredata.com/4/ubuntu/bionic bionic/contrib arm64 Packages [682 B]
Fetched 8374 B in 0s (23.5 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  td-agent
0 upgraded, 1 newly installed, 0 to remove and 27 not upgraded.
Need to get 9843 kB of archives.
After this operation, 57.3 MB of additional disk space will be used.
Get:1 http://packages.treasuredata.com/4/ubuntu/bionic bionic/contrib arm64 td-agent arm64 4.0.0-1 [9843 kB]
Fetched 9843 kB in 1s (15.6 MB/s)
Selecting previously unselected package td-agent.
(Reading database ... 60331 files and directories currently installed.)
Preparing to unpack .../td-agent_4.0.0-1_arm64.deb ...
Unpacking td-agent (4.0.0-1) ...
Setting up td-agent (4.0.0-1) ...
Adding system user `td-agent' (UID 112) ...
Adding new group `td-agent' (GID 116) ...
Adding new user `td-agent' (UID 112) with group `td-agent' ...
Creating home directory `/var/lib/td-agent' ...
Conffile /etc/td-agent/td-agent.conf has been modified. Remain untouched.
Created symlink /etc/systemd/system/multi-user.target.wants/td-agent.service → /lib/systemd/system/td-agent.service.
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

Installation completed. Happy Logging!

ubuntu@ip-10-0-1-167:~$ sudo /etc/init.d/td-agent start
sudo: /etc/init.d/td-agent: command not found
ubuntu@ip-10-0-1-167:~$ sudo /etc/init.d/td-agent status
sudo: /etc/init.d/td-agent: command not found


--- UNINSTALL OF TD-AGENT 4---

ubuntu@ip-10-0-1-167:~$ sudo apt remove td-agent
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  td-agent
0 upgraded, 0 newly installed, 1 to remove and 27 not upgraded.
After this operation, 57.3 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 67477 files and directories currently installed.)
Removing td-agent (4.0.0-1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
ubuntu@ip-10-0-1-167:~$


--- FAILED INSTALL OF TD-AGENT 3---
ubuntu@ip-10-0-1-167:~$ curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-bionic-td-agent3.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   851  100   851    0     0   4297      0 --:--:-- --:--:-- --:--:--  4297
==============================
 td-agent Installation Script
==============================
This script requires superuser access to install apt packages.
You will be prompted for your password by sudo.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3157  100  3157    0     0  42662      0 --:--:-- --:--:-- --:--:-- 42662
OK
Get:1 http://packages.treasuredata.com/3/ubuntu/bionic bionic InRelease [7692 B]
Hit:2 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease
Get:3 http://packages.treasuredata.com/3/ubuntu/bionic bionic/contrib arm64 Packages [513 B]
Hit:4 http://us-west-2.ec2.ports.ubuntu.com/ubuntu-ports bionic InRelease
Hit:5 http://us-west-2.ec2.ports.ubuntu.com/ubuntu-ports bionic-updates InRelease
Hit:6 http://us-west-2.ec2.ports.ubuntu.com/ubuntu-ports bionic-backports InRelease
Fetched 8205 B in 5s (1576 B/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
td-agent is already the newest version (4.0.0-1).
0 upgraded, 0 newly installed, 0 to remove and 27 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up td-agent (4.0.0-1) ...
Updating conffile /etc/td-agent/td-agent.conf ...
cp: cannot stat '/etc/td-agent/td-agent.conf.tmpl': No such file or directory
dpkg: error processing package td-agent (--configure):
 installed td-agent package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 td-agent
E: Sub-process /usr/bin/dpkg returned an error code (1)

Installation incompleted. Check above messages.

The template path in postinst script should be /opt/td-agent/share/td-agent.conf.tmpl instead of /etc/td-agent/td-agent.conf.tmpl.

Support Amazon Linux 2

AWS provides Amazon Linux 2 images for amd64/arm64v8: https://hub.docker.com/_/amazonlinux

The problem is Amazon Linux 2 is similar to CentOS 7 but not the same.

  • Need to use amazon-linux-extras to install ruby 2.4/2.6. No centos-release-scl.
  • No /etc/redhat-release. Maybe, fixed distribution/distribution_version is enough
  • Need to update td-agent.spec.in for amazon linux 2
  • May hit other difference point...

deb: add option to skip lintian check

Problem

Specific APT_TARGET doesn't finish to build.
There is no workaround for specific container currently.

How to reproduce

rake apt:build APT_TARGETS="ubuntu-focal-arm64"

Expected

rake apt:build APT_TARGETS="ubuntu-focal-arm64" success.
(It is able to skip lintian process if container's lintian is problematic version.)

Actual

rake apt:build process stalls.

MSI: Add Chocolatey package

Chocolatey is a modern package management system (like apt or yum on GNU/Linux) for Windows: https://chocolatey.org/

Most packages for this system is implemeted as a wrapper of an original installer (.msi or .exe).
I'm also planning to use same way to implement td-agent package for it.

Nested "opt\td-agent" folder exists in MSI package

C:\opt\td-agent>dir C:\opt\td-agent\opt\td-agent\share
 ドライブ C のボリューム ラベルは Windows です
 ボリューム シリアル番号は 8E7B-B5D5 です

 C:\opt\td-agent\opt\td-agent\share のディレクトリ

2020/07/09  16:51    <DIR>          .
2020/07/09  16:51    <DIR>          ..
2020/07/09  16:41                27 td-agent-ruby.conf
2020/07/09  16:41             2,508 td-agent.conf.tmpl
               2 個のファイル               2,535 バイト
               2 個のディレクトリ  115,490,639,872 バイトの空き領域

Reduce package size

We can remove unnecessary files from package to reduce the installed size.
One example is /opt/td-agent/lib/ruby/gems/2.4.0/cache.

In addition, I noticed rpm package is 2x bigger than deb.
The size of binary is larger. For example, jemalloc and ruby are different.

  • Ubuntu 18.04
$ ls -ahl /opt/td-agent/lib/
total 5.5M
drwxr-xr-x 4 root root 4.0K Feb 18 02:45 .
drwxr-xr-x 7 root root 4.0K Feb 18 02:45 ..
-rw-r--r-- 1 root root 912K May  7 14:45 libjemalloc.a
-rw-r--r-- 1 root root 912K May  7 14:45 libjemalloc_pic.a
lrwxrwxrwx 1 root root   16 May  7 14:45 libjemalloc.so -> libjemalloc.so.2
-rw-r--r-- 1 root root 552K May  7 14:45 libjemalloc.so.2
lrwxrwxrwx 1 root root   16 May  7 14:45 libruby.so -> libruby.so.2.7.1
lrwxrwxrwx 1 root root   16 May  7 14:45 libruby.so.2.7 -> libruby.so.2.7.1
-rw-r--r-- 1 root root 3.2M May  7 14:45 libruby.so.2.7.1
drwxr-xr-x 2 root root 4.0K Feb 18 02:45 pkgconfig
drwxr-xr-x 6 root root 4.0K Feb 18 02:45 ruby
  • CentOS 8
$ ls -ahl /opt/td-agent/lib/
total 65M
drwxr-xr-x. 4 root root  191 Apr 13 13:15 .
drwxr-xr-x. 7 root root   72 Apr 13 13:15 ..
-rwxr-xr-x. 1 root root  25M May  8  2020 libjemalloc.a
lrwxrwxrwx. 1 root root   16 May  8  2020 libjemalloc.so -> libjemalloc.so.2
-rwxr-xr-x. 1 root root 5.8M May  8  2020 libjemalloc.so.2
-rwxr-xr-x. 1 root root  25M May  8  2020 libjemalloc_pic.a
lrwxrwxrwx. 1 root root   16 May  8  2020 libruby.so -> libruby.so.2.7.1
lrwxrwxrwx. 1 root root   16 May  8  2020 libruby.so.2.7 -> libruby.so.2.7.1
-rwxr-xr-x. 1 root root 9.6M May  8  2020 libruby.so.2.7.1
drwxr-xr-x. 2 root root   44 Apr 13 13:15 pkgconfig
drwxr-xr-x. 6 root root   67 Apr 13 13:15 ruby

Of course, other extension gems are also bigger.

Migrate Gemfile based gem installation

Currently, gem installation is proceeded by gem install and these files:
https://github.com/fluent-plugins-nursery/td-agent-builder/blob/master/td-agent/core_gems.rb
https://github.com/fluent-plugins-nursery/td-agent-builder/blob/master/td-agent/plugin_gems.rb

Recent rubygems can handle Gemfile with gem install --file:
https://github.com/rubygems/rubygems/blob/6d167c1df771c7ef3f2f7c4fb12c4416c0a384b6/lib/rubygems/install_update_options.rb#L136-L151

Using gem install --file Gemfile is one of the way to migrate Gemfile based installation.

deb: Address lintian errors

Currently we get following lintian errors & warnings:

E: td-agent changes: bad-distribution-in-changes-file unstable
E: td-agent: embedded-library opt/td-agent/lib/ruby/2.4.0/x86_64-linux/psych.so: libyaml
E: td-agent: extended-description-is-empty
E: td-agent: no-copyright-file
W: td-agent: binary-without-manpage usr/bin/td
W: td-agent: binary-without-manpage usr/sbin/td-agent
W: td-agent: binary-without-manpage usr/sbin/td-agent-gem
W: td-agent: maintainer-script-needs-depends-on-adduser postinst
W: td-agent: maintainer-script-should-not-use-recursive-chown-or-chmod postinst:60
W: td-agent: maintainer-script-should-not-use-recursive-chown-or-chmod postinst:63
W: td-agent source: missing-debian-source-format
W: td-agent source: no-debian-copyright
W: td-agent: package-has-unnecessary-activation-of-ldconfig-trigger
W: td-agent: possibly-insecure-handling-of-tmp-files-in-maintainer-script postinst:62
W: td-agent source: unused-build-dependency-on-cdbs
W: td-agent: unusual-interpreter opt/td-agent/lib/ruby/gems/2.4.0/gems/bundler-1.16.6/lib/bundler/templates/Executable #!<%=
W: td-agent: unusual-interpreter opt/td-agent/lib/ruby/gems/2.4.0/gems/bundler-1.16.6/lib/bundler/templates/Executable.bundler #!<%=
W: td-agent: unusual-interpreter opt/td-agent/lib/ruby/gems/2.4.0/gems/bundler-1.16.6/lib/bundler/templates/Executable.standalone #!<%=
W: td-agent: uses-dpkg-database-directly postinst (line 37)
W: td-agent: uses-dpkg-database-directly postinst (line 40)
N: 360 tags overridden (224 errors, 136 warnings)

In addition, we are now suppressing more errors/warning by overriding lintian tags:

$ cat td-agent/debian/td-agent.lintian-overrides
td-agent: package-contains-vcs-control-file
td-agent: windows-devel-file-in-package
td-agent: dir-or-file-in-build-tree
td-agent: ruby-script-but-no-ruby-dep
td-agent: script-not-executable
td-agent: python-script-but-no-python-dep
td-agent: executable-not-elf-or-script
td-agent: missing-dep-for-interpreter
td-agent: gz-file-not-gzip
td-agent: no-upstream-changelog
td-agent: library-not-linked-against-libc
td-agent: wrong-path-for-interpreter
td-agent: duplicate-font-file
td-agent: jar-not-in-usr-share
td-agent: incorrect-libdir-in-la-file

We should ensure to address them by proper ways.

"The specified module could not be found" when using windows_eventlog2

Everything works when using the example windows_eventlog config but not when im using my own or the example windows_eventlog2 config.

plugin versions:

winevt_c' 0.8.1
fluent-plugin-windows-eventlog 0.7.0

Tried on Windows 10 and Windows Server 2019

Errorlog:

C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': 126: The specified module could not be found.   - C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/winevt_c-0.8.1/lib/winevt/winevt.so (LoadError)
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/winevt_c-0.8.1/lib/winevt.rb:4:in `rescue in <top (required)>'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/winevt_c-0.8.1/lib/winevt.rb:1:in `<top (required)>'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in `require'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluent-plugin-windows-eventlog-0.7.0/lib/fluent/plugin/in_windows_eventlog2.rb:1:in `<top (required)>'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/registry.rb:102:in `block in search'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/registry.rb:99:in `each'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/registry.rb:99:in `search'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/registry.rb:44:in `lookup'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin.rb:155:in `new_impl'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/plugin.rb:105:in `new_input'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/root_agent.rb:312:in `add_source'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/root_agent.rb:158:in `block in configure'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/root_agent.rb:152:in `each'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/root_agent.rb:152:in `configure'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/engine.rb:105:in `configure'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/engine.rb:80:in `run_configure'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/supervisor.rb:551:in `run_supervisor'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/lib/fluent/command/fluentd.rb:330:in `<top (required)>'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/opt/td-agent/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/opt/td-agent/lib/ruby/gems/2.4.0/gems/fluentd-1.10.2/bin/fluentd:8:in `<top (required)>'
        from C:/opt/td-agent/bin/fluentd:23:in `load'
        from C:/opt/td-agent/bin/fluentd:23:in `<main>'

MSI: Cannot build native extensions

When I tried to install a C extension of Ruby on Windows, I got the following error:

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lx64-msvcrt-ruby270
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:261: bson_native.so] 繧ィ繝ゥ繝シ 1

make failed, exit code 2

Gem files will remain installed in C:/opt/td-agent/lib/ruby/gems/2.7.0/gems/bson-4.9.4 for inspection.
Results logged to C:/opt/td-agent/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/bson-4.9.4/gem_make.out

The cause is that td-agent-builder removes libx64-msvcrt-ruby270.dll.a in RubyInstaller.

Support CentOS 6

This build system currently supports only modern distributions:

  • CentOS 7 or later
  • Ubuntu 18.04 or later

But at least CentOS 6 should be also supported since we have users who use it.

Enhancement: Publish a Gemfile.lock with each td-agent release.

td-agent vX.Y.Z represents a curated collection of GEMs that have been tested prior to their release.

Our project needs to add some additional plugins to support our requirements with out invalidating the integrity of the release.
Our CI pipeline takes the release, constructs a Gemfile.lock and then tries to install additional GEMS using td-agent-gem to ensure we don't replace any embedded/tested GEMS.

It is desirable if td-agent could create the lock file and publish it with the release.

rake apt:build stalls because of lintian's check with encrypted zip files

Problem

rake apt:build stalls because of lintian's check with encrypted zip files

Expected

rake apt:build succeeds without stalling.

Actual

rake apt:build stalls. It is caused by stopped lintian check process.

 184023 pts/0    S+     0:09 lintian --profile td-agent/ubuntu td-agent_3.7.0-1_amd64.changes
 185063 pts/0    S+     0:00 unzip -t /tmp/lintian-pool-cdSp7Kwv7Q/pool/t/td-agent/td-agent_3.7.0-1_amd64_binary/unpacked/opt/td-agent/lib/ruby/gems/2.4.0/gems/rubyzip-1.3.0/test/data/zipWithEncryption.zip

  17:07

        |-containerd-+-containerd-shim-+-build.sh---debuild-+-lintian --profi---unzip
        |            |                 |                    `-tee
        |            |                 `-9*[{containerd-shim}]
        |            `-24*[{containerd}]

This situation occurs on Ubuntu 20.04(focal)

Workaround

It seems that this is the bug of lintian.
It was already reported as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=935292 and fixed in lintian/2.67.0.

Workaround is:

  • Use lintian on testing(bulleseye) or sid
    apt install -t testing lintian on buster
  • on Ubuntu, fixed version is not released yet.

ubuntu bionic arm64:standard_init_linux.go:211: exec user process caused "no such file or directory"

Problem

rake apt:build APT_TARGETS="ubuntu-bionic-arm64" failed
my host is ubuntu bionic on x86_64 platform

How to reproduce

Follow the instructions in Readme to build

export TARGET="ubuntu-bionic-arm64"
sudo apt install qemu-user-static
cd /path/to/td-agent-builder
cp /usr/bin/qemu-aarch64-static td-agent/apt/${TARGET}
rake apt:build APT_TARGETS=${TARGET}

Expected

build successfully

Actual

build failed

More infomation

$%H6{MRDJN`N43C8KBGR248

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.