doc/book/en/admin/migration.rst
author Nicolas Chauvat <nicolas.chauvat@logilab.fr>
Wed, 28 Nov 2012 11:44:15 +0100
branchstable
changeset 8604 7bacc4f21edc
parent 5371 6d25b84ffd50
child 10235 684215aca046
permissions -rw-r--r--
[web/views] bugfix: the mime type is text/plain, not text/txt (closes #2526345)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5371
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
     1
.. -*- coding: utf-8 -*-
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
     2
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
     3
Migrating cubicweb instances - benefits from a distributed architecture
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
     4
=======================================================================
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
     5
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
     6
Migrate apache & cubicweb
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
     7
-------------------------
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
     8
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
     9
**Aim** : do the migration for N cubicweb instances hosted on a server to another with no downtime.
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    10
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    11
**Prerequisites** : have an explicit definition of the database host (not default or localhost). In our case, the database is hosted on another host. You are not migrating your pyro server. You are not using multisource (more documentation on that soon).
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    12
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    13
**Steps** :
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    14
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    15
1. *on new machine* : install your environment (*pseudocode*) ::
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    16
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    17
     apt-get install cubicweb cubicweb-applications apache2
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    18
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    19
2. *on old machine* : copy your cubicweb and apache configuration to the new machine ::
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    20
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    21
    scp /etc/cubicweb.d/ newmachine:/etc/cubicweb.d/
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    22
    scp /etc/apache2/sites-available/ newmachine:/etc/apache2/sites-available/
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    23
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    24
3. *on new machine* : give new ids to pyro registration so the new instances can register ::
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    25
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    26
     cd /etc/cubicweb.d/ ; sed -i.bck 's/^pyro-instance-id=.*$/\02/' */all-in-one.conf
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    27
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    28
4. *on new machine* : start your instances ::
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    29
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    30
     cubicweb start
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    31
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    32
5. *on new machine* : enable sites and modules for apache and start it, test it using by modifying your /etc/host file.
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    33
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    34
6. change dns entry from your oldmachine to newmachine
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    35
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    36
7. shutdown your *old machine* (if it doesn't host other services or your database)
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    37
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    38
8. That's it.
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    39
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    40
**Possible enhancements** : use right from the start a pound server behind your apache, that way you can add backends and smoothily migrate by shuting down backends that pound will take into account.
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    41
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    42
Migrate apache & cubicweb with pyro
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    43
-----------------------------------
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    44
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    45
FIXME TODO
6d25b84ffd50 le patch some_admin_doc_for_migration a été importé
Arthur Lutz <arthur.lutz@logilab.fr>
parents:
diff changeset
    46