Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 64 additions & 64 deletions .docker/docker-compose-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,70 +47,70 @@ services:
PGBOUNCER_IGNORE_STARTUP_PARAMETERS: "extra_float_digits, options"
PGBOUNCER_STATS_USERS: postgres

supavisor:
image: supabase/supavisor:1.1.23
depends_on:
multitenant_db:
condition: service_healthy
tenant_db:
condition: service_healthy
ports:
- 4000:4000
- 5452:5452
- 6543:6543
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4000/api/health"]
interval: 2s
timeout: 10s
retries: 5
environment:
PORT: 4000
PROXY_PORT_SESSION: 5452
PROXY_PORT_TRANSACTION: 6543
DATABASE_URL: "ecto://postgres:postgres@multitenant_db:5432/postgres"
CLUSTER_POSTGRES: "true"
SECRET_KEY_BASE: "12345678901234567890121234567890123456789012345678903212345678901234567890123456789032123456789012345678901234567890323456789032"
VAULT_ENC_KEY: "12345678901234567890123456789032"
API_JWT_SECRET: "dev"
METRICS_JWT_SECRET: "dev"
REGION: "local"
ERL_AFLAGS: -proto_dist inet_tcp
command: sh -c "/app/bin/migrate && /app/bin/server"

supavisor_setup:
image: supabase/supavisor:1.1.23
command: |
curl -X PUT \
"http://supavisor:4000/api/tenants/bjhaohmqunupljrqypxz" \
--header "Accept: application/json" \
--header "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJvbGUiOiJhbm9uIiwiaWF0IjoxNjQ1MTkyODI0LCJleHAiOjE5NjA3Njg4MjR9.M9jrxyvPLkUxWgOYSf5dNdJ8v_eRrq810ShFRT8N-6M" \
--header "Content-Type: application/json" \
--data-raw "{
\"tenant\": {
\"db_host\": \"tenant_db\",
\"db_port\": 5432,
\"db_database\": \"postgres\",
\"ip_version\": \"auto\",
\"require_user\": true,
\"upstream_ssl\": false,
\"enforce_ssl\": false,
\"default_max_clients\": 200,
\"default_pool_size\": 15,
\"users\": [
{
\"db_user\": \"postgres\",
\"db_password\": \"postgres\",
\"mode_type\": \"transaction\",
\"pool_size\": 15,
\"max_clients\": 200,
\"pool_checkout_timeout\": 5000
}
]
}
}"
depends_on:
supavisor:
condition: service_healthy
# supavisor:
# image: supabase/supavisor:1.1.23
# depends_on:
# multitenant_db:
# condition: service_healthy
# tenant_db:
# condition: service_healthy
# ports:
# - 4000:4000
# - 5452:5452
# - 6543:6543
# healthcheck:
# test: ["CMD", "curl", "-f", "http://localhost:4000/api/health"]
# interval: 2s
# timeout: 10s
# retries: 5
# environment:
# PORT: 4000
# PROXY_PORT_SESSION: 5452
# PROXY_PORT_TRANSACTION: 6543
# DATABASE_URL: "ecto://postgres:postgres@multitenant_db:5432/postgres"
# CLUSTER_POSTGRES: "true"
# SECRET_KEY_BASE: "12345678901234567890121234567890123456789012345678903212345678901234567890123456789032123456789012345678901234567890323456789032"
# VAULT_ENC_KEY: "12345678901234567890123456789032"
# API_JWT_SECRET: "dev"
# METRICS_JWT_SECRET: "dev"
# REGION: "local"
# ERL_AFLAGS: -proto_dist inet_tcp
# command: sh -c "/app/bin/migrate && /app/bin/server"
#
# supavisor_setup:
# image: supabase/supavisor:1.1.23
# command: |
# curl -X PUT \
# "http://supavisor:4000/api/tenants/bjhaohmqunupljrqypxz" \
# --header "Accept: application/json" \
# --header "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJvbGUiOiJhbm9uIiwiaWF0IjoxNjQ1MTkyODI0LCJleHAiOjE5NjA3Njg4MjR9.M9jrxyvPLkUxWgOYSf5dNdJ8v_eRrq810ShFRT8N-6M" \
# --header "Content-Type: application/json" \
# --data-raw "{
# \"tenant\": {
# \"db_host\": \"tenant_db\",
# \"db_port\": 5432,
# \"db_database\": \"postgres\",
# \"ip_version\": \"auto\",
# \"require_user\": true,
# \"upstream_ssl\": false,
# \"enforce_ssl\": false,
# \"default_max_clients\": 200,
# \"default_pool_size\": 15,
# \"users\": [
# {
# \"db_user\": \"postgres\",
# \"db_password\": \"postgres\",
# \"mode_type\": \"transaction\",
# \"pool_size\": 15,
# \"max_clients\": 200,
# \"pool_checkout_timeout\": 5000
# }
# ]
# }
# }"
# depends_on:
# supavisor:
# condition: service_healthy

minio:
image: minio/minio
Expand Down
3 changes: 2 additions & 1 deletion migrations/multitenant/0023-iceberg-catalog-id.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ DO $$
ALTER TABLE iceberg_catalogs RENAME COLUMN id TO name;
END IF;

ALTER TABLE iceberg_catalogs ADD COLUMN IF NOT EXISTS id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY;
ALTER TABLE iceberg_catalogs ADD COLUMN IF NOT EXISTS id uuid NOT NULL DEFAULT gen_random_uuid();
ALTER TABLE iceberg_catalogs ADD PRIMARY KEY (id);
ALTER TABLE iceberg_catalogs ADD COLUMN IF NOT EXISTS deleted_at timestamptz NULL;

CREATE INDEX IF NOT EXISTS iceberg_catalogs_unique_name_idx
Expand Down
9 changes: 7 additions & 2 deletions migrations/tenant/0048-iceberg-catalog-ids.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ DO $$
BEGIN

IF is_multitenant = false THEN
ALTER TABLE storage.iceberg_namespaces DROP CONSTRAINT IF EXISTS iceberg_namespaces_catalog_id_fkey;
ALTER TABLE storage.iceberg_tables DROP CONSTRAINT IF EXISTS iceberg_tables_catalog_id_fkey;
ALTER TABLE storage.iceberg_namespaces DROP CONSTRAINT IF EXISTS iceberg_namespaces_bucket_id_fkey;
ALTER TABLE storage.iceberg_tables DROP CONSTRAINT IF EXISTS iceberg_tables_bucket_id_fkey;
END IF;
Expand All @@ -17,13 +19,16 @@ DO $$
AND table_name = 'buckets_analytics'
AND constraint_type = 'PRIMARY KEY';

EXECUTE drop_constraint_sql;
IF drop_constraint_sql IS NOT NULL THEN
EXECUTE drop_constraint_sql;
END IF;

IF NOT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'buckets_analytics' AND column_name = 'name') THEN
ALTER TABLE storage.buckets_analytics RENAME COLUMN id TO name;
END IF;

ALTER TABLE storage.buckets_analytics ADD COLUMN IF NOT EXISTS id uuid NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY;
ALTER TABLE storage.buckets_analytics ADD COLUMN IF NOT EXISTS id uuid NOT NULL DEFAULT gen_random_uuid();
ALTER TABLE storage.buckets_analytics ADD PRIMARY KEY (id);
ALTER TABLE storage.buckets_analytics ADD COLUMN IF NOT EXISTS deleted_at timestamptz NULL;

CREATE UNIQUE INDEX IF NOT EXISTS buckets_analytics_unique_name_idx
Expand Down
Loading