Jump to content

How to Migrate from .deb to Docker


Recommended Posts

plittlefield
Posted

Hello everyone,

Is this thread the correct place to ask about migrating from an Ubuntu deb based installation to a Docker based installation (on the same host and IP address) while keeping all the metadata, users and media files?

🙂

plittlefield
Posted

Thanks!

I will check that and report back!

  • Thanks 1
plittlefield
Posted (edited)

That document looks good. To be sure, I think I will perform a test migration using another computer I have.

I’m hoping to be able to use the existing metadata (and libraries ofcourse) on the old deb installation when doing volume mounts in the Docker container.

Edited by plittlefield
  • Thanks 1
Posted

Let us know how you get on. Thanks.

alucryd
Posted

@plittlefield While a backup is definitely recommended, you should indeed be able to just mount /var/lib/emby:/config in your container and be good to go. If you don't touch any of the docker variables the directory will be chown to the default user in our image, daemon, but if you want to be able to read your media files you should tweak UID, GID and GIDLIST to suit your needs, the chown will take care of the rest.

  • 2 weeks later...
plittlefield
Posted

So, in my docker-compose.yml file, I would put the following ...

    volumes:
      - /var/lib/emby:/config
      - /home/paully/Emby/TV:/mnt/share1
      - /home/paully/Emby/Movies:/mnt/share2

Just to check, is /mnt/share1 and /mnt/share2 the correct container directories?

Does it matter which order I put them?

Q-Droid
Posted

I think that to maintain continuity between your bare metal and container setup the library/media structure would need to be preserved. Otherwise the existing data/metadata becomes invalid and has to be rescanned - a time consuming prospect if the libraries are big. Since your media appears to share a common base "/home/paully/Emby" it could be enough to configure your media volume the same way in the container, unless you have more than TV and Movies that you don't want in the container libs.

volumes:

- /home/paully/Emby:/home/paully/Emby

This is what I would try but not something I have done...

plittlefield
Posted (edited)

Yes, this is exactly what I was asking ... I thought those (I guess examples?) looked wrong for me.

Yes, these are the only media Library folders I have ...

/home/paully/Emby/
|-- Movies
`-- TV

So, we end up with this in the docker-compose.yml file ...

    volumes:
      - /var/lib/emby:/config
      - /home/paully/Emby:/home/paully/Emby
      - /var/lib/emby/data/playlists:/var/lib/emby/data/playlists

I have added the 'playlists' volume but don't know if this correct?

I have attached a screenshot of my current setup.

Thanks for your help and I have to say I am very nervous about doing this but have to be bold I guess.

"Who dares, wins."

Paully

2022-06-15_09-26.png

Edited by plittlefield
Q-Droid
Posted

I don't know about the playlists since they already exist in the EMBY_DATA path and under /config in the container. Probably don't need to include that volume or any other "virtual" libs like collections.

You can make a backup of /var/lib/emby (cp -rp) before you try this. What happens in the container could be reversed and the media itself is not affected.

plittlefield
Posted (edited)

Thanks for clarifying the Collections library, I shall leave that line off.

volumes:
      - /var/lib/emby:/config
      - /home/paully/Emby:/home/paully/Emby

I’m a big fan of rsync so I’ll use that to backup /var/lib/emby - good idea.

I might try this tomorrow, so watch this space!

 

 

Edited by plittlefield
plittlefield
Posted (edited)

OK, so just to double check a few things before I go for it...

 

QUESTIONS

So, the current ownership of my Library folders (/home/paully/Emby) is paully:paully or 1000:1000

There is an Linux group called 'emby' on my Ubuntu system which is GID 998 and I am a member of this.

Is it better to recursively chown my Library to paully:emby before I start the Docker container?

Is it better to have owner as paully and group as emby, which would be paully:emby  or 1000:998 ?

If I have a Let's Encrypt SSL Certificate at /opt/emby-server/emby-mydomain-uk-com.pfx how do I integrate that in Dockerville?

 

PLAN

  1. Install and run the Backup Configuration plugin and grab the backup file.
  2. Shut down Emby server and disable current deb-based auto startup.
  3. Copy the entire /var/lib/emby directory using rsync to /var/lib/emby.backup
  4. Change the ownership of the Libary folders to paully:emby
  5. Check my docker-compose file
  6. docker-compose pull
  7. docker-compose up -d
  8. Keep my fingers crossed

This is my docker-compose.yml file...

version: "2.3"
services:
  emby:
    image: emby/embyserver
    container_name: emby
    network_mode: host
    environment:
      - UID=1000
      - GID=998
    volumes:
      - /var/lib/emby:/config
      - /home/paully/Emby:/home/paully/Emby
    ports:
      - 8096:8096
      - 8920:8920
    restart: unless-stopped

I like BELT AND BRACES people - is there anything I have missed?!

Thanks,

Paully

Edited by plittlefield
forgot about SSL certificate!
Q-Droid
Posted
1 hour ago, plittlefield said:

QUESTIONS

So, the current ownership of my Library folders (/home/paully/Emby) is paully:paully or 1000:1000

There is an Linux group called 'emby' on my Ubuntu system which is GID 998 and I am a member of this.

Is it better to recursively chown my Library to paully:emby before I start the Docker container?

Is it better to have owner as paully and group as emby, which would be paully:emby  or 1000:998 ?

It depends on how the server is running now, most likely emby:emby unless you've changed that. The container UID/GID could be emby:emby if you want to be consistent, but it doesn't have to be. Using emby:paully for the container is also an option and then you wouldn't have to tweak your library, at least not right away.

Take a look at this for future access and new media: https://support.emby.media/support/solutions/articles/44001962818-linux-unix-permissions

2 hours ago, plittlefield said:

If I have a Let's Encrypt SSL Certificate at /opt/emby-server/emby-mydomain-uk-com.pfx how do I integrate that in Dockerville?

What I would do: mkdir /var/lib/emby/ssl, then copy the pfx to that directory and when you start the Emby server in the container change the cert path in network settings to /config/ssl/emby-mydomain-uk-com.pfx. 

2 hours ago, plittlefield said:

PLAN

Looks good. Might not need to chown the media if you choose emby:paully for the compose UID/GID. And keep in mind that if your playlists don't come over then you might have to add that volume to the compose or recreate with new path. I don't know if that path is static or derived.

plittlefield
Posted

Hi @Q-Droid and thanks for the suggestions!

I think I will make the ownership of the Media Library folders paully:emby with read+write for that user and group.  So, this will make it UID=1000 and GID=998.  That way, I can keep adding movies and shows easily.  Is that sufficient for the Docker container to do what it needs to?

Yes, great idea on the the SSL Certificate file - I will drop it in to that new folder /var/lib/emby/ssl and change the cert path in the network settings when I log in on the non secure port 8096 inside my network.

I note your comment about the playlists ... can I leave that off and then wait to see if it finds in in the Docker version?

Q-Droid
Posted

I gather from your settings that you intend to run the Emby container as paully:emby (UID:1000, GID:998). In other words this is a deliberate choice. If so that is fine as long as you understand the Emby config, log files, metadata and other files created by the server will have paully:emby ownership. And also that you do not have to change ownership or permissions in your media structure since it's already owned by paully. If you're not sure who owns ALL of the files and directories in your media tree then it won't hurt to recursively change ownership to paully:emby and match the server config.

Yeah, leave playlists out for now to see what happens and deal with it later.

plittlefield
Posted

OK, I think I’m ready… nervous but ready 🙂

 I’ll follow my plan tomorrow and report back.

 Wish me luck.

plittlefield
Posted

🙂 cracking start ...

image.png.77d4cdf90da1b732e97566a02a9549be.png

 

This is my docker-compose.yml file ...

version: "2.3"
services:
  emby:
    image: emby/embyserver
    container_name: embyserver
    network_mode: host
    environment:
      - UID=998
      - GID=998
    volumes:
      - /var/lib/emby:/config
      - /home/paully/Emby:/home/paully/Emby
      - /mnt/ramdisk:/mnt/ramdisk
    ports:
      - 8096:8096
      - 8920:8920
    restart: unless-stopped

 

I copied the example compose file from here: https://hub.docker.com/r/emby/embyserver

It's probably me, what have I done wrong?

plittlefield
Posted

OK, I've fixed that with a Google search.

You cannot have network_mode_host AND ports in the same compose file.

The Docker container is now running BUT I do not have port 8920 running for SSL.

What do I need to do to get port 8920 running in the Docker container for SSL connections?

plittlefield
Posted

Here are some shots from the Docker version ...

image.png.701e684f04267cfbcfa862014dc66a78.png

 

and...

image.png.c5abaa11c4b91a80d33a725b7e2639f8.png

Is there a way to keep network_mode: host for performance but have port 8920 available and used???

Paully

 

plittlefield
Posted

OK, my bad... fixed the SSL issue as well.

I'd put /var/lib/emby/ssl/ in the web gui instead of /config/ssl/

I should have done this later in the day and on more coffee.

The Libaries are all there, the Users are all there, my progress is all there, so ...

... all good so far!

A huge thanks to all who helped and this is now making my server upgrade a lot easier.

🙂

I'll watch a few things tonight and report back for a final verdict.

Regards,

Paully

 

  • Like 1
Locutus64
Posted
On 6/4/2022 at 10:13 AM, plittlefield said:

Hello everyone,

Is this thread the correct place to ask about migrating from an Ubuntu deb based installation to a Docker based installation (on the same host and IP address) while keeping all the metadata, users and media files?

🙂

If you're staying with Ubuntu then why switch to a Docker install for Emby? It's truly a unnecessary and useless additional layer for any Linux OS.

plittlefield
Posted
35 minutes ago, Locutus64 said:

If you're staying with Ubuntu then why switch to a Docker install for Emby? It's truly a unnecessary and useless additional layer for any Linux OS.

I am about to change my server disks and all my other server software is in Docker containers.  I will eventually move the /var/lib/emby folder on the host to a subfolder of the Emby docker-compose folder and then it's just an easy case of backup and then restore to my new disks with new OS and bigger Library space.  I will probably use Ubuntu Server again 'underneath' Docker but could use Alpine or something else as lightweight.  At the end of the day, it's a convenient way to keep software in one place and change easily. 

Q-Droid
Posted

Well done.

The Emby compose template is an example and does have conflicting options though it includes comments to document them. Bridged network mode is fine for most cases.

plittlefield
Posted

Well, good news - last night's viewings from Emby in Docker went perfectly with no complaints from outside users either.

Just one little error ...

Configuration Backup failed: backup directory not found

... so I must presume I have to change my Plugins > Emby Backup location which is currently ...

/home/paully/Downloads/emby/backup

I created a folder for backup under my /var/lib/emby and then changed the web gui plugin settings to ...

/config/backup

I will report back tomorrow to confirm this worked.

  • Thanks 1
plittlefield
Posted

Yes, that backup worked, so I believe we are all good and this topic can be marked as solved 🙂

  • Thanks 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...