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

Added configs for snap daemons #1204

Merged
merged 2 commits into from
Jun 14, 2023
Merged

Added configs for snap daemons #1204

merged 2 commits into from
Jun 14, 2023

Conversation

fertkir
Copy link
Contributor

@fertkir fertkir commented May 27, 2023

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
Copy link
Collaborator

zonyitoo commented May 28, 2023

// 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
Copy link
Contributor Author

fertkir commented May 28, 2023

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
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
Copy link
Contributor Author

fertkir commented May 29, 2023

Added, please review

@fertkir
Copy link
Contributor Author

fertkir commented May 29, 2023

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
Collaborator

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

@fertkir
Copy link
Contributor Author

fertkir commented May 29, 2023

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

@zonyitoo
Copy link
Collaborator

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

@fertkir
Copy link
Contributor Author

fertkir commented Jun 14, 2023

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
6 checks passed
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.

None yet

2 participants