Skip to main content
Version: 7.x

directadmin

Source

Installing#

Add to your deploy.php

require 'contrib/directadmin.php';

Configuration#

  • directadmin โ€“ array with configuration for DirectAdmin
    • host โ€“ DirectAdmin host
    • port โ€“ DirectAdmin port (default: 2222, not required)
    • scheme โ€“ DirectAdmin scheme (default: http, not required)
    • username โ€“ DirectAdmin username
    • password โ€“ DirectAdmin password (it is recommended to use login keys!)
    • db_user โ€“ Database username (required when using directadmin:createdb or directadmin:deletedb)
    • db_name โ€“ Database namse (required when using directadmin:createdb)
    • db_password โ€“ Database password (required when using directadmin:createdb)
    • domain_name โ€“ Domain to create, delete or edit (required when using directadmin:createdomain, directadmin:deletedomain, directadmin:symlink-private-html or directadmin:php-version)
    • domain_ssl โ€“ Enable SSL, options: ON/OFF, default: ON (optional when using directadmin:createdb)
    • domain_cgi โ€“ Enable CGI, options: ON/OFF, default: ON (optional when using directadmin:createdb)
    • domain_php โ€“ Enable PHP, options: ON/OFF, default: ON (optional when using directadmin:createdb)
    • domain_php_version โ€“ Domain PHP Version, default: 1 (required when using directadmin:php-version)

Usage#

A complete example with configs, staging and deployment

<?phpnamespace Deployer;
require 'recipe/directadmin.php';
Project nameset('application', 'myproject.com');Project repositoryset('repository', 'git@github.com:myorg/myproject.com');
DirectAdmin configset('directadmin', [    'host' => 'example.com',    'scheme' => 'https', // Optional    'port' => 2222, // Optional    'username' => 'admin',    'password' => 'Test1234' // It is recommended to use login keys!]);
add('directadmin', [    'db_name' => 'website',    'db_user' => 'website',    'db_password' => 'Test1234',
    'domain_name' => 'test.example.com']);

host('example.com')    ->stage('review')    ->user('admin')    ->set('deploy_path', '~/domains/test.example.com/repository')

Tasksdesc('Create directadmin domain and database');task('directadmin:prepare', [    'directadmin:createdomain',    'directadmin:symlink-private-html',    'directadmin:createdb',])->onStage('review');
task('deploy', [    'deploy:info',    'directadmin:prepare',    'deploy:prepare',    'deploy:lock',    'deploy:release',    'deploy:update_code',    'deploy:shared',    'deploy:vendors',    'deploy:writable',    'deploy:symlink',    'deploy:unlock',    'cleanup',    'success'])->desc('Deploy your project');

Tasks#

directadmin:createdb#

Source

Create a database on DirectAdmin.

directadmin:deletedb#

Source

Delete a database on DirectAdmin.

directadmin:createdomain#

Source

Create a domain on DirectAdmin.

directadmin:deletedomain#

Source

Delete a domain on DirectAdmin.

directadmin:symlink-private-html#

Source

Symlink your private_html to public_html.

directadmin:php-version#

Source

Change the PHP version from a domain.