Download DEPLOY.md from deanpowers/blind-monkeys: direct link, hf CLI and curl.
- Browser
- Download file 7.55 kB
-
https://huggingface.co/deanpowers/blind-monkeys/resolve/main/DEPLOY.md
- Command line
-
hf download hf://deanpowers/blind-monkeys/DEPLOY.md
-
curl -L -o DEPLOY.md https://huggingface.co/deanpowers/blind-monkeys/resolve/main/DEPLOY.md
Blind Monkeys β Self-Hosting / Deployment Guide
This guide explains how to run the complete Blind Monkeys application (rising-coin scanner, Bybit grid bots, combo futures, Telegram alerts) on your own Google Cloud account with your own Bybit and Telegram credentials. No coding knowledge is required beyond copying commands.
1. What you need before starting
| Service | Purpose |
|---|---|
| Bybit account | Trading (futures grid bots + combo futures) |
| Telegram account | Alert bot + notification channels |
| Google Cloud account | Hosting (free tier is enough to start) |
| A domain (optional) | Nice URLs like scan.yourdomain.com |
Estimated setup time: 30β45 minutes.
2. Generate the Bybit API keys
- Log in to Bybit β API Management (
bybit.com/en/user/api-management) - Click Create New API Key β choose System-generated API keys
- Set permissions:
- β Account β Wallet balance, Account transfer
- β Trade β Futures (covers grid bots and combo futures)
- β Do not enable withdrawal permissions β the app never needs them
- IP restriction: Bybit cannot restrict to dynamic Cloud Run IPs, so most self-hosters leave it unrestricted. This is acceptable because the key has no withdrawal rights. If you prefer, restrict to your own home IP and only run the scanner from there.
- Complete 2FA. Bybit shows the API key and API secret once β save the secret immediately (it is never shown again).
- Fund the account:
- Transfer USDT into the Funding account β grid bots draw from it
- Keep margin in Unified Trading for combo futures
β οΈ Security rules
- The API secret goes into a secret manager only β never into code, config files, or chat messages.
- If a key ever leaks: delete it in Bybit and create a new one (~1 min).
- The app's trader service is IAM-locked (below) so the open internet cannot invoke the trading endpoints directly.
3. Create the Telegram bot and channels
- Message @BotFather in Telegram β
/newbotβ follow the prompts. You receive a bot token like123456789:AAxxxxxxxxxxxxxxxxxxxx. - Create the notification channels you want, then add your bot as an Administrator in each (it must be an admin to post).
- Get each channel's ID: post one message inside the channel, then open
https://api.telegram.org/bot<TOKEN>/getUpdatesin a browser β each channel appears with itsid(format-100xxxxxxxxxx) and title. - Get your personal chat ID by messaging @userinfobot (used for admin notifications).
Typical channel layout:
| Channel | Events |
|---|---|
| Blind Monkey | daily / hourly riser scans |
| Grid New | new grid bot opened |
| Grid Profit | every grid profit event |
| Grid Closures | TP / SL / manual closes |
| Futures New | combo futures opened |
| Futures Funding | funding fees paid/received |
| Futures Close | futures TP / SL closures |
4. Google Cloud setup
Install the gcloud CLI (https://cloud.google.com/sdk/docs/install), then:
gcloud auth login
gcloud config set project YOUR-PROJECT-ID
gcloud services enable run cloudbuild.googleapis.com secretmanager.googleapis.com \
cloudscheduler.googleapis.com storage.googleapis.com
Create the secrets
printf 'YOUR_BYBIT_API_KEY' | gcloud secrets create bybit-api-key --data-file=-
printf 'YOUR_BYBIT_SECRET' | gcloud secrets create bybit-api-secret --data-file=-
printf 'YOUR_TELEGRAM_TOKEN' | gcloud secrets create telegram-bot-token --data-file=-
printf 'SOME_RANDOM_STRING' | gcloud secrets create flask-secret --data-file=-
5. Deploy the services
5.1 Trader (IAM-restricted β only the scanner may call it)
gcloud run deploy bm-trader --region europe-west1 --source trader-service \
--set-env-vars "TELEGRAM_CHAT_ID=YOUR_CHAT_ID" \
--set-secrets "BYBIT_API_KEY=bybit-api-key:latest,BYBIT_API_SECRET=bybit-api-secret:latest,TELEGRAM_BOT_TOKEN=telegram-bot-token:latest" \
--no-allow-unauthenticated
Note the trader URL that gcloud prints β you need it in the next step.
5.2 Scanner (public)
gcloud run deploy bm-scanner --region europe-west1 --source scanner-service \
--set-env-vars "TRADER_URL=<TRADER_URL_FROM_STEP_5.1>,TELEGRAM_CHAT_ID=YOUR_CHAT_ID" \
--set-secrets "TELEGRAM_BOT_TOKEN=telegram-bot-token:latest,FLASK_SECRET=flask-secret:latest" \
--allow-unauthenticated
5.3 Scheduler jobs (automation)
# Hourly rising-coin scan (runs at :15 past each hour)
gcloud scheduler jobs create http hourly-scan --location europe-west1 \
--schedule "15 * * * *" --uri "<SCANNER_URL>/run" --http-method GET
# Daily summary to Telegram
gcloud scheduler jobs create http daily-summary --location europe-west1 \
--schedule "0 8 * * *" --uri "<SCANNER_URL>/summary" --http-method GET
The scanner also detects bot closures, grid-profit events, and funding fees automatically whenever the grid page is open (90-second event-check cycle).
5.4 Main website (optional)
The main site (home page, financials, settings) deploys the same way from the
blind-monkeys/ directory:
gcloud run deploy bm-site --region us-central1 --source blind-monkeys \
--set-env-vars "FLASK_ENV=production" \
--set-secrets "FLASK_SECRET=flask-secret:latest,TELEGRAM_BOT_TOKEN=telegram-bot-token:latest,TELEGRAM_CHAT_ID=YOUR_CHAT_ID" \
--allow-unauthenticated
6. Custom domain (optional)
gcloud beta run domain-mappings create --domain scan.yourdomain.com \
--service bm-scanner --region europe-west1
Then add the CNAME record shown in the command output
(ghs.googlehosted.com) to your DNS provider. Certificate provisioning
starts as soon as the DNS record resolves (usually minutes).
7. Verify the installation
| Check | Expected |
|---|---|
Open <SCANNER_URL>/healthz |
ok |
| Open the scanner home page | Rising-coins table loads (~30β60 s first scan) |
Open <SCANNER_URL>/grid |
Grid tables + balance panel load |
| Balance panel shows your USDT | Funding / Unified / Grid values match Bybit |
| Post a test message via the bot to a channel | Message arrives |
8. Operating notes
- Grid settings (leverage, range, amount, TP/SL, auto-open score) are
configured on the scanner's
/gridpage β admin only. - Risk controls: every grid bot carries a TP and SL; there is a daily investment cap; completed bots are archived (releasing funds) and tracked for win rate.
- The score-weight feedback loop refines coin selection automatically from realized grid returns β no configuration needed.
- Costs: two Cloud Run services on the free tier plus a few scheduler jobs β $0β2/month. Cloud Build minutes are free up to the daily quota.
9. Troubleshooting
| Symptom | Fix |
|---|---|
| Balance shows $0 | Check the API key has Wallet balance permission; check USDT is in the Funding account |
| Telegram silent | Bot must be an admin of each channel; check channel IDs via getUpdates |
| 403 on trader URLs | Expected β the trader is IAM-internal; only the scanner (with OIDC) may call it |
| Grid page stuck on "Loadingβ¦" | Bybit API latency β allow ~10 s; check the trader logs: gcloud run services logs read bm-trader --region europe-west1 --limit 50 |
| Certificate pending on custom domain | DNS CNAME not propagated yet β wait, then re-check |