From 5c15ca3a2c4197d841a8dfca9f363cb268e241e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 11 Oct 2023 16:21:13 +0200 Subject: [PATCH] Task: Add deployment tools and config --- composer.json | 1 + composer.lock | 45 +++++++++++++++++++++- deploy.php | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 deploy.php diff --git a/composer.json b/composer.json index 186ba59..b1dc0fd 100644 --- a/composer.json +++ b/composer.json @@ -111,6 +111,7 @@ } }, "require-dev": { + "deployer/deployer": "^7.3", "phpunit/phpunit": "^9.5", "symfony/browser-kit": "6.3.*", "symfony/css-selector": "6.3.*", diff --git a/composer.lock b/composer.lock index 24306c4..797fe09 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": "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": "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": "2023-04-05T09:24:30+00:00" + }, { "name": "masterminds/html5", "version": "2.8.1", diff --git a/deploy.php b/deploy.php new file mode 100644 index 0000000..e00cab0 --- /dev/null +++ b/deploy.php @@ -0,0 +1,101 @@ + [ + '.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');