Why I cant export PATH by command .ebextensions config

587 views Asked by At

Hi I want to use goofys on AWS ElasticBeanstalk php 7.0 environment.
I create .ebextentions/00_install_goofy.config.

(install golang from binary because golang version by yum is old.

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 

But 100_install_golang_03 not work well...

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)

I cant export env and path. Can I set PATH on .ebextensions?

Or is there better way to install goofys on ElasticBeanstalk automatically.

1

There are 1 answers

0
hani On BEST ANSWER

finally I find commands defined by .ebextensions run NO EVIRONMET VALUE. It work on an environment like sandbox.

So scope of "export" commands is only "command" section.

if you want to use PATH in commands, you have to add export command to every commands.

Additionally if you want use PATH after eb deployed, see following link.

How can I add PATH on Elastic Beanstalk