digipolisgent/domainator9k-servertype-capistrano-openminds-bundle
Installation
Add the bundle via Composer in your Symfony/Laravel project (note: this is a Symfony bundle, but can be adapted for Laravel via bridge packages like symfony/bridge):
composer require district09/domainator9k-servertype-capistrano-openminds-bundle
Register the bundle in config/bundles.php (Symfony) or adapt for Laravel's service provider structure.
Configuration
Locate the default config at config/packages/district09_domainator9k_servertype_capistrano_openminds.yaml (Symfony) or config/domainator9k-servertype-capistrano-openminds.php (Laravel). Override key settings like:
# Example Symfony config
district09_domainator9k_servertype_capistrano_openminds:
server_type: 'openminds' # Required: 'capistrano' or 'openminds'
deployment_path: '%kernel.project_dir%/deploy'
ssh_options: { ... }
First Use Case: Server Provisioning
Use the Domainator9kServerType service to provision a server via OpenMinds API:
// Symfony
$server = $this->get('district09_domainator9k_servertype_capistrano_openminds.server_type')
->provision('openminds', [
'name' => 'my-server',
'flavor' => 'medium',
'region' => 'eu-west-1'
]);
Hybrid Deployment Workflows Combine Capistrano and OpenMinds server types in a single pipeline:
// Symfony service definition
services:
app.deployer:
arguments:
- '@district09_domainator9k_servertype_capistrano'
- '@district09_domainator9k_servertype_openminds'
Dynamic Server Scaling
Use the scale() method to adjust server resources post-deployment:
$server->scale('openminds', [
'instances' => 3,
'flavor' => 'large'
]);
Laravel Integration (via Bridge) Create a Laravel service provider to wrap the Symfony bundle:
// app/Providers/DomainatorServiceProvider.php
public function register() {
$this->app->singleton('domainator', function ($app) {
return new \District09\Domainator9k\ServerType\OpenMinds(
$app['config']['domainator9k.ssh_options']
);
});
}
ServerProvisionedEvent and ServerScaledEvent for post-deployment tasks (e.g., database migrations).AbstractServerType to support additional cloud providers:
class CustomServerType extends AbstractServerType {
public function provision($type, array $options) {
// Custom logic for AWS, DigitalOcean, etc.
}
}
deploy() method to sync artifacts from a local path to the remote server:
$server->deploy('/path/to/local/artifacts', '/remote/deploy/path');
Deprecated API Calls
The OpenMinds API wrapper assumes the 2018-09-12 API version. Update the api_version in config if using a newer endpoint:
district09_domainator9k_servertype_capistrano_openminds:
api_version: 'v2'
SSH Key Management Hardcoding SSH keys in config violates security best practices. Use environment variables or a secrets manager:
ssh_options:
key_file: '%env(SSH_KEY_PATH)%'
Laravel Compatibility The bundle lacks native Laravel support. Expect issues with:
bind() in AppServiceProvider).EventDispatcher if needed).debug: true in config to log API responses:
district09_domainator9k_servertype_capistrano_openminds:
debug: true
use GuzzleHttp\Exception\RequestException;
try {
$response = $this->httpClient->request('POST', '/servers', $data);
} catch (RequestException $e) {
if ($e->getCode() === 429) {
sleep(2); // Retry after delay
throw $e;
}
}
Custom Provisioners
Override provision() to add pre/post hooks:
class ExtendedOpenMindsServerType extends OpenMindsServerType {
public function provision($type, array $options) {
$this->preProvisionHook($options);
parent::provision($type, $options);
$this->postProvisionHook($options);
}
}
Webhook Support Extend the bundle to listen for OpenMinds webhooks (e.g., server status changes):
// Register a route in Symfony or Laravel
$this->post('/openminds/webhook', '\App\Http\Controllers\OpenMindsWebhookController');
Database Sync
Add a syncDatabase() method to handle migrations or backups:
public function syncDatabase($serverId, $migrationCommand = 'migrate') {
$this->executeOnServer($serverId, "php artisan {$migrationCommand}");
}
How can I help you explore Laravel packages today?