Testing experimental versions of Gitea

Bonjour,

@Dodecahedron mentioned a method to test a Gitea instance in the chat room:

This is what I currently do: TAGS="bindata" make && sudo systemctl stop gitea && sudo cp gitea /usr/bin/gitea && sudo systemctl start gitea. This replaces the Gitea binary with the new one and deploys it to https://git.exozy.me. […] For more complicated federation testing I might need to run two Gitea servers in the future, maybe serving the other one on https://git2.exozy.me or something like that.

In the context of the Friendly Forge Format, a shell script can spawn two Gitea instances, one at http://0.0.0.0:8781/ and another at http://0.0.0.0:8782/ with:

setup-gitea.sh

and when the test are done kill them with:

setup-gitea.sh teardown

to start fresh. While it is based on two convenient oneliners to run Gitea and register an admin user, it lacks the ability to obtain a certificate so https can be used.

Since tests will eventually need to run in a CI, using LE is impractical, but setting up an ownca certificate authority, although not a oneliner, is not very complicated once you have an example to follow. This example is for a certificate authority that can be used for production purposes, there may be ways to do the same in a simpler way using the same tools but I never tried.

My 2cts

2 Likes

Is there a reason why a certificate authority like LE is required for testing? Is it just to issue trusted certs or does it play a role in federation too?

Gitea itself won’t need https for testing, to verify that Gitea1 can federate with Gitea2. However IIRC, running tests against a live Mastodon instance won’t work unless it is able to talk to an https federated peer, even if self-hosted.

1 Like

If all nodes that are involved in testing are run locally, then mkcert might be worth checking out. It is capable of both generating certificates, installing and uninstalling from local certificate store. :slight_smile:

1 Like

Did you have good experience with it? I’m always surprised by the number of projects you know.

1 Like

mkcert is ridiculously simple:

mkcert example.org # generates certificate
mkcert -install # installs the certificate
mkcert -uninstall # uninstalls the certificate

It is built for low-friction development, and it does its job very well :smiley:

1 Like

That will be a usefull tip for Enough as well, great!

1 Like