magemojo / deployer-example
Web规模Stratus部署器插件
Requires
- deployer/dist: ^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.11
- nikic/php-parser: ^3.1
- phpmd/phpmd: ^2.6
- phpro/grumphp: ^0.14.0
- squizlabs/php_codesniffer: ^3.2
This package is auto-updated.
Last update: 2024-09-25 18:01:55 UTC
README
使用Deployer.org应用程序构建的Web规模Stratus部署示例仓库
Deployer是什么?
Deployer是一个用PHP编写的部署工具,开箱即支持流行的框架。Deployer在全球范围内被数以万计的项目使用,每月执行超过一百万次的部署。Deployer包含50多个适用于框架和第三方服务的现成配方。
创建此仓库是为了帮助您调整Deployer.org的部署流程,并使用它来在Webscale Stratus平台上部署应用程序。
基本上,要开始,我们首先需要按照https://deployer.org/docs/7.x/installation指南安装Deployer应用程序。
curl -LO https://deployer.org/deployer.phar
mv deployer.phar /usr/local/bin/dep
chmod +x /usr/local/bin/dep
现在,我们可以进入项目并运行以下命令
dep init
Deployer将向您提出几个问题,完成后您将拥有一个deploy.php或deploy.yaml文件。这是我们部署配方。它包含主机、任务和需要其他配方。Deployer附带的所有框架配方都基于通用配方。https://deployer.org/docs/7.x/recipe/common
Deployer.org已经涵盖了Magento 2配方,可以在此处下载/查看:https://github.com/deployphp/deployer/blob/master/recipe/magento2.php
如何安装此软件包
composer require magemojo/deployer-example --dev
安装后,您可以在命名空间之后添加以下行,并运行dep进行检查
// Webscale Stratus Recipe
require __DIR__ . '/vendor/magemojo/deployer-example/stratus.php';
此配方在安装后自动清除部署成功后的所有缓存,但如果您想要重启所有服务,请将这些添加到末尾
// Webscale Stratus start/stop/restart services
before('deploy', 'stratus:cron:stop');
after('deploy', 'stratus:cron:start');
after('success', 'stratus:zdd:init');
after('success', 'stratus:zdd:switch');
// Webscale Stratus clean all caches
after('success', 'stratus:cloudfront:clear');
after('success', 'stratus:varnish:clear');
after('success', 'stratus:redis:clear');
after('success', 'stratus:cache:clear');
例如
<?php
namespace Deployer;
// Webscale Stratus Recipe
require __DIR__ . '/vendor/magemojo/deployer-example/stratus.php';
// Project
set('application', 'My Project Name');
set('repository', 'git@bitbucket.org:mycompany/my-project.git');
set('default_stage', 'production');
// Project Configurations
host('production')
->hostname('iuse.magemojo.com')
->user('my-user')
->port(22)
->set('deploy_path', '/home/my-project-folder')
->set('branch', 'master')
->stage('production');
// Webscale Stratus restart services
after('success', 'stratus:zdd:init');
after('success', 'stratus:zdd:switch');
// Webscale Stratus clean all caches
after('success', 'stratus:cloudfront:clear');
after('success', 'stratus:varnish:clear');
after('success', 'stratus:redis:clear');
after('success', 'stratus:cache:clear');
所有可用命令的摘要
用于deploy.php文件的有用命令
// Webscale Stratus autoscaling requires absolute symlinks
set('use_relative_symlink', false);