简体   繁体   English

为什么AWS Elastic beantalk无法构建我的应用程序?

[英]Why does AWS elastic beanstalk fail to build my app?

I have an app written in Go, which I attempted to deploy to EB. 我有一个用Go编写的应用程序,尝试将其部署到EB。 When trying to access it, I get an Error 502 from nginx, presumably because the app is not running. 尝试访问它时,我从nginx收到错误502,大概是因为该应用程序未运行。

Looking at logs, I get a lot of errors like 查看日志,我发现很多错误,例如

14:01:29 build.1 | application.go:10:2: cannot find package "github.com/aws/aws-sdk-go/aws" in any of:
14:01:29 build.1 |  /opt/elasticbeanstalk/lib/go/src/github.com/aws/aws-sdk-go/aws (from $GOROOT)
14:01:29 build.1 |  /var/app/current/src/github.com/aws/aws-sdk-go/aws (from $GOPATH)

Despite the fact, that I have all of my dependencies included in the application bundle under a vendor subdirectory. 尽管事实如此,但我的所有依赖关系都包含在vendor子目录下的应用程序捆绑中。 How come EB does not use vendoring? EB为什么不使用供应商? According to the dashboard, it is running Go 1.9, so vendoring should be supported. 根据仪表板,它正在运行1.9,因此应支持供应商。

You need to set your GOPATH in your EBS to the root of your project directory, assuming there is a src directory where your vendor directory is located. 您需要将EBS中的GOPATH设置为项目目录的根目录,并假定您的vendor目录位于一个src目录中。

For instance, pretend this is your project structure: 例如,假设这是您的项目结构:

app/
    src/
        vendor/

And pretend that project is located in ~/home , which makes its location ~/home/app . 并假装该项目位于~/home ,从而使其位置为~/home/app

Then your GOPATH should be set to ~/home/app . 然后,您的GOPATH应该设置为~/home/app Go will attempt to access the dependencies through $GOPATH/src/vendor . Go将尝试通过$GOPATH/src/vendor访问依赖项。


But if this were the kind of structure you were using before, then you would need to have your GOPATH updated during local development as well, so if you aren't already doing that then I imagine you're using a different kind of setup... this solution, however, will work as long as your project is structured as I described above. 但是,如果这是您以前使用的那种结构,那么您还需要在本地开发期间更新GOPATH,因此,如果您尚未这样做,那么我想您正在使用另一种设置。 ..但是,只要您的项目的结构如上所述,该解决方案就可以使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么在我安装Requirements.txt时在AWS Elastic Beanstalk上的环境失败 - Why does my environment on AWS Elastic Beanstalk fail when installing the requirements.txt 为什么导入机械化会破坏我的AWS EC2弹性豆茎烧瓶“ Hello World” Python应用程序? - Why does import mechanize break my aws ec2 elastic beanstalk flask “hello world” python app? 为什么我的Rails应用程序无法部署到AWS Elastic Beanstalk? - Why is my Rails App failing to deploy to AWS Elastic Beanstalk? 我的AWS Elastic Beanstalk应用程序消失了 - My AWS Elastic Beanstalk app disappeared 使用aws fargate有什么缺点(缺点)?为什么我的laravel应用程序在fargate和弹性beanstalk上运行缓慢? - What is disadvantages(cons) to use aws fargate and why my laravel app is slow on fargate vs elastic beanstalk? AWS Elastic Beanstalk 负载均衡器正在重定向到 HTTPS - 我的应用程序是否仍然需要 UseHttpsRedirection() 和 UseHsts()? - AWS Elastic Beanstalk load balancer is redirecting to HTTPS - does my app still need UseHttpsRedirection() and UseHsts()? 为什么 Eclipse 中 AWS Toolkit 中的 Elastic Beanstalk 节点不显示我的环境? - Why does Elastic Beanstalk node in AWS Toolkit in Eclipse not show my environments? 为什么我通过 CLI 创建的 Elastic Beanstalk 应用程序没有显示在在线 AWS Elastic Beanstalk 控制台上? - Why is my Elastic Beanstalk application created through the CLI not showing up on the online AWS Elastic Beanstalk console? 在AWS Elastic Beanstalk上运行Docker容器 - 我的Web应用程序在哪里? - Running a Docker container on AWS Elastic Beanstalk - Where is my web app? aws elastic beanstalk 部署了我的应用程序,但在下一次部署时抛出错误 - aws elastic beanstalk deploys my app but on next deployments throws an error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM