Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@
{
"label": "Run Backend CE",
"type": "shell",
"windows": {
"command": "./run-cloudbeaver-server.bat"
},
"osx": {
"command": "./run-cloudbeaver-server.sh"
},
"command": "java CloudBeaverLauncher.java",
"options": {
"cwd": "${workspaceFolder}/deploy/cloudbeaver"
}
Expand Down
2 changes: 1 addition & 1 deletion deploy/build-frontend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ echo "Copy static content"

cp -rp ../webapp/packages/product-default/lib/* cloudbeaver/web

echo "Cloudbeaver is ready. Run run-cloudbeaver-server.sh in cloudbeaver folder to start the server."
echo "Cloudbeaver is ready. Run 'java CloudBeaverLauncher.java' in cloudbeaver folder to start the server."
2 changes: 1 addition & 1 deletion deploy/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ echo "Copy static content"

xcopy /E /Q ..\webapp\packages\product-default\lib cloudbeaver\web >NUL

echo "Cloudbeaver is ready. Run run-cloudbeaver-server.bat in cloudbeaver folder to start the server."
echo "Cloudbeaver is ready. Run 'java CloudBeaverLauncher.java' in cloudbeaver folder to start the server."

pause
20 changes: 20 additions & 0 deletions deploy/docker/cloudbeaver-ce-distroless/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM eclipse-temurin:25-jdk-noble AS builder

COPY scripts/CloudBeaverLauncher.java /CloudBeaverLauncher.java
RUN javac --release 25 CloudBeaverLauncher.java

### Actual image start here
FROM gcr.io/distroless/java25-debian13:nonroot

LABEL org.opencontainers.image.authors="DBeaver Corp, devops@dbeaver.com"

COPY --chown=8978:8978 cloudbeaver /opt/cloudbeaver
COPY --from=builder --chown=8978:8978 /CloudBeaverLauncher.class /opt/cloudbeaver/launcher/
USER 8978:8978
WORKDIR /opt/cloudbeaver
EXPOSE 8978

# UID 8978 has no passwd entry in distroless, so set a writable home for both the launcher and server JVMs.
ENV HOME=/opt/cloudbeaver
ENV JAVA_TOOL_OPTIONS="-Duser.home=/opt/cloudbeaver"
ENTRYPOINT ["/usr/bin/java", "-cp", "/opt/cloudbeaver/launcher", "CloudBeaverLauncher"]
5 changes: 4 additions & 1 deletion deploy/docker/cloudbeaver-ce/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ RUN groupadd -g $DBEAVER_GID dbeaver && \

COPY cloudbeaver /opt/cloudbeaver
COPY scripts/launch-product.sh /opt/cloudbeaver/launch-product.sh
COPY scripts/CloudBeaverLauncher.java /opt/cloudbeaver/CloudBeaverLauncher.java

EXPOSE 8978
RUN find /opt/cloudbeaver -type d -exec chmod 775 {} \;
WORKDIR /opt/cloudbeaver/

RUN chmod +x "run-cloudbeaver-server.sh" "/opt/cloudbeaver/launch-product.sh"
RUN javac --release 25 CloudBeaverLauncher.java && \
rm CloudBeaverLauncher.java && \
chmod +x "/opt/cloudbeaver/launch-product.sh"

ENTRYPOINT ["./launch-product.sh"]
120 changes: 120 additions & 0 deletions deploy/scripts/CloudBeaverLauncher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2026 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.TimeUnit;

public final class CloudBeaverLauncher {
static void main(String[] args) throws Exception {
initializeWorkspace();

var command = new ArrayList<String>();
command.add(Path.of(System.getProperty("java.home", "/usr"), "bin", javaExecutable()).toString());
addJavaOptions(command);
command.addAll(List.of(
"-Dfile.encoding=UTF-8",
"--enable-native-access=ALL-UNNAMED",
"--add-modules=ALL-DEFAULT",
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens=java.base/java.net=ALL-UNNAMED",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-opens=java.base/java.nio.charset=ALL-UNNAMED",
"--add-opens=java.base/java.text=ALL-UNNAMED",
"--add-opens=java.base/java.time=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED",
"--add-opens=java.base/jdk.internal.vm=ALL-UNNAMED",
"--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens=java.base/sun.security.ssl=ALL-UNNAMED",
"--add-opens=java.base/sun.security.util=ALL-UNNAMED",
"--add-opens=java.security.jgss/sun.security.jgss=ALL-UNNAMED",
"--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED",
"--add-opens=java.sql/java.sql=ALL-UNNAMED"
));
command.add("-jar");
command.add(findLauncherJar().toString());
command.addAll(Arrays.asList(args));
command.addAll(List.of(
"-product",
"io.cloudbeaver.product.ce.product",
"-web-config",
Path.of("conf", "cloudbeaver.conf").toString(),
"-nl",
"en",
"-registryMultiLanguage"
));

System.err.println("Starting CloudBeaver Server");
var process = new ProcessBuilder(command).inheritIO().start();
var shutdownHook = Thread.ofPlatform().name("cloudbeaver-shutdown").unstarted(() -> stop(process));
Runtime.getRuntime().addShutdownHook(shutdownHook);
int exitCode = process.waitFor();
Runtime.getRuntime().removeShutdownHook(shutdownHook);
System.exit(exitCode);
}

private static void initializeWorkspace() throws Exception {
var workspace = Path.of("workspace");
if (Files.notExists(workspace.resolve(".metadata"))) {
Files.createDirectories(workspace.resolve(".metadata"));
var dataSources = workspace.resolve("GlobalConfiguration").resolve(".dbeaver").resolve("data-sources.json");
Files.createDirectories(dataSources.getParent());
if (Files.notExists(dataSources)) {
Files.copy(Path.of("conf", "initial-data-sources.conf"), dataSources);
}
}
}

private static Path findLauncherJar() throws Exception {
try (var plugins = Files.list(Path.of("server", "plugins"))) {
return plugins
.filter(Files::isRegularFile)
.filter(path -> path.getFileName().toString().startsWith("org.jkiss.dbeaver.launcher"))
.filter(path -> path.getFileName().toString().endsWith(".jar"))
.sorted()
.findFirst()
.orElseThrow(() -> new IllegalStateException("CloudBeaver launcher JAR not found"));
}
}

private static void addJavaOptions(Collection<? super String> command) {
var javaOptions = System.getenv("JAVA_OPTS");
if (javaOptions != null && !javaOptions.isBlank()) {
command.addAll(Arrays.asList(javaOptions.trim().split("\\s+")));
}
}

private static String javaExecutable() {
return System.getProperty("os.name", "").startsWith("Windows") ? "java.exe" : "java";
}

private static void stop(Process process) {
process.destroy();
try {
if (!process.waitFor(10, TimeUnit.SECONDS)) {
process.destroyForcibly();
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
process.destroyForcibly();
}
}

private CloudBeaverLauncher() {
// Intentionally
}
}
2 changes: 1 addition & 1 deletion deploy/scripts/cbvr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ if [[ $# -eq 0 ]] ;
fi
set -- "$@" -cli-mode

source run-cloudbeaver-server.sh "$@"
exec java CloudBeaverLauncher.java "$@"
7 changes: 3 additions & 4 deletions deploy/scripts/launch-product.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ if [ "$(id -u)" -eq 0 ]; then
TARGET_UID=${TARGET_UID:-$DBEAVER_UID}
TARGET_GID=${TARGET_GID:-$DBEAVER_GID}

chown -R $DBEAVER_UID:$DBEAVER_GID $PWD/workspace
# Execute run-cloudbeaver-server.sh as the dbeaver user with the JAVA_HOME and PATH environment variables
exec su "$TARGET_USER" -c "JAVA_HOME=$JAVA_HOME PATH=$PATH ./run-cloudbeaver-server.sh $*"
chown -R "$DBEAVER_UID":"$DBEAVER_GID" "$PWD/workspace"
exec su "$TARGET_USER" -s /bin/bash -c 'exec "$JAVA_HOME/bin/java" -cp /opt/cloudbeaver CloudBeaverLauncher "$@"' -- "$@"
else
exec ./run-cloudbeaver-server.sh "$@"
exec "$JAVA_HOME/bin/java" -cp /opt/cloudbeaver CloudBeaverLauncher "$@"
fi
47 changes: 0 additions & 47 deletions deploy/scripts/run-cloudbeaver-server.bat

This file was deleted.

41 changes: 0 additions & 41 deletions deploy/scripts/run-cloudbeaver-server.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Running server
========================
1. View and modify server configuration before the first start.
Validate init-data.conf - you won't be able to change these parameters after the first server start.
2. Execute run-cloudbeaver-server.sh script in the root directory.
2. Execute "java CloudBeaverLauncher.java" in the root directory.

Command line parameters
========================
Expand Down
11 changes: 3 additions & 8 deletions webapp/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,11 @@ Welcome! Follow these steps to install and run the frontend dev server.

3. **Run the Backend Server**

Start the backend server by running the execution script.
Start the backend server by running the launcher.

*For macOS/Linux:*
```bash
./run-cloudbeaver-server.sh
```

*For Windows:*
*For all platforms:*
```bash
./run-cloudbeaver-server.bat
java CloudBeaverLauncher.java
```

4. **Navigate to the Webapp Directory**
Expand Down
Loading