Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to deploy golang app with dependencies to the app engine with gcloud?

I have an app that uses "github.com/gorilla/mux" and I am able to deploy it with goapp deploy. But I cannot do the same with gcloud preview app deploy because I am facing this error:

Beginning deployment...
Copying files to Google Cloud Storage...
Synchronizing files to [<googlecloudsdk.api_lib.app.cloud_storage.BucketReference object at 0x10514e790>].
File upload done.
Updating module [api]...failed.
ERROR: (gcloud.preview.app.deploy) Error Response: [9] Deployment contains files that cannot be compiled: Compile failed:
2016/03/22 09:06:40 go-app-builder: build timing: 1×6g (42ms total), 0×6l (0 total)
2016/03/22 09:06:40 go-app-builder: failed running 6g: exit status 1

api.go:29: can't find import: "github.com/gorilla/handlers"

I want to be able to do it because I need to deploy from travisCI on merge and I want to use service-client.json for authorisation.

Is there any way around it?

like image 657
user1835337 Avatar asked Mar 22 '16 16:03

user1835337


2 Answers

Since Google Cloud SDK 142.0.0 with app-engine-go 1.9.50, you should be able to deploy your application doing

gcloud beta app deploy

This also enables you to use CI/CD tools

like image 165
Matthieu Avatar answered Nov 07 '22 11:11

Matthieu


To answer your question directly, the way around this would be to use goapp deploy as is recommended by the App Engine documentation for the Go standard environment, Deploying a Go App. At the time when gcloud preview app deploy was available, goapp was recommended precisely for handling go's specific environment and dependency requirements.

Alternatively, if you're looking to use gcloud, you would need to use gcloud app deploy now. gcloud preview app deploy has been deprecated and/or removed as of June 29, 2016.

like image 42
Nicholas Avatar answered Nov 07 '22 09:11

Nicholas