%global debug_package %{nil} Name: repogoon Version: 0.3.20260111 Release: 2 Summary: Self-hosted Git repository hosting platform BuildArch: %{_target_cpu} License: MPL-2.0 Source0: %{name}-%{version}.tar.gz BuildRequires: nodejs BuildRequires: nodejs-npm BuildRequires: systemd-rpm-macros Requires: nodejs Requires: nodejs-npm Requires: git-core Requires(pre): shadow-utils Requires(post): systemd Requires(preun): systemd Requires(postun): systemd # Optional dependencies Recommends: nginx Recommends: certbot Suggests: sqlite Suggests: postgresql-server Suggests: mariadb-server %description RepoGoon is a self-hosted Git repository hosting platform built with Node.js and Express. Features include: - Multiple database backends (SQLite, PostgreSQL, MySQL, Oracle, Convex) - YAML-based configuration - LDAP and OIDC authentication support - Dynamic rate limiting - Built-in web interface - CLI management tool (rgoon-ctl) %prep %setup -q %build # Install all dependencies (including dev) for building npm ci # Rebuild native modules from source to avoid glibc compatibility issues npm rebuild # Build the frontend npm run build # Remove dev dependencies for production npm prune --omit=dev %install # Create directories install -d %{buildroot}%{_datadir}/%{name} install -d %{buildroot}%{_sysconfdir}/%{name} install -d %{buildroot}%{_localstatedir}/lib/%{name} install -d %{buildroot}%{_localstatedir}/lib/%{name}/repos install -d %{buildroot}%{_localstatedir}/lib/%{name}/avatars install -d %{buildroot}%{_localstatedir}/log/%{name} install -d %{buildroot}%{_bindir} install -d %{buildroot}%{_unitdir} install -d %{buildroot}%{_sysconfdir}/nginx/conf.d # Copy application files cp -r server %{buildroot}%{_datadir}/%{name}/ cp -r dist %{buildroot}%{_datadir}/%{name}/ cp -r node_modules %{buildroot}%{_datadir}/%{name}/ cp package.json %{buildroot}%{_datadir}/%{name}/ # Install nginx template install -d %{buildroot}%{_datadir}/%{name}/nginx install -m 0644 nginx/repogoon.conf.template %{buildroot}%{_datadir}/%{name}/nginx/ # Install configuration file (as default template) install -m 0640 config.yml %{buildroot}%{_sysconfdir}/%{name}/config.yml.default # Only create config.yml if it doesn't exist (handled in %post) # Install CLI tool install -m 0755 rgoon-ctl %{buildroot}%{_bindir}/rgoon-ctl # Create symlink for config ln -sf %{_sysconfdir}/%{name}/config.yml %{buildroot}%{_datadir}/%{name}/config.yml # Create symlinks for data directories ln -sf %{_localstatedir}/lib/%{name}/repos %{buildroot}%{_datadir}/%{name}/repos install -d %{buildroot}%{_datadir}/%{name}/public ln -sf %{_localstatedir}/lib/%{name}/avatars %{buildroot}%{_datadir}/%{name}/public/avatars # Install systemd service file install -d %{buildroot}/usr/lib/systemd/system install -m 0644 repogoon.service %{buildroot}/usr/lib/systemd/system/repogoon.service # Create environment file template cat > %{buildroot}%{_sysconfdir}/%{name}/environment << 'EOF' # RepoGoon environment variables # Uncomment and modify as needed # NODE_ENV=production # REPOGOON_CONFIG=/etc/repogoon/config.yml EOF %pre # Create repogoon user and group getent group repogoon >/dev/null || groupadd -r repogoon getent passwd repogoon >/dev/null || \ useradd -r -g repogoon -d %{_localstatedir}/lib/%{name} \ -s /sbin/nologin -c "RepoGoon service account" repogoon exit 0 %post %systemd_post %{name}.service # Config file handling CONFIG_FILE=%{_sysconfdir}/%{name}/config.yml DEFAULT_CONFIG=%{_sysconfdir}/%{name}/config.yml.default if [ $1 -eq 1 ]; then # First install - copy default config if [ ! -f "$CONFIG_FILE" ]; then cp "$DEFAULT_CONFIG" "$CONFIG_FILE" chown repogoon:repogoon "$CONFIG_FILE" chmod 0640 "$CONFIG_FILE" fi # Set ownership on first install chown -R repogoon:repogoon %{_localstatedir}/lib/%{name} chown -R repogoon:repogoon %{_localstatedir}/log/%{name} echo "" echo "==========================================" echo " RepoGoon installed successfully!" echo "==========================================" echo "" echo "Next steps:" echo " 1. Configure: sudo rgoon-ctl --setup" echo " 2. Start: sudo systemctl start repogoon" echo " 3. Enable on boot: sudo systemctl enable repogoon" echo "" echo "Configuration: /etc/repogoon/config.yml" echo "Data directory: /var/lib/repogoon" echo "Logs: journalctl -u repogoon" echo "" elif [ $1 -ge 2 ]; then # Upgrade - merge new options into existing config if [ -f "$CONFIG_FILE" ] && [ -f "$DEFAULT_CONFIG" ]; then # Check if yq is available for smart merging if command -v yq &> /dev/null; then # Create backup cp "$CONFIG_FILE" "$CONFIG_FILE.bak.$(date +%%Y%%m%%d%%H%%M%%S)" # Merge: default config provides new keys, existing config provides values # This adds any new keys from default while preserving user's existing values TEMP_CONFIG=$(mktemp) yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' "$DEFAULT_CONFIG" "$CONFIG_FILE" > "$TEMP_CONFIG" 2>/dev/null if [ $? -eq 0 ] && [ -s "$TEMP_CONFIG" ]; then cat "$TEMP_CONFIG" > "$CONFIG_FILE" echo "Config updated: new options merged, existing values preserved" else echo "Config merge skipped: check $DEFAULT_CONFIG for new options" fi rm -f "$TEMP_CONFIG" else # yq not available - notify user to check for new options echo "" echo "NOTE: New configuration options may be available." echo "Compare your config with: $DEFAULT_CONFIG" echo "Or install 'yq' for automatic config merging on future updates." echo "" fi fi fi %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service # Remove user/group on complete uninstall if [ $1 -eq 0 ]; then userdel repogoon 2>/dev/null || : groupdel repogoon 2>/dev/null || : fi %files %license LICENSE %doc README.md # Application %dir %{_datadir}/%{name} %{_datadir}/%{name}/server %{_datadir}/%{name}/dist %{_datadir}/%{name}/node_modules %{_datadir}/%{name}/package.json %{_datadir}/%{name}/nginx %{_datadir}/%{name}/config.yml %{_datadir}/%{name}/repos %{_datadir}/%{name}/public # CLI tool %{_bindir}/rgoon-ctl # Configuration %dir %{_sysconfdir}/%{name} %config(noreplace) %attr(0640,root,repogoon) %{_sysconfdir}/%{name}/config.yml.default %ghost %config(noreplace) %attr(0640,root,repogoon) %{_sysconfdir}/%{name}/config.yml %config(noreplace) %{_sysconfdir}/%{name}/environment # Systemd /usr/lib/systemd/system/%{name}.service # Data directories %dir %attr(0755,repogoon,repogoon) %{_localstatedir}/lib/%{name} %dir %attr(0755,repogoon,repogoon) %{_localstatedir}/lib/%{name}/repos %dir %attr(0755,repogoon,repogoon) %{_localstatedir}/lib/%{name}/avatars %dir %attr(0755,repogoon,repogoon) %{_localstatedir}/log/%{name} %changelog * Sat Jan 11 2026 Package Maintainer - 0.3.20260111-1 - Added Convex serverless backend support - Completed Oracle database driver implementation - Added smart config merging on updates (preserves user settings) - Fixed nginx template for modern nginx (http2 on directive) - Fixed yaml_set to handle types correctly - Fixed nginx config path detection for CentOS/RHEL - Added current password verification for password changes * Fri Jan 10 2026 Package Maintainer - 0.3.20260109-1 - Added YAML configuration system - Added multi-database support (SQLite, PostgreSQL, MySQL, Oracle, Convex) - Added rgoon-ctl CLI management tool - Added LDAP and OIDC authentication support - Added Let's Encrypt auto-renewal support - Added dynamic rate limiting from database - Added RPM packaging with systemd service