
Gitea is a lightweight, self-hosted Git service that offers features such as repository hosting, pull requests, issues, SSH/HTTPS access, a built-in web editor, and CI integrations. You can run Gitea on any Linux server and access it securely via web browser.
This article demonstrates how to deploy Gitea on Ubuntu 24.04 using Docker Compose and secure it with HTTPS via a Traefik reverse proxy.
Before you begin:
gitea.example.com, to point to your server’s public IP address.Set up the project directory to store persistent Gitea, MariaDB, and Let's Encrypt files.
Create folders to store Gitea data, database files, and Let's Encrypt certificates.
data - Gitea repositories, configs, SSH keys.db - MariaDB database files.letsencrypt - Traefik ACME certificates.Navigate to the root Gitea directory.
Create a .env file to store environment variables.
Add these values:
In the above file, replace:
STRONG_APP_PASSWORD with a secure password for the Gitea DB user.STRONG_MYSQL_ROOT_PASSWORD with a secure password for the MySQL root user.gitea.example.com with your domain.admin@example.com with your email.Save and close the file.
Deploy Gitea with Docker Compose, Traefik as reverse proxy, and MariaDB for storage.
Add your user account to the docker user group.
Apply new group membership.
Create and edit a Docker Compose manifest file.
Add the following contents:
Save and close the file.
This Docker Compose file deploys Gitea behind Traefik, enabling secure HTTPS access using Let’s Encrypt. Each service has a specific purpose:
gitea service
./data directory..env file.db service (MariaDB)
./db directory for persistent data..env file.traefik service
./letsencrypt directory.Start all services in detached mode.
Check container status.
You should see gitea, gitea-db, and traefik listed as "Up".
For more information on managing a Docker Compose stack, see the How To Use Docker Compose article.
Open your browser and visit your Gitea domain https://gitea.example.com.
You should see the Initial Configuration page. Leave the Database settings to their default values.
Scroll down to the Optional Settings section, and expand the Administrator Account Settings. Fill in the values to create an Administrator user.
Click the Install Gitea button to finish the installation process. After installation, the dashboard loads. You now have a fully functional and secure Gitea installation.
By following this article, you successfully deployed Gitea on Ubuntu 24.04 using Docker Compose and secured it with Traefik. Your Git service now supports HTTPS, automatic TLS renewal, repository hosting, and all Gitea’s built-in features. For more details, visit the Gitea documentation.
0 Comments
Be the first to comment and share your perspective with the community.