当前位置: 首页 > 后端技术 > PHP

walleWalle--部署系统(从原理到安装)

时间:2023-03-29 14:37:51 PHP

Walle介绍一款web部署系统工具Walle,配置简单,功能齐全,界面流畅,开箱即用!支持git、svn版本管理,支持各种web代码发布,PHP、Python、JAVA等代码发布回滚,通过web一键完成。功能列表用户按身份注册、登录开发者发起在线任务申请,部署管理员审核在线任务支持多项目部署支持多项目多任务并行快速回滚项目用户权限管理预部署任务pre-deploy(pre-check)代码签出后处理taskpost-deploy(如vendor)同步后更新软链接文件指纹确认支持git和svn版本管理原理分析在线流程图依赖Bash(git,ssh)which表示不支持win和maczshLNMP/LAMP(php5.4+)php需要开启pdo_mysql,exec函数执行Composer如果国内环境安装特别慢,可以直接下载vendor解压到项目根目录。Ansible安装1.宿主机安装ansibleyuminstallansible#RHEL/CentOS/Fedoraapt-getinstallansible#Debian/Ubuntuemerge-avtansible#Gentoo/Funtoopipinstallansible#也会安装paramikoPyYAMLjinja22,宿主机不需要其他配置,兼容with~/.ssh/configname,certificateconfiguration3,targetmachine不需要额外配置walle项目配置打开Ansible(optional)config/params.php配置ansible_hosts文件存放路径按照Normalprocesspublishing,onlinecode,filetransfer,远程执行的命令都会通过ansible并发执行。php5.6环境CentOS安装删除旧安装包removephp.x86_64php-cli.x86_64php-common.x86_64php-gd.x86_64php-ldap.x86_64php-mbstring.x86_64php-mcrypt.x86_64php-mysql.x86_64php-pdo.x86_64```更新源CentOs6.xrpm-Uvhhttp://mirror.webtatic.com/yu...CentOs7.Xrpm-Uvhhttps://mirror.webtatic.com/y...安装php5.6相关组件yuminstallphp56w.x86_64php56w-cli.x86_64php56w-common.x86_64php56w-gd.x86_64php56w-ldap.x86_64php56w-mbstring.x86_64php56w-mcrypt.x86_64phpmysql.x86_64php56w-pdo.x86_64安装php-fpm5.6yum安装php56w-fpm安装gitclonegit@github.com:meolu/walle-web.gitcdwalle-webviconfig/web.php#设置mysql连接composerinstall#ifIf缺少bower-asset,先安装:composerglobalrequire"fxp/composer-asset-plugin:*"./yiiwalle/setup#初始化项目,配置nginx/apache的webroot指向walle-web/web最详细的安装指南以下安装均在宿主机上进行(一台配置了LAMP/LNMP并安装了git/svn的linux机器)。如有任何疑问,请参阅问答。如果没有安装php5.4+环境,请先安装php5。4+,详见php5.6安装。1.代码检出mkdir-p/data/www/walle-web&&cd/data/www/walle-web#创建一个新目录gitclonegit@github.com:meolu/walle-web.git。#codecheckout2.Setmysqlconnectionviconfig/local.php+14'db'=>['dsn'=>'mysql:host=127.0.0.1;dbname=walle',#创建一个新的数据库walle'username'=>'username',#Connectionusername'password'=>'password',#Connectionpassword],3.安装composer,如果已经安装跳过curl-sShttps://getcomposer.org/insta...|phpmvcomposer.phar/usr/local/bin/composer#PATH目录4.安装vendocdwalle-webcomposerinstall--prefer-dist--no-dev--optimize-autoloader-vvvv安装速度慢或者失败,可以直接下载vendor解压到项目根目录5.初始化项目cdwalle-web./yiiwalle/setup#需要你的yes6。配置nginx。如果在第7步刷新页面看到50x,说明前5步安装不完整。自己检查。第7步刷新页面看到404是nginx配置不当,查看nginx简单配置server{listen80;server_namewalle.compony.com;#改变你的主机根/the/dir/of/walle-web/web;#根目录为webindexindex.php;#建议放在内网#allow192.168.0.0/24;#denyall;location/{try_files$uri$uri//index.php$is_args$args;}location~\.php${try_files$uri=404;fastcgi_pass127.0.0.1:9000;fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;includefastcgi_params;}}7.恭喜:)访问地址:localhost当然,可能你配置nginx时server_name是walle.company.com,配置本地主机后,直接访问:walle.company.com也可以安装错误的composer安装速度慢,嗯,我已经猜到有人会问有没有现成的,有!下载百度网盘,解压vendor放在walle-web根目录下。第一次使用composer可能出现的问题:1NogittokenCouldnotfetchhttps://api.github.com/repos/jquery/jquery,请创建一个GitHubOAuthtoken越过APIratelimitHeadtohttps://github.com/settings/tokens/new?scopes=repo&description=Composer+on+localhost+2015-10-08+1123获取token。会保存在“/root/.composer/auth.json”中,供以后Composer使用。Token(隐藏):解决方法:将提示中的地址复制到浏览器,点击生成gittoken,如上:https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+localhost+2015-10-08+1123将token复制到命令行,进行身份验证,第一次继续使用composer。可能的问题:2composerinstall可能的错误LoadingcomposerrepositorieswithpackageinformationInstallingdependencies(includingrequire-dev)Yourrequirementscouldnotberesolvedtoaninstallablesetofpackages.Problem1yiisoft/yii22.0.x-devrequiresbower-asset/jquery2.1.@稳定|1.11.@stable->找不到匹配的包。...解决方案:composerglobalrequire"fxp/composer-asset-plugin:*"如何添加用户keytogit'sssh-keyslistsu-www#如果www是你的php进程用户ssh-keygen-trsa#如果你从来没有生成过rsa_key,那么cat~/.ssh/id_rsa.pub#复制并打开github/gitlab添加toyourssh-keysordeploy-keysHowtoadduserssh-keytothetargetclusterdeploymentuserssh-keytrusthostoperationpsaux|grepphp#如果www_php是你的php进程用户su-www_php#切换用户ssh-keygen-trsa#如果没有生成rsa_key,则跳过ssh-copy-id-i~/.ssh/id_rsa.pubwww_remote@remote_host#加入目标集群trust,需要输入www_remote密码初始化Failedwhenwalle:couldnot找到驱动缺少pdo扩展,解决办法:在源码包php-config=/php/中添加pdo扩展ubuntuapt-getinstallphp5php5-fpmphp5-mysql或者编译cdphp-src/ext/pdo_mysqlphpize./configure--with-install/dir/bin/php-configmake&&makeinstallviphp.ini#添加pdo_mysql.sorestartphp-fpm7.nginx简单配置server{listen80;server_namewalle.company.com;#改变你的hostroot/the/dir/of/walle-web/web;#根目录为webindexindex.php;#建议把内网allow192.168.0.0/24;denyall;location/{try_files$uri$uri//index.php$is_args$args;}location~\.php${try_files$乌里=404;fastcgi_pass127.0.0.1:9000;fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;includefastcgi_params;}}切换用户时(www):此账号目前不可用cat/etc/passwd|grepwww#查看是否是/sbin/nolgin解决方法:vipw/etc/passwd修改/sbin/nolgin为/bin/bash要发布的文件或目录不存在:/data/www/walle-web/vendor/bower/jquery/dist创建一个新目录:/data/www/walle-web/vendor/bower/jquery/dist调用未定义的函数yiiwebmb_parse_str()缺少mbstring扩展,安装mbstring扩展并重启php到mbstring扩展:http://php.net/手册/zh/mbst...