Revision 857383e3

b/docs/upgrade/upgrade-0.14.rst
1
Upgrade to Synnefo v0.14
2
^^^^^^^^^^^^^^^^^^^^^^^^
3

  
4
The bulk of the upgrade to v0.14 is about resource and quota migrations.
5

  
6

  
7
.. warning::
8

  
9
    It is strongly suggested that you keep separate database backups
10
    for each service after the completion of each of step.
11

  
12
1. Bring web services down, backup databases
13
============================================
14

  
15
1. All web services must be brought down so that the database maintains a
16
   predictable and consistent state during the migration process::
17

  
18
    # service gunicorn stop
19
    # service snf-dispatcher stop
20
    # etc.
21

  
22
2. Backup databases for recovery to a pre-migration state.
23

  
24
3. Keep the database servers running during the migration process
25

  
26

  
27
2. Upgrade Synnefo and configure settings
28
=========================================
29

  
30
2.2 Sync and migrate Django DB
31
------------------------------
32

  
33
.. note::
34

  
35
   If you are asked about stale content types during the migration process,
36
   answer 'no' and let the migration finish.
37

  
38
::
39

  
40
    astakos-host$ snf-manage syncdb
41
    astakos-host$ snf-manage migrate quotaholder_app 0001 --fake
42
    astakos-host$ snf-manage migrate quotaholder_app
43
    astakos-host$ snf-manage migrate im
44

  
45
    cyclades-host$ snf-manage syncdb
46
    cyclades-host$ snf-manage migrate
47

  
48

  
49
3 Quota-related steps
50
=====================
51

  
52
3.1 Set services and resources
53
------------------------------
54

  
55
Astakos and its resources should also get registered, so that they can
56
be known to the quota system.
57

  
58
Run::
59

  
60
    astakos-host$ snf-manage service-add astakos service_url api_url
61
    astakos-host$ snf-manage resource-export-astakos > astakos.json
62
    astakos-host$ snf-manage resource-import --json astakos.json
63
    astakos-host$ snf-manage resource-modify astakos.pending_app --limit <num>
64

  
65
The last command will set the limit of max pending project applications
66
per user. This replaces setting ASTAKOS_PENDING_APPLICATION_LIMIT.
67

  
68
In order to migrate the user-specific limits, run
69
(script: ``migrate_pending_app.py``)::
70

  
71
    import os
72
    os.environ['DJANGO_SETTINGS_MODULE'] = 'synnefo.settings'
73
    from astakos.im.models import UserSetting, AstakosUserQuota, Resource
74

  
75
    SETTING = 'PENDING_APPLICATION_LIMIT'
76
    RESOURCE = 'astakos.pending_app'
77

  
78
    try:
79
        resource = Resource.objects.get(name=RESOURCE)
80
    except Resource.DoesNotExist:
81
        print "Resource 'astakos.pending_app' not found."
82
        exit()
83

  
84
    settings = UserSetting.objects.filter(setting=SETTING)
85
    for setting in settings:
86
        user = setting.user
87
        value = setting.value
88
        q, created = AstakosUserQuota.objects.get_or_create(
89
            user=user, resource=resource, capacity=value)
90
        if not created:
91
            print "Base quota already exists: %s %s" % (user.uuid, RESOURCE)
92
            continue
93
        print "Migrated base quota: %s %s %s" % (user.uuid, RESOURCE, value)
94

  
95
with::
96

  
97
    astakos-host$ python ./migrate_pending_app.py
98

  
99
followed by::
100

  
101
    astakos-host$ snf-manage reconcile-resources-astakos

Also available in: Unified diff