Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server/client): service quick reload #131

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions htdocs/luci-static/resources/view/homeproxy/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

'use strict';
'require form';
'require fs';
'require network';
'require poll';
'require rpc';
Expand Down Expand Up @@ -340,6 +341,13 @@ return view.extend({
}
so.default = 'nil';
so.rmempty = false;

so = ss.option(form.Button, '_reload_client', _('Quick Reload'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any sense of this change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emmm... I can probably list a few points.

  1. Faster than Default outbound: proxy --> nil --> SAVE --> proxy --> APPLY
  2. This is faster when hp stops due to itself or other reasons

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. you have to edit uci configuration to stop the service if use reload method.
  2. procd should automatically restart the service

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. But stop_service does not check the value of outbound_node, it just terminates the service completely.
  2. procd sometimes fails to respawn, and I have set the watchdog to stop the hp service when the proxy node is offline for a long time

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. that will not stop the service anyway, it's just restart. manually restart can be done via system -> startup.
  2. then you should check logs, why it fails. procd will only stop respawn if the service crashed 5 times in one hour.

so.inputtitle = _('Reload');
so.inputstyle = 'apply';
so.onclick = function() {
return fs.exec('/etc/init.d/homeproxy', ['reload']);
};
/* Routing settings end */

/* Routing nodes start */
Expand Down
8 changes: 8 additions & 0 deletions htdocs/luci-static/resources/view/homeproxy/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

'use strict';
'require form';
'require fs';
'require poll';
'require rpc';
'require uci';
Expand Down Expand Up @@ -72,6 +73,13 @@ return view.extend({

s = m.section(form.NamedSection, 'server', 'homeproxy', _('Global settings'));

o = s.option(form.Button, '_reload_server', _('Quick Reload'));
o.inputtitle = _('Reload');
o.inputstyle = 'apply';
o.onclick = function() {
return fs.exec('/etc/init.d/homeproxy', ['reload']);
};

o = s.option(form.Flag, 'enabled', _('Enable'));
o.default = o.disabled;
o.rmempty = false;
Expand Down
1 change: 1 addition & 0 deletions root/usr/share/rpcd/acl.d/luci-app-homeproxy.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"read": {
"file": {
"/etc/homeproxy/scripts/update_subscriptions.uc": [ "exec" ],
"/etc/init.d/homeproxy reload": [ "exec" ],
"/var/run/homeproxy/homeproxy.log": [ "read" ],
"/var/run/homeproxy/sing-box-c.log": [ "read" ],
"/var/run/homeproxy/sing-box-s.log": [ "read" ]
Expand Down