Static files in GAE Cloud - google-app-engine

When an application is deployed in GAE cloud (Appspot.com); Is there a way to update or modify the static files on the src/main/webapps folder? For example the HTML and JSP files?
Either upload a modified HTML and JSP without redeploying the whole application?
Much like what we can do with Apache Tomcat, where we can modify the contents of the deployed app?

As far as I know, there is no other way short of redeploying the entire app. App Engine runs in a sandbox, and write file access is one of the things disallowed by the security manager.

Unfortunately, "Writing to local files is not supported in App Engine" http://goo.gl/kxNM5

Related

Is Single Page Application needs a Application Server?

I'm new to SPA development, so this may be a stupid question. please understand.
My question is "Is SPA(Single Page Application) needs a Application Server?"
As I understand it, the SPA gets the response after calling REST API. It use that response to re-render.
If so, is the server that handles REST API "Application Server"?
So many posts say Application Server are tomcat, oracle, etc... and they are also say Application Server handle the request to access the database. Then what is "Application Server" in SPA? or there are no Application Server in SPA?
(Are there any architectures or systems I'm not aware of?)
If I'm misunderstanding the architecture, please let me know.
I want to understand web server and Application Server in SPA. So I have read many posts but I'm still confused.
Thanks.
A SPA needs one server to serve the SPA bundle to the users browser.
If the SPA interacts with an API or APIs, the API(s) could be hosted on the same server that served the SPA bundle, or they could be hosted on other servers.
A Single Page App requires a server to serve the .css, index.html, and .js files it requires. It is not a requirement that that an SPA must communicate with an application server via any means at all.
Your content can be static or self generated by the app itself. Should you require communication with a backend server, you can consume that via some sort of api over
protocols such as http, https, websockets or Server Side Events.
To summarize. An SPA can be completely self contained OR access an api to provide functionality. A standalone app requires a server only to serve the component files (.css, .js, .html) of the app itself.
With SPA as well you will have html file and images, js, css files that will be loaded when you launch your single html webpage. So you need to host this static content on some server. So it can be separate web server or same APIs
server(Application Server) which can host these static content and serve request for those files. It can be also hosted on cloud static server and distributed via CDN
Short answer:
Yes. SPA apps do need to live somewhere (as you need to host the assets (js, css, initial html, other)
Long Answer:
You need to setup somewhere to host the entry files as per the short answer. In the past I've used anything from:
NodeJS code base services running on a Docker container (app & assets being served via express), to
dotnetcore on a similar stack (With kestrel server serving the assets running on docker on ec2).
Docker container running Apache webserver hosting the statically compiled assets
More recently I've dabbled with compiling the SPA app to a bunch of static assets (such as the ability NextJS / Gatsby provides with their tooling, but there are tons of others or alternatives in other SPA worlds)... but even then you'll need to host those assets somewhere.
S3 on Amazon has the ability to host SPA apps directly via a bucket setting & providing an entry point
Vercel (...or any other SaaS alternatives, Vercel is just where I host my personal stuff and has been easy to get going)
Again it's all up to you, but yes, you still need to make the JavaScript available somehow, you just need to pick your mechanic. SaaS with a baked in WebServer such as Vercel, a CDN like S3 that AWS provides, or go totally custom and spin up your own WebServer as application entry.

Deploy small change to google app engine

I want to deploy a change in my app.yaml file to google app engine. Is there a simple way to do this without redeploying the whole app? Is there a way of changing the app.yaml file on the google cloud directly? Or just deploying one file from my Windows directory?
My app is working fine in the virtual environment but I'm having some issues on the google cloud platform. The whole deploying process takes quite a while so I'm looking for a faster way to make a change and test it.
You can use appcfg.py update app.yaml from AppEngine Python SDK:
https://cloud.google.com/appengine/docs/standard/python/tools/appcfg-arguments#update
Use the files argument to upload one or more YAML files that define
modules. No other types of YAML files can appear in the command line.
Only the specified modules will be updated.
You can try using gcloud app deploy inside the directory where your application is located in order to upload the file you need.
Specifying no files with the command deploys only the app.yaml file of a given service.
This command will only upload to the cloud the files where there are changes, so if you have only modified the app.yaml file, it should not take too much time for the upload. However, as that is the configuration file of your application, it might need to be re-deployed completely, as the changes made in that file might affect the behaviour of the whole app. That is the reason why it might be taking longer than expected.
On the other side, you may want to know that if you are using App Engine Flexible environment, the deployment will always be slower than in a Standard environment, as resources have to be deployed before launching the application itself.

Google App Engine - How to add static files to a war folder of a running GAE application without a redeploy

I am trying to create an application where I host a few static html files that a user authors and uploads to GAE.
Is it possible to upload these files to WAR folder for hosting without a redeploy.
Uploading to WAR may not be a good idea as a redeploy would wipe out the user authored files. Would like these files to be stored across deployments.
May be a GCS bucket ? But in case of GCS bucket, how would you serve these static html files over a GAE/page.html url ?
I was reading that GCS bucket would serve as a web folder by turning a knob on that bucket. But how scalable would that be ? Is that even a good approach to use GCS bucket as a web url ?
Would be good to get some ideas on addressing this as I am new to GAE ! Thanks a lot
You can use Google Cloud Storage to serve static websites and a Google AppEngine application to update the bucket when user edit/upload some content to the website.
You would probably need to have different subdomains for this like:
www.example.com - GCS
admin.example.com - GAE app that manages uploading/editing files using GCS API.
This should be pretty scalable & cheap to serve traffic.
Apart from GCS you also can considering storing static files on Amazon S3 or any other hosting that has API. Actually you even can develop a solution that upload files to multiple storages like GCS, S3, etc. and serve them using fault-tolerant DNS or reverse-proxy (like CloudFlare) so if Google or Amazon goes down your website is up and running.

Google App Engine swf files paritally downloading

I'm just getting started with Google App Engine and I have a few questions. Some of my swf files are halting their download after loading the first 10%. This doesn't happen on a traditional web host, or when running the GAE app locally. I'd like to verify that the file has uploaded properly, but I can't figure out how to view the files associated with an app once they've been uploaded to Google App Engine.
Thanks
There is no way to view files on the server. But you could download app files from the server: https://cloud.google.com/appengine/docs/java/tools/uploadinganapp#Downloading_an_Application
Also I suggest to use Google Cloud Storage for such files, there you can upload/download/verify/etc from the browser (or command line), and it better suits for serving static files, especially large ones

can i update my working war file in google application engine

I have developed an project in java and exported as war file it runs in tomcat . can i use this application in google application engine.
1) Will my war file works in google app engine.
2) Do i need to change any thing to make it work??
Unless we are talking about a "Hello World" type of application, you will most likely have to change some things to make it work.
In particular your interactions with a database will need to be re-thought to work with the app engine data store. Same goes for file system access (not possible on app engine) and a couple of sandboxed libraries.

Resources