|
| 1 | +# Keira3 Docker Deployment Guide |
| 2 | + |
| 3 | +This guide explains how to deploy Keira3 using Docker Compose, integrated with the acore-compose infrastructure. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +Keira3 is deployed as a single containerized service that connects to the shared AzerothCore MySQL database. The application consists of: |
| 8 | + |
| 9 | +- **Nginx web server** (port 8080) - Serves the Angular frontend |
| 10 | +- **Database API** (port 3001) - Express.js service for MySQL connections |
| 11 | +- **Angular SPA** - The Keira3 editor interface |
| 12 | + |
| 13 | +## Prerequisites |
| 14 | + |
| 15 | +1. **Docker and Docker Compose** installed |
| 16 | +2. **acore-compose MySQL service** must be running: |
| 17 | + ```bash |
| 18 | + cd ~/src/acore-compose |
| 19 | + docker-compose --profile db up -d |
| 20 | + ``` |
| 21 | +3. The **azerothcore network** must exist (created by acore-compose) |
| 22 | + |
| 23 | +## Quick Start |
| 24 | + |
| 25 | +You have two deployment options: |
| 26 | + |
| 27 | +### Option 1: Using Pre-built DockerHub Image (Recommended) |
| 28 | + |
| 29 | +This is the fastest and easiest way to get started. |
| 30 | + |
| 31 | +#### 1. Copy the example compose file |
| 32 | + |
| 33 | +```bash |
| 34 | +cd ~/src/Keira3 |
| 35 | +cp docker-compose.example.yml docker-compose.yml |
| 36 | +``` |
| 37 | + |
| 38 | +#### 2. Enable DockerHub image |
| 39 | + |
| 40 | +Edit `docker-compose.yml` and make these changes: |
| 41 | + |
| 42 | +```yaml |
| 43 | +keira3: |
| 44 | + # Uncomment this line: |
| 45 | + image: uprightbass360/keira3:latest |
| 46 | + |
| 47 | + # Comment out the build section: |
| 48 | + # build: |
| 49 | + # context: . |
| 50 | + # dockerfile: docker/Dockerfile |
| 51 | + # target: production |
| 52 | + # image: keira3:latest |
| 53 | +``` |
| 54 | + |
| 55 | +#### 3. Update database password |
| 56 | + |
| 57 | +Edit the `KEIRA_DATABASE_PASSWORD` to match your acore-compose MySQL password: |
| 58 | + |
| 59 | +```yaml |
| 60 | +environment: |
| 61 | + KEIRA_DATABASE_PASSWORD: password # CHANGE THIS! |
| 62 | +``` |
| 63 | +
|
| 64 | +#### 4. Start Keira3 |
| 65 | +
|
| 66 | +```bash |
| 67 | +docker-compose up -d |
| 68 | +``` |
| 69 | + |
| 70 | +#### 5. Access Keira3 |
| 71 | + |
| 72 | +Open your browser and navigate to: |
| 73 | +``` |
| 74 | +http://localhost:4201 |
| 75 | +``` |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +### Option 2: Building from Source (Development) |
| 80 | + |
| 81 | +Use this option if you want to build Keira3 locally or make modifications. |
| 82 | + |
| 83 | +#### 1. Copy the example compose file |
| 84 | + |
| 85 | +```bash |
| 86 | +cd ~/src/Keira3 |
| 87 | +cp docker-compose.example.yml docker-compose.yml |
| 88 | +``` |
| 89 | + |
| 90 | +#### 2. Keep build configuration |
| 91 | + |
| 92 | +The default configuration in `docker-compose.example.yml` is already set up for local builds. Just ensure the build section is uncommented: |
| 93 | + |
| 94 | +```yaml |
| 95 | +keira3: |
| 96 | + build: |
| 97 | + context: . |
| 98 | + dockerfile: docker/Dockerfile |
| 99 | + target: production |
| 100 | + image: keira3:latest |
| 101 | +``` |
| 102 | +
|
| 103 | +#### 3. Update database password |
| 104 | +
|
| 105 | +Edit the `KEIRA_DATABASE_PASSWORD` to match your acore-compose MySQL password: |
| 106 | + |
| 107 | +```yaml |
| 108 | +environment: |
| 109 | + KEIRA_DATABASE_PASSWORD: password # CHANGE THIS! |
| 110 | +``` |
| 111 | + |
| 112 | +#### 4. Build and start Keira3 |
| 113 | + |
| 114 | +```bash |
| 115 | +docker-compose up -d --build |
| 116 | +``` |
| 117 | + |
| 118 | +#### 5. Access Keira3 |
| 119 | + |
| 120 | +Open your browser and navigate to: |
| 121 | +``` |
| 122 | +http://localhost:4201 |
| 123 | +``` |
| 124 | + |
| 125 | +## Configuration Reference |
| 126 | + |
| 127 | +### Environment Variables |
| 128 | + |
| 129 | +All configuration is done via hardcoded environment variables in the docker-compose.yml file: |
| 130 | + |
| 131 | +| Variable | Default | Description | |
| 132 | +|----------|---------|-------------| |
| 133 | +| `NODE_ENV` | `production` | Node.js environment | |
| 134 | +| `KEIRA_PORT` | `8080` | Internal nginx port | |
| 135 | +| `KEIRA_HOST` | `0.0.0.0` | Bind address | |
| 136 | +| `KEIRA_DATABASE_HOST` | `ac-mysql` | MySQL hostname (container name) | |
| 137 | +| `KEIRA_DATABASE_PORT` | `3306` | MySQL port | |
| 138 | +| `KEIRA_DATABASE_USER` | `root` | MySQL username | |
| 139 | +| `KEIRA_DATABASE_PASSWORD` | `password` | MySQL password | |
| 140 | +| `KEIRA_DATABASE_NAME` | `acore_world` | Database name | |
| 141 | +| `KEIRA_DB_CONNECTION_LIMIT` | `10` | Max database connections | |
| 142 | +| `TZ` | `UTC` | Timezone | |
| 143 | + |
| 144 | +### Port Mapping |
| 145 | + |
| 146 | +| External Port | Internal Port | Service | |
| 147 | +|---------------|---------------|---------| |
| 148 | +| `4201` | `8080` | Keira3 Web UI | |
| 149 | +| N/A | `3001` | Database API (internal only) | |
| 150 | + |
| 151 | +### Resource Limits |
| 152 | + |
| 153 | +**Memory:** |
| 154 | +- Limit: 512MB |
| 155 | +- Reservation: 256MB |
| 156 | + |
| 157 | +**CPU:** |
| 158 | +- Limit: 0.5 cores |
| 159 | +- Reservation: 0.25 cores |
| 160 | + |
| 161 | +## Network Architecture |
| 162 | + |
| 163 | +``` |
| 164 | +┌─────────────────────────────────────────────────────┐ |
| 165 | +│ azerothcore network │ |
| 166 | +│ (172.28.0.0/16) │ |
| 167 | +├─────────────────────────────────────────────────────┤ |
| 168 | +│ │ |
| 169 | +│ ┌──────────────┐ ┌──────────────┐ │ |
| 170 | +│ │ ac-mysql │◄──────────┤ keira3-app │ │ |
| 171 | +│ │ (MySQL 8.0) │ │ (Nginx + │ │ |
| 172 | +│ │ Port: 3306 │ │ Node.js) │ │ |
| 173 | +│ └──────────────┘ │ Port: 8080 │ │ |
| 174 | +│ (acore-compose) └──────┬───────┘ │ |
| 175 | +│ │ │ |
| 176 | +└────────────────────────────────────┼────────────────┘ |
| 177 | + │ |
| 178 | + Port Mapping: 4201:8080 |
| 179 | + │ |
| 180 | + ▼ |
| 181 | + User Browser |
| 182 | + http://localhost:4201 |
| 183 | +``` |
| 184 | +
|
| 185 | +## Docker Commands |
| 186 | +
|
| 187 | +### Start Keira3 |
| 188 | +```bash |
| 189 | +docker-compose up -d |
| 190 | +``` |
| 191 | + |
| 192 | +### Stop Keira3 |
| 193 | +```bash |
| 194 | +docker-compose down |
| 195 | +``` |
| 196 | + |
| 197 | +### View logs |
| 198 | +```bash |
| 199 | +docker-compose logs -f keira3 |
| 200 | +``` |
| 201 | + |
| 202 | +### Rebuild and restart |
| 203 | +```bash |
| 204 | +docker-compose up -d --build |
| 205 | +``` |
| 206 | + |
| 207 | +### Check service health |
| 208 | +```bash |
| 209 | +docker-compose ps |
| 210 | +``` |
| 211 | + |
| 212 | +### Access container shell |
| 213 | +```bash |
| 214 | +docker exec -it keira3-app /bin/bash |
| 215 | +``` |
| 216 | + |
| 217 | +## Health Checks |
| 218 | + |
| 219 | +Keira3 includes built-in health checks: |
| 220 | + |
| 221 | +- **Endpoint:** `http://localhost:8080/health` |
| 222 | +- **Interval:** 30 seconds |
| 223 | +- **Timeout:** 10 seconds |
| 224 | +- **Retries:** 3 |
| 225 | +- **Start Period:** 40 seconds |
| 226 | + |
| 227 | +Check health status: |
| 228 | +```bash |
| 229 | +docker inspect keira3-app | grep -A 10 Health |
| 230 | +``` |
| 231 | + |
| 232 | +## Troubleshooting |
| 233 | + |
| 234 | +### Cannot connect to MySQL |
| 235 | + |
| 236 | +**Symptom:** Keira3 fails to connect to the database |
| 237 | + |
| 238 | +**Solution:** |
| 239 | +1. Verify ac-mysql container is running: |
| 240 | + ```bash |
| 241 | + docker ps | grep ac-mysql |
| 242 | + ``` |
| 243 | +2. Check network connectivity: |
| 244 | + ```bash |
| 245 | + docker exec keira3-app nc -zv ac-mysql 3306 |
| 246 | + ``` |
| 247 | +3. Verify database credentials in docker-compose.yml match acore-compose settings |
| 248 | + |
| 249 | +### Port 4201 already in use |
| 250 | + |
| 251 | +**Symptom:** Error: "port is already allocated" |
| 252 | + |
| 253 | +**Solution:** |
| 254 | +1. Change the external port in docker-compose.yml: |
| 255 | + ```yaml |
| 256 | + ports: |
| 257 | + - "8080:8080" # Or any available port |
| 258 | + ``` |
| 259 | +2. Access Keira3 at the new port |
| 260 | +
|
| 261 | +### Database API not responding |
| 262 | +
|
| 263 | +**Symptom:** Frontend loads but cannot connect to database |
| 264 | +
|
| 265 | +**Solution:** |
| 266 | +1. Check if database API is running: |
| 267 | + ```bash |
| 268 | + docker exec keira3-app netstat -tulpn | grep 3001 |
| 269 | + ``` |
| 270 | +2. Review database API logs: |
| 271 | + ```bash |
| 272 | + docker-compose logs keira3 | grep database-api |
| 273 | + ``` |
| 274 | + |
| 275 | +### Container keeps restarting |
| 276 | + |
| 277 | +**Symptom:** Container status shows "Restarting" |
| 278 | + |
| 279 | +**Solution:** |
| 280 | +1. Check container logs: |
| 281 | + ```bash |
| 282 | + docker-compose logs keira3 |
| 283 | + ``` |
| 284 | +2. Verify all required environment variables are set |
| 285 | +3. Check if azerothcore network exists: |
| 286 | + ```bash |
| 287 | + docker network ls | grep azerothcore |
| 288 | + ``` |
| 289 | + |
| 290 | +## Integration with acore-compose |
| 291 | + |
| 292 | +### Recommended Startup Order |
| 293 | + |
| 294 | +1. **Start acore-compose database:** |
| 295 | + ```bash |
| 296 | + cd ~/src/acore-compose |
| 297 | + docker-compose --profile db up -d |
| 298 | + ``` |
| 299 | + |
| 300 | +2. **Wait for MySQL to be healthy:** |
| 301 | + ```bash |
| 302 | + docker ps | grep ac-mysql |
| 303 | + # Look for "healthy" status |
| 304 | + ``` |
| 305 | + |
| 306 | +3. **Start Keira3:** |
| 307 | + ```bash |
| 308 | + cd ~/src/Keira3 |
| 309 | + docker-compose up -d |
| 310 | + ``` |
| 311 | + |
| 312 | +### Using with Full acore-compose Stack |
| 313 | + |
| 314 | +If you're running the full AzerothCore server stack: |
| 315 | + |
| 316 | +```bash |
| 317 | +# Start everything in acore-compose |
| 318 | +cd ~/src/acore-compose |
| 319 | +docker-compose --profile db --profile services-standard up -d |
| 320 | + |
| 321 | +# Start Keira3 |
| 322 | +cd ~/src/Keira3 |
| 323 | +docker-compose up -d |
| 324 | +``` |
| 325 | + |
| 326 | +### Accessing Other Databases |
| 327 | + |
| 328 | +To connect to different databases, modify the `KEIRA_DATABASE_NAME` variable: |
| 329 | + |
| 330 | +```yaml |
| 331 | +KEIRA_DATABASE_NAME: acore_characters # For characters database |
| 332 | +KEIRA_DATABASE_NAME: acore_auth # For auth database |
| 333 | +``` |
| 334 | +
|
| 335 | +## Production Deployment |
| 336 | +
|
| 337 | +For production deployments, consider: |
| 338 | +
|
| 339 | +1. **Use stronger passwords** - Change all default passwords |
| 340 | +2. **Enable HTTPS** - Use a reverse proxy (nginx/Caddy) with SSL |
| 341 | +3. **Increase resource limits** - Based on your server capacity |
| 342 | +4. **Set up backups** - Regular database backups via acore-compose |
| 343 | +5. **Monitor logs** - Set up log aggregation (ELK stack, etc.) |
| 344 | +6. **Network isolation** - Restrict access to internal network only |
| 345 | +
|
| 346 | +## Additional Resources |
| 347 | +
|
| 348 | +- **acore-compose repository:** `~/src/acore-compose` |
| 349 | +- **Keira3 documentation:** https://github.com/azerothcore/Keira3 |
| 350 | +- **AzerothCore wiki:** https://www.azerothcore.org/wiki/ |
0 commit comments