Files
svelte-mud/DOCKER-README.md

78 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2025-04-21 14:12:36 +02:00
# Svelte MUD Docker Setup
This guide explains how to use Docker to build and run the Svelte MUD client.
2025-04-21 23:22:32 +02:00
## Solution Overview
This setup runs both the SvelteKit application and the WebSocket server in a single container, avoiding CORS issues. It follows the same approach used in development, where both servers run as separate processes but within the same context.
2025-04-21 14:12:36 +02:00
## Prerequisites
- [Docker](https://docs.docker.com/get-docker/)
- [Docker Compose](https://docs.docker.com/compose/install/) (usually included with Docker Desktop)
## Quick Start
1. Navigate to the project directory:
```bash
cd path/to/svelte-mud
```
2025-04-21 23:22:32 +02:00
2. Build and start the container:
2025-04-21 14:12:36 +02:00
```bash
docker-compose up -d
```
3. Access the application:
- Web interface: http://localhost:3000
2025-04-21 23:22:32 +02:00
- WebSocket server: ws://localhost:3001/mud-ws
2025-04-21 14:12:36 +02:00
## Docker Commands
### Starting the Application
```bash
# Build and start in detached mode
docker-compose up -d
# Build and start with logs
docker-compose up
# Force rebuild
docker-compose up --build
```
### Stopping the Application
```bash
# Stop containers
docker-compose down
```
### Viewing Logs
```bash
2025-04-21 23:22:32 +02:00
# View logs
2025-04-21 14:12:36 +02:00
docker-compose logs -f
```
2025-04-21 23:22:32 +02:00
## Caddy Configuration
2025-04-21 14:12:36 +02:00
2025-04-21 23:22:32 +02:00
For use with Caddy as a reverse proxy, use this simple configuration:
2025-04-21 14:12:36 +02:00
2025-04-21 23:22:32 +02:00
```
mud.example.com {
reverse_proxy svelte-mud:3000
}
2025-04-21 14:12:36 +02:00
```
2025-04-21 23:22:32 +02:00
Both the web interface and WebSocket connections will be routed correctly through this single reverse proxy rule.
2025-04-21 14:12:36 +02:00
## Troubleshooting
2025-04-21 23:22:32 +02:00
If you encounter any issues, check the container logs:
2025-04-21 14:12:36 +02:00
2025-04-21 23:22:32 +02:00
```bash
docker-compose logs -f
```