Add complete setup instructions and automated setup script
- Create setup-complete.sh for automated setup after DB configuration - Add COMPLETE_SETUP_INSTRUCTIONS.md with step-by-step guide - Document remaining steps that require database authentication
This commit is contained in:
155
COMPLETE_SETUP_INSTRUCTIONS.md
Normal file
155
COMPLETE_SETUP_INSTRUCTIONS.md
Normal file
@@ -0,0 +1,155 @@
|
||||
# Complete Setup Instructions
|
||||
|
||||
## Current Status
|
||||
|
||||
✅ **Completed:**
|
||||
- Dependencies installed (backend & frontend)
|
||||
- Prisma client generated
|
||||
- Environment files created
|
||||
- Prisma schema fixed
|
||||
|
||||
⏳ **Remaining (requires PostgreSQL authentication):**
|
||||
|
||||
## Step-by-Step Completion
|
||||
|
||||
### 1. Configure Database Connection
|
||||
|
||||
You need to set up PostgreSQL database access. Choose one method:
|
||||
|
||||
#### Option A: Using Docker (Easiest - No Password Needed)
|
||||
|
||||
```bash
|
||||
# Start PostgreSQL container
|
||||
docker-compose up -d postgres
|
||||
|
||||
# Update backend/.env
|
||||
DATABASE_URL="postgresql://asle:asle_password@localhost:5432/asle?schema=public"
|
||||
```
|
||||
|
||||
#### Option B: Local PostgreSQL (Requires Password)
|
||||
|
||||
```bash
|
||||
# Create database (you'll need PostgreSQL admin password)
|
||||
sudo -u postgres psql << EOF
|
||||
CREATE DATABASE asle;
|
||||
CREATE USER asle WITH PASSWORD 'asle_password';
|
||||
GRANT ALL PRIVILEGES ON DATABASE asle TO asle;
|
||||
EOF
|
||||
|
||||
# Update backend/.env
|
||||
DATABASE_URL="postgresql://asle:asle_password@localhost:5432/asle?schema=public"
|
||||
```
|
||||
|
||||
#### Option C: Use Existing PostgreSQL
|
||||
|
||||
If you have PostgreSQL running with different credentials:
|
||||
|
||||
```bash
|
||||
# Update backend/.env with your connection string
|
||||
DATABASE_URL="postgresql://your_user:your_password@localhost:5432/asle?schema=public"
|
||||
```
|
||||
|
||||
### 2. Run Complete Setup
|
||||
|
||||
After configuring the database:
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
|
||||
# Run migrations
|
||||
npm run prisma:migrate
|
||||
|
||||
# Initialize database
|
||||
npm run setup:db
|
||||
|
||||
# Create admin user
|
||||
npm run setup:admin
|
||||
```
|
||||
|
||||
Or use the automated script:
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
./setup-complete.sh
|
||||
```
|
||||
|
||||
### 3. Start Services
|
||||
|
||||
```bash
|
||||
# Terminal 1: Backend
|
||||
cd backend
|
||||
npm run dev
|
||||
|
||||
# Terminal 2: Frontend
|
||||
cd frontend
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### 4. Access Application
|
||||
|
||||
- Frontend: http://localhost:3000
|
||||
- Backend API: http://localhost:4000/api
|
||||
- GraphQL: http://localhost:4000/graphql
|
||||
- Admin: http://localhost:3000/admin
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Database Connection Issues
|
||||
|
||||
1. **Verify PostgreSQL is running:**
|
||||
```bash
|
||||
pg_isready -h localhost -p 5432
|
||||
```
|
||||
|
||||
2. **Test connection:**
|
||||
```bash
|
||||
psql $DATABASE_URL -c "SELECT version();"
|
||||
```
|
||||
|
||||
3. **Check .env file:**
|
||||
```bash
|
||||
cat backend/.env | grep DATABASE_URL
|
||||
```
|
||||
|
||||
### Migration Issues
|
||||
|
||||
If migrations fail:
|
||||
```bash
|
||||
cd backend
|
||||
npm run prisma:generate
|
||||
npm run prisma:migrate
|
||||
```
|
||||
|
||||
### Admin User Creation
|
||||
|
||||
If admin setup fails, you can create manually:
|
||||
```bash
|
||||
cd backend
|
||||
npm run setup:admin
|
||||
# Follow prompts to create admin user
|
||||
```
|
||||
|
||||
## Quick Reference
|
||||
|
||||
**Database Setup:**
|
||||
- Docker: `docker-compose up -d postgres`
|
||||
- Local: Requires PostgreSQL admin access
|
||||
- See: `DATABASE_SETUP.md` for details
|
||||
|
||||
**Complete Setup:**
|
||||
```bash
|
||||
cd backend
|
||||
npm run prisma:migrate
|
||||
npm run setup:db
|
||||
npm run setup:admin
|
||||
```
|
||||
|
||||
**Start Development:**
|
||||
```bash
|
||||
# Backend
|
||||
cd backend && npm run dev
|
||||
|
||||
# Frontend
|
||||
cd frontend && npm run dev
|
||||
```
|
||||
|
||||
36
backend/setup-complete.sh
Executable file
36
backend/setup-complete.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
# Complete setup script - run after database is configured
|
||||
|
||||
set -e
|
||||
|
||||
echo "=== ASLE Complete Setup ==="
|
||||
echo ""
|
||||
|
||||
# Check if DATABASE_URL is configured
|
||||
if ! grep -q "DATABASE_URL=" .env || grep -q "user:password" .env; then
|
||||
echo "❌ Please configure DATABASE_URL in backend/.env first"
|
||||
echo " See DATABASE_SETUP.md for instructions"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Environment configured"
|
||||
echo ""
|
||||
|
||||
# Run migrations
|
||||
echo "Running database migrations..."
|
||||
npm run prisma:migrate
|
||||
|
||||
echo ""
|
||||
echo "Initializing database..."
|
||||
npm run setup:db
|
||||
|
||||
echo ""
|
||||
echo "Creating admin user..."
|
||||
npm run setup:admin
|
||||
|
||||
echo ""
|
||||
echo "✅ Setup complete!"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Start backend: npm run dev"
|
||||
echo " 2. Start frontend: cd ../frontend && npm run dev"
|
||||
Reference in New Issue
Block a user