From b5d52b0053e7be37f633d9fac33b3863d994dfa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Fri, 22 Nov 2024 17:52:06 +0100 Subject: [PATCH] chore: add deployer --- composer.json | 1 + composer.lock | 56 ++++++++++++++++++++++++- deploy.php | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 deploy.php diff --git a/composer.json b/composer.json index a2a1e3d..16f8e93 100644 --- a/composer.json +++ b/composer.json @@ -99,6 +99,7 @@ } }, "require-dev": { + "deployer/deployer": "^7.5", "phpunit/phpunit": "^9.5", "symfony/browser-kit": "6.4.*", "symfony/css-selector": "6.4.*", diff --git a/composer.lock b/composer.lock index 90eeb8a..e0c2599 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "e573ad1efa56e3ccee4a3bc80c29334c", + "content-hash": "d79e5d8a80d5e98bfd3dadadc9b6182c", "packages": [ { "name": "carbonphp/carbon-doctrine-types", @@ -7917,6 +7917,60 @@ } ], "packages-dev": [ + { + "name": "deployer/deployer", + "version": "v7.5.5", + "source": { + "type": "git", + "url": "https://github.com/deployphp/deployer.git", + "reference": "1b37d639e0ffad980f6cc3873859b16de29ecad7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/deployphp/deployer/zipball/1b37d639e0ffad980f6cc3873859b16de29ecad7", + "reference": "1b37d639e0ffad980f6cc3873859b16de29ecad7", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^8.0|^7.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.64", + "pestphp/pest": "^3.3", + "phpstan/phpstan": "^1.4", + "phpunit/php-code-coverage": "^11.0", + "phpunit/phpunit": "^11.4" + }, + "bin": [ + "bin/dep" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Medvedev", + "email": "anton@medv.io" + } + ], + "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": "2024-11-08T13:18:44+00:00" + }, { "name": "masterminds/html5", "version": "2.9.0", diff --git a/deploy.php b/deploy.php new file mode 100644 index 0000000..16f85d3 --- /dev/null +++ b/deploy.php @@ -0,0 +1,114 @@ + [ + '.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/', + 'xmlexport/', + '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('prod') + ->setHostname('92.205.212.39') + ->setRemoteUser('ssh-53857-root') + ->setForwardAgent(true) + ->setSshMultiplexing(true) + ->setDeployPath('/kunden/tiefschnee.de/myep-next') + ->set('writable_mode', 'chmod') + ->set('http_user', 'ssh-53857-root') + ->set('bin/php', '/usr/bin/php81') + ->set('rsync_src', __DIR__) + ->set('rsync', $rsyncOptions) + ->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{release_or_current_path}}/public/ --web-url=https://myep-next.ep-reisen.de') +; + +host('develop') + ->setHostname('185.243.132.170') + ->setRemoteUser('p546473') + ->setForwardAgent(true) + ->setSshMultiplexing(true) + ->setDeployPath('/home/www/p546473/html/myep-next') + ->set('writable_mode', 'chmod') + ->set('bin/php', '/usr/local/bin/php') + ->set('rsync_src', __DIR__) + ->set('rsync', $rsyncOptions) + ->set('keep_releases', 5) + ->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{release_or_current_path}}/public/ --web-url=https://myep-next.dreipunktnull.net') +; + +task('deploy', [ + 'deploy:info', + 'deploy:setup', + 'deploy:lock', + 'deploy:release', + 'rsync', + 'deploy:shared', + 'deploy:writable', +// 'database:migrate', + 'deploy:publish', + 'cachetool:clear:opcache', +// 'deploy:stop-workers', +]); + +task('deploy:stop-workers', function () { + run('{{bin/console}} messenger:stop-workers'); +}); + +after('deploy:failed', 'deploy:unlock');