78 lines
1.5 KiB
Markdown
78 lines
1.5 KiB
Markdown
# Svelte MUD Docker Setup
|
|
|
|
This guide explains how to use Docker to build and run the Svelte MUD client.
|
|
|
|
## 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.
|
|
|
|
## 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
|
|
```
|
|
|
|
2. Build and start the container:
|
|
```bash
|
|
docker-compose up -d
|
|
```
|
|
|
|
3. Access the application:
|
|
- Web interface: http://localhost:3000
|
|
- WebSocket server: ws://localhost:3001/mud-ws
|
|
|
|
## 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
|
|
# View logs
|
|
docker-compose logs -f
|
|
```
|
|
|
|
## Caddy Configuration
|
|
|
|
For use with Caddy as a reverse proxy, use this simple configuration:
|
|
|
|
```
|
|
mud.example.com {
|
|
reverse_proxy svelte-mud:3000
|
|
}
|
|
```
|
|
|
|
Both the web interface and WebSocket connections will be routed correctly through this single reverse proxy rule.
|
|
|
|
## Troubleshooting
|
|
|
|
If you encounter any issues, check the container logs:
|
|
|
|
```bash
|
|
docker-compose logs -f
|
|
```
|