I have been trying to use Datastore Multitenancy for weeks now. And I can't seem to make it work. Every time I try to run it on my own (computer) server, it does not seem to display anything at all. I have also tried to publish it on the GAE server, but it still does not seem to display.
What I am trying to acheive is to work on a Company Entity with another sub-entity of Users and Data which is not connected to any emails, Oauth, or third party applications. The Company Entity, being the namespace, will separate all the data and users of each company. This way, it will contain users and all its other data without leaks.
I tried to make sure that the application has its own NamespaceFilter Class for the Company Entity. What causes the blank page? (Or maybe the right question is, what am I doing wrong?)
Update:
There are no errors on the code and there are no exceptions whatsoever. However, the JSP pages that I am trying to display is just gone without any information how it does not display.
Multitenancy can only be used with Google Apps. Here is what is stated by Google App Engine on Implementing Multitenancy.
Most App Engine developers will use their Google Apps domain as the current
namespace. Google Apps lets you deploy your app to any domain that you own,
so you can easily use this mechanism to configure different namespaces for
different domains. Then, you can use those separate namespaces to segregate
data across the domains.
Clarification: It is Google Apps that lets you deploy to any domain and use Multitenancy. You need to use Google App Engine API that can make you use Multitenancy. Google Apps and Google App Engine should be connected. By registering Domains to Google Apps, you can use Multitenancy. Therefore, if you use Users, it needs to be registerd with Google Apps.
Related
I created a simple two-player game (Connect 4) with a Java/Spring backend and React.js frontend. I understand it would be simpler to create the entire app in React, but I’m studying Java development and decided to learn React to demonstrate my understanding and create a portfolio website.
I’m struggling to decide how best to deploy the app. I deployed the backend on its own to GC App Engine. After a few false starts it eventually worked. However, if I visit the project url from two separate browsers/devices, both devices are looking at the same instance of the backend, i.e. two individual users are looking at the same ‘game’, which is not what I intended.
What is the best approach to deploy the front & backend so each user is playing their own individual game?
This is literally my first foray into any kind of web development, so I may have bitten off more than I can chew.
Thanks.
I would suggest you use multiple services on your project. You can either use the same deployment command for deploying or updating the services that make up your application.
services in App Engines behave like microservices and therefore you can deploy multiple services to run as a set of microservices.
Here are the requirements for deploying multiple services:
You must initially deploy a version of your application to the default service before you can create and deploy subsequent services.
The ID of each of your services must be specified in their corresponding app.yaml configuration files. To specify the service ID, include the service element definition in each configuration file. By default, excluding this element definition from your configuration file deploys the version to the default service.
You can deploy one service as frontend and the other as backend.
You can check this documentation on services for additional information.
I looked at the documentation regarding services but I still don’t understand their use in the context of my problem. I may have misunderstood your explanation, but I don’t think I explained my problem clearly. Having looked at the documentation, my use of the word ‘instance’ is not the same as an app engine instance.
It would make sense to me to have two services in my project; one for the backend and one for the frontend. To solve the problem of each individual player interacting with the same backend API, and so unwittingly interacting with the same single Connect4 game, generating multiple services would not be a solution. Is my understanding correct?
The comment from NoCommandLine on my original post is probably a better description of what I want to achieve.
Background
I am trying to make a public facing API that is gated behind an OAuth2 workflow. I've found example database designs using JPA Repositories/Spring-OAuth2, which is the framework that I'm using. I basically have this application, which is currently using an InMemory authentication, which I'm trying to convert to pull the data from a database using JPA Repositories and a relational database design.
I did find this guy, but the problem is that it doesn't account for how the data is related to one another.
IE I was hoping that I could split the scopes into a separate table so it'd be as simple as adding additional scopes that are available for apps later on. I was also thinking of adding support for having types of OAuth clients, such as bots, website, desktop app, mobile app, etc.
I'm assuming there is some sort of a relationship between oauth_approvals, oauth_refresh_token, oauth_client_token and oauth_client_details. I want to also make sure that it's possible to map an oauth client to a user. Ultimately I'd like them to be able to have multiple clients.
For my current use case it's definitely overkill to have this flow, but I am using this application to learn about different technologies.
What I currently have
I'm sure this can be done better, if so how?
Questions
How do I properly make the relationship between the different components of an oauth client?
How can I make this so that I properly allow a user to have many clients?
How would I be able to dynamically get a client from the database, or is this handled through ClientDetailsServiceConfigurer.jdbc()?
How would I be able to add types of clients to the flow?
If you have additional questions let me know and I'll be more than happy to update my question.
If I had an application that stored information in its datastore. Is there a way to access that same datastore from a second application?
Yes you can, with the Remote APIs.
For example, you can use Remote API to access a production datastore
from an app running on your local machine. You can also use Remote API
to access the datastore of one App Engine app from a different App
Engine app.
You need to configure the servlet (see documentation for that) and import the appengine-remote-api.jar in your project (You can find it ..\appengine-java-sdk\lib\)
Only remember that Ancestor Queries with Remote APIs are not working (See this)
You didn't mention why you wanted to access the datastore of one application from another, but depending on the nature of your situation, App Engine modules might be a solution. These are structurally similar to separate applications, but they run under the same application "umbrella" and can access a common datastore.
You can not directly access datastore of another application. Your application must actively serve that data in order for another application to be able to access it. The easiest way to achieve this is via Remote API, which needs a piece of code installed in order to serve the data.
If you would like to have two separate code bases (even serving different hostnames/urls), then see the new AppEngine Modules. They give you ability to run totally different code on separate urls and with different runtime settings (instances), while still being on one application sharing all stateful services (datastore, tasks queue, memcache..).
I'm working on a web-app using Google App Engine with GWT, and I need to use Google API's (Google Calendar, Documents and so...).
As I know, I must configure a domain with Google to set my domain as callback of an OAuth Authentication. Am I right?
If so, am I forced to deploy on GAE to test? I mean, I can't run locally because my localhost can't be a valid callback.
Do you know any way to debug locally even using Google API's?
I have recommended to config a DynDNS, but isn't a solution in short term (incompatible router)...
If you use AuthSub instead I don't think you need to register a domain. The user just need a google account.
I have in the past used AuthSub together with Google Docs/Spreadsheet APIs on GAE and also been able to test it locally.
I can unfortunately not give you my code and exact solution (it was a while ago). But one of the samples I used extensively to base my code on was the FetcherServlet, check this code out:
http://code.google.com/p/google-app-engine-samples/source/browse/trunk/retrieving-gdata-feeds-java/src/com/google/appengine/demo/web/FetcherServlet.java?r=122
Also, I guess you might already have read this page (but their FetcherServlet uses OAuth, not AuthSub), so maybe just use it for some background info:
http://code.google.com/appengine/articles/java/retrieving_gdata_feeds.html
I read an article of an indie game developer who is using Google AppEngine to cache his main site and blog, to protect provide high-availability during traffic spikes (Digg, Slashdot effect).
Wolfire Blog - Google App Engine for Indie Developers
There's not a lot of detail on the exactly what they developed in Python on Google AppEngine that they used to cache the site. The only details I could find were about the AppEngine python app reading the backend wordpress articles through an RSS feed:
Wordpress runs on a dedicated server,
and we import it into www.wolfire.com
via RSS, which is the App Engine part.
Dumping Wordpress entirely is on my
list though of things to do someday.
;)
Does anyone know of any open source Python or Java web frameworks that you can use to customize caching a site that you could build and deploy on Google AppEngine to act as a "scalable" provider for your web content?
I'm using an "Ok" shared hosting service called bluehost to host my wordpress blog, I'd like to be able to instead put my blog on a separate domain (blog.ddaniels.net) and host google app-engine on www.ddaniels.net that would point to blog.ddaniels.net.
This could be extended for almost any type of website, you would still need links to dynamic content to point to the original host (for things like comments and editing wiki pages etc, basically any HTTP PUT type operations).
I'd assume you'd basically need a Java or Python framework that you could:
Configure your back end host e.g. blog.yourname.com
Configure Google App Engine framework as www.yourname.com (details for Google App Engine mapping to your domain, the key is you have to use subdomains and "www" is a subdomain)
On first access of page (or after expiration time) HTTP GET the page from backing host and cache it on Google AppEngine
You could start by taking the code for DryDrop, which mirrors static pages from a repository hosted on GitHub, and making it a more general reverse proxy. For example, you'd need to ensure that POST requests or logged-in users get passed through directly to the proxy.