Chapter: Updating an application
« Installing an application | ^ Deploying a Jelix application | Installing on a server that we cannot configure » |
− Table of content
Your application is already running on your production server. Now you would like to update the application. Main steps are:
- Closing the application.
- backup data and files
- updating files of your application
- launching the update system of jelix
- removing all files in the temp directories
- opening the application
Closing and opening an application ¶
It's often better to have a single web page saying that the application is not available, during an update process. Users could not then execute the application, and it's a good thing, since modules won't act on a database that is not already updated (an update process is never instantaneous).
You have two choice to close the application.
Your system administrator may reconfigure the web server to redirect all http request to the web page showing the message or to change the document root. Or you may configure yourself your hosting to change the document root.
An other solution, is to use a mechanism into Jelix, which allows to close the
application. It works only if you call checkAppOpened()
in the entrypoints,
before the call of jCoordinator
.
To close the application, you have to create a file, var/config/CLOSED
,
containing nothing or a message.
Then Jelix displays the page lib/jelix/installer/closed.html
. You can
provide your own html page, by storing it into one of these directories of your application, in the order:
var/themes/<current theme>/closed.html
orvar/themes/default/closed.html
var/themes/closed.html
install/closed.html
To reopen the application, just remove the file var/config/CLOSED
.
You can manipulate this file manually (if you have only a FTP access to your web
site, this is the solution). or, if you have a command line access, you can call
jelix commands: app:open
and app:close
.
$ php console.php app:close
$ php console.php app:open
You can give a message to the app:close
command. It will replace the
%message%
tag into the closed.html file.
$ php console.php app:close "Sorry, we are closed for the moment, a new version is coming."
Backing up data ¶
Before to update files and launch the installer, it is strongly recommended to backup your data. The backup should include:
- data from your database, obviously
- the content of the
var/
directory - the source of the application
Probably there are other things to back up. Only you, know what to do, or read the manual of the application.
If something goes wrong during the upgrade, these backups allow you to restore the application in the previous state.
Updating files ¶
The second step is to update files of your application. You could upload files
into the directory, with FTP, SCP or with other tools like automatic deployment
tools. You could also launch an update with your preferred source code manager
(svn update
, hg pull -u
, git pull -u
...).
If you update manually, don't forget to remove deprecated files.
Launching the update ¶
Now, source files are ok, you have to update the application it self (database, configuration...).
The first thing to do is to launch the configurator, testapp/install/configurator.php
.
It will probably modify some configuration parameters specific to the server
context. Some modules may do these modifications, and/or ask you some informations.
Then you launch the installer, as you did when you installed the application for the first time.
The Jelix installer (used by a wizard or an installation script of an application), can install and update modules.
With a wizard ¶
If you installed the application with a wizard, it won't probably work for an update, except if the documentation of the application says that you can use it. In this case, launch the corresponding script with your browser, and remove the file after the update.
With the application installer ¶
If there is a install/installer.php
script, just launch it: open a
console, go into the install/
directory, and then type php installer.php
.
By hand ¶
This is the case when the installation system has been deactivated into specifics projects (see the previous chapter about the installation). In this case, you have to update every thing needed by the application, "by hand", or by "home made" scripts.
Cleaning the temp directory ¶
- *You must always remove all files stored into the
temp/
directory.**, after an installation or an update, and before to execute the application.