mirror of
https://github.com/DeNNiiInc/Connect-5.git
synced 2026-04-22 11:05:59 +00:00
Clean up deployment scripts and documentation
- Removed all unused/deprecated deployment scripts - Created single unified deploy.sh script - Added comprehensive DEPLOYMENT.md guide - Updated README.md for Supabase migration - Script prompts for project directory or uses current - Auto-detects web server (Nginx/Apache/CloudSticks) - Fully automated deployment process
This commit is contained in:
86
README.md
86
README.md
@@ -10,7 +10,7 @@ A beautiful, feature-rich implementation of the classic Connect-5 (Gomoku) game
|
||||
|
||||
[](https://nodejs.org/)
|
||||
[](https://socket.io/)
|
||||
[](https://www.mysql.com/)
|
||||
[](https://supabase.com/)
|
||||
[](LICENSE)
|
||||
|
||||
[Play Now](https://connect5.beyondcloud.technology/) • [Features](#features) • [Installation](#installation) • [Usage](#usage) • [Multiplayer](#multiplayer) • [Tech Stack](#tech-stack)
|
||||
@@ -70,7 +70,7 @@ A beautiful, feature-rich implementation of the classic Connect-5 (Gomoku) game
|
||||
|
||||
### Prerequisites
|
||||
- **Node.js** 18+ ([Download](https://nodejs.org/))
|
||||
- **MySQL** 8.0+ ([Download](https://www.mysql.com/downloads/))
|
||||
- **Supabase Account** (Free tier available at [supabase.com](https://supabase.com/))
|
||||
- **Git** ([Download](https://git-scm.com/))
|
||||
|
||||
### Quick Start
|
||||
@@ -83,12 +83,13 @@ cd Connect-5
|
||||
# Install dependencies
|
||||
npm install
|
||||
|
||||
# Configure database (edit database.js with your credentials)
|
||||
# Update the following in database.js:
|
||||
# - host: 'your-mysql-host'
|
||||
# - user: 'your-database-user'
|
||||
# - password: 'your-password'
|
||||
# - database: 'your-database-name'
|
||||
# Configure database
|
||||
# 1. Create a Supabase project at https://supabase.com
|
||||
# 2. Copy db.config.example.js to db.config.js
|
||||
cp db.config.example.js db.config.js
|
||||
|
||||
# 3. Edit db.config.js with your Supabase credentials
|
||||
# 4. Run the SQL schema in Supabase SQL Editor (see SUPABASE_SETUP.md)
|
||||
|
||||
# Start the server
|
||||
npm start
|
||||
@@ -96,6 +97,8 @@ npm start
|
||||
|
||||
The server will start on **http://localhost:3000**
|
||||
|
||||
For detailed setup instructions, see [SUPABASE_SETUP.md](SUPABASE_SETUP.md)
|
||||
|
||||
---
|
||||
|
||||
## 🎮 Usage
|
||||
@@ -137,8 +140,8 @@ The server will start on **http://localhost:3000**
|
||||
│
|
||||
▼
|
||||
┌──────────────┐
|
||||
│ MySQL │
|
||||
│ Database │
|
||||
│ Supabase │
|
||||
│ PostgreSQL │
|
||||
└──────────────┘
|
||||
```
|
||||
|
||||
@@ -186,18 +189,19 @@ The server will start on **http://localhost:3000**
|
||||
- **Node.js**: JavaScript runtime
|
||||
- **Express.js**: Web application framework
|
||||
- **Socket.io**: WebSocket library for real-time bidirectional communication
|
||||
- **MySQL2**: MySQL database driver with promises
|
||||
- **Supabase Client**: PostgreSQL database client with real-time capabilities
|
||||
|
||||
### Database
|
||||
- **MySQL**: Relational database for persistent storage
|
||||
- **Connection Pooling**: Optimized database connections
|
||||
- **Supabase**: Managed PostgreSQL database with real-time subscriptions
|
||||
- **Row Level Security**: Built-in security policies
|
||||
- **Auto-generated APIs**: RESTful and real-time APIs
|
||||
|
||||
### Dependencies
|
||||
```json
|
||||
{
|
||||
"express": "^4.18.2",
|
||||
"socket.io": "^4.6.1",
|
||||
"mysql2": "^3.2.0",
|
||||
"@supabase/supabase-js": "^2.39.0",
|
||||
"bad-words": "^3.0.4",
|
||||
"cors": "^2.8.5",
|
||||
"nodemon": "^2.0.22"
|
||||
@@ -229,20 +233,25 @@ Connect-5/
|
||||
|
||||
### Database Configuration
|
||||
|
||||
Edit `database.js`:
|
||||
Create `db.config.js` from the example:
|
||||
|
||||
```bash
|
||||
cp db.config.example.js db.config.js
|
||||
```
|
||||
|
||||
Edit `db.config.js`:
|
||||
|
||||
```javascript
|
||||
const dbConfig = {
|
||||
host: 'your-mysql-host', // MySQL server address
|
||||
user: 'your-database-user', // Database username
|
||||
password: 'your-password', // Database password
|
||||
database: 'your-database-name',// Database name
|
||||
waitForConnections: true,
|
||||
connectionLimit: 10,
|
||||
queueLimit: 0
|
||||
module.exports = {
|
||||
supabaseUrl: 'https://your-project.supabase.co',
|
||||
supabaseAnonKey: 'your-anon-key-here',
|
||||
supabasePassword: 'your-database-password',
|
||||
postgresConnectionString: 'postgresql://postgres:password@...'
|
||||
};
|
||||
```
|
||||
|
||||
See [SUPABASE_SETUP.md](SUPABASE_SETUP.md) for detailed setup instructions.
|
||||
|
||||
### Server Configuration
|
||||
|
||||
Edit `server.js` to change the port:
|
||||
@@ -253,6 +262,27 @@ const PORT = process.env.PORT || 3000;
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Production Deployment
|
||||
|
||||
For production deployment, use the automated deployment script:
|
||||
|
||||
```bash
|
||||
sudo bash deploy.sh
|
||||
```
|
||||
|
||||
The script will:
|
||||
- ✅ Prompt for project directory
|
||||
- ✅ Request Supabase credentials
|
||||
- ✅ Configure database connection
|
||||
- ✅ Install dependencies
|
||||
- ✅ Detect and configure web server (Nginx/Apache)
|
||||
- ✅ Start Node.js server
|
||||
- ✅ Test endpoints
|
||||
|
||||
See [DEPLOYMENT.md](DEPLOYMENT.md) for detailed deployment instructions.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Game Rules
|
||||
|
||||
### Objective
|
||||
@@ -298,8 +328,8 @@ npm start
|
||||
## 🐛 Troubleshooting
|
||||
|
||||
### Connection Refused Error
|
||||
**Problem**: Cannot connect to MySQL database
|
||||
**Solution**: Ensure MySQL is running and credentials in `database.js` are correct
|
||||
**Problem**: Cannot connect to Supabase database
|
||||
**Solution**: Verify credentials in `db.config.js` and check Supabase dashboard
|
||||
|
||||
### Port Already in Use
|
||||
**Problem**: Port 3000 is already occupied
|
||||
@@ -313,6 +343,12 @@ npm start
|
||||
**Problem**: Username registration fails
|
||||
**Solution**: Try a different username or check the database for duplicates
|
||||
|
||||
### Database Disconnected
|
||||
**Problem**: Status bar shows "Disconnected"
|
||||
**Solution**: Check `db.config.js` credentials and Supabase project status
|
||||
|
||||
For more troubleshooting, see [DEPLOYMENT.md](DEPLOYMENT.md)
|
||||
|
||||
---
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
Reference in New Issue
Block a user