Page MenuHomePhorge

Fully automatic setup and synchronization script for Kontact
Closed, ResolvedPublic4 Story Points

Description

We need a way to fully automatically setup a fresh kontact, synchronize it, and shut down again.

Requirements:

  • Works on a completely fresh system
  • Set akonadi mysql server (with support for external servers)
  • Creates kolab resource
  • starts akonadi and triggers a complete sync
  • script blocks until complete sync is done (so it can be called in a loop for different users)
  • python/bash/c++ is fine
  • preferably without X11 session (headless)
  • dbus needs to be started if not available
  • script gets credentials as parameters

Details

Ticket Type
Epic

Event Timeline

mollekopf assigned this task to knauss.
mollekopf raised the priority of this task from to High.
mollekopf updated the task description. (Show Details)
mollekopf added a project: KDE PIM.
mollekopf changed Ticket Type from Task to Epic.
mollekopf subscribed.

do we need to create also the compelte configs in the user home?

At least stuff like identity configuration. A user should be able to login and kontact should be immediately useable with default configs. So I guess about the same as the setup wizard?

starting full sync and get the end:

  • dbus method org.freedesktop.Akonadi.Resource.akonadi_kolab_resource_0rc /org.freedesktop.Akonadi.Resource /sychronize
  • dbus signal org.freedesktop.Akonadi.Resource.akonadi_kolab_resource_0rc /org.freedesktop.Akonadi.Agent.Status /status this one indecated with "0, ready" that it is ready.

preferably without X11 session (headless)

problery not possible because kwalletd don't start without X11 (it won't start with xvfb).

At least stuff like identity configuration. A user should be able to login and kontact should be immediately useable with default configs. So I guess about the same as the setup wizard?

Using the setup wizard in ithis scenario is not the way to go, bcause for the accountwizard, need much more stuff to be installed. And the biggest disadvantage, you don't know the name of the resource afterwards. Because we have here a fully controlled env

Have now all bits together, but need to polish everything a little bit:

  • create database+user for mysql
  • create default configfiles
  • setup dbus
  • push password into kwallet
  • start akonadi
  • run fullSync
  • wait for sync to end

(currently a wild mixure of python and bash)

needed:

I think also I want to use:

knauss moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.
knauss edited a custom field.
knauss moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Dec 2 2015, 8:51 PM

a first version is now available at:

https://github.com/hefee/akonadi-initalsync

The target platform is debian wheezy.

petersen added a project: Restricted Project.Dec 8 2015, 11:43 AM
petersen moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.

The script doesn't seem to handle a missing connection to the server, it simply stalls forever.

We also need a defined testenvironment (a dockercontainer that can work against a test kolab server)

The target platform is Ubuntu 12.04 LTS, not debian wheezy.

there is now a testenvionment in dev/autoupdate

(when I write ipython i mean ipython - the problem is that the normal python interpreter has problems with the inter-module import of f.ex. settings)

ipython ./automatedupdate/build.py #build kolabclient/percise
python testenv.py start set1  #start the kolab server (set1)

start the sync:

% ipython automatedupdate/run.py
$ cd akonadi-initalsync/
$ ./test.sh

As example a full session:

% ipython automatedupdate/run.py
WARNING: Your kernel does not support memory swappiness capabilities, memory swappiness discarded.
fatal: destination path 'akonadi-initalsync' already exists and is not an empty directory.
developer@3071cf06276b:/work$ cd akonadi-initalsync/
developer@3071cf06276b:/work/akonadi-initalsync$ ./test.sh 
+ export QT_GRAPHICSSYSTEM=native
+ QT_GRAPHICSSYSTEM=native
+ export QT_X11_NO_MITSHM=1
+ QT_X11_NO_MITSHM=1
+ sudo setfacl -m user:developer:rw /dev/dri/card0
+ export KDE_DEBUG=1
+ KDE_DEBUG=1
+ USER=doe
+ PASSWORD=Welcome2KolabSystems
+ sleep 2
+ sudo /usr/sbin/mysqld
151215 14:17:25 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
151215 14:17:25 [Note] /usr/sbin/mysqld (mysqld 5.5.46-0ubuntu0.12.04.2) starting as process 16 ...
+ sudo mysql --defaults-extra-file=/etc/mysql/debian.cnf
+ ./initalsync.py 'John Doe' doe@example.com doe Welcome2KolabSystems akonadi_kolab_resource_0
INFO:root:setup configs
INFO:DBusServer:starting dbus...
INFO:root:set kwallet password
INFO:Akonadi:starting akonadi ...
INFO:root:trigger fullSync
INFO:AkonadiSync:fullSync for akonadi_kolab_resource_0 started
INFO:AkonadiSync:fullSync for akonadi_kolab_resource_0 was successfull.
INFO:Akonadi:stopping akonadi ...
INFO:DBusServer:stopping dbus...
developer@3071cf06276b:/work/akonadi-initalsync$ echo $?
0

The process as described above works fine (except that I had to create ~/kdebuild/automatedupdate manually because it had the wrong permissions, I guess it should be created before running the container).

The mysql config doesn't provide the necessary configuration options to configure an external server, but that could be done by editing the template directly:

developer@4f95b959b320:/work/akonadi-initalsync$ cat sync/templates/.config/akonadi/akonadiserverrc
[%General]
Driver=QMYSQL

[QMYSQL]
Name={uid}
Host=localhost
Options="UNIX_SOCKET=/run/mysqld/mysqld.sock"
ServerPath=/usr/sbin/mysqld
StartServer=false
User={uid}
Password={password}

[Debug]
Tracer=null

[QPSQL]
StartServer=true
Name=akonadi
Host=
User=
Password=
Port=5432

[SQLITE]
Name=akonadi

Further mysqld, kded4, klauncher, kwalletd and kuiserver keep running, but I don't think that is a problem.

The help script creates a database with the uid of the user, so multiple users can live on the same database.
I verified that collections and items are correctly synced, and that the script can be run multiple times without problems.

mollekopf moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.
mollekopf added a subscriber: knauss.
knauss moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.

it is already gone to the wild