Add support for updating the daemon's configuration file automatically.
This commit is contained in:
parent
72ad6d5c87
commit
1eb1f96e71
3 changed files with 42 additions and 3 deletions
|
@ -4,6 +4,9 @@ This file is a running track of new features and fixes to each version of the pa
|
|||
This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||
|
||||
## v0.5.4 (Bodacious Boreopterus)
|
||||
### Added
|
||||
* Changing node configuration values now automatically makes a call to the daemon and updates the configuration there. Changing daemon tokens now does not require any intervention, and takes effect immediately. SSL & Port configurations will still require a daemon reboot.
|
||||
|
||||
### Changed
|
||||
* File uploads now account for a maximum file size that is assigned for the daemon, and gives cleaner errors when that limit is reached.
|
||||
* File upload limit can now be controlled from the panel.
|
||||
|
|
|
@ -106,6 +106,7 @@ class NodeRepository {
|
|||
'memory_overallocate' => 'numeric|min:-1',
|
||||
'disk' => 'numeric|min:1',
|
||||
'disk_overallocate' => 'numeric|min:-1',
|
||||
'upload_size' => 'numeric|min:0',
|
||||
'daemonBase' => 'regex:/^([\/][\d\w.\-\/]+)$/',
|
||||
'daemonSFTP' => 'numeric|between:1,65535',
|
||||
'daemonListen' => 'numeric|between:1,65535',
|
||||
|
@ -151,8 +152,43 @@ class NodeRepository {
|
|||
unset($data['reset_secret']);
|
||||
}
|
||||
|
||||
// Store the Data
|
||||
return $node->update($data);
|
||||
$oldDaemonKey = $node->daemonSecret;
|
||||
$node->update($data);
|
||||
try {
|
||||
$client = Models\Node::guzzleRequest($node->id);
|
||||
$client->request('PATCH', '/config', [
|
||||
'headers' => [
|
||||
'X-Access-Token' => $oldDaemonKey,
|
||||
],
|
||||
'json' => [
|
||||
'web' => [
|
||||
'listen' => $node->daemonListen,
|
||||
'ssl' => [
|
||||
'enabled' => ($node->scheme === 'https'),
|
||||
'certificate' => '/etc/letsencrypt/live/' . $node->fqdn .'/fullchain.pem',
|
||||
'key' => '/etc/letsencrypt/live/' . $node->fqdn . '/privkey.pem',
|
||||
],
|
||||
],
|
||||
'sftp' => [
|
||||
'path' => $node->daemonBase,
|
||||
'port' => $node->daemonSFTP,
|
||||
],
|
||||
'remote' => [
|
||||
'base' => config('app.url'),
|
||||
'download' => route('remote.download'),
|
||||
'installed' => route('remote.install'),
|
||||
],
|
||||
'uploads' => [
|
||||
'size_limit' => $node->upload_size,
|
||||
],
|
||||
'keys' => [
|
||||
$node->daemonSecret,
|
||||
]
|
||||
],
|
||||
]);
|
||||
} catch (\Exception $ex) {
|
||||
throw new DisplayException('Failed to update the node configuration, however your changes have been saved to the database. You will need to manually update the configuration file for the node to apply these changes.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@
|
|||
<div class="col-xs-6">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="reset_secret" class="control-label"><span class="label label-warning"><i class="fa fa-power-off"></i></span> Reset Daemon Key</label>
|
||||
<label for="reset_secret" class="control-label">Reset Daemon Key</label>
|
||||
<div style="padding: 7px 0;">
|
||||
<input type="checkbox" name="reset_secret" id="reset_secret" /> Reset Daemon Master Key
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue