summaryrefslogtreecommitdiffstats
path: root/SPECS/gitlab.spec
diff options
context:
space:
mode:
Diffstat (limited to 'SPECS/gitlab.spec')
-rw-r--r--SPECS/gitlab.spec62
1 files changed, 41 insertions, 21 deletions
diff --git a/SPECS/gitlab.spec b/SPECS/gitlab.spec
index 395f85f..7cb4f81 100644
--- a/SPECS/gitlab.spec
+++ b/SPECS/gitlab.spec
@@ -2,8 +2,8 @@
# add your specific settings here
%define app_name gitlab
-%define app_version 6.1.0
-%define gitlabshell_version 1.7.1
+%define app_version 6.2.3
+%define gitlabshell_version 1.7.6
%define ruby_version 1.9.3
# which bundle envs should not go into production?
@@ -67,22 +67,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(id -un)
This is gitlab
-%pre
-# Run before the package is installed.
-# Creates the user and group which will be used to run the
-# application.
-getent group %{git_user} > /dev/null || groupadd -r %{git_user}
-getent passwd %{git_user} > /dev/null || \
- useradd -m -g %{git_user} -d %{wwwdir} -s /bin/bash \
- -c "Rails Application %{name}" %{git_user}
-getent group %{git_user} | grep -q apache || usermod -a -G %{git_user} apache
-
-test -d %{wwwdir} || mkdir -p %{wwwdir}
-chown %{git_user}.%{git_user} %{wwwdir}
-chmod 0750 %{wwwdir}
-exit 0
-
-
%prep
# prepare the source to install it during the package building
# process.
@@ -186,11 +170,35 @@ cp -p -r gitlab/{.bundle,.git*} $RPM_BUILD_ROOT/%{wwwdir}/%{name}/
touch $RPM_BUILD_ROOT/%{wwwdir}/.ssh/authorized_keys
touch $RPM_BUILD_ROOT/%{wwwdir}/gitlab-shell/gitlab-shell.log
+# enable rack-attack
+cp -p -r $RPM_BUILD_ROOT/%{wwwdir}/%{name}/config/initializers/rack_attack.rb.example $RPM_BUILD_ROOT/%{wwwdir}/%{name}/config/initializers/rack_attack.rb
+sed 's/# config.middleware.use Rack::Attack/config.middleware.use Rack::Attack/' $RPM_BUILD_ROOT/%{wwwdir}/%{name}/config/application.rb
+
# fix shebangs
grep -sHE '^#!/usr/(local/)?bin/ruby' $RPM_BUILD_ROOT/%{wwwdir}/%{name}* -r | awk -F: '{ print $1 }' | uniq | while read line; do sed -i 's@^#\!/usr/\(local/\)\?bin/ruby@#\!%{ruby_bin}@' $line; done
grep -sHE '^#!/usr/bin/env ruby' $RPM_BUILD_ROOT/%{wwwdir}/%{name}* -r | awk -F: '{ print $1 }' | uniq | while read line; do sed -i 's@^#\!/usr/bin/env ruby@#\!%{ruby_bin}@' $line; done
grep -sHE '^#!/usr/bin/env rake' $RPM_BUILD_ROOT/%{wwwdir}/%{name}* -r | awk -F: '{ print $1 }' | uniq | while read line; do sed -i 's@^#\!/usr/bin/env rake@#\!%{ruby_bindir}/rake@' $line; done
+%pre
+# Run before the package is installed.
+# Creates the user and group which will be used to run the
+# application.
+getent group %{git_user} > /dev/null || groupadd -r %{git_user}
+getent passwd %{git_user} > /dev/null || \
+ useradd -m -g %{git_user} -d %{wwwdir} -s /bin/bash \
+ -c "Rails Application %{name}" %{git_user}
+getent group %{git_user} | grep -q apache || usermod -a -G %{git_user} apache
+
+test -d %{wwwdir} || mkdir -p %{wwwdir}
+chown %{git_user}.%{git_user} %{wwwdir}
+chmod 0750 %{wwwdir}
+
+/sbin/service %{name} status > /dev/null 2>&1 && \
+ /sbin/service %{name} stop > /dev/null 2>&1
+
+exit 0
+
+
%post
# Runs after the package got installed.
# Configure here any services etc.
@@ -216,12 +224,21 @@ for selinuxvariant in %{selinux_variants}; do
done
/sbin/restorecon -R %{wwwdir}/.ssh
+if [ "$1" != "1" ] && [ -f %{wwwdir}/%{name}/config/database.yml ] && [ -f %{wwwdir}/%{name}/config/gitlab.yml ]; then
+ su %{git_user} -l -c "cd %{wwwdir}/%{name}; bundle exec rake db:migrate RAILS_ENV=production"
+ su %{git_user} -l -c "cd %{wwwdir}/%{name}; bundle exec rake assets:clean RAILS_ENV=production"
+ su %{git_user} -l -c "cd %{wwwdir}/%{name}; bundle exec rake assets:precompile RAILS_ENV=production"
+ su %{git_user} -l -c "cd %{wwwdir}/%{name}; bundle exec rake cache:clear RAILS_ENV=production"
+ /sbin/service %{name} restart > /dev/null 2>&1
+ /sbin/service httpd restart > /dev/null 2>&1
+fi
+
%preun
# Run before uninstallation
# $1 will be 1 if the package is upgraded
# and 0 if the package is deinstalled.
-if [ "$1" = 0 ] ; then
+if [ $1 -eq 0 ] ; then
/sbin/service %{name} stop > /dev/null 2>&1
/sbin/chkconfig --del %{name} || :
fi
@@ -232,14 +249,15 @@ fi
# and 0 if the package is deinstalled.
if [ $1 -eq 0 ] ; then
- userdel git
- groupdel git
+ userdel %{git_user}
+ groupdel %{git_user}
for selinuxvariant in %{selinux_variants}; do
/usr/sbin/semodule -s ${selinuxvariant} -r gitlab &> /dev/null || :
done
fi
+
%files
# describe all the files that should be included in the package
%defattr(-,root,root,)
@@ -255,6 +273,8 @@ fi
%attr(-,%{git_user},%{git_user}) %{wwwdir}/gitlab-shell/gitlab-shell.log
# run application as dedicated user
%attr(-,%{git_user},%{git_user}) %{wwwdir}/%{name}/config.ru
+# db updates need to dump the schema
+%attr(-,%{git_user},%{git_user}) %{wwwdir}/%{name}/db/schema.rb
# allow write access to special directories
%attr(0770,%{git_user},%{git_user}) %{wwwdir}/%{name}/log
%attr(0770,%{git_user},%{git_user}) %{wwwdir}/%{name}/public