home-network/forgeo.org
2025-04-09 08:53:53 +03:00

138 lines
4.1 KiB
Org Mode
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#+title: Forgejo
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="_share/media/css/computer.css" />
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="_share/media/css/org-media-sass/content-overview.css" />
#+OPTIONS: H:6
* links
- [[./toc.org][TOC - Home System]]
* Hardware
* Forgejo Setup on Raspberry Pi
** Login data
| property | value |
|-------------+------------------------------|
| url | https://git.ronnyabraham.com |
| admin user | git-admin |
| admin pass | 2reishit2ara |
| admin email | ronny.abraham@ymail.com |
** Data Drive Setup
*** Git Repository Storage Info
| Property | Value |
|-------------------+----------------------------------|
| Physical Mount | /mnt/git |
| Logical Bind Mount| /srv/git |
| Device | /dev/sdb1 |
| Filesystem Type | ext4 |
| Label | gitdisk |
| UUID | 649f82e9-cfc0-4725-b260-d40f413bd0c3 |
| Used for | Forgejo repository storage |
*** fstab entry
#+begin_src conf
UUID=649f82e9-cfc0-4725-b260-d40f413bd0c3 /mnt/git ext4 defaults,noatime 0 2
/mnt/git /srv/git none bind 0 0
#+end_src
** Data Volume Layout
To separate application configuration from repository data, the Forgejo Docker container uses specific internal paths. We map our host directories accordingly for clarity and ease of maintenance.
*** Folder Breakdown
The folder structure on the host (Raspberry Pi):
#+begin_example
/mnt/storage/compose/docker/forgejo ← holds docker-compose.yml
/srv/git/
├── data/ ← holds all persistent repo data (repositories, issues, uploads)
└── config/ ← holds configuration files (e.g. app.ini)
#+end_example
This split layout allows easy backup, inspection, and version control of the Forgejo configuration without interfering with large and changing repository data.
*** Volume Mapping
| Host path | Container path | Purpose |
|-------------------+------------------------+--------------------------------|
| /srv/git/data | /data/data | Git repos, issues, uploads |
| /srv/git/config | /data/gitea/conf | app.ini, server configuration |
Make sure both folders on the host (`/srv/git/data` and `/srv/git/config`) are owned by the correct user (e.g. UID 1000), and match the containers expectations.
*** docker-compose.yml
#+INCLUDE: "docker.org::#docker-forgejo" :only-contents t
** Nginx
Create file: /etc/nginx/sites-available/forgejo
#+INCLUDE: "nginx.org::#forgejo-conf" :only-contents t
Enable and reload Nginx:
#+begin_src bash
sudo ln -s /etc/nginx/sites-available/forgejo /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
#+end_src
*** (Optional) Enable HTTPS with Certbot
#+begin_src bash
sudo certbot --nginx -d git.ronnyabraham.com
#+end_src
** Finish Setup
Visit: https://git.ronnyabraham.com
Set up the admin user and create your first repository.
** Push or Mirror Repositories to Forgejo
*** Push an Existing Local Repo to Forgejo
1. Go to your local repo:
#+begin_src bash
cd ~/your-local-project
#+end_src
2. Add your Forgejo remote:
#+begin_src bash
git remote add origin https://git.ronnyabraham.com/ronny/<repo-name>.git
#+end_src
3. Push your local code:
#+begin_src bash
git push -u origin main
#+end_src
4. Optional: use SSH instead of HTTPS
#+begin_src bash
git remote add origin git@git.ronnyabraham.com:ronny/<repo-name>.git
#+end_src
*** Mirror a Bitbucket Repo to Forgejo
1. Clone your Bitbucket repo **bare**:
#+begin_src bash
git clone --mirror git@bitbucket.org:your-username/your-repo.git
cd your-repo.git
#+end_src
2. Add Forgejo as a new remote:
#+begin_src bash
git remote set-url --push origin git@git.ronnyabraham.com:ronny/your-repo.git
#+end_src
3. Push all branches and tags:
#+begin_src bash
git push --mirror
#+end_src
4. Delete the local clone if desired:
#+begin_src bash
cd ..
rm -rf your-repo.git
#+end_src