App template
Gitea
Git hosting, with repositories on a volume and PostgreSQL.
- Memory when idle
- about 150 MiB
- CI measures it once the app is ready and before any traffic. Leave room for more.
- Tested on
- x86 servers
Introduction
Gitea is a Git hosting service with repositories, issues and pull requests. This template runs Gitea behind your domain, with repositories on a volume and a PostgreSQL database.
Public registration is off, and SSH is off. People use Gitea over HTTPS.
Values you provide
You don’t fill in anything when you deploy.
Made for you
These values are generated at deploy and kept in a Kubernetes Secret, shown as Secret/key.
- gitea-secrets/admin-password
- gitea-secrets/secret-key
- gitea-secrets/internal-token
- gitea-secrets/jwt-secret
- gitea-secrets/lfs-jwt-secret
Getting started
-
In Zeabur OSS, open the
giteaservice. When Overview shows its replica as ready, the service is up. Its domain is on the Networking tab under Public domains, for examplegit.example.com. There is no install wizard. -
The first start creates the administrator
gitea_admin. Get its password. Open Variables, clickgitea-secretsunder From config files and secrets, and click the eye icon next toadmin-password. Without Zeabur OSS, read Secretgitea-secrets, keyadmin-password, with kubectl:kubectl -n <namespace> get secret gitea-secrets -o jsonpath='{.data.admin-password}' | base64 -d -
Sign in as
gitea_adminwith that password. Change the password in Gitea. Gitea reads the Secret only at the first start, so a later change of the Secret does not apply.
The other keys in gitea-secrets (secret-key, internal-token, jwt-secret and lfs-jwt-secret) are for Gitea’s own use. Keep secret-key for the life of the database, because Gitea uses it to encrypt stored credentials such as two-factor secrets.
Configuration
Create a user
Registration is off, so the administrator creates the other users. Open Site Administration, then User Accounts. See the FAQ of Gitea.
Push over HTTPS with an access token
Create an access token in Settings > Applications, or at https://git.example.com/user/settings/applications. Give it the permissions you need, and copy it when Gitea shows it, because Gitea shows it only once. Use the token as the password when Git asks:
git clone https://git.example.com/<user>/<repository>.git
See API Usage.
Back up the data
Gitea keeps accounts, issues and settings in the gitea-db database. In the project, open gitea-db. Under Backups, set up S3 backups. To get a file instead, click More → Export. Repositories and uploaded files are on the volume gitea-data, mounted at /var/lib/gitea. Copy it with the Files tab of the gitea service. For a large folder, use kubectl. kubectl -n <namespace> get pods lists the replica names:
kubectl -n <namespace> cp <replica>:/var/lib/gitea ./gitea-data
Gitea also has a gitea dump command that packs the repositories, the database and the data into one ZIP file. Gitea says to stop the instance during the backup, so that the files and the database match. See Create, back up, and restore databases and Download a database dump in the Zeabur OSS docs and Backup and Restore in the Gitea docs.
Troubleshooting
Cloning over SSH fails
SSH is off in this template. Use the HTTPS clone address of the repository. See Config Cheat Sheet.
The page shows 502 or does not load
Open the gitea service in Zeabur OSS. Check that Overview shows its replica as ready, then read the Logs tab. If the replica is not ready, open Deployments and switch to Events. If Events show OOMKilled, the service ran out of memory. Raise Maximum memory under Settings → Compute. If the domain or the certificate stays pending, see Troubleshooting on the domains page.
Without Zeabur OSS, read the logs with kubectl -n <namespace> logs deployment/gitea and the events with kubectl -n <namespace> get events --sort-by=.lastTimestamp.
See Adjust replicas, resources, and health checks and View logs, events, and usage, and open a terminal in the Zeabur OSS docs.
Resources
Each service is guaranteed the first amount and can use up to the second.
gitea
Ports
3000
CPU
0.1 cores to 2 cores
Memory
256 MiB to 1 GiB
gitea-db
Ports
5432
CPU
0.1 cores to 1 core
Memory
256 MiB to 1 GiB
Technical details
This release
- Version
- 28.2.0-rootless
- Licence
- MIT AND PostgreSQL AND Apache-2.0
- Homepage
- about.gitea.com
- Source file
- templates/gitea/template.yaml @ v0.6.3
Tested in CI
CI installs these exact files on a new cluster, waits until they are ready, then records the idle memory.
| Distribution | Platform | Kubernetes | Passed | Idle memory |
|---|---|---|---|---|
| kind | linux/amd64 | v1.37.0 | 153 MiB |
Security
The rootless image runs as UID 1000 with a read-only root filesystem, no service-account token and all capabilities dropped. Outbound traffic is not limited. Sign-up is closed and the install page is locked.
Known risks
Risk
If the install page is not locked, the first visitor can configure the server.
How it is handled
INSTALL_LOCK is true and the settings come from environment variables. Before Gitea starts, an init container creates the gitea_admin account with the generated password.
Risk
Anyone could register an account.
How it is handled
DISABLE_REGISTRATION is true. The administrator creates users in Site Administration.
Risk
Git over SSH does not work.
How it is handled
The Ingress carries HTTP only, so the SSH server is off. Clone and push over HTTPS with a password or an access token.
Risk
Webhooks, mirrors and repository migrations make the server send requests to addresses that users choose.
How it is handled
Gitea blocks private webhook targets by default. The template does not limit outbound traffic. To limit it, add an egress NetworkPolicy. No SMTP server is set up, so Gitea sends no email.
Risk
The CloudNativePG database instances call the Kubernetes API with an identity that the operator creates.
How it is handled
The cloudnative-pg component creates the RBAC permissions for each cluster. The Gitea Pod has no token.
Risk
Repositories and LFS objects live on the volume, so the database backup does not include them.
How it is handled
Back up the gitea-data volume separately, for example with gitea dump. Try a restore before you go to production.
What the cluster needs
Zeabur OSS suggests the components a cluster is missing. Without it, install them first.