Git Product home page Git Product logo

indico-migrate's Introduction

This script migrates the database of an Indico 1.2.x server to version 2.0.

Migrating to Indico 2.0

Please refer to the Upgrade Guide for instructions on how to upgrade from Indico 1.2 to 2.0.

Migration settings

The migration command accepts a series of options that you will have to adjust according to your current Indico setup and whichever way you'd like to organize your new installation. We will go over them one by one, please read carefully!

The basic migration command consists of:

$ indico-migrate <sqlalchemy-uri> <zodb-uri> [--rb-zodb-uri <rb-zodb-uri>]

sqlalchemy-uri

This is the URI of your new SQLAlchemy database. If it's located in your local machine, it will look like this:

postgresql:///indico

Otherwise, it will be something like postgresql://<username>:<password>@<hostname>:<port>/indico.

zodb-uri

This is the URI of your Indico 1.2 ZODB. It should normally look like this:

zeo://localhost:9675/indico

If you're running it on a remote server, it will become zeo://<username>:<password>@<hostname>:<port>/indico

You can also choose to access the database file directly, instead of going through the ZEO service:

file:///opt/indico/db/Data.fs

This is slightly slower than the previous option but can be very useful if all you have is a database file and you don't want to set up a ZEO server.

--rb-zodburi (optional)

This option only applies if you were running Indico's Room Booking system and wish to migrate room and reservation information. The URI follows the same rules of zodb-uri. In most cases it will be something like:

zeo://localhost:9676/indico

This is followed by the relevant options from the following list:

--system-user-id (optional)

The "system user" is a user that performs automatic operations and which will also be used whenever, during the migration process, Indico doesn't manage to figure out who was responsible for a given action.

For instance, in Indico < 2.0 we were not keeping track of whoever submitted a paper revision. In 2.0 that is enforced, which is why during the migration we set all revisions as if they were authored by the system user.

If you already had an Indico user that you were using for "bot" actions, you can specify its (numeric) ID using this option. If that's not the case, you can safely ignore it and a new user will be created automatically.

Example:

$ indico-migrate postgresql:///indico2 zeo://127.0.0.1:9675 -v

--default-email (mandatory)

This is an e-mail address that will be used whenever Indico finds invalid addresses it cannot correct. Unfortunately, really old versions of Indico didn't validate e-mail addresses that well, which is why we need a placeholder e-mail to use in case we find an address we cannot understand. E.g. [email protected].

--ldap-provider-name (optional)

This is the name of the LDAP provider that will be used in your new config. Existing LDAP identities will be mapped to it. The best choice at this point is to set it to something like <your-organization>-ldap (e.g. cern-ldap). Write down this choice, you will need it when configuring Indico 2.0.

--default-group-provider (mandatory)

This is the name of the LDAP provider that will be used to resolve any groups in your new config. Existing LDAP groups will be mapped to the provider with this ID. It will be almost always the same value as that of --ldap-provider-name. Once again, write it down, you will need it when configuring Indico 2.0.

--archive-dir (mandatory)

This is the ArchiveDir that was set in your old indico.conf (in version 1.2).

--storage-backend (mandatory)

This is the name of the storage backend where migrated files will be kept. This option was added since in Indico 2.0 you will be able to set more than one storage backend (thus being able to split your files across different folders and even storage technology). The setup process needs to know the ID you will give to the storage backend where files imported from 1.2 will be kept. Since the directory structure changes slightly in 2.0, we recommend that you set this to something like fs-legacy. Whatever you choose, write it down since you'll need it when configuring 2.0.

These two options are closely related and require each other.

The sanitization of file names was quite poor in some early versions of Indico. This could lead to files with non-UTF8 names, which would be difficult for Indico 2.0 to deal with. Instead of renaming those files (which is not as simple as it may seem), we chose to instead symlink them and store the name of the link instead. If these options are specified, symlinks to weirdly-named files will be kept in the directory indicated by --symlink-target. They will be associated with the storage backend ID specified in --symlink-backend.

NOTE: This means that in the STORAGE_BACKENDS option of your new indico.conf you will have something like:

STORAGE_BACKENDS = {
    ...
    'fs-legacy-symlinks`: '/opt/indico/archive/legacy-symlinks'
}

--photo-path (optional)

If --rb-zodb-uri was specified, this is an optional directory (path) where Indico will be able to find photos of each room. Indico will look inside two directories: small_photos (thumbnails) and large_photos and import existing files (<room_canonical_name>.jpg) into the database.

--reference-type (optional, multiple)

If you were storing "Report Numbers" (now known as "External References"), specify here the IDs of the systems that were being used. Those should correspond to the keys in your ReportNumberSystems dictionary (Indico 1.2 config). The result should be somethink like --reference-type CDS --reference-type EDMS ...

--default-currency (mandatory)

This is the code of the currency unit that will be used by default in your server. E.g. USD or EUR.

--ignore-local-accounts (optional flag)

This option is meant for servers that were at some point using local accounts (username + password) but have since adopted another authentication method (LDAP + SSO, for instance). If you don't need local accounts anymore and don't want to move the old usernames and password to the new DB (which is probably a good idea), then set this option. This will also save you some migration time.

--migrate-broken-events (optional flag)

This option will import events that were previously broken due to not being associated with a valid category. Such events usually only exist if the old database had events imported from CDSAgenda. If this flag is enabled and any such events exist, a new top-level category named 'Lost & Found' will be created and the events stored in there.

Other settings

These less used settings are meant mainly for debugging purposes. You shouldn't normally use them unless you know what you're doing.

--no-gui (optional flag)

This option will disable the curses-like "graphical" interface, using plain text instead.

--verbose (optional flag)

This flag increases the verbosity of the Indico migration command. The amount of information can be overwhelming.

--dblog (optional flag)

If this option is specified, the migration command will contact the Indico DB logger running in the local machine and log every request that is made to the PostgreSQL server.

--debug (optional flag)

This option will launch the migration in debug mode, which means that the user will be given a debugger shell when something goes wrong.

--avoid-storage-check (optional flag)

DANGER! By specifying this option, you're telling Indico it doesn't need to check if a file really exists when migrating it. This will result in a faster migration but as well in possible data inconsistency and incomplete information.

--save-restore (optional flag)

This option triggers a dump of all intermediate migration data that is kept in memory to a file on disk, called indico-migration.yaml, whenever the migration fails. This allows the process to be resumed from the point at which it failed.

--restore-file (optional flag)

DANGER! This option takes a file path as argument. The file in question should be a dump proced with --save-restore and which will be loaded to memory. The global migration steps that had been performed at the time of the failure will be skipped.

indico-migrate's People

Contributors

bpedersen2 avatar maxfischer2781 avatar mic4ael avatar pferreir avatar thiefmaster avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

indico-migrate's Issues

(psycopg2.IntegrityError) null value in column "storage_backend" violates not-null constraint

Good Morning,

I am getting the following error when trying to migrate fom 1.2 to 2.0.:

(psycopg2.IntegrityError) null value in column "storage_backend" violates not-null constraint
DETAIL:  Failing row contains (1, 109, 1, 0, null, application/pdf, , null, senekane_et_al_dp_student_t_mechanism.pdf).
 [SQL: 'INSERT INTO event_paper_reviewing.files (contribution_id, revision_id, size, storage_backend, content_type, md5, storage_file_id, filename) VALUES (%(contribution_id)s, %(revision_id)s, %(size)s, %(storage_backend)s, %(content_type)s, %(md5)s, %(storage_file_id)s, %(filename)s) RETURNING event_paper_reviewing.files.id'] [parameters: {'storage_file_id': None, 'filename': 'senekane_et_al_dp_student_t_mechanism.pdf', 'contribution_id': 109, 'storage_backend': None, 'content_type': 'application/pdf', 'revision_id': 1, 'md5': u'', 'size': 0}]

option to suppress garbage participant email

In our 1.2 database, we have several invalid emails entered by participants who registered to events, in particular missing @dom.ain. Currently the migration script is adding @example.com which is not really making sense IMO. Could it be possible to have an option to delete such emails rather than modifying them (keeping the participants)?

Migrate plugin data

  • Chat
  • Invenio Importer - just settings
  • LiveSync - if we ignore it people need to add their agent manually and either run an initial export or set it as run via indico shell
  • PayPal Payment - important event settings such as the recipient of the payment
  • Piwik - just settings
  • Search Invenio - just settings
  • VC Vidyo

Migrate Attachments

Attachment migration should be split between:

  • Event migration
  • Category migration

naive datetime message has no event ID

I think that everything is in the title. The [event] message about naive datetime is not associated with an event so it is difficult to check the result. For example:

! [event] Naive datetime converted (2006-11-24 18:00:00)

timetable errors

I have also a number of events where indico-migrate reported a timetable error like:

timetable   Contribution <persistent broken MaKaC.conference.Contribution instance '\x00\x00\x00\x00\x00\x16\x8a#'> has no fields

An event with such an error in my database is a0681. I have no clue what the potential impact on the converted event could be.

I did a check to compare the occurence of this error with the layout error and I found that it is often but not always associated with a layout error. The attached file is the result of the check done with the following command ($events containing all the event ids where a timetable error occured):

for event in $events; do echo Checking layout errors for $event; grep layout migration.log|grep " $event "; done>/tmp/timetable.list

From the visual checks I made, it seems to be again CDSAgenda events. And as usual you can look at these events in more details at http://indico.lal.in2p3.fr (v1.2).

Improve processing of events without a category in 1.2

indico-migrate reported 710 events without a category in our 1.2 DB. From the tests I made these events are already unreachable in v1.2 so this is not in itself a show stopper. But looking at the problem in 1.2 when trying to access them, the error reported is:

astimezone() cannot be applied to a naive datetime

which suggests that event is there but broken. The result of the conversion is that the event is not migrated. Is there a chance to fix the problem with the "naive time" and to resurrect these events without too much efforts? It seems that the affected events all come from CDSAgenda.

BTW, if the problem really is that the event has no category in 1.2 (probably due to some problem during the CDSAgenda -> Indico conversion), would it be possible to have an option in indico-migrate to create a Lost+Found category and assign these events to it (the category name is not that important, we can change it afterward).

If you want to look in more details to such an event, use the following URL: https://indico.lal.in2p3.fr/event/LAPPa079/.

Looking with indico_shell to the event in 1.2 gives the following result:

>>> pp.pprint(ConferenceHolder().getById('LAPPa079').__dict__)
{   '_Conference___contribTypeGenerator': <MaKaC.common.Counter.Counter object at 0x737fb90>,
    '_Conference__ac': <MaKaC.accessControl.AccessController object at 0x737fb18>,
    '_Conference__alarmCounter': <MaKaC.common.Counter.Counter object at 0x73812a8>,
    '_Conference__contribGenerator': <MaKaC.common.Counter.Counter object at 0x737fe60>,
    '_Conference__creator': <Avatar(1, CDS Agenda)>,
    '_Conference__materialGenerator': <MaKaC.common.Counter.Counter object at 0x737fc80>,
    '_Conference__owners': [],
    '_Conference__programGenerator': <MaKaC.common.Counter.Counter object at 0x737f668>,
    '_Conference__schedule': <MaKaC.schedule.ConferenceSchedule object at 0x737f8c0>,
    '_Conference__sessionGenerator': <MaKaC.common.Counter.Counter object at 0x737fcf8>,
    '_IM2Categs': [],
    '_OAImodificationDS': datetime.datetime(2007, 2, 5, 20, 27, 7, 338606),
    '_accessKey': '',
    '_archiveId': None,
    '_archivingDate': None,
    '_archivingRequestDate': None,
    '_authorIdx': <MaKaC.conference.AuthorIndex object at 0x737faa0>,
    '_autoSolveConflict': True,
    '_boa': <MaKaC.conference.BOAConfig object at 0x7381230>,
    '_bookings': {   },
    '_chairGen': <MaKaC.common.Counter.Counter object at 0x7381140>,
    '_chairs': [<MaKaC.conference.ConferenceChair object at 0x73810c8>],
    '_closed': False,
    '_contribTypes': {   },
    '_creationDS': datetime.datetime(2007, 1, 19, 0, 0),
    '_enableSessionSlots': True,
    '_legacyAlarmList': [],
    '_logHandler': <MaKaC.common.log.LogHandler object at 0x737fed8>,
    '_logo': None,
    '_modifKey': '41304100',
    '_modificationDS': datetime.datetime(2013, 5, 30, 11, 1, 27, 789721, tzinfo=<UTC>),
    '_participation': <MaKaC.participant.Participation object at 0x737f7d0>,
    '_pendingQueuesMgr': <MaKaC.common.pendingQueues.ConfPendingQueuesMgr object at 0x737f6e0>,
    '_primAuthIdx': <MaKaC.conference._PrimAuthIdx object at 0x7381050>,
    '_registrantGenerator': <MaKaC.common.Counter.Counter object at 0x737f758>,
    '_registrants': {   },
    '_registrationForm': <MaKaC.registration.RegistrationForm object at 0x737f9b0>,
    '_reportNumberHolder': <MaKaC.conference.ReportNumberHolder object at 0x737fde8>,
    '_sections': [],
    '_sessionCoordinatorRights': [],
    '_sessionCoordinators': <MaKaC.conference.SCIndex object at 0x737fc08>,
    '_speakerIdx': <MaKaC.conference.AuthorIndex object at 0x737f5f0>,
    '_submissionDate': None,
    '_submitterIdx': <MaKaC.conference.SubmitterIndex object at 0x737f938>,
    '_supportInfo': <indico.core.db.event.SupportInfo object at 0x73811b8>,
    '_trackCoordinators': <MaKaC.conference.TCIndex object at 0x737fd70>,
    '_visibility': 999,
    'abstractMgr': <MaKaC.review.AbstractMgr object at 0x737fa28>,
    'alarmList': {   },
    'chairmanText': '',
    'chairmans': [],
    'contactInfo': '',
    'contributions': {   's1t0': <MaKaC.conference.Contribution object at 0x737f848>},
    'description': '',
    'endDate': datetime.datetime(2007, 1, 19, 17, 0),
    'id': 'LAPPa079',
    'materials': {   },
    'minutes': None,
    'paper': None,
    'places': [<MaKaC.conference.CustomLocation object at 0x7381320>],
    'poster': None,
    'program': [],
    'programDescription': '',
    'rooms': [],
    'sessions': {   },
    'slides': None,
    'startDate': datetime.datetime(2007, 1, 19, 15, 30),
    'title': 'r\xc3\xa9union LHCb',
    'video': None}

Event ID sequence is not synced after migration

Should be fixed in the migration script.

SQL command to fix it in an already-migrated DB:

SELECT setval(pg_get_serial_sequence('events.events', 'id'), (SELECT max(id) FROM events.events));

Migrate Events

  • event_data
  • event_alarms
  • event_logs
  • event_notes
  • event_images
  • event_stubs
  • event_menus
  • event_layout
  • event_surveys
  • event_managers
  • event_regforms
  • event_participants
  • event_timetable
  • event_locations
  • event_categories
  • event_dates_titles
  • event_abstracts_zodb / event_abstracts
  • event_paper_reviewing_legacy / event_papers
  • event_acls
  • event_types
  • event_keywords_ctimes_visibility
  • event_shorturls

'Alarm' object has no attribute 'startDateTime'

Hi,

I am getting the following errors when doing an indico Migration:

Traceback (most recent call last): |/opt/indico/.venv/bin/indico-migrate:11 [<module>]
 |/opt/indico/.venv/local/lib/python2.7/site-packages/indico_migrate/cli.py:126 [main]
 |/opt/indico/.venv/local/lib/python2.7/site-packages/click/core.py:722 [__call__]
 |/opt/indico/.venv/local/lib/python2.7/site-packages/click/core.py:697 [main]
 |/opt/indico/.venv/local/lib/python2.7/site-packages/click/core.py:895 [invoke]
 |/opt/indico/.venv/local/lib/python2.7/site-packages/click/core.py:535 [invoke]
 |/opt/indico/.venv/local/lib/python2.7/site-packages/indico_migrate/cli.py:122 [cli]
 debug=debug, **kwargs)
 |/opt/indico/.venv/local/lib/python2.7/site-packages/indico_migrate/migrate.py:106 [migrate]
 |/opt/indico/.venv/local/lib/python2.7/site-packages/indico_migrate/importer.py:161 [run]
 |/opt/indico/.venv/local/lib/python2.7/site-packages/indico_migrate/util.py:323 [_f]
 |/opt/indico/.venv/local/lib/python2.7/site-packages/indico_migrate/steps/events/importer.py:183 [migrate]
 |/opt/indico/.venv/local/lib/python2.7/site-packages/indico_migrate/steps/events/importer.py:211 [migrate_event_data]
 |/opt/indico/.venv/local/lib/python2.7/site-packages/indico_migrate/steps/events/importer.py:137 [run_step]
 |/opt/indico/.venv/local/lib/python2.7/site-packages/indico_migrate/steps/events/__init__.py:83 [run]
 |/opt/indico/.venv/local/lib/python2.7/site-packages/indico_migrate/steps/events/misc.py:109 [migrate]
 if not alarm.startDateTime:

'Alarm' object has no attribute 'startDateTime'

layout and type of events created by CDSAgenda not properly converted

indico-migrate on our 1.2 db reported a non negligible number of layout problems with the following message (for example event a0698 in our db):

layout      Skipping some settings, missing _styleMngr attribute

Looking in more details, it appeared that the events causing this problem are coming from CDSAgenda (said explicitly in management mode) and have the layout shown in the attached screenshot (the traditional CDSAgenda look if I remember properly). Their "default style" setting is 'CDSAgenda style'. Those events are created in v2 but as a conference rather than a meeting (despite the event type in 1.2 is meeting) and I didn't find how to change it. Also the timetable style is the default one rather than the "indico style" which is very close to the CDSAgenda one (only the background customization in the description is not done).

Even if nobody should use the CDSAgenda layout for a new event, for a migrated one the layout should be as close as possible (if not identical) to what it was in 1.2 (the description yellow background is among the details that can be ignored IMO).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.