取决于环境的不同.ebextensions [英] Different .ebextensions depending on environment

查看:254
本文介绍了取决于环境的不同.ebextensions的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个单独的环境来管理我的应用程序,一个是主环境,一个带有负载平衡器的Web服务器,另一个是辅助环境,一个运行克朗的小型工作层.

I have 2 separate environments to manage my application, a primary env, webserver with a load balancer, and a secondary env, a single small tier worker to run crons.

我的.ebextensions包含许多实例和负载平衡器配置,例如:

My .ebextensions contains a lot of Instance and load balancer configurations, example:

01 amazon.config

01amazon.config

Resources:
  # LB SG
  AWSEBLoadBalancerSecurityGroup:
    Type: "AWS::EC2::SecurityGroup"
    Properties:
....

当我通过eb deploy worker-env部署到我的工作程序实例时,是否有任何方法可以忽略此单个文件

Is there any way to ignore this single file when i deploy to my worker instance via eb deploy worker-env

如果不忽略该文件,则由于工作程序没有负载均衡器,它将导致错误.

If the file is not ignored, it causes an error, due to the worker not having a load balancer.

推荐答案

正如 astroanu 在上面的注释中所写,一种方法是根据您的环境来制作版本.以下是根据环境使用 eb create 和custom-$(ENV_TYPE).config文件从我的Makefile中提取的内容.使用 eb deploy 可以使用相同类型的参数.

As astroanu is writing in above comment, one way is to make a version depending on your environment. Following is an extract from my Makefile using eb create with custom-$(ENV_TYPE).config file depending on the environment. The same kind of parameters should be possible with eb deploy.

    git archive -v -o $(ZIP) --format=zip HEAD
    zip $(ZIP) .ebextensions/custom-$(ENV_TYPE).config
    aws s3 cp "$(ZIP)" "s3://$(BUCKET)/$(APP_NAME)/$(VERSION).zip"
    aws elasticbeanstalk create-application-version --application-name "$(APP_NAME)" --version-label "$(VERSION)" --description '$(DESCRIPTION)' --source-bundle "S3Bucket=$(BUCKET),S3Key=$(APP_NAME)/$(VERSION).zip"
    eb create --process --version "$(VERSION)" --branch_default --instance-types "$(INSTANCE_TYPES)" --cname "$(CNAME)"

这篇关于取决于环境的不同.ebextensions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆