DEV Community

Cover image for Deploy your own database with Supabase and Docker in a few simple steps
ben.
ben.

Posted on

Deploy your own database with Supabase and Docker in a few simple steps

If you are looking for a powerful and easy-to-use NoSQL database solution, then Supabase might be the perfect choice for you. Supabase is an open-source database service that allows you to quickly create web and mobile applications using Firebase, but with the flexibility and power of a PostgreSQL database.

Prerequisites:

  • A computer with Docker and Docker Compose installed
  • A GitHub account (to retrieve 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”.

Once you have downloaded the files, unzip them in a directory of your choice.

Step 2: Modify configuration files

Before starting Supabase, you need to configure a few settings for your installation. Open the “docker-compose.yml” file and modify the following lines:

  • POSTGRES_USER: replace “supabase” with your database's username
  • POSTGRES_PASSWORD: replace “supabase” with your database's password
  • PGDATA: replace “/var/lib/postgresql/data/pgdata” with the path where you want to store your database's data

Step 3: Start Supabase with Docker

Once you have configured the settings, you can now start Supabase using Docker. Open a terminal and navigate to the directory where you unzipped the configuration files. Then, type the following command:

docker-compose up -d
Enter fullscreen mode Exit fullscreen mode

This will start Supabase in daemon mode (in the background) and you will be able to see the startup messages in the terminal.

Step 4: Configure Supabase

Once Supabase is started, you can access the admin interface by accessing the URL “http://localhost:3000” in your browser. You will then need to log in with the username and password you configured in the “docker-compose.yml” file.

Once logged in, you can create tables, add data, and configure access permissions. You can also use the REST API to interact with your database from a front-end or back-end application.

In summary, setting up a self-hosted Supabase with Docker is a simple process that only requires a few configuration steps. This gives you the freedom to deploy Supabase on your own server or private cloud, with more flexibility and control over data and performance. Don't hesitate to explore Supabase's advanced features to fully benefit from its advantages.

Latest comments (0)