All pages now use native Vuetify components directly. Flash messages are handled by the ToastStack component via Pinia store. Notifications use NotificationPanel. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3.8 KiB
Provisioning & Service Termination Fix - 2026-02-10
Issues Fixed
Issue #1: VPS Not Being Provisioned
Root Cause: All provisioning services (VirtFusion, Pterodactyl, SynergyCP, Enhance) were reading credentials from config('services.*') which pulls from .env, but the actual credentials are stored in the database via the settings table (configured in Admin → Settings → API).
What Happened:
- User configured VirtFusion API URL/token via admin panel settings (stored in DB)
- VirtFusionService was reading from
.env(empty values) - HTTP client tried to connect to relative hostnames like
sanctum,users,servers - cURL errors: "Could not resolve host: users"
Files Updated:
app/Services/Provisioning/VirtFusionService.phpapp/Services/Provisioning/PterodactylService.phpapp/Services/Provisioning/SynergyCPService.phpapp/Services/Provisioning/EnhanceService.php
Change: All services now use \App\Models\Setting::get('provider_api_url') instead of config('services.provider.url')
Issue #2: Services Not Terminated on Subscription Cancellation
Root Cause: HandleSubscriptionCancelled listener only sent a notification - it didn't call the provisioning service's terminate() method.
What Happened:
- User canceled subscription with "immediate" setting
- Subscription canceled in Stripe
- Service remained active on VirtFusion panel
- No cleanup of provisioned resources
Files Updated:
app/Listeners/HandleSubscriptionCancelled.php
Changes:
- Made listener implement
ShouldQueue(background job with retries) - Added logic to find all active/suspended services for the subscription
- Call
terminate()on each service via ProvisioningFactory - Proper error handling and logging
- Service status updated to "terminated" in database
Current State
VirtFusion Configuration (Database)
virtfusion_api_url: https://cp.vps.ezscale.tech/api/v1
virtfusion_api_token: (encrypted in DB)
How It Works Now
Subscription Created:
- HandleSubscriptionCreated listener queued
- Reads plan from database
- Gets provisioning service (VirtFusionService for VPS)
- VirtFusionService reads URL/token from settings table
- Ensures user exists on VirtFusion panel
- Creates server (package ID 43)
- Changes package to match plan specs
- Updates service record with IP, hostname, etc.
- Sends credentials email to customer
Subscription Canceled:
- HandleSubscriptionCancelled listener queued
- Finds all active/suspended services for subscription
- Gets provisioning service for each
- Calls
terminate()on VirtFusion (DELETE /servers/{id}) - Updates service status to "terminated"
- Sends cancellation email to customer
Testing Needed
- ✅ Horizon restarted to reload code changes
- ⏳ Create a new VPS subscription and verify:
- Service is provisioned on VirtFusion
- Credentials email is sent
- Service appears in customer dashboard
- ⏳ Cancel the subscription and verify:
- Service is terminated on VirtFusion
- Service status updates to "terminated"
- Cancellation email is sent
Environment Variables (No Longer Used)
The following .env variables are no longer used for provisioning (database settings take precedence):
VIRTFUSION_API_URLVIRTFUSION_API_TOKENPTERODACTYL_PANEL_URLPTERODACTYL_API_KEYSYNERGYCP_API_URLSYNERGYCP_API_TOKENENHANCE_API_URLENHANCE_API_TOKEN
Configure all provisioning credentials in: Admin Panel → Settings → API Integrations
Migration Notes
If you have provisioning credentials in .env, migrate them to the database:
- Go to Admin → Settings → API
- Enter the URL and token for each provider
- Click "Save" to encrypt and store in database
- Remove from
.env(optional, but recommended to avoid confusion)