Open ajoliveira opened 2 years ago
Checked Elastic-Agent and it also has same 'Relocations' directory and I assume would have same issue - failing to install service, etc. Adding/changing labels accordingly.
Pinging @elastic/elastic-agent (Team:Elastic-Agent)
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)
@nimarezainia could you please have a look.
@ajoliveira sorry for the delay. Was there a specific customer request for this? I understand the use case and why it could be important.
I would prefer to make this enhancement to elastic-agent. your thoughts?
@ajoliveira pls let me know. At the moment ideally I'd like to concentrate on customer found enhancement requests
@nimarezainia Yes, this was found as an issue at a customer installation. Details were provided in direct a e-mail and while it was originally specific to metricbeat, I'll defer to you as to when and how we can implement this. While not optimal, there is a workaround if needed in the meantime.
@nimarezainia should we spend some time on this one or is it something we want to only allow when installed from tar.gz?
@pierrehilbert can the rpm/deb at all use a different install location?
Not currently, only possible when installing through CLI.
Describe the enhancement: For comparison, the Elasticsearch RPM file allows relocation of the
/usr
directory ONLY.RPM supports the use of a '--prefix' flag (ex:
--prefix=/opt
) to change the installation path of files listed in the matching directory (if allowed). For example, the following rpm command output - ex: Relocations:In the case of metricbeat, the 3 top level directories that are used for install are
/etc
,/lib
, and/usr
. Since the allowed relocation is the top-level root directory/
, all 3 directories will be moved since they are sub-directories of this directory. This has an unfortunate side effect that if you are not able to install into/usr
for example, you cannot change ONLY that directory. Installing with the--prefix=/opt/metricbeat
option:sudo rpm -ivh --prefix=/opt/metricbeat metricbeat-7.15.1-x86_64.rpm
everything ends up in
/opt/metricbeat
with no files/directories in/etc/
or/lib
and no service is installed. The workaround can be used to add the service and update configuration files, ex: 1) move files from/opt/metricbeat/etc/*
to/etc
and/opt/metricbeat/lib/*
to/lib
/lib/systemd/system/metricbeat.service
, prepending any references to/usr/share
with/opt/metricbeat
(ex:/opt/metricbeat/usr/share/metricbeat
) 3) do same for resulting/etc/init.d/metricbeat
4) enable the metricbeat service for startup (ex:sudo systemctl enable metricbeat
) 5) start/stop service as requiredDescribe a specific use case for the enhancement or feature: In some cases, users are not allowed to (or it is recommended that they not) install any files to the
/usr
directory and would prefer to install to the/opt
directory as an alternative - WHILE still allowing for proper installation relative to configuration files and startup scripts/services and not require manual steps to get working properly.