Damien
Damien

Reputation: 4121

Elasticbeanstalk .ebextensions not taking effect

I am deploying a go application to elastic beanstalk using circleci. I have a .ebextensions folder with the following two files in it 01_filebeat.config

files:
  "/etc/filebeat/filebeat.yml":
    mode: "000755"
    owner: root
    group: root
    content: |
      filebeat.inputs:
          - type: log
            enabled: true
            paths:
               - /var/log/web*.log
               - /tmp/application.INFO
               - /tmp/application.WARNING
               - /tmp/application.ERROR
               - /var/log/nginx/access.log
               - /var/log/nginx/error.log
            fields_under_root: true
      output.elasticsearch:
        hosts: ["FILEBEAT-HOST-PLACEHOLDER:443"]
        protocol: "https"
      setup.ilm:
        enabled: false
commands:
  1_command:
    command: "curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-oss-7.8.0-x86_64.rpm"
    cwd: /home/ec2-user
  2_command:
    command: "rpm -ivh --replacepkgs filebeat-oss-7.8.0-x86_64.rpm"
    cwd: /home/ec2-user
  3_command:
    command: "/etc/init.d/filebeat start"

02_nginx.config

files:
  "/etc/nginx/conf.d/01-timeout.conf":
     mode: "000644"
     owner: root
     group: root
     content: |
       keepalive_timeout 300s;
       proxy_connect_timeout 300s;
       proxy_send_timeout 300s;
       proxy_read_timeout 300s;
       fastcgi_send_timeout 300s;
       fastcgi_read_timeout 300s;
commands:
  nginx_reload:
     command: "sudo service nginx reload"

The first file for the filebeat agent runs as expected. However, the extension 02_nginx.config doesnt seem to run and no files end up in /etc/nginx/conf.d/

Does anyone see anything wrong with this approach or have any recommendations on what I could dd to investigate this issue further?

I checked the file /var/log/eb-activity.log and there are no errors in there

Thank you Damien

Upvotes: 0

Views: 487

Answers (1)

stefansundin
stefansundin

Reputation: 3054

If you are using the recently released Amazon Linux 2 platform (available for Golang), then you can put your custom nginx configuration in the .platform/nginx/ directory. This should simplify your configuration as the files will be automatically picked up by the platform.

See Migrating your Elastic Beanstalk Linux application to Amazon Linux 2 and Extending Elastic Beanstalk Linux platforms for more information.

Upvotes: 1

Related Questions