All Projects → timewarrior-synchronize → timew-sync-server

timewarrior-synchronize / timew-sync-server

Licence: MIT license
The timewarrior synchronization server

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to timew-sync-server

minutes
Sync worklogs between multiple time trackers, invoicing, and bookkeeping software.
Stars: ✭ 19 (-26.92%)
Mutual labels:  timewarrior
billwarrior
A Timewarrior report extension for generating invoices in LaTeX
Stars: ✭ 21 (-19.23%)
Mutual labels:  timewarrior

Timewarrior Sync Server

This repository contains the Server of the Timewarrior Sync project.

Setup

Building from source

First you need to build the server:

go build -o timew-server

If you haven't already, create a folder named authorized_keys in the same folder as your executable:

mkdir authorized_keys

Now you can start using your server:

./timew-server start

Using Nix

timew-sync-server is included in Nixpkgs. To install timew-sync-server into your current environment, use:

nix-env -i timew-sync-server

Then, follow the instructions above (create a directory for the keys and start the server).

Using docker

You can build a docker image using the provided Dockerfile:

# Build a docker image tagged timew-server
docker build -t timew-server .

To start the server, use:

# Running from the docker image tagged timew-server
docker run -p 8080:8080 timew-server

# Start an existing docker container
docker start <container-id>

Subcommands can be used via docker exec:

docker exec -it <container-id> server <subcommand>

Usage

Starting the server

Start the server using the start subcommand:

./timew-server start

The start subcommand supports the following (optional) flags:

  • --config-file: (reserved, not used yet) Specifies the path to the configuration file
  • --port: Specifies the port. Default: 8080
  • --keys-location: Specifies the folder holding the authorized keys. Default: authorized_keys
  • --no-auth: Deactivates client authentication. Only for testing purposes.
  • --sqlite-db: Path to the sqlite database. Default: db.sqlite

Adding users

New users can be registered using the add-user subcommand:

./timew-server add-user

If no additional flags are specified, this command will return the new user id.

The add-user subcommand supports the following flags:

  • --path: Specifies the path to a public key and associates it with the user.
  • --keys-loaction: Specifies the folder holding the authorized keys. Default: authorized_keys

Note: If you are running our provided Docker image, see the note under Adding keys to users.

Adding keys to users

New keys can be added using the add-key subcommand:

./timew-server add-key --path public-key.pem --id <user-id>

The add-key subcommand supports the following flags:

  • --path (required): Specifies the path to a public key and associates it with the user.
  • --id (required): Specifies the user id.
  • --keys-location: Specifies the folder holding the authorized keys. Default: authorized_keys

Note: If you are running the server inside a docker container, you have to copy the key into the container first:

# Copy the key into /public-key.pem
docker cp public-key.pem <container-id>:/public-key.pem

# Add the key
docker exec -it <container-id> server add-key --path /public-key.pem --id <user-id>

Development

The code has to be formatted using go fmt before commits. To enforce this, we provide a pre-commit-hook. It can be setup by copying it into to your .git/hooks/pre-commit:

cp git/hooks/pre-commit .git/hooks/pre-commit

Acknowledgements

This project was developed during the so-called "Bachelorpraktikum" at TU Darmstadt. It was supervised by the Department of Biology, Computer-aided Synthetic Biology. For more information visit kabisch-lab.de.

This work was supported by the BMBF-funded de.NBI Cloud within the German Network for Bioinformatics Infrastructure (de.NBI) (031A532B, 031A533A, 031A533B, 031A534A, 031A535A, 031A537A, 031A537B, 031A537C, 031A537D, 031A538A).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].