简体   繁体   English

上线步骤-Symfony2

[英]Steps for going live - Symfony2

I've been working on my website for some time now and I am now ready to push this brand new project to live. 我已经在网站上工作了一段时间,现在可以将这个崭新的项目付诸实践了。

I have already already read this link on Symfony2 with regards to what should be done, but I still think it is missing some details. 我已经在Symfony2上阅读了此链接,以了解应该做什么,但是我仍然认为它缺少一些细节。 For example, it talks nothing about some of the commands that I run to get the site to work on live. 例如,它没有提及我运行的一些命令以使站点能够正常运行。

Currently this is what I would like to do to get this to work on live: 目前,这是我想做的工作:

php composer.phar install --no-dev --optimize-autoloader --no-scripts
rm -rf app/cache/* 
php app/console assetic:dump --env=prod --no-debug 
php app/console assets:install web --symlink --env=prod

Is there anything else that needs to be done, for example, I don't want live to be able to execute my fixtures, nor do I want any users to be able to go to www.mysite.com/app_dev.php 还有其他需要做的事情吗,例如,我不希望现场能够执行我的固定装置,也不希望任何用户都可以访问www.mysite.com/app_dev.php

Check out How to deploy a Symfony2 application . 查看如何部署Symfony2应用程序

Refer to link above. 请参阅上面的链接。 The typical steps taken while deploying a Symfony2 application include: 部署Symfony2应用程序时采取的典型步骤包括:

  1. Upload your modified code to the live server; 将修改后的代码上传到实时服务器;
  2. Update your vendor dependencies (typically done via Composer, and may be done before uploading); 更新您的供应商依赖关系(通常通过Composer完成,并且可能在上传之前完成);
  3. Running database migrations or similar tasks to update any changed data structures; 运行数据库迁移或类似任务以更新任何已更改的数据结构;
  4. Clearing (and perhaps more importantly, warming up) your cache. 清除(也许更重要的是,预热)缓存。

Common Post-Deployment Tasks 常见的部署后任务

  1. Configure your app/config/parameters.yml file 配置您的app / config / parameters.yml文件
  2. Update your vendors 更新您的供应商

    $ php composer.phar install --no-dev --optimize-autoloader $ php composer.phar install --no-dev --optimize-autoloader

  3. Clear your Symfony cache 清除您的Symfony缓存

    $ php app/console cache:clear --env=prod --no-debug $ php app /控制台缓存:clear --env = prod --no-debug

  4. Dump your Assetic assets 转储您的资产

    $ php app/console assetic:dump --env=prod --no-debug $ php应用程序/控制台资产:dump --env = prod --no-debug

  5. Other things! 其他事情!

There may be lots of other things that you need to do, depending on your setup: 根据您的设置,您可能还需要执行许多其他操作:

  • Running any database migrations 运行任何数据库迁移
  • Clearing your APC cache 清除您的APC缓存
  • Running assets:install (taken care of already in composer.phar install) 运行资产:安装(已在composer.phar安装中处理)
  • Add/edit CRON jobs 添加/编辑CRON作业
  • Pushing assets to a CDN 将资产推送到CDN
  • ... ...

take a look at capifony ( https://github.com/everzet/capifony ). 看一下capifony( https://github.com/everzet/capifony )。 Unfortunately the Website ( http://capifony.org ) is currently down.. 不幸的是,该网站( http://capifony.org )当前已关闭。

The best solution to me is to have your project in a versionning system like git or svn without the vendors dir of course ... 对我来说最好的解决方案是将您的项目安装在git或svn之类的版本控制系统中,而无需供应商目录。

This way, your simply have to do : 这样,您只需要做:

1) git clone your project into the prod dir

2) php composer.phar install to install your vendors

2b) create the mysql user with correct login and password according to your parameters.yml

 3) php app/console doctrine:database:create to create your database with the credentials you set up in mysql

 4) php app/console doctrine:schema:update --force to perform the database tables creation
 5) testing the project :)

If you are not using a versionning system just upload your project to your server with an ftp software without the vendors directory ( it will be feeded by step 2) then perform 3rd , 4th and 5th steps ! 如果您不使用版本控制系统,只需使用没有供应商目录的ftp软件将您的项目上载到服务器(该文件将在步骤2中提供),然后执行第3、4和5步!

you now should be able to reach you project through you domain url . 您现在应该可以通过您的域url访问您的项目。

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

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