Installation de forgejo sur rocky-linux en mode binaire
Installation des pré-requis
Installation des packages manquants
dnf install -y git git-lfs wget
Installation de forgejo
Création du groupe et du user associé au futur service
groupadd --system git
adduser --system --shell /bin/bash --comment 'Git Version Control' --gid git --home-dir /home/git --create-home git
Création des dossiers qui seront utilisés par le service
- Création du dossier /var/lib/forgejo qui contiendra les données
mkdir /var/lib/forgejo
chown git:git /var/lib/forgejo && chmod 750 /var/lib/forgejo
- Création du dossier /etc/forgejo qui contiendra le fichier de configuration app.ini
mkdir /etc/forgejo
chown root:git /etc/forgejo && chmod 770 /etc/forgejo
Recuperation du binaire forgejo
cd /usr/local/bin
wget https://codeberg.org/forgejo/forgejo/releases/download/v7.0.4/forgejo-7.0.4-linux-amd64
chmod 755 /usr/local/bin/forgejo-7.0.4-linux-amd64
ln -s forgejo-7.0.4-linux-amd64 forgejo
Installation du service
wget -O /etc/systemd/system/forgejo.service https://codeberg.org/forgejo/forgejo/raw/branch/forgejo/contrib/systemd/forgejo.service
Ouverture firewall du port tcp/3000 sur firewalld
firewall-cmd --permanent --add-port=3000/tcp
firewall-cmd --reload
Démarrage du service forgejo
systemctl enable forgejo.service
systemctl start forgejo.service
Further configuration in Forgejo’s app.ini
Stop the forgejo service: # systemctl stop forgejo.service
While at it, make /etc/forgejo/
and the app.ini
read-only for the git user (Forgejo doesn’t write to it after the initial configuration): # chmod 750 /etc/forgejo && chmod 640 /etc/forgejo/app.ini
Now (as root) edit /etc/forgejo/app.ini
NOTE: You’ll probably find the Configuration Cheat Sheet and the Example app.ini that contains all options incl. descriptions helpful.
The following changes are recommended if dealing with many large files:
-
Forgejo allows uploading files to Git repositories through the web interface. By default the file size for uploads is limited to 3MB per file, and 5 files at once. To increase it, under the
[repository]
section, add a[repository.upload]
section with a line likeFILE_MAX_SIZE = 4095
(that would be 4095MB, about 4GB) andMAX FILES = 20
It’ll look somehow like this:... [repository] ROOT = /var/lib/forgejo/data/forgejo-repositories [repository.upload] ;; max size for files to the repo via web interface, in MB, ;; defaults to 3 (this sets a limit of about 4GB) FILE_MAX_SIZE = 4095 ;; by default 5 files can be uploaded at once, increase to 20 MAX_FILES = 20 [server] ...
Similar restrictions restrictions exist for attachments to issues/pull requests, configured in the
[attachment]
sectionsMAX_SIZE
(default 4MB) andMAX_FILES
(default 5) settings. -
By default LFS data uploads expire after 20 minutes - this can be too short for big files, slow connections or slow LFS storage (git-lfs seems to automatically restart the upload then - which means that it can take forever and use lots of traffic).. If you’re going to use LFS with big uploads, increase thus limit, by adding a line
LFS_HTTP_AUTH_EXPIRY = 180m
(for 180 minutes) to the[server]
section. -
Similarly there are timeouts for all kinds of git operations, that can be too short. Increasing all those git timeouts by adding a
[git.timeout]
section below the[server]
section:;; Git Operation timeout in seconds ;; increase the timeouts, so importing big repos (and presumably ;; pushing large files?) hopefully won't fail anymore [git.timeout] DEFAULT = 3600 ; Git operations default timeout seconds MIGRATE = 6000 ; Migrate external repositories timeout seconds MIRROR = 3000 ; Mirror external repositories timeout seconds CLONE = 3000 ; Git clone from internal repositories timeout seconds PULL = 3000 ; Git pull from internal repositories timeout seconds GC = 600 ; Git repository GC timeout seconds
They are increased by a factor 10 (by adding a 0 at the end); probably not all these timeouts need to be increased (and if, then maybe not this much)… use your own judgement.
-
By default LFS files are stored in the filesystem, in
/var/lib/forgejo/data/lfs
. In the[lfs]
section you can change thePATH = ...
line to store elsewhere, but you can also configure Forgejo to store the files in an S3-like Object-Storage. -
If you want to use the systemwide sendmail, enable sending E-Mails by changing the
[mailer]
section like this:[mailer] ;; send mail with systemwide "sendmail" ENABLED = true PROTOCOL = sendmail FROM = "Forgejo Git" <noreply@yourdomain.com>
-
By default Forgejo will listen to the port 3000 but that can be changed to 80 with HTTP_PORT like this:
[server] HTTP_PORT = 80
When you’re done editing the app.ini, save it and start the forgejo service again: # systemctl start forgejo.service
You can test sending a mail by clicking the user button on the upper right of the Forgejo page (“Profile and Settings”), then Site Administration
, then Configuration
and under Mailer Configuration
type in your mail address and click Send Testing Email
.