An Ansible Playbook for deploying your own self-hosted Gitea instance
Theodotos Andreou aa723ffee1 Fix hardcoded version 4 months ago
templates Enable captcha 6 months ago
vars Switch to version 1.4.3 4 months ago
.gitignore Initial Commit 6 months ago
LICENSE Add LICENSE 6 months ago
README.md Some Typos 6 months ago
deploy_gitea.yml Fix hardcoded version 4 months ago

README.md

Setting up a Gitea code hosting platform

Gitea is a self-hosted Git-based Code Hosting Platform and a nice alternative to Github and other proprietary services. You can use this Ansible Playbook to host your own Code Hosting Platform under your own control.

This setup offers:

  • Gitea
  • PostgreSQL backend
  • Nginx reverse proxy
  • Fail2Ban Gitea protection
  • HTTPS by Let's Encrypt

Prerequisites

  • A Debian or Ubuntu machine.
  • A publicly available FQDN:
git.example.org.	300	IN	A	1.2.3.4

Deploy gitea

Clone the repository:

$ git clone https://git.theo-andreou.org/Personal/ansible-deploy-gitea.git
$ cd ansible-deploy-gitea

Prepare a vars/all.yml file (you can use vars/all.yml.example as reference):

# vars/all.yml
gitea_fqdn: git.example.org
gitea_db: giteadb
gitea_db_user: giteadbuser
gitea_version: 1.4.2

Adjusts the host(s) in deploy_gitea.yml and run the Playbook:

$ ansible-playbook deploy_gitea.yml

When done rush to https://git.example.org. First one to create an account gets to be an admin!

References

  • https://docs.gitea.io/en-us/install-from-binary/
  • https://docs.gitea.io/en-us/linux-service/
  • https://dl.gitea.io/gitea/1.4.2/
  • https://docs.gitea.io/en-us/fail2ban-setup/
  • https://docs.ansible.com/ansible/latest/modules/postgresql_db_module.html
  • https://docs.ansible.com/ansible/latest/modules/postgresql_user_module.html