DEV Community

Cover image for Deploy your own database with Supabase and Docker
Beπ ✨
Beπ ✨

Posted on • Updated on • Originally published at benoitpetit.dev

Deploy your own database with Supabase and Docker

Substack Newsletter

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

git clone https://github.com/supabase/supabase.git
Enter fullscreen mode Exit fullscreen mode

configuration

cd supabase/docker/
cp .env.example .env
Enter fullscreen mode Exit fullscreen mode

Step 2: Modify configuration .env file

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

nano .env
Enter fullscreen mode Exit fullscreen mode
  • 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
Enter fullscreen mode Exit fullscreen mode

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


Stripe Sponsor


👀 See me here :

Top comments (0)