Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 831735 - net-p2p/syncthing: make openrc service ready for multiple instances
Summary: net-p2p/syncthing: make openrc service ready for multiple instances
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement
Assignee: Marek Szuba (RETIRED)
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2022-01-21 14:02 UTC by Till Schäfer
Modified: 2022-01-27 14:15 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
modified syncthing init script (syncthing,1.25 KB, text/plain)
2022-01-21 14:03 UTC, Till Schäfer
Details
modified syncthing config file (syncthing.conf,621 bytes, text/plain)
2022-01-21 14:05 UTC, Till Schäfer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Till Schäfer 2022-01-21 14:02:39 UTC
I usually run syncthing on a per user basis. Thus, multiple instances are running at the same time. This is currently not supported by the provided init script, since it uses a rc-name independent fixed pidfile (/run/syncthing.pid).

Thus is propose the following change to the init script (see attached file) in order to allow multiple instances by symlinking the init script (e.g., /etc/init.d/syncthing -> /etc/init.d/syncthing.username) and providing a matching conf.d file (in the above example /etc/conf.d/syncthing.username):

-> Use the following pidfile in the init script. This is backward compatible, i.e., everyting works with the original init script as it was. 
pidfile="/run/${RC_SVCNAME}.pid"


Furthermore, multiple instances usually collide using the same gui port, thus one can add "--gui-address=127.0.0.1:PORT" to SYNCTHING_OPTS in the conf file. Since this is not very convenient, I propose to add an extra option to the conf file:
 
SYNCTHING_GUI_ADDRESS

Of course this should default to the previous one by adding 

SYNCTHING_GUI_ADDRESS=${SYNCTHING_GUI_ADDRESS:-127.0.0.1:8384}

to the init stript and use it explicitly in the command opts

command_args="-no-browser -home=${SYNCTHING_HOMEDIR} -gui-address=${SYNCTHING_GUI_ADDRESS} ${SYNCTHING_OPTS}"


Reproducible: Always
Comment 1 Till Schäfer 2022-01-21 14:03:16 UTC
Created attachment 763003 [details]
modified syncthing init script
Comment 2 Till Schäfer 2022-01-21 14:05:42 UTC
Created attachment 763004 [details]
modified syncthing config file
Comment 3 Marek Szuba (RETIRED) archtester gentoo-dev 2022-01-27 14:11:39 UTC
LGTM, thanks!
Comment 4 Larry the Git Cow gentoo-dev 2022-01-27 14:15:35 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a121cdb69c3887a83315cb88dbb285712176a779

commit a121cdb69c3887a83315cb88dbb285712176a779
Author:     Marek Szuba <marecki@gentoo.org>
AuthorDate: 2022-01-27 14:11:01 +0000
Commit:     Marek Szuba <marecki@gentoo.org>
CommitDate: 2022-01-27 14:15:28 +0000

    net-p2p/syncthing: make syncthing OpenRC service ready for multiple instances
    
    Thanks-to: Till Schäfer <till2.schaefer@uni-dortmund.de>
    Closes: https://bugs.gentoo.org/831735
    Signed-off-by: Marek Szuba <marecki@gentoo.org>

 net-p2p/syncthing/files/syncthing.confd            |  4 +++
 net-p2p/syncthing/files/syncthing.initd-r2         | 33 ++++++++++++++++++++++
 ...ng-1.18.6.ebuild => syncthing-1.18.6-r1.ebuild} |  2 +-
 3 files changed, 38 insertions(+), 1 deletion(-)