dbeaver / cloudbeaver

Cloud Database Manager
https://dbeaver.com/
Apache License 2.0
3.52k stars 382 forks source link

Vertica Driver Configuration #2957

Closed geleou closed 1 month ago

geleou commented 1 month ago

Greetings! I'm currently in the process of deploying Cloudbeaver CE within a Docker container, attempting to establish comms with a Vertica Database.

The first issue I'd like to point out, is that if someone wishes to deploy Cloudbeaver from within a container (I suppose that's something quite natural for a cloud-oriented application), there seems to be no way of configuring a 3rd party driver (like Vertica), without having to rebuild the image yourself (or run the app locally). Why would configuring a separate database driver require for building the app from the ground up (unless I'm missing something)? Also there should be more clear instructions on how to actually run the app from within a container in that case (the default Dockerfile mentioned here will not work - it clones the already built git repo as is).

The other issue I'm facing is that even though I've followed all steps to adding a new Vertica driver in cloudbeaver, the web UI does not seem to be able to list it when creating a new connection.

Steps to reproduce:

  1. Clone the repo: git clone https://github.com/dbeaver/cloudbeaver.git
  2. Create a Dockerfile for building and running Cloudbeaver :
    
    # Use a base image with Ubuntu 22.04
    FROM ubuntu:22.04

Set environment variables to prevent interactive prompts

ENV DEBIAN_FRONTEND=noninteractive

Install required packages

RUN apt-get update && apt-get install -y \ curl \ gnupg2 \ openjdk-17-jdk \ git \ build-essential

Install Maven 3.9.0 manually to ensure the correct version

RUN curl -sL https://archive.apache.org/dist/maven/maven-3/3.9.0/binaries/apache-maven-3.9.0-bin.tar.gz -o /tmp/maven.tar.gz && \ tar -xzf /tmp/maven.tar.gz -C /opt && \ ln -s /opt/apache-maven-3.9.0 /opt/maven && \ ln -s /opt/maven/bin/mvn /usr/bin/mvn

Add Yarn repository and install Node.js 20.x and Yarn

RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ curl -sL https://deb.nodesource.com/setup_20.x | bash - && \ apt-get update && apt-get install -y yarn nodejs

Uninstall conflicting packages related to Node.js 12.x

RUN apt-get remove -y libnode72 libnode-dev

RUN apt-get purge -y libnode72 libnode-dev || true

Set up working directory

WORKDIR /opt/cloudbeaver

Copy the local CloudBeaver repository into the container

COPY cloudbeaver/. .

Set the working directory to the deploy folder

WORKDIR /opt/cloudbeaver/deploy

Build the application using the existing build.sh script

RUN ./build.sh

Expose the default port CloudBeaver uses

EXPOSE 8978

WORKDIR /opt/cloudbeaver/deploy/cloudbeaver

Set up the entry point to run the CloudBeaver server

RUN chmod +x run-server.sh

Set the command to run the script

ENTRYPOINT ["./run-server.sh"]


3. Create a _vertica_ folder within _cloudbeaver/server/drivers_, paste the appropriate driver jar and create a pom.xml, that looks like this:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<artifactId>drivers.vertica</artifactId>
<version>1.0.0</version>
<parent>
    <groupId>io.cloudbeaver</groupId>
    <artifactId>drivers</artifactId>
    <version>1.0.0</version>
    <relativePath>../</relativePath>
</parent>

<properties>
    <deps.output.dir>vertica</deps.output.dir>
</properties>

<dependencies>
    <dependency>
        <groupId>com.vertica</groupId>
        <artifactId>vertica-jdbc</artifactId>
        <version>24.1.0-0</version>
        <scope>system</scope>
        <systemPath>/opt/cloudbeaver/server/drivers/vertica/vertica-jdbc-24.1.0-0.jar</systemPath>
    </dependency>
</dependencies>


4. Update the pom.xml of the _cloudbeaver/drivers_ directory:

...

clickhouse_com ... vertica

...


5. Update the _cloudbeaver/server/bundles/io.cloudbeaver.resources.drivers.base/plugins.xml_:

... <?xml version="1.0" encoding="UTF-8"?>

... ... ...

...


6. Create a docker-compose.yml:

services: cloudbeaver: image: cloudbeaver-vertica container_name: cloudbeaver restart: unless-stopped

ports:

#   - "8978:8978" 
volumes:
  - ./workspace:/opt/cloudbeaver/deploy/cloudbeaver/workspace
  - ./logs:/opt/cloudbeaver/deploy/cloudbeaver/logs          
  - ./cloudbeaver.conf:/opt/cloudbeaver/deploy/cloudbeaver/conf/cloudbeaver.conf 

7. Build & Run:

docker build -t cloudbeaver-vertica . docker compose up -d && docker compose logs -f



You've done a truly wonderful job to bringing the DBeaver client to cloud environments but I think documentation
is lacking in many aspects. I'd be more than happy to contribute if I somehow can.

Thank you! 
geleou commented 1 month ago

I forgot the step to build and run the Docker image:

  1. Create a docker-compose.yml:
    services:
    cloudbeaver:
    image: cloudbeaver-vertica
    container_name: cloudbeaver
    restart: unless-stopped
  2. Build and run:
    docker build -t cloudbeaver-vertica .
    docker compose up -d && docker compose logs -f
LonwoLonwo commented 1 month ago

Hello @geleou

Could you please take a look at this ticket? https://github.com/dbeaver/cloudbeaver/issues/2611 Also, why do you use the PostgreSQL driver for Vertica? Or is this an example of configuration?

EvgeniaBzzz commented 1 month ago

Hi @geleou We appreciate your interest and feedback 🦫

Answering your questions:

  1. CloudBeaver Community Edition provides the ability to use the most popular drivers out of the box. Other drivers you can add yourself by following thе instruction. Vertica is included in the Enterprise Edition, along with many other drivers. You can explore it in a 14-day free trial version.
  2. We are constantly working on documentation, but sometimes the speed of change outpaces our writing capabilities. We'll update Run Docker article.
  3. For Vertica, please try to specify <driver id=vertica:vertica-jdbc-8"/>, it's working one.
geleou commented 1 month ago

Hello @geleou

Could you please take a look at this ticket? #2611 Also, why do you use the PostgreSQL driver for Vertica? Or is this an example of configuration?

My mistake I copy pasted the postgres pom.xml not the Vertica.

<project xmlns="http://maven.apache.org/POM/4.0.0" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>drivers.vertica</artifactId>
    <version>1.0.0</version>
    <parent>
        <groupId>io.cloudbeaver</groupId>
        <artifactId>drivers</artifactId>
        <version>1.0.0</version>
        <relativePath>../</relativePath>
    </parent>

    <properties>
        <deps.output.dir>vertica</deps.output.dir>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.vertica</groupId>
            <artifactId>vertica-jdbc</artifactId>
            <version>24.1.0-0</version>
            <scope>system</scope>
            <systemPath>/opt/cloudbeaver/server/drivers/vertica/vertica-jdbc-24.1.0-0.jar</systemPath>
        </dependency>
    </dependencies>

</project>

I will try out the suggested solution and will come back. Thank you so much! <3

geleou commented 1 month ago

It works!!! Thank you so much!! <3

LonwoLonwo commented 1 month ago

Thanks for the feedback.