How do I find the application id of a Google App Engine? - google-app-engine

After creating an App Engine application on Google Cloud Platform, where can I find the application id?
This is in order to populate:
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<version>1</version>
<application> ? </application>
<threadsafe>true</threadsafe>
<runtime>java8</runtime>
</appengine-web-app>

You should not need to provide this property if you're using gcloud.
The Project ID used to be an explicit requirement with older tooling (which is why it's referred to as application rather than projectId) but it is no longer needed if you use gcloud.
This is because gcloud either takes the value implicitly from gcloud config get-value project or, explicitly when provided during deployment, i.e. gcloud app deploy --project=${PROJECT}.
If you still wish to determine the Project ID, the easiest way is to use Google Cloud Console (https://console.cloud.google.com), switch to the project you're interest in using the dropdown and then use the hamburger and project settings, or use this link replacing the value of ${PROJECT}:
https://console.cloud.google.com/iam-admin/settings?project=${PROJECT}
Or, if you'd prefer to use gcloud though this assumes you already know your Project's ID ;-):
gcloud projects describe ${PROJECT} --format="value(projectId)"
If you ever need to find the project's unique number, then you can:
gcloud projects describe ${PROJECT} --format="value(projectNumber)"

Related

GAE: No longer able to update my Gaelyk project due to appcfg losing support

Recently tried to update my Gaelyk project (yes, it's old, but it works well and I still use it), but Google App Engine will no longer accept the update. The error message returned is "Deployments using appcfg are no longer supported. See https://cloud.google.com/appengine/docs/deprecations". The thing is, I never used appcfg to deploy my application; I used Gaelyk and Gradle. But obviously Gaelyk must have used appcfg under the covers.
I did download the replacement Google Cloud SDK, but this new tool is not similar at all to how Gaelyk and Gradle worked. Is there anything I can do to get Gaelyk to work anymore? Or is Gaelyk just dead and I need to rewrite my application (like in Node.js or something instead of Groovy).
This will be hard, however I will try to help you as possible. I think you may try to migrate it somehow to app.yaml configuration of GAE.
I am not sure what plugins are used in the project. From Gaelyk temple project I can see that it's using appengine-geb which, according to the documentation, behind the scenes, is using gradle-appengine-plugin (there is wrong link on this doc, but proper is bellow).
On the github of gradle-appengine-plugin I have found following.
There is a note:
NOTE: All App Engine users are encouraged to transition to the new
gradle plugin for their projects.
And in FAQ part there is following information:
How do I deploy with gcloud?
If you're using gcloud to deploy your application, the newest version of app deploy > doesn't support war
directories, you will need to provide it with an app.yaml OR you can
use the appengineStage task to create a directory that is deployable
in /build/staged-app
$ ./gradlew appengineStage
$ gcloud app deploy build/staged-app/app.yaml --project [app id]
--version [some version]
NOTES:
You must explicitly define all config files your want to upload
(cron.yaml, etc)
This does not work with EAR formatted projects.
I think the best option will be to migrate to new appenine plugin or if not possible try to implement is with gcloud app deploy command crating the config files manually (at least app.yaml). And for this migration I can provide you this document.
I hope you will manage somehow...
I can confirm that Serge's answer on the Gaelyk Groups site works; the same procedure that he figured out also worked for me. To summarize:
Run gradlew appengineRun as run previously with Gaelyk.
Copy all jar files inside the build\exploded-app\WEB-INF\lib folder into a \src\main\webapp\web-inf\lib folder (for me the new lib folder did not exist previously).
To deploy, use the new required gcloud tool, and instead of running gradlew appengineUpdate (which fails now), instead run
gcloud app deploy appengine-web.xml where that XML file can be found in your webapp/WEB-INF directory. I navigated to that directory to run the gcloud command, but you can use a relative path there if your working directory is elsewhere. (There are a number of optional flags associated with the gcloud app deploy command, but I didn't need any of them.)
Serge needed to use these instructions to convert datastore-indexes.xml to index.yaml and run gcloud app deploy index.yaml, however, I didn't need to do this because I had no datastores.

Does my PHP project need appengine-web.xml

Setting up IntelliJ IDEA to run my PHP Wordpress (for App Engine) projects. Google Cloud Tools installed.
Have imported existing project files and then went to Tools > Google Cloud Tools > Run on a local App Engine Standard dev server.
An error is returned:
Project does not contain App Engine Standard modules: To use the App Engine Standard local development server, the project must contain at least one App Engine Standard module with an appengine-web.xml configuration file.
I read up on appengine-web.xml and apparently its used for Java projects. I'm trying to run PHP at the moment.
I haven't dealt with this file type before, is it similar to app.yaml?
Do I need this fie to set up my local server for PHP?
Actually the file appengine-web.xml corresponds to the App Engine Java runtime, you don't need to use it in your PHP project. It is similar to the app.yaml in the sense that it is where you define your default service.
In order to define the default service in your PHP app, you need the app.yaml. There are also optional configuration files, such as:
dispatch.yaml, queue.yaml, index.yaml, cron.yaml, dos.yaml
On a side note, maybe PHP Storm or Eclipse with the PHP Development tools are more suitable for your use case.

How is my GAE app able to run without app.yaml?

Although I started development for Google App Engine using Endpoints a while ago, I hadn't noticed this - Google's ref. page for Project structure says this:
Your development file hierarchy should look like this:
MyDir/
[pom.xml]
[build.gradle]
[index.yaml]
[cron.yaml]
[dispatch.yaml]
src/main/
appengine/
app.yaml
docker/
[Dockerfile]
java/
com.example.mycode/
MyCode.java
webapp/
[index.html]
[jsp.jsp]
WEB-INF/
[web.xml]
You'll need to define an app.yaml file that looks like this:
...
Note that the app.yaml is deemed compulsory as per the docs. In my case, I spawned a backend module(through the Wizard) in Android Studio that builds on Gradle. I have been able to build and deploy this module on GAE successfully but now I needed to switch from automatic scaling to basic/manual scaling, I found this to be done through app.yaml file.
Here is the thing: I don't have an app.yaml in place and it works fine. Where is then the config info. that GAE requires to deploy the App.
Specifically,
app.yaml specifies the environment - Java. But, I found the java plugin in build.gradle for that. Aren't 2 config places for the same thing confusing?
Is it possible to ditch app.yaml entirely for equivalent config. in build.gradle?
Why is Google claiming app.yaml to be compulsory when I am able to do without it?
The App Engine Java runtime uses its own configuration schema in XML, while others are YAML.
To set the scaling elements, follow the official reference.

Is there a mandatory requirement to switch app.yaml?

Folks,
I'm using the recently released Google Cloud SDK 0.9.56 on Windows 7x64.
When trying to gcloud deploy my app using web.xml and appengine-web.xml, I get a response:
ERROR: Found no valid App Engine configuration files in directory
When trying to do the same with apps defined with app.yaml there were no issues.
Teammates with older SDK versions don't seem to have an issue.
Is there a mandatory requirement to use app.yaml in all apps?
P.S: This question might be related but its actually a different issue.
sorry about this.
That question you linked is actually the same issue. You can use the new maven plugin described there to translate your appengine-web.xml to app.yaml automatically. We have a gradle plugin coming out very soon to do the same thing.
If you'd like to keep using gcloud directly without Maven or Gradle, you'll need to translate the appengine-web.xml to an app.yaml for now.
Let me know if I can help.

Mapping project-name and application-id in GAE

I am trying to deploy my project on the appengine. I use maven to build it. Name of my project (say, project-name)and the application-id on the appengine are different. Is there a way to map the application-id with my project? Every time I say,
mvn appengine:update
I get an error message like
This application does not exist (app_id='project-name').
Since I have not said which application-id to map it with, it attempts to find an application-id same as y project name. How should I fix this?
The appengine-application.xml and appengine-web.xml files contain general information used by App Engine tools when your app is deployed. Put your application ID (the ID you registered when you created your application in the Google Developers Console) into <application> element.
appengine-application.xml
<appengine-application xmlns="http://appengine.google.com/ns/1.0">
<application>your-application-id</application>
</appengine-application>
appengine-web.xml
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>your-application-id</application>
<module>default</module>
<version>v1</version>
...
</appengine-web-app>
All the App Engine Configuration information is store in the appengine-web.xml You must need to update them as per your google app engine project information.
For example my
project id : prabhatabc-2012
& i want to run my application on the version : v2
so i need to update my appengine-web.xml file project id(prabhatabc-2012) in <application></application> and version in <version>v2</version>
<application>prabhatabc-2012</application>
<version>v2</version>

Resources