Deploy your own database with Supabase and Docker
Tags: database, supabase, docker, devops
Published: 2023-01-15 15:10:58

[![Substack Newsletter](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qbg4qlzlytxbzbvj97ia.png)](https://benoitpetit.substack.com/subscribe)

If you're seeking a robust and user-friendly NoSQL database solution, Supabase emerges as an ideal choice. As an open-source database service, Supabase facilitates the swift development of web and mobile applications akin to Firebase, yet harnessing the adaptability and potency of a PostgreSQL database.

_Prerequisites:_

- A computer equipped with Docker and Docker Compose
- A GitHub account for acquiring configuration files

## Step 1: Retrieve configuration files

The first step is to retrieve Supabase's configuration files from GitHub. To do this, go to the Supabase GitHub page (https://github.com/supabase/supabase) and download the configuration files by clicking on “Clone or download” and then “Download ZIP” (1.28 Gio) or line command.

### clone the repo
```bash
git clone https://github.com/supabase/supabase.git
```
### configuration
```bash
cd supabase/docker/
cp .env.example .env
```

## Step 2: Modify configuration `.env` file

> Before launching Supabase, essential configurations must be made. Open the `.env` file and adjust the following lines:

```bash
nano .env
```

- POSTGRES_USER: Replace "supabase" with your chosen database username.
- POSTGRES_PASSWORD: Replace "supabase" with your selected database password.
- PGDATA: Replace "/var/lib/postgresql/data/pgdata" with the preferred path for storing your database's data.

## Step 3: Launch Supabase with Docker

With configurations in place, initiate Supabase using Docker. Open a terminal, navigate to the directory housing the configuration files, and execute the following command:

in `supabase/docker/`
```
docker-compose up -d
```

This command initiates Supabase in daemon mode, running in the background, with startup messages visible in the terminal.

## Step 4: Configure Supabase

Upon Supabase launch, access the admin interface via `http://localhost:3000` in your browser. Log in with the username and password configured in the `.env` file. Post-login, create tables, populate data, and configure access permissions. Utilize the REST API to interact with your database from front-end or back-end applications.

In summary, establishing a self-hosted Supabase with Docker is a straightforward process requiring minimal configuration steps. This approach grants you the autonomy to deploy Supabase on your server or private cloud, offering enhanced control over data and performance. Delve into Supabase's advanced features to maximize its benefits fully.

See you later! Beπ ✨

---

> 🫶 If you appreciate my posts and would like to support my work, feel free to make a donation by clicking on the Stripe Sponsor link below or by scanning the QR code. [lien Stripe Sponsor](https://donate.stripe.com/00g6pJ6R19MJ15S7ss)

---

[![Stripe Sponsor](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ohkf7lrymedkort4w9iz.png)](https://donate.stripe.com/00g6pJ6R19MJ15S7ss)

--- 

👀 See me here : 

- [Substack](https://benoitpetit.substack.com/subscribe)
- [Mastodon](https://piaille.fr/@codingben) 
- [(X) Twitter](https://twitter.com/codingben_)
- [Github](https://github.com/benoitpetit)
- [NPM Packages](https://www.npmjs.com/~codingben)
- [benoitpetit.dev](https://benoitpetit.dev)
- [Dev.to](https://dev.to/benoitpetit)