## Please edit system and help pages ONLY in the master wiki!
## For more information, please see MoinMoin:MoinDev/Translation.
##master-page:Unknown-Page
##master-date:Unknown-Date
#acl -All:write Default
#format wiki
#language en
= Updating MoinMoin =

<<TableOfContents>>

== General procedures ==
=== Download and unpack the new MoinMoin archive ===
Download the MoinMoin code that you are interested in updating to. If you are not a developer, this is usually the distribution archive for the latest released version from the project homepage.

=== Reading the docs ===
{{{#!wiki note
Please read the files `docs/CHANGES` and `docs/README.migration` contained in the moin distribution archive for details on what changed and how to upgrade.

The docs might contain import installation, compatibility and upgrade hints we won't repeat here.
}}}

=== Backup ===
{{{#!wiki warning
'''Before you update an existing wiki, MAKE A BACKUP!'''

You have been warned, and it's not our fault when you end up like this: X-( 
}}}

As you want to make a ''complete'' backup (not even losing a single edit), you want to stop your wiki server process now.

This is what you should backup (the real paths depend on your installation):
 * The directory containing the MoinMoin code files (e.g. {{{/usr/lib/python*.*/site-packages/MoinMoin}}})
   * (!) after you have a backup of this, you might want to delete the `MoinMoin` directory there to avoid having old code files there that are not overwritten by the new code, but maybe interfering with it)
 * The directory containing your data (e.g. {{{/usr/share/moin/wikiname/data}}} - see data_dir in your moin_config.py). 
 * your moin.wsgi file (or other server adaptor file you use)
 * your wikiconfig.py or farmconfig.py or other wiki configuration files
 * your web server configuration files
 * optionally you can also backup your underlay_data_dir (it shouldn't contain data from you, but it is maybe easier to rollback if you have a backup of it and don't need to get it from some other place)

=== Code update ===
First remove the old MoinMoin code (including any `*.pyc` and `*.pyo` files).

If you are installing from the original distribution archive, run "{{{python setup.py install}}}" as root to install the new version.

If you are using some Linux (or other) distributor's package, please read their docs.

Please also upgrade your moin.wsgi (or other) server adaptor file. You likely have to edit it to fix some pathes and you also need to set some specific user/group/mode on that file (just look at the old one before replacing it).

=== Configuration update ===

After upgrading, your existing wiki should continue to work (the goal is to have sane defaults for any new config values, but then there can be bugs and also changes that must break compatibility).

Check that this is indeed the case, and then take the time to check the CHANGES file in your distribution archive. Often, new features will be invisible unless you extend your configuration in `wikiconfig.py`.

Check that you have the latest "intermap.txt" file; If you have your own entries, you can point "shared_intermap" at a file loaded ''before'' the file in your data directory, which takes precedence (i.e. have global entries in the shared one, private entries the data dir file).

=== Static files ===
Since release 1.9.0, moin has a built-in static file webserver to serve the CSS, images, javascript, etc. files that come with moin.

This static file web server serves the files contained in path `MoinMoin/web/static/htdocs/` at URL `<script URL> + <url_prefix_static>`.

So, if you run your wiki at the root of your site (/) the default `url_prefix_static` will work for you.

The default `url_prefix_static` is something like `/moin_staticVVV` (VVV is 190 for moin release 1.9.0) and VVV will change on every release (moin 1.9.1 will use `/moin_static191` by default). This is done to be able to use a very long cache lifetime for the static stuff, so your wiki will be faster and cause less load and traffic. Even if you don't use a long cache lifetime, a changing `url_prefix_static` makes sure that if you upgrade your wiki all your wiki users will immediately get the fresh static stuff.

If you run your wiki at a different base path, you need to set `url_prefix_static` to the correct value, e.g. `url_prefix_static = '/mywiki' + url_prefix_static` if you run your wiki at `/mywiki`.

If you want moin to serve a different directory than the default `MoinMoin/web/static/htdocs/`, you can change the path in `moin.wsgi` like `shared='/my/path/to/htdocs'` to serve static files from that path.

(!) Please note that if you serve the static files from a different than the "builtin" directory, you are responsible for updating those files from `MoinMoin/web/static/htdocs/` when you upgrade your moin installation.

Alternatively to using moin's builtin static files server, you can also serve the static files with some external webserver (e.g. with Apache, if that is your main web server). If you want to do this, just have your web server catch the requests for stuff below the `url_prefix_static` URL (before they reach the moin script) and serve those requests with the files from `MoinMoin/web/static/htdocs/` (or a copy of them).


=== Wiki pages update ===
==== System and Help pages ====
System and help pages are separately stored in the `underlay` directory. Just use the fresh underlay directory we provide in the distribution archive (move the old one to your backup directory) and read and follow the LanguageSetup page in your wiki.

If you previously modified some system page in your wiki (see [[EditedSystemPages]] on your wiki), you might want to ''Delete'' them to use moinmoin's updated version (warning: you can't un-delete that page later).

==== InterWiki data ====
Copy `intermap.txt` from the distribution archive into your wiki data 

==== Your valuable own pages ====
See CHANGES and README.migration for maybe necessary steps to convert your `data_dir` to what we expect.

=== Clean your cache ===
Finally, stop moin, delete cached data by running `moin ... maint cleancache`, start moin.

=== Troubleshooting ===
Hints: 
 * Use absolute pathes, not relative ones.

 * Make sure you have an adequate logging configuration (see server adaptor script and the logging configuration file) and carefully read the log!

 * Make sure python can find the !MoinMoin code package and your wiki configuration files (fix `sys.path` in the server adaptor script or PYTHONPATH in the environment).

 * Make sure !MoinMoin can find the data_dir and data_underlay_dir (see `wikiconfig.py`).

 * When you are editing python code files (e.g. `wikiconfig.py`), be careful to indent correctly (use 4 spaces, not tabs) and also be careful not to make syntax errors. If you have a working config, do not make too many changes at once (and have a backup of a working version).

 * Check permissions (the moin process needs read/write access to `data_dir` and `data_underlay_dir`, it needs at least read access to the MoinMoin code and configuration).

 * Depending on your installation, more tightly secured permissions are a good idea. Ideally, you assign all files in the data directory to the user the web server runs under, and then you use `700` or `770` - see also the `config.umask` setting.

== Version specific notes ==
 * For 1.2.x to 1.3.x, you maybe find some useful hints on [[MoinMoin:MauricioHernandez/HowToSurviveMigration]].
 * For 1.5.x to 1.6.x, see [[MoinMoin:RickVanderveer/UpgradingFromMoin15ToMoin16]].
 * For 1.6.x to 1.7.x, see [[MoinMoin:RickVanderveer/UpgradingFromMoin16ToMoin17]].
 * For 1.7.x to 1.8.x, see [[MoinMoin:RickVanderveer/UpgradingFromMoin17ToMoin18]].
 * For 1.8.x to 1.9.x, see [[MoinMoin:RickVanderveer/UpgradingFromMoin18ToMoin19]].
