Task: Add deployment tools and config

This commit is contained in:
Björn Fromme
2023-10-11 16:21:13 +02:00
parent d48f449076
commit 5c15ca3a2c
3 changed files with 146 additions and 1 deletions
+1
View File
@@ -111,6 +111,7 @@
}
},
"require-dev": {
"deployer/deployer": "^7.3",
"phpunit/phpunit": "^9.5",
"symfony/browser-kit": "6.3.*",
"symfony/css-selector": "6.3.*",
Generated
+44 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "69e7597627d8e6c883d063d873a08d78",
"content-hash": "d714db6b49b6684caaf4544a90193da3",
"packages": [
{
"name": "doctrine/cache",
@@ -8588,6 +8588,49 @@
}
],
"packages-dev": [
{
"name": "deployer/deployer",
"version": "v7.3.1",
"source": {
"type": "git",
"url": "https://github.com/deployphp/deployer.git",
"reference": "c5c5e79d4e57445918ed24a9cdd3d85b0f261de3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/deployphp/deployer/zipball/c5c5e79d4e57445918ed24a9cdd3d85b0f261de3",
"reference": "c5c5e79d4e57445918ed24a9cdd3d85b0f261de3",
"shasum": ""
},
"bin": [
"dep"
],
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anton Medvedev",
"email": "[email protected]"
}
],
"description": "Deployment Tool",
"homepage": "https://deployer.org",
"support": {
"docs": "https://deployer.org/docs",
"issues": "https://github.com/deployphp/deployer/issues",
"source": "https://github.com/deployphp/deployer"
},
"funding": [
{
"url": "https://github.com/sponsors/antonmedv",
"type": "github"
}
],
"time": "2023-04-05T09:24:30+00:00"
},
{
"name": "masterminds/html5",
"version": "2.8.1",
+101
View File
@@ -0,0 +1,101 @@
<?php
namespace Deployer;
require 'recipe/symfony.php';
require 'contrib/rsync.php';
add('shared_dirs', [
'uploads',
'var/log',
'var/sessions',
]);
add('shared_files', [
'public/.htaccess',
'.env.local.php',
]);
// Rsync options, mainly files/dirs to exclude
$rsyncOptions = [
'exclude' => [
'.idea',
'.vscode',
'.DS_Store',
'.ddev',
'.git',
'.github',
'node_modules',
'.editorconfig',
'.env.dev.local',
'.env.dev.local.php',
'.env.test',
'.env.test.local',
'.gitignore',
'.nvmrc',
'.php-cs-fixer.cache',
'.php-cs-fixer.dist.php',
'.phpunit.result.cache',
'deploy.php',
'package.json',
'package-lock.json',
'*.http',
'postcss.config.js',
'phpunit.xml.dist',
'public/.htaccess',
'tailwind.config.js',
'webpack.config.js',
'rapidapi.paw',
'bin/.phpunit',
'temp/',
'tests/',
'uploads/',
'var/',
],
'exclude-file' => false,
'include' => [],
'include-file' => false,
'filter' => [],
'filter-file' => false,
'filter-perdir' => false,
'flags' => 'rz',
'options' => ['delete', 'copy-links', 'chmod=D755,F664'],
'timeout' => 300,
];
host('develop')
->setHostname('185.243.132.170')
->setRemoteUser('p546473')
->setForwardAgent(true)
->setSshMultiplexing(true)
->setDeployPath('/home/www/p546473/html/myep-team')
->set('writable_mode', 'chmod')
->set('http_user', 'p546473')
->set('bin/php', '/usr/local/bin/php')
->set('rsync_src', __DIR__)
->set('rsync', $rsyncOptions)
;
task('deploy', [
'deploy:info',
'deploy:setup',
'deploy:lock',
'deploy:release',
'deploy:assets',
'rsync',
'deploy:shared',
'deploy:writable',
'database:migrate',
'deploy:publish',
// 'deploy:stop-workers',
]);
task('deploy:stop-workers', function () {
run('{{bin/console}} messenger:stop-workers');
});
task('deploy:assets', function () {
runLocally('npm i && npm run build');
});
after('deploy:failed', 'deploy:unlock');