Install fluentd gem on debian/ubuntu for non x86_64

The package used to install fluentd on debian/ubuntu is not
available for architectures other than x86_64. For those cases
install fluentd as a gem until the package 'td-agent' is available
for more architectures.

Change-Id: Ic1b25b37d06b429a112f1418a79d385d505bb1e9
This commit is contained in:
Pedro Alvarez 2019-02-21 16:46:21 +00:00 committed by Pedro Alvarez Piedehierro
parent 83e8be4f05
commit 35394e25a3
4 changed files with 31 additions and 7 deletions

View File

@ -18,7 +18,9 @@ LABEL kolla_version="{{ kolla_version }}"
ENV KOLLA_BASE_DISTRO={{ base_distro }} \
KOLLA_INSTALL_TYPE={{ install_type }} \
KOLLA_INSTALL_METATYPE={{ install_metatype }} \
KOLLA_DISTRO_PYTHON_VERSION={{ distro_python_version }}
KOLLA_DISTRO_PYTHON_VERSION={{ distro_python_version }} \
KOLLA_BASE_ARCH={{ base_arch }}
#### Customize PS1 to be used with bash shell
COPY kolla_bashrc /tmp/

View File

@ -27,19 +27,29 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
] %}
{% elif base_package_type == 'deb' %}
{{ macros.configure_user(name='td-agent', groups='mysql') }}
{% set fluentd_packages = [
'g++',
'make',
'ruby',
'ruby-dev',
'td-agent'
] %}
{% if base_arch == 'x86_64' %}
{{ macros.configure_user(name='td-agent', groups='mysql') }}
{% set fluentd_packages = fluentd_packages + [
'td-agent'
] %}
{% else %}
{{ macros.configure_user(name='fluentd', groups='mysql') }}
{% endif %}
{% endif %}
{{ macros.install_packages(fluentd_packages | customizable("packages")) }}
{% if base_package_type == 'deb' and base_arch != 'x86_64' %}
RUN /usr/bin/gem install fluentd --no-rdoc --no-ri
{% endif %}
# Distro specific files and operations
{% if base_package_type == 'rpm' %}
COPY rpm_fluentd_sudoers /etc/sudoers.d/kolla_fluentd_sudoers
@ -47,11 +57,19 @@ RUN chmod 440 /etc/sudoers.d/kolla_fluentd_sudoers \
&& mkdir -p /var/run/fluentd \
&& chown -R fluentd: /etc/fluentd /var/run/fluentd
{% elif base_package_type == 'deb' %}
{% if base_arch == 'x86_64' %}
COPY fluentd_sudoers /etc/sudoers.d/kolla_fluentd_sudoers
RUN chmod 440 /etc/sudoers.d/kolla_fluentd_sudoers \
&& sed -i -e "s/USER=td-agent/USER=root/" -e "s/GROUP=td-agent/GROUP=root/" /etc/init.d/td-agent \
&& rm -f /etc/td-agent/td-agent.conf \
&& chown -R td-agent: /etc/td-agent
{% else %}
COPY rpm_fluentd_sudoers /etc/sudoers.d/kolla_fluentd_sudoers
RUN chmod 440 /etc/sudoers.d/kolla_fluentd_sudoers \
&& mkdir -p /etc/fluentd \
&& mkdir -p /var/run/fluentd \
&& chown -R fluentd: /etc/fluentd /var/run/fluentd
{% endif %}
{% endif %}
@ -90,8 +108,8 @@ RUN tar -xvf /tmp/fluentd-monasca.tar.gz -C /tmp \
{% block fluentd_footer %}{% endblock %}
{% block footer %}{% endblock %}
{% if base_package_type == 'rpm' %}
{% if base_package_type == 'rpm' or (base_package_type == 'deb' and base_arch != 'x86_64') %}
USER fluentd
{% elif base_package_type == 'deb' %}
{% elif base_package_type == 'deb' and base_arch == 'x86_64' %}
USER td-agent
{% endif %}

View File

@ -6,7 +6,7 @@
# Also set the setgid permission on the /var/log/kolla directory so that new
# files and sub-directories in that directory inherit its group id ("kolla").
if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then
if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu && "${KOLLA_BASE_ARCH}" == "x86_64" ]]; then
USERGROUP="td-agent:kolla"
FLUENTD="td-agent"
else

View File

@ -110,7 +110,11 @@ RUN apt-get update \
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] -%}
RUN ulimit -n 65536 && gem install --minimal-deps {{ plugins | join(' ') }}
{%- elif base_distro in ['debian', 'ubuntu'] -%}
RUN ulimit -n 65536 && td-agent-gem install {{ plugins | join(' ') }}
{% if base_arch == 'x86_64' %}
RUN ulimit -n 65536 && td-agent-gem install {{ plugins | join(' ') }}
{% else %}
RUN ulimit -n 65536 && gem install --minimal-deps {{ plugins | join(' ') }}
{% endif %}
{%- endif %}
{%- endif %}
{%- endmacro %}