Development

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

Show
Ignore:
Author:
karen (IP: 152.81.12.23)
Timestamp:
12/21/07 15:05:55 (10 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • 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. 
    210210 
     211## Mettre à jour votre application 
     212 
     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 
     215 
     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. 
     217 
     218In the application settings.yml, define the unavailable_module and unavailable_action settings: 
     219 
     220all: 
     221  .settings: 
     222    unavailable_module:     content 
     223    unavailable_action:     unavailable 
     224 
     225Create an empty content/unavailable action and a unavailableSuccess.php template: 
     226 
     227// askeet/apps/frontend/modules/content/actions/actions.class.php 
     228public function executeUnavailable() 
     229{ 
     230  $this->setTitle('askeet! » maintenance'); 
     231} 
     232  
     233// askeet/apps/frontend/modules/content/templates/unavailableSuccess.php 
     234<h1>Askeet: Site maintenance</h1> 
     235  
     236<p>The askeet website is currently being updated.</p> 
     237  
     238<p>Please try again in a few minutes.</p> 
     239  
     240<p><i>The askeet team</i></p> 
     241  
     242 
     243Now each time that you want to make your application unavailable, just change the available setting: 
     244 
     245all: 
     246 
     247  .settings: 
     248 
     249    available:              off 
     250 
     251Don't forget that for a configuration change to be taken into account in production, you need to clear the cache. 
     252 
     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. 
     254 
     255Use two versions of your application 
     256 
     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: 
     258 
     259/home/myaccount/ 
     260  pake/ 
     261    lib/       
     262  symfony/ 
     263    lib/ 
     264    data/ 
     265  askeet/     -> /home/production/askeet.123/ 
     266  askeet.123/ 
     267  askeet.134/ 
     268 
     269Then you can instantly switch between the two versions by changing the symlink: 
     270 
     271$ ln -sf /home/myaccount/askeet/ /home/myaccount/askeet.134/ 
     272 
     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 
     275 
     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: 
     277 
     278all: 
     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 
     289 
     290As the databases.yml will be switched as the same time as the application itself, your askeet will instantly start querying the new database. 
     291 
     292This technique is especially useful if your application has a big traffic and if you can't afford any service interruption. 
     293See you Tomorrow 
     294 
     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. 
     296 
     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. 
     298 
     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? 
     300 
    211301}}}