{"success":true,"name":"hosting-provider-selection","description":"Use when picking or moving to a [PRIVATE_HOST]/host. Tested, cut over.","category":"devops","path":"devops/hosting-provider-selection/SKILL.md","file":"SKILL.md","content":"---\nname: hosting-provider-selection\ndescription: Use when picking or moving to a [PRIVATE_HOST]/host. Tested, cut over.\n---\n\n# Choosing a [PRIVATE_HOST] / hosting provider (latency + price + traffic)\n\n## When to Use\nThe owner asks for a server/[PRIVATE_HOST]/static IP \"with less than N ms for Tunisians\", wants providers compared, shares provider screenshots/URLs, or asks \"should I pick this\". Output follows `colored-comparison-tables` (widget on desktop) — one table, few lines.\n\n## Procedure\n1. **Pin the brief before searching** (each was a correction round when missed): latency target (e.g. < 40 ms from Tunisia), budget ceiling, currency (owner wants **TND**, VAT included — Tunisian prices are HT, TTC = HT × 1.19), and the ROLE of the server:\n   - *full copy* of the current [PRIVATE_HOST] → size from live usage (RAM used, disk used after log cleanup, container count);\n   - *fixed-IP gateway* in front of home PCs ([PRIVATE_HOST]/[PRIVATE_HOST]) → 1 GB plan is enough; latency counts twice (user→[PRIVATE_HOST]→home), so only an in-country [PRIVATE_HOST] stays low.\n   Ask once with `clarify` if the role is unclear; it flips the whole ranking.\n2. **Search wider than the links given.** Screenshots/URLs from the owner are a starting set, not the list: also search local hosts (Tunisia: OxaHost, ATI, GNET/GlobalNet, Safozi, Atlax, Topnet, Hodi, deeploy.tn) and cheap near-Europe (OVH Gravelines, Aruba Italy, EDIS Marseille/Palermo, IONOS, Contabo). Read every screenshot the owner sent — they are the core of \"real compare\".\n3. **Measure ping yourself, never trust marketing ms.** Use the provider's published test IP, else its looking-glass/speedtest node, else its own website/client-area IP (resolve with `dig +short`; Cloudflare IPs prove nothing). Two vantage points, in parallel:\n   - Globalping API from Tunisia: POST `https://api.globalping.io/v1/measurements` `{\"type\":\"ping\",\"target\":IP,\"locations\":[{\"country\":\"TN\"}],\"limit\":3,\"measurementOptions\":{\"packets\":8}}`, poll `/v1/measurements/<id>` until `finished`. Do not set both a global `limit` and `locations[].limit` (400 error). Probe `asn` filters also work (ping *from* a provider's network when it has no test IP).\n   - Owner's own line: `ssh [PRIVATE_HOST] 'ping -c 6 -q <ip> | tail -1'`.\n   A single spiky run → rerun before judging. Label which IP was tested (\"network IP, not a rented [PRIVATE_HOST]\").\n4. **Count bandwidth from real counters, not graphs.** On the current [PRIVATE_HOST]: `/proc/net/dev` eth0 rx/tx ÷ days since `uptime -s` → per-30-day in/out; a 20 s delta sample for the current rate; `ss -tn state established` for top peers. Compare each plan's quota against three scenarios: past average, gateway-only (≈ outgoing × 2), today's rate. Note whether the host counts in+out or out only.\n5. **Check the disk/RAM fit.** `free -h`, `df -h /`, `du -xsh [PATH] /var/log`, `journalctl --disk-usage`; PM2 bot logs are usually most of the disk — state the size *after* log cleanup and recommend rotation (pm2-logrotate ~100 MB × 5, journal ≤ 200 MB). Prod [PRIVATE_HOST] stays read-only.\n6. **Before \"buy this\", open the real order page** (provider pricing JSON/slider data, store/cart page): confirm plan tiers (the next tier up is often the better buy), billing cycle (recommend Monthly for a trial), setup fees, add-ons to skip, money-back days, virtualization (OpenVZ ⇒ ask whether Docker works), fixed IPv4 and its country. Give the exact question to send the provider in French.\n7. **Table**: rows sorted fastest → best price for the owner's use; columns = ping (Tunis probe / [PRIVATE_HOST] / user→[PRIVATE_HOST]→home when gateway), price/mo TND, specs vs need, traffic·port, verdict. Hide over-budget rows but name them in one footer line. Unverified data (listing sites, 404 pages, promo-then-renewal prices) in gray/yellow.\n\n## Pitfalls\n- Explain units when the owner reads a port spec: 100 Mbps = 12.5 MB/s; compare it to measured average Mbps (GB/month × 8000 / 2.592e6 s) and to per-user needs (pages/s, API calls/s, video viewers).\n- VAT on the invoice proves a local company, not a local server/IP — check the IP's range and ping it.\n- Server location is a weak Google ranking signal; the real wins are speed (TTFB), ccTLD/Search Console targeting, Google Business Profile and local content. After a move, resubmit sitemaps and watch Search Console 2–4 weeks.\n- When a provider's checkout goes down mid-purchase, verify from two vantage points (`curl -w '%{http_code}'` from Mac and [PRIVATE_HOST]), report, and offer the next-ranked option.\n- Check live stock before recommending: OVH [PRIVATE_HOST] datacenter stock is at `https://eu.api.ovh.com/1.0/[PRIVATE_HOST]/order/rule/datacenter?ovhSubsidiary=TN&planCode=[PRIVATE_HOST]-2027-model2` (model1/2/3); Europe Linux was out of stock while the configurator still offered Canada (~120 ms).\n- The owner wants hosts ordered and paid online with no human step. Click through to the payment step before recommending: several Tunisian \"Commander\" buttons end on quote forms, empty stores or appointment pages (GNET, Atlax, ATI — see `references/tunisia-providers.md`).\n- Promo prices: read the asterisk and quote the after-promo total with VAT (Aruba H.4-8 €5 = purchase + 2 renewals only, then €10.49; add 22% IT VAT). Budget the steady-state month, not month 1.\n- Combo pattern for low budget: cheap 8 GB host ≤ 40 ms (Aruba IT1 Arezzo) + 1–2 GB Tunisian-IP front. In practice a single in-country [PRIVATE_HOST] fronting the home PCs beat the combo (sub-ms ping, one bill).\n- Home-hosting behind a [PRIVATE_HOST]: tunnel outbound from the home PC so no public IPv4 is needed at home. OpenVZ has no TUN, so WireGuard is out — use SSH reverse tunnels (`-R`) to a restricted user. Keep money/critical sites with a fallback; list power/backup-line/data-cap risks.\n- OpenVZ (Safozi) facts to state up front: Docker works (overlayfs, cgroup v1 — test with `docker run --rm hello-world`); zram and swap files are impossible (no modules, `swapon` not permitted; the host gives fixed fake swap = RAM size); disk type is hidden behind ploop — measure with `dd oflag=direct` + `fio` 4k randread instead of guessing NVMe.\n- Paid plan upgrades on Tunisian hosts may not auto-apply: re-check `nproc`/`free -m`/`df -h /` after payment; if unchanged after a reboot, have the owner open a ticket citing the invoice number before planning around the new size.\n\n## After buying: migrating onto the new server\nRun `scripts/[PRIVATE_HOST]-inventory.sh` on the old host for the \"what's left / migrate everything\" list, then follow `references/[PRIVATE_HOST]-cutover.md` (front-door Caddy, reverse tunnels, inventory of what is left on the old host, per-domain DNS cutover with cert copy, app copy, verification). The owner's goal is to cancel the old host: every fix must make sites independent of it (DNS straight to the new IP), and \"what's left\" answers come from the Caddyfile port→app map, never from guessing which PM2 apps are workers.\n- \"Fix it\" means the agent makes the change: re-try driving the DNS panel (re-open the page, wait, retry) before handing the owner manual steps; hand off only for a real human gate (captcha, login, 2FA) and name that gate.\n- \"Full migration\" = everything found by Caddy + PM2 + Docker + services, not a hand-picked list; when the owner says to detect it, run the inventory script instead of reasoning from memory.\n- Never bulk-rsync the old `[PATH]` over the new `[PATH]`: it replaces the new box's SSH keys (lockout) and PM2 state (running apps die, old bots resurrect on reboot). Copy per app folder with `.ssh/` and `.pm2/` excluded, and set up a non-root sudo admin user first so no copy can lock you out — see `references/[PRIVATE_HOST]-cutover.md` §1 and §4, which also has the malware gate the owner requires before any copied code runs.\n- \"Migrate all\" after the copy: follow `references/[PRIVATE_HOST]-cutover.md` §5 (PM2 settings via `scripts/pm2-eco-from-jlist.py`, start Next apps with `run start` not `prod`, Caddy blocks via `scripts/caddy-blocks.py`, DB order) and its trading-bots section: exchange keys are IP-whitelisted to the old server, so get the new IP whitelisted before stopping any bot.\n- After the copy, before any cancel: pull users' later changes with the dry-run delta, move Docker with `scripts/docker-move.sh`, move bots account by account after `scripts/exchange-key-check.js` passes from the new IP (switch each with `scripts/bot-server-move.js`; kill only that account on the old host, restart gap-multi only on the new one; add the new hostname to the dashboard dropdown `dashboard/data/servers.json`), and stop each old duplicate once its traffic is forwarded (`references/[PRIVATE_HOST]-cutover.md` §4, §5b, bots).\n- A site moved to a new domain that loads but sits on \"Preparing…\" usually needs its origin added to the API's CORS allow-list — recipe in `references/[PRIVATE_HOST]-cutover.md`.\n- DNS switch at scale: hPanel's Hostinger Agent does the bulk edit, but the owner's rule is \"give their AI ~3 min, then check and fix yourself one by one\" — verify every hostname on every NS with `scripts/dns-verify.sh` and the zone table, then fix misses individually (`references/[PRIVATE_HOST]-cutover.md` §3).\n- Write status in plain words, not jargon: a \"DNS still Hostinger\" cell needs one line saying visitors are still sent to the old server, plus what changes when it is switched.\n","linked_files":["references/[PRIVATE_HOST]-cutover.md","references/tunisia-providers.md","scripts/[PRIVATE_HOST]-inventory.sh","scripts/bot-server-move.js","scripts/caddy-blocks.py","scripts/dns-verify.sh","scripts/docker-move.sh","scripts/exchange-key-check.js","scripts/pm2-eco-from-jlist.py"],"origin":"brimind","owner_id":null,"source":"router"}