简体   繁体   English

如何在 Jelastic 上运行(或者我应该运行)PHP composer?

[英]How to run (or should I run) PHP composer on Jelastic?

Basically what I'm trying to do is to create a simple multi-node env with varnish+nginx+mariadb+memcached.基本上我想要做的是使用 varnish+nginx+mariadb+memcached 创建一个简单的多节点环境。 By now I've managed to launch the environment and attach git project to it.到目前为止,我已经设法启动环境并将 git 项目附加到它。 The problem is that we work with php and symfony2, which requires composer to be executed at least once in order to properly deploy the application.问题是我们使用 php 和 symfony2,这需要 composer 至少执行一次才能正确部署应用程序。

Outside of jelastic we use Jenkins + Ant (but we don't scale horizontally in automatic on the projects where this setup is used, so it's not a problem to add node manually).在 jelastic 之外,我们使用 Jenkins + Ant(但我们不会在使用此设置的项目中自动水平扩展,因此手动添加节点不是问题)。

So the question is: How can I run composer or ant with build.xml on each deploy?所以问题是:如何在每次部署时使用 build.xml 运行 composer 或 ant?

I see that Java environments have a build server option, is there something like this for php environments?我看到 Java 环境有一个构建服务器选项,php 环境有这样的东西吗?

PHP projects do not have a "standard" build server in the way that many Java projects do - requirements for PHP build tools are more varied depending on the particular project. PHP 项目没有像许多 Java 项目那样的“标准”构建服务器——PHP 构建工具的要求因特定项目而异。

For example one customer may ask for grunt, another for ant, and another for phing.例如,一个客户可能要求 grunt,另一个要求 ant,另一个要求 phing。

If you want to perform a sophisticated build, you can create your own build node for your PHP project using an Elastic VPS or separate Docker environment.如果要执行复杂的构建,可以使用 Elastic VPS 或单独的 Docker 环境为 PHP 项目创建自己的构建节点。 To deploy the built project to your servers you can use SSH connections, or simply git push and set the runtime environment to auto-update (eg via ZDT feature) from that git repo / branch.要将构建的项目部署到您的服务器,您可以使用 SSH 连接,或者简单地 git push 并将运行时环境设置为从该 git repo / 分支自动更新(例如通过 ZDT 功能)。

If your needs are more simple, you can install composer directly onto your php runtime node in the normal way via SSH.如果您的需求更简单,您可以通过 SSH 以正常方式将 composer 直接安装到您的 php 运行时节点上。

Eg例如

$ curl -sS https://getcomposer.org/installer | php

There are more detailed tips about how to tidy that up (add to your PATH etc.) at http://kb.layershift.com/jelastic-install-composerhttp://kb.layershift.com/jelastic-install-composer 上有关于如何整理(添加到您的 PATH 等)的更详细的提示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM