Last active
April 15, 2019 05:19
-
-
Save AugustMiller/158b39a5525b7e75600400b2c87892a0 to your computer and use it in GitHub Desktop.
Boilerplate Deployer config for a Craft 3 project https://deployer.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Deployer; | |
require 'recipe/composer.php'; | |
// Project name | |
set('application', 'my-project'); | |
// Project repository | |
set('repository', '[email protected]:organization/repo.git'); | |
// Use Git cache to speed up cloning new code: | |
set('git_cache', true); | |
// Allow multiplexing | |
set('ssh_multiplexing', true); | |
// Shared files/dirs between deploys | |
add('shared_files', [ | |
'.env', | |
'config/license.key' | |
]); | |
add('shared_dirs', [ | |
'storage', | |
'web/cpresources', | |
'web/your-asset-folder' | |
]); | |
// Composer Settings | |
set('composer_options', '{{composer_action}} --no-dev --optimize-autoloader --no-progress --no-interaction --ignore-platform-reqs'); | |
// Writable dirs by web server | |
add('writable_dirs', []); | |
// Hosts | |
inventory('hosts.yml'); | |
// Tasks | |
desc('Custom Pipeline: Build local assets'); | |
task('build:render', function () { | |
runLocally('npm run build'); | |
}); | |
after('deploy:update_code', 'build:render'); | |
desc('Custom Pipeline: Sync built assets to remote server'); | |
task('build:sync', function () { | |
upload('web/assets/css', '{{release_path}}/web/assets', ['options' => ['--recursive']]); | |
upload('web/assets/js', '{{release_path}}/web/assets', ['options' => ['--recursive']]); | |
}); | |
after('deploy:update_code', 'build:sync'); | |
// Re-trigger this, as it isn't part of the default `composer` recipe: | |
after('deploy:vendors', 'deploy:writable'); | |
// [Optional] if deploy fails automatically unlock. | |
after('deploy:failed', 'deploy:unlock'); | |
set('allow_anonymous_stats', false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
staging: | |
hostname: staging.yourdomain.com | |
stage: staging | |
roles: web | |
user: deploy | |
forwardAgent: true | |
deploy_path: /var/www/my-project |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Deploy to the defined
staging
host with:(This should always work—there are ways to make the
dep
command directly available to your terminal, though!)