我有一個預先存在的golang項目,其中包含以下文件夾結構(爲了提高可讀性最小化文件夾)。將cmd文件夾中的golang應用程序部署到AWS Beanstalk
- postgre
- service.go
- cmd
- vano
- main.go
- vanoctl
- main.go
vano.go
現在,因爲我的項目的Web服務器是./cmd/vano
我需要創建一個自定義的Buildfile
和Procfile
。所以我做了
這裏是我的構建文件
make: ./build.sh
build.sh文件:
#!/usr/bin/env bash
# Install dependencies.
go get ./...
# Build app
go build ./cmd/vano -o bin/application
最後我Procfile:
web: bin/application
所以現在我的文件夾結構看起來像這個:
- postgre
- service.go
- cmd
- vano
- main.go
- vanoctl
- main.go
vano.go
Buildfile
build.sh
Procfile
我拉上使用Git源:
git archive --format=zip HEAD > vano.zip
,並上傳到AWS魔豆。我如何不斷收到錯誤,並且AWS錯誤似乎不是最符合要求的。這是我的錯誤
Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
錯誤消息
[Instance: i-0d8f642474e3b2c68] Command failed on instance. Return code: 1 Output: (TRUNCATED)...' Failed to execute 'HOME=/tmp /opt/elasticbeanstalk/lib/ruby/bin/ruby /opt/elasticbeanstalk/lib/ruby/bin/foreman start --procfile /tmp/d20170213-1941-1baz0rh/eb-buildtask-0 --root /var/app/staging --env /var/elasticbeanstalk/staging/elasticbeanstalk.env'. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/01_configure_application.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
額外的錯誤信息:
Failed to execute 'HOME=/tmp /opt/elasticbeanstalk/lib/ruby/bin/ruby /opt/elasticbeanstalk/lib/ruby/bin/foreman start --procfile /tmp/d20170213-1941-1baz0rh/eb-buildtask-0 --root /var/app/staging --env /var/elasticbeanstalk/staging/elasticbeanstalk.env'
它可能未能安裝依賴項。它在'/ var/log/eb-activity.log'文件中說了什麼? – mass
爲什麼你不提供依賴關係,然後壓縮代碼。不需要去'去'/ ...'。 –
看起來像工頭失敗,你的Procfile是否有效? –