# elixir_nugiteaAn Elixir port of `rust_nugitea`, at feature parity with it: the same splitinto an app tier and a storage tier (GitLab and Gitaly), but the tiers talkover Erlang distribution instead of an internal protocol written by hand.```git client --HTTP/SSH--> [app node] --Erlang distribution--> [storage node]Router (smart HTTP, /graphql) StorageSSH, mirror scheduler (owns repo root, runs git)accounts.json, mirrors.json[web: Nuxt frontend, rust_nugitea/web] --/graphql--> [app node]````Nugitea.Storage.Client` is the entire internal API: `:erpc.call/4` for plaincalls, and a linked process plus messages for streaming a git exchange.## What it does- Smart-HTTP and SSH clone, fetch and push, including protocol v2 andgzipped requests, at any owner depth (`org/sub-org/name`).- Users, orgs (nested), teams, enterprises, grants and blocks(`Nugitea.Accounts.Directory`), stored as accounts.json in the same JSONshape rust_nugitea writes. Not enforced yet: `Nugitea.Auth` allows all.- Pull and push mirrors, synced by a scheduler (`Nugitea.Mirror`).- The GitHub-shaped GraphQL API the Nuxt frontend uses, loaded from thefrontend's own schema.graphql (`priv/schema.graphql`), with GraphiQL at`/graphql`.- Git hooks installed on every repo (stubs for now).## Run```shmix deps.getmix nugitea user create alicemix nugitea repo create alice/demomix nugitea serve # HTTP :3080, SSH :2222```Split across two nodes (any two hosts sharing an Erlang cookie):```shNUGITEA_ROLE=storage elixir --sname storage -S mix nugitea serveNUGITEA_ROLE=app NUGITEA_STORAGE_NODE=storage@$(hostname -s) elixir --sname app -S mix nugitea servemix nugitea --storage-node storage@$(hostname -s) repo create alice/demo```Commands: `serve`, `user create|list`, `org create|list`, `repo create|list`,`mirror add-pull|add-push`, `graphql-schema`. See `Nugitea.CLI`.| Variable | Default | ||---|---|---|| `NUGITEA_ROLE` | `all` | `all`, `app` or `storage` || `NUGITEA_REPO_ROOT` | `./data/repos` | storage tier: bare repos || `NUGITEA_STATE_DIR` | `./data` | app tier: accounts.json, mirrors.json || `NUGITEA_HTTP_PORT` / `NUGITEA_SSH_PORT` | `3080` / `2222` | || `NUGITEA_SSH_HOST_KEY_DIR` | `./data/ssh` | generated on first start || `NUGITEA_STORAGE_NODE` | | required with `NUGITEA_ROLE=app` |Connected Erlang nodes trust each other completely, the same trust Gitalygives GitLab's app tier: keep the distribution port private.## Notes- git runs under `erlexec`, which can close git's stdin while still readingits stdout; plain Erlang ports can't, and both smart HTTP (stateless-rpc)and SSH need that.- Unlike rust_nugitea, the Git-Protocol header also reaches the refadvertisement, so HTTP clients get protocol v2.- Input to the storage node isn't flow-controlled: a large push to a slowstorage node queues in memory.