Skip to content

Instantly share code, notes, and snippets.

@Iristyle
Last active February 28, 2019 21:56
Show Gist options
  • Save Iristyle/0de6b9f7e8534366a28f2768eb94aa21 to your computer and use it in GitHub Desktop.
Save Iristyle/0de6b9f7e8534366a28f2768eb94aa21 to your computer and use it in GitHub Desktop.
Migrating Emby from Diskstation package to Docker Container

There are some docs in Emby about a couple of approaches at https://github.com/MediaBrowser/Wiki/wiki/Backup

However, you can also do things the hard way! (Some info at https://emby.media/community/index.php?/topic/60079-relocate-media-library-metadata/)

  • Update the optional path in Emby itself from \\serverfoo\path\to\files to \\serverbar\path\to\files to make sure native paths still work in Emby

Use a tool like SQLite Web container at https://hub.docker.com/r/coleifer/sqlite-web/ to mount library.db and run a query like

UPDATE "TypedBaseItems" 
SET Path = replace(Path, '/var/packages/EmbyServer/target/var', '/config') 
WHERE Path is not null 
  AND PATH LIKE '%/var/packages/EmbyServer/target/var/%'

Launching Transmisssion

  • Requires a TUN script to be setup (and run as a task every 5 minutes)
#!/bin/sh

# Create the necessary file structure for /dev/net/tun
if ( [ ! -c /dev/net/tun ] ); then
  if ( [ ! -d /dev/net ] ); then
    mkdir -m 755 /dev/net
  fi
  mknod /dev/net/tun c 10 200
  chmod 0755 /dev/net/tun
fi

# Load the tun module if not already loaded
if ( !(lsmod | grep -q "^tun\s") ); then
  insmod /lib/modules/tun.ko
fi
  • Requires the root@Molokai:/volume1/docker/transmissiondata# ./docker-run.sh command to be run that consists of:
#!/bin/sh

docker run \
  --cap-add=NET_ADMIN \
  --device=/dev/net/tun \
  -d \
  -v /volume1/docker/transmissiondata/resolv.conf:/etc/resolv.conf \
  -v /volume1/docker/transmissiondata/AirVPN_America_UDP-443.ovpn:/etc/openvpn/custom/default.ovpn \
  -v /volume1/Media/Downloads/Transmission:/volume1/Media/Downloads/Transmission \
  --env-file /volume1/docker/transmissiondata/DockerEnv \
  -p 8888:8888 \
  -p 9091:9091 \
  --sysctl net.ipv6.conf.all.disable_ipv6=0 \
  --name "transmission-openvpn-syno" \
  haugene/transmission-openvpn:latest

Keep in mind there is a DockerEnv file at /volume1/docker/transmissiondata/DockerEnv based on https://github.com/haugene/docker-transmission-openvpn/blob/master/DockerEnv

Enumerate with synouser --enum all:

admin
calibre-web
embysvr
guest
jackett
kodi
lazylibrarian
nzbhydra
Parity
radarr
sabnzbd
sonarr
transmission

Create users

synouser --add "calibre-web" "" "Calibre Web" 0 "" 0
synouser --add "embysvr" "" "Emby Server" 0 "" 0
synouser --add "jackett" "" "Jackett" 0 "" 0
synouser --add "lazylibrarian" "" "Lazy Librarian" 0 "" 0
synouser --add "nzbhydra" "" "nzbHydra2" 0 "" 0
synouser --add "radarr" "" "Radarr" 0 "" 0
synouser --add "sabnzbd" "" "Sabnzbd+" 0 "" 0
synouser --add "sonarr" "" "Sonarr" 0 "" 0
synouser --add "transmission" "" "Transmission" 0 "" 0

Or synogroup --enum all

administrators
download
http
media
users

Create groups

synogroup --add download lazylibrarian nzbhydra radarr sonarr transmission sabnzbd jackett
synogroup --add media embysvr lazylibrarian radarr sonarr calibre-web
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment