Skip to content

Instantly share code, notes, and snippets.

@dzungtran89
Last active April 15, 2022 05:12
Show Gist options
  • Save dzungtran89/e2c88f1d539a20f5adea5e9cad6eae51 to your computer and use it in GitHub Desktop.
Save dzungtran89/e2c88f1d539a20f5adea5e9cad6eae51 to your computer and use it in GitHub Desktop.

There are many ways to help you backup the tasks, using subversion control is one of those. I've used git for a while to keep track them, now I would like to show you how to keep track the tasks by the traditional way - Taskserver

Installation

brew install taskd

brew is available on either macos or ubuntu. If you are using another OS, please refer to 1

  1. Configuration

    You might already see some of guidelines using $TASKDDATA to point to taskd data dir. In my case, I explicitly point to the default /var/taskd, you can have another as you wish

    taskd init --data /var/taskd
    

    When you're done, you can see a file named config in that dir, now you need to update this file with another values

    log=/var/taskd/taskd.log
    pid.file=/var/taskd/taskd.pid
    client.cert=/var/taskd/api.cert.pem
    client.key=/var/taskd/api.key.pem
    server.cert=/var/taskd/server.cert.pem
    server.key=/var/taskd/server.key.pem
    server.crl=/var/taskd/server.crl.pem
    ca.cert=/var/taskd/ca.cert.pem
    

    log and pid.file can be created by touch command. For the keys, somehow I could not see the dir pki on local, so I used an alternative as below

    # Clone this repo
    git clone git@github.com:GothenburgBitFactory/taskserver.git
    cd taskserver/pki
    
    # Generate keys for you server
    ./generate
    
    # Then, copy the keys to `/var/taskd` dir
    
  2. Start the taskserver

    taskdctl start
    
    # Check the server status
    taskdctl status
    
    # For more info, you might refer to the log
    tail -f /var/taskd/taskd.log
    

Users

  1. Create user

    taskd add org <org>
    taskd add user <org> <user>
    
    # cd the `pki` dir as above
    cd taskserver/pki
    
    # Generate cert / key for the beloved user
    ./generate.client <user>
    

    fyi, Org / User is managed in the dir /var/taskd/orgs. Each user has an uuid, i.e: 36102155-5be6-4da0-afca-6d1a7b86b696

    The infomation that you need to provide to the user

    • The taskserver address, i.e: localhost:53589
    • The generated certificate file with format <user>.cert.pem
    • The generated key file with format <user>.key.pem
    • User credential <uuid which can be found after user created, or in the dir <org>/<user>/<uuid>
  2. At the client side

    Update your own taskrc with the provided info as above

    taskd.trust=allow all
    taskd.server=localhost:53589
    taskd.certificate=~/.task/foo.cert.pem
    taskd.key=~/.task/foo.key.pem
    taskd.credentials=Public/foo/36102155-5be6-4da0-afca-6d1a7b86b696
    

    Try to sync your tasks by task sync init


Footnotes

  1. https://taskwarrior.org/docs/taskserver/setup.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment