Update docker compose to use profiles

This commit is contained in:
Zoe Roux 2024-02-24 20:04:09 +00:00
parent 0ccb03f004
commit 586b7900bb
5 changed files with 114 additions and 52 deletions

View File

@ -1,3 +1,14 @@
# Installing TLDR
1. Install docker & docker-compose
2. Download the
[`docker-compose.yml`](https://raw.githubusercontent.com/zoriya/Kyoo/master/docker-compose.prod.yml),
[`nginx.conf.template`](https://raw.githubusercontent.com/zoriya/Kyoo/master/nginx.conf.template) and
[`.env`](https://raw.githubusercontent.com/zoriya/Kyoo/master/.env.example) files
3. Fill the `.env` file with your configuration options (and an API Key from [themoviedb.org](https://www.themoviedb.org/))
4. Look at [Hardware Acceleration section](#Hardware-Acceleration) if you need it
4. Run `docker compose up -d` and see kyoo at `http://localhost:8901`
# Installing # Installing
To install Kyoo, you need docker and docker-compose. Those can be installed from here for To install Kyoo, you need docker and docker-compose. Those can be installed from here for
@ -24,21 +35,13 @@ To retrieve metadata, Kyoo will need to communicate with an external service. Fo
For this purpose, you will need to get an API Key. For that, go to [themoviedb.org](https://www.themoviedb.org/) and create an account, then For this purpose, you will need to get an API Key. For that, go to [themoviedb.org](https://www.themoviedb.org/) and create an account, then
go [here](https://www.themoviedb.org/settings/api) and copy the `API Key (v3 auth)`, paste it after the `THEMOVIEDB_APIKEY=` on the `.env` file. go [here](https://www.themoviedb.org/settings/api) and copy the `API Key (v3 auth)`, paste it after the `THEMOVIEDB_APIKEY=` on the `.env` file.
If you need hardware acceleration, look at [Hardware Acceleration section](#Hardware-Acceleration) if you need it
The next and last step is actually starting Kyoo. To do that, open a terminal in the same directory as the 3 configurations files The next and last step is actually starting Kyoo. To do that, open a terminal in the same directory as the 3 configurations files
and run `docker-compose up -d`. and run `docker-compose up -d`.
Congratulation, everything is now ready to use Kyoo. You can navigate to `http://localhost:8901` on a web browser to see your instance of Kyoo. Congratulation, everything is now ready to use Kyoo. You can navigate to `http://localhost:8901` on a web browser to see your instance of Kyoo.
# Installing TLDR
1. Install docker & docker-compose
2. Download the
[`docker-compose.yml`](https://raw.githubusercontent.com/zoriya/Kyoo/master/docker-compose.prod.yml),
[`nginx.conf.template`](https://raw.githubusercontent.com/zoriya/Kyoo/master/nginx.conf.template) and
[`.env`](https://raw.githubusercontent.com/zoriya/Kyoo/master/.env.example) files
3. Fill the `.env` file with your configuration options (and an API Key from [themoviedb.org](https://www.themoviedb.org/))
4. Run `docker-compose up -d`
# Updating # Updating
Updating Kyoo is exactly the same as installing it. Get an updated version of the `docker-compose.yml` and `nginx.conf.template` files and Updating Kyoo is exactly the same as installing it. Get an updated version of the `docker-compose.yml` and `nginx.conf.template` files and
@ -54,3 +57,17 @@ TLDR: `docker run -d --name watchtower -e WATCHTOWER_CLEANUP=true -e WATCHTOWER_
To uninstall Kyoo, you need to open a terminal in the configuration's directory and run `docker-compose down`. This will To uninstall Kyoo, you need to open a terminal in the configuration's directory and run `docker-compose down`. This will
stop Kyoo's services. You can then remove the configuration files. stop Kyoo's services. You can then remove the configuration files.
# Hardware Acceleration
## Nvidia
To enable nvidia hardware acceleration, first install necessary drivers on your system.
Then, install the [nvidia-container-toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html), you can simply
follow the instructions on the official webpage or your distribution wiki.
To test if everything works, you can run `sudo docker run --rm --gpus all ubuntu nvidia-smi`. If your version of docker is older,
you might need to add `--runtime nvidia` like so: `sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi`
After that, you can now use `docker compose --profile nvidia up -d` to start kyoo with nvidia hardware acceleration.

View File

@ -1,5 +1,25 @@
version: "3.8" version: "3.8"
x-transcoder: &transcoder-base
build:
context: ./transcoder
dockerfile: Dockerfile.dev
networks:
default:
aliases:
- transcoder
ports:
- "7666:7666"
restart: on-failure
cpus: 1
env_file:
- ./.env
volumes:
- ./transcoder:/app
- ${LIBRARY_ROOT}:/video
- ${CACHE_ROOT}:/cache
- metadata:/metadata
services: services:
back: back:
build: build:
@ -53,20 +73,19 @@ services:
- ${LIBRARY_ROOT}:/video - ${LIBRARY_ROOT}:/video
transcoder: transcoder:
build: <<: *transcoder-base
context: ./transcoder profiles: ['']
dockerfile: Dockerfile.dev
ports: transcoder-nvidia:
- "7666:7666" <<: *transcoder-base
restart: on-failure deploy:
cpus: 1 resources:
env_file: reservations:
- ./.env devices:
volumes: - capabilities: [gpu]
- ./transcoder:/app environment:
- ${LIBRARY_ROOT}:/video - GOTRANSCODER_HWACCEL=nvidia
- ${CACHE_ROOT}:/cache profiles: ['nvidia']
- metadata:/metadata
ingress: ingress:
image: nginx image: nginx

View File

@ -1,12 +0,0 @@
version: "3.8"
services:
transcoder:
runtime: nvidia
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]
environment:
- GOTRANSCODER_HWACCEL=nvidia

View File

@ -1,5 +1,19 @@
version: "3.8" version: "3.8"
x-transcoder: &transcoder-base
image: zoriya/kyoo_transcoder:edge
networks:
default:
aliases:
- transcoder
restart: unless-stopped
env_file:
- ./.env
volumes:
- ${LIBRARY_ROOT}:/video
- ${CACHE_ROOT}:/cache
- metadata:/metadata
services: services:
back: back:
image: zoriya/kyoo_back:edge image: zoriya/kyoo_back:edge
@ -36,14 +50,19 @@ services:
- ${LIBRARY_ROOT}:/video - ${LIBRARY_ROOT}:/video
transcoder: transcoder:
image: zoriya/kyoo_transcoder:edge <<: *transcoder-base
restart: unless-stopped profiles: ['']
env_file:
- ./.env transcoder-nvidia:
volumes: <<: *transcoder-base
- ${LIBRARY_ROOT}:/video deploy:
- ${CACHE_ROOT}:/cache resources:
- metadata:/metadata reservations:
devices:
- capabilities: [gpu]
environment:
- GOTRANSCODER_HWACCEL=nvidia
profiles: ['nvidia']
ingress: ingress:
image: nginx image: nginx

View File

@ -1,5 +1,19 @@
version: "3.8" version: "3.8"
x-transcoder: &transcoder-base
build: ./transcoder
networks:
default:
aliases:
- transcoder
restart: on-failure
env_file:
- ./.env
volumes:
- ${LIBRARY_ROOT}:/video
- ${CACHE_ROOT}:/cache
- metadata:/metadata
services: services:
back: back:
build: ./back build: ./back
@ -35,14 +49,19 @@ services:
- ${LIBRARY_ROOT}:/video - ${LIBRARY_ROOT}:/video
transcoder: transcoder:
build: ./transcoder <<: *transcoder-base
restart: on-failure profiles: ['']
env_file:
- ./.env transcoder-nvidia:
volumes: <<: *transcoder-base
- ${LIBRARY_ROOT}:/video deploy:
- ${CACHE_ROOT}:/cache resources:
- metadata:/metadata reservations:
devices:
- capabilities: [gpu]
environment:
- GOTRANSCODER_HWACCEL=nvidia
profiles: ['nvidia']
ingress: ingress:
image: nginx image: nginx