【发布时间】:2017-02-22 08:05:48
【问题描述】:
我有一个预先存在的 golang 项目,其文件夹结构如下(为了便于阅读,将文件夹最小化)。
- 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 Beanstalk。我是如何不断收到错误的,而 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文件中的内容是什么? -
为什么不提供依赖项然后压缩代码。不用
go get ./...。 -
工头好像失败了,你的 Procfile 有效吗?
-
@KennyGrant 我的 Procfile 大部分来自 AWS 文档
-
@MayankPatel 我可以轻松做到这一点,除非我必须从
cmd文件夹中提供供应商,这对我来说似乎是错误的
标签: amazon-web-services go amazon-elastic-beanstalk