refactor: enhance installation process with support for full-stack and app-only modes, update environment configurations, and improve database migration handling
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<SQL
|
||||
create role anon nologin;
|
||||
create role authenticated nologin;
|
||||
create role service_role nologin bypassrls;
|
||||
create role authenticator noinherit login password '$POSTGRES_PASSWORD';
|
||||
create role supabase_auth_admin noinherit login password '$POSTGRES_PASSWORD';
|
||||
create role supabase_storage_admin noinherit login password '$POSTGRES_PASSWORD';
|
||||
|
||||
grant anon, authenticated, service_role to authenticator;
|
||||
grant all privileges on database postgres to supabase_auth_admin;
|
||||
grant all privileges on database postgres to supabase_storage_admin;
|
||||
|
||||
create schema if not exists auth authorization supabase_auth_admin;
|
||||
create schema if not exists storage authorization supabase_storage_admin;
|
||||
|
||||
grant usage on schema public to anon, authenticated, service_role;
|
||||
grant usage on schema auth to supabase_auth_admin;
|
||||
grant usage on schema storage to anon, authenticated, service_role, supabase_storage_admin;
|
||||
|
||||
create extension if not exists "uuid-ossp";
|
||||
create extension if not exists pgcrypto;
|
||||
create extension if not exists vector;
|
||||
|
||||
create or replace function auth.uid()
|
||||
returns uuid
|
||||
language sql
|
||||
stable
|
||||
as \$\$
|
||||
select nullif(current_setting('request.jwt.claim.sub', true), '')::uuid;
|
||||
\$\$;
|
||||
|
||||
create or replace function auth.role()
|
||||
returns text
|
||||
language sql
|
||||
stable
|
||||
as \$\$
|
||||
select nullif(current_setting('request.jwt.claim.role', true), '')::text;
|
||||
\$\$;
|
||||
|
||||
create or replace function auth.email()
|
||||
returns text
|
||||
language sql
|
||||
stable
|
||||
as \$\$
|
||||
select nullif(current_setting('request.jwt.claim.email', true), '')::text;
|
||||
\$\$;
|
||||
|
||||
alter default privileges in schema public grant select, insert, update, delete on tables to anon, authenticated, service_role;
|
||||
alter default privileges in schema public grant usage, select on sequences to anon, authenticated, service_role;
|
||||
SQL
|
||||
@@ -0,0 +1,37 @@
|
||||
server {
|
||||
listen 8000;
|
||||
server_name _;
|
||||
client_max_body_size 50m;
|
||||
|
||||
location /auth/v1/ {
|
||||
proxy_pass http://neta-auth:9999/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /rest/v1/ {
|
||||
proxy_pass http://neta-rest:3000/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /storage/v1/ {
|
||||
proxy_pass http://neta-storage:5000/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /health {
|
||||
return 200 "ok\n";
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user