···1818## Design tradeoffs
19192020- All repos are stored in object storage, making the local filesystem irrelevant at the cost of making storage operations a bit more latent compared to the local filesystem.
2121+- Repos are stored in git bare repo format. This theoretically could hamper performance, but also means that in a pinch you can just download the repo from the object storage bucket should you need to get a copy of it RIGHT NOW.
2122- Post-receive hooks are stored in the repository, meaning that hooks are checked out from the repository on push.
2223- Right now all s3fs reads are completely buffered in memory before billy can use them, theoretically this means that the size limit for files is 2Gi.
2324- This is like very new and not tested in the slightest.
···2930- Any kind of blogpost.
3031- Deployment to Kubernetes.
3132- HTTPS support with TLS termination.
3333+3434+## Setup instructions
3535+3636+objgit depends on the following things:
3737+3838+- A system capable of running the Go runtime.
3939+- TLS certificate authorities on the disk.
4040+- A functional IPv4/IPv6 network stack.
4141+- A Tigris account, bucket, and access keypair (part of the core flow of this tool relies on Tigris' [RenameObject](https://www.tigrisdata.com/docs/objects/object-rename/) call which is not part of the standard S3 API).
4242+4343+### Prepare your `.env` file
4444+4545+objgit takes its configuration via flags, environment variables, and `.env` files in this order of precedence:
4646+4747+- envvars
4848+- `.env` file
4949+- flags
5050+5151+Here is a sample `.env` file:
5252+5353+```sh
5454+# Use the AWS credential chain to load Tigris credentials
5555+AWS_PROFILE=tigris
5656+5757+# If true, allow the execution of post-receive hooks
5858+ALLOW_HOOKS=true
5959+# Hook timeout in go time.Duration format
6060+HOOK_TIMEOUT=60s
6161+6262+# If true, allow anonymous pushes
6363+ALLOW_PUSH=true
6464+6565+# The Tigris bucket that all repos are stored in,
6666+# as well as the SSH host key
6767+BUCKET=xe-git-repos
6868+6969+# Per-protocol bindhosts
7070+GIT_BIND=:9418
7171+HTTP_BIND=:8080
7272+SSH_BIND=:2222
7373+7474+# Prometheus metrics
7575+METRICS_BIND=:9090
7676+7777+# Logging detail level
7878+SLOG_LEVEL=INFO
7979+```
8080+8181+### Run the program
8282+8383+```text
8484+go run ./cmd/objgitd
8585+```
8686+8787+### Push a repo
8888+8989+```text
9090+$ git push ssh://localhost:2222/xeiaso.net/objgit.git
9191+Enumerating objects: 9, done.
9292+Counting objects: 100% (9/9), done.
9393+Delta compression using up to 32 threads
9494+Compressing objects: 100% (9/9), done.
9595+Writing objects: 100% (9/9), 2.80 KiB | 2.80 MiB/s, done.
9696+Total 9 (delta 5), reused 0 (delta 0), pack-reused 0 (from 0)
9797+remote: push to xeiaso.net/objgit.git refs/heads/main: a300ea49df20ad5dc82fc4dabb85fbd3261faed7 -> 3d889908eefd60d9a11605f077b7b4560aef8e74
9898+remote: top-level contents:
9999+remote: CLAUDE.md
100100+remote: LICENSE
101101+remote: README.md
102102+remote: cmd
103103+remote: docs
104104+remote: go.mod
105105+remote: go.sum
106106+remote: internal
107107+remote: go module: tangled.org/xeiaso.net/objgit
108108+remote: manifest (/tmp/manifest.txt):
109109+remote: ref refs/heads/main
110110+remote: sha 3d889908eefd60d9a11605f077b7b4560aef8e74
111111+remote: hook done
112112+To ssh://localhost:2222/xeiaso.net/objgit.git
113113+ a300ea4..3d88990 main -> main
114114+```
115115+116116+### Deployment to production
117117+118118+TODO(Xe): re-evaluate performance-based life choices and write.