fluent / fluent-package-builder

td-agent (Fluentd) Building and Packaging System
Apache License 2.0
22 stars 25 forks source link

deb:rpm: stop editing settings for migration #546

Closed daipom closed 1 year ago

daipom commented 1 year ago

This fix stops editing /etc/default/fluentd or /etc/sysconfig/fluentd for migration. We shouldn't touch the settings for migration.

For migration of the config file, we make a symlink:

We stop migrating the log filename. If need to output logs to the old filename td-agent.log, user needs to set the environmental variable.

daipom commented 1 year ago

This PR is originally motivated by the idea that the main migration target should be existing user service files and we should not do complicated migration processes for our own assumption.

In this case, users should migrate the user service file manually. Since we provide symlinks /etc/td-agent/ and /var/log/td-agent/, updating some paths should work:

* `LD_PRELOAD`

* `GEM_HOME`

* `GEM_PATH`

* `/opt/td-agent/bin/fluentd`

I assume the following script, for example.

sudo sed -i /etc/systemd/system/td-agent.service -e 's /opt/td-agent/lib/libjemalloc.so /opt/fluent/lib/libjemalloc.so g'
sudo sed -i /etc/systemd/system/td-agent.service -e 's /opt/td-agent/lib/ruby/gems/2.7.0/ /opt/fluent/lib/ruby/gems/3.2.0/ g'
sudo sed -i /etc/systemd/system/td-agent.service -e 's /opt/td-agent/lib/ruby/gems/2.7.0/ /opt/fluent/lib/ruby/gems/3.2.0/ g'
sudo sed -i /etc/systemd/system/td-agent.service -e 's /opt/td-agent/bin/fluentd /opt/fluent/bin/fluentd g'
echo "Alias=fluentd.service" | sudo tee -a /etc/systemd/system/td-agent.service

This should be done by users manually, I think.

daipom commented 1 year ago

Recently, ServerSpec test for RockyLinux8 often fails and we can't confirm the results of systemd tests. To check the results, I ran the tests without ServerSpec test on my fork. The tests for yum are stable.

kenhys commented 1 year ago

By the way, how about testing with /etc/systemd/system/td-agent.d/override.conf?

daipom commented 1 year ago

By the way, how about testing with /etc/systemd/system/td-agent.d/override.conf?

Thanks. I will separate the fixes about user service file tests from this PR. I will consider it later!

daipom commented 1 year ago

yum tests are all green in my fork(without serverspec test): https://github.com/daipom/fluent-package-builder/actions/runs/5666906256

The Jammy test fails because some gem paths of v450 are different from other platform. It is just a problem of tests. I will separate these new tests from this PR since it is not directly related to this PR.

daipom commented 1 year ago

I will separate the fixes about user service file tests from this PR.

Done.

daipom commented 1 year ago

Thanks for your review!