You may need to run a skeleton DNS server on localhost which understands your address allocations.
Nitin Sent from my mobile Internet device On Mar 11, 2011, at 2:10 PM, Joe Freeman <[email protected]> wrote: > How about you just always send the user to the local instance if they > have couch installed by putting '127.0.0.1 app.com' in /etc/hosts (or > similar). Then you don't have to worry about the 'remote'/'local' > subdomain. Anyone that doesn't have couch installed (and hence doesn't > have the customised /etc/hosts) will get directed to the remote > instance. > > The only problem is that users with couch installed locally won't be > able to access the remote couch directly (on the 'app.com' domain), > but if you can rely on couch syncing the databases, is this even a > problem? > > (Obviously you can't setup the replication using the 'app.com' domain, > as the local instance would end up syncing with itself?) > > Does that help? > > > On 10 March 2011 19:16, Ryan Ramage <[email protected]> wrote: >> Ok, this maybe slightly off-topic for couch, but since it is the >> garden path couch has led me down for the design of my app, I am sure >> others here will have an opinion. >> >> >> Here is what I have: >> On a users machine, they have a local couch instance. It syncs up with >> a hosted couch. Here are some 'example urls' >> >> http://local.app.com/db/doc >> http://remote.app.com/db/doc >> >> (I have an A record dns entry local.app.com -> localhost) >> >> Here is what I want: >> I want URLs that will failover to either the local or remote depending >> on what is available. >> >> >> >> Situation 1. >> So lets say I am ROAMING with no inet connection. I open a word >> document on my local machine, which contains the link: >> >> http://remote.app.com/db/doc >> >> When I click on the link, would there be a way that it get redirected >> to http://local.app.com/db/doc >> >> >> >> >> Situation 2. >> Someone has emailed me a word doc, and I have no couch locally. I open >> a url in the doc: >> >> http://local.app.com/db/doc >> >> Since I have no couch locally, could they be redirected to >> http://remote.app.com/db/doc >> >> >> >> Situation 3 >> So lets say I am ROAMING, BUT HAVE inet connection. I open a word >> document on my local machine, which contains the link: >> >> http://remote.app.com/db/doc >> >> When I click on the link, would there be a way that it get redirected >> to http://local.app.com/db/doc >> This way the fastest copy will be used. >> >> >> My Initial idea (untested) >> I was thinking about having the following DNS entries: >> >> local.app.com IN A localhost 300s (5m) >> local.app.com IN A 74.74.74.74 300s (5m) >> remote.app.com IN A 74.74.74.74 300s (5m) >> remote.app.com IN A localhost 300s (5m) >> >> >> Would that even work? I am not sure how a browser (or other client) >> takes the order or A records. Also, when offline, and no real dns is >> available, would there be a cached copy so at least >> it would resolve to localhost? >> >> So the discussion is about keeping, nice, world friendly URLs that >> might please Tim Berners-Lee, and also having the local/remote copies. >> >> Any thoughts? >> Ryan >>
