88 lines
1.9 KiB
Markdown
88 lines
1.9 KiB
Markdown
# Database Setup Required
|
|
|
|
## Issue
|
|
|
|
The deployment script is failing at the database connection step because the database user or database doesn't exist.
|
|
|
|
## Solution
|
|
|
|
### Option 1: Run Database Setup Script (Recommended)
|
|
|
|
```bash
|
|
cd ~/projects/proxmox/explorer-monorepo
|
|
sudo bash scripts/setup-database.sh
|
|
```
|
|
|
|
This will:
|
|
- Create the `explorer` user
|
|
- Create the `explorer` database
|
|
- Set password to `L@ker$2010`
|
|
- Grant all necessary privileges
|
|
|
|
### Option 2: Manual Setup
|
|
|
|
```bash
|
|
# Connect as postgres superuser
|
|
sudo -u postgres psql
|
|
|
|
# Then run these commands:
|
|
CREATE USER explorer WITH PASSWORD 'L@ker$2010';
|
|
CREATE DATABASE explorer OWNER explorer;
|
|
GRANT ALL PRIVILEGES ON DATABASE explorer TO explorer;
|
|
\q
|
|
|
|
# Test connection
|
|
PGPASSWORD='L@ker$2010' psql -h localhost -U explorer -d explorer -c "SELECT 1;"
|
|
```
|
|
|
|
### Option 3: Check Existing Setup
|
|
|
|
```bash
|
|
# Check if user exists
|
|
sudo -u postgres psql -c "\du" | grep explorer
|
|
|
|
# Check if database exists
|
|
sudo -u postgres psql -c "\l" | grep explorer
|
|
|
|
# Check PostgreSQL is running
|
|
systemctl status postgresql
|
|
```
|
|
|
|
## After Setup
|
|
|
|
Once the database is set up, run the deployment script again:
|
|
|
|
```bash
|
|
cd ~/projects/proxmox/explorer-monorepo
|
|
bash EXECUTE_DEPLOYMENT.sh
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### If PostgreSQL is not running:
|
|
```bash
|
|
sudo systemctl start postgresql
|
|
sudo systemctl enable postgresql
|
|
```
|
|
|
|
### If user exists but password is wrong:
|
|
```bash
|
|
sudo -u postgres psql -c "ALTER USER explorer WITH PASSWORD 'L@ker\$2010';"
|
|
```
|
|
|
|
### If database exists but user doesn't have access:
|
|
```bash
|
|
sudo -u postgres psql -d explorer -c "GRANT ALL PRIVILEGES ON DATABASE explorer TO explorer;"
|
|
sudo -u postgres psql -d explorer -c "GRANT ALL ON SCHEMA public TO explorer;"
|
|
```
|
|
|
|
## Quick Fix Command
|
|
|
|
```bash
|
|
cd ~/projects/proxmox/explorer-monorepo
|
|
sudo bash scripts/setup-database.sh && bash EXECUTE_DEPLOYMENT.sh
|
|
```
|
|
|
|
This will set up the database and then run the deployment.
|
|
|