Complete modernization of Aphlict configuration

Summary:
Fixes T10697. This finishes bringing the rest of the config up to cluster power levels.

Phabricator is now given an arbitrarily long list of notification servers.

Each Aphlict server is given an arbitrarily long list of ports to run services on.

Users are free to make them meet in the middle by proxying whatever they want to whatever else they want.

This should also accommodate clustering fairly easily in the future.

Also rewrote the status UI and changed a million other things. 🐗

Test Plan:
{F1217864}

{F1217865}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10697

Differential Revision: https://secure.phabricator.com/D15703
This commit is contained in:
epriestley
2016-04-13 12:07:48 -07:00
parent c6b0925954
commit 2930733ac9
25 changed files with 788 additions and 289 deletions

View File

@@ -82,6 +82,7 @@ try {
require('./lib/AphlictAdminServer');
require('./lib/AphlictClientServer');
var ii;
var logs = config.logs || [];

View File

@@ -58,7 +58,7 @@ JX.install('AphlictAdminServer', {
_onrequest: function(request, response) {
var self = this;
var u = url.parse(request.url, true);
var instance = u.query.instance || '/';
var instance = u.query.instance || 'default';
// Publishing a notification.
if (u.pathname == '/') {

View File

@@ -26,11 +26,11 @@ JX.install('AphlictClientServer', {
_server: null,
_lists: null,
getListenerList: function(path) {
if (!this._lists[path]) {
this._lists[path] = new JX.AphlictListenerList(path);
getListenerList: function(instance) {
if (!this._lists[instance]) {
this._lists[instance] = new JX.AphlictListenerList(instance);
}
return this._lists[path];
return this._lists[instance];
},
log: function() {
@@ -58,8 +58,14 @@ JX.install('AphlictClientServer', {
var wss = new WebSocket.Server({server: server});
wss.on('connection', function(ws) {
var path = url.parse(ws.upgradeReq.url).pathname;
var listener = self.getListenerList(path).addListener(ws);
var instance = url.parse(ws.upgradeReq.url).pathname;
instance = instance.replace(/\//g, '');
if (!instance.length) {
instance = 'default';
}
var listener = self.getListenerList(instance).addListener(ws);
function log() {
self.log(
@@ -104,23 +110,12 @@ JX.install('AphlictClientServer', {
});
ws.on('close', function() {
self.getListenerList(path).removeListener(listener);
self.getListenerList(instance).removeListener(listener);
log('Disconnected.');
});
wss.on('close', function() {
self.getListenerList(path).removeListener(listener);
log('Disconnected.');
});
wss.on('error', function(err) {
log('Error: %s', err.message);
});
});
},
}
}
});

View File

@@ -50,7 +50,7 @@ JX.install('AphlictListener', {
},
getDescription: function() {
return 'Listener/' + this.getID() + this._path;
return 'Listener/' + this.getID() + '/' + this._path;
},
writeMessage: function(message) {