I cannot stop or delete versions of a project created as it was created as a flexible environment within the EU. I understand the restriction by region but cannot work out why it cannot be removed.
jamie#dartmoor-1320:~$ gcloud preview app versions delete 20160607t131220
Deleting the following versions:
- dartmoor-1320/default/20160607t131220
Do you want to continue (Y/n)?
Deleting [default/20160607t131220]...failed.
ERROR: (gcloud.preview.app.versions.delete) Issue deleting version: [default/20160607t131220]
[default/20160607t131220]: Error Response: [13] Managed VMs can not be hosted in the application's region. (e~))
The GUI fails too but with a non descript error message.
You have to have at least one version for the default module. That's the reason why it doesn't allow you to delete it.
You need to deploy a new version, it can be a Flexible VM (deployed to another region in your situation), or Standard VM.
As a workaround, when you don't have any app to replace it right now, you can deploy an empty app instead. You have to create an app.yaml:
---
runtime: python38
handlers:
- url: /
script: auto
and deploy it using:
gcloud app deploy app.yaml
As your app.yaml doesn't have any script to execute, you'll not be charged for any instance.
If you want to stop app engine you can disable it App Engine -> Settings -> Disable application
This will only stop traffic to you Application after that you can remove the instances.
Related
I am using Google App Engine to deploy a node app (nextjs, node-12).
To deploy the app, I run:
gcloud app deploy
My app.yaml is as follows (minus variable substitutions):
runtime: nodejs12
env_variables:
NEXT_PUBLIC_FRONTEND_URL: "A"
In my code is the following line:
const url = `${process.env.NEXT_PUBLIC_FRONTEND_URL}/login/callback`;
When this code runs in app engine, url evaluates to B/login/callback
I don't understand this behavior. The documentation here (https://cloud.google.com/appengine/docs/standard/nodejs/config/appref) seems to indicate to me that this should work, but it does not.
Is there a reason for this? I've unset the variables from my local computer, just in case they were somehow getting passed, and I removed the .env file in case nginx was sourcing it or something like that.
What you have done looks correct. Try the following troubleshooting steps
Confirm you are not directly setting the value somewhere in your code e.g. say you call a child process and pass an env to it and you have explicitly set the value there
Check your deployed versions (you can do this via cloud console, see path below). Do you have multiple versions of the app? Which one are you running?
To check your versions and which one is running
console.cloud.google.com > App Engine > Versions
To view the configuration for each of the deployed versions,
select the version and click on 'View' under the 'config' column . This will display the deployed app.yaml file for that version
I want to test Python 3.7 on Google App Engine Standard.
I am afraid if I upload application with python37 old application will stop working and will be no revert to previous python27.
Can you share some experience if it possible to keep both runtime versions?
It is not clear for me.
I read Python 3.7 on Google App Engine - documentation but not found information.
You have 3 main options, ranked from easier to 'harder' to do:
Just deploy this test you want to do in a new project, and you don't have to worry about your old application getting replaced.
Deploy this test to a new service. Just add the line service: whatevername to the app.yaml file of your test, and deploy it as usual with $gcloud app deploy. Voilà, you have a new service.
You can deploy this test in your default service, but to avoid stopping the previous one, add the --no-stop-previous-version flag to your $ gcloud app deploy command. After that, you can split traffic between this test and your actual app.
To be honest, I would go with options 1 or 2, as they are far more simple to deploy, and you can later on delete the test project or delete the new service if you wish to.
Edit: Google Cloud at its finest. Made absolutely no changes but deployed fine this morning.
Error after ~10m of deployment (10+ deploy attempts).
I've changed the app to add a simply function with less than 10 lines of code. It has no affect on libraries and uses native python only and hence I'm not sure how it can affect the deployment.
I've tested the app and it runs fine locally.
Here is the error that I get:
ERROR: (gcloud.app.deploy) Cloud build failed. Check logs at
https://console.cloud.google.com/xxxxxxxx/ Failure status: UNKNOWN:
Error Response: [4] DEADLINE_EXCEEDED
Previously to that, logs don't show any errors, in fact everything is going as expected.
Newest entries first:
9302e2430a0e: Pushed
4f56eb74b6bf: Pushed
21df82f90a72: Layer already exists
f0e2b3558b28: Layer already exists
99c71ba2c817: Layer already exists
2483da9621d1: Layer already exists
af09d2110abe: Layer already exists
d968669f4b42: Pushed
4b1e707066a6: Layer already exists
55530b72c8c8: Layer already exists
62c169a7d462: Layer already exists
According to this you can change the build timeout setting with:
gcloud config set app/cloud_build_timeout 1000
Setting it to 1000 seconds in this example.
I have this problem too when deploying my custom image to AppEngine flex. My image requires a few ML models and takes around 2 hours to build and GAE does not seem to like it.
To build your container images outside of Google Cloud Platform, you must first upload your images to a container image repository before you can deploy your images to App Engine with the gcloud app deploy command.
In short, push your image to Google Container Registry or container image repository of your choice, then deploy with this command
gcloud app deploy --image-url gcr.io/YOUR_PROJECT_ID/YOUR_CONTAINER_IMAGE
More info here and here
For my case, I've found out the problem was that I have the same version for all gcloud app deploy command.
When there's traffic, the deployment will timeout.
I've deployed my node application on GAE (Google App Engine) flex environment. I would like to know the created app version. After the deployement succeeds, gcloud just shows the previous version that was stopped to run the new version.
It should be shown at the start of your deploy output, when you are asked for a yes confirmation:
You are about to deploy the following services:
- project-id/default/20170425t160124 (from [path/app.yaml])
Deploying to URL: [https://project-id.appspot.com]
Do you want to continue (Y/n)? Y
You can also open the console, go App Engine -> Versions and sort by date.
according to the official documentation for Google App Engine Standard environment (Go API) the "preferred tooling to deploy a project" is now the Cloud SDK and so we moved to gcloud from goapp.
We are unable to deploy Go projects to GAE because all the sub-packages of every given project can't be found at "deploy time".
The typical folder structure that we have been using for every GAE project was as follows:
-project-name
--app.yaml
--main.go
--assets
---package1
---package2
When global libraries were put in the system GOPATH everything worked smoothly.
Running gcloud app deploy we now get this:
You are about to deploy the following services:
- yourproject/default/123456789 (from [/Path/to/app.yaml])
Deploying to URL: [https://yourproject.appspot.com]
Do you want to continue (Y/n)? Y
Beginning deployment of service [default]...
ERROR: (gcloud.app.deploy) Staging command [/path/to/yourproject/app.yaml /var/folders/b6/5ydn0wdn64jd32sxzzz48b7c0000gn/T/tmpbd4oiG] failed with return code [1].
------------------------------------ STDOUT ------------------------------------
------------------------------------ STDERR ------------------------------------
2017/03/24 10:25:58 failed analyzing /path/to/yourproject: cannot find package "yourpackage" in any of:
($GOROOT not set)
/path/to/gopath/src/yourpackage (from $GOPATH)
GOPATH: /path/to/gopath
--------------------------------------------------------------------------------
while dev_appserver.py works perfectly keeping the same folder structure.
Did we miss something?
How can we deploy to Google App Engine Standard environment using gcloud?
If the project structure needs to be changed: how? Is there official documentation about it?
Thanks in advance,
Edit -- Further infos:
Luigi-Mac-Pro:path/to/yourproject distudio$ gcloud version
Google Cloud SDK 148.0.0
app-engine-go
app-engine-go-darwin-x86_64 1.9.50
app-engine-python 1.9.50
bq 2.0.24
bq-nix 2.0.24
core 2017.03.17
core-nix 2016.11.07
gcloud
gcloud-deps 2017.03.17
gcloud-deps-darwin-x86_64 2017.02.21
gsutil 4.23
gsutil-nix 4.22
Google recommends keeping your dependencies outside of the app directory, and using GOPATH to refer them. In your case, that would mean doing the following:
-project-name
--app.yaml
--main.go
where main.go contains
import (
"package1"
"package2"
)
And somewhere else:
-my_packages
--src
---package1
---package2
And then set GOPATH environment variable to path/to/my_packages prior to running dev_appserver and gcloud app deploy.
For the future
We are working out the long term solution for properly vendoring packages inside your app directory – likely using Go's future native package manager. I'm sorry to say that we don't have a good way of supporting sub-packages for gcloud app deploy. This was an unfortunate side effect of compatibility with the App Engine Flexible environment.