svsticky / chroma

Manage photo albums on S3 buckets. Successor to Pxl and Rstr
1 stars 1 forks source link

CI and builds #2

Closed Riscky closed 1 year ago

Riscky commented 1 year ago

This is written as an answer to https://github.com/svsticky/chroma/issues/1#issuecomment-1453646998

Are there any other changes hosting wise you'd like to see?

We can probably get this up and running quickly if we can build a binary for the backend. Building this binary on CI on the same Ubuntu version as the servers run should save us from linking woes, or we could produce a static binary of course. We also use the Nix package manager on our servers, so if you could build a Nix derivation that would work great too. We could also use the Docker container, but we haven't set up Docker on our servers (I'm not sure how much effort this would cost, but it's more then just running apt install). I think it is easiest to just build a binary.

the backend server could also serve the docs and frontend

As the frontend is a static website, we can just serve the build with nginx, no problem. We could even do continuous delivery for that, similar to how https://github.com/svsticky/static-sticky has been set up. We currently don't have a specific place where we host docs, but if we have a static website, it's easy enough to host it somewhere.


To make this a proper issue:

We should set up a CI pipeline, probably in Github actions (which we use everywhere). This CI should run the linters and builds. We can upload build artifacts (of tagged commits) as GitHub releases (or on S3, but I think it's more in the spirit of open source software to publish your builds publicly). For the frontend and the docs, this can be a tar.gz with the static website. For the backend, this should be either a Nix derivation (stored in Cachix), a binary (this is my preference) or a Docker image (probably uploaded to Dockerhub?).

@TobiasDeBruijn if you need help with setting up Github Actions, I'd be glad to help.

TobiasDeBruijn commented 1 year ago

Binary is the default yep. I usually build for musl libc (as I usually run my software on Alpine images). I'm not at all familiar with Nix, so I prefer not to set that up. While I'd love to learn it eventually, I currently don't have the time to do so.

Installing docker is adding the docker apt repo and apt install, it's not too much effort, but more than just a regular binary.

If Nginx is already running, then the frontend via that is definitely the easiest. Both the docs and the frontend compile to a static website.

I'll work on setting up a CI pipeline on GH Actions for the following then:

I think I'll be able to get this done over the weekend, or Monday.

Riscky commented 1 year ago

Installing docker is...

I meant that we have to integrate it with our (alerting and logging) infra, and getting the security sorted out correctly. We have that set up for simple systemd services nicely.

Build a static binary of the frondend

I think you meant backend in this sentence?

I think I'll be able to get this done over the weekend, or Monday.

No rush, the next IT Crowd session is in two weeks, and I doubt people will be working on it in between sessions.

TobiasDeBruijn commented 1 year ago

Check.

Indeed I ment static binary for the backend yep

Riscky commented 1 year ago

Thanks for creating a CI pipeline and getting builds and releases done! Really nice work!

I noticed that the releases don't contain the actual build artifacts, just the source code. Based on the screenshot of the CI run, I think we have the paths wrong: image

Should be an easy fix I think.

TobiasDeBruijn commented 1 year ago

Yeah that's the last remaining issue. Hope to get that out this weekend.

Riscky commented 1 year ago

Ah sorry, I didn't mean to rush you, I thought you weren't aware of the issue

TobiasDeBruijn commented 1 year ago

No problem at all, should probably have left something here anyways.

Shouldn't be too much of an issue