diff --git a/Service%EF%BC%9ACoder.md b/Service%EF%BC%9ACoder.md index d2eee42..7418bce 100644 --- a/Service%EF%BC%9ACoder.md +++ b/Service%EF%BC%9ACoder.md @@ -13,5 +13,32 @@ echo 'export CODER_HTTP_ADDRESS=0.0.0.0:3000' >> ~/.bashrc && source ~/.bashrc # 啟動 Coder 服務 ```bash -systemctl enable --now coder@coder +systemctl enable --now coder +``` + +# 使用 + +```bash +sudo -u postgres psql +``` + +新建使用者與資料庫 + +```sql +CREATE USER coder WITH PASSWORD 'coder'; + +CREATE DATABASE coder; +``` + +設定資料庫權限 + +```sql +-- 1. Give ownership of the database to the app user +ALTER DATABASE coder OWNER TO coder; + +-- 2. Give ownership of the public schema to the app user +ALTER SCHEMA public OWNER TO coder; + +-- 3. Ensure the user has create permissions (Crucial for Postgres 15+) +GRANT USAGE, CREATE ON SCHEMA public TO coder; ``` \ No newline at end of file