This commit is contained in:
nazunalika
2022-02-11 22:13:12 -07:00
commit 7bcbae972b
7 changed files with 384 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
rpmspecs-gitea
^^^^^^^^^^^^^^
This is the RPM spec files that I have created for gitea. I am not affiliated with the gitea project and only provide this as a service.
.. contents::
Information
-----------
**Note:** I am not responsible for system damages, break-ins, or faulty code of the software that can cause the formerly listed. Always develop and test in an isolated environment at all times. **Always keep SELinux enabled.**
Frequently Asked Questions
--------------------------
Do you have any SRPMS available?
++++++++++++++++++++++++++++++++
They'll normally be available from my copr builds, if you are interested in making changes and using mock for yourself.
Have any documentation or guides?
+++++++++++++++++++++++++++++++++
If you're starting out rpm packaging, please consider reading the following documentation. The packaging guidelines may seem strict, but they are deemed best practices if you are considering on being a package maintainer (sponsored or not). Keep in mind, **I am always learning**. I am in no way an expert, nor do I claim to be.
`FHS <http://www.pathname.com/fhs/>`_
`Fedora: Fedora Packaging Guidelines <https://docs.fedoraproject.org/en-US/packaging-guidelines/>`_
`Fedora: Creating RPM Packages <https://docs.fedoraproject.org/en-US/package-maintainers/Packaging_Tutorial_GNU_Hello/>`_
What you should get from the above is there are specific guidelines that should be followed, for maintainability, portability, and easy review. My RPM specs will have an FAQ of the "purpose".
Do you have any repositories?
+++++++++++++++++++++++++++++
Yes, I do. I have two, actually. I have a copr and a personal repository.
`Copr <https://copr.fedorainfracloud.org/coprs/nalika/>`_
Do you take requests?
+++++++++++++++++++++
I normally don't. But, if what you're asking for doesn't have an RPM or project in copr, I'll consider it based on what it is, and if it fits licensing and guidelines. You can drop me an email or a line here and I will get back to you.
Do you package for other systems?
+++++++++++++++++++++++++++++++++
At this present time, I do not. I have considered packaging for Ubuntu or OpenSUSE. However those, much like Arch, already have plenty of maintainers with tons upon tons of packages (up to date or not) and their own build systems similar to Fedora. So some of the packages you may see here may already exist for those distributions in base or extra repositories they provide.
+33
View File
@@ -0,0 +1,33 @@
diff -Naurp git-old/custom/conf/app.example.ini git/custom/conf/app.example.ini
--- git-old/custom/conf/app.example.ini 2022-02-06 06:23:18.000000000 -0700
+++ git/custom/conf/app.example.ini 2022-02-11 20:59:19.897244829 -0700
@@ -188,10 +188,10 @@ RUN_MODE = ; prod
;;
;; Root directory containing templates and static files.
;; default is the path where Gitea is executed
-;STATIC_ROOT_PATH =
+STATIC_ROOT_PATH = /usr/share/gitea
;;
;; Default path for App data
-;APP_DATA_PATH = data
+APP_DATA_PATH = /var/lib/gitea/data
;;
;; Enable gzip compression for runtime-generated content, static resources excluded
;ENABLE_GZIP = false
@@ -446,14 +446,14 @@ APP_ID = ; e.g. http://localhost:3000/
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Root path for the log files - defaults to %(GITEA_WORK_DIR)/log
-;ROOT_PATH =
+ROOT_PATH = /var/log/gitea
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Main Logger
;;
;; Either "console", "file", "conn", "smtp" or "database", default is "console"
;; Use comma to separate multiple modes, e.g. "console, file"
-MODE = console
+MODE = console, file
;;
;; Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Trace"
LEVEL = Info
+43
View File
@@ -0,0 +1,43 @@
To setup Gitea, perform the following:
* Create a user and database for gitea (while granting rights)
* Start gitea.service
* Change the configuration under [server] in /etc/gitea/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/gitea/conf/app.ini afterwards.
You can create an admin user on the console by running:
su - git
gitea --name admin --password somePassword --email some@email.com --admin
---
If you want to access gitea through httpd (apache), install the gitea-httpd
subpackage, and change /etc/httpd/conf.d/gitea.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.
<Location />
ProxyPass unix:/run/gitea/gitea.socket|http://127.0.0.1/
ProxyPassReverse unix:/run/gitea/gitea.socket|http://127.0.0.1/
</Location>
---
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-gitea.conf (EL9 and Fedora):
AcceptEnv GIT_PROTOCOL
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>Gitea</short>
<description>A painless self-hosted Git service.</description>
<port protocol="tcp" port="3000"/>
</service>
+50
View File
@@ -0,0 +1,50 @@
# ENSURE YOU SET YOUR ROOT_URL CORRECTLY AFTER MAKING CHANGES
# Virtual Host Examples
# <VirtualHost *:80>
# ServerName git.example.com
# ServerAlias git.example.com
# ProxyPreserveHost On
# ProxyRequests Off
# AllowEncodedSlashes NoDecode
# ProxyPass / http://localhost:3000/ nocanon
# ProxyPassReverse / http://localhost:3000/ nocanon
# </VirtualHost>
#
# <VirtualHost *:443>
# 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
# </VirtualHost>
# This is if you're using sockets
# <VirtualHost *:443>
# SSLEngine on
# ServerName git.example.com
# DocumentRoot /var/www/html
# <Location />
# ProxyPass unix:/run/gitea/gitea.socket|http://127.0.0.1/
# ProxyPassReverse unix:/run/gitea/gitea.socket|http://127.0.0.1/
# </Location>
# </VirtualHost>
# Examples of using /git
#<Location /git>
# Require all granted
# ProxyPass http://localhost:3000
# ProxyPassReverse http://localhost:3000
#</Location>
#<Location /git>
# Require all granted
# ProxyPass https://some.git.com:3000
# ProxyPassReverse https://some.git.com:3000
#</Location>
+36
View File
@@ -0,0 +1,36 @@
# Gitea Service File (part of the gitea 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/gitea.service.d/ with your override files.
[Unit]
Description=Gitea (Git with a cup of tea)
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/gitea/
ExecStart=/usr/bin/gitea web --config /etc/gitea/conf/app.ini
Restart=always
Environment=USER=git HOME=/usr/share/gitea GITEA_WORK_DIR=/var/lib/gitea
# If you plan on binding Gitea 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
+167
View File
@@ -0,0 +1,167 @@
%global major_version 1
%global minor_version 16
%global micro_version 1
# Default support for sqlite and pam (not provided by upstream by default)
%global gitea_tags "sqlite sqlite_unlock_notify pam"
%define debug_package %{nil}
Name: gitea
Version: 1.16.1
Release: 1%{?dist}
Summary: A painless self-hosted Git service
License: MIT
URL: https://gitea.io
Source0: https://github.com/go-gitea/gitea/releases/download/v%{version}/gitea-src-%{version}.tar.gz
Source1: https://github.com/go-gitea/gitea/releases/download/v%{version}/gitea-docs-%{version}.tar.gz
Source2: gitea.service
Source3: gitea.firewalld
Source4: README.EL+Fedora
Source5: gitea.httpd
Patch1: 0001-gitea.app.ini.patch
BuildRequires: systemd
BuildRequires: go >= 1.16.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
Requires(post): systemd
Requires(postun): systemd
Requires(preun): systemd
Conflicts: git-web
# Suggesting httpd for now
Suggests: httpd
%description
A painless self-hosted Git service.
Gitea is a community managed fork of Gogs. A lightweight code hosting solution
written in Go and published under the MIT license.
%package httpd
Summary: Apache (httpd) configuration for %{name}
Requires: httpd
%description httpd
This subpackage contains Apache configuration files that can be used to reverse
proxy for Gitea.
#%package nginx
#%description nginx
%package docs
Summary: Documentation for %{name}
%description docs
This subpackage contains the Gitea documentation from https://docs.gitea.io
%prep
%setup -q -c
%patch1 -p1
install -m 0644 %{SOURCE4} .
for file in $(find . -type f - name "*.css"); do
chmod -x ${file}
done
%build
export TAGS="%{gitea_tags}"
export LDFLAGS="-s -w -X \"main.Version=%{version}\" -X \"code.gitea.io/gitea/modules/setting.CustomPath=/etc/gitea\" -X \"code.gitea.io/gitea/modules/setting.AppWorkPath=/var/lib/gitea\""
# Probably not needed, but just in case I guess.
TAGS="${TAGS}" LDFLAGS="${LDFLAGS}" make build
%install
install -D -m 755 gitea $RPM_BUILD_ROOT%{_bindir}/gitea
install -D -m 644 %{SOURCE2} $RPM_BUILD_ROOT/%{_unitdir}/gitea.service
install -D -m 644 custom/conf/app.example.ini $RPM_BUILD_ROOT%{_sysconfdir}/gitea/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
mkdir -p $RPM_BUILD_ROOT%{_datadir}/gitea \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/data \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/data/lfs \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/data/tmp \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/data/tmp/uploads \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/data/tmp/pprof \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/data/sessions \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/data/avatars \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/data/attachments \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/data/repo-avatars \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/indexers \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/indexers/issues.bleve \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/indexers/issues.queue \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/indexers/repos.bleve \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/queues \
$RPM_BUILD_ROOT%{_localstatedir}/lib/gitea/repositories \
$RPM_BUILD_ROOT%{_localstatedir}/log/gitea \
$RPM_BUILD_ROOT%{_sysconfdir}/gitea/conf \
$RPM_BUILD_ROOT%{_sysconfdir}/gitea/https \
$RPM_BUILD_ROOT%{_sysconfdir}/gitea/mailer
cp -r options $RPM_BUILD_ROOT%{_datadir}/gitea/
cp -r public $RPM_BUILD_ROOT%{_datadir}/gitea/
cp -r templates $RPM_BUILD_ROOT%{_datadir}/gitea/
cp -r web_src/less $RPM_BUILD_ROOT%{_datadir}/gitea/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 <<EOF
d /run/gitea 0755 git git -
EOF
%pre
# Not official
%{_sbindir}/groupadd -r git 2>/dev/null || :
%{_sbindir}/useradd -r -g git \
-s /sbin/nologin -d %{_datadir}/%{name} \
-c 'Gitea' git 2>/dev/null || :
%preun
%systemd_preun %{name}.service
%post
%systemd_post %{name}.service
systemd-tmpfiles --create %{name}.conf || :
%files
%doc README.EL+Fedora README.md custom/conf/app.example.ini
%license LICENSE
%exclude %{_datadir}/%{name}/docs.gitea.io
%{_unitdir}/gitea.service
%{_bindir}/gitea
%{_prefix}/lib/firewalld/services/%{name}.xml
%{_tmpfilesdir}/%{name}.conf
%defattr(0660,root,git,770)
%dir %{_sysconfdir}/gitea
%dir %{_sysconfdir}/gitea/conf
%dir %{_sysconfdir}/gitea/https
%dir %{_sysconfdir}/gitea/mailer
%dir %{_localstatedir}/log/gitea
%config(noreplace) %{_sysconfdir}/gitea/conf/app.ini
%defattr(0660,git,git,750)
%{_datadir}/gitea
%{_localstatedir}/lib/gitea
%files httpd
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
%files docs
%{_datadir}/%{name}/docs.gitea.io
%changelog
* Fri Feb 11 2022 Louis Abel <tucklesepk@gmail.com> - 1.16.1-1
- Initial release of 1.16.1 for Fedora and Enterprise Linux