How to create static pages programmatically from app on App Engine? - google-app-engine

GAE is great. Everything becomes easy developing on it.
But recently I have found the need to create pages that can be served statically without changing my app.yaml and re deploying. Is this possible through the API?

No. To change anything in the app, you have to re-deploy (which you could do programmatically).
Your options are serving dynamic contents, or putting the contents in the blob store (or some other CDS like Amazon S3), and serving it from there.

Related

How do I dynamically generate a sitemap with Google App Engine

My website changes every day - I run a news website with new stories every day. I want Google to index my site as often as possible and want/need to autogenerate the sitemap.
I use Google App Engine (with Node.js) to run my site. With GAE - I do not have write-access to the root directory. To post the site map - I need to re-deploy my whole site after generating the map. That is an unnecessarily complex step.
I have searched far and wide and cannot see how to save my sitemap. So - I considered using a static one with a dynamically generated child that I store in another location where I have write access. Google says it wants all linked sitemaps in the same directory. So that appears to be a dead-end.
Can I use "App Deploy" in such a way that only the sitemap is uploaded? Any other possibilities? Appreciate any and all suggestions. It seems unlikely that Google didn't provide some way to solve this.
For a site where new URLs are being created regularly (like a news, blog site, etc), don't 'store' your sitemap. It should be generated on demand i.e. your App should include code to generate the content when the link <your_website>/sitemap.xml is loaded.
Separately, you should note that gcloud app deploy doesn't always deploys all your files. It usually deploys only files that have changed. You can easily confirm this by running the deploy command, changing a single file and then running the deploy command again. You will see that the logs will say something like - Uploading 1 files to Google Cloud Storage and the deploy will be faster. You can change X number of files, deploy again and the message will be updated to indicate it is only deploying x files.
However, I'm not sure what it uses to compute the diff. Maybe it compares it to the files currently in your staging bucket and if the files in the staging bucket have been deleted (they have a default life span of 15 days) it will deploy all the files again (but as I said, I'm not sure of this)

Caching problem on Azure CDN + Cloudflare structure

Our site is being made available with the following structure:
Static Blob Container Azure > CDN > Cloudflare > User.
The React app build is made available in an Azure Static Blob Container that is accessed by an Azure CDN. When we access the app via the CDN URL, we never have a cache problem. We also use cloudflare to manage the DNS and supposedly improve the cache. But when we access the app through cloudflare, we have a serious cache problem, returning extremely old versions for users who have accessed the site before.
Even after turning off all cache options available in Cloudflare's dashboard and its graphics show that cache consumption has dropped, the bug still persists. We were unable to identify where our problem is in the structure mentioned above.
The problem is because a CDN uses multiple nodes to serve the content. The proper way to 'solve' this is appending a version in the filename or path, this way, whenever you need to change something, the CDN will download the latest version. Just using a regular 'app.js' is not enough.
More info:
How to force the browser to reload cached CSS and JavaScript files
https://stackoverflow.com/a/34604256/1384539

google app engine gwt application doesnt load with custom domain

I have deployed my app on google app engine here is the link
Than I have done all the stuff to create custom domain link to my app with custom domain
Obviously the static data from app is loaded without the gwt module
(Right now no data is inserted in highly replicated Datastore for sake of simplicity)
That's not an Gae issue but a Gwt issue. By the way - on my browser (Chrome 27) both domains work and the Gwt client is loaded. Without having any knowledge about your Gwt app it is really hard to debug.
There is one issue however:
http://hawt-project.appspot.com/hawtproject/hawtproject.nocache.js
has cache headers. And this might cause your browser to load an old version of your application. And this might cause your page to look broken. It would also explain why it works for me - and not for you.
Try to clean your browser cache and reload your page. If it works => Adjust Gae's static file cache settings in appengine-web.xml (If it's Java) - well you should do that anyway - caching nocache.js is just wrong.

Is there a way to deploy / update only static content to GAE?

There are many cases in which we run into a need to update only static content of a production GAE app.
Examples:
CSS changes, and other related resources, such as images
New HTML pages, API of the app stays the same (RESTful web services)
Client side flow changes (only JS)
Each of the above changes requires a full deployment.
I read the documentation (Java) and searched this forum (and others), and I'm pretty sure there's no such method exists.
Partial updates of the app in GAE is possible, like updating indexes, update cron jobs, backend management (deploy, start, stop, etc.), but nothing about update static content.
Does anyone know a way for just deploying / updating the static part of a GAE app?
Is this something that folks using GAE would need / use?
Cant be done. File a feature requets!

web page folder inside war in google app engine project?

I am working on Restful Web application. I am maintaining different project for web client code and Google app engine server code.
When ever i made changes in the client code, i rebuilt the client code and places inside the war folder of server project through build scripts.
Here i dont want to place all files directly to war folder and i wanted to put them under folder called 'Publish' for better maintainence. How can do it?
Is there any better way to maintaining client code and Google app engine server code?
The structure also works well for Mobile application in future.
I am still new to this too, but there is versioning. If you change the version number in your project manifest file, it does not become the default (i.e., visible to your original public URL). It is public and accessible for you to test. When you are ready to "publish" just switch the new version to be the default. Use the Manage section of the Dashboard and set the Version to be the default when you are ready.
To test any of the earlier versions, you access through the Manage and click on the specific version. I don't know if the persistent storage is versioned with this same mechanism -- I can image problems if you have a huge DB.

Resources