Running with docker examples

This commit is contained in:
xis 2023-10-22 13:42:35 +02:00
parent 615b488a49
commit 4ae6775ecd
6 changed files with 145 additions and 22 deletions

View file

@ -4,7 +4,33 @@ DLNA addon for your self-hosted Nextcloud app instance that allows you to stream
devices in your network.
It supports the group folders as well.
Just edit the `application.yml` and rebuild the project with:
## Running in Docker
You can use the docker image with nextcloud-dlna e.g.:
```bash
docker run -d \
--name="nextcloud-dlna" \
--net=host \
-v /path/to/nextcloud/app/ending/with/data:/nextcloud \
-e NEXTCLOUD_DATA_DIR=/nextcloud \
-e NEXTCLOUD_DB_HOST='<your_nextcloud_db_host_ip_here>' \
-e NEXTCLOUD_DB_PASS='<your_nextcloud_db_pass_here>' \
nextcloud-dlna
```
or, if used together with the official Nextcloud docker image using the docker-composer. See the [examples](./examples)
directory. for more details about running nextcloud-dlna server in the docker container.
You can pass to the container other env variables that are listed below.
Note that it would not work on Mac OS since docker is a Linux container and the `host` networking mode doesn't actually
share the host's network interfaces.
See https://hub.docker.com/r/thanek/nextcloud-dlna for more docker image details.
## Building the project
Build the project with:
`./gradlew clean bootRun`
@ -16,6 +42,8 @@ or, if you've already built the project and created the jar file:
`NEXTCLOUD_DLNA_SERVER_PORT=9999 java -jar nextcloud-dlna-X.Y.Z.jar`
## ENV variables
Available env variables with their default values that you can overwrite:
| env variable | default value | description |
@ -32,27 +60,6 @@ Available env variables with their default values that you can overwrite:
| NEXTCLOUD_DB_PASS | nextcloud | nextcloud database password |
## Running in Docker
You can use the docker image with nextcloud-dlna e.g.:
```
docker run -d \
--name="nextcloud-dlna" \
--net=host \
-v /path/to/nextcloud/app/ending/with/data:/nextcloud \
-e NEXTCLOUD_DATA_DIR=/nextcloud \
-e NEXTCLOUD_DB_HOST='<your_nextcloud_db_host_ip_here>' \
-e NEXTCLOUD_DB_PASS='<your_nextcloud_db_pass_here>' \
nextcloud-dlna
```
You can pass to the container other env variables that are listed above.
Note that it would not work on Mac OS since docker is a Linux container and the `host` networking mode doesn't actually
share the host's network interfaces.
See https://hub.docker.com/r/thanek/nextcloud-dlna for more docker image details.
### Code used
Some java code was taken from https://github.com/haku/dlnatoad

View file

@ -0,0 +1,84 @@
version: '2'
volumes:
app:
driver: local
driver_opts:
type: none
o: bind
device: ${PWD}/app
app_etc:
driver: local
driver_opts:
type: none
o: bind
device: ${PWD}/etc/apache2
db_data:
driver: local
driver_opts:
type: none
o: bind
device: ${PWD}/db
db_etc:
driver: local
driver_opts:
type: none
o: bind
device: ${PWD}/etc/mysql
services:
db:
image: mariadb:10.5
restart: always
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- db_data:/var/lib/mysql
- db_etc:/etc/mysql
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=sql
- MYSQL_PASSWORD=secret
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
redis:
image: redis
restart: always
app:
image: nextcloud
restart: always
ports:
- "80:80"
- "443:443"
links:
- db
- redis
volumes:
- app:/var/www/html
- app_etc:/etc/apache2
environment:
- PHP_MEMORY_LIMIT=1G
- PHP_UPLOAD_LIMIT=4G
- MYSQL_PASSWORD=secret
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
dlna:
image: thanek/nextcloud-dlna
restart: always
volumes:
- app:/nextcloud
network_mode: "host"
ports:
- "9999:9999"
environment:
- NEXTCLOUD_DLNA_SERVER_PORT=9999
- NEXTCLOUD_DLNA_FRIENDLY_NAME=Nextcloud
- NEXTCLOUD_DATA_DIR=/nextcloud/data
- NEXTCLOUD_DB_TYPE=mariadb
- NEXTCLOUD_DB_HOST=localhost
- NEXTCLOUD_DB_PASS=secret

View file

@ -0,0 +1,13 @@
This will run the nextcloud-dlna in docker together with the full Nextcloud installation (containing the app, database
and redis) located in the `./app` directory.
Note: in order to enable network access to the MariaDB server, after the first run, you'll need to edit
the `./etc/mariadb.cnf`, section `[client-config]` by adding the line:
```
port = 3306
```
and removing the line:
```
socket = /var/run/mysqld/mysqld.sock
```
, then restart the `db` (`nextcloud-db-1`) container.

View file

@ -0,0 +1,3 @@
#!/bin/bash
docker-compose up -d

View file

@ -0,0 +1,2 @@
This will run the nextcloud-dlna in docker and connect to the Nextcloud installation assuming it is located in the
`/opt/nextcloud` directory.

View file

@ -0,0 +1,14 @@
#!/bin/bash
docker run -d \
--name="nextcloud-dlna" \
--restart=unless-stopped \
--net=host \
-p 9999:9999 \
-e NEXTCLOUD_DLNA_SERVER_PORT=9999 \
-e NEXTCLOUD_DLNA_FRIENDLY_NAME="Nextcloud" \
-e NEXTCLOUD_DB_HOST='localhost' \
-e NEXTCLOUD_DB_PASS='secret' \
-v '/opt/nextcloud/data:/nextcloud' \
-e NEXTCLOUD_DATA_DIR=/nextcloud \
thanek/nextcloud-dlna