|
| 1 | +--- |
| 2 | +title: Docker |
| 3 | +description: Sim Studio mit Docker Compose bereitstellen |
| 4 | +--- |
| 5 | + |
| 6 | +import { Tab, Tabs } from 'fumadocs-ui/components/tabs' |
| 7 | +import { Callout } from 'fumadocs-ui/components/callout' |
| 8 | + |
| 9 | +## Schnellstart |
| 10 | + |
| 11 | +```bash |
| 12 | +# Clone and start |
| 13 | +git clone https://github.com/simstudioai/sim.git && cd sim |
| 14 | +docker compose -f docker-compose.prod.yml up -d |
| 15 | +``` |
| 16 | + |
| 17 | +Öffnen Sie [http://localhost:3000](http://localhost:3000) |
| 18 | + |
| 19 | +## Produktionseinrichtung |
| 20 | + |
| 21 | +### 1. Umgebung konfigurieren |
| 22 | + |
| 23 | +```bash |
| 24 | +# Generate secrets |
| 25 | +cat > .env << EOF |
| 26 | +DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio |
| 27 | +BETTER_AUTH_SECRET=$(openssl rand -hex 32) |
| 28 | +ENCRYPTION_KEY=$(openssl rand -hex 32) |
| 29 | +INTERNAL_API_SECRET=$(openssl rand -hex 32) |
| 30 | +NEXT_PUBLIC_APP_URL=https://sim.yourdomain.com |
| 31 | +BETTER_AUTH_URL=https://sim.yourdomain.com |
| 32 | +NEXT_PUBLIC_SOCKET_URL=https://sim.yourdomain.com |
| 33 | +EOF |
| 34 | +``` |
| 35 | + |
| 36 | +### 2. Dienste starten |
| 37 | + |
| 38 | +```bash |
| 39 | +docker compose -f docker-compose.prod.yml up -d |
| 40 | +``` |
| 41 | + |
| 42 | +### 3. SSL einrichten |
| 43 | + |
| 44 | +<Tabs items={['Caddy (Empfohlen)', 'Nginx + Certbot']}> |
| 45 | + <Tab value="Caddy (Empfohlen)"> |
| 46 | +Caddy verwaltet SSL-Zertifikate automatisch. |
| 47 | + |
| 48 | +```bash |
| 49 | +# Install Caddy |
| 50 | +sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl |
| 51 | +curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg |
| 52 | +curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list |
| 53 | +sudo apt update && sudo apt install caddy |
| 54 | +``` |
| 55 | + |
| 56 | +Erstellen Sie `/etc/caddy/Caddyfile`: |
| 57 | + |
| 58 | +``` |
| 59 | +sim.yourdomain.com { |
| 60 | + reverse_proxy localhost:3000 |
| 61 | +
|
| 62 | + handle /socket.io/* { |
| 63 | + reverse_proxy localhost:3002 |
| 64 | + } |
| 65 | +} |
| 66 | +``` |
| 67 | + |
| 68 | +```bash |
| 69 | +sudo systemctl restart caddy |
| 70 | +``` |
| 71 | + |
| 72 | + </Tab> |
| 73 | + <Tab value="Nginx + Certbot"> |
| 74 | + |
| 75 | +```bash |
| 76 | +# Install |
| 77 | +sudo apt install nginx certbot python3-certbot-nginx -y |
| 78 | + |
| 79 | +# Create /etc/nginx/sites-available/sim |
| 80 | +server { |
| 81 | + listen 80; |
| 82 | + server_name sim.yourdomain.com; |
| 83 | + |
| 84 | + location / { |
| 85 | + proxy_pass http://127.0.0.1:3000; |
| 86 | + proxy_http_version 1.1; |
| 87 | + proxy_set_header Upgrade $http_upgrade; |
| 88 | + proxy_set_header Connection 'upgrade'; |
| 89 | + proxy_set_header Host $host; |
| 90 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 91 | + } |
| 92 | + |
| 93 | + location /socket.io/ { |
| 94 | + proxy_pass http://127.0.0.1:3002; |
| 95 | + proxy_http_version 1.1; |
| 96 | + proxy_set_header Upgrade $http_upgrade; |
| 97 | + proxy_set_header Connection "upgrade"; |
| 98 | + } |
| 99 | +} |
| 100 | + |
| 101 | +# Enable and get certificate |
| 102 | +sudo ln -s /etc/nginx/sites-available/sim /etc/nginx/sites-enabled/ |
| 103 | +sudo certbot --nginx -d sim.yourdomain.com |
| 104 | +``` |
| 105 | + |
| 106 | + </Tab> |
| 107 | +</Tabs> |
| 108 | + |
| 109 | +## Ollama |
| 110 | + |
| 111 | +```bash |
| 112 | +# With GPU |
| 113 | +docker compose -f docker-compose.ollama.yml --profile gpu --profile setup up -d |
| 114 | + |
| 115 | +# CPU only |
| 116 | +docker compose -f docker-compose.ollama.yml --profile cpu --profile setup up -d |
| 117 | +``` |
| 118 | + |
| 119 | +Zusätzliche Modelle herunterladen: |
| 120 | + |
| 121 | +```bash |
| 122 | +docker compose -f docker-compose.ollama.yml exec ollama ollama pull llama3.2 |
| 123 | +``` |
| 124 | + |
| 125 | +### Externes Ollama |
| 126 | + |
| 127 | +Wenn Ollama auf Ihrem Host-Rechner läuft (nicht in Docker): |
| 128 | + |
| 129 | +```bash |
| 130 | +# macOS/Windows |
| 131 | +OLLAMA_URL=http://host.docker.internal:11434 docker compose -f docker-compose.prod.yml up -d |
| 132 | + |
| 133 | +# Linux - use your host IP |
| 134 | +OLLAMA_URL=http://192.168.1.100:11434 docker compose -f docker-compose.prod.yml up -d |
| 135 | +``` |
| 136 | + |
| 137 | +<Callout type="warning"> |
| 138 | + Innerhalb von Docker bezieht sich `localhost` auf den Container, nicht auf Ihren Host. Verwenden Sie `host.docker.internal` oder die IP-Adresse Ihres Hosts. |
| 139 | +</Callout> |
| 140 | + |
| 141 | +## Befehle |
| 142 | + |
| 143 | +```bash |
| 144 | +# View logs |
| 145 | +docker compose -f docker-compose.prod.yml logs -f simstudio |
| 146 | + |
| 147 | +# Stop |
| 148 | +docker compose -f docker-compose.prod.yml down |
| 149 | + |
| 150 | +# Update |
| 151 | +docker compose -f docker-compose.prod.yml pull && docker compose -f docker-compose.prod.yml up -d |
| 152 | + |
| 153 | +# Backup database |
| 154 | +docker compose -f docker-compose.prod.yml exec db pg_dump -U postgres simstudio > backup.sql |
| 155 | +``` |
0 commit comments