feat: add docker-compose with instructions #55

This commit is contained in:
FoxxMD
2023-02-10 12:44:22 -05:00
parent 636004a1bb
commit e2d150ce15
2 changed files with 62 additions and 13 deletions
+43 -13
View File
@@ -46,6 +46,8 @@ Clone this repository somewhere and then install from the working directory
git clone https://github.com/FoxxMD/multi-scrobbler.git .
cd multi-scrobbler
npm install
npm build
npm start
```
### [Docker](https://hub.docker.com/r/foxxmd/multi-scrobbler)
@@ -54,39 +56,67 @@ npm install
foxxmd/multi-scrobbler:latest
```
Or use the provided [docker-compose.yml](/docker-compose.yml) after modifying it to fit your configuration.
## Setup
Some setup is required! See the [configuration](docs/configuration.md) docs for a full reference.
### TLDR, Minimal Example
**Is there an example configuration using everything?**
You want to use multi-scrobbler to scrobble your plays from Spotify to Maloja:
Yes, check out the [kitchen sink example](/docs/kitchensink.md)
#### Local
#### Local Example
```bash
SPOTIFY_CLIENT_ID=yourId SPOTIFY_CLIENT_SECRET=yourSecret MALOJA_URL=http://domain.tld MALOJA_API_KEY=1234 node index.js
```
#### Docker
```bash
docker run -e "SPOTIFY_CLIENT_ID=yourId" -e "SPOTIFY_CLIENT_SECRET=yourSecret" -e "MALOJA_URL=http://domain.tld" -e "MALOJA_API_KEY=1234" -v /path/on/host/config:/home/node/app/config foxxmd/multi-scrobbler
```
**But I want to use json for configuration?**
Then use [config.json.example](/config/config.json.example) and drop it in your `CONFIG_DIR` directory
Rename [config.json.example](/config/config.json.example) to `config.json` and modify as necessary.
**Is there an example configuration using everything?**
#### Docker
Yes, check out the [kitchen sink example](/docs/kitchensink.md)
Recommended configuration steps for docker or docker-compose usage:
* If using json configuration you must **bind the host directory where your configurations are located into the container:**
* [Using `-v` method for docker](https://docs.docker.com/storage/bind-mounts/#start-a-container-with-a-bind-mount): `-v /path/on/host/config:/config`
* [Using docker-compose](https://docs.docker.com/compose/compose-file/compose-file-v3/#short-syntax-3): `- /path/on/host/config:/config`
* (Optionally) map the web UI port in the container **9078** to the host
* With [docker](https://docs.docker.com/engine/reference/commandline/run/#publish): `-p 9078:9078` (first port is the port on the host to use)
* With [docker-compose](https://docs.docker.com/compose/compose-file/compose-file-v3/#short-syntax-1): `- "9078:9078"`
* (Optionally) set the [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for the container using the environmental variable `TZ` ([docker](https://docs.docker.com/engine/reference/commandline/run/#env)) ([docker-compose](https://docs.docker.com/compose/compose-file/compose-file-v3/#environment))
##### Linux Host
If you are
* using [rootless containers with Podman](https://developers.redhat.com/blog/2020/09/25/rootless-containers-with-podman-the-basics#why_podman_)
* running docker on MacOS or Windows
this **DOES NOT** apply to you.
If you are running Docker on a **Linux Host** you must specify `user:group` permissions of the user who owns the **configuration directory** on the host to avoid [docker file permission problems.](https://ikriv.com/blog/?p=4698) These can be specified using the [environmental variables **PUID** and **PGID**.](https://docs.linuxserver.io/general/understanding-puid-and-pgid)
To get the UID and GID for the current user run these commands from a terminal:
* `id -u` -- prints UID
* `id -g` -- prints GID
##### Examples
```bash
docker run -e "SPOTIFY_CLIENT_ID=yourId" -e "SPOTIFY_CLIENT_SECRET=yourSecret" -e "MALOJA_URL=http://domain.tld" -e "MALOJA_API_KEY=1234" -e "PUID=1000" -e "PGID=1000" -p 9078:9078 -v /path/on/host/config:/home/node/app/config foxxmd/multi-scrobbler
```
See the [docker-compose.yml](/docker-compose.yml) file for how to use with docker-compose.
## Usage
A status page with statistics, recent logs, and some runtime configuration options can be found at
```
https://localhost:9078
http://localhost:9078
```
Output is also provided to stdout/stderr as well as file if specified in configuration.
+19
View File
@@ -0,0 +1,19 @@
multi-scrobbler:
image: foxxmd/multi-scrobbler
container_name: multi-scrobbler
environment:
- TZ=Etc/GMT # Specify timezone from TZ Database name found here https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
#- SPOTIFY_CLIENT_ID=
#- SPOTIFY_CLIENT_SECRET=
#- SPOTIFY_REDIRECT_URI=http://multi-scrobbler-host-IP:9078/callback ## Need to be whitelisted in Spotify dashboard and is used for creating the connection first time
#- MALOJA_URL=http://maloja:42010
#- MALOJA_API_KEY=
#- PUID=1000 # required if running docker on linux host, see main README Docker setup instructions
#- PGID=1000 # required if running docker on linux host, see main README Docker setup instructions
volumes:
- /path_on_host/multi-scrobbler-config:/config
#networks:
# - (optional to add container to the same bridge network that maloja is inside to be able to use docker internal networking & dns to resolve and connect to maloja URL via http://maloja:port)
ports:
- 9078:9078 # first port is the HOST port multi-scrobbler will serve UI on
restart: unless-stopped