releaz / deployer
Yii2 Deployer (基于Deployer)
Requires
- php: ~7.0
- deployer/deployer: ^5.0
- symfony/framework-bundle: ^3.3
- symfony/yaml: ~2.7|~3.0
Requires (Dev)
- phpunit/phpunit: ^6.1
This package is not auto-updated.
Last update: 2024-09-15 02:27:24 UTC
README
构建状态 Deployer:
文档: https://releaznl.github.io/releaz-deployer
Packagist: https://packagist.org.cn/packages/releaz/deployer
本工具是为了方便使用Deployer进行Yii2部署而创建的。在这个工具中,可以轻松配置部署变量并在同事之间共享。
部署
部署是通过 Deployer 完成的。要使用此依赖项,请在您的 composer.json 文件中添加以下内容。
composer require releaz/deployer
之后,通过调用 vendor/bin/dep init
初始化 Deployer 并选择 'Releaz' 模板。这样将生成示例配置和所需的 Deployer deploy.php 文件。请参阅以下关于如何配置此文件的信息。通过在 common 文件夹中复制生成的 .example 配置文件来创建 Yii2 配置文件。默认情况下,deploy.php 文件寻找 deploy-config.yml
可以像Deployer一样编辑 deploy.php
文件。有关更多信息,请访问 Deployer 的 文档。
说明
# General information: general: ssh_repo_url: 'git@github.com:johankladder/yii2-app-advanced.git' # The repository your project is stored # Staging servers: server: # The production server production: host: 'applicationname.com' # Deployment server hostname/ip stage: 'production' # Stage name; can be used by 'dep deploy-yii [stage] branch: 'master' # The branch that should be used to deploy deploy_path: '/var/www/applicationname.com' # The deploy location ssh_user: 'username' # The SSH username, that has access to the remote server # The development server development: host: 'dev.applicationname.com' # Deployment server hostname/ip stage: 'development' # Stage name; can be used by 'dep deploy-yii [stage] branch: 'develop' # The branch that should be used to deploy deploy_path: '/var/www/dev.applicationname.com' # The deploy location ssh_user: 'username' # The SSH username, that has access to the remote server # A custom deployment server: custom: host: 'localhost' # Deployment server hostname/ip stage: 'test' # Stage name; can be used by 'dep deploy-yii [stage] branch: 'develop' # The branch that should be used to deploy deploy_path: '/var/www/test.local' # The deploy location ssh_user: 'johankladder' # The SSH username, that has access to the remote server settings: yii: init: 'Development' # Environment that can be used. See `php init` for possibilities overwrite: 'All' # Overwrite all the generated files during init | Can also be None files: upload-files: - 'common/config/afile.yml' # A file that needs the be send to the remote server show: - 'common/config/afile.yml' # A file that needs to be outputted when deploying migrate: rbac: true # Execute RBAC migrations db: true # Execute `yii migrate` sync: uploads: source: 'shared/uploads/' # Base of the sync folder dest: 'shared/uploads' # 'To' pathname from base deployment path create_if_not_exists: true # Create the 'To' path if not exist shared: - 'common/config/config.yaml'
在服务器部分,您可以添加不同数量的阶段。给出的键在 Deployer 中不被使用。说明
密码
该模块使用 forward-agent 允许用户无密码访问远程服务器。按照以下步骤确保不需要密码:
- 尝试
ssh-add -L
查看您的公钥是否已添加到代理。如果没有,运行:ssh-add
- 使用
ssh-copy-id remoteusername@remotehost
将您的公钥复制到远程服务器的 known-hosts - 尝试
ssh remoteuser@remotehost
。服务器现在不再要求密码,因为它由代理提供。
远程服务器访问仓库
为了使部署服务器能够访问您在 Github 上的私有/公开仓库,请将服务器的公钥作为部署密钥添加到您的仓库设置中。