Deployment guide

GitLab CE

Overview

GitLab is an end-to-end DevSecOps platform. It combines Git repository hosting, code review, CI/CD pipelines, a container registry, issue tracking, a wiki and security scanning in a single self-hosted application.

This SecureAnyCloud image installs GitLab Community Edition 18 from the official packages.gitlab.com Omnibus package, with no third-party builds. The package bundles PostgreSQL, Redis, Nginx, Puma (Rails app server), Sidekiq (background jobs), Gitaly (Git RPC) and GitLab Workhorse (file uploads and websockets). The password of the default root administrator account is rotated per VM at first boot.

What you get:

  • GitLab Community Edition 18.11.2 from the packages.gitlab.com/gitlab/gitlab-ce Omnibus APT repository
  • PostgreSQL embedded at /var/opt/gitlab/postgresql, so there is no separate database to manage
  • Redis embedded at /var/opt/gitlab/redis
  • Nginx fronting Puma at :80 (HTTP), and GitLab Git SSH on :2222 to avoid a collision with the system sshd
  • Sidekiq, Gitaly, GitLab Workhorse, GitLab Shell, GitLab KAS, mailroom, alertmanager and Prometheus exporters
  • gitlab-firstboot.service, which rotates the root admin password and rewrites external_url to the VM's IP
  • An Ubuntu 24.04 LTS base, patched at build time
  • 24/7 SecureAnyCloud support

Prerequisites

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

Standard_D4s_v3 (4 vCPU, 16 GB RAM) is the minimum size. The GitLab Omnibus services together use about 6 GB of resident memory under no load. For real teams, use Standard_D8s_v3 (8 vCPU, 32 GB) or larger.

Allocate at least 50 GB of OS disk. GitLab repository data lives at /var/opt/gitlab/git-data.

1

Deploy from the Azure Marketplace

In the Azure Marketplace, search for "GitLab Community Edition on Ubuntu 24.04 LTS". Select Get It Now, then Create.

Pick your resource group, region, VM size (Standard_D4s_v3 minimum) and SSH key. In the network security group (NSG), allow inbound 22 (SSH), 80 (GitLab HTTP) and 2222 (GitLab Git SSH).

2

Connect to the VM over SSH

Connect as azureuser:

ssh azureuser@<vm-ip>

The first boot takes 5-8 minutes. GitLab runs gitlab-ctl reconfigure to re-render nginx and restart services after the per-VM external_url is set. Wait for /var/lib/sac/data/gitlab-firstboot.done to appear before you browse to the VM. This loop waits for you:

while [ ! -f /var/lib/sac/data/gitlab-firstboot.done ]; do echo "waiting..."; sleep 15; done; echo "READY"
3

Verify the services

Check the status of every bundled service:

sudo gitlab-ctl status

Every line should start with run:, which means the service is up. If a service shows down:, wait another 60 seconds. Puma and Workhorse can take a moment after the reconfigure.

4

Read the per-VM root password

Print the credentials file:

sudo cat /stage/scripts/gitlab-credentials.log

Note GITLAB_ROOT_PASSWORD and GITLAB_LOGIN_URL. Treat both as secrets. The file is mode 0600 root:root.

5

Set your public URL

Azure VMs with Standard public IPs do not return the public IP through the Azure Instance Metadata Service (IMDS). The build script therefore sets external_url to the VM's private IP.

Before you expose GitLab to real users, set external_url to your actual hostname or public IP and run the reconfigure again:

sudo sed -i "s|^external_url .*|external_url 'http://your-gitlab.example.com'|" /etc/gitlab/gitlab.rb
sudo gitlab-ctl reconfigure

If HTTPS is available (Let's Encrypt), use https://. GitLab then renews the certificate automatically once you set letsencrypt['enable'] = true in the same file.

6

Sign in

Browse to http://<vm-ip>/users/sign_in and sign in as root with the password from Step 4.

7

Create your first project

After you sign in, you land on the welcome view. Create your first project to get a Git remote URL.

8

Open the Admin Area

Open /admin for the administration overview: users, groups, runners, jobs, settings and monitoring.

9

Push over Git SSH

GitLab Git SSH listens on port 2222, while the system sshd stays on port 22. Add the port to your remote URL or to ~/.ssh/config:

git remote set-url origin ssh://git@<vm-ip>:2222/root/sample-project.git
git push origin main
10

Know where things live

  • GitLab install root: /opt/gitlab/
  • GitLab data: /var/opt/gitlab/
  • GitLab config: /etc/gitlab/gitlab.rb
  • Repositories: /var/opt/gitlab/git-data/repositories/
  • Embedded PostgreSQL: /var/opt/gitlab/postgresql/
  • Embedded Redis: /var/opt/gitlab/redis/
  • GitLab logs: /var/log/gitlab/<service>/current
  • Reconfigure logs: /var/log/gitlab/reconfigure/*.log
  • First-boot script: /usr/local/sbin/gitlab-firstboot.sh
  • Credentials: /stage/scripts/gitlab-credentials.log (mode 0600 root:root)
11

Back up GitLab

GitLab's official backup tool dumps the repositories, database, uploads and container registry into a single tarball:

sudo gitlab-backup create ls -la /var/opt/gitlab/backups/

Store the resulting .tar somewhere off the VM, such as Azure Blob or S3. Restore it with gitlab-backup restore BACKUP=<timestamp>.

12

Security notes

  • HTTPS: edit external_url 'https://...' in /etc/gitlab/gitlab.rb, set letsencrypt['enable'] = true, then run sudo gitlab-ctl reconfigure. GitLab obtains and automatically renews a Let's Encrypt certificate.
  • Restrict the NSG: limit ports 22 and 2222 to your management CIDR, and limit 80 and 443 to your CDN or office IPs only.
  • Enforce 2FA: go to Admin, then Settings, then Sign-up restrictions. Or enforce it per user under /profile/two_factor_auth.
  • Sign in with SSO: GitLab supports OIDC, SAML, LDAP, Azure AD and Microsoft Entra ID. Configure it in /etc/gitlab/gitlab.rb, then reconfigure.
  • Patch monthly: run sudo apt-get update && sudo apt-get upgrade && sudo gitlab-ctl restart. GitLab CE releases patch versions monthly and a major version every quarter.
  • Back up before upgrades: run sudo gitlab-backup create, then sudo apt-get install gitlab-ce.

Licensing

GitLab Community Edition is MIT-licensed and free to use commercially. SecureAnyCloud provides commercial support separately. Contact sales@secureanycloud.com.

Deploy on Azure

Launch GitLab Community Edition on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View on Marketplace

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure