/Emby.Build

Primary LanguageShellMIT LicenseMIT

Emby-Server

Alt text

Introduction:

Emby Server is a home media server built on top of other popular open source technologies such as Service Stack, jQuery, jQuery mobile, and Mono.

It features a REST-based API with built-in documention to facilitate client development. We also have client libraries for our API to enable rapid development.

This subfolder contains all necessary files to build a Docker image for embyserver.

Supported Tags:

Image - emby/embyserver

  • latest - latest stable release
  • x86_64 - latest stable release for x86_64
  • armv7 - latest stable release for armv7 or armhf
  • aarch64 - latest stable release for armv8 or aarch64
  • x86_64_${VERSION} - $VERSION stable release for x86_64
  • armv7_${VERSION} - $VERSION stable release for armv7 or armhf
  • aarch64_${VERSION} - $VERSION stable release for armv8 or aarch64

Image - emby/embyserver_beta

  • latest - latest beta release
  • x86_64 - latest beta release for x86_64
  • armv7 - latest beta release for armv7 or armhf
  • aarch64 - latest beta release for armv8 or aarch64
  • x86_64_${VERSION} - $VERSION beta release for x86_64
  • armv7_${VERSION} - $VERSION beta release for armv7 or armhf
  • aarch64_${VERSION} - $VERSION beta release for armv8 or aarch64

Contributing:

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Issues:

Before reporting your issue please try updating Docker to the latest version and check if it resolves the issue. Refer to the Docker installation guide for instructions.

SELinux users should try disabling SELinux using the command setenforce 0 to see if it resolves the issue.

If the above recommendations do not help then report your issue along with the following information:

  • Output of the docker version and docker info commands
  • The docker run command or docker-compose.yml used to start the image. Mask out the sensitive bits.
  • Please state if you are using Boot2Docker, VirtualBox, etc.

Getting started:

Installation:

Docker Hub:

It is recommended you install directly from the Docker Hub.

The installation process and scripts are very versatile and can be adjusted by passing the right combination of variables and arguments to each of the commands.

The following examples should cover most scenarios, in each, a wrapper script will be installed on the host that should ease creation and management of the containerized application. When executing the script it will create a container named embyserver. Additionally, the script will ensure that this container gets setup with the appropriate environment variables and volumes each time it is executed.

Installation as current user:

Start the installation by issuing the following command from within a terminal:

docker run -it --rm -v /usr/local/bin:/target \
    emby/embyserver instl

Optionally, you can also install a systemd service file by executing:

docker run -it --rm -v /etc/systemd/system:/target  \
    emby/embyserver instl service

To enable the systemd service for embyserver execute the following:

sudo systemctl enable embyserver@${USERNAME}

Installation as other user:

In the following instructions adjust each command replacing username with the name of the user you wish to install and run the container as.

To install the application execute and, again, adjust the command replacing username accordingly.

docker run -it --rm -v /usr/local/bin:/target \
    -e "APP_USER=username" \
    emby/embyserver instl

Note, if the user is a system account, the command will need further adjustment. This is because by default the script stores settings and configuration in a hidden folder within the executing user's home directory. This can be overridden by passing the appropriate environment variable (APP_CONFIG) to the instl script, such as in the example below:

docker run -it --rm -v /usr/local/bin:/target \
    -e "APP_USER=username" \
    -e "APP_CONFIG=/var/lib/embyserver" \
    emby/embyserver instl

Optionally, proceed to installing the systemd service:

docker run -it --rm -v /etc/systemd/system:/target \
   emby/embyserver instl service

Additionally, you can enable the service on boot by executing:

sudo systemctl enable embyserver@username.service

GitHub:

Installation from GitHub is recommended only for the purposes of troubleshooting and development. To install from GitHub execute the following:

git clone https://github.com/MediaBrowser/Emby.Build
cd docker-containers/stable
make instl

Additionally, you can install the systemd service file after executing the above by issuing the following:

make service

Initial Configuration:

Once the embyserver wrapper script for docker has been installed you just need to execute the wrapper script from within a terminal:

emby-server

On the first run the wrapper script will prompt for system paths that you wish made accessible from within the container. Enter one path per line.

Adding more volumes after first run:

Volumes which should be mounted within the container at runtime are kept in the volume configuration file found under the APP_CONFIG folder on the host. The location will vary depending on the type of installation.

If the wrapper script was installed as the executing user the volume configuration file can be found at: ${HOME}/.embyserver/.embyserver.volumes Otherwise at: ${APP_CONFIG}/.embyserver.volumes

Maintenance:

Upgrading:

You can upgrade the version of embyserver found within the container by executing one of the following commands:

emby-server update

Or by executing:

docker exec emby-server update

You can update the container itself by executing:

docker pull emby/embyserver
docker stop emby-server
emby-server

If you wish the docker container to automatically update upon creation, set the environment variable EDGE to 1. Please read the Technical Details section for the various ways this can be achieved.

Automatic Upgrades:

In order to have the container periodically check and upgrade the embyserver binary one needs to add a crontab entry. Like so, please keep in mind the command might need to be updated to reflect the container name:

echo "0 2 * * * docker exec emby-server update" | sudo tee -a /var/spool/cron/crontabs/root

or

echo "0 2 * * * docker exec EmbyServer update" | sudo tee -a /var/spool/cron/crontabs/root

or

echo "0 2 * * * docker exec EmbyServerBeta update" | sudo tee -a /var/spool/cron/crontabs/root

or

echo "0 2 * * * emby-server update" | sudo tee -a /var/spool/cron/crontabs/root

Removal:

docker run -it --rm \
  --volume /usr/local/bin:/target \
  emby/embyserver uninstl

Shell Access:

For debugging and maintenance purposes you may want access the containers shell. If you are using Docker version 1.3.0 or higher you can access a running containers shell by starting bash using docker exec:

emby-server console

Logs:

emby-server logs

Status of service within container:

emby-server status

unRAID:

You can find the template for this container on GitHub. Located here.

unRAID Installation:

Please navigate to the Docker settings page on unRAID's Web-UI and under repositories add:

https://github.com/MediaBrowser/Emby.Build/tree/master/unraid-templates/emby

For more information on adding templates to unRAID please visit the unRAID forums.

unRAID Automatic Upgrades:

On unRAID, execute the following to have the container periodically update itself. Additionally, add the same line of code to your go file to make the change persistent.

echo "0 2 * * * docker exec emby-server update" | sudo tee -a /var/spool/cron/crontabs/root

Technical information:

By default the containerized application has been set to run with UID and GID 1000. If using the automatic install method from Docker, the container is set to run with the UID and GID of of the user executing the embyserver wrapper script. Additionally, the wrapper script saves embyserver's configuration and settings in a hidden sub folder in the executing user's home directory. Most default settings can be adjusted by passing the appropriate environment variable. Here is a list of any and all applicable environment variables that can be override by the end user.

Environment Variables:

You can adjust some of the default settings set for container/application by passing any or all of the following environment variable:

ENV VAR Definition
APP_USER Name of user the service will run as.[4]
APP_UID UID assigned to APP_USER upon creation, or will query APP_USER's ID.[3]
APP_GID GID assigned to APP_USER upon creation, or will query APP_USER's GID.[3]
APP_CONFIG Location where application will store settings and database on host.[1]
APP_GCONFIG Location where application will store settings and database within guest.[4]
UMASK umask assigned to service, default set to 002.[4]
EDGE Update the containerized service, default set to 0(Off).[4]

[1]: Variable is applicable only during install.
[2]: Variable is applicable during install, when invoking installed wrapper script or systemd service.
[3]: Variable is applicable only when invoking docker run directly.
[4]: Variable is applicable in all scenarios.

Adjusting Variables:

In order to pass any of the applicable variables during install or when invoking docker run directly please read Docker's documentation on environment variables for clarification if the following examples are not clear.

In the following examples will use the environment variable EDGE. EDGE has been chosen since it is applicable during all scenarios.

To pass the EDGE variable will invoking docker run append the following prior to the image name. Any and all other applicable variables can be done in the same manner.

--env=EDGE=1

To pass the environment variable during the other scenarios do so like in one of the examples below:

From the commandline when calling the wrapper script:

EDGE=1 emby-server

By adjusting the systemd service:

[Service]
Type=simple
Environment=EDGE=1
...

Volumes:

  • /config - Folder for configuration and settings.

Manual Run and Installation:

Of course you can always run the docker image manually. Please be aware that if you wish your data to remain persistent you need to provide a location for the /config volume. For example,

docker run -d --net=host -v /*your_config_location*:/config \
                         -e TZ=America/Edmonton
                         --name=emby-server emby/embyserver

All the information mention previously regarding user UID and GID still applies when executing a docker run command.

License:

Code released under the MIT license.

Donation:

@hurricanehrndz: PayPal