From 6ba2986fb0eb3259a2d1dca3c870ea181aeb8ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80?= Date: Fri, 21 Jul 2023 14:32:57 +0200 Subject: [PATCH 1/9] add jda-nas for linux musl (#920) --- LavalinkServer/build.gradle.kts | 2 +- LavalinkServer/docker/alpine.Dockerfile | 2 ++ .../main/java/lavalink/server/config/KoeConfiguration.kt | 3 +++ settings.gradle.kts | 6 +++--- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/LavalinkServer/build.gradle.kts b/LavalinkServer/build.gradle.kts index ad61565fe..fbb61ecae 100644 --- a/LavalinkServer/build.gradle.kts +++ b/LavalinkServer/build.gradle.kts @@ -137,7 +137,7 @@ tasks { archiveFileName.set("Lavalink-musl.jar") // Exclude base dependency jar exclude { - it.name.contains("lavaplayer-natives-fork") || it.name.contains("udpqueue-native-") + it.name.contains("lavaplayer-natives-fork") || (it.name.contains("udpqueue-native-") && !it.name.contains("musl")) } // Add custom jar diff --git a/LavalinkServer/docker/alpine.Dockerfile b/LavalinkServer/docker/alpine.Dockerfile index b410fadc6..e24daeed2 100644 --- a/LavalinkServer/docker/alpine.Dockerfile +++ b/LavalinkServer/docker/alpine.Dockerfile @@ -1,5 +1,7 @@ FROM azul/zulu-openjdk-alpine:17-jre-headless-latest +RUN apk add --no-cache libgcc + # Run as non-root user RUN addgroup -g 322 -S lavalink && \ adduser -u 322 -S lavalink lavalink diff --git a/LavalinkServer/src/main/java/lavalink/server/config/KoeConfiguration.kt b/LavalinkServer/src/main/java/lavalink/server/config/KoeConfiguration.kt index b7f5048e8..41397f506 100644 --- a/LavalinkServer/src/main/java/lavalink/server/config/KoeConfiguration.kt +++ b/LavalinkServer/src/main/java/lavalink/server/config/KoeConfiguration.kt @@ -20,6 +20,9 @@ class KoeConfiguration(val serverConfig: ServerConfig) { SystemType(DefaultArchitectureTypes.X86_32, DefaultOperatingSystemTypes.LINUX), SystemType(DefaultArchitectureTypes.ARMv8_64, DefaultOperatingSystemTypes.LINUX), + SystemType(DefaultArchitectureTypes.X86_64, DefaultOperatingSystemTypes.LINUX_MUSL), + SystemType(DefaultArchitectureTypes.ARMv8_64, DefaultOperatingSystemTypes.LINUX_MUSL), + SystemType(DefaultArchitectureTypes.X86_64, DefaultOperatingSystemTypes.WINDOWS), SystemType(DefaultArchitectureTypes.X86_32, DefaultOperatingSystemTypes.WINDOWS), diff --git a/settings.gradle.kts b/settings.gradle.kts index 8cce7cd49..0f12f7e6d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -36,7 +36,7 @@ fun VersionCatalogBuilder.spring() { } fun VersionCatalogBuilder.voice() { - version("lavaplayer", "17c75f5") + version("lavaplayer", "17c75f51f9") library("lavaplayer", "com.github.walkyst.lavaplayer-fork", "lavaplayer").versionRef("lavaplayer") library("lavaplayer-ip-rotator", "com.github.walkyst.lavaplayer-fork", "lavaplayer-ext-youtube-rotator").versionRef("lavaplayer") @@ -45,8 +45,8 @@ fun VersionCatalogBuilder.voice() { library("koe", "moe.kyokobot.koe", "core").version("2.0.0-rc1") library("koe-udpqueue", "moe.kyokobot.koe", "ext-udpqueue").version("2.0.0-rc1") - version("udpqueue", "0.2.6") - val platforms = listOf("linux-x86-64", "linux-x86", "linux-aarch64", "linux-arm", "win-x86-64", "win-x86", "darwin") + version("udpqueue", "0.2.7") + val platforms = listOf("linux-x86-64", "linux-x86", "linux-aarch64", "linux-arm", "linux-musl-x86-64", "linux-musl-aarch64", "win-x86-64", "win-x86", "darwin") platforms.forEach { library("udpqueue-native-$it", "club.minnced", "udpqueue-native-$it").versionRef("udpqueue") } From 6672f0dd8932fd4000077606f73ea683e146333e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80?= Date: Fri, 21 Jul 2023 14:36:02 +0200 Subject: [PATCH 2/9] update lavaplayer to 08cfbc0 - Fixed ogg streaming --- settings.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 0f12f7e6d..887c8afdc 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -36,7 +36,7 @@ fun VersionCatalogBuilder.spring() { } fun VersionCatalogBuilder.voice() { - version("lavaplayer", "17c75f51f9") + version("lavaplayer", "08cfbc0595") library("lavaplayer", "com.github.walkyst.lavaplayer-fork", "lavaplayer").versionRef("lavaplayer") library("lavaplayer-ip-rotator", "com.github.walkyst.lavaplayer-fork", "lavaplayer-ext-youtube-rotator").versionRef("lavaplayer") From 9ac3eb8b7209d317fb913cf0e5018e08b8ad55b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80?= Date: Fri, 21 Jul 2023 14:46:49 +0200 Subject: [PATCH 3/9] add new config option to readme env vars --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 733338dd6..7b6e6b38b 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,8 @@ LAVALINK_PLUGINS_0_REPOSITORY LAVALINK_PLUGINS_1_DEPENDENCY LAVALINK_PLUGINS_1_REPOSITORY +LAVALINK_PLUGINS_DIR + LAVALINK_SERVER_PASSWORD LAVALINK_SERVER_SOURCES_YOUTUBE LAVALINK_SERVER_SOURCES_BANDCAMP From f543fa9e98e61efa6f46511ac785041777e62364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80?= Date: Fri, 21 Jul 2023 14:49:09 +0200 Subject: [PATCH 4/9] fixup some readme things --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7b6e6b38b..68ab53e15 100644 --- a/README.md +++ b/README.md @@ -263,19 +263,20 @@ WantedBy=multi-user.target ``` To initiate the service, run + ```shell sudo systemctl daemon-reload sudo systemctl enable lavalink sudo systemctl start lavalink ``` + In addition to the usual log files, you can also view the log with `sudo journalctl -u lavalink`. + ### Docker Docker images can be found under [packages](https://github.com/lavalink-devs/Lavalink/pkgs/container/lavalink) with old builds prior to `v3.7.4` being available on [Docker Hub](https://hub.docker.com/r/fredboat/lavalink/). There are 2 image variants `Ubuntu` and `Alpine`, the `Alpine` variant is smaller and can be used with the `-alpine` suffix, for example `ghcr.io/lavalink-devs/lavalink:3-alpine`. ---- - Install [Docker](https://docs.docker.com/engine/install/) & [Docker Compose](https://docs.docker.com/compose/install/) Create a `docker-compose.yml` with the following content: From 83d6f59a22e7b8106b00f7db906d35766b4c7b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80?= Date: Fri, 21 Jul 2023 15:05:47 +0200 Subject: [PATCH 5/9] readd hardware support section in readme --- README.md | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 68ab53e15..be108bf4c 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ A [basic example bot](Testbot) is available. - [Features](#features) - [Requirements](#requirements) +- [Hardware Support](#hardware-support) - [Changelog](#changelog) - [Versioning policy](#versioning-policy) - [Client libraries](#client-libraries) @@ -49,19 +50,28 @@ A [basic example bot](Testbot) is available. * Java 17 LTS or newer required. (we recommend running the latest LTS version or newer) * OpenJDK or Zulu running on Linux AMD64 is officially supported. -Support for Darwin (Mac), Windows AMD64, and Linux ARM (Raspberry Pi) is provided on a best-effort basis. This is dependent on Lavaplayer's native libraries. - -Lavaplayer currently supports following architectures: - -`Darwin (M1 & Intel)`, `Linux aarch32`, `Linux aarch64`, `Linux ARMv7+ 32/64`, `Linux ARMHF(v6) 32`, `Linux i386 32`, `Linux x86 64`, `Windows i386 32` and `Windows x86 64` - -JDA-NAS(Native Audio Buffer) & the Timescale filter are currently not supported on following architectures: - -`Linux ARMHF(v6) 32` and `Linux aarch32` - - Support for other JVMs is also best-effort. Periodic CPU utilization stats are prone not to work everywhere. +## Hardware Support + +Lavalink also runs on other hardware, but support is best-effort. +Here is a list of known working hardware: + +| Operating System | Architecture | Lavaplayer | JDA-NAS | Timescale | AVX2 | +|------------------|--------------|------------|---------|-----------|------| +| linux | x86-64 | ✅ | ✅ | ✅ | ✅ | +| linux | x86 | ✅ | ✅ | ✅ | ✅ | +| linux | arm | ✅ | ✅ | ✅ | ❌ | +| linux | armhf | ✅ | ❌ | ❌ | ❌ | +| linux | aarch32 | ✅ | ❌ | ❌ | ❌ | +| linux | aarch64 | ✅ | ✅ | ✅ | ❌ | +| linux-musl | x86-64 | ✅ | ✅ | ✅ | ✅ | +| linux-musl | aarch64 | ✅ | ✅ | ✅ | ❌ | +| windows | x86-64 | ✅ | ✅ | ✅ | ✅ | +| Windows | x86 | ✅ | ✅ | ✅ | ✅ | +| darwin | x86-64 | ✅ | ✅ | ✅ | ✅ | +| darwin | aarch64e | ✅ | ✅ | ✅ | ❌ | + ## Changelog Please see [here](CHANGELOG.md) From c79ffaace544a986356d6fc93eea0d893ac943ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80?= Date: Fri, 21 Jul 2023 15:12:46 +0200 Subject: [PATCH 6/9] update changelog for v4.0.0-beta.2 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cef880bbb..dc71834ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ Each release usually includes various fixes and improvements. The most noteworthy of these, as well as any features and breaking changes, are listed here. +## 4.0.0-beta.2 +* Update lavaplayer to [`08cfbc0`](https://github.com/Walkyst/lavaplayer-fork/commit/08cfbc05953128f3cf727ea3bcbe41dabcd1c7db) - Fixed ogg streaming +* Add JDA-NAS support for musl (`x86-64`, `aarch64`) based systems (most notably `alpine`) +* New config option to specify the directory to load plugins from. `lavalink.pluginsDir` (defaults to `./plugins`) + ## 4.0.0-beta.1 * New Lavalink now requires Java 17 or higher to run * **Removal of all websocket messages sent by the client. Everything is now done via [REST](IMPLEMENTATION.md#rest-api)** From fe316404fb84e9225092d4001236dfc4a23859c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80?= Date: Fri, 28 Jul 2023 20:43:09 +0200 Subject: [PATCH 7/9] update lavaplayer version to 74e6c4d728 --- settings.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 887c8afdc..500068551 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -36,7 +36,7 @@ fun VersionCatalogBuilder.spring() { } fun VersionCatalogBuilder.voice() { - version("lavaplayer", "08cfbc0595") + version("lavaplayer", "74e6c4d728") library("lavaplayer", "com.github.walkyst.lavaplayer-fork", "lavaplayer").versionRef("lavaplayer") library("lavaplayer-ip-rotator", "com.github.walkyst.lavaplayer-fork", "lavaplayer-ext-youtube-rotator").versionRef("lavaplayer") From 507b610b229229aefd229754407aa1abb4900308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80?= Date: Wed, 2 Aug 2023 22:28:46 +0200 Subject: [PATCH 8/9] add missing env variables in github workflows --- .github/workflows/build.yml | 12 ++++++++++++ .github/workflows/release.yml | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 19ee18338..347e05b67 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,6 +18,14 @@ on: required: false MAVEN_PASSWORD: required: false + ORG_GRADLE_PROJECT_mavenCentralPassword: + required: false + ORG_GRADLE_PROJECT_mavenCentralUsername: + required: false + ORG_GRADLE_PROJECT_signingInMemoryKey: + required: false + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: + required: false jobs: build: @@ -29,6 +37,10 @@ jobs: DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }} MAVEN_USERNAME: ${{ vars.MAVEN_USERNAME }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }} steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b2a3107db..8ed15f640 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,10 @@ jobs: DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }} MAVEN_USERNAME: ${{ vars.MAVEN_USERNAME }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }} release: needs: build From 9d85bed0ebaa7048106c8bbf6d166dc5eaf9c457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80?= Date: Thu, 3 Aug 2023 17:40:31 +0200 Subject: [PATCH 9/9] use lavalink lavaplayer fork 2.0.0 (#931) --- .../src/main/java/lavalink/server/player/AudioLoader.kt | 6 +++--- .../java/lavalink/server/player/AudioLoaderRestHandler.kt | 5 ++--- settings.gradle.kts | 6 +++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/player/AudioLoader.kt b/LavalinkServer/src/main/java/lavalink/server/player/AudioLoader.kt index fcdad0e1e..5987d372a 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/AudioLoader.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/AudioLoader.kt @@ -49,12 +49,12 @@ class AudioLoader( private val loadResult = CompletableFuture() private val used = AtomicBoolean(false) - fun load(identifier: String?): CompletionStage { + fun load(identifier: String?): LoadResult { val isUsed = used.getAndSet(true) check(!isUsed) { "This loader can only be used once per instance" } log.trace("Loading item with identifier $identifier") - audioPlayerManager.loadItem(identifier, this) - return loadResult + audioPlayerManager.loadItemSync(identifier, this) + return loadResult.get() } override fun trackLoaded(audioTrack: AudioTrack) { diff --git a/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.kt b/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.kt index 6847af31d..83114fc7e 100644 --- a/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.kt +++ b/LavalinkServer/src/main/java/lavalink/server/player/AudioLoaderRestHandler.kt @@ -51,10 +51,9 @@ class AudioLoaderRestHandler( fun loadTracks( request: HttpServletRequest, @RequestParam identifier: String - ): CompletionStage> { + ): ResponseEntity { log.info("Got request to load for identifier \"${identifier}\"") - return AudioLoader(audioPlayerManager, pluginInfoModifiers).load(identifier) - .thenApply { ResponseEntity.ok(it) } + return ResponseEntity.ok(AudioLoader(audioPlayerManager, pluginInfoModifiers).load(identifier)) } @GetMapping("/v4/decodetrack") diff --git a/settings.gradle.kts b/settings.gradle.kts index c35dfed60..d81126fa8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -36,10 +36,10 @@ fun VersionCatalogBuilder.spring() { } fun VersionCatalogBuilder.voice() { - version("lavaplayer", "74e6c4d728") + version("lavaplayer", "2.0.0") - library("lavaplayer", "com.github.walkyst.lavaplayer-fork", "lavaplayer").versionRef("lavaplayer") - library("lavaplayer-ip-rotator", "com.github.walkyst.lavaplayer-fork", "lavaplayer-ext-youtube-rotator").versionRef("lavaplayer") + library("lavaplayer", "dev.arbjerg", "lavaplayer").versionRef("lavaplayer") + library("lavaplayer-ip-rotator", "dev.arbjerg", "lavaplayer-ext-youtube-rotator").versionRef("lavaplayer") library("lavadsp", "dev.arbjerg", "lavadsp").version("0.7.8") library("koe", "moe.kyokobot.koe", "core").version("2.0.0-rc1")