I wanted to create an App Engine app using the following command
gcloud app create --project=recommendations-1 --region=asia-east1-b
but system told me:
ERROR: (gcloud.app.create) PERMISSION_DENIED: Operation not allowed
'#type': type.googleapis.com/google.rpc.ResourceInfo
description: The "appengine.applications.create" permission is
required.
resourceType: gae.api
Other information:
I use google cloud shell
before create app, I connect instance with [gcloud compute ssh recommendations-1 ]
I wanted to make recommendation system with (https://cloud.google.com/solutions/machine-learning/recommendation-system-tensorflow-deploy)
I have enabled [ App Engine Flexible Environment] and [App Engine Admin API] manually
I have gcloud auth login
I have gcloud config list project
I believe you have already created the project “recommendations-1”. If not, use this command first:
gcloud projects create sample-project-name
If yes, you can start by running the following commands:
gcloud config set project sample-project-name
gcloud app create --project=sample-project-name --region=valid-region
Note that your command contains an invalid region. Check the valid regions here and here or use this command to see the list and choose interactively on the console.
gcloud app create
The issue you are having is most probably because you are trying to create an application in a project (recommendations-1) from within another project causing the permission errors.
You can have two machines running at the same time. As shown here the VM that you access when using Cloud Shell is the active VM of the current project in the Cloud Console, so in case you access another VM with “gcloud compute ssh” in a terminal, you may be accessing different VMs. It will depend on which VM is set up on each tool.
So in case you are trying to create an app in the project “recommendations-1” using Cloud Shell, Cloud SDK or another tool, you will need to set "recommendations-1" as the current project in that tool by using the “gcloud config set project recommendations-1” command. If the Cloud Console current project is already set to "recommendations-1", Cloud Shell will automatically be set with this project. Otherwise, you do not have access to create an app in a project from within the instance of another project.
Related
I am stuck on the first page of instructions for Google App Engine
https://console.cloud.google.com/appengine/start/reception
I downloaded and installed the cloud SDK.
"gcloud init" worked.
I am stuck at "Deploy to App Engine".
When I type "gcloud app deploy" in Terminal, I get two errors.
"ERROR: An app.yaml (or appengine-web.xml) file is required to deploy this directory as an App Engine application. Create an app.yaml file using the directions at https://cloud.google.com/appengine/docs/flexible/python/configuring-your-app-with-app-yaml"
The page it says to go to does not give directions for creating the file. What is the command? Also, why is this error happening at all? If I follow the instructions on the Get Started page, I should not get an error. Some instructions must be missing or something not working when I install the SDK.
The second error I get is "ERROR: (gcloud.app.deploy) [/Users/chucky] could not be identified as a valid source directory or file."
Again, there must be instructions missing because I am following them.
Screen Shot
gcloud app deploy is for deploying a project. This means you need to have a folder with a sample project. The project will need to have an app.yaml file. Essentially, the steps are
Download and install the Google Cloud SDK
Run gcloud init to initialize the SDK (this makes you to login to Google and grant access to gcloud to your account; also sets up your default project)
Create your project (or copy an existing one) where project is your App i.e. the application you are working on. This project should have an app.yaml file.
Then deploy your project to production by running gcloud app deploy. You first have to change directory to your project folder. If you don't want to do this, you have to specify the full path to your app.yaml file.
An alternative for steps 3 - 4 is to use a Graphical User Interface (GUI) like one from us - https://nocommandline.com . You just click a button to create a new project and it will create a shell project ('hello world') with all the necessary files. To deploy your project, you also click another button 'Deploy' and it will take care of deploying your project.
From the link:
https://console.cloud.google.com/appengine/start/reception
First, you need to download the resources. You can use the Cloud SDK, Cloud Shell, directly download from github or other terminal to download the resources files. For example, you want to deploy a Python app using Cloud SDK in Windows OS:
Install and open Cloud SDK.
Copy the resources file from github:
From Cloud SDK run:
git clone https://github.com/GoogleCloudPlatform/python-docs-samples
Go to directory of your application files:
cd python-docs-samples/appengine/standard_python3/hello_world
Deploy and browse your application
Deploy using the command:
gcloud app deploy --project PROJECTID
Browse using the command:
gcloud app browse --project PROJECTID
If you see the Hello World! you've successfully deployed your application.
Deploying an application to Google App Engine using the 'Custom Runtimes Flexible Environment' option requires a Dockerfile to build the docker image Google-side. I want to specify an image from my private Docker registry in the Dockerfile FROM clause. However, I cannot find any documentation or see any obvious options explaining where I would specify credentials for a private registry, or invoke a docker login. Without this, gcloud app deploy fails, of course, attempting to pull the image Google-side.
For example:
$ gcloud app deploy
...
Beginning deployment of service
...
Sending build context to Docker daemon 3.072kB
Step 1/1 : FROM registry.gitlab.com/my/private/registry/image:latest
Get https://registry.gitlab.com/v2/my/private/registry/image/manifests/latest: denied: access forbidden
The Dockerfile in this case would simply be:
FROM registry.gitlab.com/my/private/registry/image:latest
Does anyone out there know if this is possible with Google App Engine, and if so, how to configure it?
There is this Stackoverflow post that already covers the topic and provides an answer.
In fact, if you upload your image to Google Container Registry, it will be private and you will be able to control who has access to GCR by using IAM permissions. After that you can use it in your App Engine deployments:
gcloud app deploy --image-url $GCR_IMAGE_PATH
Where is the google app engine home root? I can't seem to find it, I want to edit the source code in there but I just can't. I want to use the default editor but I just can't seem to find the root project or wherever it is that's located at. Do you know where it is?
What you want to do is only possible if you are using App Engine Flex.
For App Engine Flex the deployment gets your files, build a Docker container with them, and then deploys this container inside a VM. As you can see on the documentation, you can connect directly to your container by running:
gcloud app instances ssh [INSTANCE-NAME] --service [SERVICE] --version [VERSION]
docker exec -it gaeapp /bin/bash
Once you run these commands you will be on the root folder of your container and changes you make on files will be reflected on the current running version of your app.
If you are using App Engine Standard, you cannot access the instances since it is a fully managed environment. Therefore you won't be able to find the root of the running app version.
NOTE: For App Engine Standard, since it uses a staging bucket to gather the code before compiling, you are able to get the files themselves but on a pre deployment state, meaning that if you change them it will not reflect on the current running version of your app. You can find your staging bucket through the App Engine Admin API. This bucket is usually staging.<PROJECT_ID>.appspot.com, although you can change this configuration.
Google no longer support the GoogleAppEngineLauncher program.
When I installed GoogleAppEngine I just got Google Cloud SDK shell. I want to add a project to GoogleAppEngine to run and deploy.
I got these links and cant understand
Local Development Server
Deploying the Application
How to do it both locally and online ?
"Quickstart for Windows" is a good starting point for new users of Cloud SDK.
In order to deploy and run a GAE application with the Cloud SDK you have to use shell/command prompt, as opposed to GoogleAppEngineLauncher where you had a GUI. The steps are:
Open the shell
In the shell change the current directory to where your project's app.yaml. is. For example: CD C:\Users\AQueue\Projects\MyGAEApplication and check that app.yaml file is there using dir command.
run gcloud app deploy
This should be it.
gcloud is one of the most important tools in the SDK that allows to interact with many products and services from Google Cloud Platform. If you want to read more about gcloud you can start with this overview.
I have production GAE application - myapp. I've created also second app - myapp-staging to have separate, staging environment.
In myapp I've created Jenkins machine to get Build pipeline.
It's easy to run test and deploy jobs on the same app. But there is a problem with deploy version from Jenkins VM on myapp to myapp-staging. I got unknown application (or similar) error while gcloud preview deploy.
Is it possible to give access from VM on one application to another one? Especially for gcloud command?
The problem is that the Jenkins instance is using a service account which is enabled as myapp admin but has no access to myapp-staging . You'll have to either:
1) Setup your original Jenkins with a second service account with admin rights to myapp-staging
2) Setup a second Jenkins instance and trigger the build of the staging version when the first one is complete.