Sunday, May 14, 2017

taskwarrior and its synchronization server

*** server ***

1- install task synchronization server
$ sudo apt-get install taskd

 2- initialize first configuration and user
$ cd ~
$ taskd init --data .
- add organization named org1
$  taskd add org org1 --data
- add group
$ taskd add group org1 group1 --data .
- add user

$ taskd add user org1 user10 --data .
New user key: 06b0e5ec-c89e-4ccd-b4f9-ab86aeb18045
Created user 'user10' for organization 'org1'

$ taskd add user org1 user11 --data .
New user key: 1cf0c32d-fe9e-4cf0-a2aa-27d2522ee773
Created user 'user11' for organization 'org1'



3- update its configration ~/config as below (certification, can use easy-rsa to generate)
confirmation=1
extensions=/usr/libexec/taskd
ip.log=off
log=/home/user1/tasklog
pid.file=/run/taskd.pid
queue.size=10
request.limit=1048576
root=/var/lib/taskd
server=192.168.58.153:53589
trust=allow all
verbose=1
server.cert=/home/user1/keys/server1.crt
server.client=/home/user1/keys/server2.crt
server.key=/home/user1/keys/server1.key
debug.tls=9


4- start the taskd server
$ export TASKDDATA=/home/user1
$ sudo -E bash -c "taskdctl restart"

*** client ***
1- install taskwarrior
$ sudo apt-get install taskwarrior
2- update its configuration file, ~/.taskrc, as below
taskd.server=192.168.58.153:53589
taskd.credentials=org1/user11/1cf0c32d-fe9e-4cf0-a2aa-27d2522ee773
taskd.certificate=/home/user1/keys/server1.crt
taskd.key=/home/user1/keys/server1.key
taskd.ca=/home/user1/keys/ca.crt
taskd.trust=ignore hostname
data.location=~/.task


3- now we can add tasks and sync to server
$ task add "buy a spoon" due:tomorrow 
$ task add "top tasks"
Created task 3.$ task ls

ID Description   
 1 buy a spoon   
 2 newtask       
 3 top tasks

3 tasks
There are local changes.  Sync required


- to sync
$ task synchronize
Syncing with 192.168.58.153:53589

Sync successful.  1 changes uploaded.


now if you have another device, you can sync the tasks to its with the name username/key (user11/.....)



***tips***

verify whether, the certificate issued by ca
$ openssl verify -verbose -CAfile ca.crt  server1.crt
server1.crt: OK


in case there're  cert errors, we can debug both client and server with the following  command

-on server
$ sudo taskd server --debug --debug.tls=2 --data .

-on client
$ task rc.debug=1 rc.debug.tls=2 sync











No comments:

Post a Comment