Skip to content

Manual Installation

This guide explains how to manually set up pgflow and Edge Worker without using the automatic installer. While we recommend using the pgflow install command for most users, this manual approach can be helpful in certain scenarios:

  • When you need more control over the installation process
  • When troubleshooting installation issues
  • When integrating with custom deployment pipelines
  • When you want to understand what happens behind the scenes

To manually install the required migration files:

Download the latest release

  1. Go to the pgflow GitHub releases page
  2. Download the source code zip file for the latest release
  3. Extract the downloaded zip file
  4. Create your migrations directory if it doesn’t exist: mkdir -p supabase/migrations

Copy the migration files

Copy files from the extracted archive’s pkgs/core/supabase/migrations/*.sql to your project’s supabase/migrations/ folder.

Apply the migrations

After copying the migration files, apply them:

npx supabase migration up

Edge Worker needs environment variables for database connection and logging.

Create a .env file in your supabase/functions directory with the following content:

Terminal window
# Database connection string for Edge Worker and pgflow
EDGE_WORKER_DB_URL="postgresql://postgres.pooler-dev:postgres@pooler:6543/postgres"
# Log level (options: debug, info, warn, error)
EDGE_WORKER_LOG_LEVEL="info"

Modify the db.pooler section in your supabase/config.toml file to enable pooler and make sure that db.pool_mode is set to "transaction".

[db.pooler]
enabled = false
enabled = true
# Port to use for the local connection pooler.
port = 54329
# Specifies when a server connection can be reused by other clients.
# Configure one of the supported pooler modes: `transaction`, `session`.
pool_mode = "transaction"
# How many server connections to allow per user/database pair.
default_pool_size = 20
# Maximum number of client connections allowed.
max_client_conn = 100

Change the Edge Runtime policy to per_worker to enable Background Tasks (see more in Testing background tasks locally).

[edge_runtime]
enabled = true
# Configure one of the supported request policies: `oneshot`, `per_worker`.
# Use `oneshot` for hot reload, or `per_worker` for load testing.
policy = "oneshot"
policy = "per_worker"
# Port to attach the Chrome inspector for debugging edge functions.
inspector_port = 8083

To apply the changes, restart Supabase:

npx supabase stop
npx supabase start

When following these steps, the installation sets up:

  • worker schema with tables for worker management and message queuing
  • pgflow schema with tables for workflows and execution state
  • SQL functions for worker lifecycle management and workflow operations

The same migrations and configuration are used for both Edge Worker and pgflow, as pgflow builds on top of Edge Worker’s functionality.

The manual installation process essentially performs the same steps as the automatic pgflow install command, but gives you direct control over each step. The automatic installer:

  1. Detects your Supabase project directory
  2. Updates your config.toml file
  3. Copies the migration files
  4. Creates the environment file
  5. Provides helpful feedback during installation

If you encounter any issues with the automatic installer, this manual approach can help you identify and fix specific problems in your setup.

After completing the installation, verify it by running these queries:

-- Verify worker schema
SELECT * FROM pgflow.workers LIMIT 1;
-- Verify pgflow schema
SELECT * FROM pgflow.flows LIMIT 1;

If these queries run without errors (they may return no rows, which is expected for a fresh installation), your installation was successful and you can proceed to using the features.