File rocketgit.spec renamed from rocketgit.spec.in (similarity 63%) (mode: 100644) (index 9490b70..1ab789c) |
5 |
5 |
%{?systemd_requires} |
%{?systemd_requires} |
6 |
6 |
|
|
7 |
7 |
Summary: Light and fast Git hosting solution |
Summary: Light and fast Git hosting solution |
8 |
|
Name: @PRJ@ |
|
9 |
|
Version: @VER@ |
|
10 |
|
Release: @REV@ |
|
|
8 |
|
Name: rocketgit |
|
9 |
|
Version: 0.74 |
|
10 |
|
Release: 1 |
11 |
11 |
License: AGPLv3+ |
License: AGPLv3+ |
12 |
12 |
Group: Development/Tools |
Group: Development/Tools |
13 |
13 |
Source: http://kernel.embedromix.ro/us/rocketgit/%{name}-%{version}.tar.gz |
Source: http://kernel.embedromix.ro/us/rocketgit/%{name}-%{version}.tar.gz |
|
... |
... |
for type in %{selinux_variants} |
47 |
47 |
do |
do |
48 |
48 |
[ -r /tmp/rgsdebug ] && echo "Installing module ${type}..." |
[ -r /tmp/rgsdebug ] && echo "Installing module ${type}..." |
49 |
49 |
/usr/sbin/semodule -s ${type} -i \ |
/usr/sbin/semodule -s ${type} -i \ |
50 |
|
@USR_SHARE@/selinux/${type}/@PRJ@.pp &> /dev/null || : |
|
|
50 |
|
/usr/share/selinux/${type}/rocketgit.pp &> /dev/null || : |
51 |
51 |
done |
done |
52 |
52 |
[ -r /tmp/rgsdebug ] && echo "fixfiles -R..." |
[ -r /tmp/rgsdebug ] && echo "fixfiles -R..." |
53 |
|
/sbin/fixfiles -R @PRJ@ restore || : |
|
|
53 |
|
/sbin/fixfiles -R rocketgit restore || : |
54 |
54 |
# restorecon is needed because fixfiles -R will not restore the locks! |
# restorecon is needed because fixfiles -R will not restore the locks! |
55 |
55 |
[ -r /tmp/rgsdebug ] && echo "restorecon -R..." |
[ -r /tmp/rgsdebug ] && echo "restorecon -R..." |
56 |
|
/sbin/restorecon -R @VAR_LIB@/@PRJ@ || : |
|
|
56 |
|
/sbin/restorecon -R /var/lib/rocketgit || : |
57 |
57 |
|
|
58 |
58 |
if [ $1 -ne 0 ]; then |
if [ $1 -ne 0 ]; then |
59 |
59 |
[ -r /tmp/rgsdebug ] && echo "Reloading xinetd..." |
[ -r /tmp/rgsdebug ] && echo "Reloading xinetd..." |
60 |
60 |
/usr/bin/systemctl reload xinetd &>/dev/null || : |
/usr/bin/systemctl reload xinetd &>/dev/null || : |
61 |
61 |
fi |
fi |
62 |
62 |
[ -r /tmp/rgsdebug ] && echo "systemd_post fpm..." |
[ -r /tmp/rgsdebug ] && echo "systemd_post fpm..." |
63 |
|
%systemd_post @PRJ@-fpm.service |
|
|
63 |
|
%systemd_post rocketgit-fpm.service |
64 |
64 |
[ -r /tmp/rgsdebug ] && echo "systemd_post builder..." |
[ -r /tmp/rgsdebug ] && echo "systemd_post builder..." |
65 |
|
%systemd_post @PRJ@-builder.service |
|
|
65 |
|
%systemd_post rocketgit-builder.service |
66 |
66 |
[ -r /tmp/rgsdebug ] && echo "systemd_post fs..." |
[ -r /tmp/rgsdebug ] && echo "systemd_post fs..." |
67 |
|
%systemd_post @PRJ@-fs.service |
|
|
67 |
|
%systemd_post rocketgit-fs.service |
68 |
68 |
[ -r /tmp/rgsdebug ] && echo "'post' done..." |
[ -r /tmp/rgsdebug ] && echo "'post' done..." |
69 |
69 |
|
|
70 |
70 |
%preun |
%preun |
71 |
|
%systemd_preun @PRJ@-fpm.service |
|
72 |
|
%systemd_preun @PRJ@-builder.service |
|
73 |
|
%systemd_preun @PRJ@-fs.service |
|
74 |
|
%systemd_preun @PRJ@-worker@\*.service |
|
|
71 |
|
%systemd_preun rocketgit-fpm.service |
|
72 |
|
%systemd_preun rocketgit-builder.service |
|
73 |
|
%systemd_preun rocketgit-fs.service |
|
74 |
|
%systemd_preun rocketgit-worker@\*.service |
75 |
75 |
|
|
76 |
76 |
%postun |
%postun |
77 |
77 |
if [ $1 = 0 ]; then |
if [ $1 = 0 ]; then |
78 |
78 |
for type in %{selinux_variants} |
for type in %{selinux_variants} |
79 |
79 |
do |
do |
80 |
|
/usr/sbin/semodule -s ${type} -r @PRJ@ &> /dev/null || : |
|
|
80 |
|
/usr/sbin/semodule -s ${type} -r rocketgit &> /dev/null || : |
81 |
81 |
done |
done |
82 |
|
/sbin/fixfiles -R @PRJ@ restore || : |
|
|
82 |
|
/sbin/fixfiles -R rocketgit restore || : |
83 |
83 |
fi |
fi |
84 |
|
%systemd_postun_with_restart @PRJ@-fpm.service |
|
85 |
|
%systemd_postun_with_restart @PRJ@-builder.service |
|
86 |
|
%systemd_postun_with_restart @PRJ@-fs.service |
|
87 |
|
%systemd_postun_with_restart @PRJ@-worker@\*.service |
|
|
84 |
|
%systemd_postun_with_restart rocketgit-fpm.service |
|
85 |
|
%systemd_postun_with_restart rocketgit-builder.service |
|
86 |
|
%systemd_postun_with_restart rocketgit-fs.service |
|
87 |
|
%systemd_postun_with_restart rocketgit-worker@\*.service |
88 |
88 |
|
|
89 |
89 |
%prep |
%prep |
90 |
90 |
%setup -q |
%setup -q |
|
... |
... |
rm -rf ${RPM_BUILD_ROOT} |
104 |
104 |
|
|
105 |
105 |
%files |
%files |
106 |
106 |
%defattr (-,root,root,0755) |
%defattr (-,root,root,0755) |
107 |
|
%dir @USR_SHARE@/@PRJ@ |
|
108 |
|
%doc README LICENSE TODO selinux/@PRJ@.* samples/* |
|
109 |
|
%attr(0700,rocketgit,rocketgit) %dir @ETC@/@PRJ@ |
|
110 |
|
@ETC@/@PRJ@/config.php.sample |
|
111 |
|
@ETC@/httpd/conf.d/rocketgit.conf.sample |
|
112 |
|
@ETC@/nginx/conf.d/rocketgit.conf.sample |
|
113 |
|
@ETC@/@PRJ@/worker-main.conf.sample |
|
114 |
|
%config(noreplace) @ETC@/@PRJ@/config.php |
|
115 |
|
%config(noreplace) @ETC@/@PRJ@/php-fpm.conf |
|
116 |
|
%config(noreplace) @ETC@/@PRJ@/pool.conf |
|
117 |
|
%config(noreplace) @ETC@/cron.d/rocketgit |
|
118 |
|
%config(noreplace) @ETC@/xinetd.d/rocketgit |
|
119 |
|
%config(noreplace) @ETC@/ssh/sshd_config.d/* |
|
120 |
|
%attr(0700,rocketgit,rocketgit) %dir @VAR_LOG@/@PRJ@ |
|
121 |
|
%attr(0771,rocketgit,rocketgit) %dir @VAR_LIB@/@PRJ@ |
|
122 |
|
%attr(0700,rocketgit,rocketgit) %dir @VAR_LIB@/@PRJ@/locks |
|
123 |
|
%attr(0700,rocketgit,rocketgit) %dir @VAR_LIB@/@PRJ@/repos |
|
124 |
|
%attr(0700,rocketgit,rocketgit) %dir @VAR_LIB@/@PRJ@/q_merge_requests |
|
125 |
|
%attr(0700,rocketgit,rocketgit) %dir @VAR_LIB@/@PRJ@/sockets |
|
126 |
|
%attr(0700,rocketgit,rocketgit) %dir @VAR_LIB@/@PRJ@/tmp |
|
127 |
|
%attr(0755,root,root) @USR_SBIN@/* |
|
128 |
|
@USR_SHARE@/@PRJ@/* |
|
129 |
|
@USR_SHARE@/selinux/*/@PRJ@.pp |
|
|
107 |
|
%dir /usr/share/rocketgit |
|
108 |
|
%doc README LICENSE Changelog TODO selinux/rocketgit.* samples/* |
|
109 |
|
%attr(0700,rocketgit,rocketgit) %dir /etc/rocketgit |
|
110 |
|
/etc/rocketgit/config.php.sample |
|
111 |
|
/etc/httpd/conf.d/rocketgit.conf.sample |
|
112 |
|
/etc/nginx/conf.d/rocketgit.conf.sample |
|
113 |
|
/etc/rocketgit/worker-main.conf.sample |
|
114 |
|
%config(noreplace) /etc/rocketgit/config.php |
|
115 |
|
%config(noreplace) /etc/rocketgit/php-fpm.conf |
|
116 |
|
%config(noreplace) /etc/rocketgit/pool.conf |
|
117 |
|
%config(noreplace) /etc/cron.d/rocketgit |
|
118 |
|
%config(noreplace) /etc/xinetd.d/rocketgit |
|
119 |
|
%attr(0700,rocketgit,rocketgit) %dir /var/log/rocketgit |
|
120 |
|
%attr(0771,rocketgit,rocketgit) %dir /var/lib/rocketgit |
|
121 |
|
%attr(0700,rocketgit,rocketgit) %dir /var/lib/rocketgit/locks |
|
122 |
|
%attr(0700,rocketgit,rocketgit) %dir /var/lib/rocketgit/repos |
|
123 |
|
%attr(0700,rocketgit,rocketgit) %dir /var/lib/rocketgit/q_merge_requests |
|
124 |
|
%attr(0700,rocketgit,rocketgit) %dir /var/lib/rocketgit/sockets |
|
125 |
|
%attr(0700,rocketgit,rocketgit) %dir /var/lib/rocketgit/tmp |
|
126 |
|
%attr(0755,root,root) /usr/sbin/* |
|
127 |
|
/usr/share/rocketgit/* |
|
128 |
|
/usr/share/selinux/*/rocketgit.pp |
130 |
129 |
%{_unitdir}/*.service |
%{_unitdir}/*.service |
131 |
130 |
|
|
132 |
131 |
%changelog |
%changelog |
File scripts/builder.php changed (mode: 100644) (index 2ff2c06..87fedca) |
... |
... |
function xdispatch($key, $data) |
694 |
694 |
return $ret; |
return $ret; |
695 |
695 |
} |
} |
696 |
696 |
|
|
|
697 |
|
/* |
|
698 |
|
* Returns TRUE if we should try to continue finding a worker. |
|
699 |
|
* Returns FALSE if we should not continue. |
|
700 |
|
*/ |
697 |
701 |
function rg_process_job($db, &$job) |
function rg_process_job($db, &$job) |
698 |
702 |
{ |
{ |
699 |
703 |
global $rg_conns; |
global $rg_conns; |
|
... |
... |
function rg_process_job($db, &$job) |
705 |
709 |
//rg_log($jid . ': job is already assigned to' |
//rg_log($jid . ': job is already assigned to' |
706 |
710 |
// . ' worker [' . $job['worker_name'] . ']' |
// . ' worker [' . $job['worker_name'] . ']' |
707 |
711 |
// . ' (id ' . $job['worker_id'] . '); skip it'); |
// . ' (id ' . $job['worker_id'] . '); skip it'); |
708 |
|
return; |
|
|
712 |
|
return FALSE; |
709 |
713 |
} |
} |
710 |
714 |
|
|
711 |
715 |
// Should we delay because of a previous fail? |
// Should we delay because of a previous fail? |
712 |
716 |
if (isset($job['next_try']) && ($job['next_try'] > time())) { |
if (isset($job['next_try']) && ($job['next_try'] > time())) { |
713 |
717 |
rg_log($jid . ': job is suspended till ' |
rg_log($jid . ': job is suspended till ' |
714 |
718 |
. date('Y-m-d H:i:s', $job['next_try'])); |
. date('Y-m-d H:i:s', $job['next_try'])); |
715 |
|
return; |
|
|
719 |
|
return FALSE; |
716 |
720 |
} |
} |
717 |
721 |
|
|
718 |
722 |
rg_log_ml($jid . ': processing job...'); |
rg_log_ml($jid . ': processing job...'); |
|
... |
... |
function rg_process_job($db, &$job) |
728 |
732 |
if ($workers_list === FALSE) { |
if ($workers_list === FALSE) { |
729 |
733 |
rg_log($jid . ': cannot load workers list: ' . rg_worker_error()); |
rg_log($jid . ': cannot load workers list: ' . rg_worker_error()); |
730 |
734 |
$job['next_try'] = time() + 60; |
$job['next_try'] = time() + 60; |
731 |
|
return; |
|
|
735 |
|
return TRUE; |
732 |
736 |
} |
} |
733 |
737 |
//rg_log_debug('workers list: ' . rg_array2string($workers_list)); |
//rg_log_debug('workers list: ' . rg_array2string($workers_list)); |
734 |
738 |
|
|
|
... |
... |
function rg_process_job($db, &$job) |
821 |
825 |
// duplicate work |
// duplicate work |
822 |
826 |
rg_log($key . ': ' . $jid . ': job sent to worker [' . $name . ']'); |
rg_log($key . ': ' . $jid . ': job sent to worker [' . $name . ']'); |
823 |
827 |
rg_log_debug('sent job: ' . rg_array2string($job2)); |
rg_log_debug('sent job: ' . rg_array2string($job2)); |
824 |
|
return; |
|
|
828 |
|
return FALSE; |
825 |
829 |
} |
} |
826 |
830 |
unset($i); |
unset($i); |
827 |
831 |
|
|
|
832 |
|
// TODO: we should signal this and prevent the call if the list of |
|
833 |
|
// workers does not change. |
828 |
834 |
rg_log('No workers found!'); |
rg_log('No workers found!'); |
|
835 |
|
return TRUE; |
829 |
836 |
} |
} |
830 |
837 |
|
|
831 |
838 |
|
|
File scripts/worker.php changed (mode: 100644) (index f3ac73b..b238d58) |
... |
... |
function start_worker_build_rgfs($job, &$reason, &$reason2) |
735 |
735 |
. ' exit 0' . "\n" |
. ' exit 0' . "\n" |
736 |
736 |
. 'fi' . "\n" |
. 'fi' . "\n" |
737 |
737 |
. "\n" |
. "\n" |
738 |
|
. 'git clone https://rocketgit.com/user/catalinux/rgfs' . "\n" |
|
|
738 |
|
. 'git clone -b main https://rocketgit.com/user/catalinux/rgfs' . "\n" |
739 |
739 |
. 'cd rgfs' . "\n" |
. 'cd rgfs' . "\n" |
740 |
740 |
. './configure' . "\n" |
. './configure' . "\n" |
741 |
741 |
. 'make' . "\n" |
. 'make' . "\n" |
|
... |
... |
function start_worker($job) |
1143 |
1143 |
|
|
1144 |
1144 |
rg_exec('umount ' . $emain . '/root', '', FALSE, FALSE, FALSE); |
rg_exec('umount ' . $emain . '/root', '', FALSE, FALSE, FALSE); |
1145 |
1145 |
|
|
|
1146 |
|
rg_log_debug('Cleaning dir ' . $job['main']); |
1146 |
1147 |
$r = rg_del_tree($job['main']); |
$r = rg_del_tree($job['main']); |
1147 |
1148 |
if ($r === FALSE) { |
if ($r === FALSE) { |
1148 |
1149 |
$reason = 'cannot delete main dir'; |
$reason = 'cannot delete main dir'; |
|
... |
... |
function start_worker($job) |
1335 |
1336 |
. ' >>/mnt/status/RG_LABELS' . "\n"; |
. ' >>/mnt/status/RG_LABELS' . "\n"; |
1336 |
1337 |
|
|
1337 |
1338 |
$s .= 'date +%s > ' . $prefix . '.start' . "\n" |
$s .= 'date +%s > ' . $prefix . '.start' . "\n" |
|
1339 |
|
. '# i: ' . json_encode($i) . "\n" |
1338 |
1340 |
. 'echo "Executing [' . $i['cmd'] . ']"' . "\n" |
. 'echo "Executing [' . $i['cmd'] . ']"' . "\n" |
1339 |
1341 |
. '(' . $i['cmd'] . ') &>' . $prefix . '.log' . "\n" |
. '(' . $i['cmd'] . ') &>' . $prefix . '.log' . "\n" |
1340 |
1342 |
. 'E=${?}' . "\n" |
. 'E=${?}' . "\n" |
1341 |
1343 |
. 'echo ${E} > ' . $prefix . ".status\n" |
. 'echo ${E} > ' . $prefix . ".status\n" |
1342 |
1344 |
. 'date +%s > ' . $prefix . '.done' . "\n" |
. 'date +%s > ' . $prefix . '.done' . "\n" |
1343 |
1345 |
. 'if [ "${E}" != "0" ]; then' . "\n" |
. 'if [ "${E}" != "0" ]; then' . "\n" |
|
1346 |
|
. ' echo "Command failed with code ${E}"' . "\n" |
1344 |
1347 |
. $lnok |
. $lnok |
1345 |
|
. ($i['abort'] ? ' exit 1' . "\n" : '') |
|
|
1348 |
|
. ($i['abort'] ? ' exit ${E}' . "\n" : '') |
1346 |
1349 |
. 'else' . "\n" |
. 'else' . "\n" |
1347 |
1350 |
. $lok |
. $lok |
1348 |
1351 |
. 'fi' . "\n\n"; |
. 'fi' . "\n\n"; |