Skip to content

Instantly share code, notes, and snippets.

@shyim
Last active June 14, 2024 08:43
Show Gist options
  • Save shyim/f6ca5ee0fc11462bb30edaf7d206edd1 to your computer and use it in GitHub Desktop.
Save shyim/f6ca5ee0fc11462bb30edaf7d206edd1 to your computer and use it in GitHub Desktop.
<?php
namespace Deployer;
require 'recipe/common.php';
set('bin/console', '{{bin/php}} {{release_or_current_path}}/bin/console');
set('default_timeout', 3600); // Increase when tasks take longer than that.
// These files are shared among all releases.
set('shared_files', [
'.env.local',
'install.lock',
'public/.htaccess',
'public/.user.ini',
]);
// These directories are shared among all releases.
set('shared_dirs', [
'config/jwt',
'files',
'var/log',
'public/media',
'public/thumbnail',
'public/sitemap',
]);
// These directories are made writable (the definition of "writable" requires attention).
// Please note that the files in `config/jwt/*` receive special attention in the `sw:writable:jwt` task.
set('writable_dirs', [
'config/jwt',
'custom/plugins',
'files',
'public/bundles',
'public/css',
'public/fonts',
'public/js',
'public/media',
'public/sitemap',
'public/theme',
'public/thumbnail',
'var',
]);
task('sw:deployment:helper', static function() {
run('cd {{release_path}} && ./vendor/bin/shopware-deployment-helper deploy');
});
// This is for my setup relevant, lazy to add a non-root user
task('custom-setup-fix', static function() {
run('chown -R www-data:www-data {{release_path}}');
run('systemctl restart php8.3-fpm');
});
desc('Deploys your project');
task('deploy', [
'deploy:prepare',
'deploy:clear_paths',
'sw:deployment:helper',
'custom-setup-fix',
'deploy:publish',
]);
task('deploy:update_code')->setCallback(static function () {
upload('.', '{{release_path}}', [
'options' => [
'--exclude=.git',
'--exclude=deploy.php',
'--exclude=node_modules',
],
]);
});
// Hosts
host('116.203.69.18')
->set('remote_user', 'root')
->set('deploy_path', '/var/www/');
// Hooks
after('deploy:failed', 'deploy:unlock');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment