Better Developer Experience: Getting Started with YugabyteDB on Gitpod
Tags: gitpod, developer, distributedsql, yugabytedb
Published: 2022-03-01 07:34:35

---
title: Better Developer Experience: Getting Started with YugabyteDB on Gitpod
published: true
date: 2022-02-24 23:34:57 UTC
tags: Gitpod,Developer,DistributedSQL,YugabyteDB
canonical_url: https://blog.yugabyte.com/better-developer-experience-yugabytedb-gitpod/
---

Developer onboarding and experience gets simplified every day. But while developers use many modern software development techniques—including 12-factor, cloud native, and continuous integration—developer onboarding remains a challenge. Therefore, what developers need is an integrated, self-contained platform that helps them get started with ease. 

[Gitpod](https://www.gitpod.io/) is one such way we can steer into that problem space to create a better developer experience. More specifically, Gitpod provides git-based, fully automated, integrated cloud-native development workflows with the prerequisites configured. This “GitDev” approach offers a preconfigured environment that seamlessly provides a consistent development environment for stream-aligned teams.

In this post, we’ll explore how to get started with [YugabyteDB](https://www.yugabyte.com/yugabytedb/) in a Gitpod-driven workspace covering the following workflows:

- Creating a single-node instance
- Creating a cluster with multiple nodes
- Customizing the cluster configuration

## First steps

Gitpod is a configurable, ready-to-code cloud development environment accessible via a browser. A Gitpod workspace includes everything we need to develop, such as the Visual Studio Code editor, common languages, tools, and utilities. Instantly, this sets up a cloud-hosted, containerized, and customizable editing environment that is ready to go.

Gitpod doesn’t require anything other than a code editor and Git CLI on your local computer. Therefore, much of the development happens in the cloud through a web browser. But you can refer to the [QuickStart](https://www.gitpod.io/docs/quickstart) section to get started with Gitpod. 

We’ll use GitHub as our source code repository. For starters, create a new empty repository **yb-git-pod** and clone that to the local workstation.

| **git clone https://github.com/[user]/yb-git-pod.git**

You can find the complete code in this [GitHub repository](https://github.com/srinivasa-vasu/yb-git-pod).

## Creating the base image

Let’s make a new file— **.gitpod.Dockerfile** —inside the _yb-git-pod_ directory we cloned to the local workstation. The content of the YugabyteDB Dockerfile is as follows:

![Creating the base image with YugabyteDB on Gitpod](https://blog.yugabyte.com/wp-content/uploads/2022/02/Screen-Shot-2022-02-24-at-4.02.36-PM.png)

## Creating a single-node instance

Next, let’s make a new file: **.gitpod.yml**. The content of this file is as follows:

![Creating a single-node instance with YugabyteDB on Gitpod](https://blog.yugabyte.com/wp-content/uploads/2022/02/Screen-Shot-2022-02-24-at-4.05.37-PM.png)

Next, commit .gitpod.Dockerfile and .gitpod.yml to your GitHub repository. To initialize the Gitpod workspace, launch https://gitpod.io/#[REPO_URL] in a browser window. Replace [REPO_URL] with your repository URL.

![Launcing a Gitpod workspace.](https://blog.yugabyte.com/wp-content/uploads/2022/02/Screen-Shot-2022-02-24-at-4.06.57-PM.png)

A Gitpod workspace gets created based on the definition of the .gitpod.yml file. The **“yugabyted start”** statement can be part of the “before” or “command” task. These two tasks get executed during the initial workspace creation and re-initialization phases. YugabyteDB starts during the initialization phase, and upon completion, a terminal launches with the ysql shell prompt.

Gitpod manages the exposed ports in the Dockerfile definition. Specifically, it automatically creates the port-forwarding rules. We will get links to access the Web-UI right from this same interface.

![Launching a Gitpod workspace.](https://blog.yugabyte.com/wp-content/uploads/2022/02/Screen-Shot-2022-02-24-at-4.08.02-PM.png)

## Creating a cluster with multiple nodes

We need to update .gitpod.yml with the following multi-node configuration. The complete multi-node configuration spec is available in the .gitpod-cluster.yml file in the repository.

![Creating a cluster with multiple nodes.](https://blog.yugabyte.com/wp-content/uploads/2022/02/Screen-Shot-2022-02-24-at-4.10.30-PM.png)

Finally, commit .gitpod.yml with this updated configuration to your GitHub repository and re-initialize the Gitpod workspace https://gitpod.io/#[REPO_URL].

Specifically, this configuration will initialize a three-node cluster based on the loopback interface configuration. The node initialization is sequenced properly using _gp sync-done_ and _gp sync-await_ calls.

## Customizing the cluster configuration

The following config builds on top of the previous cluster configuration, providing [GFlags](https://docs.yugabyte.com/latest/yugabyte-platform/manage-deployments/edit-config-flags/) and cluster-configuration customization. However, we have configured the cluster with custom placement info in the below snippet. The complete multi-node custom configuration spec is available in the .gitpod-cluster-config.yml file in the repository.

![Customizing the cluster configuration.](https://blog.yugabyte.com/wp-content/uploads/2022/02/Screen-Shot-2022-02-24-at-4.24.26-PM.png)

Finally, commit .gitpod.yml with this updated configuration to your GitHub repository and re-initialize the Gitpod workspace https://gitpod.io/#[REPO_URL].

The Web-UI console now reflects the custom configuration changes, as illustrated below:

![The Gitpod Web-UI console.](https://blog.yugabyte.com/wp-content/uploads/2022/02/Screen-Shot-2022-02-24-at-4.19.13-PM.png)

## Conclusion

Additionally, you can check out [this article](https://docs.yugabyte.com/latest/develop/gitdev/) to learn more about integrating microservices with a Gitpod-powered YugabyteDB workspace to improve developer experience. Specifically, we have a pull request submitted for a dedicated YugabyteDB base image for Gitpod. 

Finally, if interested, you can follow [this pull request](https://github.com/gitpod-io/workspace-images/pull/604) to track our progress. Either way, we hope you give this short tutorial a shot.

_Any questions? Let us know what you think in the [YugabyteDB Community Slack channel](https://www.yugabyte.com/community/)._

The post [Better Developer Experience: Getting Started with YugabyteDB on Gitpod](https://blog.yugabyte.com/better-developer-experience-yugabytedb-gitpod/) appeared first on [The Distributed SQL Blog](https://blog.yugabyte.com).