dBeaver and CloudBeaver: Two Excellent Open Source Database Management Tools

My previous video ona a database amnagement tool was on MySQL Workbench, and got a pretty good response.  I did, however, have quite a few poeple ask about using it with Postgres SQL, which can be done, but is not super easy, and really not what the tool is for.

If you're interested in the MySQL Workbench software, check out my install and basic usage video here: https://www.youtube.com/watch?v=2pA6pl3q91c

In my search through the internet for all things great and open source, I came upon a suggestion for dBeaver https://dbeaver.io/, and after checking it out, found it to be an excellent open source database management tool.  Additionally, the dBeaver folks had made a new product called CloudBeaver which is a self-hosted, online / web browser based database management tool, so this week you get a two-fer (two for one).

Installing dBeaver

dBeaver is a desktop application that will run on Linux (my preferred platform), MacOS (my second choice personally), or Windows.   It has multiple installation options, but the two most promising for most Linux users is through the snap package, or via a flatpak installation depending on your specific OS distribution and preference.

You can find the dBeaver installation / download options on their page at https://dbeaver.io/download/

For those using snap (like me), the installation is quite simple:

sudo snap install dbeaver-ce

This will download and install dBeaver Community Edition on your Linux desktop / laptop / tablet / device, and you'll be up and running in minutes.

For those using / prefering flatpak, you can use the following command:

flatpak install flathub io.dbeaver.DBeaverCommunity

NOTE: I have not installed the flatpak, but this command is directly from the dBeaver install page as of Community Edition 7.2.4.

Once installed, start it up, and start connecting to your databases using the many, many drivers they have available.

If, however, you are a dev shop, IT shop, or are just looking for a tool with support and a few more drivers / features such as NoSQL support (e.g. MongoDB, etc), then you might want to check into the dBeaver Enterprise Edition https://dbeaver.com/ .

They have different licensing options, including a free Academic License for students and teachers, that could very well be worth your time and money.

Installing CloudBeaver

Next up, we have CloudBeaver.  This is a very cool offering from the dBeaver folks that provides a Web User Interface that is open source and self hostable.  The interface front-end is built on modern technology, and has a clean look and feel, and is laid out in a very similar fashion to dBeaver.

Installing CloudBeaver is quite simple, especially using Docker, and a simple script to help setup the container networking to allow you to connect to a locally hosted database (on the same machine you are running the CloudBeaver container).

Before you can do any of this, you need to have Docker installed.  You can follow this video (part 1) to get that done, and I have the commands and steps below for you if you use a Debian / Ubuntu spin of Linux.

Steps for Installing Docker-CE on Ubuntu / Debian

Below is a bash script to install docker-ce and setup the logged in user as part of the docker group so you don't have to use sudo to run the docker commands.

In the script, you should comment out (put a # in front of the line) the line for Ubuntu 18.04 if you use 20.04, or 20.04 if you use 18.04, and only run the line for your version.  You can copy / paste those lines for 18.10, 19.04, 19.10, etc (just put the right version label with those versions).

Create a file called "install-docker.sh", paste in the code with the appropriate line commented out for version, then save it.

Run the script with . ./install-docker.sh

Enter your sudo password when prompted, and let it run.  As long as you get no errors, you'll be set to run docker commands after you log out and back in.

#!/bin/bash
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

## for ubuntu 18.04
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"

## for ubuntu 20.04
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce -y

## now set user as part of docker group
sudo usermod -aG docker ${USER}

Now We Install CloudBeaver

Next, we need to create a folder in our server.  I just made one called "cloudbeaver".

mkdir cloudbeaver

Move into that folder, and create a new file called "install-cloudbeaver.sh"

cd cloudbeaver

nano install-cloudbeaver

Paste the following into that file.  You can copy with CTRL+C (or CMD+C for MacOS), then paste in the terminal with Shift+CTRL+V (or CMD+V for MacOS).

# Detect host machine IP Address (we need this when run in docker container)
export CB_LOCAL_HOST_ADDR=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1)

docker run -d \
    --name cloudbeaver \
    --restart unless-stopped \
    -p 8978:8978 \
    --add-host=host.docker.internal:${CB_LOCAL_HOST_ADDR} \
    -v /var/cloudbeaver/workspace:/opt/cloudbeaver/workspace \
    dbeaver/cloudbeaver:latest

Sve the file with CTRL+O, then press Enter / Return, and exit nano with CTRL+X.

NOTE: You'll need ifconfig installed if you don't have it already.  

You can check this by typing the command

ifconfig

into your terminal.  If you get an error, you can install it on Ubuntu by doing

sudo apt install net-tools -y

You may want to change the host portion of the port in the script if you want / need a differennt port.  Remember, the host portion is on the left of the colon : .  So in the 8978:8978 part, you would change the left side.  I made min 8121, so it now looks like this:

-p 8121:8978

After you have made adjustments, saved, and exited nano, you can run the script to get CloudBeaver installed.

. ./install-cloudbeaver.sh

Just relax while it installs.  When it's done, give it about a minute, just to be sure the app is up and running, then log into your server at the server IP address and the port you set.  My server IP is 192.168.7.125 and the port I set was 8121, so I navigated in my browser to:

http://192.168.7.125:8121

Next, you'll start the process to create your admin account, and setup your first database.  Check out the video at the top for the navigation and setup of CloudBeaver.