Docker

Docker Composeを使用してSteelEngineをデプロイする

クイックスタート

# Clone and start
git clone https://github.com/steelengineai/steelengine.git && cd steelengine
docker compose -f docker-compose.prod.yml up -d

http://localhost:3000を開く

本番環境のセットアップ

1. 環境の設定

# Generate secrets
cat > .env << EOF
DATABASE_URL=postgresql://postgres:postgres@db:5432/steelengine
BETTER_AUTH_SECRET=$(openssl rand -hex 32)
ENCRYPTION_KEY=$(openssl rand -hex 32)
INTERNAL_API_SECRET=$(openssl rand -hex 32)
NEXT_PUBLIC_APP_URL=https://steelengine.yourdomain.com
BETTER_AUTH_URL=https://steelengine.yourdomain.com
NEXT_PUBLIC_SOCKET_URL=https://steelengine.yourdomain.com
EOF

2. サービスの起動

docker compose -f docker-compose.prod.yml up -d

3. SSLの設定

Caddyは自動的にSSL証明書を処理します。

# Install Caddy
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update && sudo apt install caddy

/etc/caddy/Caddyfileを作成します:

steelengine.yourdomain.com {
    reverse_proxy localhost:3000

    handle /socket.io/* {
        reverse_proxy localhost:3002
    }
}
sudo systemctl restart caddy

Ollama

# With GPU
docker compose -f docker-compose.ollama.yml --profile gpu --profile setup up -d

# CPU only
docker compose -f docker-compose.ollama.yml --profile cpu --profile setup up -d

追加モデルを取得:

docker compose -f docker-compose.ollama.yml exec ollama ollama pull llama3.2

外部Ollama

Ollamaがホストマシン上で実行されている場合(Dockerではない):

# macOS/Windows
OLLAMA_URL=http://host.docker.internal:11434 docker compose -f docker-compose.prod.yml up -d

# Linux - use your host IP
OLLAMA_URL=http://192.168.1.100:11434 docker compose -f docker-compose.prod.yml up -d

Docker内では、localhostはホストではなくコンテナを指します。host.docker.internalまたはホストのIPを使用してください。

コマンド

# View logs
docker compose -f docker-compose.prod.yml logs -f steelengine

# Stop
docker compose -f docker-compose.prod.yml down

# Update
docker compose -f docker-compose.prod.yml pull && docker compose -f docker-compose.prod.yml up -d

# Backup database
docker compose -f docker-compose.prod.yml exec db pg_dump -U postgres steelengine > backup.sql

On this page