From 91fb9c56dc15768fce7aceb4920a938c0841c81e Mon Sep 17 00:00:00 2001 From: Jeffery Date: Wed, 20 May 2026 08:43:24 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Service=EF=BC=9ACoder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service%EF%BC%9ACoder.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) 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