fork 0k-charms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

184 lines
5.7 KiB

  1. # -*- ispell-local-dictionary: "english" -*-
  2. #+TITLE: Cyclos
  3. * Upgrade
  4. ** Migration of existing database
  5. This is taken into account on first run of the newer version.
  6. ** Cleaning an existing database to share a new version of it
  7. The initial dump provided should probably use:
  8. #+begin_src sql
  9. delete from account_balances;
  10. delete from dirty_account_balances;
  11. delete from closed_account_balances;
  12. delete from imported_file;
  13. delete from imported_files;
  14. delete from account_balances where account_id in (select id from accounts where user_id in (select id from users where status ='PURGED'));
  15. delete from user_status_logs where user_id in (select id from users where status = 'PURGED');
  16. delete from messages_to_users where user_id in (select id from users where status = 'PURGED');
  17. delete from ads where owner_id in (select id from users where status = 'PURGED');
  18. delete from passwords where user_id in (select id from users where status = 'PURGED');
  19. delete from user_group_logs where user_id in (select id from users where status = 'PURGED');
  20. delete from admin_notif_settings_fwd_message_categories where preference_id in (
  21. select id from notification_settings where user_id in (
  22. select id from users where status = 'PURGED')
  23. );
  24. delete from admin_notif_settings_user_groups where preference_id in (
  25. select id from notification_settings where user_id in (
  26. select id from users where status = 'PURGED')
  27. );
  28. delete from notification_type_settings where settings_id in (
  29. select id from notification_settings where user_id in (
  30. select id from users where status = 'PURGED')
  31. );
  32. delete from admin_notif_settings_user_alerts where admin_notification_preference_id in (
  33. select id from notification_settings where user_id in (
  34. select id from users where status = 'PURGED')
  35. );
  36. delete from admin_notif_settings_external_payments_expired where preference_id in (
  37. select id from notification_settings where user_id in (
  38. select id from users where status = 'PURGED')
  39. );
  40. delete from admin_notif_settings_external_payments_failed where preference_id in (
  41. select id from notification_settings where user_id in (
  42. select id from users where status = 'PURGED')
  43. );
  44. delete from admin_notif_settings_payments where preference_id in (
  45. select id from notification_settings where user_id in (
  46. select id from users where status = 'PURGED')
  47. );
  48. delete from notification_settings where user_id in (select id from users where status = 'PURGED');
  49. delete from user_activities where user_id in (select id from users where status = 'PURGED');
  50. delete from trusted_devices where user_id in (select id from users where status = 'PURGED');
  51. delete from messages_to_groups where message_id in (
  52. select id from messages where
  53. messages.owner_user_id in (select id from users where status = 'PURGED') or
  54. messages.sentby_user_id in (select id from users where status = 'PURGED'));
  55. delete from messages where owner_user_id in (select id from users where status = 'PURGED') or
  56. sentby_user_id in (select id from users where status = 'PURGED');
  57. delete from notifications where user_id in (select id from users where status = 'PURGED');
  58. delete from failed_action_logs where user_id in (select id from users where status = 'PURGED');
  59. delete from users where status = 'PURGED';
  60. delete from ad_history_logs;
  61. delete from notified_ad_interests;
  62. delete from alerts;
  63. delete from error_logs;
  64. delete from entity_property_logs;
  65. delete from entity_logs;
  66. delete from login_history_logs;
  67. delete from messages;
  68. delete from failed_action_logs;
  69. #+end_src
  70. This will set back admin password to 1234 as stated in
  71. [[https://documentation.cyclos.org/4.14/cyclos-reference/installation-maintenance.html][cyclos maintenance documentation]]
  72. #+begin_src sql
  73. UPDATE passwords
  74. SET value='$2a$10$yM.uw9jC7C1DrRGUhqUc3eSR6FCJH0.HdDt3CJs8YL56iATHcXH7.'
  75. WHERE user_id = (SELECT id FROM users WHERE username='admin')
  76. AND status = 'ACTIVE'
  77. AND password_type_id in (
  78. SELECT id FROM password_types
  79. WHERE input_method = 'TEXT_BOX'
  80. AND password_mode = 'MANUAL'
  81. );
  82. UPDATE passwords
  83. SET value = '$2a$04$rDPKseEiJhYdjx9RogW2tuzNX4TKG1wcE79ooEXiA5.mJF.ooZY/2'
  84. WHERE status <> 'OLD'
  85. AND password_type_id in (
  86. SELECT id FROM password_types
  87. WHERE input_method = 'TEXT_BOX'
  88. AND password_mode = 'MANUAL'
  89. );
  90. UPDATE users
  91. SET email = concat(username, '@test.com')
  92. WHERE email IS NOT null;
  93. #+end_src
  94. This needs to be deleted also for any dumps.
  95. #+begin_src sql
  96. delete from database_lock;
  97. #+end_src
  98. In java also:
  99. #+begin_src sh
  100. compose --debug stop cyclos
  101. compose --debug --no-hooks run --entrypoint bash cyclos
  102. #+end_src
  103. then inside the docker:
  104. #+begin_src sh
  105. java -cp "WEB-INF/classes:WEB-INF/lib/*:/usr/local/tomcat/lib/*" \
  106. org.cyclos.db.DeleteNetworkData
  107. #+end_src
  108. (remove all users and transfer, choice 1, then 'yes')
  109. * Changing Licence information
  110. This command is to be executed from the host, knowing that here =cyclos=
  111. stands for the name of the =cyclos= service:
  112. #+begin_src sh
  113. compose sql cyclos <<EOF
  114. update application
  115. set
  116. license_key = null,
  117. license_data = null,
  118. local_license_data = null;
  119. EOF
  120. #+end_src
  121. Restart cyclos
  122. #+begin_src sh
  123. docker restart myc_cyclos_1
  124. #+end_src
  125. Then go to URL =/global/classic= with a browser... follow wizard with
  126. your id and password from cyclos licence server.
  127. You have to create a new admin that will need to be removed
  128. afterwards. It is a good idea to give him the identifier: =adminTemp=.
  129. At the end of the wizard, you'll have a broken interface. You can
  130. point to the root url and then disconnect, and reconnect with the
  131. standard admin.
  132. Go to general settings, then users management, and select =adminTemp=
  133. user, and ask to remove it. Purge it completely.