Skip to content

Commit

Permalink
Merge pull request #182 from floriegl/master
Browse files Browse the repository at this point in the history
Update from floriegl's fork
  • Loading branch information
UnderMybrella authored Jan 11, 2025
2 parents f4ef7a2 + 45faa8b commit 7a2c215
Show file tree
Hide file tree
Showing 114 changed files with 2,376 additions and 14,540 deletions.
17 changes: 6 additions & 11 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
# only used for docker

DOMAIN=
PORT=

# Spotify Client / Secret; make an application over here: https://developer.spotify.com/my-applications/
SPOTIFYCLIENT=
SPOTIFYSECRET=

# Only needed if you're doing oauth logins
GOOGLECLIENT=
GOOGLESECRET=

# This can be obtained from here: https://developers.google.com/youtube/v3/getting-started
YOUTUBE_API_KEY=

# database setup, can be left untouched if the database isn't manually exposed
SQL_USERNAME=eternal_user
SQL_PASSWORD=36ngEC5AmoLT6x
SQL_TYPE=mysql
SQL_HOST=db
SQL_PORT=3306
SQL_DATABASE_NAME=eternaljukebox
#SQL_USERNAME=eternal_user
#SQL_PASSWORD=36ngEC5AmoLT6x
#SQL_TYPE=mysql
#SQL_HOST=db
#SQL_PORT=3306
#SQL_DATABASE_NAME=eternaljukebox
35 changes: 35 additions & 0 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: ci

on:
push:
branches:
- "master"

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64/v8
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/eternaljukebox:latest
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ trid_audio/
working/
!/src/main/kotlin/org/abimon/eternalJukebox/data/audio
/data/
/database/
/database/*
!/database/eternal_jukebox.mv.db.init
web

# ignore config files
Expand All @@ -66,3 +67,6 @@ config.json

# docker-compose environment
.env

build/
bin/
18 changes: 0 additions & 18 deletions Authentication.md

This file was deleted.

24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# set up the main image with dependencies first, to avoid re-doing this after each build
FROM adoptopenjdk:8-jdk-hotspot as deps
FROM amazoncorretto:11-alpine as deps

WORKDIR /EternalJukebox

RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp \
&& chmod a+rx /usr/local/bin/yt-dlp \
&& apt-get update \
&& apt-get install ffmpeg gettext python3 -y \
&& apt-get clean \
RUN wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp \
&& chmod a+rx /usr/local/bin/yt-dlp

RUN apk update \
&& apk add ffmpeg gettext python3 \
&& touch hikari.properties

# build jar with gradle

FROM gradle:jdk8 as gradle-build
FROM gradle:8-jdk11 as gradle-build

WORKDIR /home/gradle/project


# Only copy dependency-related files
COPY build.gradle gradle.propertie* settings.gradle ./EternalJukebox/

Expand All @@ -26,12 +25,13 @@ RUN gradle clean shadowJar --no-daemon > /dev/null 2>&1 || true

COPY . ./EternalJukebox

RUN cd EternalJukebox\
&& gradle clean shadowJar --no-daemon
WORKDIR /home/gradle/project/EternalJukebox

RUN gradle clean shadowJar --no-daemon

# build web with jekyll

FROM jekyll/jekyll:stable as jekyll-build
FROM rockstorm/jekyll:latest as jekyll-build

WORKDIR /EternalJukebox

Expand All @@ -49,4 +49,4 @@ COPY --from=gradle-build /home/gradle/project/EternalJukebox/build/libs/* ./
# envsubst is used so environment variables can be used instead of a config file

CMD envsubst < "/EternalJukebox/envvar_config.yaml" > "/EternalJukebox/config.yaml"\
&& java -jar EternalJukebox.jar
&& java -jar EternalJukebox-all.jar
54 changes: 54 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# set up the main image with dependencies first, to avoid re-doing this after each build
FROM amazoncorretto:11-alpine as deps

WORKDIR /EternalJukebox

RUN wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp \
&& chmod a+rx /usr/local/bin/yt-dlp

RUN apk update \
&& apk add ffmpeg gettext python3 \
&& touch hikari.properties

# build jar with gradle

FROM gradle:8-jdk11 as gradle-build

WORKDIR /home/gradle/project

# Only copy dependency-related files
COPY build.gradle gradle.propertie* settings.gradle ./EternalJukebox/

# Only download dependencies
# Eat the expected build failure since no source code has been copied yet
RUN gradle clean shadowJar --no-daemon > /dev/null 2>&1 || true

COPY . ./EternalJukebox

WORKDIR /home/gradle/project/EternalJukebox

# Do not build on the dev docker container
# We'll use the mounted from the host machine becuase that's faster
#RUN gradle clean shadowJar --no-daemon

# build web with jekyll

FROM rockstorm/jekyll:latest as jekyll-build

WORKDIR /EternalJukebox

COPY --from=gradle-build /home/gradle/project/EternalJukebox .

RUN chmod -R 777 . && jekyll build --source _web --destination web

# copy into main image

FROM deps as main

COPY --from=jekyll-build /EternalJukebox/ ./
COPY --from=gradle-build /home/gradle/project/EternalJukebox/build/libs/* ./

# envsubst is used so environment variables can be used instead of a config file

CMD envsubst < "/EternalJukebox/envvar_config.yaml" > "/EternalJukebox/config.yaml"\
&& java -jar EternalJukebox-all.jar
87 changes: 61 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,89 +1,124 @@
# EternalJukebox

The source files for the EternalJukebox, a rehosting of the Infinite Jukebox.
This repo contains everything you need to host the EternalJukebox on your own server!
This repository is a fork which fixes bugs because the upstream repo is unmaintained.

You can visit the official site [here](https://eternalbox.dev/), in case you want to mess around with it without doing all the hard stuff.
You can visit the hosted instance of this repository [here](https://eternalbox.floriegl.tech), in case you want to mess around with it without doing all the hard stuff.

The source files for the EternalJukebox, a rehosting of the Infinite Jukebox.
This repo contains everything you need to host the EternalJukebox on your own server!

# Docker Install

## Prerequesits
## Prerequisites

You need to install [docker](https://docs.docker.com/engine/install/) and [docker-compose](https://docs.docker.com/compose/install/)

Then, download or clone the repository.

## Configuration

To configure, rename `.env.example` to `.env` and change the appropriate values. For advanced configuration edit `envvar_config.yaml`.
To configure, grab `.env.example` from this repository, rename it to `.env` and change the appropriate values.

You'll also need `envvar_config.yaml`, but only edit this if you want some advanced configuration.

## Running

To start, run `docker-compose up -d` in the repositories directory. To stop, run `docker-compose down`.
You can use the following `docker-compose.yaml` as a starting point to run the application without needing a database running, if you want to use a db refer to the main `docker-compose.yaml`.

```yaml
version: "3"

services:
main:
image: daviirodrig/eternaljukebox
ports:
- 8080:8080
env_file:
- .env
volumes:
- "./envvar_config.yaml:/EternalJukebox/envvar_config.yaml"
```
If you change anything in the repository, like pulling updates, run `docker-compose build` to re-build the application.
To start, run `docker compose up -d` in the folder containing `envvar_config.yaml`, `.env` and `docker-compose.yaml`. To stop, run `docker compose down`.

If you want to change the port from 8080, edit `docker-compose.yml` line 9, to be `- <your port>:8080`
If you want to you can upgrade the image by pulling the newest with `docker pull daviirodrig/eternaljukebox` and then restart with `docker compose down` and `docker compose up -d`

If you want to change the port from 8080, edit `docker-compose.yml` port, to be `- <your port>:8080`

# Manual Install

## Prerequisites

### Java:

##### Windows
Download and install Java from https://www.java.com/en/download/

Download and install Java from https://www.java.com/en/download/

##### Debian-based Linux distributions
For Ubuntu or Debian-based distributions execute `sudo apt-get install default-jre` in the terminal

For Ubuntu or Debian-based distributions execute `sudo apt-get install default-jre` in the terminal

##### Fedora and CentOS
There is a tutorial for installing java on Fedora and CentOS at https://www.digitalocean.com/community/tutorials/how-to-install-java-on-centos-and-fedora

There is a tutorial for installing java on Fedora and CentOS at https://www.digitalocean.com/community/tutorials/how-to-install-java-on-centos-and-fedora

### Yt-dlp (a more up-to-date fork of Youtube-dl):

##### Windows

Download the .exe at https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe and place it in `C:\Windows\`, or in another folder on the PATH.

##### Linux
Use these commands in the terminal to install youtube-dl on Linux:
`sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp`

Use these commands in the terminal to install youtube-dl on Linux:
`sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp`
`sudo chmod a+rx /usr/local/bin/yt-dlp`

### ffmpeg:

##### Windows

Download the exe from https://ffmpeg.zeranoe.com/builds/ and place it in `C:\Windows\`, or in another folder on teh PATH.

##### Linux

ffmpeg is available to download in most distributions using `sudo apt-get install ffmpeg` or equivalent

## Getting the project files:

The whole process of obtaining project files is much easier now, as the build process is streamlined through Jenkins.

The project site is over [here](https://jenkins.abimon.org/job/EternalJukebox/), and contains the individual files to download, or an all-in-one zip for all the files. Alternatively, the files can be found over at a permanent server [here](https://abimon.org/eternal_jukebox)

## Configuring

First thing to do is create a new file called either `config.yaml` or `config.json` (YAML tends to be easier to write, but takes up slightly more space), then open it with notepad/notepad++ on Windows and whatever text editor you like on Linux (for example nano: `nano config.json`)

Now you should go to https://developer.spotify.com/my-applications/ and log in to your spotify account.
Then click the "Create an app" button and a new page should popup.
There give it a name and description and click create.
It should send you to the new app's page, the only thing you need from here is your Client ID and Client Secret
(Note: Never share these with anyone!)
Now you should go to https://developer.spotify.com/my-applications/ and log in to your spotify account.
Then click the "Create an app" button and a new page should popup.
There give it a name and description and click create.
It should send you to the new app's page, the only thing you need from here is your Client ID and Client Secret
(Note: Never share these with anyone!)

You will also need a Youtube Data API key, which you can find about how to obtain [here](https://developers.google.com/youtube/v3/getting-started).

There are a variety of config options (documentation coming soon) that allow most portions of the EternalJukebox to be configured, and these can be entered here.

## Starting the server:

First you need to open the Terminal or Command Prompt.
Then make sure its running in the folder that your EternalJukebox.jar is in, once again to do this use the `cd` command.
First you need to open the Terminal or Command Prompt.
Then make sure its running in the folder that your EternalJukebox.jar is in, once again to do this use the `cd` command.
Then execute the jar with `java -jar EternalJukebox.jar`

If everything went right it should say `Listening at http://0.0.0.0:11037`
If everything went right it should say `Listening at http://0.0.0.0:11037`

you should now be able to connect to it with a browser through http://localhost:11037
you should now be able to connect to it with a browser through http://localhost:11037

Congrats you did it!
Congrats you did it!

## Manually Building

This is not recommended unless you're making some modifications, and as such should only be performed by more advanced users

You'll need to obtain a copy of [Gradle](https://gradle.org/install/), likely a [JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html), and [Jekyll](https://jekyllrb.com/). You'll also need the project files in some capacity, be it `git clone` or downloading the archive from GitHub.
You'll need to obtain a copy of [Gradle](https://gradle.org/install/), likely a [JDK](https://www.oracle.com/java/technologies/javase/jdk11-archive-downloads.html), and [Jekyll](https://jekyllrb.com/). You'll also need the project files in some capacity, be it `git clone` or downloading the archive from GitHub.

From there, building in Gradle is simple; just run `gradle clean shadowJar` from the project file directory. That should produce a jar file in `build/libs` that will work for you. In addition, you'll need to build the Jekyll webpages, which can be done by running `jekyll build --source _web --destination web`
2 changes: 1 addition & 1 deletion _web/_config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: The Eternal Jukebox
url: https://eternal.abimon.org
url: https://eternalbox.floriegl.tech

defaults:
-
Expand Down
2 changes: 1 addition & 1 deletion _web/_data/faq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ faq:
- question: Who made this?
id: creator
answer: "The original site was made by [Paul Lamere](http://twitter.com/plamere) at [Music Hack Day Boston](http://boston.musichackday.org/) on November 11, 2012 (More info at [Music Machinery](http://musicmachinery.com/2012/11/12/the-infinite-jukebox/) ), and used to be hosted over [here.](http://labs.echonest.com/Uploader/index.html)
This site is a rework of the original project, and is now hosted by [UnderMybrella]({{ site.data.var.git }})."
This site is a rework of the original project, and it was hosted by [UnderMybrella](https://github.com/UnderMybrella/EternalJukebox) and [daviirodrig](https://github.com/daviirodrig/EternalJukebox), but this instance is hosted by [floriegl]({{ site.data.var.git }})"

- question: Help! My audio seems to be jumping randomly!
id: random-jump
Expand Down
6 changes: 3 additions & 3 deletions _web/_data/var.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cdn: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7"
git: "https://github.com/UnderMybrella/EternalJukebox"
cdn: "https://maxcdn.bootstrapcdn.com"
git: "https://github.com/floriegl/EternalJukebox"
jquery: "https://code.jquery.com"
version: "1-1-1"
version: "1-2-1"
Loading

0 comments on commit 7a2c215

Please sign in to comment.