Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

SOLVED HOWTO Resilio(btsync) iocage setup

Prasanth

Member
Joined
Mar 2, 2014
Messages
100
As I convert over my plugins, I'm looking to see if anyone has cli instructions for installing resilio sync(btsync) with iocage
I've tried to piece together some instructions myself but I don't really know what I'm doing and the jail crashed and burned. I think a lot of the errors have come up because of the change of name from btsync to rslsync.


# make temp file that will cause iocage to install some packages
echo '{"pkgs":["ca_root_nss"]}' > /tmp/pkg.json
# create jail
iocage create -n "btsync" -p /tmp/pkg.json -r 11.1-RELEASE ip4_addr="vnet0|[btsync IP]/24" defaultrouter="[router ip]" vnet="on" allow_raw_sockets="1" boot="on"
# remove the temp file
rm /tmp/pkg.json
# map config and data storage outside of jail
iocage fstab -a btsync /mnt/[zpool]/[data directory on server] /mnt/btsyncdata nullfs rw 0 0
iocage fstab -a btsync /mnt/[zpool]/[config directory on server] /config nullfs rw 0 0
# link python
iocage exec btsync ln -s /usr/local/bin/python2.7 /usr/bin/python
iocage exec btsync ln -s /usr/local/bin/python2.7 /usr/bin/python2
# download and unpack resilio from website
iocage exec btsync mkdir /usr/local/btsync
iocage exec btsync "fetch https://download-cdn.resilio.com/stable/FreeBSD-x64/resilio-sync_freebsd_x64.tar.gz -o /usr/local/btsync/"
iocage exec btsync "tar -xzvf /usr/local/btsync/resilio-sync_freebsd_x64.tar.gz -C /usr/local/btsync/"
iocage exec btsync rm /usr/local/btsync/resilio-sync_freebsd_x64.tar.gz
# add btsync user using pid:uid used by btsync in the past
iocage exec btsync "pw user add btsync -c btsync -u 817 -d /nonexistent -s /usr/bin/nologin"
# change ownership of config and data directories
iocage exec btsync chown -R btsync:btsync /mnt/btsyncdata /config
# Link the btsync config file to one from config directory outside of jail
iocage exec btsync ln -s /config/btsync.conf /usr/local/etc/btsync.conf
# create the run command directory and file
iocage exec btsync mkdir /usr/local/etc/rc.d


ee /mnt/iocage/jails/btsync/root/usr/local/etc/rc.d/rslsync
#!/bin/sh
#
# PROVIDE: btsync
# REQUIRE: LOGIN DAEMON NETWORKING
# KEYWORD: shutdown
#
# To enable BTSync, add this line to your /etc/rc.conf:
#
# btsync_enable="YES"
#
# And optionally these line:
#
# btsync_user="username" # Default is "root"
# btsync_bin="/path/to/btsync" # Default is "/usr/local/sbin/btsync"

. /etc/rc.subr

name="btsync"
rcvar="btsync_enable"

load_rc_config $name

required_files=$btsync_bin

: ${btsync_enable="NO"}
: ${btsync_user="btsync"}
: ${btsync_bin="/usr/local/sbin/btsync"}
: ${btsync_config="/usr/local/btsync/btsync.conf"}

command=$btsync_bin
command_args="--config ${btsync_config}"
run_rc_command "$1"

#move the executable from btsync to sbin
iocage exec btsync mv /usr/local/btsync/rslsync /usr/local/sbin/
# make the run command file executable
iocage exec btsync chmod u+x /usr/local/etc/rc.d/rslsync
#enable start up of btsync and start
iocage exec btsync sysrc "btsync_enable=YES"
iocage exec btsync service btsync start

 

Prasanth

Member
Joined
Mar 2, 2014
Messages
100
Anyone get this working?
 

Prasanth

Member
Joined
Mar 2, 2014
Messages
100
  • OK no one else using resilio?
working on the problem and I think I have everything in the install working, but still can't access the webui
Here's what I'm doing

Initial setup

# make temp file that will cause iocage to install some packages
echo '{"pkgs":["ca_root_nss"]}' > /tmp/pkg.json
# create jail
iocage create -n "rslsync" -p /tmp/pkg.json -r 11.1-RELEASE ip4_addr="vnet0|yourip/24" defaultrouter="routerip" vnet="on" allow_raw_sockets="1" boot="on"
# remove the temp file
rm /tmp/pkg.json


Data directory config

# map config and data storage outside of jail
iocage fstab -a rslsync /mnt/syncdatadirectory /mnt/syncdata nullfs rw 0 0
iocage fstab -a rslsync /mnt/syncconfigdirectory /config nullfs rw 0 0
# link python
iocage exec rslsync ln -s /usr/local/bin/python2.7 /usr/bin/python
iocage exec rslsync ln -s /usr/local/bin/python2.7 /usr/bin/python2


actual install of resilio

# download and unpack resilio from website
iocage exec rslsync mkdir /usr/local/rslsync
iocage exec rslsync "fetch https://download-cdn.resilio.com/stable/FreeBSD-x64/resilio-sync_freebsd_x64.tar.gz -o /usr/local/rslsync/"
iocage exec rslsync "tar -xzvf /usr/local/rslsync/resilio-sync_freebsd_x64.tar.gz -C /usr/local/rslsync/"
iocage exec rslsync rm /usr/local/rslsync/resilio-sync_freebsd_x64.tar.gz


user and directory setup

# add rslsync user using pid:uid used by rslsync in the past
iocage exec rslsync "pw user add rslsync -c rslsync -u 817 -d /nonexistent -s /usr/bin/nologin"
# change ownership of config and data directories
iocage exec rslsync chown -R rslsync:rslsync /mnt/syncdata /config
# Link the rslsync config file to one from config directory outside of jail
##if using an old btsync install in your config dir copy the old config to new one
#iocage exec rslsync cp -s /config/btsync.conf /config/sync.conf
iocage exec rslsync ln -s /config/sync.conf /usr/local/etc/sync.conf
# create the run command directory and file
iocage exec rslsync mkdir /usr/local/etc/rc.d
iocage exec rslsync "ee /usr/local/etc/rc.d/rslsync"


Put the following into the rc.d file

#!/bin/sh
#
# PROVIDE: resilio
# REQUIRE: LOGIN DAEMON NETWORKING
# KEYWORD: shutdown
#
# To enable Resilio, add this line to your /etc/rc.conf:
#
# resilio_enable="YES"
#
# And optionally these line:
#
# resilio_user="username" # Default is "root"
# resilio_bin="/path/to/resilio" # Default is "/usr/local/share/rslsync"

. /etc/rc.subr

name="rslsync"
rcvar="resilio_enable"

load_rc_config $name

required_files=$resilio_bin

: ${resilio_enable="NO"}
: ${resilio_user="rslsync"}
: ${resilio_bin="/usr/local/sbin/rslsync"}

command=$resilio_bin

run_rc_command "$1"


use esc to get out of the editor and exit+save by pressing 'a' twice

finalizing setup and startup

#move the executable from rslsync to sbin
iocage exec rslsync mv /usr/local/rslsync/rslsync /usr/local/sbin/
# make the run command file executable
iocage exec rslsync chmod u+x /usr/local/etc/rc.d/rslsync
#enable start up of rslsync and start
iocage exec rslsync sysrc "resilio_enable="YES""
iocage exec rslsync service rslsync start


to get around vnet errors
iocage exec rslsync 'sysrc ifconfig_epair0_name="epair0b"'
 

Areasi

Newbie
Joined
Dec 19, 2017
Messages
2
Hello Prasanth,

I had to make a couple modifications to get the webUI up.

First, for me it was a fresh install, so I had to actually create the sync.conf file. It contained the following:
Code:
{
	"webui": {
		"ssl_certificate": "",
		"force_https": false,
		"ssl_private_key": "",
		"listen": "0.0.0.0:8888"
	},
	"storage_path": "/config"
}


Also, I had to make a modifications to your rc file.
Under command, I added the following line:

command_args="--config /config/sync.conf"

As soon as I restarted the service, I was able to browse to <IP>:8888/gui
 

Prasanth

Member
Joined
Mar 2, 2014
Messages
100
Hello Prasanth,

I had to make a couple modifications to get the webUI up.

First, for me it was a fresh install, so I had to actually create the sync.conf file. It contained the following:
Code:
{
	"webui": {
		"ssl_certificate": "",
		"force_https": false,
		"ssl_private_key": "",
		"listen": "0.0.0.0:8888"
	},
	"storage_path": "/config"
}


Also, I had to make a modifications to your rc file.
Under command, I added the following line:

command_args="--config /config/sync.conf"

As soon as I restarted the service, I was able to browse to <IP>:8888/gui
Thanks Areasi. Since you chose storage path =/config were you still able to access other locations on the disk within resilio to use as storage directories?

edited for clarity
 
Last edited:

Areasi

Newbie
Joined
Dec 19, 2017
Messages
2
Hello Prasanth,
Yes, I had no issues with pointing connections to other locations on the jail, including my storage mount.

One other modification I made was a slight change to the settings in your RC file, although this was more regarding the user account in use, and not the web gui itself.

: ${resilio_enable="NO"}
: ${resilio_user="rslsync"}
: ${resilio_bin="/usr/local/sbin/rslsync"}

These should have a colon in front of the equal sign on each line := When I had it with just an equal sign, the app was using the root user instead of what was specified.
 

Prasanth

Member
Joined
Mar 2, 2014
Messages
100
Perfect everything running now. I deleted my old config file and copied the one you created. I will put this together and save as a resource for others. Thanks again for the help!
 

diedrichg

Neophyte Sage
Joined
Dec 4, 2012
Messages
1,299
Perfect everything running now. I deleted my old config file and copied the one you created. I will put this together and save as a resource for others. Thanks again for the help!
Is your original post complete/correct now?
 

Astrodonkey

Member
Joined
Jul 18, 2017
Messages
52
Hey man, just wanted to say thanks for this. Worked flawlessly the first time. Nice work!
 

molotov_kazic

Neophyte
Joined
Jun 22, 2017
Messages
8
@Prasanth,

Thanks for your write up on this. I've recently migrated to 11.2 and have noticed that there is something wrong with this config regarding max file sizes over 4GB.

Getting the following in the resilio logs:
Code:
is not written to disk: size limit exceeded


However when I've tested the resilio plugin using the same 4GB test file it's able to sync with no issues. I'm wondering if there's an issue with how the jail is created and thinking that it's using a file system that doesn't allow files larger than 4GB?

Any help in the right direction is much appreciated.

MK
 

paredaks

Neophyte
Joined
Apr 29, 2016
Messages
7
@Prasanth,

Thanks for your write up on this. I've recently migrated to 11.2 and have noticed that there is something wrong with this config regarding max file sizes over 4GB.

(snip)

MK
@molotov_kazic -

Any luck on this? Just installed myself using instructions above without issue except that which you mention above, large files failing. On fresh install of 11.2-U3. Pool was previously assigned to 11.1 install successfully running resilio in jail. No changes to dataset other than creating mount point into new iocage jail.
 
Last edited:

Bearmangler

Newbie
Joined
May 22, 2018
Messages
2
@molotov_kazic -

Any luck on this? Just installed myself using instructions above without issue except that which you mention above, large files failing. On fresh install of 11.2-U3. Pool was previously assigned to 11.1 install successfully running resilio in jail. No changes to dataset other than creating mount point into new iocage jail.
I'm also having this issue, it appears files larger than 4GB won't sync due to "size limit exceeded".
 

colinsullivan

Newbie
Joined
May 11, 2019
Messages
1
Hi!

Yup, resilio reports similar messages for me too:

Code:
Error opening "/.../.sync/C63...24.!sync": file is too large 8628574347


Should this be a new thread? Seems the OP issue is different and this thread is marked as "solved".
 
Top