Revision e6df0da5
b/docs/upgrade-0.13.rst | ||
---|---|---|
15 | 15 |
it will be needed during a second-phase of UUID and quota migrations, that |
16 | 16 |
also uses data extracted from step 1. |
17 | 17 |
|
18 |
.. warning:: |
|
19 |
|
|
20 |
It is highly suggested that you keep separate database backups for each |
|
21 |
service after the completion of each of step. |
|
22 |
|
|
18 | 23 |
|
19 | 24 |
1. Bring all services down |
20 | 25 |
========================== |
21 | 26 |
|
22 |
All services must be brought down so that the database maintains a predictable
|
|
23 |
and consistent state as the migration is being executed. |
|
27 |
All web services must be brought down so that the database maintains a
|
|
28 |
predictable and consistent state as the migration is being executed.
|
|
24 | 29 |
|
25 | 30 |
|
26 | 31 |
2. Prepare astakos user migration to case insensitive emails |
... | ... | |
39 | 44 |
------------------------------------------- |
40 | 45 |
(script: ``find_astakos_users_with_conflicting_emails.py``):: |
41 | 46 |
|
42 |
astakos-host$ cat << EOF > find_astakos_users_with_conflicting_emails.py |
|
43 |
import os |
|
44 |
import sys |
|
45 |
|
|
46 |
os.environ['DJANGO_SETTINGS_MODULE'] = 'synnefo.settings' |
|
47 |
|
|
48 |
import astakos |
|
49 |
from astakos.im.models import AstakosUser as A |
|
50 |
|
|
51 |
def user_filter(user): |
|
52 |
return A.objects.filter(email__iexact=user.email).count() > 1 |
|
53 |
|
|
54 |
all_users = list(A.objects.all()) |
|
55 |
userlist = [(str(u.pk) + ': ' + str(u.email)) |
|
56 |
for u in filter(user_filter, all_users)] |
|
57 |
sys.stderr.write("id: email\n") |
|
58 |
print "\n".join(userlist) |
|
59 |
|
|
60 |
EOF |
|
61 |
|
|
47 |
astakos-host$ wget https://code.grnet.gr/projects/synnefo/repository/revisions/release-0.13/raw/contrib/upgrade-013/find_astakos_users_with_conflicting_emails.py |
|
62 | 48 |
astakos-host$ python ./find_astakos_users_with_conflicting_emails.py |
63 | 49 |
|
64 | 50 |
|
... | ... | |
68 | 54 |
------------------------------------------------- |
69 | 55 |
(script: ``delete_astakos_users.py``):: |
70 | 56 |
|
71 |
astakos-host$ cat << EOF > delete_astakos_users.py |
|
72 |
import os |
|
73 |
import sys |
|
74 |
from time import sleep |
|
75 |
|
|
76 |
os.environ['DJANGO_SETTINGS_MODULE'] = 'synnefo.settings' |
|
77 |
|
|
78 |
import astakos |
|
79 |
from astakos.im.models import AstakosUser as A |
|
80 |
|
|
81 |
def user_filter(user): |
|
82 |
return A.objects.filter(email__iexact=user.email).count() > 1 |
|
83 |
|
|
84 |
argv = sys.argv |
|
85 |
argc = len(sys.argv) |
|
86 |
|
|
87 |
if argc < 2: |
|
88 |
print "Usage: ./delete_astakos_users.py <id>..." |
|
89 |
raise SystemExit() |
|
90 |
|
|
91 |
id_list = [int(x) for x in argv[1:]] |
|
92 |
|
|
93 |
print "" |
|
94 |
print "This will permanently delete the following users:\n" |
|
95 |
print "id: email" |
|
96 |
print "-- -----" |
|
97 |
|
|
98 |
users = A.objects.filter(id__in=id_list) |
|
99 |
for user in users: |
|
100 |
print "%s: %s" % (user.id, user.email) |
|
101 |
|
|
102 |
print "\nExecute? (yes/no): ", |
|
103 |
line = raw_input().rstrip() |
|
104 |
if line != 'yes': |
|
105 |
print "\nCancelled" |
|
106 |
raise SystemExit() |
|
107 |
|
|
108 |
print "\nConfirmed." |
|
109 |
sleep(2) |
|
110 |
for user in users: |
|
111 |
print "deleting %s: %s" % (user.id, user.email) |
|
112 |
user.delete() |
|
113 |
|
|
114 |
EOF |
|
115 |
|
|
57 |
astakos-host$ wget https://code.grnet.gr/projects/synnefo/repository/revisions/release-0.13/raw/contrib/upgrade-013/delete_astakos_users.py |
|
116 | 58 |
astakos-host$ python ./delete_astakos_users.py 30 40 |
117 | 59 |
|
118 | 60 |
.. warning:: |
119 | 61 |
|
120 |
MAKE SURE THAT YOU HAVE RESOLVED ALL CONFLICTS |
|
62 |
After you finish with duplicate accounts cleanup using the |
|
63 |
``delete_astakos_users.py`` script, execute the |
|
64 |
``find_astakos_users_with_conflicting_emails.py`` once again and make sure |
|
65 |
that it reports no such users and all duplicate email conflicts have been |
|
66 |
resolved. |
|
121 | 67 |
|
122 | 68 |
|
123 | 69 |
3. Upgrade Synnefo and configure settings |
... | ... | |
152 | 98 |
snf-pithos-webclient \ |
153 | 99 |
kamaki \ |
154 | 100 |
|
101 |
.. note:: |
|
102 |
|
|
103 |
If you get questioned about stale content types during the |
|
104 |
migration process, answer ``no`` and let the migration finish. |
|
105 |
|
|
106 |
|
|
155 | 107 |
3.2 Sync and migrate Django DB |
156 | 108 |
------------------------------ |
157 | 109 |
|
... | ... | |
282 | 234 |
Configure and load the available resources per service |
283 | 235 |
and associated default limits into Astakos:: |
284 | 236 |
|
285 |
astakos.host$ snf-manage astakos-load-service-resources |
|
237 |
astakos.host$ snf-manage astakos-init --load-service-resources
|
|
286 | 238 |
|
287 | 239 |
Example astakos settings (from `okeanos.io <https://okeanos.io/>`_):: |
288 | 240 |
|
... | ... | |
359 | 311 |
|
360 | 312 |
:: |
361 | 313 |
|
362 |
cyclades.host$ snf-manage cyclades-astakos-migrate-0.13 --validate
|
|
314 |
cyclades.host$ snf-manage cyclades-astakos-migrate-013 --validate |
|
363 | 315 |
|
364 | 316 |
Duplicate user found? |
365 | 317 |
|
366 | 318 |
- either *merge* (merge will merge all resources to one user):: |
367 | 319 |
|
368 |
cyclades.host$ snf-manage cyclades-astakos-migrate-0.13 --merge-user=kpap@grnet.gr
|
|
320 |
cyclades.host$ snf-manage cyclades-astakos-migrate-013 --merge-user=kpap@grnet.gr |
|
369 | 321 |
|
370 | 322 |
- or *delete* :: |
371 | 323 |
|
372 |
cyclades.host$ snf-manage cyclades-astakos-migrate-0.13 --delete-user=KPap@grnet.gr
|
|
324 |
cyclades.host$ snf-manage cyclades-astakos-migrate-013 --delete-user=KPap@grnet.gr |
|
373 | 325 |
# (only KPap will be deleted not kpap) |
374 | 326 |
|
375 | 327 |
6.2 Migrate Cyclades users (email case/uuid) |
... | ... | |
377 | 329 |
|
378 | 330 |
:: |
379 | 331 |
|
380 |
cyclades.host$ snf-manage cyclades-astakos-migrate-0.13 --migrate-users
|
|
332 |
cyclades.host$ snf-manage cyclades-astakos-migrate-013 --migrate-users |
|
381 | 333 |
|
382 | 334 |
- if invalid usernames are found, verify that they do not exist in astakos:: |
383 | 335 |
|
... | ... | |
385 | 337 |
|
386 | 338 |
- if no user exists:: |
387 | 339 |
|
388 |
cyclades.host$ snf-manage cyclades-astakos-migrate-0.13 --delete-user=<userid>
|
|
340 |
cyclades.host$ snf-manage cyclades-astakos-migrate-013 --delete-user=<userid> |
|
389 | 341 |
|
390 | 342 |
6.3 Migrate Pithos user names |
391 | 343 |
----------------------------- |
392 | 344 |
|
393 | 345 |
Check if alembic has not been initialized :: |
394 | 346 |
|
395 |
pithos.host$ pithos-migrate-0.13 current
|
|
347 |
pithos.host$ pithos-migrate current |
|
396 | 348 |
|
397 | 349 |
- If alembic current is None (e.g. okeanos.io) :: |
398 | 350 |
|
399 |
pithos.host$ pithos-migrate-0.13 stamp 3dd56e750a3
|
|
351 |
pithos.host$ pithos-migrate stamp 3dd56e750a3 |
|
400 | 352 |
|
401 | 353 |
Finally, migrate pithos account name to uuid:: |
402 | 354 |
|
403 |
pithos.host$ pithos-migrate-0.13 upgrade head
|
|
355 |
pithos.host$ pithos-migrate upgrade head |
|
404 | 356 |
|
405 | 357 |
7. Migrate old quota limits |
406 | 358 |
=========================== |
Also available in: Unified diff