I am facing an issue with the 20 limit dispatch.yaml rule
Currently I am using "client".mydomain.com which is easy to setup
But I have some bigger clients who I want to put onto a separate service
My goal was the following,
Public website
Put 30-50 clients on service A using "client".mydomain.com
Put 1 client on service B using "client".mydomain.com
Put 20-30 clients on service C
But then using number 3 I need to be creative and use something like "client".2.mydomain.com. I would rather see also just "client".mydomain.com on service C
Now dispatch.yaml does have a 20 rule limit, so putting many clients on a separate service is not possible. Eventually I will run into the limit
Anyone has any ideas on to fix this, or do this in another way.
I am open for any suggestions, I was thinking of putting up an nginx, but not each service has it's own ip, so that also not a possibility. Perhaps some new features or so ?
I could also just setup different "similar" domain names and map those like mydomainapp.com appmydomain.com etc, but that would be a bit too much
Currently my dispatch.yaml looks like
dispatch:
- url: "domain.com/*"
service: default
- url: "www.domain.com/*"
service: default
- url: "*.domain.com/*"
service: myapp
- url: "*/something"
service: myapp
- url: "*/*"
service: default
So any ideas on how to make this working for everything so that I can use "client".domain.com for every
For better routing you can make use of a Load Balancer in front of your App Engine services, and add App Engine as a NEG (Network Endpoint Group).
If you set up the Load Balancer and the NEG, you can then create a URL Map or even URL Masks to determine which service should be handling the request.
With that option you'll be also removing the limit that you've encountered while using the dispatch.yaml file to define the routing paths.
Related
Is it possible to group certain requests togeather based on their url ensuring that similar requests go to the same instance?
E.g.
There are multiple instances for my app engine
myurl.com?foo=abc // Multiple people putting in this url will all go to the same instance
myurl.com // I don't care which one this goes
I don't think you can control which instance handles a url pattern.
If you want to send certain urls to a certain service, what you want is a dispatch.yaml, which does exactly that. You can use regex to tailor how you want. With some strategy, you could match urls with (groups of) instances, though they would be in separate services. If your site doesn't get a lot of traffic, you could essentially have one instance per service, and accomplish what you want.
dispatch:
# don't forget: gcloud app deploy dispatch.yaml after changes !!!
- url: "*/some/high/memory/urls/*"
service: my_high_memory_service
- url: "*/some/fast/cpu/url"
service: my_fast_cpu_service
- url: "*/.*"
service: default
More at: https://cloud.google.com/appengine/docs/standard/python/reference/dispatch-yaml
I'm trying to create path routing in AWS application load balancer.
Example:
apple.mango.com/vault goes to instance1 port 80 and nginx routes it to /var/html/reactApp1/build/
apple.mango.com/flow goes to instance2 port 80 and nginx routes it to /var/html/reactApp2/build/
My configuration look something like this:
Also, for both /var/html/reactApp1/build/ and /var/html/reactApp2/build/, I have them hosted normally say mango.com and apple.com and they work just fine.
Problem Statement:
When the application is visited via path routing like apple.mango.com/vault or apple.mango.com/flow it reaches the correct machines/root but fails to load the sites as expected.
Upon inspecting the blank page, it does not load the node-modules:
Where am I going wrong?
I know this question was asked since almost 2 years, but I think I found the solution, so even if it is not usefull now, it can be important in the near future:
In the rules of your load balancer you must enable one rule to allow redirect the traffic to your app when it try to search /static/... because that is the bundle.js created by react:
I hope this will be as useful for you as it has been for me.
Having multiple languages to deploy under appengine; I wonder if some kind of private approach could be applied; in order to have it all resides only under a single domain
For example, given xyz.com domain setup as wildcard; having a default service, services svc1 and svc2; and a dispatch.yaml mapping */svc1/* to svc1 service and */svc2* to svc2 service; how to :
hide all the *.appspot domain ?
hide the automatic setup of svc1.xyz.com and svc2.xyz.com ?
It could be easy for a given service to check the host and redirect to the desired one; but it would have to be done for every services; feels like there a better way
It feels a bit messy to have all those auto enopoints opened and unused, the idea would be to have it all under xyz.com/
-
There is no way of hiding all the routes of the .appspot domain. As you probably are aware the dispatch.yaml, only works as a redirect. Probably, you cannot just disable the default domain, since there are a lot of tools like Cloud Tasks, Cron Jobs etc.. that uses that default domain, hitting those endopoints.
As for the second question, you cannot hide them, but in case you don't need them, you can overwrite them in the dispatch.yaml to point to some custom made "not found" page.
I have this:
- url: "awesome.com/*"
service: awesome
- url: "www.awesome.com/*"
service: awesome
Is possible to do this? to achieve same as above?
- url: "*.awesome.com/*"
service: awesome
No, what that last option you mentioned would do is map all subdomains of awesome.com to the service awesome, as you can see in this example corresponding to mapping subdomains in the documentation.
Here you have more information about mapping custom domains.
Yes, it's possible to do that. But it won't be equivalent with what you have now:
it won't match your top-level domain awesome.com which is matched by your current 1st rule
it'll match any <blah>.awesome.com subdomain, your current set of rules only matches the www.awesome.com subdomain
If indeed you want to send requests for both the full domain as well as all its subdomains to the awesome service you can achieve that simply by the custom domain mapping/config itself (which you need to do explicitly for the domain and each subdomain anyways), no need for a dispatch file.
Note that you'd still need to deploy a default service, see Why do I need to deploy a "default" app before I can deploy multiple services in GAE?. Might as well just let the awesome service be the default one in this case, less confusing and less room for trouble IMHO.
I have two very simple services set up (in python) on google app engine. I have a site which has been up for a while as the defualt service of my example project, and I just deployed another service, lets call it foo. I have dns forwarding working for the default service, so I can go to example.com (which I own in this hypothetical scenario) and see my default service. I can also go to foo.example.appspot.com and see my foo service, which works at the url.
I have also registered another domain, let's call it foo.com. What I want is for foo.com to use my foo.example.appspot.com service. To make matters trickier, foo.com has a bunch of sub-domains of it's own, so I need x.foo.com to go to my foo service as well (and even x.y.foo.com would be ideal, but if that is hard I can work around that one easily enough by just substituting out another character so it would be x-y.foo.com or something along those lines).
I'm pretty new to web dev (which is honestly a generous description for this simple project), but Iv'e spent a while reading and googling and haven't found a solution to this, so any advice would be helpful. My last resort would be to un-service-ify (if you will) the two services, and just bundle it all up into one big main.py which routes differently depending on the domain, and then point both domains at the default service. The big downside to this is that I already have everything working with services (which seems like a better approach).
I expect to get very few users so scaling isn't really an issue (though it's always interesting to learn about).
EDIT:
attempted to create a dispatch.yaml file to solve this as follows:
dispatch:
- url: "foo.com"
module: foo
- url: "*.foo.com"
module: foo
but when I run appcfg.py -A <project_id_here> update_dispatch . it says
Error parsing yaml file:
Unable to assign value 'foo.com' to attribute 'url':
invalid url 'foo.com'
in "./dispatch.yaml", line 3, column 10
Yes, it should be possible. I didn't actually use 2 different top-level domains, but the development console appears to be ready to accept a second one (I can't actually check as I don't own a 2nd domain). Follow the Adding a custom domain for your application procedure.
Pay special attention to the Wildcard mappings section - since your foo.com domain already has sub-domains in use you can't use wildcards at/above those sub-domains, you'll have to specify the desired subdomains.
The procedure only maps (sub)domains to the app as a whole, not to individual services/modules. You'll also have to use a dispatch file, to route the specific subdomains to the corresponding modules/services. You can find examples here: https://stackoverflow.com/a/32103486/4495081 and https://stackoverflow.com/a/34111170/4495081 (the last one has rules to allow the module to work on the custom domain, on appspot.com and on the local development server).
I got it to work following The links in the answer. My dispatch file wound up looking like this:
dispatch:
- url: "foo.com/*"
module: foo
- url: "*.foo.com/*"
module: foo