Docker Compose

Self-hosting with docker-compose.

Prerequisites

Instructions for Linux OSes:

sudo yum install -y git zip yum-utils

# Install and setup Docker for non-root user
yes | sudo  yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yes | sudo  yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl enable --now docker
sudo usermod -aG docker $USER
newgrp docker

# Install Deno
curl -fsSL https://deno.land/install.sh > /tmp/install.sh
chmod +x /tmp/install.sh
sudo env DENO_INSTALL=/usr/local /tmp/install.sh
rm /tmp/install.sh

Self-hosting with Docker Compose

Download source code

Clone the code using git:

git clone https://github.com/space-operator/flow-backend

Go to docker folder:

cd flow-backend/docker

Every commands in this tutorial must be run in flow-backend/docker folder.

Generate secrets and configurations

Our Docker Compose setup needs 2 configuration files, both are located in flow-backend/docker folder:

  • .env : dotenv file containing environment variables

  • .config.toml: configuration file used by flow-server.

Template for these files are in env.example and flow-server-config.toml .

Generate secrets and config files for your server:

./gen-secrets.ts

Generated secrets are saved in .env and .config.toml files.

The script use env.example and flow-server-config.toml as templates, you can edit them before running the script to customize values.

Start and wait for containers to be ready:

docker compose up -d --wait

Port binding:

  • Supabase: port 8000

  • Flow server: port 8080

  • PostgreSQL: port 5432

To see Supabase Dashboard:

  • Open .env file to see DASHBOARD_USERNAME and DASHBOARD_PASSWORD values:

cat .env | grep DASHBOARD

Export your data and use them in self-hosted server

Follow steps from here

Stop and clean up

To stop services:

docker compose down

Stop and clean up all data:

docker compose down -v

Last updated

Was this helpful?