diff --git a/Makefile b/Makefile index acd3efe8..14753dab 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,12 @@ build-init: docker buildx create --platform linux/arm/v7,linux/amd64 --use --name multiarch build-cadence: - docker buildx build --push --platform linux/arm/v7,linux/amd64 --tag kenellorando/cadence:latest --file ./cadence/Dockerfile.multiarch ./cadence/ + docker buildx build --push --platform linux/arm/v7,linux/amd64 --tag kenellorando/cadence:latest --tag kenellorando/cadence:$(VERSION) --file ./cadence/Dockerfile.multiarch ./cadence/ build-cadence_icecast2: - docker buildx build --push --platform linux/arm/v7,linux/amd64 --tag kenellorando/cadence_icecast2:latest ./cadence_icecast2/ + docker buildx build --push --platform linux/arm/v7,linux/amd64 --tag kenellorando/cadence_icecast2:latest --tag kenellorando/cadence_icecast2:$(VERSION) --file ./cadence_icecast2/Dockerfile ./cadence_icecast2/ build-cadence_liquidsoap: - docker buildx build --push --platform linux/arm/v7,linux/amd64 --tag kenellorando/cadence_liquidsoap:latest ./cadence_liquidsoap/ + docker buildx build --push --platform linux/arm/v7,linux/amd64 --tag kenellorando/cadence_liquidsoap:latest --tag kenellorando/cadence_liquidsoap:$(VERSION) --file ./cadence_liquidsoap/Dockerfile ./cadence_liquidsoap/ -build-all: build-init build-cadence build-cadence_icecast2 build-cadence_liquidsoap +build-all: build-cadence build-cadence_icecast2 build-cadence_liquidsoap diff --git a/README.md b/README.md index d242d899..5ba771e9 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,17 @@ # CadenceRadio -**Cadence** is a fully-featured HTTP API web radio software suite. +**Cadence** is a fully-featured REST API web radio software suite. -It ships everything you need to start a web radio station, including: -- an API server (with search, request, now playing, artwork, and stream information functions) +It ships everything needed to run a web radio station, including: + +- an API server with search, request, now playing, artwork, and stream information - an interactive browser UI - an autopopulating music-metadata database - custom built-in _Icecast_ and _Liquidsoap_ integration -These features allow your audiences to interact with your web radio much like a call-in radio station. The project ships all components pre-configured to work with each each other so there is hardly any configuration to do. +These features allow your audiences to interact with your web radio much like a traditional call-in radio station. The project ships all components pre-configured to work with each each other so there is hardly any configuration to do. -To start your own instance of Cadence, set a target directory containing your music, set a few service passwords and hostnames, and you're good to go! Cadence has builds available for amd64 and armv7 systems. All components are containerized, and a Compose file will set the entire radio stack up in minutes. +To start your own instance of Cadence, set a target directory containing your music, set a few service passwords and hostnames, and you're good to go! All components have multi-architecture containers, and a Compose file will set the entire radio stack up in minutes. **See a live demo on [cadenceradio.com](https://cadenceradio.com/)!** @@ -26,6 +27,10 @@ To start your own instance of Cadence, set a target directory containing your mu > **Warning**: The way this repo currently handles configuration involves adding passwords to files which you may accidentally commit, so be careful. +## Prerequisites +1. You must have Docker Compose installed. + +## Installation 1. Edit the `cadence/config/cadence.env` file: 1. Set the `CSERVER_MUSIC_DIR` value to an absolute path of a directory on your local system which you want to play music. The target is not recursively searched. The default location is `/music/`. 2. Set the `CSERVER_REQRATELIMIT` to the number of seconds you wish to timeout users after they make song requests. Setting this value to `0` will disable rate limiting. @@ -34,19 +39,21 @@ To start your own instance of Cadence, set a target directory containing your mu 2. Set the `` value to the endpoint you expect your audience to connect to. Cadence uses this value to set the stream source in the UI. This can be a DNS name, an IP address, or leave it default `localhost` to run locally. 3. Configure the `cadence_liquidsoap/config/cadence.liq` file. 1. Change all instances of `hackme` to a new password. -4. `docker compose up` - -Running `docker compose up` will start all Cadence services. +4. `docker compose up`. -- The UI is accessible by default at `localhost:8080`. -- The stream endpoint is accessible by default at `localhost:8000/cadence1`. +That's all. All Cadence services will start up linked with each other. -If you are developing and need to rebuild exactly what you have locally: +## Accessing Services +- The UI is accessible in a browser by default at `localhost:8080`. +- API server requests may sent to the `localhost:8080` path by default. See API Documentation below. +- The stream endpoint is accessible at `localhost:8000/cadence1` by default. +## Building the Stack Locally +If you are developing and need to rebuild all services exactly as you have locally: 1. `docker compose up --build` # API Reference -See the `API` tab on https://cadenceradio.com for more details and request/response examples. +See [Cadence's GitHub Wiki for API Documentation](https://github.com/kenellorando/cadence/wiki/API-Reference) or the `API` tab on https://cadenceradio.com for complete details and request/response examples. # Container Repositories - https://hub.docker.com/r/kenellorando/cadence diff --git a/cadence/Dockerfile.multiarch b/cadence/Dockerfile.multiarch index 4fddb8fb..3537f0ba 100644 --- a/cadence/Dockerfile.multiarch +++ b/cadence/Dockerfile.multiarch @@ -17,6 +17,12 @@ LABEL maintainer="Ken Ellorando (kenellorando.com)" LABEL source="github.com/kenellorando/cadence" COPY --from=builder /cadence/public /cadence/server/public COPY --from=builder /cadence-server /cadence/cadence-server + +RUN useradd -s /bin/bash cadence +RUN touch /cadence/music-metadata.db +RUN chown cadence:cadence /cadence/ /cadence/* /cadence/cadence-server +RUN chmod u+wrx /cadence/ /cadence/* + EXPOSE 8080 -# TODO: use non-root user +USER cadence CMD [ "/cadence/cadence-server" ] diff --git a/cadence/config/cadence.env b/cadence/config/cadence.env index 24006ac6..6234e201 100644 --- a/cadence/config/cadence.env +++ b/cadence/config/cadence.env @@ -5,7 +5,7 @@ CSERVER_REQRATELIMIT=180 # If you are running Cadence through Docker simply as a user, # you are unlikely to ever need to change anything below. -CSERVER_VERSION=5.0.0 +CSERVER_VERSION=5.0.1 CSERVER_LOGLEVEL=4 CSERVER_SOURCEADDRESS=liquidsoap:1234 CSERVER_SOURCEPORT= diff --git a/cadence/server/public/index.html b/cadence/server/public/index.html index 47f7cabc..be5ae9ee 100644 --- a/cadence/server/public/index.html +++ b/cadence/server/public/index.html @@ -63,17 +63,17 @@
-

Cadence is a fully-featured HTTP API web radio software suite.

-

It ships everything you need to run an internet radio station, including:

+

Cadence is a fully-featured REST API web radio software suite.

+

It ships everything you need to run an web radio station, including:

    -
  • ... an API server providing music search, request, now playing, artwork, and stream information functions.
  • +
  • ... an API server with search, request, now playing, artwork, and stream information.
  • ... an interactive browser UI.
  • ... an auto-populating music metadata database.
  • ... custom built-in Icecast and Liquidsoap integration.
  • -
  • ... containerization of all components (this demo even runs on a Kubernetes cluster).
-

To configure Cadence, set a music directory (with some music files inside it), set a few service passwords and hostnames, and you're good to go! Cadence has releases for amd64 and armv7. A Compose file will build the entire radio stack for you in minutes. Leave a star on GitHub!

- +

These features allow your audiences to interact with your web radio much like a traditional call-in radio station. The project ships all components pre-configured to work with each each other so there is hardly any configuration to do.

+ +

To start your own instance of Cadence, set a target directory containing your music, set a few service passwords and hostnames, and you're good to go! All components have multi-architecture containers, and a Compose file will set the entire radio stack up in minutes. Leave a star on GitHub!

Submit a song request to enter the play queue.

@@ -197,13 +197,10 @@

GET /api/

-