How can I run GAE projects separately under one application? - google-app-engine

I'm new to web application and Google app engine. I don't understand the relationship between projects and the application. I know that there is one unique application ID, but under the application, there can be a lot of projects.
Now I want to run those projects individually under one application using different folders in URL, like this: http://udacity-cs253.appspot.com/unit2/rot13. It's using different URLs for projects but I don't know how to do that.
I read google's help pages but they didn't help. So can anyone help me with this?
Thank you~

An application consists of all of the code deployed to App Engine under a single application ID (appid). For a single appid you have shared:
datastore contents
cron jobs
task queues
logs
project administrators and permissions
billing settings and quotas
If you'd like to arrange the code within a single application into logical projects, and are comfortable with sharing the above amongst the projects contained in the same appid, you can feel free to do so.
However, if you'd like to segregate the projects (for instance, if you don't want developers of project A to be able to configure project B), you should create individual appids for each project and manage them separately.
As far as routing of requests to individual projects, aschmid00's answer provides a useful suggestion on how to do this.

lets suppose your app is written in python.
you do that in your app.yaml file
if you have 2 applications (unit1 and unit2) in your app folder both do have a main.py and in there you define your WSGI application
in your app.yaml you do like this:
- url: /unit1/.*
script: unit1.main.application
- url: /unit2/.*
script: unit2.main.application
all requests with path /unit1/.* will be served by unit1, the /unit2/.* by unit2.
the datastore will be shared

Related

Firebase - Add many apps to one project

This is the first time i'm working with firebase. My goal is to have a bounch of client apps (more and more over time), all of them managed by an admin app (One app to rule them all).
The thing is that the client apps have a certain content that needs to be updated from the admin app. My best approach is to create a firebase project, put the admin app there and adding client apps over time. I'have read that is possible to have an unlimited number of apps inside one Firebase project. On addition, someone told me to create one project for each client app and connect them to the same database somehow. I simply don't know what to do.
Which would be the best solution for my problem? thank you
firebaser here
A Firebase project can currently contain up to 30 app definitions. This is meant to support variations of the same logical application. For example, having an Admin app in addition to the app for regular users, and/or having an iOS, Android, and Web version of the same app, and for example having a free and a pro version of the app (if that is allowed by the stores where you deliver them).
Adding multiple apps to a project is expressly not meant to be used for white labeling apps, where you ship essentially the same app with different branding to different user segments, as you'd be sharing the backend services between them. For some backend services (such as database and storage) this is not necessarily a problem, as you can isolate the customers with security rules. But for other services (such as authentication and analytics) this is not possible, which is why this use-case is not supported.
If you need to define a separate app in the project for each customer, the only supported approach is to create a separate project for each customer.
I'have read that is possible to have an unlimited number of apps inside one Firebase project.
In that case please provide a link, so we can either fix it, or (if it's not in the Firebase documentation) leave a comment to clarify.

Serving different Container Registry images for dev, test, prod within one GAE project

I deploy my Docker image to default GAE by gcloud app deploy --image-url=us.gcr.io
I have successfully mapped my custom domain to this application with custom runtime and flex env.
My dispatch.yaml sends requests to its sub-domain:
dispatch:
- url: "dev.domain.com/*"
service: default
Now I want to use different images from Container Registry for test.domain.com and domain.com
While having all these images sharing same Cloud Storage and Firebase credentials.
Being new to GCP I wanted to learn any simple approach to organize such basic structure without going into services and versions (just by assigning proper images to serve relevant domains).
Is it even possible to do within one GAE project or I should create separate projects for it?
Mapping custom domains can only be done at the service level, so if you don't want to go into services separate projects is your only choice.
Actually using separate projects instead of services (or service versions) for implementing different environments has some advantages, I'd choose separate projects, too. See Advantages of implementing CI/CD environments at GAE project/app level vs service/module level?
I'm not sure if sharing the storage and credentials between production and other environments is a good idea (what if something goes wrong?). I'd keep them separate, too (maybe with some jobs to populate non-production projects with production data, if you need to). But if you do want to share them across projects you'll probably need to make some extra steps.

Custom Url with Umbraco(other CMS) to point to existing website

We have a running multi-lingual app hosted in Azure written in AngularJS. For managing some of the unsecured/public pages, we are looking for hosting another app with a CMS. So our app structure is would look something like:
App: www.example.com
CMS: www.examplecms.com
What we want to achieve is that dynamic content generated by CMS (different domain) for static pages be served using urls in www.example.com. Is it possible? We are primary targeting .net based CMS solutions but are open to other platforms. The static content is not too complicated.
Since the app supports multiple languages and most of the CMS solutions available offer multi-language support via subdomain.example.com or www.example.com/language/ directory structure, we want the custom url redirection to point to our app site (www.example.com).
Looking for suggestions you opinions or best strategies to work around this problem.
This Q is off topic, nether the less...
As you would essentially be running 2 entirely different web sites, yes everything would work just fine. The requirements are vague and very generic but any application/CMS could be setup in different domains and if you wanted requests made between them, allowing cross origin requests would allow sharing content/data.
Umbraco, like many CMS's supports multilingual sites using path prefixes as you mention along with any other method you are willing to write yourself.

An API for creating and managing Google Cloud Console projects?

I believe there is an undocumented Google API available to create and manage Google Cloud Console (and App Engine) projects on behalf of third party users.
Does anyone know how to use it?
I think older versions of the Google Eclipse Plugin obtained an OAuth2 token in the (undocumented) scope https://www.googleapis.com/auth/appengine.admin, and this allowed it to generate a Cloud Console project on your behalf. The latest version doesn't seem to do this. App Engine's own appcfg.py also uses this scope, but doesn't seem to do much more than deploy the code - I'm looking to change core settings for the project, such as Name, Redirect URLs, and Web Origins.
Any information would be appreciated.
I maintain a WordPress plugin providing secure Google Apps Login for end users, and currently have to give detailed instructions to admins for creating a new Cloud Console project manually, and entering settings such as Redirect URL. Ideally, I would create a simple on-line service to do all of this for them.
Thank you!
It is possible to programmatically create a new Developer Console project on behalf of a Google Account (yes, you read that right). You do so in a very roundabout way:
Request the https://www.googleapis.com/auth/drive.scripts scope from the user (standard OAuth 2.0 flow).
Use the Drive API's drive.insert method to create a new file with a mimetype of application/vnd.google-apps.script.
Somehow try to get the project ID, maybe by uploading some Apps Script code? This is the part that I was never able to figure out.
A little known fact is that every Google Apps Script project has a hidden Developer Console project associated with it. This project is not shown in the list of projects, but it does exist. It is created automatically when the user starts a new Apps Script project, and the drive.insert method is enough to cause this to happen.
How do you get to the hidden project? Well, the only way I know of is to open the Apps Script project from the Drive website, open the "Resources > Advanced Google Services" dialog, and click the link to the Developer Console. You'll find the project ID in the URL.
Aside from not being shown in your list of projects and not being able to use App Engine, this is a normal Developer Console project. You can add additional OAuth client credentials, service accounts, Compute Engine instances, etc. And of course once you have a project ID, all of the various management APIs will work: creating new virtual machines, making use of a service account's impersonation ability, etc.

deploy multiple appengine apps to one appspot subdomain

I don't want to waste any more of my 10 appspot.com subdomains for test projects. Is there an elegant way to have multiple appengine apps, each to its own folder, e.g. xx.appspot.com/myapp1, xx.appspot.com/myapp2? I want the configuration to be identical or very close to the actual deployment configuration at a subdomain's root.
Just ask for more apps. Google would rather give you more apps than have you work around the limit. See here
What you could maybe do is (ab-)use the different versions for completely different projects. In this case you do not have to change anything in web.xml.
http://1.latest.xx.appspot.com for myapp1
http://2.latest.xx.appspot.com for myapp2
They do share the same datastore and memcache and task queues, but you would have the same situation with separating the paths. And if the table names do not collide, that should not be a problem.
You do get different admin consoles (log viewers etc) for each version.
You could always create a new Google account and get 10 new apps, right?
You could use dummy Google accounts for your test projects, and add your original Google account as a developer to a project you decide to actively work on... That way your original Google account doesn't get "polluted" by test projects.

Resources