Laravel package for automated DirectAdmin deployment with GitHub Actions support
cocomedia-nl/laravel-directadmin-deploy is a Laravel package for laravel package for automated directadmin deployment with github actions support.
It currently has 0 GitHub stars and 590 downloads on Packagist (latest version 0.1.8).
Install it with composer require cocomedia-nl/laravel-directadmin-deploy.
Discover more Laravel packages by cocomedia-nl
or browse all Laravel packages to compare alternatives.
Last updated
Originally inspired by laravel-hostinger-deploy by TheCodeholic
Deploy your Laravel application to DirectAdmin shared hosting with automated GitHub Actions support.
Install the package via Composer:
composer require cocomedia-nl/laravel-directadmin-deploy:^0.1 --dev
Or install the latest version:
composer require cocomedia-nl/laravel-directadmin-deploy --dev
Note: This package should be installed as a development dependency (
--dev) since it's only needed during deployment, not in production.
Before using any deployment commands, add these to your .env file:
DIRECTADMIN_SSH_HOST=your-server-ip
DIRECTADMIN_SSH_USERNAME=your-username
DIRECTADMIN_SSH_PORT=22
DIRECTADMIN_SITE_DIR=your-website-folder
GITHUB_API_TOKEN=your-github-token
⚠️ Important: It is highly recommended to set up SSH public key authentication on your DirectAdmin server instead of using password authentication. Public key authentication is more secure and eliminates the need to enter passwords during deployments.
To set up SSH public key authentication:
- Generate an SSH key pair on your local machine:
ssh-keygen -t rsa -b 4096- Copy your public key to the server:
ssh-copy-id username@your-server-ip- Test the connection:
ssh username@your-server-ip(should connect without password prompt)Once configured, the deployment commands will use your SSH key automatically, making deployments seamless and secure.
The easiest way to deploy and set up automated deployment:
php artisan directadmin:deploy-and-setup-cicd
What this command does:
.github/workflows/directadmin-deploy.yml)Command Options:
--fresh - Delete existing files and clone fresh repository--site-dir= - Override site directory from config--token= - GitHub Personal Access Token (overrides GITHUB_API_TOKEN from .env)--branch= - Branch to deploy (default: auto-detect)--php-version= - PHP version for workflow (default: 8.3)php artisan directadmin:deploy
What it does: Deploys your Laravel application to DirectAdmin server (composer install, migrations, storage link, etc.)
Command Options:
--fresh - Delete existing files and clone fresh repository--site-dir= - Override site directory from config--token= - GitHub Personal Access Token (optional, enables automatic deploy key management)--show-errors - Display detailed error messages with exit codes and command outputNote: If
GITHUB_API_TOKENis provided (via.envor--tokenoption), the command will automatically add deploy keys to your GitHub repository. Otherwise, you'll be prompted to add the deploy key manually.
php artisan directadmin:publish-workflow
What it does: Creates .github/workflows/directadmin-deploy.yml file locally
Command Options:
--branch= - Branch to trigger deployment (default: auto-detect)--php-version= - PHP version for workflow (default: 8.3)php artisan directadmin:setup-cicd
What it does: Publishes GitHub Actions workflow file locally and creates secrets automatically via GitHub API, and automatically adds deploy keys to your repository
Command Options:
--token= - GitHub Personal Access Token (overrides GITHUB_API_TOKEN from .env)--branch= - Branch to deploy (default: auto-detect)--php-version= - PHP version for workflow (default: 8.3)GitHub Personal Access Token Permissions: Your GitHub Personal Access Token needs the following permissions:
Note: The workflow file is published locally to .github/workflows/directadmin-deploy.yml. You'll need to review, commit, and push it manually. The command only uses the API to create secrets and deploy keys.
| Variable | Required For | Description |
| -------------------------- | --------------- | --------------------------------------------------------------------------------- |
| DIRECTADMIN_SSH_HOST | All commands | DirectAdmin server IP address |
| DIRECTADMIN_SSH_USERNAME | All commands | DirectAdmin SSH username |
| DIRECTADMIN_SSH_PORT | All commands | SSH port (default: 22) |
| DIRECTADMIN_SITE_DIR | All commands | Website folder name |
| GITHUB_API_TOKEN | Automated setup | GitHub Personal Access Token (requires Administration permission for deploy keys) |
exec() function must be enabled (required for executing SSH commands and process management)Important: This package requires the PHP
exec()function to be available and enabled on your system. Theexec()function is used for executing SSH commands and managing deployment processes. Ifexec()is disabled in your PHP configuration, deployment operations will fail.
MIT