Files
Archive/retro/DOCKER_README.md

333 lines
6.5 KiB
Markdown
Raw Permalink Normal View History

2025-12-09 06:52:43 +00:00
# Habbo Retro Docker Deployment
This directory contains a complete Docker containerization of the Habbo Retro server setup.
## Services Included
- **MySQL Database** (Port 3306) - Habbo database with all translations
- **Arcturus Emulator** (Ports 30000, 2096) - Game server with 84 plugins
- **Cool UI** (Port 5174) - Primary Nitro client
- **Standard Nitro** (Port 5173) - Alternative Nitro client
- **Asset Server** (Port 8080) - Static assets (images, gamedata, sounds)
- **AtomCMS** (Ports 80, 443) - Website and admin panel
## Prerequisites
- Docker Engine 20.10+
- Docker Compose 2.0+
- At least 4GB RAM available
- 10GB free disk space
## Quick Start
### 1. Configure Environment
Copy the example environment file:
```bash
cp .env.docker .env
```
Edit `.env` and update the following:
- `MYSQL_ROOT_PASSWORD` - Set a secure root password
- `MYSQL_PASSWORD` - Set a secure user password
- `APP_KEY` - Generate Laravel app key (see below)
Generate Laravel app key:
```bash
# Option 1: Using existing Laravel installation
cd atomcms && php artisan key:generate --show
# Option 2: Generate manually (base64 encoded 32 character string)
echo "base64:$(openssl rand -base64 32)"
```
### 2. Build Containers
Build all Docker images:
```bash
docker-compose build
```
This will take 5-10 minutes on first build.
### 3. Start Services
Start all services:
```bash
docker-compose up -d
```
Check service status:
```bash
docker-compose ps
```
View logs:
```bash
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f emulator
docker-compose logs -f mysql
```
### 4. Verify Services
Check each service is running:
**MySQL Database:**
```bash
docker-compose exec mysql mysql -u habbo_user -p -e "SHOW DATABASES;"
# Password: habbo_password_2024 (or your custom password)
```
**Emulator:**
```bash
# Check emulator logs
docker-compose logs emulator | tail -50
```
**Cool UI:**
```bash
curl -I http://localhost:5174
# Should return 200 OK
```
**Asset Server:**
```bash
curl http://localhost:8080/gamedata/UITexts.json | head -20
# Should return JSON data
```
**CMS:**
```bash
curl -I http://localhost
# Should return 200 OK
```
## Service URLs
- **Cool UI**: http://localhost:5174
- **Standard Nitro**: http://localhost:5173
- **Asset Server**: http://localhost:8080
- **CMS**: http://localhost
- **MySQL**: localhost:3306
- **Emulator**: localhost:30000 (game), localhost:2096 (WebSocket)
## Management Commands
### Start Services
```bash
docker-compose up -d
```
### Stop Services
```bash
docker-compose down
```
### Restart a Service
```bash
docker-compose restart emulator
docker-compose restart mysql
```
### View Logs
```bash
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f emulator
docker-compose logs -f cool-ui
```
### Access Container Shell
```bash
# MySQL
docker-compose exec mysql bash
# Emulator
docker-compose exec emulator bash
# CMS
docker-compose exec cms bash
```
### Database Backup
```bash
docker-compose exec mysql mysqldump \
-u habbo_user -p habbo_retro \
--routines --triggers > backup_$(date +%Y%m%d).sql
```
### Database Restore
```bash
docker-compose exec -T mysql mysql -u habbo_user -p habbo_retro < backup.sql
```
## Troubleshooting
### MySQL Won't Start
Check if port 3306 is already in use:
```bash
lsof -i :3306
# Kill existing MySQL if needed
```
View MySQL logs:
```bash
docker-compose logs mysql
```
### Emulator Can't Connect to Database
1. Check MySQL is healthy:
```bash
docker-compose ps mysql
# Should show "healthy"
```
2. Verify database credentials in `emulator/config.ini`:
```ini
db.hostname=mysql # Must be "mysql" (container name)
db.username=habbo_user
db.password=habbo_password_2024
db.database=habbo_retro
```
3. Restart emulator:
```bash
docker-compose restart emulator
```
### Cool UI Shows Blank Page
1. Check asset server is running:
```bash
curl http://localhost:8080/gamedata/UITexts.json
```
2. Check browser console for errors
3. Verify CORS is enabled on asset server
### CMS Shows 500 Error
1. Check Laravel logs:
```bash
docker-compose exec cms tail -f /var/www/html/storage/logs/laravel.log
```
2. Clear cache:
```bash
docker-compose exec cms php artisan cache:clear
docker-compose exec cms php artisan config:clear
docker-compose exec cms php artisan view:clear
```
3. Check database connection:
```bash
docker-compose exec cms php artisan tinker
# Then: DB::connection()->getPdo();
```
### Port Already in Use
If you get "port already in use" errors, edit `docker-compose.yml` and change the port mappings:
```yaml
ports:
- "5175:80" # Changed from 5174:80
```
## Data Persistence
All important data is stored in Docker volumes:
- `mysql_data` - Database data
- `mysql_logs` - MySQL logs
- `emulator_logs` - Emulator logs
- `cms_storage` - CMS uploaded files
- `cms_cache` - CMS cache files
To remove all data (⚠️ WARNING: This deletes everything):
```bash
docker-compose down -v
```
## Updating
### Update a Service
1. Make changes to the service files
2. Rebuild the specific service:
```bash
docker-compose build emulator
```
3. Restart the service:
```bash
docker-compose up -d emulator
```
### Update All Services
```bash
docker-compose build
docker-compose up -d
```
## Production Deployment
For production deployment:
1. **Change all default passwords** in `.env`
2. **Set `APP_DEBUG=false`** in `.env`
3. **Generate new `APP_KEY`** for Laravel
4. **Enable SSL/HTTPS** for CMS (configure nginx SSL)
5. **Set up automatic backups** for MySQL
6. **Configure firewall rules** to restrict access
7. **Use Docker secrets** for sensitive data
8. **Enable resource limits** in docker-compose.yml:
```yaml
services:
mysql:
deploy:
resources:
limits:
cpus: '2'
memory: 2G
```
## Health Monitoring
All services include health checks. View health status:
```bash
docker-compose ps
```
Healthy services show `healthy` in the status column.
## Network Architecture
All services communicate on the `habbo-network` bridge network:
- Subnet: 172.20.0.0/16
- Internal DNS resolution by container name
- Isolated from host network (except exposed ports)
## Support
For issues:
1. Check logs: `docker-compose logs -f [service-name]`
2. Verify health: `docker-compose ps`
3. Check resources: `docker stats`
4. Review configuration files for typos
## Database Information
- Database: habbo_retro
- Tables: 174
- Catalog Items: 51,678 (99.93% English)
- Catalog Pages: 2,311 (100% English)
- Size: ~51 MB
The database dump includes all translations completed on December 6, 2025.