Vaadin on Google Cloud: Production Deployment - google-app-engine

I've gone through https://vaadin.com/learn/tutorials/cloud-deployment/google to learn about how to deploy a Vaadin application on GCP.
Now, when I dive into the details, I see that Cloud Run doesn't support Session Affinity, and although Google App Engine does support it, the documentation says "You should never use session affinity to build stateful applications." So basically that means that what is suggested in the tutorial is not really working for production use.
So, my question is, what is the recommended approach to run Vaadin application on Google Cloud for production deployments?
I read that a distributed session store is also not on option (https://vaadin.com/blog/session-replication-in-the-world-of-vaadin).
Thank you,
Kristof.

Using any Vaadin (except Fusion maybe) relies on heavy use of server side stored state in a session (a massive scene graph is stored per client) -- there is no way around it. If your environment or use-case can not cope with this, then you are better off not using Vaadin. Due to the size of the session data, using a distributed session store without session affinity is discouraged (and the linked blog shows why).
TL;DR: there are no silver bullets.

A late response but could be useful for others.
Vaadin is not really cloud friendly.
There are demo on the vaadin site about server side stored session with hazelcast ... but after the first 'great it works' and a few days of effort and research you realise
it is not really more than a hello world and others developers having tried this way faced multiple blocking issues with no answers
this server side stored session endup with something much too heavy for a large scale deployment.
as cfrick mentioned, this required anyway session affinity for performance reasons
So my view is : forget it, sticky session is the only way with vaadin.
Now sticky session is not so straight forward to setup first especially when using push then to go production, you also need to manage things like "app ready" and "app gone" ... and up to now, I've not seen any production grade response.

Related

Ways to share data between desktop application and mobile app

I want certain data from a iot endpoint or desktop implementation of app to be seen on mobile version of an app and visa versa. All endpoints should be able to access and change data as they see fit.
What are the ways that you can make data available to all endpoints? For instance I have a list of tasks that i make on the application on my desktop. Then I leave my house turn off my desktop and pull up the mobile version of the application. I want to see that same list. What are the ways to do this? I have considered a cloud hosted database but it kinda seems like overkill to have a database to store maybe 10kb of data as well as the cost associated with using their service.
Things I have considered but discarded because they dont fit-
google drive with a shareable googlesheet
The issue is that it is read only. Also speed and functionality is limited.
database running on desktop that syncs to mobile app.
The issue is that mobile app needs to be running at same time as desktop. also any changes the mobile makes to the data will not be saved to database if desktop version is not on.
Is there a way to do this without having a personal server running all the time to serve out data? Is there any database hosting that is free? Or is there something more lightweight than a database that would allow me to access and modify the data from any endpoint that has internet?
Depends on many factors so a little hard to give you the "This is clearly the best option" answer.
Easiest? Probably kick up a hosted database in a Cloud provider. I'm partial to Firebase/Firestore (Google) for mobile. They're extremely low latency, so any changes are reflected pretty much instantly, and they have an awesome SDK that makes it really easy to get up and running quickly. It's equally as easy on mobile and desktop. It does require a Google Cloud Platform account to use it, but the free tiers are super generous, so unless you're doing a ton of updating, it's probably free to host it (and you get $300 free credits for the first year of GCP).
https://firebase.google.com/

What is a good DB for Offline/Online capabilities for a Web Application

My team is developing an appraisals software for real estate on an enterprise level. This application has some special requirements.
The application should work in Online and Offline environment. If the user is working and suddenly Application goes offline User should be able to work offline. All offline work is stored in local database and sync next time to a central database when Application connects to the internet.This application has many users and all will work at the same time on same information.
User local database must be updated all times either other users are working or not. If other users are working all updated information should be available in the local database to ensure when the user goes offline all information is updated.
The question is How to develop this kind of application? Is there any standard way to achieve this target? Is there any standard or non-standard pattern to build this kind of software?
We are planning to use the Angular 2 Framework for our front end development. If anyone has experience with this and can give suggestions on what tech stack we should use, it would be greatly appreciated.
Well, you can use pouchdb as client-side DB and use every DB that uses the CouchDB sync protocol. I have used this stack with an Angular 2 application. (NoSQL)
I also worked with Kinto (PostgreSQL) and Kinto.js. It is not as user-friendly as PouchDB, but I think the documentation has improved since I used it.
And finally, I know about Meteor/Mongo/GroundDB. Meteor is very powerful it's a fully reactive Stack which works really well with the async options you have with angular and rxjs. But think if you have not worked with rxjs or reactive backends it's the hardest to learn. I took me a long time to adapt my coding style to the reactive Behavior of the data flow.
We are also doing an online POS that would work as a point of sale
but we are in constant backend solution for us to set up database that can sync or scale with offline and online .

Create App Engine project via API

I would need to automate the creation of new App Engine projects. Is this possible? I see there is a Google Cloud SQL Admin API which can create new Cloud SQL instances, but what about App Engine? Is there anything similar?
Update:
We have developed an application that runs on GAE and uses Cloud SQL and plenty of API integration with most of Google Apps. We foresee dozens, if not hundreds, of customers in a near future. All of them will be using their own Google domain and Google Apps.
While we could actually just deploy the application in our App Engine and modify the Cloud SQL tables to include the id of the customer who owns the record, we thought it would be better if we deploy an app instance and Cloud SQL for every one of them (on our own account). The main reasons coming to mind are that we can track how much every customer spends in terms of billing, and speed up the database since Cloud SQL is just a MySQL instance.
Steps for the creation would require editing a properties file in the packaged .war file, adding the certificate used to log in as a service account, and probably something that I am missing at this moment :-P
This question is somehow related Create an App Engine Project ID command line
As far as I know this is not possible (and is unlikely to be possible anytime soon).
Update:
I can see why splitting into separate projects for billing purposes would be really nice (multi-tenancy is great, but getting one bill per customer from Google sounds easier), but unfortunately I don't think that it's going to be your best option.
For AppEngine, you may want to look into the multi-tenancy features (or in Python) and how to get stats for billing.
Keep in mind however, CloudSQL is not simply a MySQL instance. It happens to speak MySQL but is not the same as running MySQL on Compute Engine for example. I would recommend that you run some benchmarks to be sure that the "adding the customer ID to the table" idea you had won't work.
Lastly, a possibly relevant read: http://signalvnoise.com/posts/1509-mr-moore-gets-to-punt-on-sharding
I guess the conclusion is that there’s no use in preempting the technological progress of tomorrow. Machines will get faster and cheaper all the time, but you’ll still only have the same limited programming resources that you had yesterday.
If you can spend them on adding stuff that users care about instead of prematurely optimizing for the future, you stand a better chance of being in business when that tomorrow finally rolls around.

How to use JDBC on Google AppEngine

I have an application that is using JDBC to manipulate its data.
I'm looking for a way to run the application on Appengine. Unfortunately, it seems like there aren't many options besides datastore (which I just can't get used to).
I've tried to use an embedded JavaDB, but Appengine blocks FileOutputStream (throws an exception "java.io.FileOutputStream is a restricted class" on initial driver loading). Therefore, I haven't tried Sqlite.
I've also tried to use Jiql, a new project that offers a JDBC interface to Datastore. However, I just can't seem to establish a "connection". It is somewhat unclear to me how to use jiql (like: what user/pass do you supply?), despite the few examples on their site.
I've looked at Google Cloud SQL and eventually signed up for it. It seemed to be the perfect solution to our problem, until I realized it's a paid service (it'll be paid soon, once it leaves the beta phase). I prefer not to pay (yet) as I'm still testing and evaluating the potential of GAE.
--
What would you recommend, keeping in mind would like to use JDBC for the persistence layer of the application?
Thanks in advance!
GAE supports two frameworks for persistence, JPA and JDO. There are few frameworks that plays well with GAE rules like Objectify. But to start with datastore you can also take at google tutorial GAE DATASTORE. If you need to learn the relationship with JPA and support for JDBC persistence Check this Link

Migrating from AppEngine

I have developed a application using GWT/AppEngine/Objectify. There are many clients who want this locally deployed in their environments as the data is sensitive.
I cannot think of a way where the data of a application is hidden from its developers in AppEngine. Even I encrypt the data there will be always question about security.
I thought of the following alternatives
a) I have now a multitenancy application in appengine. I can now have a deployment for particular clients using their individual google accounts. This way they have security of data. I am not sure how I will handle new deployments. There is nothing like sharing the application with a user.
b) Migrate to MongoDB/MYSql.
This will lead to the whole question of handling migrations when data models are changed.I have read that with MongoDB I will not face migration issues. Is this correct.
What would be the best way to solve this issue. The root issue is that we as developers have access to data in Google/AppEngine environment which the client does not want.
Any help would be appreciated.
The easiest would be for the client to create an App Engine account and you only supply the war.
If you still plan to migrate away from GAE, then you might want to take a look at AppScale and capedwarf-blue.

Resources