Deployment guide

Gitea 1.25

Overview

Gitea is a lightweight, self-hosted Git server. It ships as a single Go binary (about 150 MB installed), uses SQLite by default and runs comfortably on a 4 GB VM.

This SecureAnyCloud image installs the latest 1.25.x release from GitHub. On first boot, gitea-firstboot.service rotates SECRET_KEY, INTERNAL_TOKEN and JWT_SECRET in /etc/gitea/app.ini, generates a per-VM SecureAnyCloud admin password and creates the admin user. It writes the credentials to /stage/scripts/gitea-credentials.log, a root-only file with mode 0600.

What you get:

  • Gitea 1.25.5 as a single Go binary (/usr/local/bin/gitea)
  • A SQLite database at /var/lib/gitea/data/gitea.db, so there is no separate database to maintain
  • gitea.service running as git:git
  • gitea-firstboot.service, which rotates secrets and creates the per-VM admin user
  • The web UI on TCP 3000 (HTTP) and SSH for git push and pull on TCP 2222
  • The LFS server enabled
  • GITEA_WORK_DIR=/var/lib/gitea (not /mnt)
  • An Ubuntu 24.04 LTS base with the latest patches
  • 24/7 SecureAnyCloud support with a 24h response SLA

Prerequisites

You need an active Azure subscription, an SSH key, and a VNet with a subnet.

The recommended VM size is Standard_B2s. Gitea is efficient, and 4 GB of RAM is plenty for small teams.

1

Deploy from the Azure Portal

In the Azure Portal, search the Marketplace for Gitea 1.25 and create the VM. In the network security group (NSG), allow inbound TCP 22, 3000 and 2222 from your client networks.

Port 3000 serves plain HTTP. For production, put a TLS reverse proxy in front of it.

2

Deploy from the Azure CLI

RG="gitea-prod"; LOCATION="eastus"; VM_NAME="gitea-01" IMAGE_URN="sac1647283583153:gitea-1-25-ubuntu-24-04:default:latest" SSH_KEY="$(cat ~/.ssh/id_rsa.pub)" az group create --name "$RG" --location "$LOCATION" az network vnet create -g "$RG" --name git-vnet --address-prefix 10.102.0.0/16 --subnet-name git-subnet --subnet-prefix 10.102.1.0/24 az network nsg create -g "$RG" --name git-nsg az network nsg rule create -g "$RG" --nsg-name git-nsg --name allow-ssh --priority 100 \
  --source-address-prefixes "<your-mgmt-cidr>" --destination-port-ranges 22 --access Allow --protocol Tcp az network nsg rule create -g "$RG" --nsg-name git-nsg --name allow-web --priority 110 \
  --source-address-prefixes 10.102.0.0/16 --destination-port-ranges 3000 --access Allow --protocol Tcp az network nsg rule create -g "$RG" --nsg-name git-nsg --name allow-git-ssh --priority 120 \
  --source-address-prefixes 10.102.0.0/16 --destination-port-ranges 2222 --access Allow --protocol Tcp
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:gitea-1-25-ubuntu-24-04:default:latest
az vm create -g "$RG" --name "$VM_NAME" --image "$IMAGE_URN" \
  --size Standard_B2s --storage-sku StandardSSD_LRS \
  --admin-username azureuser --ssh-key-values "$SSH_KEY" \
  --vnet-name git-vnet --subnet git-subnet --nsg git-nsg --public-ip-sku Standard
3

Connect over SSH

Connect to the VM as azureuser:

ssh azureuser@<vm-ip>

Both gitea.service and gitea-firstboot.service run automatically at boot.

4

Verify the service

Check that Gitea is running, that first boot completed, and that ports 3000 and 2222 are listening:

sudo systemctl status gitea.service --no-pager sudo test -f /var/lib/sac/data/gitea-firstboot.done && echo FIRSTBOOT_DONE
sudo ss -tln | grep -E ':(3000|2222)'
5

Retrieve the admin password

Read the per-VM admin credentials from the root-only credentials file:

sudo cat /stage/scripts/gitea-credentials.log
GITEA_USER=sac GITEA_PASSWORD=<GITEA_PASSWORD> HTTP_PORT=3000 SSH_PORT=2222 GITEA_URL=http://localhost:3000/
6

Use the Gitea API

Read the admin password from the credentials file, then call the Gitea API to check the version, identify the signed-in user and create a repository:

PASS=$(sudo grep '^GITEA_PASSWORD=' /stage/scripts/gitea-credentials.log | cut -d= -f2-)
curl -fsS http://localhost:3000/api/v1/version curl -fsS -u "sac:${PASS}" http://localhost:3000/api/v1/user
# Create a repo curl -X POST -u "sac:${PASS}" -H 'Content-Type: application/json' \
  -d '{"name":"hello-world","auto_init":true}' \
  http://localhost:3000/api/v1/user/repos
7

Open the web UI

Browse to the VM on port 3000:

open http://<vm-ip>:3000/

Sign in with SecureAnyCloud / <GITEA_PASSWORD>. The dashboard opens on your activity feed.

The Site Administration page (/-/admin) shows server statistics, all users, organizations and repositories.

8

Push your first repository

Create a local repository and push it to Gitea over HTTPS or SSH:

mkdir myrepo && cd myrepo git init echo "# myrepo" > README.md git add README.md git commit -m "Initial commit"
# Use HTTPS (with sac / password)
git remote add origin http://<vm-ip>:3000/sac/myrepo.git
git push -u origin main
# Or SSH (after adding your SSH key in Settings → SSH/GPG Keys)
git remote add origin ssh://git@<vm-ip>:2222/sac/myrepo.git
git push -u origin main
9

Server components

Use this list to find the main parts of the installation:

  • Gitea binary: /usr/local/bin/gitea
  • Configuration: /etc/gitea/app.ini
  • Data directory: /var/lib/gitea/ (data/, custom/, log/)
  • SQLite database: /var/lib/gitea/data/gitea.db
  • Log: /var/lib/gitea/log/gitea.log
  • systemd unit: /etc/systemd/system/gitea.service
  • First-boot script: /usr/local/sbin/gitea-firstboot.sh
  • Credentials: /stage/scripts/gitea-credentials.log (mode 0600)
  • First-boot sentinel: /var/lib/sac/data/gitea-firstboot.done

To print the installed version, run:

/usr/local/bin/gitea --version
10

Manage the service

Restart Gitea, follow its log and list users with these commands:

sudo systemctl restart gitea.service
sudo tail -f /var/lib/gitea/log/gitea.log
sudo -u git /usr/local/bin/gitea admin user list --config /etc/gitea/app.ini
11

Security recommendations

  • Rotate the admin password. Change the SecureAnyCloud admin password in Account Settings or with gitea admin user change-password.
  • Restrict the NSG. Allow ports 3000 and 2222 only from trusted networks.
  • Front Gitea with TLS. For production, terminate TLS at a reverse proxy.
  • Disable open registration. Set DISABLE_REGISTRATION = true in the [service] section of app.ini.
  • Enable 2FA in Account Settings, under Security.
  • Back up /var/lib/gitea/ to Azure Blob Storage. It holds the SQLite database, custom/ and data/.
  • Patch the OS monthly with apt-get update && apt-get upgrade && reboot.
12

Migrate from SQLite to PostgreSQL (optional)

For larger teams, you can replace SQLite with an external PostgreSQL server:

  • Stop Gitea: sudo systemctl stop gitea
  • Dump the data: sudo -u git /usr/local/bin/gitea dump --config /etc/gitea/app.ini --type zip --file /tmp/gitea-dump.zip
  • Update the [database] section in /etc/gitea/app.ini with DB_TYPE=postgres and the connection parameters.
  • Run the migration: sudo -u git /usr/local/bin/gitea migrate --config /etc/gitea/app.ini
  • Start Gitea: sudo systemctl start gitea
13

Support and licensing

Gitea is MIT-licensed, with no per-CPU or per-user fee. SecureAnyCloud provides commercial support separately.

  • Email: sales@secureanycloud.com
  • Website: secureanycloud.com
  • Support hours: 24/7, 24h response SLA

Deploy on Azure

Launch Gitea 1.25 on Ubuntu 24.04 with 24/7 support from SecureAnyCloud.

View on Marketplace

Need Help?

Our support team is available 24/7. sales@secureanycloud.com

Deploy on Azure

Launch Gitea 1.25 on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure