在AWS Elastic beantalk上设置L​​inux服务

时间:2020-10-07 23:09:14

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

我想在通过弹性beantalk部署的Amazon Linux 1实例上重新启动php-fpm和apache。我正在使用负载平衡的环境,并希望自动化整个部署过程。

有人在this post from aws上有其他信息吗?

我很简单,尝试使用yaml文件在每次部署后也要重新启动这些服务(正常)。

示例:

services: 
  sysvinit:
    myservice:
      enabled: true
      ensureRunning: true
      commands: 
        - "command name used as trigger"

我真的不确定“ myservices”部分可接受什么输入。会提供任何帮助。

谢谢!

1 个答案:

答案 0 :(得分:0)

我尚未验证以下内容,但我的理解如下。由于您必须重新启动php-fpmapache服务,因此您的服务部分可能是:

services: 
  sysvinit:
    php-fpm:
      enabled: true
      ensureRunning: true
      commands: 
        - 01_some_command_name
    apache:
      enabled: true
      ensureRunning: true
      commands: 
        - 02_some_other_command_name

01_some_command_name02_some_other_command_namecommands部分中命令的名称。例如:

commands:
  01_some_command_name: 
    command: echo "execute command 01"
  02_some_other_command_name: 
    command: echo "execute command 02"

执行这两个命令应该在我看来触发php-fpmapache服务的重启。