Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15403202
D11359.id27442.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
D11359.id27442.diff
View Options
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementDebugWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementDebugWorkflow.php
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementDebugWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementDebugWorkflow.php
@@ -4,17 +4,16 @@
extends PhabricatorAphlictManagementWorkflow {
protected function didConstruct() {
- parent::didConstruct();
$this
->setName('debug')
->setSynopsis(
pht(
'Start the notifications server in the foreground and print large '.
- 'volumes of diagnostic information to the console.'));
+ 'volumes of diagnostic information to the console.'))
+ ->setArguments(array());
}
public function execute(PhutilArgumentParser $args) {
- parent::execute($args);
$this->setDebug(true);
$this->willLaunch();
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementRestartWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementRestartWorkflow.php
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementRestartWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementRestartWorkflow.php
@@ -4,15 +4,13 @@
extends PhabricatorAphlictManagementWorkflow {
protected function didConstruct() {
- parent::didConstruct();
$this
->setName('restart')
- ->setSynopsis(pht('Stop, then start the notifications server.'));
+ ->setSynopsis(pht('Stop, then start the notifications server.'))
+ ->setArguments(array());
}
public function execute(PhutilArgumentParser $args) {
- parent::execute($args);
-
$err = $this->executeStopCommand();
if ($err) {
return $err;
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementStartWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementStartWorkflow.php
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementStartWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementStartWorkflow.php
@@ -4,14 +4,13 @@
extends PhabricatorAphlictManagementWorkflow {
protected function didConstruct() {
- parent::didConstruct();
$this
->setName('start')
- ->setSynopsis(pht('Start the notifications server.'));
+ ->setSynopsis(pht('Start the notifications server.'))
+ ->setArguments(array());
}
public function execute(PhutilArgumentParser $args) {
- parent::execute($args);
return $this->executeStartCommand();
}
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
@@ -4,54 +4,11 @@
extends PhabricatorManagementWorkflow {
private $debug = false;
- private $clientHost;
- private $clientPort;
-
- protected function didConstruct() {
- $this
- ->setArguments(
- array(
- array(
- 'name' => 'client-host',
- 'param' => 'hostname',
- 'help' => pht('Hostname to bind to for the client server.'),
- ),
- array(
- 'name' => 'client-port',
- 'param' => 'port',
- 'help' => pht('Port to bind to for the client server.'),
- ),
- ));
- }
-
- public function execute(PhutilArgumentParser $args) {
- $this->clientHost = $args->getArg('client-host');
- $this->clientPort = $args->getArg('client-port');
- return 0;
- }
final public function getPIDPath() {
return PhabricatorEnv::getEnvConfig('notification.pidfile');
}
- final public function getLogPath() {
- $path = PhabricatorEnv::getEnvConfig('notification.log');
-
- try {
- $dir = dirname($path);
- if (!Filesystem::pathExists($dir)) {
- Filesystem::createDirectory($dir, 0755, true);
- }
- } catch (FilesystemException $ex) {
- throw new Exception(
- pht(
- "Failed to create '%s'. You should manually create this directory.",
- $dir));
- }
-
- return $path;
- }
-
final public function getPID() {
$pid = null;
if (Filesystem::pathExists($this->getPIDPath())) {
@@ -137,38 +94,42 @@
}
private function getServerArgv() {
- $ssl_key = PhabricatorEnv::getEnvConfig('notification.ssl-key');
- $ssl_cert = PhabricatorEnv::getEnvConfig('notification.ssl-cert');
-
- $admin_uri = PhabricatorEnv::getEnvConfig('notification.admin-uri');
- $admin_uri = new PhutilURI($admin_uri);
-
- $client_uri = PhabricatorEnv::getEnvConfig('notification.client-uri');
- $client_uri = new PhutilURI($client_uri);
+ $argv = array();
- $log = $this->getLogPath();
+ $client_uri = PhabricatorEnv::getEnvConfig('notification.client-bind-uri');
+ if ($client_uri) {
+ $client_uri = new PhutilURI($client_uri);
+ $argv[] = '--client-host='.$client_uri->getDomain();
+ $argv[] = '--client-port='.$client_uri->getPort();
+ } else {
+ $client_uri = PhabricatorEnv::getEnvConfig('notification.client-uri');
+ $argv[] = '--client-port='.$client_uri->getPort();
+ }
- $server_argv = array();
- $server_argv[] = '--client-port='.coalesce(
- $this->clientPort,
- $client_uri->getPort());
- $server_argv[] = '--admin-port='.$admin_uri->getPort();
+ $admin_uri = PhabricatorEnv::getEnvConfig('notification.admin-bind-uri');
+ if ($admin_uri) {
+ $admin_uri = new PhutilURI($admin_uri);
+ $argv[] = '--admin-host='.$admin_uri->getDomain();
+ $argv[] = '--admin-port='.$admin_uri->getPort();
+ } else {
+ $admin_uri = PhabricatorEnv::getEnvConfig('notification.server-uri');
+ $argv[] = '--admin-port='.$admin_uri->getPort();
+ }
+ $ssl_key = PhabricatorEnv::getEnvConfig('notification.ssl-key');
if ($ssl_key) {
- $server_argv[] = '--ssl-key='.$ssl_key;
+ $argv[] = '--ssl-key='.$ssl_key;
}
+ $ssl_cert = PhabricatorEnv::getEnvConfig('notification.ssl-cert');
if ($ssl_cert) {
- $server_argv[] = '--ssl-cert='.$ssl_cert;
+ $argv[] = '--ssl-cert='.$ssl_cert;
}
- $server_argv[] = '--log='.$log;
-
- if ($this->clientHost) {
- $server_argv[] = '--client-host='.$this->clientHost;
- }
+ $log = PhabricatorEnv::getEnvConfig('notification.log');
+ $argv[] = '--log='.$log;
- return $server_argv;
+ return $argv;
}
private function getAphlictScriptPath() {
diff --git a/src/applications/config/option/PhabricatorNotificationConfigOptions.php b/src/applications/config/option/PhabricatorNotificationConfigOptions.php
--- a/src/applications/config/option/PhabricatorNotificationConfigOptions.php
+++ b/src/applications/config/option/PhabricatorNotificationConfigOptions.php
@@ -40,12 +40,42 @@
'ws',
'wss')),
$this->newOption(
+ 'notification.client-bind-uri',
+ 'string',
+ null)
+ ->setDescription(
+ pht(
+ 'Interface and port for the Aphlict client server to bind to. '.
+ 'This can be either a hostname and port or a unix socket '.
+ '(specified as a `%s` resource). If left unspecified, the server '.
+ 'will accept connections directed to any IPv4 address (`%s`) with '.
+ 'the port specified in [[%s|%s]]`.',
+ 'file://',
+ 'INADDR_ANY',
+ '/config/edit/notification.client-uri/',
+ 'notification.client-uri')),
+ $this->newOption(
'notification.admin-uri',
'string',
'http://localhost:22281/')
->setDescription(
pht(
'Location of the notification admin server.')),
+ $this->newOption(
+ 'notification.server-bind-uri',
+ 'string',
+ null)
+ ->setDescription(
+ pht('Interface and port for the Aphlict Admin server to bind to.'))
+ ->addExample(
+ 'http://localhost:22280',
+ pht('Accept connections from %s over port %d.', 'localhost', 22280))
+ ->addExample(
+ 'http://localhost:22280',
+ pht('Accept connections from %s over port %d.', 'localhost', 22280))
+ ->addExample(
+ 'file:///var/run/aphlict.socket',
+ pht('Bind to a unix socket.')),
$this->newOption('notification.log', 'string', '/var/log/aphlict.log')
->setDescription(pht('Location of the server log file.')),
$this->newOption('notification.ssl-key', 'string', null)
diff --git a/src/docs/user/configuration/notifications.diviner b/src/docs/user/configuration/notifications.diviner
--- a/src/docs/user/configuration/notifications.diviner
+++ b/src/docs/user/configuration/notifications.diviner
@@ -191,5 +191,4 @@
With this approach, you should set `notification.client-uri` to
`http://localhost/ws/`. Additionally, there is no need for the Aphlict server
to bind to `0.0.0.0` anymore (which is the default behavior), so you could
-start the Aphlict server with `./bin/aphlict start --client-host=localhost`
-instead.
+also set `notification.bind-uri` to `http://localhost:22280/`.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 19, 2:12 AM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7386762
Default Alt Text
D11359.id27442.diff (9 KB)
Attached To
Mode
D11359: Add `notification.bind-uri` to configure Aphlict server
Attached
Detach File
Event Timeline
Log In to Comment