diff --git a/.forgejo.metadata b/.forgejo.metadata new file mode 100644 index 0000000..1437af2 --- /dev/null +++ b/.forgejo.metadata @@ -0,0 +1 @@ +eb5c90679d073856bac4b67fd49a9d74de6c91d3627461e8426ed0c2de2ca4344d25fb559bd7f6f13e09b7e443c51c3b4d5ead32f23f3fe10c115eb9ee019999 SOURCES/forgejo-src-8.0.3.tar.gz diff --git a/SOURCES/0001-forgejo.app.ini.patch b/SOURCES/0001-forgejo.app.ini.patch new file mode 100644 index 0000000..f1344f3 --- /dev/null +++ b/SOURCES/0001-forgejo.app.ini.patch @@ -0,0 +1,33 @@ +diff -Naurp forgejo/custom/conf/app.example.ini forgejo-new/custom/conf/app.example.ini +--- forgejo/custom/conf/app.example.ini 2024-04-26 21:49:54.000000000 -0700 ++++ forgejo-new/custom/conf/app.example.ini 2024-04-28 15:09:26.192685348 -0700 +@@ -279,10 +279,10 @@ RUN_USER = ; git + ;; + ;; Root directory containing templates and static files. + ;; default is the path where Gitea is executed +-;STATIC_ROOT_PATH = ; Will default to the built-in value _`StaticRootPath`_ ++STATIC_ROOT_PATH = /usr/share/forgejo + ;; + ;; Default path for App data +-;APP_DATA_PATH = data ; relative paths will be made absolute with _`AppWorkPath`_ ++APP_DATA_PATH = /var/lib/forgejo/data + ;; + ;; Enable gzip compression for runtime-generated content, static resources excluded + ;ENABLE_GZIP = false +@@ -569,14 +569,14 @@ ENABLED = true + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Root path for the log files - defaults to %(GITEA_WORK_DIR)/log +-;ROOT_PATH = ++ROOT_PATH = /var/log/forgejo + ;; + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Main Logger + ;; + ;; Either "console", "file" or "conn", default is "console" + ;; Use comma to separate multiple modes, e.g. "console, file" +-MODE = console ++MODE = console, file + ;; + ;; Either "Trace", "Debug", "Info", "Warn", "Error" or "None", default is "Info" + LEVEL = Info diff --git a/SOURCES/README.EL+Fedora b/SOURCES/README.EL+Fedora new file mode 100644 index 0000000..558827c --- /dev/null +++ b/SOURCES/README.EL+Fedora @@ -0,0 +1,43 @@ +To setup Forgejo, perform the following: + +* Create a user and database for forgejo (while granting rights) +* Start forgejo.service +* Change the configuration under [server] in /etc/forgejo/conf/app.ini and then + call http://server:port/ (default is http://localhost:3000) to finish setup. + + Alternatively, you can call http://server:port/ and setup from there and + change /etc/forgejo/conf/app.ini afterwards. + +You can create an admin user on the console by running: + +su - git +forgejo --name admin --password somePassword --email some@email.com --admin + +--- + +If you want to access forgejo through httpd (apache), install the forgejo-httpd +subpackage, and change /etc/httpd/conf.d/forgejo.conf. There are comments in that +file that give you examples of how to set it up, either as a vhost or as a +subdirectory like /git + +This will require you to also change the [server] section, in particular, +ROOT_URL to match what you are expecting. + +--- + +I would highly recommend that you setup the webserver to run on a socket rather +than a simple web server. That way, when you setup httpd or nginx, you can run +the reverse proxy into the socket. For example. + + + ProxyPass unix:/run/forgejo/forgejo.socket|http://127.0.0.1/ + ProxyPassReverse unix:/run/forgejo/forgejo.socket|http://127.0.0.1/ + + +--- + +If you plan on using SSH on the native 22 port, you do *not* have to disable +your default sshd service. Instead, you can add the following line to +/etc/ssh/sshd_config or /etc/ssh/sshd_config.d/99-forgejo.conf (EL9 and Fedora): + +AcceptEnv GIT_PROTOCOL diff --git a/SOURCES/forgejo.caddy b/SOURCES/forgejo.caddy new file mode 100644 index 0000000..7d9ce4c --- /dev/null +++ b/SOURCES/forgejo.caddy @@ -0,0 +1,11 @@ +#git.example.com { +# reverse_proxy localhost:3000 +#} + +# Using sub-path +#git.example.com { +# route /git/* { +# uri strip_prefix /git +# reverse_proxy localhost:3000 +# } +#} diff --git a/SOURCES/forgejo.firewalld b/SOURCES/forgejo.firewalld new file mode 100644 index 0000000..b19ecf5 --- /dev/null +++ b/SOURCES/forgejo.firewalld @@ -0,0 +1,6 @@ + + + Forgejo + Self-hosted lightweight software forge. + + diff --git a/SOURCES/forgejo.httpd b/SOURCES/forgejo.httpd new file mode 100644 index 0000000..68892fe --- /dev/null +++ b/SOURCES/forgejo.httpd @@ -0,0 +1,50 @@ +# ENSURE YOU SET YOUR ROOT_URL CORRECTLY AFTER MAKING CHANGES + +# Virtual Host Examples + +# +# ServerName git.example.com +# ServerAlias git.example.com +# ProxyPreserveHost On +# ProxyRequests Off +# AllowEncodedSlashes NoDecode +# ProxyPass / http://localhost:3000/ nocanon +# ProxyPassReverse / http://localhost:3000/ nocanon +# +# +# +# Protocols h2 http/1.1 +# SSLEngine On +# ServerName git.example.com +# ServerAlias git.example.com +# ProxyPreserveHost On +# ProxyRequests Off +# AllowEncodedSlashes NoDecode +# ProxyPass / http://localhost:3000/ nocanon +# ProxyPassReverse / http://localhost:3000/ nocanon +# + +# This is if you're using sockets +# +# SSLEngine on +# ServerName git.example.com +# DocumentRoot /var/www/html +# +# ProxyPass unix:/run/forgejo/forgejo.socket|http://127.0.0.1/ +# ProxyPassReverse unix:/run/forgejo/forgejo.socket|http://127.0.0.1/ +# +# + +# Examples of using /git + +# +# Require all granted +# ProxyPass http://localhost:3000 +# ProxyPassReverse http://localhost:3000 +# + +# +# Require all granted +# ProxyPass https://some.git.com:3000 +# ProxyPassReverse https://some.git.com:3000 +# diff --git a/SOURCES/forgejo.nginx b/SOURCES/forgejo.nginx new file mode 100644 index 0000000..420af5e --- /dev/null +++ b/SOURCES/forgejo.nginx @@ -0,0 +1,40 @@ +# Single node, single domain +#server { +# listen 80; +# server_name git.example.com; +# +# location /_/static/assets { +# alias /path/to/forgejo/public; +# } +# +# location / { +# proxy_pass http://localhost:3000; +# } +#} + +# Two nodes, two domains +#server { +# listen 80; +# server_name git.example.com; +# +# location / { +# proxy_pass http://localhost:3000; +# } +#} + +# static content delivery server +#server { +# listen 80; +# server_name cdn.example.com; +# +# location /forgejo { +# alias /path/to/forgejo/public; +# } +# +# location / { +# return 404; +# } +#} + +# If you need to resolve a 413 error, add "client_max_body_size 16M;" to your +# location block diff --git a/SOURCES/forgejo.service b/SOURCES/forgejo.service new file mode 100644 index 0000000..a00886f --- /dev/null +++ b/SOURCES/forgejo.service @@ -0,0 +1,36 @@ +# Forgejo Service File (part of the forgejo rpm package) +# +# If you plan on using a database or using different settings from the defaults +# please copy this file to /etc/systemd/system/ or setup a directory structure +# like /etc/systemd/system/forgejo.service.d/ with your override files. + +[Unit] +Description=Forgejo (Self-hosted lightweight software forge) +After=syslog.target +After=network.target +After=mysqld.service +After=postgresql.service +After=memcached.service +After=redis.service + +[Service] +# Uncomment these if you run into 500 errors - This occurs only if you have +# repos with a lot of files. +#LimitMEMLOCK=infinity +#LimitNOFILE=65535 +RestartSec=2s +Type=simple +User=git +Group=git +WorkingDirectory=/var/lib/forgejo/ +ExecStart=/usr/bin/forgejo web --config /etc/forgejo/conf/app.ini +Restart=always +Environment=USER=git HOME=/usr/share/forgejo GITEA_WORK_DIR=/var/lib/forgejo + +# If you plan on binding Forgejo to a port lower than 1024 (not recommended), +# uncomment the below. +#CapabilityBoundingSet=CAP_NET_BIND_SERVICE +#AmbientCapabilities=CAP_NET_BIND_SERVICE + +[Install] +WantedBy=multi-user.target diff --git a/SOURCES/forgejo.sysusers b/SOURCES/forgejo.sysusers new file mode 100644 index 0000000..7e976ac --- /dev/null +++ b/SOURCES/forgejo.sysusers @@ -0,0 +1,3 @@ +#Type Name ID GECOS Home directory Shell +g git - +u git - "Forgejo" /usr/share/forgejo /bin/bash diff --git a/SPECS/forgejo.spec b/SPECS/forgejo.spec new file mode 100644 index 0000000..09cd84f --- /dev/null +++ b/SPECS/forgejo.spec @@ -0,0 +1,268 @@ +%global major_version 8 +%global minor_version 0 +%global micro_version 3 +%global append_tag 1 +%global attachment_uuid d7d1ee1b-c6c4-40ea-ad48-b8417fecb001 + +%define debug_package %{nil} + +Name: forgejo +Version: %{major_version}.%{minor_version}.%{micro_version} +Release: %{append_tag}%{?dist} +Summary: Self-hosted lightweight software forge +License: MIT +URL: https://forgejo.org +Source0: https://codeberg.org/forgejo/forgejo/releases/download/v%{version}/%{name}-src-%{version}.tar.gz +#Source1: https://github.com/go-gitea/gitea/releases/download/v%{version}/%{name}-docs-%{version}.tar.gz +Source2: forgejo.service +Source3: forgejo.firewalld +Source4: README.EL+Fedora +Source5: forgejo.httpd +Source6: forgejo.nginx +Source7: forgejo.caddy +Source8: forgejo.sysusers + +Patch1: 0001-forgejo.app.ini.patch + +BuildRequires: systemd +BuildRequires: go >= 1.21.0 +BuildRequires: git +BuildRequires: make +BuildRequires: nodejs-devel >= 16.0.0 +BuildRequires: npm +BuildRequires: go-srpm-macros +BuildRequires: pam-devel +Requires: git +Requires: systemd +Requires: openssh-server +Requires(pre): shadow-utils +Requires(post): systemd +Requires(postun): systemd +Requires(preun): systemd + +Conflicts: git-web +Conflicts: gitea + +# Suggesting httpd for now +Suggests: httpd + +%description +Forgejo is a self-hosted lightweight software forge. +Easy to install and low maintenance, it just does the job + +Brought to you by an inclusive community under the umbrella +of Codeberg e.V., a democratic non-profit organization, +Forgejo can be trusted to be exclusively Free Software. It +is a "soft" fork of Gitea with a focus on scaling, federation +and privacy. + +%package httpd +Summary: Apache (httpd) configuration for %{name} +Requires: forgejo +Requires: httpd + +%description httpd +This subpackage contains Apache configuration files that can be used to reverse +proxy for Gitea. + +%package nginx +Summary: nginx configuration for %{name} +Requires: forgejo +Requires: nginx + +%description nginx +This subpackage contains an nginx configuration file that can be used to reverse +proxy for Gitea. + +%package caddy +Summary: caddy configuration for %{name} +Requires: forgejo +Requires: caddy >= 2.0.0 + +%description caddy +This subpackage contains an caddy configuration file that can be used to reverse +proxy for Gitea. + +#%package docs +#Summary: Documentation for %{name} + +#%description docs +#This subpackage contains the Gitea documentation from https://docs.gitea.io + +%prep +%setup -q -n %{name}-src-%{version} +%autopatch -p1 + +install -m 0644 %{SOURCE4} . +for file in $(find . -type f -name "*.css"); do + chmod -x ${file} +done + +%build +# Default support for sqlite and pam (not provided by upstream by default) +export TAGS="sqlite sqlite_unlock_notify pam" +export LDFLAGS="-s -w -X \"main.Version=%{version}\" -X \"code.gitea.io/gitea/modules/setting.CustomPath=/etc/forgejo\" -X \"code.gitea.io/gitea/modules/setting.AppWorkPath=/var/lib/forgejo\"" + +# Probably not needed, but just in case I guess. +TAGS="${TAGS}" LDFLAGS="${LDFLAGS}" make build + +%install +# The binary comes out as "gitea" for now +install -D -m 755 gitea $RPM_BUILD_ROOT%{_bindir}/forgejo +install -D -m 644 %{SOURCE2} $RPM_BUILD_ROOT/%{_unitdir}/forgejo.service +install -D -m 644 custom/conf/app.example.ini $RPM_BUILD_ROOT%{_sysconfdir}/forgejo/conf/app.ini +install -D -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_prefix}/lib/firewalld/services/%{name}.xml +install -D -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/%{name}.conf +install -D -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/%{name}.conf +install -D -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/caddy/Caddyfile.d/%{name}.caddyfile +install -D -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysusersdir}/%{name}.conf +mkdir -p $RPM_BUILD_ROOT%{_datadir}/forgejo \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/data \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/data/lfs \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/data/tmp \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/data/tmp/uploads \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/data/tmp/pprof \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/data/sessions \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/data/avatars \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/data/attachments \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/data/repo-avatars \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/indexers \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/indexers/issues.bleve \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/indexers/issues.queue \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/indexers/repos.bleve \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/queues \ + $RPM_BUILD_ROOT%{_localstatedir}/lib/forgejo/repositories \ + $RPM_BUILD_ROOT%{_localstatedir}/log/forgejo \ + $RPM_BUILD_ROOT%{_sysconfdir}/forgejo/{conf,https,mailer} + +cp -r options $RPM_BUILD_ROOT%{_datadir}/forgejo/ +cp -r public $RPM_BUILD_ROOT%{_datadir}/forgejo/ +cp -r templates $RPM_BUILD_ROOT%{_datadir}/forgejo/ +#cp -r web_src/less $RPM_BUILD_ROOT%{_datadir}/forgejo/public +#install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/docs.gitea.io/ +#tar -xvzf %{SOURCE1} -C $RPM_BUILD_ROOT%{_datadir}/%{name}/docs.gitea.io + +mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir}/ +cat > $RPM_BUILD_ROOT%{_tmpfilesdir}/%{name}.conf <= 9 +%sysusers_create_compat %{SOURCE8} +%else +%{_sbindir}/groupadd -r git 2>/dev/null || : +%{_sbindir}/useradd -r -g git \ + -s /bin/bash -d %{_datadir}/%{name} \ + -c 'Forgejo' git 2>/dev/null || : +%endif + +%preun +%systemd_preun %{name}.service + +%post +%systemd_post %{name}.service +systemd-tmpfiles --create %{name}.conf || : + +%postun +%systemd_postun_with_restart %{name}.service + +%files +%doc README.EL+Fedora README.md custom/conf/app.example.ini +%license LICENSE +#%exclude %{_datadir}/%{name}/docs.gitea.io +%{_unitdir}/forgejo.service +%{_bindir}/forgejo +%{_prefix}/lib/firewalld/services/%{name}.xml +%{_tmpfilesdir}/%{name}.conf +%{_sysusersdir}/%{name}.conf + +%defattr(0660,root,git,770) +%dir %{_sysconfdir}/forgejo +%dir %{_sysconfdir}/forgejo/conf +%dir %{_sysconfdir}/forgejo/https +%dir %{_sysconfdir}/forgejo/mailer +%dir %{_localstatedir}/log/forgejo +%config(noreplace) %{_sysconfdir}/forgejo/conf/app.ini + +%defattr(0660,git,git,750) +%{_datadir}/forgejo +%{_localstatedir}/lib/forgejo + +%files httpd +%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf + +%files nginx +%config(noreplace) %{_sysconfdir}/nginx/conf.d/%{name}.conf + +%files caddy +%config(noreplace) %{_sysconfdir}/caddy/Caddyfile.d/%{name}.caddyfile + +#%files docs +#%{_datadir}/%{name}/docs.gitea.io + +%changelog +* Tue Nov 19 2024 Louis Abel - 8.0.3-1 +- Update to 8.0.3 + +* Fri Aug 09 2024 Louis Abel - 8.0.1-1 +- Update to 8.0.1 + +* Thu May 02 2024 Louis Abel - 7.0.2-1 +- Update to 7.0.2 + +* Sun Apr 28 2024 Louis Abel - 7.0.1-1 +- Move to 7.0.1 + +* Thu Apr 04 2024 Louis Abel - 1.21.10-0 +- Update to 1.21.10-0 + +* Thu Mar 21 2024 Louis Abel - 1.21.7-0 +- Update to 1.21.7-0 + +* Tue Jan 16 2024 Louis Abel - 1.21.4-0 +- Update to 1.21.4-0 + +* Sat Jan 06 2024 Louis Abel - 1.21.3-0.0.1 +- Set git user to /bin/bash + +* Sat Dec 30 2023 Louis Abel - 1.21.3-0 +- Update to 1.21.3-0 + +* Tue Oct 17 2023 Louis Abel - 1.20.5-0 +- Update to 1.20.5-0 + +* Thu Sep 28 2023 Louis Abel - 1.20.4-1 +- Update to 1.20.4-1 + +* Sun Jul 30 2023 Louis Abel - 1.20.2-0 +- Update to 1.20.2-0 + +* Mon Jul 24 2023 Louis Abel - 1.20.1-0 +- Update to 1.20.1-0 + +* Wed Jul 05 2023 Louis Abel - 1.19.4-0 +- Updates to 1.19.4-0 + +* Wed May 03 2023 Louis Abel - 1.19.3-0 +- Updates to 1.19.3-0 + +* Fri Apr 28 2023 Louis Abel - 1.19.2-0 +- Updates to 1.19.2-0 + +* Sun Apr 16 2023 Louis Abel - 1.19.1-0 +- Updates to 1.19.1-0 + +* Wed Apr 05 2023 Louis Abel - 1.19.0-3 +- Updates to 1.19.0-3 + +* Tue Mar 21 2023 Louis Abel - 1.19.0-2 +- Updates to 1.19.0-2 + +* Tue Mar 07 2023 Louis Abel - 1.18.5-0.0.1 +- Fix requires + +* Tue Feb 28 2023 Louis Abel - 1.18.5-0 +- Update to 1.18.5