Our Home Server is doing some nice stuff already. With the last articles, I want to demonstrate how you can deploy some useful applications on it. Running your own Git server has some advantages, when it comes to private work or testing.
Gitea is an Open Source Git server, that provides a pleasant web UI and lots of functionality, you might know from GitHub. Compared to GitLab, it is way easier to deploy and maintain. I am running my own instance for over 2 years now, with zero outages.
If you are looking for an internet hosted Gitea instance, you can find it on codeberg.org.
Gitea with Ansible and Podman
In the past articles, we were getting used to Podman deployments with Ansible already. We will do the same pattern with Gitea. You will need Ansible on your workstation and Podman on your home server.
We will create a new playbook deploy_gitea_container.yml as shown below.
As always, you can find the above code in the home server repository.
How it works
The playbook will create a new Podman network first. To ensure that the images are present, we will download them as a separate task. We are also creating two systemd services, which will start the containers. The service files also allow auto-updates of the container images via the podman-auto-update service.
Run the playbook
To install Gitea on your home server, you just need to execute the playbook.
# Run the playbook
$ ansible-playbook -i IP_ADDRESS, -u USER -k -K ansible/playbooks/deploy_gitea_container.yml
At the end of the run, you might see an output similar to the below.
You can check the deployment with the below commands.
# Check if the db service is running
$ sudo systemctl status container-gitea-db.service
# Check if the app service is running
$ sudo systemctl status container-gitea-app.service
# Check if the containers are running
$ sudo podman ps
If everything is working, point your browser to your home server on port 3000 http://IP_ADDRESS:3000. You will be greeted with the setup wizard.
At the very end, you can find a section "Administrator Account Settings". Enter your desired credentials for the admin account there. Afterwards, hit the "Install Gitea" button. After some time (maybe a reload of the page), you will land on your fresh installed Gitea server.
One more thing
We deployed the MariaDB container with a random root password. To fetch and save this, you need to perform the below command.
# Read logs from gitea db
$ sudo podman logs gitea-db
In the output, you will find a line, that looks similar to the below.
Save this password in a secure location, in case you need it.
Docs & Links
Gitea can be a beast, so let me provide some documentation. I also want to provide the newly created "whiletruedoio.container" collection, that also holds a role to deploy Gitea as Podman container.
That sums up our Git server deployment. I hope this helps to get a good understanding how these things can be handled. Also, having your own git server in a local network can be a good solution for temporary work, experiments, and stuff that is not ready for the public.
Do you have a local Git server? Which one is your favorite?