Commit Graph

6 Commits

Author SHA1 Message Date
kappa
d41f1ee841 fix: pass API URL params to ProvisioningService in all handlers
- Add env.LINODE_API_URL and env.VULTR_API_URL to all ProvisioningService
  constructor calls in provision.ts
- Fixes delete and other operations using wrong API endpoint (defaulting
  to api.linode.com instead of configured emulator URL)
- Affected handlers: handleGetOrders, handleGetOrder, handleDeleteOrder,
  handleGetBalance, handleGetOsImages

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 11:38:54 +09:00
kappa
f7aa571ae3 fix: correct provider lookup in deleteServer
Bug: deleteServer was using pricing.provider_name (always "Anvil")
instead of pricing.source_provider (linode/vultr).

Changes:
- provisioning-service.ts: Use source_provider for provider lookup
- provision.ts: Add user validation and better error handling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 11:25:08 +09:00
kappa
1c65c02045 feat: add GET /api/provision/images endpoint
- Add handleGetOsImages handler in provision.ts
- Add getOsImages method in ProvisioningService
- Add route in index.ts
- Returns key, name, family, is_default for each OS image

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 10:35:16 +09:00
kappa
3c420d2841 feat: manage OS images in database instead of hardcoded values
- Add os_images table with linode_image_id and vultr_os_id columns
- Support Ubuntu (24.04, 22.04), Debian (11-13), AlmaLinux (8-9),
  Rocky Linux (8-9), and Fedora 42
- AlmaLinux and Rocky Linux added as CentOS migration alternatives
- Default OS changed from ubuntu_22_04 to ubuntu_24_04
- Fix Vultr OS IDs (1743=22.04, 2284=24.04)
- Remove hardcoded OS validation, validate against DB
- Return available OS list in error message for invalid image

Migration: migrations/003_os_images.sql

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 10:31:14 +09:00
kappa
7d9edc14a3 feat: add configurable VPS provider API URLs for emulator testing
- Add LINODE_API_URL and VULTR_API_URL environment variables
- Update LinodeProvider and VultrProvider to accept optional baseUrl
- Update ProvisioningService to pass API URLs to providers
- Add source_provider and source_region_code to PricingWithProvider type
- Use source_provider (linode/vultr) instead of provider_name (Anvil)
- Improve error handling for non-JSON responses in LinodeProvider

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 10:21:27 +09:00
kappa
9b51b8d427 feat: add Queue-based async server provisioning
- Add Cloudflare Queue for async server provisioning workflow
- Implement VPS provider abstraction (Linode, Vultr)
- Add provisioning API endpoints with API key authentication
- Fix race condition in balance deduction (atomic query)
- Remove root_password from Queue for security (fetch from DB)
- Add IP assignment wait logic after server creation
- Add rollback/refund on all failure cases

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 17:19:19 +09:00