jedie
(jedie)
May 26, 2014, 8:38am
1
Sometimes is will be good, to have a small test instance. Only one repro with only a handfull of files.
How to setup this?
e.g.: It is possible to run more than one instance on the same machine and sync “via” localhost?
Run one instance, chnage the ports and start another instance and change the ports?!?
jedie
(jedie)
May 26, 2014, 8:40am
2
Maybe use “-home” to use different .config directories?
calmh
(Jakob Borg)
May 26, 2014, 8:41am
3
There’s a script, which is fairly involved, that does this, in https://github.com/calmh/syncthing/blob/master/integration/test.sh . The basics is to just start multiple instances with separate listening ports and hard code the node address/port since local discovery doesn’t work within the same host.
jedie
(jedie)
May 26, 2014, 9:04am
4
Hm, didn’t see how it helps.
I’m working on something like this:
Startup file 01:
#!/bin/bash
BASE_DIR=$(pwd)/instance01/
SYNCTHING_BIN=/home/syncthing/bin/syncthing
(
set -x
${SYNCTHING_BIN} -version
HOME=${BASE_DIR}
${SYNCTHING_BIN} -home=${BASE_DIR}\syncthing_configs
)
and startup file 02:
#!/bin/bash
BASE_DIR=$(pwd)/instance02/
SYNCTHING_BIN=/home/syncthing/bin/syncthing
(
set -x
${SYNCTHING_BIN} -version
HOME=${BASE_DIR}
${SYNCTHING_BIN} -home=${BASE_DIR}\syncthing_configs
)
Only the BASE_DIR is changed.
Start first skript and change ports. Start second script and change ports.
Will result in something like this:
The configs looks like this:
config from instance01:
<configuration version="2">
<repository id="default" directory="/home/jens/syncthing_test/instance01/Sync" ro="false" ignorePerms="false">
<node id="DB4B7IURXQSOXYPIRGHANDTUAJFRWIG7U5SMV3UYALVSLLPCPHNA"></node>
<node id="HN7FVKI4NQNYFPXY2MBDJUCOKOVD3KSTIRVPM25MWP2UISYNP6WA"></node>
<versioning type="simple">
<param key="keep" val="5"></param>
</versioning>
</repository>
<node id="DB4B7IURXQSOXYPIRGHANDTUAJFRWIG7U5SMV3UYALVSLLPCPHNA" name="instance01">
<address>127.0.0.1:22001</address>
</node>
<node id="HN7FVKI4NQNYFPXY2MBDJUCOKOVD3KSTIRVPM25MWP2UISYNP6WA" name="instance02">
<address>127.0.0.1:22002</address>
</node>
<gui enabled="true" tls="false">
<address>127.0.0.1:8001</address>
</gui>
<options>
<listenAddress>127.0.0.1:22001</listenAddress>
<globalAnnounceServer>announce.syncthing.net:22025</globalAnnounceServer>
<globalAnnounceEnabled>false</globalAnnounceEnabled>
<localAnnounceEnabled>false</localAnnounceEnabled>
<localAnnouncePort>21026</localAnnouncePort>
<parallelRequests>16</parallelRequests>
<maxSendKbps>0</maxSendKbps>
<rescanIntervalS>3</rescanIntervalS>
<reconnectionIntervalS>60</reconnectionIntervalS>
<maxChangeKbps>10000</maxChangeKbps>
<startBrowser>true</startBrowser>
<upnpEnabled>false</upnpEnabled>
</options>
</configuration>
config from instance02:
<configuration version="2">
<repository id="default" directory="/home/jens/syncthing_test/instance02/Sync" ro="false" ignorePerms="false">
<node id="HN7FVKI4NQNYFPXY2MBDJUCOKOVD3KSTIRVPM25MWP2UISYNP6WA"></node>
<node id="DB4B7IURXQSOXYPIRGHANDTUAJFRWIG7U5SMV3UYALVSLLPCPHNA"></node>
<versioning type="simple">
<param key="keep" val="5"></param>
</versioning>
</repository>
<node id="DB4B7IURXQSOXYPIRGHANDTUAJFRWIG7U5SMV3UYALVSLLPCPHNA" name="instance01">
<address>127.0.0.1:22001</address>
</node>
<node id="HN7FVKI4NQNYFPXY2MBDJUCOKOVD3KSTIRVPM25MWP2UISYNP6WA" name="instance02">
<address>127.0.0.1:22002</address>
</node>
<gui enabled="true" tls="false">
<address>127.0.0.1:8002</address>
</gui>
<options>
<listenAddress>127.0.0.1:22002</listenAddress>
<globalAnnounceServer>announce.syncthing.net:22025</globalAnnounceServer>
<globalAnnounceEnabled>false</globalAnnounceEnabled>
<localAnnounceEnabled>false</localAnnounceEnabled>
<localAnnouncePort>21027</localAnnouncePort>
<parallelRequests>16</parallelRequests>
<maxSendKbps>0</maxSendKbps>
<rescanIntervalS>3</rescanIntervalS>
<reconnectionIntervalS>60</reconnectionIntervalS>
<maxChangeKbps>10000</maxChangeKbps>
<startBrowser>true</startBrowser>
<upnpEnabled>false</upnpEnabled>
</options>
</configuration>
jedie
(jedie)
May 26, 2014, 9:14am
5
I update configs…
It works fine!
The error from https://github.com/calmh/syncthing/issues/284 didn’t happen.
jedie
(jedie)
May 26, 2014, 12:41pm
6
set a other HOME= under linux for testing, is IMHO a good solution.
I would like to do the same under windows. I looked into https://github.com/calmh/syncthing/blob/master/cmd/syncthing/main.go and see some environment variables that are used under windows.
So i created a batch start file for this:
@title syncthing test
set HOMEDRIVE=D:
set HOMEPATH=\synthing_test
set USERPROFILE=%HOMEDRIVE%%HOMEPATH%
set APPDATA=%USERPROFILE%\Roaming
set LOCALAPPDATA=%USERPROFILE%\Local
syncthing.exe
@pause
What i didn’t find out, how the computer name are get trou. I tried this:
set COMPUTERNAME=%USERDOMAIN%_test
set USERDOMAIN_ROAMINGPROFILE=%USERDOMAIN%_test
set USERDOMAIN=%USERDOMAIN%_test
Doesn’t work. But ok, i start it one time and change the config.
So now i can setup a “test” network on linux and windows, independently from productive usage
jedie
(jedie)
May 28, 2014, 9:23pm
7