prototipando / google-cloud-sdk

Automatically exported from code.google.com/p/google-cloud-sdk
1 stars 0 forks source link

golang appengine vm application won't run #139

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Downloaded Go Example from 
https://github.com/golang/appengine/tree/master/demos/helloworld
2. gcloud preview app run ./app.yaml 

What is the expected output? What do you see instead?
I expected the application to run and serve the page.  I instead got the 
following error:

Module [default] found in file [/Users/terry/go/src/demo/app.yaml]
INFO: Looking for the Dockerfile in /Users/terry/go/src/demo
INFO: Using Dockerfile found in /Users/terry/go/src/demo
INFO     2015-05-01 22:55:11,962 application_configuration.py:399] No version 
specified. Generated version id: 20150501t225511
INFO     2015-05-01 22:55:11,962 devappserver2.py:745] Skipping SDK update 
check.
INFO     2015-05-01 22:55:12,018 api_server.py:190] Starting API server at: 
http://localhost:60278
INFO     2015-05-01 22:55:12,064 vm_runtime_proxy_go.py:107] Starting Go VM 
Deployment process
INFO     2015-05-01 22:55:12,064 dispatcher.py:192] Starting module "default" 
running at: http://localhost:8080
INFO     2015-05-01 22:55:12,066 admin_server.py:118] Starting admin server at: 
http://localhost:8000
INFO     2015-05-01 22:55:12,104 containers.py:259] Building docker image 
humming-au.default.20150501t225511 from 
/var/folders/2q/xcpjq4j91xdbnjnx_bbd30q00000gn/T/tmpcMVe9Kgo_deployment_dir/Dock
erfile:
INFO     2015-05-01 22:55:12,104 containers.py:261] --------------------  
DOCKER BUILD  --------------------
INFO     2015-05-01 22:55:12,315 containers.py:280] Step 0 : FROM 
gcr.io/google_appengine/golang
INFO     2015-05-01 22:55:12,547 containers.py:280] ---> 23ccdeebfe2d
INFO     2015-05-01 22:55:12,547 containers.py:280] Step 1 : COPY . /go/src/app
INFO     2015-05-01 22:55:12,831 containers.py:280] ---> 174399b102ec
INFO     2015-05-01 22:55:12,839 containers.py:280] Removing intermediate 
container f80c7a43c908
INFO     2015-05-01 22:55:12,840 containers.py:280] Step 2 : RUN go-wrapper 
download
INFO     2015-05-01 22:55:12,936 containers.py:280] ---> Running in e8038ddbd74c
INFO     2015-05-01 22:55:13,256 containers.py:280] + exec go get -v -d

INFO     2015-05-01 22:55:13,333 containers.py:280] Fetching 
https://google.golang.org/appengine?go-get=1

INFO     2015-05-01 22:55:14,519 containers.py:280] Parsing meta tags from 
https://google.golang.org/appengine?go-get=1 (status code 200)

INFO     2015-05-01 22:55:14,520 containers.py:280] get 
"google.golang.org/appengine": found meta tag 
main.metaImport{Prefix:"google.golang.org/appengine", VCS:"git", 
RepoRoot:"https://github.com/golang/appengine"} at 
https://google.golang.org/appengine?go-get=1
google.golang.org/appengine (download)

INFO     2015-05-01 22:55:14,520 containers.py:280] go: missing Git command. 
See http://golang.org/s/gogetcmd
package google.golang.org/appengine: exec: "git": executable file not found in 
$PATH

INFO     2015-05-01 22:55:14,520 containers.py:280] Fetching 
https://google.golang.org/appengine/log?go-get=1

INFO     2015-05-01 22:55:14,847 containers.py:280] Parsing meta tags from 
https://google.golang.org/appengine/log?go-get=1 (status code 200)

INFO     2015-05-01 22:55:14,847 containers.py:280] get 
"google.golang.org/appengine/log": found meta tag 
main.metaImport{Prefix:"google.golang.org/appengine", VCS:"git", 
RepoRoot:"https://github.com/golang/appengine"} at 
https://google.golang.org/appengine/log?go-get=1
get "google.golang.org/appengine/log": verifying non-authoritative meta tag
Fetching https://google.golang.org/appengine?go-get=1

INFO     2015-05-01 22:55:15,171 containers.py:280] Parsing meta tags from 
https://google.golang.org/appengine?go-get=1 (status code 200)

INFO     2015-05-01 22:55:15,171 containers.py:280] package 
google.golang.org/appengine/log
    imports google.golang.org/appengine/log
    imports google.golang.org/appengine/log: cannot find package "google.golang.org/appengine/log" in any of:
    /usr/src/go/src/google.golang.org/appengine/log (from $GOROOT)
    /go/src/google.golang.org/appengine/log (from $GOPATH)
    /go/src/app/_gopath/src/google.golang.org/appengine/log

ERROR    2015-05-01 22:55:15,346 containers.py:283] The command [/bin/sh -c 
go-wrapper download] returned a non-zero code: 1
INFO     2015-05-01 22:55:15,347 containers.py:292] 
--------------------------------------------------------
INFO     2015-05-01 22:55:15,351 vm_runtime_proxy_go.py:133] Go VM Deployment 
process failed: Docker build aborted: The command [/bin/sh -c go-wrapper 
download] returned a non-zero code: 1
ERROR    2015-05-01 22:55:15,351 instance.py:280] Docker build aborted: The 
command [/bin/sh -c go-wrapper download] returned a non-zero code: 1
INFO     2015-05-01 22:55:15,351 health_check_service.py:101] Health checks 
starting for instance 0.

What is the output of 'gcloud info'?

Google Cloud SDK [0.9.58]

Platform: [Mac OS X, x86_64]
Python Version: [2.7.9 (v2.7.9:648dcafa7e5f, Dec 10 2014, 10:10:46)  [GCC 4.2.1 
(Apple Inc. build 5666) (dot 3)]]
Site Packages: [Disabled]

Installation Root: [/Users/terry/google-cloud-sdk]
Installed Components:
  app-engine-python: [1.9.19]
  app: [2015.04.29]
  app-engine-go-darwin-x86_64: [1.9.19]
  app-engine-python-extras: [1.9.18]
  gsutil: [4.12]
  gcutil: [1.16.5]
  app-engine-java: [1.9.19]
  gcloud: [2015.04.29]
  bq: [2.0.18]
  dns: [2015.04.29]
  preview: [2015.04.29]
  gcutil-nix: [1.16.5]
  core: [2015.04.29]
  gae-python: [2014.05.06]
  gsutil-nix: [4.6]
  gae-go: [2015.04.29]
  sql: [2015.04.09]
  gcloud-extensions-darwin-x86_64: [0.15.0]
  core-nix: [2014.10.20]
  compute: [2015.04.29]
  gae-go-nix: [2014.09.10]
  gae-python-launcher-mac: [1.9.19]
  bq-nix: [2.0.18]
System PATH: 
[/Users/terry/google-cloud-sdk/bin:/usr/local/bin:/Library/Frameworks/Python.fra
mework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/terr
y/Sdks/dart/dart-sdk/bin:/Users/terry/Sdks/android:/usr/local/opt/go/libexec/bin
:/Users/terry/go/bin:/Users/terry/Sdks/go_appengine]
Cloud SDK on PATH: [True]

Installation Properties: [/Users/terry/google-cloud-sdk/properties]
User Config Directory: [/Users/terry/.config/gcloud]
User Properties: [/Users/terry/.config/gcloud/properties]
Current Workspace: [None]
Workspace Config Directory: [None]
Workspace Properties: [None]

Logs Directory: [/Users/terry/.config/gcloud/logs]
Last Log File: [/Users/terry/.config/gcloud/logs/2015.05.02/08.55.11.398475.log]

Please provide any additional information below.

Original issue reported on code.google.com by terry.wa...@gmail.com on 1 May 2015 at 10:58

GoogleCodeExporter commented 8 years ago
It looks like it could be the default Dockerfile from the SDK.  As follows: # 
Dockerfile extending the generic Go image with application files for a
# single application.
FROM gcr.io/google_appengine/golang

COPY . /go/src/app
RUN go-wrapper download
RUN go-wrapper install -tags appenginevm

gcloud-golang-todos example has a different Dockerfile:
FROM gcr.io/google_appengine/go-compat

# TODO: Remove once base image updates to 1.4.2 toolchain.
RUN rm -rf /goroot && mkdir /goroot && curl 
https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | tar xvzf - 
-C /goroot --strip-components=1

ADD . /app
RUN /bin/bash /app/_ah/build.sh

After changing the default Dockerfile, the app was able to run.  However I was 
not abled to deploy, see following error:
DEBUG: Host: appengine.google.com
DEBUG: _Authenticate configuring auth; needs_auth=False
DEBUG: Sending request to 
https://appengine.google.com/api/vms/prepare?app_id=humming-au 
headers={'X-appcfg-api-version': '1', 'content-length': '0', 'Content-Type': 
'application/octet-stream'} body=
INFO: Attempting refresh to obtain initial access_token
INFO: Refreshing access_token
DEBUG: Got response: {bucket: vm-containers.humming-au.appspot.com, path: 
/containers}

INFO: Refreshing access_token
DEBUG: Detected docker environment variables: 
DOCKER_HOST=tcp://192.168.59.103:2376, 
DOCKER_CERT_PATH=/Users/terry/.boot2docker/certs/boot2docker-vm, 
DOCKER_TLS_VERIFY=1
INFO: Starting new HTTPS connection (1): 192.168.59.103
DEBUG: "GET /v1.10/_ping HTTP/1.1" 200 2
Updating module [default] from file [/Users/terry/go/src/demo/app.yaml]
INFO: Looking for the Dockerfile in /Users/terry/go/src/demo
INFO: Using Dockerfile found in /Users/terry/go/src/demo
INFO: Building docker image humming-au.default.20150502t131811 from 
/Users/terry/go/src/demo/Dockerfile:
INFO: --------------------  DOCKER BUILD  --------------------
DEBUG: "POST 
/v1.10/build?pull=True&nocache=False&q=False&t=humming-au.default.20150502t13181
1&forcerm=False&rm=True HTTP/1.1" 200 None
INFO: Step 0 : FROM gcr.io/google_appengine/go-compat
INFO: ---> 0cd813bd386d
INFO: Step 1 : RUN rm -rf /goroot && mkdir /goroot && curl 
https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | tar xvzf - 
-C /goroot --strip-components=1
INFO: ---> Using cache
INFO: ---> c04d5ca72d02
INFO: Step 2 : ADD . /app
INFO: ---> c9697e8b62c6
INFO: Removing intermediate container 92da1df4aede
INFO: Step 3 : RUN /bin/bash /app/_ah/build.sh
INFO: ---> Running in b49ad182f4a9
INFO: /bin/bash: /app/_ah/build.sh: No such file or directory

ERROR: The command [/bin/sh -c /bin/bash /app/_ah/build.sh] returned a non-zero 
code: 127
INFO: --------------------------------------------------------
Traceback (most recent call last):
  File "/Users/terry/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 211, in <module>
    main()
  File "/Users/terry/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 207, in main
    _cli.Execute()
  File "/Users/terry/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 617, in Execute
    result = args.cmd_func(cli=self, args=args)
  File "/Users/terry/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 1110, in Run
    result = command_instance.Run(args)
  File "/Users/terry/google-cloud-sdk/./lib/googlecloudsdk/calliope/exceptions.py", line 86, in TryFunc
    return func(*args, **kwargs)
  File "/Users/terry/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/deploy.py", line 143, in Run
    info.runtime, docker_client)
  File "/Users/terry/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/images/push.py", line 64, in BuildAndPushDockerImage
    nocache=False)) as image:
  File "/Users/terry/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/docker/containers.py", line 119, in __enter__
    self.Build()
  File "/Users/terry/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/docker/containers.py", line 188, in Build
    raise ImageError(msg)
googlecloudsdk.appengine.lib.docker.containers.ImageError: Docker build 
aborted: The command [/bin/sh -c /bin/bash /app/_ah/build.sh] returned a 
non-zero code: 127

Original comment by terry.wa...@gmail.com on 2 May 2015 at 3:25

GoogleCodeExporter commented 8 years ago
I just saw the note on the appengine website, for go developers to use 
appcfg.py to update the VM application.

This is no longer an issue unless you plan to use gcloud deploy.

Original comment by terry.wa...@gmail.com on 2 May 2015 at 11:11

GoogleCodeExporter commented 8 years ago
Hi, I'm trying to build a go app and running it in google cloud managed vm 
flavour.

My first step is trying to launch the hello world demo app: 
https://github.com/golang/appengine/tree/master/demos/guestbook

First of all, I got the error described above, after changing the Dockerfile, I 
get lots of 'cannot find package xxxx', then I run 'go get', to download 
dependencies, and it throws following error:

helloworld $ go get
go install: no install location for directory 
/home/matias/sandbox/appengine/demos/helloworld outside GOPATH
helloworld $
GOPATH is set to /home/matias/sandbox/appengine/demos/helloworld

Lots of packages got downloaded, but it looks like not enough, I'm still 
getting some 'cannot find pacakge':

helloworld $ gcloud preview app run app.yaml
INFO     2015-05-23 13:32:29,336 containers.py:280] 2015/05/23 13:32:29 Can't 
find package "golang.org/x/text/encoding" in $GOPATH: cannot find package 
"golang.org/x/text/encoding" in any of:
        /goroot/src/golang.org/x/text/encoding (from $GOROOT)
        /gopath/src/golang.org/x/text/encoding (from $GOPATH)
and lots of others...

Regards,
Matías.

Original comment by matias.b...@gmail.com on 23 May 2015 at 1:34

GoogleCodeExporter commented 8 years ago
It may have something to do with your GOPATH structure.  Try and set you 
structure and GOPATH as describe in this 
https://golang.org/doc/code.html#Organization.

Original comment by terry.wa...@gmail.com on 24 May 2015 at 12:17