dwyl / github-backup

:octocat: :back: 🆙 Backup your GitHub Issues so you can still work when (they/you are) offline.
https://github-backup.herokuapp.com
GNU General Public License v2.0
31 stars 3 forks source link

Backup a Github/dwyl Repo to Gitea! #136

Open nelsonic opened 2 years ago

nelsonic commented 2 years ago

Our original reasoning for this project is still very much still a reality.

GitHub still has regular "incidents": https://www.githubstatus.com/history where it's offline for hours ... ⏳ image

Using GitHub as our Single source of truth means it's "mission critical" and we need access to it pretty much always.

At present this project mirrors issue data to AWS S3 and @RobStallion asked a very valid question about it: #126 That's OK as a "cold" backup but it's not very useful for business continuity.

Starting Point

Todo

nelsonic commented 2 years ago

https://github.com/gogs/gogs GitHub repo is very popular and has a healthy number of contributors: image

Who is using Gogs? https://gogs.io a lot of CN companies: image

Which makes sense as GitHub is partially blocked in China: https://en.wikipedia.org/wiki/Censorship_of_GitHub#China and it probably makes sense for CN companies to be at least a little paranoid of putting all their code/secrets on a US-owned platform. 💭

nelsonic commented 2 years ago

Also looked at Gitea: https://gitea.io/en-us/ > https://github.com/go-gitea/ > https://try.gitea.io/api/swagger#/repository

image

image

It's a Fork of Gogs with a focus on front-end UI/UX. It looks good, basically a clone of what GitHub used to look like before Microsoft.

nelsonic commented 2 years ago

https://news.ycombinator.com/item?id=31033758

nelsonic commented 2 years ago

Gogs server deployed to: https://gogs-server.fly.dev/ 🚀 gogs-server

Documented in: https://github.com/dwyl/gogs-server

nelsonic commented 2 years ago

The work on https://github.com/dwyl/gogs is coming along nicely. We've shipped most of the core functions we need: https://hexdocs.pm/gogs/api-reference.html

But we are tidying it up a bit first before using it in an App: https://github.com/dwyl/gogs/issues/24 + https://github.com/dwyl/gogs/pull/25 + https://github.com/dwyl/gogs/issues/26

nelsonic commented 2 years ago

really wish I had seen this page earlier: https://docs.gitea.io/en-us/comparison/ ... 🙄 ⏳ image

nelsonic commented 2 years ago

We've invested a considerable amount of time in: ⌛

But re-reading the Gitea API I'm being forced to re-consider ... 🙄 I'm suffering from a serious case of "Sunk Cost Bias" ...

Basically 3 things are forcing me consider switching from Gogs to Gitea:

  1. More extensive and documented API: https://try.gitea.io/api/swagger#/

  2. Ability to create Orgs via the API: image

    • Orgs have a visibility option which allows them to be unlisted i.e. not visible even if someone has access to the Gitea instance.
  3. Git Diff appears to be available via the API: https://github.com/dwyl/gogs/issues/27

nelsonic commented 2 years ago

Ok, while it totally sucks to write-off the time we've invested in Gogs and switch to Gitea, ⏳ 🔥 🤦‍♂️ I'm thinking that I will do a Spike to try and replicate the work we've done (deployment, module & demo). 🧑‍💻 It's definitely not a complete waste of effort because all the local_... functions can be recycled ♻️ and my reading is that there is a migration path from Gogs to Gitea: https://docs.gitea.io/en-us/upgrade-from-gogs ... So all the underlying "DevOps" work should be transferable too. 🤞

Going to start with getting Gitea running on Fly.io: https://github.com/dwyl/gitea-server Then I will try and simulate the API requests noted above:

  1. Create an org that has visibility: hidden
  2. Create a PR and attempt to get the diff via the REST API

If those two things work and it doesn't take me too much time I will report back.

Wish me luck! 🍀

nelsonic commented 2 years ago

Not for github-backup, but this is a useful feature for orgs that need privacy: https://gitea-server.fly.dev/private-org visible to members: image

404 for anyone else: image

nelsonic commented 2 years ago

We've made substantial progress with this:

Still #Todo: Backups! https://github.com/dwyl/gitea-server/issues/3 🙏