Deploying to Google App engine flexible for go1.12 fails - google-app-engine

I have a service that looks somewhat like this -
service
|
|__cmd
| |_main.go
|
|_ app.yaml
|_ cloudbuild.yaml
|_ service.go
|_ someHelper.go
I have a few private packages that I include in go.mod and after a lengthy build process I have an image that can be deployed to GAE. However, I get this error after I deploy -
Starting Step #6 - "deploy app"
Step #6 - "deploy app": Already have image (with digest): gcr.io/cloud-builders/gcloud
Step #6 - "deploy app": ERROR: (gcloud.app.deploy) Staging command [/builder/google-cloud-sdk/platform/google_appengine/go-app-stager /workspace/app.yaml /workspace /tmp/tmpuwereWq0/tmpdfWB0wiJ] failed with return code [1].
Step #6 - "deploy app":
Step #6 - "deploy app": ------------------------------------ STDOUT ------------------------------------
Step #6 - "deploy app": ------------------------------------ STDERR ------------------------------------
Step #6 - "deploy app": 2019/09/06 12:17:42 staging for go1.12
Step #6 - "deploy app": 2019/09/06 12:17:42 Staging Flex app: failed analyzing /workspace: the root of your app needs to be package "main" (currently "some_service_name")
Step #6 - "deploy app": GOPATH: /go
Step #6 - "deploy app": --------------------------------------------------------------------------------
Step #6 - "deploy app":
Finished Step #6 - "deploy app"
My cloud build sample file is posted here - https://gist.github.com/automaticalldramatic/961dbd2a92a6b9518835688eb2df2d67
Any help or insight would be appreciated :)

Related

Deploying automatically Node app to App Engine with Cloud Build and VPC connector

i have a Problem during deploying an App Engine app with Cloud Build and VPC connector to my MongodDB Atlas Database.
When i deploy it with gcloud, it works perfectly with this command:
gcloud beta app deploy
But i want CI (Continuous integration) to be implemented with Cloud Build.
During the Cloud build following error appears:
Step #3: #============================================================#
Step #3: #= Uploading 2 files to Google Cloud Storage =#
Step #3: #============================================================#
Step #3: File upload done.
Step #3: Updating service [nodeapi]...
Step #3: .......................................................................................................................................................................................failed.
Step #3: ERROR: (gcloud.beta.app.deploy) Error Response: [7] Error attaching GCE network to app.
Step #3:
Step #3: Details: [
Step #3: [
Step #3: {
Step #3: "#type": "type.googleapis.com/google.rpc.ResourceInfo",
Step #3: "resourceName": "projects/visifingc/global/networks/default",
Step #3: "resourceType": "Network"
Step #3: }
Step #3: ]
Step #3: ]
Step #3:
Finished Step #3
ERROR
ERROR: build step 3 "gcr.io/cloud-builders/gcloud" failed: exit status 1
My app.yaml file:
runtime: nodejs10
service: nodeapi
vpc_access_connector:
name: "projects/visifingc/locations/europe-west1/connectors/app-engine"
network:
name: default
And cloudbuild.yaml:
steps:
- name: node:10.15.1
entrypoint: npm
args: ["install"]
- name: node:10.15.1
entrypoint: npm
args: ["run", "build"]
- name: "gcr.io/cloud-builders/gcloud"
args: ["beta","app","deploy"]
When a I look in App Engine to the configuration of Instance which was deployed (but with the error, therefore not really deployed)
following App Engine Instance Configuration can be seen:
runtime: nodejs10
env: standard
instance_class: F1
handlers:
- url: .*
script: auto
automatic_scaling:
min_idle_instances: automatic
max_idle_instances: automatic
min_pending_latency: automatic
max_pending_latency: automatic
network: {}
As you can see, something is wrong with the network because it is empty.
Could you help me please to find a solution? I thought it could be a rights problems, therefore i tried to give to all the accounts access rights to VPC, but id didn't helped.
Mostly i am following the defined setup with VPC network which is described here:
https://cloud.google.com/appengine/docs/standard/nodejs/connecting-vpc
I ran into the same problem, and it turns out it was a permission issue after all. For us, the fix was to give "Compute Network Admin" permissions to the CI/CD process.
I was having this issue earlier and struggled with it for a while. Solved it be changing from "gcloud beta app deploy" to simply "gcloud app deploy." Don't know why the beta version isn't working (especially if it was working from your CLI).
I know this isn't a satisfying answer, but hopefully it puts you on the right track!
BEFORE:
steps:
- name: "gcr.io/google-containers/busybox"
args: ["sed", "-i", "s/PROJECT_ID/${PROJECT_ID}/g", "app.yaml"]
- name: "gcr.io/cloud-builders/gcloud"
args: ["beta", "app", "deploy"]
AFTER:
steps:
- name: "gcr.io/google-containers/busybox"
args: ["sed", "-i", "s/PROJECT_ID/${PROJECT_ID}/g", "app.yaml"]
- name: "gcr.io/cloud-builders/gcloud"
args: ["app", "deploy"]

How to run cakephp 3 project placed inside the cakephp 3 project webroot

I would like to run the cakephp3 project placed inside the cakephp3 project webroot
/example.com/
bin/
config/
logs/
plugins/
src/
tests/
tmp/
vendor/
webroot/
/uat/ (this is another project placed inside webroot)
bin/
config/
logs/
plugins/
src/
tests/
tmp/
vendor/
webroot/
...
...
...
.gitignore
.htaccess
.travis.yml
composer.json
index.php
phpunit.xml.dist
README.md
I'm trying to access another project using the address https://example.com/uat/index.php, but it throws the error:-
Uat class not found
2018-08-07 12:54:53 Error: [Cake\Routing\Exception\MissingControllerException] Controller class Uat could not be found.
Request URL: /uat/index.php
Stack Trace:
#0 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/ControllerFactory.php(72): Cake\Http\ControllerFactory->missingController(Object(Cake\Network\Request))
#1 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(93): Cake\Http\ControllerFactory->create(Object(Cake\Network\Request), Object(Cake\Network\Response))
#2 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/BaseApplication.php(83): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#3 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Http\BaseApplication->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response), Object(Cake\Http\Runner))
#4 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php(62): Cake\Http\Runner->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response))
#5 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\RoutingMiddleware->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response), Object(Cake\Http\Runner))
#6 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php(93): Cake\Http\Runner->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response))
#7 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\AssetMiddleware->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response), Object(Cake\Http\Runner))
#8 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php(81): Cake\Http\Runner->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response))
#9 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Error\Middleware\ErrorHandlerMiddleware->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response), Object(Cake\Http\Runner))
#10 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/Runner.php(51): Cake\Http\Runner->__invoke(Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response))
#11 /home/corpveda/public_html/vendor/cakephp/cakephp/src/Http/Server.php(92): Cake\Http\Runner->run(Object(Cake\Http\MiddlewareQueue), Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response))
#12 /home/corpveda/public_html/webroot/index.php(37): Cake\Http\Server->run()
#13 {main}
This was required to set up the UAT server for our team, I have also tried some example from google by modifying the .htaccess file found inside the webroot folder to make it work, but it throws the same error each time.
I think this is your best option : https://book.cakephp.org/3.0/en/plugins.html

Issues while creating and deploying an app to google app engine

I am running into this error while deploying my app to google app-engine.
Error:
Error 404: --- begin server output ---
This application does not exist (project_id=u'homework-153002'). To create an App Engine application in this project, run "gcloud beta app create" in your console.
--- end server output ---
When I try to create the app using the above command this is what I see:
ERROR: (gcloud.beta.app.create) You do not have permission to access app [homework] (or it may not exist): Operation not allowed
I have created a project in google developers api website with project_name of "homework" and random id. Here is the url for that:
https://console.developers.google.com/apis/library?project=homework-153002
Any pointers on what I might be doing wrong here?
This is my yaml file:
application: homework-153002
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: .*
script: main.app
libraries:
- name: webapp2
version: "2.5.2"
Your app URL indicates your app ID is homework-153002, but the
error message indicates you're connecting to an ap called homework - likely not your own, hence the permission issue.
Simply correcting the app ID in your deployment command and/or your app.yaml file should suffice.
As your comment indicates, for your case (gcloud deployment) the solution was:
gcloud config set project homework-153002
gcloud beta app create
appcfg.py update homework/

Couldn't connect to the Docker daemon due to an SSL

I'm trying to deploy Managed VM (Python) on Google App / Compute Engine with command:
gcloud --verbosity debug preview app deploy ./app.yaml --set-default
during deployment VM instance is created but it exits on error (here is paste of last few lines of listing):
DEBUG: Display disabled.
Copying certificates for secure access. You may be prompted to create an SSH keypair.
DEBUG: Loaded Command Group: ['gcloud', 'compute', 'copy_files']
DEBUG: Detected docker environment variables: DOCKER_HOST=tcp://104.197.50.238:2376, DOCKER_CERT_PATH=../../../../../tmp/tmpPbKmOs, DOCKER_TLS_VERIFY=True
INFO: Starting new HTTPS connection (1): 104.197.50.238
DEBUG: Failed to connect to Docker daemon due to an SSL problem: [Errno 1] _ssl.c:523: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
DEBUG: (gcloud.preview.app.deploy) Couldn't connect to the Docker daemon due to an SSL problem.
Traceback (most recent call last):
File "/home/zdenulo/bin/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 591, in Execute
result = args.cmd_func(cli=self, args=args)
File "/home/zdenulo/bin/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 1191, in Run
resources = command_instance.Run(args)
File "/home/zdenulo/bin/google-cloud-sdk/./lib/googlecloudsdk/appengine/app_commands/deploy.py", line 208, in Run
implicit_remote_build)
File "/home/zdenulo/bin/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/deploy_command_util.py", line 137, in BuildAndPushDockerImages
with docker_util.DockerHost(cli, version_id, remote) as docker_client:
File "/home/zdenulo/bin/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/images/docker_util.py", line 215, in __enter__
return containers.NewDockerClient(local=(not self._remote), **kwargs)
File "/home/zdenulo/bin/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/docker/containers.py", line 313, in NewDockerClient
'Couldn\'t connect to the Docker daemon due to an SSL problem.' + msg)
DockerDaemonConnectionError: Couldn't connect to the Docker daemon due to an SSL problem.
ERROR: (gcloud.preview.app.deploy) Couldn't connect to the Docker daemon due to an SSL problem.
apparently there is problem with SSL but I have no idea how to solve it, and I'm quite desperate at the moment :)
I have:
Docker version 1.8.2, build 0a8c2e3
Boot2Docker-cli version: v1.8.0 Git commit: 9a26066
Google Cloud SDK 0.9.79
app 2015.09.23
app-engine-java 1.9.26
app-engine-python 1.9.26
bq 2.0.18
bq-nix 2.0.18
core 2015.09.23
core-nix 2015.09.03
gcloud 2015.09.21
gsutil 4.15
gsutil-nix 4.14
preview 2015.09.21
OpenSuse 13.2
OpenSSL 1.0.1k-fips 8 Jan 2015
I would very much appreciate help of any kind.
EDIT:
app.yaml
module: default
runtime: python27
api_version: 1
threadsafe: yes
vm: true
resources:
cpu: .5
memory_gb: 1.3
manual_scaling:
instances: 1
handlers:
- url: .*
script: main.app
Are you using homebrew Python on OS X? If so, there's an existing bug for OpenSSL and Docker here.
The easiest way around this is to temporary use a virtualenv with system python.
pip install virtualenv
virtualenv ~/system-python-env
source ~/system-python-env
gcloud preview app deploy ...
You can get at a short-lived SSL with "gcloud docker --authorize-only". Then immediately do your "gcloud preview app deploy..".
gcloud docker --authorize-only
gcloud preview app deploy app.yaml --promote

Google App Engine Launcher - localhost shows a blank page. (Python2.7)

I'm on Win 8 x64, Python 2.7
Steps I followed:
Downloaded, installed python.
Downloaded, installed Google App Engine Launcher.
Created new application with name helloworld-kg on the app engine site.
In Launcher, File > Create New Application > entered the name of app and browsed to the directory.
Hit Run, wait for light to turn green.
Click Browser. Get a blank page on localhost:8080
Here's the log from launcher:
2013-04-05 20:54:10 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000', u'C:\\Users\\Karan\\Desktop\\helloworld-kg\\helloworld-kg']"
INFO 2013-04-05 20:54:12,068 devappserver2.py:401] Skipping SDK update check.
WARNING 2013-04-05 20:54:12,078 api_server.py:328] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2013-04-05 20:54:12,088 api_server.py:152] Starting API server at: http://localhost:55309
INFO 2013-04-05 20:54:12,091 dispatcher.py:98] Starting server "default" running at: http://localhost:8080
INFO 2013-04-05 20:54:12,092 admin_server.py:117] Starting admin server at: http://localhost:8000
INFO 2013-04-05 20:54:58,167 api_server.py:517] Applying all pending transactions and saving the datastore
INFO 2013-04-05 20:54:58,167 api_server.py:520] Saving search indexes
2013-04-05 20:54:58 (Process exited with code 0)
2013-04-05 20:55:01 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000', u'C:\\Users\\Karan\\Desktop\\helloworld-kg\\helloworld-kg']"
INFO 2013-04-05 20:55:03,788 devappserver2.py:401] Skipping SDK update check.
WARNING 2013-04-05 20:55:03,799 api_server.py:328] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2013-04-05 20:55:03,809 api_server.py:152] Starting API server at: http://localhost:55354
INFO 2013-04-05 20:55:03,811 dispatcher.py:98] Starting server "default" running at: http://localhost:8080
INFO 2013-04-05 20:55:03,813 admin_server.py:117] Starting admin server at: http://localhost:8000
INFO 2013-04-05 20:56:02,868 api_server.py:517] Applying all pending transactions and saving the datastore
INFO 2013-04-05 20:56:02,869 api_server.py:520] Saving search indexes
2013-04-05 20:56:02 (Process exited with code 0)
2013-04-05 20:56:09 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000', u'C:\\Users\\Karan\\Desktop\\helloworld-kg\\helloworld-kg']"
INFO 2013-04-05 20:56:11,631 devappserver2.py:401] Skipping SDK update check.
WARNING 2013-04-05 20:56:11,644 api_server.py:328] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2013-04-05 20:56:11,653 api_server.py:152] Starting API server at: http://localhost:55397
INFO 2013-04-05 20:56:11,655 dispatcher.py:98] Starting server "default" running at: http://localhost:8080
INFO 2013-04-05 20:56:11,657 admin_server.py:117] Starting admin server at: http://localhost:8000
My app.yaml file contents:
application: helloworld-kg
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
script: helloworld-kg.app
And the helloworld-kg.py file contents:
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, webapp2 World!')
app = webapp2.WSGIApplication([('/', MainPage)],
debug=True)
I'm new with Python and GAE. This is for Udacity's CS 253 course.
Possible solutions?
Got it to work. Apparently, GAEL was creating a new app for me. A re-install solved the problem. App is working fine now!

Resources