docs: update Step 5 PostgreSQL setup for Debian (md5 auth, dentalapp db)
This commit is contained in:
30
README.md
30
README.md
@@ -62,17 +62,33 @@ sudo apt-get install -y postgresql postgresql-contrib
|
|||||||
sudo systemctl enable postgresql
|
sudo systemctl enable postgresql
|
||||||
sudo systemctl start postgresql
|
sudo systemctl start postgresql
|
||||||
|
|
||||||
# Create a database and user (replace values as needed)
|
# Create the database the app uses
|
||||||
sudo -u postgres psql -c "CREATE USER dental_user WITH PASSWORD 'yourpassword';"
|
sudo -u postgres psql -c "CREATE DATABASE dentalapp OWNER postgres;"
|
||||||
sudo -u postgres psql -c "CREATE DATABASE dental_db OWNER dental_user;"
|
|
||||||
|
|
||||||
# Verify
|
# Set the postgres user password to match packages/db/.env
|
||||||
psql -U dental_user -d dental_db -c "\conninfo"
|
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'mypassword';"
|
||||||
```
|
```
|
||||||
|
|
||||||
> Then update `DATABASE_URL` in your `.env` file:
|
#### Enable password authentication over TCP
|
||||||
|
|
||||||
|
By default Debian uses `scram-sha-256` or `peer` auth for local connections, which blocks password login. Switch to `md5`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo sed -i 's/scram-sha-256/md5/g' /etc/postgresql/*/main/pg_hba.conf
|
||||||
|
sudo systemctl restart postgresql
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Verify
|
||||||
|
|
||||||
|
```sh
|
||||||
|
psql -U postgres -d dentalapp -h 127.0.0.1 -W
|
||||||
|
# Enter: mypassword
|
||||||
|
# You should see: dentalapp=#
|
||||||
|
```
|
||||||
|
|
||||||
|
> The `DATABASE_URL` in `packages/db/.env` is already set to:
|
||||||
> ```
|
> ```
|
||||||
> DATABASE_URL="postgresql://dental_user:yourpassword@localhost:5432/dental_db"
|
> DATABASE_URL="postgresql://postgres:mypassword@localhost:5432/dentalapp"
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
### Step 6 — Install Redis
|
### Step 6 — Install Redis
|
||||||
|
|||||||
Reference in New Issue
Block a user