GothenburgBitFactory / taskchampion-sync-server

The sync server for Taskchampion
MIT License
44 stars 8 forks source link

Provide releases, packages and documentation for taskchampion/sync-server #2

Closed jcgruenhage closed 5 months ago

jcgruenhage commented 5 months ago

As a user who used to use taskd, I want to have a self-hostable sync backend again. It seems to me like taskchampion/sync-server is that backend.

To me, it is not clear how I am supposed to go about this. I can find docs for for running that piece of software under https://taskchampion.github.io/taskchampion/running-sync-server.html, which comes from an archived repo (https://github.com/taskchampion/taskchampion).

Ideally, there'd be docs, release tags, container images and so on. I can manage to build some of these myself if needed, but at least I need release tags to know where to grab the source from.

djmitche commented 5 months ago

Thanks for the issue! I suspect you're not alone in wanting to deploy a self-hosted sync backend. We don't have a great answer for that right now.

That said, taskchampion-sync-server is an OK answer, and is actually included both in the repo and in the tarball.

tar -zxf task-3.0.0.tar.gz
cd task-3.0.0

..edit Cargo.toml to omit integration-tests (#3294)..

cargo build -p taskchampion-sync-server
./target/debug/taskchampion-sync-server --help

The --help output is really all there is: give it a --data-dir and it serves HTTP traffic. The warning in the docs you link is accurate: this isn't particularly deployable at the moment. For example, if you'd like to use TLS, you'll need a reverse proxy. And, it automatically creates client IDs on request, with no access control.

I suspect that this will soon become its own project (repo, releases, etc. - GothenburgBitFactory/taskwarrior#3209) and from there go in one of two directions:

For what it's worth, taskchampion-sync-server's current setup is about where taskd aka taskserver has been for years: poorly documented, difficult to deploy, and not especially production-ready. So while it may seem poor form to ship something in this sorry state, I would argue it's not worse than the previous solution.

If anyone is interested in picking this up, I'd be happy to help with any necessary implementation changes (such as taking a config file instead of command-line options). It just needs someone who has a vision for how this should work.

Another -- very different -- option would be to find some existing server application that could be easily deployed and which provides enough consistency to support task sync. It's not much: GCP and Azure's blob-storage are both enough, although AWS S3 is not. I suspect Redis would be enough, but .. well, it's not OSS anymore. Maybe there are other options? If we went this course, we could probably drop the sync-server entirely.

jcgruenhage commented 5 months ago

So while it may seem poor form to ship something in this sorry state, I would argue it's not worse than the previous solution.

Just by being an http based service it's already a lot better than taskd, because it's easier to deploy it somewhere where other web services are already deployed.

someone (maybe you?) will pick it up and make it more admin-able and deploy-able in whatever way seems most appropriate to them. [...] If anyone is interested in picking this up, I'd be happy to help with any necessary implementation changes (such as taking a config file instead of command-line options). It just needs someone who has a vision for how this should work.

I'm not sure when I'll have the time, but I'm definitely interested.

My initial gut feeling from what you've written is that what this needs is:

I'd personally if I'd be responsible for this also rip out actix-web and replace it with axum, just because that's the framework I'm using in other places.

jcgruenhage commented 5 months ago

..edit Cargo.toml to omit integration-tests (https://github.com/GothenburgBitFactory/taskwarrior/issues/3294)..

Already patching that for where I'm packaging taskwarrior 3.0.0 :P

https://github.com/chimera-linux/cports/pull/1671/files#diff-c4ff55248dc8c3ff3a68f6b141cd66af883bb6aa49f8245023604705122cdce0

djmitche commented 5 months ago

I think your gut feeling is accurate,and using axum sounds fine too. As a web app this is pretty dead-simple so that shouldn't be hard.

For the moment, I'm going to focus on feedback for 3.0.0 and get 3.0.1 out the door, but once that's done I'll work on GothenburgBitFactory/taskwarrior#3209.

felixschurk commented 5 months ago

Would it be also possible for GotheburgBitFactory to distribute the taskchampion/sync-server as a docker image? I think on this way, one would ease the usage of an own sync-server for the user a lot.

Maybe based on Alpine Linux as e.g. @ogarcia does for the old taskserver as in https://github.com/ogarcia/docker-taskd?

ogarcia commented 5 months ago

Hello guys!!

If you want I can help with anything to do with the container. For example, something I've done right now that might be useful for you.

FROM docker.io/rust:alpine AS builder
RUN apk -U add libc-dev && \
  cargo install \
  --git https://github.com/GothenburgBitFactory/taskwarrior.git \
  taskchampion-sync-server

FROM docker.io/alpine:latest
COPY --from=builder /usr/local/cargo/bin/taskchampion-sync-server /bin
RUN adduser -S -D -H -h /var/lib/taskchampion-sync-server -s /sbin/nologin -G users \
  -g taskchampion taskchampion && \
  install -d -m755 -o100 -g100 "/var/lib/taskchampion-sync-server"
EXPOSE 8080
VOLUME "/var/lib/taskchampion-sync-server"
USER taskchampion
ENTRYPOINT [ "taskchampion-sync-server" ]

This is simply built with:

docker build -t taskchampion .

And run with:

docker run -t -i -p 8080:8080 --rm taskchampion:latest

For run it more permanent:

mkdir /where/you/want/store/data
chown 100:100 /where/you/want/store/data
docker run -d \
  -n taskchampion \
  -p 8080:8080 \
  -v /where/you/want/store/data:/var/lib/taskchampion-sync-server \
  taskchampion:latest

I'm here for whatever you need, let me know when you want and I'll give you a hand without problems.

djmitche commented 5 months ago

This is a great idea. I still think we should do GothenburgBitFactory/taskwarrior#3209 first, at least moving the sync server out of this repo. It doesn't actually share any code with Taskwarrior or the rest of Taskchampion!

I won't have time to do so this weekend, but I'll put it in my backlog.

djmitche commented 5 months ago

Ok, https://github.com/GothenburgBitFactory/taskchampion-sync-server is ready to go!

@jcgruenhage please have a look and file some issues or PRs for your ideas?

@ogarcia do you want to work on the packaging / release process?

ogarcia commented 5 months ago

@djmitche Yes, today during the day I will do a PR with the Dockerfile and a GitHub action to build the image on the GitHub remote. :wink:

jcgruenhage commented 5 months ago

@djmitche I've started some work on code for this on Saturday already, and will continue onwards in that new repo. You can expect a PR for that some time in the near-ish future ^^

djmitche commented 5 months ago

Thank you both!

jcgruenhage commented 5 months ago

I think with the code split out to a separate repo, a Dockerfile already PR'd and other bits being worked on over there, we can probably close this issue here, as it's not really the right place anymore, right?

djmitche commented 5 months ago

I moved the issue to the new repo! But, yes, I think we can close tihs.