Documentation/fr_FR/askeet/trunk/D22 (diff)

You must first sign up to be able to contribute.

Changes between Version 13 and Version 14 of Documentation/fr_FR/askeet/trunk/D22

karen (IP:
12/21/07 15:05:55 (9 years ago)



  • Documentation/fr_FR/askeet/trunk/D22

    v13 v14  
    209209> Vous devez être conscients qu'en donnant accès par le Web à des outils d'administration, vous pouvez créer une brèche de sécurité dans votre site. 
     211## Mettre à jour votre application 
     213There will be times in the life of your project when you need to switch between two versions of an application. It can be in order to correct bugs, or to upload new features. You can also be faced with the problem of switching between two versions of the database. If you follow a few good practices, these actions will prove easy and harmless. 
     214Show unavailability notice 
     216Between the moment when you start the data transfer and the moment you clear the cache (if you modify the configuration or the data model), there are sometimes more than a few seconds of delay. You must plan to display an unavailability notice for users trying to browse the site at that very moment. 
     218In the application settings.yml, define the unavailable_module and unavailable_action settings: 
     221  .settings: 
     222    unavailable_module:     content 
     223    unavailable_action:     unavailable 
     225Create an empty content/unavailable action and a unavailableSuccess.php template: 
     227// askeet/apps/frontend/modules/content/actions/actions.class.php 
     228public function executeUnavailable() 
     230  $this->setTitle('askeet! » maintenance'); 
     233// askeet/apps/frontend/modules/content/templates/unavailableSuccess.php 
     234<h1>Askeet: Site maintenance</h1> 
     236<p>The askeet website is currently being updated.</p> 
     238<p>Please try again in a few minutes.</p> 
     240<p><i>The askeet team</i></p> 
     243Now each time that you want to make your application unavailable, just change the available setting: 
     247  .settings: 
     249    available:              off 
     251Don't forget that for a configuration change to be taken into account in production, you need to clear the cache. 
     253    : The fact that the whole application can be turned off with only a single parameter is possible because symfony applications use a single entry point, the front web controller. You will find more information about it in the controller page of the symfony book. 
     255Use two versions of your application 
     257A good way to avoid unavailability is to have the project root folder configured as a symlink. For instance, imagine that you are currently using the version 123 of your application, and that you want to switch to the version 134. If your web server root is set to /home/myaccount/askeet/web/ and that the production folder looks like that: 
     260  pake/ 
     261    lib/       
     262  symfony/ 
     263    lib/ 
     264    data/ 
     265  askeet/     -> /home/production/askeet.123/ 
     266  askeet.123/ 
     267  askeet.134/ 
     269Then you can instantly switch between the two versions by changing the symlink: 
     271$ ln -sf /home/myaccount/askeet/ /home/myaccount/askeet.134/ 
     273The users will see no interruption, and yet all the files used after the change of the symlink will be the ones of the new release. If, in addition, you emptied the cache/ folder of your release 134, you don't even need to launch a clear-cache after switching applications. 
     274Switching databases 
     276You can extrapolate that technique to switching databases. Remember that the address of the database used by your application is defined in the databases.yml configuration file. If you create a copy of the database with a new name, say askeet.134, you just need to write in the askeet.134/apps/frontend/config/databases.yml: 
     279  propel: 
     280    class:          sfPropelDatabase 
     281    param: 
     282      phptype:      mysql 
     283      hostspec:     localhost 
     284      database:     askeet.134 
     285      username:     myuser 
     286      password:     mypassword 
     287      compat_assoc_lower:  true 
     288      compat_rtrim_string: true 
     290As the databases.yml will be switched as the same time as the application itself, your askeet will instantly start querying the new database. 
     292This technique is especially useful if your application has a big traffic and if you can't afford any service interruption. 
     293See you Tomorrow 
     295Synchronization is often a big issue for high traffic websites, but thanks to the file structure of the symfony projects, it should not create any problem for askeet. 
     297Tomorrow, we will talk about the way to adapt askeet to other languages. The patient speakers call it internationalization, the others find it more convenient to talk about i18n. Symfony has built-in support for multilingual sites, so that should not be a big deal. 
     299You can still post your questions and suggestions in the askeet forum. And did you try to ask one in the brand new askeet website?