# クラウドプラットフォーム

クラウドプラットフォームにSteelEngineをデプロイする

## Railway

ワンクリックデプロイメントで自動的にPostgreSQLをプロビジョニングします。

\[

![Railwayにデプロイ](https://railway.app/button.svg)

]\([https://railway.com/new/template/steelengine](https://railway.com/new/template/steelengine))

デプロイ後、Railwayダッシュボードで環境変数を追加してください：

* `BETTER_AUTH_SECRET`, `ENCRYPTION_KEY`, `INTERNAL_API_SECRET` (自動生成)
* `OPENAI_API_KEY` または他のAIプロバイダーキー
* 設定 → ネットワーキングでカスタムドメイン

## VPSデプロイメント

DigitalOcean、AWS EC2、Azure VMsまたは任意のLinuxサーバー向け：

**DigitalOcean**

**推奨：** 16 GB RAMドロップレット、Ubuntu 24.04

```bash
# Create Droplet via console, then SSH in
ssh root@your-droplet-ip
```

**AWS EC2**

**推奨：** t3.xlarge (16 GB RAM)、Ubuntu 24.04

```bash
ssh -i your-key.pem ubuntu@your-ec2-ip
```

**Azure VM**

**推奨：** Standard\_D4s\_v3 (16 GB RAM)、Ubuntu 24.04

```bash
ssh azureuser@your-vm-ip
```

### Dockerのインストール

```bash
# Install Docker (official method)
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USER

# Logout and reconnect, then verify
docker --version
```

### SteelEngineのデプロイ

```bash
git clone https://github.com/steelengineai/steelengine.git && cd steelengine

# Create .env with 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

# Start
docker compose -f docker-compose.prod.yml up -d
```

### CaddyによるSSL

```bash
# 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

# Configure (replace domain)
echo 'steelengine.yourdomain.com {
    reverse_proxy localhost:3000
    handle /socket.io/* {
        reverse_proxy localhost:3002
    }
}' | sudo tee /etc/caddy/Caddyfile

sudo systemctl restart caddy
```

ドメインのDNS AレコードをサーバーのIPアドレスに向けてください。

## Kubernetes (EKS, AKS, GKE)

[Kubernetesガイド](/self-hosting/kubernetes)でマネージドKubernetesへのHelmデプロイメントについて確認してください。

## マネージドデータベース（オプション）

本番環境では、マネージドPostgreSQLサービスを使用してください：

* **AWS RDS** / **Azure Database** / **Cloud SQL** - pgvector拡張機能を有効化
* **Supabase** / **Neon** - pgvector搭載済み

環境に`DATABASE_URL`を設定してください：

```bash
DATABASE_URL="postgresql://user:pass@host:5432/db?sslmode=require"
```
