4

我已经差不多完成了一个用 Symfony2 开发的项目的开发,希望把项目放到网上。

但是,我想有很多事情需要做才能让一切正常。我想,需要禁用开发模式等......需要做什么以及如何做?

在 Symfony2 项目中,网络上的每个人都可以使用的最重要的事情是什么?

4

4 回答 4

6

我建议您使用Capifony进行部署。它做了很多开箱即用的东西,你可以让它运行你需要的任何自定义命令。有关详细信息,请参阅其文档。

关于开发模式,除非您已从 中删除 IP 检查,否则您app_dev.php不必担心部署它。当然,如果您愿意,您可以告诉 Capifony 在部署时将其删除。

于 2012-08-27T06:48:09.277 回答
3

Im currently researching the same thing.

The first thing you have to consider is "how professional" you want to deploy. There are a lot of tools you can use:

  1. Continous Integration Server ( e.g. Hudson, Jenkins)
  2. Build Tools (e.g. Phing, Capistrano --> Capifony, Shell scripts)
  3. Versioning Tools (e.g. Git, SVN)

I think the simplest setup is using only a Build tool and i guess you are already using some kind of versioning.

Depending on which tool you use, the setup is different, but I think there are some things you should consider with your application (maybe not all are applicable to your application)

  • Creating a Tag in your Versioning
  • Copying the new Code in an folder on production --> if you are in a new folder you dont need to clear the cache and logs, since these shouldnt be in your versioning the first time.
  • loading composer (if youre using it)
  • installing vendors
  • updating database schema
  • install assets from your bundles
  • move symlink from current version to the folder of the new site

These are the things I currently need for my application for production deployment, if you deploy to an test environment you should load fixtures and run your testscripts as well.

于 2012-08-27T07:26:06.083 回答
3

处理部署的最佳方式是创建“构建”脚本,它将:

  1. 从您的捆绑包和供应商中删除所有包含测试的文件夹和文件。
  2. 删除app_dev.php文件
  3. 确保它app/cacheapp/logs完全可写/可读的。
  4. 将您的项目打包成存档 (rpm fe)

然后,在部署之前,您应该在项目中创建标签 - 这意味着您的应用程序的某个版本已发布(我建议遵循此git 分支模型)。

  1. 创建标签。
  2. 运行你的构建脚本
  3. 上传存档到主机
  4. 打开包装
  5. 享受你的项目
于 2012-08-27T06:38:37.857 回答
0

这里很好地描述的另一个选项是使用Apache Ant部署 Symfony2 应用程序。Apache Ant是一个 Java 库和命令行工具,其任务是驱动构建文件中描述的进程作为相互依赖的目标和扩展点。

于 2012-11-14T00:08:41.690 回答