Skip to content

Commit

Permalink
fix: remove dependencies on unnecessary postgres roles
Browse files Browse the repository at this point in the history
  • Loading branch information
khorshuheng committed Oct 24, 2024
1 parent aea8380 commit 6a34be3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ APPFLOWY_COLLABORATE_REMOVE_BATCH_SIZE=100

# AppFlowy Worker
APPFLOWY_WORKER_REDIS_URL=redis://localhost:6379
APPFLOWY_WORKER_DATABASE_URL=postgres://postgres:password@postgres:5432/postgres
APPFLOWY_WORKER_DATABASE_URL=postgres://postgres:password@localhost:5432/postgres

# AppFlowy Web
APPFLOWY_WEB_URL=http://localhost:3000
4 changes: 3 additions & 1 deletion docker-compose-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ services:
- POSTGRES_DB=${POSTGRES_DB:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
- POSTGRES_HOST=${POSTGRES_HOST:-postgres}
- SUPABASE_USER=${SUPABASE_USER:-supabase_auth_admin}
- SUPABASE_PASSWORD=${SUPABASE_PASSWORD:-root}
volumes:
- ./migrations/before:/docker-entrypoint-initdb.d

Expand Down Expand Up @@ -93,7 +95,7 @@ services:
- RUST_LOG=${RUST_LOG:-info}
- APPFLOWY_ENVIRONMENT=production
- APPFLOWY_DATABASE_URL=${APPFLOWY_DATABASE_URL}
- APPFLOWY_REDIS_URI=redis://redis:6379
- APPFLOWY_REDIS_URI=${APPFLOWY_REDIS_URI}
- APPFLOWY_GOTRUE_JWT_SECRET=${GOTRUE_JWT_SECRET}
- APPFLOWY_GOTRUE_JWT_EXP=${GOTRUE_JWT_EXP}
- APPFLOWY_GOTRUE_BASE_URL=${APPFLOWY_GOTRUE_BASE_URL}
Expand Down
2 changes: 2 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ services:
- POSTGRES_DB=${POSTGRES_DB:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
- POSTGRES_HOST=${POSTGRES_HOST:-postgres}
- SUPABASE_USER=${SUPABASE_USER:-supabase_auth_admin}
- SUPABASE_PASSWORD=${SUPABASE_PASSWORD:-root}
ports:
- 5432:5432
volumes:
Expand Down
12 changes: 1 addition & 11 deletions migrations/before/supabase_auth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-E
END LOOP;
END;
\$\$;
SELECT create_roles(ARRAY ['anon', 'authenticated']);
-- Create supabase_admin user if it does not exist
DO \$\$ BEGIN IF NOT EXISTS (
SELECT
FROM pg_catalog.pg_roles
WHERE rolname = 'supabase_admin'
) THEN CREATE USER supabase_admin LOGIN CREATEROLE CREATEDB REPLICATION BYPASSRLS;
END IF;
END \$\$;
-- Create supabase_auth_admin user if it does not exist
DO \$\$ BEGIN IF NOT EXISTS (
Expand All @@ -42,4 +32,4 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-E
-- Set search_path for supabase_auth_admin
ALTER USER $SUPABASE_USER SET search_path = 'auth';
EOSQL
EOSQL

0 comments on commit 6a34be3

Please sign in to comment.