phwoolcon / deploy-automator
Phwoolcon项目的部署自动化器
dev-master / 1.0.x-dev
2017-09-12 09:17 UTC
Requires
- deployer/recipes: dev-master
This package is auto-updated.
Last update: 2024-08-29 04:48:16 UTC
README
工作流程
[您]
bin/build
然后cd ignore/release
然后git push
到release
(或staging
,production
) 分支;[自动化器]
捕获推送钩子;[自动化器]
调用dep local:prepare prepare
来拉取代码;[自动化器]
调用rsync
将./workspace/current
下的代码推送到远程服务器;[自动化器]
在远程服务器上调用bin/cli migrate:up
和bin/dump-autoload
。
要求
用法
1. 安装PHP
add-apt-repository ppa:ondrej/php apt update apt install php7.1-fpm php7.1-gd php7.1-cli php7.1-curl php7.1-dev php7.1-json php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-xml php7.1-zip php-redis
2. 安装Phalcon
curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | bash
apt install php7.0-phalcon
3. 安装Deploy Automator
git clone -b release git@github.com:phwoolcon/deploy-automator.git ./
4. 配置Deploy Automator
vim app/config/production/app.php
<?php return [ 'enable_https' => true, // true if your site have https access, otherwise false 'timezone' => 'Asia/Shanghai', // Use your timezone 'url' => 'https://deploy.example.com', // Use your real site URL ];
vim app/config/production/database.php
<?php return [ 'default' => 'mysql', 'connections' => [ 'mysql' => [ 'host' => '127.0.0.1', // Use real server 'username' => 'dbuser', // Use real username 'password' => 'dbpass', // Use real password 'dbname' => 'dbname', // Use real db name ], ], ];
5. 初始化Deploy Automator
sudo -H -u www-data bin/dump-autoload sudo -H -u www-data bin/cli migrate:up sudo -H -u www-data bin/dump-autoload
6. Nginx设置
7. Supervisor设置
8. 创建SSH私钥
sudo -H -u www-data ssh-keygen -N "" -t rsa -b 4096 -C "deployer"
9. 远程服务器设置
在远程服务器上创建用户 deployer
以接收代码推送(通过 rsync
,使用 ssh
连接)。
sudo adduser --disabled-password deployer
授予 deployer
以 www-data
身份运行的sudo权限,添加sudo配置
sudo visudo -f /etc/sudoers.d/deployer
内容如下
deployer ALL=(www-data) NOPASSWD:ALL