Bloc notes | Mémo resilio (btsync)


Posted on December 26, 2018 by Alex comments [resilio zfs nixos]

Single user

# after zfs set acltype=posixacl zroot/.... if zfs
sudo setfacl -m "u:alex:rwX" /var/lib/resilio-sync/

/etc/nixos/configuration.nix

systemd.services.resilio.serviceConfig.User = lib.mkOverride 10 "alex";

Other

ZFS

zfs set acltype=posixacl zroot/root/home # permet de faire des setfacl -m u:rslsync:x /home/alex/

setfacl

setfacl -m -R u:rslsync:rwX /home/alex/sync # sur un rep (-R avec x que pour les dir)
setfacl -m -R u:rslsync:rw /home/alex/sync.txt # sur un file

exemple container nixos

/etc/nixos/configuration.nix

[...]
  imports =                                 
    [                                                                                                        
      ./hardware-configuration.nix
      ./nginx.nix                   
      ./containers/vod.nix       
      ./containers/cam88.nix                          
      ./containers/matomo.nix                                                                                
      ./containers/nextcloud.nix  
      ./containers/resilio.nix                                                                               
      ./containers/gitlab.nix
    ]; 
[...]

/etc/nixos/containers/resilo.nix

{ pkgs, config, ... }:

with pkgs;

{
  containers.resilio = {

    autoStart = true;
    privateNetwork = true;
    hostAddress = "10.10.16.1";
    localAddress = "10.10.16.2";

    bindMounts."/resilio" = {
      hostPath = "/resilio/alex";
      isReadOnly = false;
    };

    bindMounts."/www" = {
      hostPath = "/zroot/www";
      isReadOnly = false;
    };

    config = { config, pkgs, ... }: {

      nixpkgs.config.allowUnfree = true;
      networking.hostName = "sync1";
      networking.firewall.allowedTCPPorts = [ 9000 ];

      services.resilio.enable = true;
      services.resilio.enableWebUI = true;
      services.resilio.storagePath = "/resilio";

    };
  };
}