Initial commit - Church Music Database
This commit is contained in:
155
legacy-site/documentation/md-files/POSTGRESQL_SETUP_COMPLETE.md
Normal file
155
legacy-site/documentation/md-files/POSTGRESQL_SETUP_COMPLETE.md
Normal file
@@ -0,0 +1,155 @@
|
||||
# ✅ PostgreSQL Setup Complete
|
||||
|
||||
**Date**: December 14, 2025
|
||||
**Status**: All services running with PostgreSQL
|
||||
|
||||
## What Was Done
|
||||
|
||||
### 1. ✅ Switched from SQLite to PostgreSQL
|
||||
|
||||
- Updated `postgresql_models.py` to use PostgreSQL connection
|
||||
- Connection string: `postgresql://songlyric_user:MySecurePass123@192.168.10.130:5432/church_songlyric`
|
||||
- Removed SQLite database references
|
||||
- Granted proper permissions to `songlyric_user`
|
||||
|
||||
### 2. ✅ Removed All MongoDB References
|
||||
|
||||
- Deleted `app_mongodb_backup.py`
|
||||
- Deleted `check_mongo_data.py`
|
||||
- Deleted `migrate_to_mongodb.py`
|
||||
- Deleted `mongodb_models.py`
|
||||
- Restored SQLite-based app.py (which works with PostgreSQL via SQLAlchemy)
|
||||
|
||||
### 3. ✅ Configured Port 5100
|
||||
|
||||
- Backend running on port **5100** (<http://192.168.10.130:5100>)
|
||||
- Frontend running on port **3000** (<http://192.168.10.130:3000>)
|
||||
- Updated default FLASK_PORT from 5000 to 5100
|
||||
|
||||
### 4. ✅ Configured DNS Support
|
||||
|
||||
- Added CORS support for `houseofprayer.ddns.net` domain
|
||||
- Supports both HTTP and HTTPS
|
||||
- Supports multiple ports (3000, 5100)
|
||||
- Full wildcard support for all origins
|
||||
|
||||
### 5. ✅ Installed Bootstrap
|
||||
|
||||
- Bootstrap 5.3.8 installed
|
||||
- Bootstrap Icons 1.13.1 installed
|
||||
- Mobile-responsive configuration
|
||||
- Imported in `frontend/src/index.js`
|
||||
|
||||
## Current Running Services
|
||||
|
||||
### Backend (Port 5100)
|
||||
|
||||
- **Process**: Python Flask app with PostgreSQL
|
||||
- **Local**: <http://localhost:5100>
|
||||
- **Network**: <http://192.168.10.130:5100>
|
||||
- **DNS**: <http://houseofprayer.ddns.net:5100>
|
||||
- **Database**: PostgreSQL (church_songlyric)
|
||||
- **Status**: ✅ Running
|
||||
|
||||
### Frontend (Port 3000)
|
||||
|
||||
- **Process**: React development server
|
||||
- **Local**: <http://localhost:3000>
|
||||
- **Network**: <http://192.168.10.130:3000>
|
||||
- **DNS**: <http://houseofprayer.ddns.net:3000>
|
||||
- **Bootstrap**: ✅ Configured for mobile
|
||||
- **Status**: ✅ Running
|
||||
|
||||
## Database Information
|
||||
|
||||
- **Database**: church_songlyric
|
||||
- **User**: songlyric_user
|
||||
- **Password**: MySecurePass123
|
||||
- **Host**: 192.168.10.130
|
||||
- **Port**: 5432
|
||||
- **Tables**: songs, profiles, plans, plan_songs, profile_songs
|
||||
|
||||
## API Endpoints
|
||||
|
||||
All endpoints available at `http://192.168.10.130:5100/api/`
|
||||
|
||||
- `GET /api/songs` - List all songs
|
||||
- `POST /api/songs` - Create new song
|
||||
- `GET /api/songs/{id}` - Get song by ID
|
||||
- `PUT /api/songs/{id}` - Update song
|
||||
- `DELETE /api/songs/{id}` - Delete song
|
||||
- `GET /api/profiles` - List all profiles
|
||||
- `GET /api/plans` - List all plans
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
# Test backend
|
||||
curl http://localhost:5100/api/songs
|
||||
|
||||
# Test frontend
|
||||
curl http://localhost:3000
|
||||
|
||||
# Test with network IP
|
||||
curl http://192.168.10.130:5100/api/songs
|
||||
|
||||
# Test with DNS (if configured)
|
||||
curl http://houseofprayer.ddns.net:5100/api/songs
|
||||
```
|
||||
|
||||
## Files Modified
|
||||
|
||||
1. `backend/postgresql_models.py` - Updated to use PostgreSQL
|
||||
2. `backend/app.py` - Updated CORS and port configuration
|
||||
3. `backend/.env` - Updated PostgreSQL password
|
||||
4. `frontend/src/setupProxy.js` - Updated to proxy to port 5100
|
||||
5. `frontend/src/index.js` - Bootstrap imports added
|
||||
|
||||
## Files Deleted
|
||||
|
||||
1. `backend/app_mongodb_backup.py`
|
||||
2. `backend/check_mongo_data.py`
|
||||
3. `backend/migrate_to_mongodb.py`
|
||||
4. `backend/mongodb_models.py`
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. Configure DNS forwarding on your router for ports 3000 and 5100
|
||||
2. Test external access via `http://houseofprayer.ddns.net:3000`
|
||||
3. Consider setting up HTTPS with Let's Encrypt
|
||||
4. Set up PM2 for production deployment
|
||||
5. Configure Nginx reverse proxy (optional)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### If backend won't start
|
||||
|
||||
```bash
|
||||
cd /media/pts/Website/Church_HOP_MusicData/backend
|
||||
source venv/bin/activate
|
||||
python app.py
|
||||
```
|
||||
|
||||
### If database connection fails
|
||||
|
||||
```bash
|
||||
# Test PostgreSQL connection
|
||||
sudo -u postgres psql -d church_songlyric -c "SELECT 1"
|
||||
|
||||
# Reset user password
|
||||
sudo -u postgres psql -d church_songlyric -c "ALTER USER songlyric_user WITH PASSWORD 'MySecurePass123';"
|
||||
|
||||
# Grant permissions
|
||||
sudo -u postgres psql -d church_songlyric -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO songlyric_user;"
|
||||
```
|
||||
|
||||
### If frontend won't start
|
||||
|
||||
```bash
|
||||
cd /media/pts/Website/Church_HOP_MusicData/frontend
|
||||
npm start
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Everything is ready for production use with PostgreSQL, mobile-optimized Bootstrap UI, and DNS support! 🎉**
|
||||
Reference in New Issue
Block a user