Elastic Beanstalk 上特定于环境的 ebextensions
Environment-specific ebextensions on Elastic Beanstalk
我将同一个应用程序部署到两个不同的环境 app-web
和 app-worker
。这些环境的配置略有不同(例如,它们 运行 不同的进程)因此每个环境都需要一些不同的 .ebextensions
。有没有办法指定某个配置文件对于某个环境只能 运行?
这里是只需要为工作环境设置的配置文件:
packages:
yum:
monit: []
files:
"/etc/monit.d/resque_worker":
mode: "000644"
owner: root
group: root
content: |
check process resque_worker_QUEUE
with pidfile /var/app/resque_worker_QUEUE.pid
start program = "/bin/sh -l -c 'cd /var/app/current; nohup rake environment resque:work QUEUE=* VERBOSE=1 PIDFILE=/var/app/resque_worker_QUEUE.pid >> log/resque_worker_QUEUE.log 2>&1'" as uid webapp and gid webapp
stop program = "/bin/sh -c 'cd /var/app/current && kill -9 $(cat tmp/pids/resque_worker_QUEUE.pid) && rm -f /var/app/resque_worker_QUEUE.pid; exit 0;'"
if totalmem is greater than 300 MB for 10 cycles then restart # eating up memory?
group resque_workers
commands:
remove_bak:
command: "rm /etc/monit.d/resque_worker.bak"
ignoreErrors: true
service:
sysvinit:
monit:
ensureRunning: true
enabled: true
我知道我可以测试是否存在环境变量来停止来自 运行 和 commands/test
的命令,但我不确定如何处理其余部分。
据我所知,目前没有办法做到这一点,这非常令人讨厌...我最后写了一个 script which conditionally enables worker extensions for deploys。
基本上在 worker 部署期间,脚本通过将扩展名从 worker-config
更改为 config
来启用某些文件,创建临时提交,部署,然后重置提交。
我将同一个应用程序部署到两个不同的环境 app-web
和 app-worker
。这些环境的配置略有不同(例如,它们 运行 不同的进程)因此每个环境都需要一些不同的 .ebextensions
。有没有办法指定某个配置文件对于某个环境只能 运行?
这里是只需要为工作环境设置的配置文件:
packages:
yum:
monit: []
files:
"/etc/monit.d/resque_worker":
mode: "000644"
owner: root
group: root
content: |
check process resque_worker_QUEUE
with pidfile /var/app/resque_worker_QUEUE.pid
start program = "/bin/sh -l -c 'cd /var/app/current; nohup rake environment resque:work QUEUE=* VERBOSE=1 PIDFILE=/var/app/resque_worker_QUEUE.pid >> log/resque_worker_QUEUE.log 2>&1'" as uid webapp and gid webapp
stop program = "/bin/sh -c 'cd /var/app/current && kill -9 $(cat tmp/pids/resque_worker_QUEUE.pid) && rm -f /var/app/resque_worker_QUEUE.pid; exit 0;'"
if totalmem is greater than 300 MB for 10 cycles then restart # eating up memory?
group resque_workers
commands:
remove_bak:
command: "rm /etc/monit.d/resque_worker.bak"
ignoreErrors: true
service:
sysvinit:
monit:
ensureRunning: true
enabled: true
我知道我可以测试是否存在环境变量来停止来自 运行 和 commands/test
的命令,但我不确定如何处理其余部分。
据我所知,目前没有办法做到这一点,这非常令人讨厌...我最后写了一个 script which conditionally enables worker extensions for deploys。
基本上在 worker 部署期间,脚本通过将扩展名从 worker-config
更改为 config
来启用某些文件,创建临时提交,部署,然后重置提交。