如何将 GO Echo 我的应用程序部署到 Elastic Beanstalk
How to deploy GO Echo my app to Elastic Beanstalk
我正在尝试将 Go echo 应用程序部署到弹性 beanstalk。
我正在使用 go modules 并且 go.mod 和 go.sum 被签入我的 repo
我的回购协议的根目录中也有以下文件
构建文件
build: go build -o bin/application application.go
Procfile
web: bin/application
每隔几次我部署一个构建 - 它都会失败。
当我登录到由弹性 beantalk 创建的 ec2 实例并检查文件 /var/log/eb-activity.log - 我看到以下内容
creating: /var/app/staging/pkg/usermanagement/
inflating: /var/app/staging/pkg/usermanagement/usermanagement.go
inflating: /var/app/staging/pkg/usermanagement/usermanagement_test.go
creating: /var/app/staging/scripts/
inflating: /var/app/staging/scripts/00_init.sql
inflating: /var/app/staging/scripts/10_indices_for_loading.sql
inflating: /var/app/staging/scripts/20_indices_for_searching.sql
inflating: /var/app/staging/scripts/create_coded_adsbx.py
creating: /var/app/staging/scripts/db-data/
inflating: /var/app/staging/scripts/db-data/aircraft_current-2020-01-27-coded.csv
creating: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/
inflating: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.README.html
extracting: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.VERSION.txt
extracting: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.cpg
inflating: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.dbf
inflating: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.prj
inflating: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.shp
inflating: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.shx
inflating: /var/app/staging/scripts/init.sh
extracting: /var/app/staging/scripts/init_db.py
inflating: /var/app/staging/scripts/localities_sys_setup.sql
Executing: HOME=/tmp /opt/elasticbeanstalk/lib/ruby/bin/ruby /opt/elasticbeanstalk/lib/ruby/bin/foreman start --procfile /tmp/d20200320-5495-eutama/eb-buildtask-0 --root /var/app/staging --env /var/elasticbeanstalk/staging/elasticbeanstalk.env
13:17:25 build.1 | started with pid 5508
13:17:25 build.1 | $GOPATH/go.mod exists but should not
13:17:25 build.1 | exited with code 1
13:17:25 system | sending SIGTERM to all processes
似乎没有下载所需的依赖项
我想知道我是否遗漏了什么,是否应该 go.mod 包含在我的回购中(我不明白为什么不应该)
运行go.env的结果如下
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ec2-user/.cache/go-build"
GOENV="/home/ec2-user/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ec2-user/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/elasticbeanstalk/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/elasticbeanstalk/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/var/app/current/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build578441755=/tmp/go-build -gno-record-gcc-switches"
我在 circleci 中生成了应用程序工件,并使用 .ebignore
文件仅推送该库。 Elasticbeanstalk 上没有构建,现在一切正常
我正在尝试将 Go echo 应用程序部署到弹性 beanstalk。 我正在使用 go modules 并且 go.mod 和 go.sum 被签入我的 repo 我的回购协议的根目录中也有以下文件
构建文件
build: go build -o bin/application application.go
Procfile
web: bin/application
每隔几次我部署一个构建 - 它都会失败。 当我登录到由弹性 beantalk 创建的 ec2 实例并检查文件 /var/log/eb-activity.log - 我看到以下内容
creating: /var/app/staging/pkg/usermanagement/
inflating: /var/app/staging/pkg/usermanagement/usermanagement.go
inflating: /var/app/staging/pkg/usermanagement/usermanagement_test.go
creating: /var/app/staging/scripts/
inflating: /var/app/staging/scripts/00_init.sql
inflating: /var/app/staging/scripts/10_indices_for_loading.sql
inflating: /var/app/staging/scripts/20_indices_for_searching.sql
inflating: /var/app/staging/scripts/create_coded_adsbx.py
creating: /var/app/staging/scripts/db-data/
inflating: /var/app/staging/scripts/db-data/aircraft_current-2020-01-27-coded.csv
creating: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/
inflating: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.README.html
extracting: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.VERSION.txt
extracting: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.cpg
inflating: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.dbf
inflating: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.prj
inflating: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.shp
inflating: /var/app/staging/scripts/db-data/localities_sys-shapefiles-admin-1/ne_10m_admin_1_states_provinces.shx
inflating: /var/app/staging/scripts/init.sh
extracting: /var/app/staging/scripts/init_db.py
inflating: /var/app/staging/scripts/localities_sys_setup.sql
Executing: HOME=/tmp /opt/elasticbeanstalk/lib/ruby/bin/ruby /opt/elasticbeanstalk/lib/ruby/bin/foreman start --procfile /tmp/d20200320-5495-eutama/eb-buildtask-0 --root /var/app/staging --env /var/elasticbeanstalk/staging/elasticbeanstalk.env
13:17:25 build.1 | started with pid 5508
13:17:25 build.1 | $GOPATH/go.mod exists but should not
13:17:25 build.1 | exited with code 1
13:17:25 system | sending SIGTERM to all processes
似乎没有下载所需的依赖项 我想知道我是否遗漏了什么,是否应该 go.mod 包含在我的回购中(我不明白为什么不应该)
运行go.env的结果如下
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ec2-user/.cache/go-build"
GOENV="/home/ec2-user/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ec2-user/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/elasticbeanstalk/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/elasticbeanstalk/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/var/app/current/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build578441755=/tmp/go-build -gno-record-gcc-switches"
我在 circleci 中生成了应用程序工件,并使用 .ebignore
文件仅推送该库。 Elasticbeanstalk 上没有构建,现在一切正常