Moving app to production mode in Symfony 2 - deployment

Can someone help me to move my Symfony 2 application into production mode?
Currently, the application is running properly in /app_dev.php.
I'm googling, but I'm not finding a definite guide for deployment in Symfony 2.

Couple more things to consider:
php app/console cache:clear --env=prod --no-debug
php app/console assets:install web_directory
php app/console assetic:dump web_directory
You might also run into permission issues with the cache directory. I would actually first make sure everything works in development mode on the server before switching to production mode. And if all you get is blank screens in production mode then set debug to true. And of course know how to check your error logs.

Moving Symfony2 to production means :
access the application through : app.php/
Test dev bundles won't be loaded since there is a condition into the AppKernel.php when you use app.php. If you want to unload bundle that should be used only in dev, you can place them into the this section (in appKernel.php)
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Sf2gen\Bundle\GeneratorBundle\Sf2genGeneratorBundle();
}
You also need to make some server tuning by désactivating xdebug and adding eacclerator (or someting else for caching performance)
I also advice to rename app_dev.php to disactivate dev mode

Basic configuration information can be found here:
http://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html
One important spot where many people stumble is asset management. When accessing the app via the app.dev front controller (see fist link), it may be necessary to dump the assets first. Read all about it here:
http://symfony.com/doc/current/cookbook/assetic/asset_management.html#cookbook-assetic-dumping

The Symfony CookBook has now a few recipes about deployment covering:
standard linux-based web-server: How to Deploy a Symfony2 Application,
Microsoft Azure Website Cloud: Deploying to Microsoft Azure Website Cloud,
Heroku Cloud: Deploying to Heroku Cloud.

Symfony2
How to Master and Create new Environments
http://symfony.com/doc/current/cookbook/configuration/environments.html

Related

Yii2 advanced prepare to production

I have an app in yii2 builded on top the template advanced, but i have a few concerns about how to deploy this app in Production.
Should i run php init again and set production env?
many thanks,enter image description here
If you prepared your Production environment correctly - yes, you should.

Deploying Meteor + Angular2 app to Heroku

I have an app I'm writing using Meteor, Angular2 (using the angular-meteor package), Typescript, and MongoDB. I'm trying to put it up on Heroku and running into difficulties. I'm using this meteor buildpack. I'm not sure whether the problems are with Meteor, Heroku, or Angular2, though I suspect it's something Heroku isn't configuring correctly for Angular2. The site is at http://alfred-zahner.herokuapp.com/ and the error I'm getting is:
EXCEPTION: No provider for t! (e -> t)
I've checked the Heroku logs and there is no sign of trouble there. Part of my problem is that I can't see what t and e are, as someone (Heroku?) is uglifying the JavaScript. I'm not really sure how to proceed in debugging this.
One way to solve this problem would be to figure out and fix the error, but I'd be happy if there's a better build pack, or even a better (must be free!) hosting environment that I could be using.
Edit
It's not Heroku's problem. The same thing happens when deploying to Meteor's built in deployment testing (meteor deploy site.meteor.com). If I deploy using meteor deploy --debug site.meteor.com, however, it works, so Angular2 has some problem with the extra processing that happens when Meteor prepares an app for production.
On the angular2-meteor Github I found out that this is an issue with Angular 2 in particular, when using UglifyJS. For now, it seems the only solution is to use meteor deploy --debug. I'm planning to just use that on meteor's built in hosting until Angular 2 plays nicely.

how can I set up a continuous deployment with TFSBuild for MVC app?

I have some questions around the best mechanism to deploy MVC web applications to different environments. Previously I used setup projects (.msi's) but as these have been discontinued in VS2012 I am looking to move to an alternative.
Let me explain my current setup. I currently have a CI setup using TFSBuild 2010 with Team Foundation Server for source control.
A number of developers work on their local machines and check in to the TFS Server. We regularly deploy to a single server dev environment and a load balanced qa environment with 2 servers. Our current process includes installing an msi which carries out some of the following custom actions:
brings current app offline with the app_offline.htm file
run in database scripts (from database project in the solution)
modifies web.config (different for each web server of qa)
labels the code
warmup each deployed file via http request
etc
This is the current process. Now I would like to make some changes. Firstly, I need alternative to msi's. From som research I believe that web deploy via IIS and using MsDeploy is the best alternative. I can use web config transforms for web config modifications. Is this correct and if so, could I get an outline of what I need to do?
Secondly I want to set up continuous delivery via TFSBuild, I have no idea how this may be achieved, would it be possible to get an outline of how it can be integrated in to my current setup? Rather than check in driven, I would like it to be user driven following check in. Also, would it be possible for this to also run in database scripts from a database project in the solution.
Finally, there is also a production environment, but I would like to manually deploy this - can my process also produce an artifact that I can manually install?
Vishal Joshi has some information on his blog that is reasonably good, http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html. It does have the downside that your deployment password is include in the properties you pass to msbuild.
Syed Hashimi has also posted some information on this in another questions Team Build: Publish locally using MSDeploy.

How Do I deploy an application to IIS while that web application is running

Where I work, we release bug fixes in to the system every night when we know our clients are not using the system.
Trying to take a step towards better service I'd like to deploy to IIS while the application is running.
A solution that comes to mind is to setup two different IIS applications and switch them over after deploy using a script. But I'm not going to try this out as I don't want any complications during our busy hours.
Does anyone have experience in this area of deployment?
Thanks
Regardless of whether you're using PHP, ASP, ASP.NET etc there is no native support for transactional deployment on IIS.
The simplest approach would be to have two physical folders and (optionally two web sites - one production, one test) on your web server, for example:
c:\websites\myapp\dep1
c:\websites\myapp\dep2
Initially your site would have its physical path pointing to c:\websites\myapp\dep1.
When you deploy your latest build you'd deploy into c:\websites\myapp\dep2. Once you're done just switch the physical path of the production site over to this folder. This means you still have the original site and can fall back to it if the new code fails for whatever reason.
The next time you do a deployment you'd deploy into c:\websites\myapp\dep1 and once you're done switch the production site to that folder.
You could optionally have a test site that points to the folder you're deploying to so you can make sure the site works before switching your production site over.
This could all be scripted.
Here's some related reading that may be of interest:
Publishing/uploading new DLL to IIS: website goes down whilst uploading
Is smooth deployment possible with componentized ASP.NET MVC apps?
Rob Conery also had an excellent blog post about the lack of a decent deployment story for ASP.NET application. You should take a trawl through the comments some of which are quite insightful:
ASP.NET Deployment Needs To Be Fixed
Getting Constructive On ASP.NET Deployment

Setup MVC2 Web App with IIS7

I've seen SO MANY articles that explain how to do this with IIS6, and some that offer SOME guides for IIS 7 but they are ask you to do so much setup and I've tried them all and ALWAYS get errors.
Is there a guide out there that some of you have used that just...works?
All I need is something step by step to setup my local MVC2 app using my local IIS7 server so I can test locally without using VS2010's dev server all the time (gets so annoying).
Assuming you have IIS installed locally you could go to the properties of the project and:
You may also find the following blog post useful.