Elasticbeanstalk .ebextensions不起作用

时间:2020-06-24 18:05:09

标签: amazon-web-services amazon-elastic-beanstalk

我正在使用circleci将go应用程序部署到弹性beantalk。 我有一个.ebextensions文件夹,其中包含以下两个文件 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"

filebeat代理的第一个文件按预期运行。但是,扩展名02_nginx.config似乎没有运行,并且没有文件结尾在/etc/nginx/conf.d /

有人认为这种方法有什么问题吗?或者对我可以进一步调查这个问题有什么建议?

我检查了/var/log/eb-activity.log文件,其中没有错误

谢谢 达米安

1 个答案:

答案 0 :(得分:1)

如果您使用的是最近发布的Amazon Linux 2平台(可用于Golang),则可以将自定义nginx配置放在.platform/nginx/目录中。这将简化您的配置,因为文件将被平台自动提取。

有关更多信息,请参见Migrating your Elastic Beanstalk Linux application to Amazon Linux 2Extending Elastic Beanstalk Linux platforms