OAuth2 password-less GAE upload using Google's Maven GAE plugin - google-app-engine

I know that Google support password-less GAE app uploads using appcfg.{sh,cmd], as described here: https://developers.google.com/appengine/docs/java/tools/uploadinganapp#Passwordless_Login_with_OAuth2
However, I would like to know if I can do the same using Google's official Maven GAE plugin. There is a goal called appengine:update that is used for uploading the local GAE app to the cloud. However, I cannot find information anywhere as to whether this will support OAuth2. Anyone know how I can combine OAuth2 and this Maven plugin?
The reason why is because I am using Jenkins to build my project and I would much rather prefer to upload my application automatically using a Maven goal during the build instead of running a script (more complex than Maven goal) as a post-build step.

It seems that it have been improved in recent versions of GAE Maven plugin (no appcfg invocation necessary). It is enough to invoke:
mvn clean appengine:update
if there is no ~/.appcfg_oauth2_tokens_java it will pop your browser, and will ask for credential to Google Account. After successful authentication you are presented with OAuth2 token. Paste it in the terminal window, where you invoked mvn and you're done.

It appears that appengine:update automatically supports OAuth2. I just had to run a manual build with appcfg.sh. If that shell script was on your PATH, then the command looks something like this:
appcfg.sh --oauth2 update myapp/war-directory
Once I follow the manual steps to deploy my app and download the OAuth2 token for my user, I can run mvn appengine:udpate. This will detect my OAuth2 token and not require any manual interaction.

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.

deploy multiple enpoint api google app engine

I have 2 json files, I want to deploy on GCloud
With this command:
gcloud endpoints services deploy first_file.json
gcloud endpoints services deploy second_file.json
But after second file deploys the first one is removed.
Why?
If both files are for the same service you should check this documentation on how to deploy configuration files. You might be also having some issues with naming, as described in the description of the gcloud endpoints services deploy page.
Besides that, here you'll find tutorials on how to configure Endpoints on App Engine Standard.
If this is not the case, please add more information to the question, such as what is your use case and some code if possible.

How to run GoogleAppEngineLauncher in terminal window(Google cloud SDK shell)?

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.

deploy web application to google app engine on travis-ci - travis is asking for a password

I´m trying to deploy a web application to google app engine after successful build(I´m using maven on my project) and travis-ci is asking for my password. How can I input my password or specify somewhere else?
Based on the limited information you are giving us, I am guessing this is happening during the gcloud preview app deploy call.
Typically the docker TLS Verification will need a local public key for a Cert and this requires a passcode response. This situation can be avoided by providing the cert using the travis encrypt-file api and calling gcloud auth activate-service-account during the build. see gloud cli here
Please see the travis yml here for a full example
As always, post questions either here or github for additional walk-through questions.

How do I clone a website that is hosted on Google App Engine?

I have a friend's website hosted on Google App Engine and he wants a some changes to be done. He wants to download the assets from there and build it from scratch into a different host provider. Thing is, when I enter in the Google App Engine Dashboard I find it so hard to export/download anything. All looks so messy. I can't even find the index.html and css files. Any answers would be really appreciated. Thanks.
You can download an application's source code by running appcfg.py with the download_app action in the Python SDK command-line tool:
appcfg.py download_app -A <your_app_id> -V <your_app_version> <output-dir>
Only the developer who uploaded the code and the application owner(s) can download it. But you can be added as admin by the current account holder and then your credentials will work on the command line.
It's possible downloading of source-code has been permanently disabled. This action is irreversible. After you prohibit code download, there is no way to re-enable this feature.
See this page for more: Python Downloading source code
Instructions above for python version. For Java look here. Others, start here.

Resources