Gitea
As I wanted to be able to deploy something that works “out of the box” I looked at how to provision one of these alternatives on my own AWS account.
Gitness is an open source development platform packed with the power of code hosting and automated DevOps pipelines. It’s biggest mantainer is Harness. It includes “way more” than just Git - eg Gitspaces, Pipelines, etc.
If you want to deploy Gitness, the docs point you at running it locally using Docker, or by deploying it on EC2 or k8s.
My aim was to “only” make the “Git” component available and because of that I’ve chosen Amazon ECS with EFS as storage to provision Gitness.
I’ve set up a project on Github where all of the code examples are available for you to look at:
https://github.com/Lock128/setup-gitness
In the rest of the article, I’ll try to walk you through the most important parts of the project.
Please note that this code is not production-ready, it is more a PoC to showcase the direction that you could take.
We’re using AWS CDK and Typescript for Infrastructure As Code (IaC).
We have a “bin” directory where the main application is and a “lib” directory where the “Cloudformation Stack” is.
The “real code” is in setup-gitness-stack.ts where we create:
You only need to set up “Secrets” in your repository with the names AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
After the initial deployment, you will need to modify the GITNESS_URL_BASE in https://github.com/Lock128/setup-gitness/blob/main/lib/setup-gitness-stack.ts#L104 to point it at the Load Balancer URL that has been set up for you.
If you “fork” this repository and then push something to the “main” branch, a Github Action workflow will deploy this to your AWS account.
The deployed CloudFormation stack will contain everythign that you need:
The expected costs for this is roughly 50 USD / month.
As mentioned above the code presented here is not production ready and it does not allow to use all of the functionalities of Gitness.
Things that you will need to consider / think of when using this code as a starting point:
As you can see, this is just a starting point of your journey to host your own Git Server on AWS :-)
Please let me know if you have better ideas, suggestions or alternatives!