为什么我不能通过命令.ebextensions配置导出PATH

时间:2017-09-09 14:57:14

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

您好我想在AWS ElasticBeanstalk php 7.0环境中使用goofys 我创建.ebextentions / 00_install_goofy.config。

(从二进制文件安装golang,因为yum的golang版本已经过时了。

packages:
  yum:
    fuse: []
commands:
  100_install_golang_01: 
    command: wget https\://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz
  100_install_golang_02: 
    command: tar -C /usr/local -xzf go1.9.linux-amd64.tar.gz
  100_install_golang_03: 
    command: export GOROOT=/usr/local/go
    test: [ -z "$GOROOT" ]
  100_install_golang_04: 
    command: export GOPATH=/home/ec2-user/go
    test: [ -z "$GOPATH" ]
  100_install_golang_05: 
    command: export PATH=$PATH\:$GOROOT/bin\:$GOPATH/bin
  100_install_golang_06: 
    command: echo $GOPATH > gopath 

但100_install_golang_03效果不好......

Test for Command 100_install_golang_03
[2017-09-09T14:39:52.422Z] INFO  [3034]  - [Application deployment app-f68c-170909_143641@1/StartupStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_1_yubion_website] : Completed activity.
[2017-09-09T14:39:52.422Z] INFO  [3034]  - [Application deployment app-f68c-170909_143641@1/StartupStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild] : Activity execution failed, because: [Errno 2] No such file or directory (ElasticBeanstalk::ExternalInvocationError)

我无法导出env和路径。我可以在.ebextensions上设置PATH吗?

或者是否有更好的方法可以自动在ElasticBeanstalk上安装goofys。

1 个答案:

答案 0 :(得分:1)

最后我发现.ebextensions定义的命令运行NO EVIRONMET VALUE。 它适用于像沙盒这样的环境。

"出口的范围"命令只是"命令"部分。

如果要在命令中使用PATH,则必须为每个命令添加export命令。

此外,如果您希望在部署eb后使用PATH,请参阅以下链接。

How can I add PATH on Elastic Beanstalk