this post was submitted on 23 Nov 2024
40 points (97.6% liked)

Selfhosted

40359 readers
278 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

I’ve started building a small decentralized, non commercial app with a Rust backend + Node.js frontend running on k8s. I would have my own dedicated server for this. Just mentioning the setup because it might grow and for git there seem to be only GitHub and GitLab around and I prefer GitLab.

I care a lot about security and was wondering if it makes sense to self-host GitLab. I‘m not afraid of doing it, but after setup it shouldn’t take more than 1-2 hours per week for me to maintain it in the long run and I’m wondering if that’s realistic.

Would love to hear about the experience of people who did what I’m planning to do.

EDIT: Thanks for all the answers, trying my best to reply. I want CI/CD, container registry and secrets management that's what I was hoping to get out of GitLab.

all 38 comments
sorted by: hot top controversial new old
[–] jimmy90@lemmy.world 1 points 31 minutes ago

do the front end in Leptos and host it on ForgeJo

[–] liliumstar@lemmy.dbzer0.com 11 points 1 day ago

Gitlab uses a ton of resources and is a pain to setup. Once you get it going, it's fine.

Going to echo what others have said: Use Gitea or Forgejo instead if you can. Both have runners you can setup like gitlab, but they instead mimic github actions instead of gitlab ci/cd.

I run a semi-private gitea instance, and have not had any problems past the initial setup in 2+ years.

[–] l_b_i@pawb.social 52 points 1 day ago (6 children)

For self hosting there is also https://forgejo.org/ which is a fork of https://about.gitea.com/ , the latter of which started to shift to a corporate model.

[–] shaserlark@sh.itjust.works 2 points 17 hours ago

Thanks! This looks actually really interesting. Did you try doing CI/CD with it? In future I would probably collaborate with others who'd be also using my self-hosted Git. What would be critical for me is that I can set it up in a way that once I open a PR that branch automatically gets deployed to a dev Kubernetes environment and when I merge with main that it automatically deploys to staging and only when I release a tag the branch would end up in prod. Also I'd like to do secrets management over the platform. I like that Forgejo would be non-commercial and I would prefer it over GitLab if it can do these things well.

[–] alwayssitting@infosec.pub 22 points 1 day ago

Previous Gitea user and now Forgejo, and yeah it's a great git server. Simple, lightweight but still very capable.

Another upvote for forgeo. So easy to get set up and running. Can run it in docker itself. I tried to host gitlab and got so frustrated with the pages and pages of ruby configs. Forgejo is so much cleaner.

[–] Eezyville@sh.itjust.works 2 points 1 day ago

I'd also like to add that Forgejo is working on federation along with GitLab. I think Forgejo will do it first though.

[–] BaalInvoker@lemmy.eco.br 5 points 1 day ago (1 children)
[–] neshura@bookwormstory.social 16 points 1 day ago (2 children)

technically the same as forgejo, codeberg is the main forgejo contributor/the org owning it

[–] BaalInvoker@lemmy.eco.br 4 points 1 day ago

Oh! Is it?

Well, living and learning haha

[–] BlastboomStrice@mander.xyz 1 points 1 day ago (2 children)

Quick question: forgejo is the git program that you can install self host a git server, while codeberg is probably the biggest forgejo-kind git server that is open to the public, right?

I dont have a home server to host forgejo (yet?), so I'm thinking of making an account on codeberg, is that correct reasoning?

[–] scsi@scribe.disroot.org 4 points 1 day ago (1 children)

If you own a domain, hosting Forgejo on a $5 Debian cloud server works perfectly for your personal use case. My site admin panel shows it's using 75MB of actual RAM (not allocated/virtual), it's truly very lightweight. Disk use is very low, just however big your git repos actually are is the key.

The internal SQlite database option is just fine, don't need to bother with PostgreSQL if you're only doing it for yourself (the DB only holds referential info, the actual git data is stored on disk in normal git directories). There's a built in backup command so you can build a simple shell script to run the dump command periodically and back up the entire thing to a tarball.

re: Codeberg, the only "downside" (not really) is they are for FOSS licensed projects only and frown upon using their service for your personal private non FOSS needs (they're not draconian about it, but it's part of the ethos the service is for FOSS licensed projects to use).

[–] BlastboomStrice@mander.xyz 2 points 1 day ago (1 children)

Oh thank you for the detailed answer😄

I think codeberg is for me in my case. (Btw, I barely know git, I'm gonna read a guide today.) I really like foss, so I will probably create foss stuff.

I really want to make a nas in the future, so I might host my own forgejo instance locally and possibly keep a backup on a cloud storage provider (bought 2tb lifetime on filen). I have somewhat big plans for my nas, but I don't know what I'll eventually do😆

So far I barely use git, so I probably dont need to rent a cloud server. Thanks again though:)

[–] scsi@scribe.disroot.org 2 points 1 day ago* (last edited 1 day ago) (1 children)

Suggestion: start learning git by using your $HOME config files as the first thing you learn how to manage; mentally easy to understand, low friction and just basic git commands needed. One of the most popular repo names we all use is dotfiles so you have plenty of examples to learn from: https://codeberg.org/explore/repos?q=dotfiles

[–] BlastboomStrice@mander.xyz 1 points 1 day ago* (last edited 1 day ago)

Yeah, (among others) I really want to learn git to sync dotfiles and the nixos configs

(Hopefully I'll probably have tranitioned to nixos in a few months. If I get good enough and somehow build a nas, I might use nixos instead of debian in the server too.)

[–] neshura@bookwormstory.social 2 points 1 day ago (1 children)

Pretty much yes, codeberg integrates some additional services and branding on top (such as codeberg-pages for static page hosting or forgejo-runners for CI) but you can integrate those yourself as well, it's just extra work.

If you're looking for an open alternative to github/gitlab codeberg is imo definitely the way to go

[–] BlastboomStrice@mander.xyz 1 points 1 day ago

Yo thank youu:)

[–] Lem453@lemmy.ca 3 points 1 day ago

I did an inplace upgrade of gitea to forgejo. No issues.

I've been self hosting this for 2 or 3 years now.

There has been zero maintenance other than the occasional update button

I use it for my docker compose files that portainer pulls from with the click of the button to update my containers when needed.

I edit the files in VS code with the git plugin and it works without issue

[–] kensand@sopuli.xyz 12 points 1 day ago (2 children)

I tried hosting Gitlab for a while, but configuration and upgrades were difficult, and your really have to stay on top of updates due to vulnerabilities. It also used a lot of resources and wasn't super responsive.

I moved to Forgejo (a hard fork of Gitea), and haven't looked back; I cant recommend it enough. It's fast, doesn't take a lot of resources, actively developed, and has all the features I need.

Codeberg is a public instance of Forgejo if you want to try it out first.

[–] shaserlark@sh.itjust.works 1 points 17 hours ago

Thanks! May I ask what kind of setup you were running and if there's any feature you might be missing that existed in GitLab but doesn't in Forgejo?

It's not fully selfhosted but I did setup my own runner that integrates with their site.

[–] Luckyfriend222@lemmy.world 6 points 1 day ago (1 children)

I have been maintaining several self-hosted GitLab instances over the past 5 years, and it rarely takes me longer than 20minutes per update.

Their upgrade paths are clearly marked and well thought out. Their packaging methods are of great quality.

You will not regret going with GitLab.

[–] shaserlark@sh.itjust.works 1 points 16 hours ago* (last edited 16 hours ago) (1 children)

Thank you! I'm running a Servarr over Docker Compose, and have managed some Kubernetes clusters in the past (although poorly tbh). Any idea how complicated that is in comparison? Also, do you use their Helm charts?

[–] Luckyfriend222@lemmy.world 1 points 7 hours ago

I do straight VM installations unfortunately. I am too stupid for K8s. But seeing how the rest of their stuff is packaged, I suspect you will be fine!

[–] just_another_person@lemmy.world 6 points 1 day ago* (last edited 1 day ago)

I remember Gitlab requiring quite a large amount of resources, so if you're talking about a solo project, I'd skip it and go with something a lot leaner like Gitea, personally.

I've never had any security issues with GitHub in the past though, and extended features are free for open source projects, so it's kind of hard to ignore.

[–] spechter@lemmy.ml 3 points 1 day ago (1 children)

I am selfhosting my Gitlab and it's one of the less troubling services I run.

I followed their documentation for setup and update gitlab biyearly, as far as I remembered I never had to revert to a backup, even after I skipped updates for a little over a year.

[–] shaserlark@sh.itjust.works 1 points 16 hours ago

Thanks! What resources are you running it on? I'm looking into a VPS that could host it and ChatGPT recommends 4-8 vCPUs and 16 GB Ram, which sounds reasonable. But let's say I'm running it on k8s does that leave any room for e.g. running other services on the same cluster?

[–] astrsk@fedia.io 2 points 1 day ago (1 children)

What are the features you need from your host? If it’s just remote syncing, why not just make a small Debian system and install git on it? You can manage security on the box itself. Do you need the overhead of gitlab at all?

I say this because I did try out hosting my own GitLab, GitTea, Cogs, etc and I just found I never needed any of the features. The whole point was to have a single remote that can be backed up and redeployed easily in disaster situations but otherwise all my local work just needed simple tracking. I wrote a couple scripts so my local machine can create new repos remotely and I also setup ssh key on the remote machine.

I don’t have a complicated setup, maybe you do, not sure. But I didn’t need the integrated features and overhead for solo self hosting.

For example, one of my local machine scripts just executes a couple commands on the remote to create a new folder, cd into it, and then run git init —bare then I can just clone the new project folder on the local machine and get started.

[–] shaserlark@sh.itjust.works 2 points 16 hours ago

I would actually want to use it to integrate with k8s. I would deploy the app on Kubernetes and do load balancing + pointing at a Cloudflare domain so I would need the whole thing to be solid. I think I do need a lot of the features, but I don't think I necessarily need to have GitLab if something FOSS could offer the same.

[–] scottmeme@sh.itjust.works 1 points 1 day ago (2 children)

I run GitLab with docker compose and watchtower, all the updates are automated and have never caused any issues for me.

That being said my setup uses about 7-8gb of ram.

[–] shaserlark@sh.itjust.works 2 points 16 hours ago (1 children)

Thanks! What about CPU usage, how many CPUs did you assign to the environment you run the container in?

[–] scottmeme@sh.itjust.works 1 points 11 hours ago* (last edited 11 hours ago) (1 children)

The VM is a 6 thread 16gb

OS is currently Ubuntu 22.04.5 LTS (cloud image which is lightweight) just running a very simple docker engine install using the script (plus a few other options since I script the install)

The load averages as of this current moment are 0.12, 0.15, 0.10 so not even a full thread is being used.

I let the container run unmetered on the CPU and memory.

I can provide both the compose and my install script (which is on the GitLab instance) if you are curious.

[–] shaserlark@sh.itjust.works 1 points 10 hours ago

Thanks! Super helpful and I’d love to have the compose and install script. I also looked into the Helm charts but still wondering if I should go down that route or not eventually.

[–] interurbain1er@sh.itjust.works 1 points 1 day ago (2 children)

First question is why do you want a forge ? Knowing the feature you need out of it is what should drive your decision.

Personally I would question the benefit of allocating ~5% of your work time to anything that isn't core building your product but that's up to you.

[–] shaserlark@sh.itjust.works 1 points 16 hours ago

I would deploy the whole app over k8s Helm charts and I would want to use the CI/CD tools and also do Traefik/Ingress for load balancing and having cloudflare point at it. In the future I might be collaborating with other people so I would want the architecture to be solid.

[–] WalnutLum@lemmy.ml 1 points 1 day ago (1 children)

Yea a surprisingly small number of people don't know a git remote can literally be any folder outside of your tree, over almost any kind of connection.

I thought about doing a forge but realized that if I was the only one working on this stuff then I could do the same thing by setting my remote to a folder on my NAS.

Yup, for a solo project that you don't want to share I would even argue that a forge is close to pointless.

Any ssh remote will work as a backup, you can run the ci/cd task on your own computer just fine (very likely faster even), you obviously don't need to send PR and request code review to yourself and if a TODO.md isn't enough to keep track of tasks there's a billions lightweight task/note tracker.

I use github because I'm a lazy and it works fine as a backup but I don't need 99% of the features for my pet projects.