opencode / DEPLOY.md
abbasyk60's picture
Add Render deployment config and guide
a2fb4d4
|
Raw
History Blame Contribute Delete
1.69 kB
# Deploy to Render.com (Free 24/7 Hosting)
## Step 1: Create Render Account
1. Go to **https://render.com**
2. Sign up with your GitHub account
## Step 2: Push Code to GitHub
```bash
cd C:\Users\abbasyk\Documents\opencode-hf-space
git init
git add -A
git commit -m "Initial commit"
git remote add origin https://github.com/YOUR_USERNAME/opencode-bot.git
git push -u origin main
```
## Step 3: Create Background Worker on Render
1. Go to **https://dashboard.render.com**
2. Click **"New +"****"Background Worker"**
3. Connect your GitHub repo
4. Settings:
- **Name**: opencode-telegram-bot
- **Runtime**: Node
- **Build Command**: `npm install`
- **Start Command**: `node bot.js`
5. Click **"Advanced"** → Add these **Environment Variables**:
| Key | Value |
|-----|-------|
| `TELEGRAM_BOT_TOKEN` | `8835963099:AAHvLdFqbpsfDs3hTUBXuFQzSo3LSpedd6k` |
| `TELEGRAM_CHAT_ID` | `6922119748` |
| `OPENCODE_ZEN_KEY` | `sk-1IwuYl2EKD0bNtmoEPqBVuWQHlKlc7gN5VLFZnjBrGTUbg7O1376dM9eYg8AHaUv` |
6. Click **"Create Background Worker"**
## Step 4: Verify
- Go to your service page on Render
- Check **"Logs"** tab - you should see:
```
[OK] Starting Telegram bot...
[OK] Telegram bot is running!
```
## Free Tier Limitations
- **750 hours/month** (enough for 24/7)
- **Sleeps after 15 min** of inactivity (but Telegram bot keeps it awake)
- **Spins up in ~30 seconds** when new message arrives
## Alternative: Fly.io
If Render doesn't work, try Fly.io:
1. Install: `curl -L https://fly.io/install.sh | sh`
2. Run: `fly auth login`
3. Run: `fly launch`
4. Run: `fly secrets set TELEGRAM_BOT_TOKEN=... TELEGRAM_CHAT_ID=... OPENCODE_ZEN_KEY=...`
5. Run: `fly deploy`