Skip to content

Added configs for snap daemons - #1204

Merged
zonyitoo merged 2 commits into
shadowsocks:masterfrom
fertkir:master
Jun 14, 2023
Merged

Added configs for snap daemons#1204
zonyitoo merged 2 commits into
shadowsocks:masterfrom
fertkir:master

Conversation

@fertkir

@fertkir fertkir commented May 27, 2023

Copy link
Copy Markdown
Contributor

Currently if you run snap start shadowsocks-rust.ssserver-daemon it will fail because of the missing config.

This patch adds paths to config files. All a user needs to do is to add desired local/server configs to $SNAP_COMMON directory.

Still there's a problem, that only one sslocal/ssserver daemon instance is allowed.
With ssserver you can work around this by runing multiple servers in one process (shadowsocks config allows it).
But with sslocal this is, alas, impossible.

@zonyitoo

zonyitoo commented May 28, 2023

Copy link
Copy Markdown
Collaborator

// UNIX global configuration file
#[cfg(unix)]
{
let global_config_path = Path::new("/etc/shadowsocks-rust/config.json");
if global_config_path.exists() {
return Some(global_config_path.to_path_buf());
}
}

/etc/shadowsocks-rust/config.json is already in the default path. It should be able to read the config in $SNAP_COMMON in the current implementation.

@fertkir

fertkir commented May 28, 2023

Copy link
Copy Markdown
Contributor Author

I don't think that having one config file for both ssserver and sslocal is very usable, since same config fields mean different things for server and local. AFAIU, server and local need separate configs.

@zonyitoo

Copy link
Copy Markdown
Collaborator

Why would you run sslocal and ssserver simotanously on the same machine?

On the other hand, add these local.json and server.json into src/config.rs.

@fertkir

fertkir commented May 29, 2023

Copy link
Copy Markdown
Contributor Author

Added, please review

@fertkir

fertkir commented May 29, 2023

Copy link
Copy Markdown
Contributor Author

Also, I would like to be able to run multiple instances of sslocal.
Here they say that it's impossible to run multiple instances of a snap daemon: https://forum.snapcraft.io/t/run-multiple-service-instances/35233
ssserver supports having 2 instances as a one process (I can add multiple configs to "locals' field).
But sslocal, unfortunately, does not support anything like this (it instead load-balances between configs in "servers" field).

Do you know any workaround?

@zonyitoo

Copy link
Copy Markdown
Collaborator

I don't know. I run my own services with handwriting systemd service files.

@fertkir

fertkir commented May 29, 2023

Copy link
Copy Markdown
Contributor Author

Me too. But when running snaps with handwritten systemd service, journalctl doesn't show the logs.

@zonyitoo

Copy link
Copy Markdown
Collaborator

Hmm, shouldn't we also support config.json?

@fertkir

fertkir commented Jun 14, 2023

Copy link
Copy Markdown
Contributor Author

It is used if server.json/local.json is not provided:

 let config_files = vec![config_file, "config.json"];

@zonyitoo
zonyitoo merged commit 67232c3 into shadowsocks:master Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants