Elastic Beanstalk environment variables for Docker host

后端 未结 5 674
春和景丽
春和景丽 2021-02-08 04:51

I have an EB env with Docker web app (rails) properly deployed. I set several EB env variables and they are properly visible in the container. Now - I\'d like these EB env varia

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-08 05:43

    Adding to @Patrick H McJury's answer.

    Here is how it worked for me in a multi container beanstalk environment -

    .ebextensions/newrelic.config -

    container_commands:
      setup-nr-infra:
        command: |
          NRIA_LICENSE_KEY=$(sudo /opt/elasticbeanstalk/bin/get-config environment | jq -r '.NEW_RELIC_LICENSE_KEY')
          NRIA_DISPLAY_NAME=$(sudo /opt/elasticbeanstalk/bin/get-config environment | jq -r '.APPNAME')
          touch /etc/newrelic-infra.yml && \
          echo "license_key: ${NRIA_LICENSE_KEY}" > /etc/newrelic-infra.yml && \
          echo "display_name: ${NRIA_DISPLAY_NAME}" >> /etc/newrelic-infra.yml && \
          chmod 644 /etc/newrelic-infra.yml
          sudo initctl start newrelic-infra || true
    
    commands:
    # Create the agent’s yum repository
      "01-agent-repository":
        command: sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/el/6/x86_64/newrelic-infra.repo
    #
    # Update your yum cache
      "02-update-yum-cache":
        command: yum -q makecache -y --disablerepo='*' --enablerepo='newrelic-infra'
    #
    # Run the installation script
      "03-run-installation-script":
        command: sudo yum install newrelic-infra -y
    

    NEW_RELIC_LICENSE_KEY & APPNAME variable must be populated before in beanstalk environment.

提交回复
热议问题