# How to setup a small test environment?

**URL:** https://forum.syncthing.net/t/how-to-setup-a-small-test-environment/272
**Category:** Development
**Created:** [May 26, 2014, 8:38am UTC](https://forum.syncthing.net/t/how-to-setup-a-small-test-environment/272 "2014-05-26T08:38:59Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jedie](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.syncthing.net/u/jedie)
#### Post date: [May 26, 2014, 8:38am UTC](https://forum.syncthing.net/t/how-to-setup-a-small-test-environment/272/1 "2014-05-26T08:38:59Z")

</div>

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?!?

---

<div class="post-metadata">

### Author: ![jedie](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.syncthing.net/u/jedie)
#### Post date: [May 26, 2014, 8:40am UTC](https://forum.syncthing.net/t/how-to-setup-a-small-test-environment/272/2 "2014-05-26T08:40:34Z")

</div>

Maybe use “-home” to use different **.config** directories?

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [May 26, 2014, 8:41am UTC](https://forum.syncthing.net/t/how-to-setup-a-small-test-environment/272/3 "2014-05-26T08:41:34Z")

</div>

There’s a script, which is fairly involved, that does this, in [https://github.com/calmh/syncthing/blob/master/integration/test.sh](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.

---

<div class="post-metadata">

### Author: ![jedie](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.syncthing.net/u/jedie)
#### Post date: [May 26, 2014, 9:04am UTC](https://forum.syncthing.net/t/how-to-setup-a-small-test-environment/272/4 "2014-05-26T09:04:16Z")

</div>

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: ![](https://forum.syncthing.net/uploads/default/34/e85f90451da4fc59.jpg)

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>

```

---

<div class="post-metadata">

### Author: ![jedie](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.syncthing.net/u/jedie)
#### Post date: [May 26, 2014, 9:14am UTC](https://forum.syncthing.net/t/how-to-setup-a-small-test-environment/272/5 "2014-05-26T09:14:47Z")

</div>

I update configs…

It works fine!

The error from [https://github.com/calmh/syncthing/issues/284](https://github.com/calmh/syncthing/issues/284) didn’t happen.

---

<div class="post-metadata">

### Author: ![jedie](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.syncthing.net/u/jedie)
#### Post date: [May 26, 2014, 12:41pm UTC](https://forum.syncthing.net/t/how-to-setup-a-small-test-environment/272/6 "2014-05-26T12:41:21Z")

</div>

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](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 😉

---

<div class="post-metadata">

### Author: ![jedie](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/j/b5a626/32.png) [@jedie](https://forum.syncthing.net/u/jedie)
#### Post date: [May 28, 2014, 9:23pm UTC](https://forum.syncthing.net/t/how-to-setup-a-small-test-environment/272/7 "2014-05-28T21:23:52Z")

</div>

I have created [https://github.com/jedie/syncthing/wiki/Test-Syncthing](https://github.com/jedie/syncthing/wiki/Test-Syncthing) for this.

EDIT: New topic here -\> [How to create Syncthing test environments](https://forum.syncthing.net/t/how-to-create-syncthing-test-environemnts/406)

---

<div class="post-metadata">

### Author: ![system](https://forum-uploads.syncthingcdn.net/original/2X/0/0b50e0a202b22ae6a67190759e8c868805b8ed9f.png) [@system](https://forum.syncthing.net/u/system)
#### Post date: [May 12, 2017, 1:17pm UTC](https://forum.syncthing.net/t/how-to-setup-a-small-test-environment/272/8 "2017-05-12T13:17:04Z")

</div>


