feat(0.2.1): M4-a 部署栈 —— compose(PG逻辑复制+powersync+app:13001), sync streams(任务域6表+User), initdb, DISABLE_CRON 开关, 健康检查端口跟随 PORT
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# 一次性初始化 (仅首次建库时执行): 创建 powersync bucket storage 专用用户
|
||||
# PG >= 14 允许源库与 bucket storage 同实例 (powersync schema 由 service 自建)
|
||||
set -e
|
||||
: "${PS_STORAGE_PASSWORD:?PS_STORAGE_PASSWORD missing}"
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
||||
DO \$\$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'powersync_storage') THEN
|
||||
CREATE USER powersync_storage WITH PASSWORD '$PS_STORAGE_PASSWORD';
|
||||
END IF;
|
||||
END
|
||||
\$\$;
|
||||
GRANT CREATE ON DATABASE $POSTGRES_DB TO powersync_storage;
|
||||
EOSQL
|
||||
|
||||
echo "[initdb] powersync_storage user ready."
|
||||
Reference in New Issue
Block a user