Pet*_*mit 13 php deployment dependency-management
我目前正在为慈善组织开发一个php应用程序,现在我正处于定义部署实践的阶段.
我们的应用程序使用Zend Framework和Doctrine.该应用程序将推广到不同的服务器,每个服务器都有不同的配置文件.这些机器都是Windows和Linux(但都使用Apache和PHP 5.2+).
源可以在subversion存储库中找到,我们希望在Linux服务器上构建和存储我们的包.
我们希望更新过程与在应用程序目录中运行更新命令一样简单,其中update命令还更新数据库(使用doctrine脚本)并确保框架的依赖性.此更新命令必须是计算机上的命令(我们不能ssh到它们).优选地,我们可以选择下载新版本或提供已经下载的具有新版本的tarball.(但只下载或只有tarball也可以)
具有安装和更新(新版本)的包也优选地由单个命令构建.
我一直在读一些关于phar,pear,phing的内容,但我不知道最好的方法是什么.连续集成服务器并不是必需的,但我认为在构建版本后会自动部署测试环境.
最初只需要更新php应用程序非常容易,最初填写配置文件时可以手动完成安装.
你说你有一个cluster。我们处于相同的位置,我们使用 ZF 和 Doctrine。这就是我们解决问题的方法:
<?xml version="1.0" encoding="UTF-8"?>
<project name="yourprojectname" basedir=".">
<target name="deploy" depends="apply-deltas,update-app01,update-app02">
</target>
<target name="update-app01">
<sshexec host="app01"
username="yourusername"
password="yourpassword"
trust="true"
command="cd path/to/root/directory &&
svn update &&
php cmd/clear_cache.php
"/>
</target>
<target name="update-app02">
<sshexec host="app02"
username="yourusername"
password="yourpassword"
trust="true"
command="cd path/to/root/directory &&
svn update &&
php cmd/clear_cache.php
"/>
</target>
<target name="apply-deltas" depends="liquibase-prepare">
<updateDatabase
changeLogFile="${db.changelog.file}"
driver="${database.driver}"
url="${database.url}"
username="${database.username}"
password="${database.password}"
promptOnNonLocalDatabase="${prompt.user.if.not.local.database}"
dropFirst="false"
classpathref="classpath" >
<changeLogProperty name="table.name" value="ant_param_table"/>
</updateDatabase>
</target>
<target name="liquibase-prepare">
<path id="classpath">
<fileset dir="${basedir}/libNoPackage">
<include name="**/*.jar" />
</fileset>
</path>
<taskdef resource="liquibasetasks.properties">
<classpath refid="classpath"/>
</taskdef>
</target>
</project>
Run Code Online (Sandbox Code Playgroud)
这远非理想,但对我们来说效果很好。希望有帮助。
链接:
如果您有任何疑问,请告诉我,以便我更新答案。t