fedwiki / wiki-server

Federated Wiki client and server in Node.js
Other
153 stars 35 forks source link

running server with wildcard DNS #57

Closed PeterSommerlad closed 8 years ago

PeterSommerlad commented 10 years ago

Hi,

I am struggling with setting up a farmed federated wiki server. If I want to limit the amount of wikis by manually creating them, the wiki server crashes, when I use an URL for which no farm element directory exists. Any ideas to overcome that, but still limit the number of wikis in a farm? (I know, this is newbie stuff, but I'd like to figure things out).

[ { _: [],
    test: false,
    help: false,
    h: false,
    p: 3000,
    port: 40002,
    d: '/home/wiki/node-fedwiki',
    data: '/home/wiki/node-fedwiki/test2.fed.hsr.ch',
    f: true,
    farm: true,
    '$0': 'wiki',
    valueOf: undefined,
    farmPort: 40000,
    root: '/usr/lib/node_modules/wiki/node_modules/wiki-server',
    home: 'welcome-visitors',
    url: 'http://test2.fed.hsr.ch',
    packageDir: '/usr/lib/node_modules/wiki/node_modules',
    client: '/usr/lib/node_modules/wiki/node_modules/wiki-client/client',
    db: '/home/wiki/node-fedwiki/test2.fed.hsr.ch/pages',
    status: '/home/wiki/node-fedwiki/test2.fed.hsr.ch/status',
    id: '/home/wiki/node-fedwiki/test2.fed.hsr.ch/status/persona.identity',
    database: { type: './page' },
    debug: true } ]
[ 'Smallest Federated Wiki server listening on',
  40002,
  'in mode:',
  'development' ]

/usr/lib/node_modules/wiki/node_modules/coffee-trace/lib/coffee-trace.coffee:33
      coffee_trace = (stack = err.stack.split("\n"))[1].match(options.stack_ma
                                                        ^
TypeError: Cannot call method 'match' of undefined
    at process.<anonymous> (/usr/lib/node_modules/wiki/node_modules/coffee-trace/lib/coffee-trace.coffee:33:57)
    at process.EventEmitter.emit (events.js:95:17)
    at process._fatalException (node.js:272:26)
paul90 commented 10 years ago

Any ideas to overcome that, but still limit the number of wikis in a farm? (I know, this is newbie stuff, but I'd like to figure things out).

An interesting question, and not newbie stuff.

Currently, in farm.coffee line 43 when a request arrives for new sub-domain a new server is started.

One way of doing this would be to check that the directory for the wiki exists, before creating the server, and return a 404 error if the directory does not exist. This would restrict wiki creation to those with file system access.

nrn commented 10 years ago

The way I do this now is a little awkward, but I've got a reverse proxy on my server listening on port 80, for virtual hosts because I have a bunch of different stuff running on the server. For wikis that I want to restrict farm creation on I only redirect sub-domains I want to them, for wikis I want any subdomain I want to be created I redirect * subdomains.

This is not the slickest, but it works well.

WardCunningham commented 10 years ago

We have discussed a number of strategies for managing a farm but have not yet coded logic in wiki for any particular solution other than farm vs. not-farm.

I like the solution @nrn offers because it makes domain creation the responsibility of network administration.

I also like the solution we've talked about of making farm site creation dependent on a Persona login based on a specific domain. This would be good for company wikis because it pushes the administration onto the email account administration.

I consider the promiscuous approach I am currently using on fed.wiki.org a short-term solution suitable for an experimental environment. I sometimes run commands on the server that find empty wiki sites and deletes them. I use some variation of find that suites my mood.