Release Symfony2 project to the web

限于喜欢 提交于 2019-12-06 05:45:44

问题


I have almost finished the development of a project developed with Symfony2, and wish to put the project online.

However, I suppose there are a lot of things that need to be done so that everything works ok. I suppose, the dev mode needs to be disabled etc....What needs to be done and how?

What are the most important things to do on a Symfony2 project that will be available to everyone on the web?


回答1:


I suggest you to use Capifony for deployment. It does a lot of stuff out of the box and you can make it run any custom commands you need. See its documentation for details.

Regarding the dev mode, unless you've removed the IP checks from app_dev.php, you don't have to worry about deploying it. Of course, if you wish, you can tell Capifony to delete it on deployment.




回答2:


The best way to handle deployment is to create "build" script, which will:

  1. Remove all folders and files with tests from your bundles and vendors.
  2. Remove app_dev.php file
  3. Make sure that app/cache and app/logs are fully writable/readable.
  4. Packs your project into archive (rpm f.e.)

Then, before deployment, you should create tag in your project - so it will mean, that certain version of your application is released (I recommend to follow this git branching model).

  1. Create tag.
  2. Run your build script
  3. Upload archive to host
  4. Unpack
  5. Enjoy your project



回答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.




回答4:


One other option that is very well described here is to deploy the Symfony2 application with Apache Ant. Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other.



来源:https://stackoverflow.com/questions/12137051/release-symfony2-project-to-the-web

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!