Kolla provides production-ready containers and deployment tools for operating OpenStack clouds
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
3.5KB

  1. FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
  2. LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
  3. {% block fluentd_header %}{% endblock %}
  4. {% import "macros.j2" as macros with context %}
  5. {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
  6. {{ macros.configure_user(name='fluentd', groups='mysql') }}
  7. # TODO:remove hostname package as it should be installed by the
  8. # fluentd dependencies.
  9. # hostname package is installed by default on CentOS/RHEL but not on
  10. # oraclelinux.
  11. {% set fluentd_packages = [
  12. 'fluentd',
  13. 'gcc-c++',
  14. 'hostname',
  15. 'make',
  16. 'ruby-devel',
  17. 'rubygem-fluent-plugin-elasticsearch',
  18. 'rubygem-fluent-plugin-grok-parser',
  19. 'rubygem-fluent-plugin-rewrite-tag-filter',
  20. 'rubygem-fluent-plugin-secure-forward'
  21. ] %}
  22. {% elif base_distro in ['debian', 'ubuntu'] %}
  23. {{ macros.configure_user(name='td-agent', groups='mysql') }}
  24. {% set fluentd_packages = [
  25. 'g++',
  26. 'make',
  27. 'ruby',
  28. 'ruby-dev',
  29. 'td-agent'
  30. ] %}
  31. {% endif %}
  32. {{ macros.install_packages(fluentd_packages | customizable("packages")) }}
  33. # Distro specific files and operations
  34. {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
  35. COPY rpm_fluentd_sudoers /etc/sudoers.d/kolla_fluentd_sudoers
  36. RUN chmod 440 /etc/sudoers.d/kolla_fluentd_sudoers \
  37. && mkdir -p /var/run/fluentd \
  38. && chown -R fluentd: /etc/fluentd /var/run/fluentd
  39. {% elif base_distro in ['debian', 'ubuntu'] %}
  40. COPY fluentd_sudoers /etc/sudoers.d/kolla_fluentd_sudoers
  41. RUN chmod 440 /etc/sudoers.d/kolla_fluentd_sudoers \
  42. && sed -i -e "s/USER=td-agent/USER=root/" -e "s/GROUP=td-agent/GROUP=root/" /etc/init.d/td-agent \
  43. && rm -f /etc/td-agent/td-agent.conf \
  44. && chown -R td-agent: /etc/td-agent
  45. {% endif %}
  46. COPY extend_start.sh /usr/local/bin/kolla_extend_start
  47. RUN chmod 755 /usr/local/bin/kolla_extend_start
  48. {% block fluentd_plugins_install %}
  49. {% if base_distro in ['debian', 'ubuntu'] %}
  50. # NOTE(osmanlicilegi): fluentd has dropped support for ruby 2.3 and below at
  51. # the end of 2019 so we need to pin its version to 1.8.x.
  52. # NOTE(mgoddard): fluent-plugin-elasticsearch requires faraday, which from
  53. # 0.16.0 depends on Ruby 2.3, but td-agent provides its own older version of
  54. # Ruby.
  55. {% set fluentd_plugins = [
  56. 'fluentd:"<1.9.0"',
  57. 'faraday:"~>0.15.4"',
  58. 'fluent-plugin-elasticsearch:4.0.0',
  59. 'fluent-plugin-grep',
  60. 'fluent-plugin-grok-parser:2.1.4',
  61. 'fluent-plugin-parser',
  62. 'fluent-plugin-rewrite-tag-filter:2.0.0',
  63. 'fluent-plugin-secure-forward',
  64. ] %}
  65. {% endif %}
  66. {{ macros.install_fluent_plugins(fluentd_plugins | customizable("plugins")) }}
  67. # Build and install Fluentd output plugin for Monasca Log API
  68. ARG monasca_output_plugin_tag=0.1.0
  69. ARG monasca_output_plugin_url=https://github.com/monasca/fluentd-monasca/archive/$monasca_output_plugin_tag.tar.gz
  70. ADD $monasca_output_plugin_url /tmp/fluentd-monasca.tar.gz
  71. RUN tar -xvf /tmp/fluentd-monasca.tar.gz -C /tmp \
  72. && cd /tmp/fluentd-monasca-* \
  73. && gem build fluentd-monasca-output.gemspec \
  74. && gem install fluentd-monasca-output-*.gem \
  75. && {{ macros.install_fluent_plugins(['fluentd-monasca-output-*.gem'], chain=True) }} \
  76. && rm -rf /tmp/fluentd*
  77. {% endblock %}
  78. {% block fluentd_footer %}{% endblock %}
  79. {% block footer %}{% endblock %}
  80. {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
  81. USER fluentd
  82. {% elif base_distro in ['debian', 'ubuntu'] %}
  83. USER td-agent
  84. {% endif %}