This repository has been archived on 2024-11-07. You can view files and clone it, but cannot push or open issues or pull requests.
gitlab-foss/gitlab-foss.spec

267 lines
10 KiB
RPMSpec
Raw Permalink Normal View History

# Based on Arch Linux PKGBUILD for 13.10.0
%define gitlab_uid 65434
%define gitlab_gid 65434
%define _use_internal_dependency_generator 0
Name: gitlab-foss
Version: 13.10.0
Release: 2mamba
Summary: A Web interface to create projects and repositories, manage access and do code reviews
Group: Applications/Web
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://www.gitlab.com/gitlab-foss/
Source: https://gitlab.com/gitlab-org/gitlab-foss.git/v%{version}/gitlab-foss-%{version}.tar.bz2
#Source: https://gitlab.com/gitlab-org/gitlab-ce.git/v%{version}/gitlab-ce-%{version}.tar.bz2
License: MIT
Source1: gitlab.target
Source2: gitlab-sidekiq.service
Source3: gitlab-unicorn.service
Source4: gitlab.logrotate
Source5: gitlab.tmpfiles.d
Source6: gitlab-apache-conf
Source7: gitlab-environment
Source8: gitlab-backup.service
Source9: gitlab-backup.timer
Source10: gitlab-mailroom.service
Source11: gitlab-puma.service
Patch0: gitlab-configs.patch
Patch1: gitlab-13.10.0-Gemfile-mimemagic-fix.patch
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libassuan-devel
BuildRequires: libffi-devel
BuildRequires: libgcc
BuildRequires: libgpg-error-devel
BuildRequires: libgpgme-devel
BuildRequires: libicu-devel
BuildRequires: liblzma-devel
BuildRequires: libopenssl-devel
BuildRequires: libperl
BuildRequires: libpostgresql-devel
BuildRequires: libre2-devel
BuildRequires: libruby-devel
BuildRequires: libssh2-devel
BuildRequires: libstdc++6-devel
BuildRequires: libz-devel
BuildRequires: perl-File-Find-Rule
BuildRequires: perl-IPC-Run3
BuildRequires: perl-devel
BuildRequires: perl-Parallel-Runner
## AUTOBUILDREQ-END
BuildRequires: ruby
BuildRequires: yarn
BuildRequires: go
BuildRequires: nodejs
Requires: ruby >= 1:2.7
Requires: ruby < 1:2.8
Requires: redis
Requires: postgresql
#Requires: apache
Requires: git
Requires(pre): gitlab-shell >= 13.17.0
Requires: gitlab-gitaly
Requires: gitlab-workhorse
Provides: gitlab
Obsoletes: gitlab < 13.10.0
Obsoletes: gitlab-ce < 13.10.0
%description
GitLab Community Edition (CE) is open source software to collaborate on code.
Create projects and repositories, manage access and do code reviews.
GitLab CE is on-premises software that you can install and use on your server(s).
%debug_package
%prep
%setup -q -n gitlab-foss-%{version} -D -T
:<< _EOF
%global __requires_exclude_from ^%{_datadir}/gitlab/vendor/.*$
%patch0 -p1
%patch1 -p1
cp config/gitlab.yml.example config/gitlab.yml
cp config/database.yml.postgresql config/database.yml
cp config/puma.rb.example config/puma.rb
cp config/resque.yml.example config/resque.yml
cp config/secrets.yml.example config/secrets.yml
cp config/initializers/smtp_settings.rb.sample config/initializers/smtp_settings.rb
# https://github.com/bundler/bundler/issues/6882
sed -e '/BUNDLED WITH/,+1d' -i Gemfile.lock
bundle lock --update=bundler-audit
# 'lock' adds 'BUNDLED WITH' back. Remove it again.
sed -e '/BUNDLED WITH/,+1d' -i Gemfile.lock
%build
:<< _EOF
echo "Fetching bundled gems..."
# Gems will be installed into vendor/bundle
bundle config build.gpgme --use-system-libraries
bundle config force_ruby_platform true
bundle install --jobs=$(nproc) --no-cache --deployment --without development test aws kerberos
yarn install --production --pure-lockfile
bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_ENV=production NODE_OPTIONS="--max_old_space_size=4096"
bundle exec rake gettext:compile RAILS_ENV=production
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%define homedir %{_localstatedir}/lib/gitlab
install -d %{buildroot}%{_datadir}/gitlab
cp -r * %{buildroot}%{_datadir}/gitlab/
cp -r .[a-zA-Z0-9]* %{buildroot}%{_datadir}/gitlab/
# Remove unneeded directories: node_modules is only needed during build
rm -r %{buildroot}%{_datadir}/gitlab/node_modules
for dir in spec qa rubocop app/assets vendor/assets; do
rm -r %{buildroot}%{_datadir}/gitlab/${dir}
done
rm -r %{buildroot}%{_datadir}/gitlab/{builds,tmp,log,shared}
install -d \
%{buildroot}%{_datadir}/gitlab \
%{buildroot}%{homedir}/shared/{artifacts,lfs-objects} \
%{buildroot}%{homedir}/builds \
%{buildroot}%{homedir}/uploads \
%{buildroot}%{homedir}/backups \
%{buildroot}%{_sysconfdir}/gitlab \
%{buildroot}%{_localstatedir}/log/gitlab \
%{buildroot}%{_docdir}/gitlab \
# Rails app hardcodes/configures by default that data is stored under $_appdir
# Create symlinks that point to data directories under /var
ln -fs %{_localstatedir}/log/gitlab %{buildroot}%{_datadir}/gitlab/log
ln -fs ../../..%{homedir}/builds %{buildroot}%{_datadir}/gitlab/builds
ln -fs ../../..%{homedir}/tmp %{buildroot}%{_datadir}/gitlab/tmp
mkdir -p %{buildroot}%{homedir}/tmp/backups
ln -fs ../../../..%{homedir}/uploads %{buildroot}%{_datadir}/gitlab/public/uploads
ln -fs ../../..%{homedir}/shared %{buildroot}%{_datadir}/gitlab/shared
# TODO: workhorse and shell secret files are the application data and should be stored under /var/lib/gitlab
ln -fs ../../..%{_sysconfdir}/gitlab/gitlab_workhorse_secret %{buildroot}%{_datadir}/gitlab/.gitlab_workhorse_secret
ln -fs ../../..%{_sysconfdir}/gitlab/gitlab-shell-secret %{buildroot}%{_datadir}/gitlab/.gitlab_shell_secret
# Install config files
for config_file in gitlab.yml database.yml puma.rb resque.yml secrets.yml; do
cp config/${config_file} %{buildroot}%{_sysconfdir}/gitlab/
# TODO: configure rails app to use configs right from /etc
ln -fs ../../../..%{_sysconfdir}/gitlab/${config_file} %{buildroot}%{_datadir}/gitlab/config/
done
cp config/initializers/smtp_settings.rb %{buildroot}%{_sysconfdir}/gitlab/
ln -fs ../../../../..%{_sysconfdir}/gitlab/smtp_settings.rb %{buildroot}%{_datadir}/gitlab/config/initializers/smtp_settings.rb
# Install secrets symlink
# TODO: ruby uses _appdir to load config files. Figure out if we can load files directly from /etc
ln -fs ../../../..%{_sysconfdir}/gitlab/secrets.yml %{buildroot}%{_datadir}/gitlab/config/secrets.yml
install -Dm644 %{SOURCE7} %{buildroot}%{_datadir}/gitlab/environment
# Install systemd service files
install -D -m0644 %{S:1} %{buildroot}%{_unitdir}/gitlab.target
install -D -m0644 %{S:2} %{buildroot}%{_unitdir}/gitlab-sidekiq.service
install -D -m0644 %{S:3} %{buildroot}%{_unitdir}/gitlab-unicorn.service
install -D -m0644 %{S:8} %{buildroot}%{_unitdir}/gitlab-backup.service
install -D -m0644 %{S:9} %{buildroot}%{_unitdir}/gitlab-backup.timer
install -D -m0644 %{S:10} %{buildroot}%{_unitdir}/gitlab-mailroom.service
install -D -m0644 %{S:11} %{buildroot}%{_unitdir}/gitlab-puma.service
install -D -m0644 %{S:4} %{buildroot}%{_sysconfdir}/logrotate.d/gitlab.logrotate
install -D -m0644 %{S:5} %{buildroot}%{_tmpfilesdir}/gitlab.conf
install -D -m0644 %{S:6} %{buildroot}%{_sysconfdir}/httpd/httpd.d/gitlab.conf.example
# Fix weird shebang causing weird require
sed -i "s|#!/this/.*|#!/usr/bin/ruby|" %{buildroot}%{_datadir}/gitlab/vendor/bundle/ruby/*/gems/unicorn-*/bin/unicorn*
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%preun
%systemd_preun gitlab.target
:
%post
%systemd_post gitlab.target
if [ $1 -eq 1 ]; then
echo "Configure your /etc/gitlab/gitlab.yml"
echo "Set up your redis to run on /run/redis/redis.sock or configure gitlab to use redis TCP"
echo "Put a secret bytestring to /etc/gitlab/secret"
echo "Configure /etc/webapps/gitlab/secrets.yml"
echo "Setup the database:"
echo "$ (cd /usr/share/gitlab && sudo -u gitlab \$(cat environment | xargs) bundle exec rake gitlab:setup)"
echo "Finally run the following commands to check your installation:"
echo "$ (cd /usr/share/gitlab && sudo -u gitlab \$(cat environment | xargs) bundle exec rake gitlab:env:info)"
echo "$ (cd /usr/share/gitlab && sudo -u gitlab \$(cat environment | xargs) bundle exec rake gitlab:check)"
#sudo -u gitlab -H git config --global user.name "GitLab"
#sudo -u gitlab -H git config --global user.email "gitlab@localhost"
#sudo -u gitlab -H git config --global core.autocrlf input
#echo "Create and configure database in /etc/gitlab/database.yml"
#echo "Then run 'sudo -u gitlab bundle exec rake gitlab:setup RAILS_ENV=production'"
#echo
fi
if [ $1 -gt 1 ]; then
echo "You should upgrade your database:"
echo "$ (cd /usr/share/gitlab && sudo -u gitlab \$(cat environment | xargs) bundle exec rake db:migrate)"
echo "Afterwards, restart gitlab-related services:"
echo "# systemctl daemon-reload"
echo "# systemctl restart gitlab-sidekiq gitlab-puma gitlab-workhorse gitlab-gitaly"
fi
:
%postun
%systemd_postun_with_restart gitlab.target
:
%files
%defattr(-,root,root)
%dir %{_sysconfdir}/gitlab
%config(noreplace) %{_sysconfdir}/gitlab/database.yml
%config(noreplace) %{_sysconfdir}/gitlab/gitlab.yml
%config(noreplace) %{_sysconfdir}/gitlab/puma.rb
%config(noreplace) %{_sysconfdir}/gitlab/resque.yml
%config(noreplace) %{_sysconfdir}/gitlab/secrets.yml
%config(noreplace) %{_sysconfdir}/gitlab/smtp_settings.rb
%{_sysconfdir}/httpd/httpd.d/gitlab.conf.example
%{_sysconfdir}/logrotate.d/gitlab.logrotate
%{_unitdir}/gitlab-backup.service
%{_unitdir}/gitlab-backup.timer
%{_unitdir}/gitlab-mailroom.service
%{_unitdir}/gitlab-puma.service
%{_unitdir}/gitlab-sidekiq.service
%{_unitdir}/gitlab-unicorn.service
%{_unitdir}/gitlab.target
%{_tmpfilesdir}/gitlab.conf
%{_datadir}/gitlab
%dir %attr(0750,gitlab,gitlab) %{homedir}/builds
%dir %attr(0700,gitlab,gitlab) %{homedir}/uploads
%dir %attr(0750,gitlab,gitlab) %{homedir}/shared
%dir %attr(0750,gitlab,gitlab) %{homedir}/shared/artifacts
%dir %attr(0750,gitlab,gitlab) %{homedir}/shared/lfs-objects
%dir %attr(0750,gitlab,gitlab) %{homedir}/tmp
%dir %attr(0750,gitlab,gitlab) %{homedir}/tmp/backups
%doc LICENSE
%changelog
* Mon Mar 29 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 13.10.0-2mamba
- various fixes after testing
* Sun Mar 28 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 13.10.0-1mamba
- update to 13.10.0
* Sat Nov 21 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 8.1.4-1mamba
- update to 8.1.4
* Tue Jul 08 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 6.9.2-1mamba
- update to 6.9.2
* Sun May 25 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 6.9.0-1mamba
- package created using the webbuild interface