DEV Community

Franck Pachot for YugabyteDB

Posted on • Updated on

Gitpod with YugabyteDB image

This is a small doc from a PR I submitted to Gitpod's how-to guides but they prefer to have only a few databases in this guide (PostgreSQL, MySQL, Redis, MongoDB). No problem, I'll post this doc here.

YugabyteDB

If your project uses PostgreSQL, you can test it on YugabyteDB (Open Source PostgreSQL-compatible Distributed SQL database) with the dedicated YugabyteDB image. Simply base your .gitpod.dockerfile on:

FROM gitpod/workspace-yugabytedb
Enter fullscreen mode Exit fullscreen mode

and call ysqlsh instead of psql.

For the application, you connect to port 5433 instead of 5432.

This image starts a single-node YugabyteDB server, and you can use the ysqlsh CLI like you would do with psql:

$ ysqlsh

ysqlsh (11.2-YB-2.14.0.0-b0)
Type "help" for help.

yugabyte=# select * from yb_servers();

   host    | port | num_connections | node_type | cloud  |   region    | zone  | public_ip 
-----------+------+-----------------+-----------+--------+-------------+-------+-----------
 127.0.0.1 | 5433 |               0 | primary   | cloud1 | datacenter1 | rack1 | 127.0.0.1
(1 row)

yugabyte=# 
Enter fullscreen mode Exit fullscreen mode

Example

I used this for a previous blog post to test Mastodon with YugabyteDB instead of PostgreSQL. You can test it:
Open in Gitpod
Image description

Multi-node

If you want to play with a multi-node, as you need multiple network interfaces, it is better not to use this image but start YugabyteDB nodes in docker, as I do in my ybdemo:

Open in Gitpod

Image description

Oldest comments (0)