7 Commits

Author SHA1 Message Date
641ac4adb6 fix: forgejo web command
Some checks failed
Continuous Delivery / build_n_upload (push) Has been cancelled
2026-03-03 01:34:18 +01:00
bb55579880 fix: usermod command syntax
Some checks failed
Continuous Delivery / build_n_upload (push) Has been cancelled
2026-03-03 01:28:21 +01:00
c4adafb535 fix: add folders in make instal
Some checks failed
Continuous Delivery / build_n_upload (push) Has been cancelled
2026-03-03 01:11:39 +01:00
c0de29a266 feat: replace gitea by forgejo 2026-03-03 01:09:48 +01:00
e19760d37e fix: typo in spec
Some checks failed
Continuous Delivery / build_n_upload (push) Has been cancelled
2026-03-01 17:03:10 +01:00
89837bef2b fix: remove wget output
Some checks failed
Continuous Delivery / build_n_upload (push) Has been cancelled
2026-03-01 16:56:47 +01:00
3334a877d7 fix: group not exists
Some checks failed
Continuous Delivery / build_n_upload (push) Has been cancelled
2026-03-01 16:45:01 +01:00
6 changed files with 40 additions and 100 deletions

View File

@@ -3,6 +3,7 @@ VERSION = $(shell git describe --abbrev=0)
RELEASE = $(shell git rev-parse --short HEAD) RELEASE = $(shell git rev-parse --short HEAD)
REFERENCE = $(if $(GIT_REFERENCE),$(GIT_REFERENCE),$(shell git branch --show-current)) REFERENCE = $(if $(GIT_REFERENCE),$(GIT_REFERENCE),$(shell git branch --show-current))
ARCH = noarch ARCH = noarch
OWNER = samuel
RPM_RPMDIR = $(shell rpm --eval '%{_rpmdir}') RPM_RPMDIR = $(shell rpm --eval '%{_rpmdir}')
RPM_SBINDIR = $(shell rpm --eval '%{_sbindir}') RPM_SBINDIR = $(shell rpm --eval '%{_sbindir}')
@@ -16,26 +17,30 @@ RPM_BUILD_PATH = $(RPM_RPMDIR)/$(BUILD_ARCH)/$(NAME)-$(VERSION)-$(RELEASE).$(BUI
.PHONY: name .PHONY: name
name: name:
@echo "$(NAME)" @echo $(NAME)
.PHONY: version .PHONY: version
version: version:
@echo "$(VERSION)" @echo $(VERSION)
.PHONY: release .PHONY: release
release: release:
@echo "$(RELEASE)" @echo $(RELEASE)
.PHONY: arch .PHONY: arch
arch: arch:
@echo "$(ARCH)" @echo $(ARCH)
.PHONY: owner
owner:
@echo $(OWNER)
.PHONY: install .PHONY: install
install: install:
install --mode=755 --directory $(DESTDIR)$(RPM_SYSCONFDIR)/gitea $(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d $(DESTDIR)$(RPM_UNITDIR) $(DESTDIR)$(RPM_SHAREDSTATEDIR)/actrunners install --mode=755 --directory $(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d $(DESTDIR)$(RPM_SYSCONFDIR)/forgejo/conf $(DESTDIR)$(RPM_UNITDIR)/forgejo.service.d
install --mode=644 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d/ files/nginx/git.netoik.io.conf install --mode=644 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/nginx/conf.d/ files/nginx/git.netoik.io.conf
install --mode=640 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/gitea files/gitea/app.ini install --mode=640 --target-directory=$(DESTDIR)$(RPM_SYSCONFDIR)/forgejo/conf files/forgejo/netoik_app.ini
install --mode=644 --target-directory=$(DESTDIR)$(RPM_UNITDIR) files/systemd/gitea.service files/systemd/actrunner@.service install --mode=644 --target-directory=$(DESTDIR)$(RPM_UNITDIR)/forgejo.service.d files/systemd/forgejo.conf
$(RPM_TARBALL_PATH): * $(RPM_TARBALL_PATH): *
git archive --format=tar.gz \ git archive --format=tar.gz \
@@ -49,6 +54,4 @@ tarball: $(RPM_TARBALL_PATH)
.PHONY: upload .PHONY: upload
upload: upload:
curl --fail-with-body --upload-file "$(RPM_BUILD_PATH)" --user "$(GIT_PACKAGES_USERNAME):$(GIT_PACKAGES_TOKEN)" https://git.netoik.io/api/packages/$(GIT_PACKAGES_USERNAME)/rpm/upload curl --fail-with-body --upload-file "$(RPM_BUILD_PATH)" --user "$(OWNER):$(GIT_PACKAGES_TOKEN)" https://git.netoik.io/api/packages/$(OWNER)/rpm/upload

View File

@@ -2,9 +2,9 @@
# See official doc here: https://docs.gitea.com/next/administration/config-cheat-sheet # See official doc here: https://docs.gitea.com/next/administration/config-cheat-sheet
APP_NAME = Netoïk Git Server APP_NAME = Netoïk Git Server
RUN_USER = gitea RUN_USER = forgejo
RUN_MODE = prod RUN_MODE = prod
WORK_PATH = /var/lib/gitea WORK_PATH = /var/lib/forgejo
[server] [server]
DOMAIN = git.netoik.io DOMAIN = git.netoik.io
@@ -17,8 +17,8 @@ SSH_PORT = 22222
[database] [database]
DB_TYPE = postgres DB_TYPE = postgres
HOST = /run/postgresql HOST = /run/postgresql
NAME = gitea NAME = forgejo
USER = gitea USER = forgejo
[security] [security]
INSTALL_LOCK = true INSTALL_LOCK = true

View File

@@ -1,17 +0,0 @@
[Unit]
Description=Gitea Actions runner #%i
Documentation=https://gitea.com/gitea/act_runner
After=network.target gitea.service
[Service]
ExecStartPre=/usr/bin/rpmdev-setuptree
ExecStart=/usr/local/bin/act_runner daemon
ExecReload=/bin/kill -s HUP $MAINPID
WorkingDirectory=/var/lib//actrunners/actrunner%i
TimeoutSec=0
RestartSec=10
Restart=always
User=actrunner%i
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,3 @@
[Service]
ExecStart=
ExecStart=/usr/bin/forgejo web --config /etc/forgejo/conf/netoik_app.ini

View File

@@ -1,15 +0,0 @@
[Unit]
Description=Gitea (Git with a cup of tea)
After=network.target postgresql.service valkey.service
[Service]
RestartSec=2s
Type=simple
User=gitea
Group=gitea
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
[Install]
WantedBy=multi-user.target

View File

@@ -5,15 +5,15 @@ Version: %(make version)
Release: %(make release) Release: %(make release)
Summary: Netoik Reverse Proxy Summary: Netoik Reverse Proxy
License: MIT License: MIT
URL: https://git.netoik.io/samuel/%(make name) URL: https://git.netoik.io/%(make owner)/%(make name)
Source0: %{name}-%{version}-%{release}.tar.gz Source0: %{name}-%{version}-%{release}.tar.gz
Buildarch: %(make arch) Buildarch: %(make arch)
BuildRequires: make BuildRequires: make
Requires: netoik-rp netoik-db netoik-cache git Requires: netoik-rp netoik-db netoik-cache forgejo
%description %description
Install the Git UI server called Gitea. Install the Git UI server called Forgejo (fork of Gitea).
%prep %prep
%autosetup -v %autosetup -v
@@ -21,65 +21,31 @@ Install the Git UI server called Gitea.
%install %install
%make_install %make_install
%pre
# Create gitea user
useradd --system --create-home --bade-dir %{_sharedstatedir} gitea
runuser --user gitea -- mkdir --parents %{_sharedstatedir}/gitea/{data,custom}
%post %post
# Download gitea bin and verify gpg signature # Change rights on config file
wget --output-document %{_tmppath}/gitea "$GITEA_BIN_URL" chgrp forgejo %{_sysconfdir}/forgejo/conf/netoik_app.ini
wget --output-document %{_tmppath}/gitea.asc "$GITEA_ASC_URL"
gpg --keyserver "$GITEA_GPG_KEYSERVER" --recv "$GITEA_GPG_RECV"
gpg --verify %{_tmppath}/gitea.asc %{_tmppath}/gitea
mv %{_tmppath}/gitea %{_sbindir}
chmod 755 %{_sbindir}/gitea
rm %{_tmppath}/gitea.asc
# Generate internal token and secret key # Add user forgejo to db groups
INTERNAL_TOKEN="$(gitea generate secret INTERNAL_TOKEN)" usermod --groups postgres,valkey --append forgejo
SECRET_KEY="$(gitea generate secret SECRET_KEY)"
envsubst < %{_sysconfdir}/gitea/app.ini > %{_sysconfdir}/gitea/app.ini.new
mv %{_sysconfdir}/gitea/app.ini.new %{_sysconfdir}/gitea/app.ini
chgrp gitea %{_sysconfdir}/gitea/app.ini
chmod 640 %{_sysconfdir}/gitea/app.ini
# Start gitea service # Create postgres user and db
systemctl daemon-reload if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet forgejo; then
systemctl reenable gitea.service runuser --user=postgres -- createuser forgejo
systemctl restart gitea.service runuser --user=postgres -- createdb --owner=forgejo forgejo
# Create actrunners
for i in $(seq 1 $GITEA_ACT_RUNNERS); do
if ! id "actrunner$i"; then
useradd --system --create-home --base-dir %{_sharedstatedir}/actrunners "actrunner$i"
systemctl daemon-reload
systemctl reenable "actrunner@$i"
systemctl restart "actrunner@$i"
fi
done
%preun
# Backup gitea data in case of problem
runuser --user gitea -- gitea dump --config %{_sysconfdir}/gitea/app.ini --tempdir %{_tmppath}
%postun
# Remove gitea user after uninstall
if [ %1 == 0 ]; then
systemctl stop gitea.service
userdel --force --remove gitea
fi fi
# Restart forgejo and nginx services
systemctl daemon-reload
systemctl reenable forgejo.service
systemctl restart forgejo.service
systemctl restart nginx.service
%files %files
%attr(640, root, -) %{_sysconfdir}/forgejo/conf/netoik_app.ini
%attr(644, root, root) %{_sysconfdir}/nginx/conf.d/git.netoik.io.conf %attr(644, root, root) %{_sysconfdir}/nginx/conf.d/git.netoik.io.conf
%dir %attr(755, root, root) %{_sysconfdir}/gitea %dir %attr(755, root, root) %{_unitdir}/forgejo.service.d
%attr(640, root, gitea) %{_sysconfdir}/gitea/app.ini %attr(644, root, root) %{_unitdir}/forgejo.service.d/forgejo.conf
%attr(644, root, root) %{_unitdir}/gitea.service
%attr(644, root, root) %{_unitdir}/actrunner@.service
%dir %attr(755, root, root) %{_sharedstatedir}/actrunners
%changelog %changelog
%autochangelog %autochangelog