Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Cosmetic | 1d638cee22854ab2f98ae3a72afd34ea337c101a | Catalin(ux) M. BOIE | 2024-06-05 06:06:33 |
Mostly cosmetic | 427e7056c6593359b68317c071d175cc38b1705d | Catalin(ux) M. BOIE | 2023-12-17 12:01:17 |
readme rendering: everything not makrdown is treated as text | d7c1a9e039e3b7945682ee2e13745cd0d4ad446a | Catalin(ux) M. BOIE | 2023-06-22 03:40:21 |
Really bumbed version to 0.78 | 223d494efb0cc012c72fe8898e2800ce15e4eaf7 | Catalin(ux) M. BOIE | 2023-06-15 20:36:31 |
Make rgfs more verbose in case of errors | 197c21765870fa6b95bb08c8599de9decf3980eb | Catalin(ux) M. BOIE | 2023-06-15 20:33:18 |
Cosmetic | d48682ffe54991deedd4989a100a0607cafefab8 | Catalin(ux) M. BOIE | 2023-06-14 17:11:03 |
Fixed delete account op | 4157f88a19d1b24934743d0193755a6dc3f98c13 | Catalin(ux) M. BOIE | 2023-06-14 17:10:22 |
Render readme files on the project page | a8c09adb1bceed31f8070386158561b06470a98f | Catalin(ux) M. BOIE | 2023-06-14 17:09:17 |
Added rg_sid global variable to simplify the function calling | 0047908fcd2ed0302a826487ddd15ca2579a9a83 | Catalin(ux) M. BOIE | 2023-06-14 17:06:39 |
Removed delta support for rpms because Fedora will remove it | 2c26be90f4bc08a06ab03ab016e9ccaa843780e5 | Catalin(ux) M. BOIE | 2023-05-03 05:04:40 |
Added first payments option; fixes all around | 7102aed9f239d529723799171553e8c4bd018440 | Catalin(ux) M. BOIE | 2023-05-02 22:36:28 |
Fixed a nasty typo in the build system; doc update; cosmetic | 1934732b297d6476be7954fabdcaf9eb87678f5e | Catalin(ux) M. BOIE | 2022-12-21 12:51:53 |
Send client features to the builder | dcf648353662409b9e39a422228ddb6a7c43358c | Catalin(ux) M. BOIE | 2022-12-21 11:10:00 |
Add support for SHA-256 git repos | 8b88927d353c7b588909d0b1220c8922b32129c0 | Catalin(ux) M. BOIE | 2022-12-21 11:03:19 |
Look-up pkg_repo using pkg_repo uid | f2b188b8cb151c376d8ee8c81f8e82c02ed93cd1 | Catalin(ux) M. BOIE | 2022-12-12 05:29:13 |
Cosmetic | 04ae5ac6b9805198966a21755d1d430ef5b6a6dd | Catalin(ux) M. BOIE | 2022-12-11 17:17:39 |
Keep-alive mechanism for builder/worker | 7e3add2ab41feefe37a858439934b8599fb30933 | Catalin(ux) M. BOIE | 2022-12-10 19:36:53 |
Bumped version to 0.76 | 09bb0cc92a9dfce513ce1289a22e71faf4ad1fe1 | Catalin(ux) M. BOIE | 2022-10-22 06:27:35 |
Cosmetic | 45c59081c97489ccccd35efffa522607fee25a63 | Catalin(ux) M. BOIE | 2022-10-22 05:52:56 |
Mostly worker stuff | ccf3a8d8da2ad1b0d97418fabb5028b40721835f | Catalin(ux) M. BOIE | 2022-10-22 05:50:04 |
File | Lines added | Lines deleted |
---|---|---|
TODO | 18 | 1 |
debian/changelog | 4 | 0 |
duilder.conf | 1 | 1 |
hooks/update | 1 | 1 |
inc/builder.inc.php | 7 | 3 |
inc/keys.inc.php | 1 | 1 |
inc/prof.inc.php | 2 | 1 |
inc/user.inc.php | 4 | 4 |
inc/util.inc.php | 1 | 1 |
rocketgit.spec | 3 | 1 |
samples/nginx.conf | 2 | 1 |
samples/rg.conf | 2 | 0 |
scripts/builder.php | 50 | 14 |
scripts/remote.php | 4 | 3 |
scripts/worker.php | 25 | 5 |
tests/helpers.inc.php | 1 | 1 |
File TODO changed (mode: 100644) (index 050f419..2297802) | |||
78 | 78 | [ ] | [ ] |
79 | 79 | ||
80 | 80 | == Next next release == | == Next next release == |
81 | [ ] if a build env not found, cancel the job after a 10m? | ||
81 | [ ] Download all keys used to sign a commit or a push, in a common keyring. | ||
82 | I cannot use a split keyring because I cannot control how git log is | ||
83 | looking up the keys. | ||
84 | [ ] Push options: deal with them on the server side; we may use it for: | ||
85 | - use TOTP to allow the push - a new right may be needed | ||
86 | - Control CI/CD | ||
87 | (GIT_PUSH_OPTION_COUNT + GIT_PUSH_OPTION_0...) | ||
88 | [ ] Push sign: suggest, in hints, 'tag.gpgSign' to be set to 'true'. | ||
89 | [ ] Push sign: add it to repo push rights. | ||
90 | [ ] Commit sign: add it to repo push rights. | ||
91 | [ ] When starting a build machine, set the hostname to something like | ||
92 | "RocketGit", so, people will know that the package was built | ||
93 | by RocketGit. Let's say it is a small advertising. | ||
94 | [ ] For next line: | ||
95 | RocketGit: Info: you are connecting from IP 2a02:2f0e:d108:9400:90f9:7714:4d24:d9dd by ssh (key 6). | ||
96 | show when the IP push was granted. And the line is a bit too long. | ||
97 | [ ] If a build env not found, cancel the job after a 10m? | ||
98 | At least do not log ad infinitum that an env is not available. | ||
82 | 99 | [ ] Would be nice to see what webhooks will execute after a push. | [ ] Would be nice to see what webhooks will execute after a push. |
83 | 100 | Maybe the events system can pass back some information to be shown to the user. | Maybe the events system can pass back some information to be shown to the user. |
84 | 101 | [ ] Clone by git (eg ninedogs) failes to checkout files. | [ ] Clone by git (eg ninedogs) failes to checkout files. |
File debian/changelog changed (mode: 100644) (index e177f60..7f70e3b) | |||
1 | rocketgit (0.79) unstable; urgency=low | ||
2 | * ??? | ||
3 | -- Catalin(ux) M. BOIE <catab@embedromix.ro> Thu, 15 Jun 2023 23:00:00 +0300 | ||
4 | |||
1 | 5 | rocketgit (0.78) unstable; urgency=low | rocketgit (0.78) unstable; urgency=low |
2 | 6 | * Fixed delete account | * Fixed delete account |
3 | 7 | * Render readme files | * Render readme files |
File duilder.conf changed (mode: 100644) (index b791516..aced68c) | |||
1 | 1 | PRJ="rocketgit" | PRJ="rocketgit" |
2 | VER="0.78" | ||
2 | VER="0.79" | ||
3 | 3 | REV="1" | REV="1" |
4 | 4 | SHORT_DESCRIPTION="Light and fast Git hosting solution" | SHORT_DESCRIPTION="Light and fast Git hosting solution" |
5 | 5 | EXCLUDE=".exclude" | EXCLUDE=".exclude" |
File hooks/update changed (mode: 100755) (index 05300b5..b2442c5) | |||
... | ... | if (strncmp($a['refname'], "refs/tags/", 10) == 0) { | |
95 | 95 | rg_git_fatal("No action for remotes for now!"); | rg_git_fatal("No action for remotes for now!"); |
96 | 96 | } else { | } else { |
97 | 97 | $m = "Unknown refname type provided [" . $a['refname'] . "]"; | $m = "Unknown refname type provided [" . $a['refname'] . "]"; |
98 | rg_internal_error($m); | ||
98 | //rg_internal_error($m); | ||
99 | 99 | rg_git_fatal($m); | rg_git_fatal($m); |
100 | 100 | } | } |
101 | 101 |
File inc/builder.inc.php changed (mode: 100644) (index 7d1e8f0..8e423b0) | |||
... | ... | function rg_builder_vm_list() | |
101 | 101 | /* | /* |
102 | 102 | * Function executed when a job is done | * Function executed when a job is done |
103 | 103 | */ | */ |
104 | function rg_builder_done($db, $job, $s) | ||
104 | function rg_builder_done($db, array $job, array $s) | ||
105 | 105 | { | { |
106 | 106 | rg_log_enter('builder_done'); | rg_log_enter('builder_done'); |
107 | 107 | //rg_log_debug('builder_done: job: ' . print_r($job, TRUE)); | //rg_log_debug('builder_done: job: ' . print_r($job, TRUE)); |
... | ... | function rg_builder_done($db, $job, $s) | |
120 | 120 | break; | break; |
121 | 121 | $rollback = TRUE; | $rollback = TRUE; |
122 | 122 | ||
123 | $labels = $s['labels']; | ||
123 | if (array_key_exists('labels', $s)) | ||
124 | $labels = $s['labels']; | ||
125 | else | ||
126 | $labels = array(); | ||
124 | 127 | ||
125 | 128 | // Some cosmetic stuff | // Some cosmetic stuff |
126 | 129 | $env = $req['env']; | $env = $req['env']; |
127 | 130 | // TODO: sometimes, done is not present | // TODO: sometimes, done is not present |
128 | 131 | if (isset($s['done'])) | if (isset($s['done'])) |
129 | 132 | $labels[] = 'worker_elap/' . ($s['done'] - intval($s['start'])) . 's'; | $labels[] = 'worker_elap/' . ($s['done'] - intval($s['start'])) . 's'; |
130 | $labels[] = 'wait_time/' . ($job['worker_sent'] - $job['itime']) . 's'; | ||
133 | if (array_key_exists('worker_sent', $job)) | ||
134 | $labels[] = 'wait_time/' . ($job['worker_sent'] - $job['itime']) . 's'; | ||
131 | 135 | $labels[] = 'date/' . gmdate('Y-m-d', $job['itime']); | $labels[] = 'date/' . gmdate('Y-m-d', $job['itime']); |
132 | 136 | $labels[] = 'time/' . gmdate('H:i', $job['itime']); | $labels[] = 'time/' . gmdate('H:i', $job['itime']); |
133 | 137 |
File inc/keys.inc.php changed (mode: 100644) (index 47d31ad..1a78505) | |||
... | ... | function rg_keys_info($key) | |
364 | 364 | ||
365 | 365 | if ($i == $bits_pos) { | if ($i == $bits_pos) { |
366 | 366 | rg_log_debug('bits_sub=' . $bits_sub . ' bits_div=' . $bits_div); | rg_log_debug('bits_sub=' . $bits_sub . ' bits_div=' . $bits_div); |
367 | $ret['bits'] = (($xlen - $bits_sub) / $bits_div) * 8; | ||
367 | $ret['bits'] = intval(($xlen - $bits_sub) / $bits_div) * 8; | ||
368 | 368 | if (isset($fixes[$ret['bits']])) { | if (isset($fixes[$ret['bits']])) { |
369 | 369 | rg_log_debug('apply fix from ' . $ret['bits'] . ' to ' . $fixes[$ret['bits']]); | rg_log_debug('apply fix from ' . $ret['bits'] . ' to ' . $fixes[$ret['bits']]); |
370 | 370 | $ret['bits'] = $fixes[$ret['bits']]; | $ret['bits'] = $fixes[$ret['bits']]; |
File inc/prof.inc.php changed (mode: 100644) (index ac65f08..29f9b34) | |||
... | ... | function rg_prof_log() | |
206 | 206 | $p = rg_prof_text(); | $p = rg_prof_text(); |
207 | 207 | rg_log_ml($p); | rg_log_ml($p); |
208 | 208 | ||
209 | rg_log("peak: " . sprintf("%.2f MiB", memory_get_peak_usage(TRUE) / 1024 / 1024)); | ||
209 | rg_log("peak: " . sprintf("%.2f MiB", | ||
210 | memory_get_peak_usage(TRUE) / 1024 / 1024)); | ||
210 | 211 | } | } |
211 | 212 |
File inc/user.inc.php changed (mode: 100644) (index b9cc58e..df360b0) | |||
... | ... | function rg_user_edit_high_level($db, $rg) | |
2050 | 2050 | } | } |
2051 | 2051 | ||
2052 | 2052 | $v = microtime(TRUE); | $v = microtime(TRUE); |
2053 | $gen1 = sprintf("%u", $v); | ||
2053 | $gen1 = intval($v); | ||
2054 | 2054 | $gen2 = sprintf("%03u", ($v - intval($v)) * 1000); | $gen2 = sprintf("%03u", ($v - intval($v)) * 1000); |
2055 | 2055 | ||
2056 | 2056 | $errmsg = array(); | $errmsg = array(); |
... | ... | function rg_user_edit_high_level($db, $rg) | |
2093 | 2093 | if (empty($gen)) { | if (empty($gen)) { |
2094 | 2094 | $diff = 0; | $diff = 0; |
2095 | 2095 | } else { | } else { |
2096 | $xgen1 = substr($gen, 3); | ||
2097 | $xgen2 = substr($gen, 0, 3); | ||
2098 | $diff = ($gen1 - $xgen1) * 1000 + $gen2 - $xgen2; | ||
2096 | $xgen1 = intval(substr($gen, 3)); | ||
2097 | $xgen2 = intval(substr($gen, 0, 3)); | ||
2098 | $diff = ($gen1 - $xgen1) * 1000 + intval($gen2) - $xgen2; | ||
2099 | 2099 | } | } |
2100 | 2100 | if ($diff < 2000) { | if ($diff < 2000) { |
2101 | 2101 | rg_log('Bot tried to create account in ' . $diff . 'ms'); | rg_log('Bot tried to create account in ' . $diff . 'ms'); |
File inc/util.inc.php changed (mode: 100644) (index 6750694..87fcb90) | |||
... | ... | function rg_socket_recv_wait($socket, $wait, $timeout) | |
2263 | 2263 | $tv_usec = 0; | $tv_usec = 0; |
2264 | 2264 | $limit = 0; | $limit = 0; |
2265 | 2265 | } else { | } else { |
2266 | $tv_sec = $timeout / 1000; | ||
2266 | $tv_sec = intval($timeout / 1000); | ||
2267 | 2267 | $tv_usec = ($timeout % 1000) * 1000; | $tv_usec = ($timeout % 1000) * 1000; |
2268 | 2268 | $limit = microtime(TRUE) + $timeout / 1000; | $limit = microtime(TRUE) + $timeout / 1000; |
2269 | 2269 | } | } |
File rocketgit.spec changed (mode: 100644) (index 2c2fa82..f5a151f) | |||
6 | 6 | ||
7 | 7 | Summary: Light and fast Git hosting solution | Summary: Light and fast Git hosting solution |
8 | 8 | Name: rocketgit | Name: rocketgit |
9 | Version: 0.78 | ||
9 | Version: 0.79 | ||
10 | 10 | Release: 1 | Release: 1 |
11 | 11 | License: AGPLv3+ | License: AGPLv3+ |
12 | 12 | Group: Development/Tools | Group: Development/Tools |
... | ... | rm -rf ${RPM_BUILD_ROOT} | |
153 | 153 | %{_unitdir}/* | %{_unitdir}/* |
154 | 154 | ||
155 | 155 | %changelog | %changelog |
156 | * Thu Jun 15 2023 Catalin(ux) M. BOIE <catab at embedromix dot ro> 0.79 | ||
157 | |||
156 | 158 | * Thu Jun 15 2023 Catalin(ux) M. BOIE <catab at embedromix dot ro> 0.78 | * Thu Jun 15 2023 Catalin(ux) M. BOIE <catab at embedromix dot ro> 0.78 |
157 | 159 | Fixed delete account feature | Fixed delete account feature |
158 | 160 | Render readme files | Render readme files |
File samples/nginx.conf changed (mode: 100644) (index 1955e09..d303065) | |||
... | ... | server { | |
28 | 28 | ||
29 | 29 | # Security (ClickJacking) | # Security (ClickJacking) |
30 | 30 | add_header X-Frame-Options DENY; | add_header X-Frame-Options DENY; |
31 | add_header Content-Security-Policy "frame-ancestors 'self';"; | ||
31 | 32 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options |
32 | 33 | add_header X-Content-Type-Options nosniff; | add_header X-Content-Type-Options nosniff; |
33 | 34 | # XSS protection | # XSS protection |
... | ... | server { | |
99 | 100 | # https://www.digicert.com/ssl-support/ssl-enabling-perfect-forward-secrecy.htm | # https://www.digicert.com/ssl-support/ssl-enabling-perfect-forward-secrecy.htm |
100 | 101 | # Generated by: https://ssl-config.mozilla.org | # Generated by: https://ssl-config.mozilla.org |
101 | 102 | ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; | ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; |
102 | ssl_session_cache shared:SSL:60m; | ||
103 | ssl_session_cache shared:SSL-cache-rocketgit:60m; | ||
103 | 104 | ssl_session_timeout 1d; | ssl_session_timeout 1d; |
104 | 105 | ssl_session_tickets off; | ssl_session_tickets off; |
105 | 106 |
File samples/rg.conf changed (mode: 100644) (index 29509de..cb7bbeb) | |||
58 | 58 | <IfModule mod_headers.c> | <IfModule mod_headers.c> |
59 | 59 | # Security (ClickJacking) | # Security (ClickJacking) |
60 | 60 | Header always append X-Frame-Options DENY | Header always append X-Frame-Options DENY |
61 | Header set Content-Security-Policy "frame-ancestors 'self';" | ||
61 | 62 | </IfModule> | </IfModule> |
62 | 63 | ||
63 | 64 | # Compress | # Compress |
106 | 107 | <IfModule mod_headers.c> | <IfModule mod_headers.c> |
107 | 108 | # Security (ClickJacking) | # Security (ClickJacking) |
108 | 109 | Header always append X-Frame-Options DENY | Header always append X-Frame-Options DENY |
110 | Header set Content-Security-Policy "frame-ancestors 'self';" | ||
109 | 111 | # Security (STS) | # Security (STS) |
110 | 112 | Header set Strict-Transport-Security "max-age=31536000" | Header set Strict-Transport-Security "max-age=31536000" |
111 | 113 | </IfModule> | </IfModule> |
File scripts/builder.php changed (mode: 100644) (index a5fe8ad..2623a7a) | |||
... | ... | function xdispatch_one($key, $data) | |
201 | 201 | } | } |
202 | 202 | ||
203 | 203 | $op = $u['op']; unset($u['op']); | $op = $u['op']; unset($u['op']); |
204 | rg_log_debug($key . ': op=' . $op); | ||
204 | $ignore_for_log = array('pong' => 1, 'WORKER_STATS' => 1); | ||
205 | if (!array_key_exists($op, $ignore_for_log)) | ||
206 | rg_log_debug($key . ': op=[' . $op . ']'); | ||
205 | 207 | ||
206 | 208 | if (strcmp($op, 'features') == 0) { | if (strcmp($op, 'features') == 0) { |
207 | 209 | $rg_conns[$key]['feat'] = $u['features']; | $rg_conns[$key]['feat'] = $u['features']; |
... | ... | function xdispatch_one($key, $data) | |
215 | 217 | } | } |
216 | 218 | ||
217 | 219 | if (strcmp($op, 'ANN') == 0) { | if (strcmp($op, 'ANN') == 0) { |
220 | rg_log($key . ': ANN received'); | ||
221 | |||
218 | 222 | if (($u['boot_time'] < $now - 30) || ($u['boot_time'] > $now + 30)) { | if (($u['boot_time'] < $now - 30) || ($u['boot_time'] > $now + 30)) { |
219 | 223 | $err = array( | $err = array( |
220 | 224 | 'op' => $op, | 'op' => $op, |
... | ... | function xdispatch_one($key, $data) | |
548 | 552 | rg_conn_shutdown($key, 2); | rg_conn_shutdown($key, 2); |
549 | 553 | } | } |
550 | 554 | } | } |
551 | rg_log_ml($key . ': ' . $jid . ': ' . $aid . ': DEBUG: adir=' . $adir); | ||
555 | rg_log_ml($key . ': ' . $jid . ': ' . $aid | ||
556 | . ': DEBUG: adir=' . $adir); | ||
552 | 557 | ||
553 | 558 | // Prepare the replace of special strings | // Prepare the replace of special strings |
554 | 559 | $a = array(); $b = array(); | $a = array(); $b = array(); |
... | ... | function xdispatch_one($key, $data) | |
612 | 617 | } | } |
613 | 618 | ||
614 | 619 | $apath = $adir . '/' . $path; | $apath = $adir . '/' . $path; |
615 | rg_log($key . ': ' . $jid . ': ' . $aid . ': DEBUG: apath=' . $apath); | ||
620 | rg_log($key . ': ' . $jid . ': ' . $aid | ||
621 | . ': DEBUG: apath=' . $apath); | ||
616 | 622 | $d = dirname($apath); | $d = dirname($apath); |
617 | 623 | if (!is_dir($d)) { | if (!is_dir($d)) { |
618 | 624 | $r = @mkdir($d, 0770, TRUE); | $r = @mkdir($d, 0770, TRUE); |
... | ... | function rg_process_job($db, &$job) | |
739 | 745 | ||
740 | 746 | // Should we delay because of a previous fail? | // Should we delay because of a previous fail? |
741 | 747 | if (isset($job['next_try']) && ($job['next_try'] > time())) { | if (isset($job['next_try']) && ($job['next_try'] > time())) { |
742 | rg_log_debug($jid . ': job is suspended till ' | ||
743 | . date('Y-m-d H:i:s', $job['next_try'])); | ||
748 | //rg_log_debug($jid . ': job is suspended till ' | ||
749 | // . date('Y-m-d H:i:s', $job['next_try']) | ||
750 | // . ' because [' . $job['next_try_reason'] . ']'); | ||
744 | 751 | return TRUE; | return TRUE; |
745 | 752 | } | } |
746 | 753 | ||
... | ... | function rg_process_job($db, &$job) | |
763 | 770 | ||
764 | 771 | // Trying to find a worker in the list of connections | // Trying to find a worker in the list of connections |
765 | 772 | $reason = array(); | $reason = array(); |
773 | $delta = 30; // how many seconds to postpone the job | ||
774 | $total_time_allowed = 0; // unlimited | ||
766 | 775 | foreach ($rg_conns as $key => &$i) { | foreach ($rg_conns as $key => &$i) { |
767 | 776 | if (strcmp($key, 'master') == 0) | if (strcmp($key, 'master') == 0) |
768 | 777 | continue; | continue; |
769 | 778 | ||
770 | 779 | if (!isset($i['ann'])) { | if (!isset($i['ann'])) { |
771 | //rg_log($key . ': ' . $jid . ': conn has no announce.'); | ||
780 | rg_log($key . ': ' . $jid . ': conn has no announce.'); | ||
772 | 781 | // TODO: close after some time? | // TODO: close after some time? |
773 | 782 | $reason[] = 'no_announce'; | $reason[] = 'no_announce'; |
774 | 783 | continue; | continue; |
... | ... | function rg_process_job($db, &$job) | |
806 | 815 | if ($wi['workers']) { | if ($wi['workers']) { |
807 | 816 | $aj = worker_active_jobs($i['worker_id']); | $aj = worker_active_jobs($i['worker_id']); |
808 | 817 | if ($aj >= $wi['workers']) { | if ($aj >= $wi['workers']) { |
809 | rg_log($key . ': ' . $jid . ': DEBUG: skip worker ' . $name . ' because' | ||
810 | . ' sent jobs(' . $aj . ')' | ||
818 | rg_log($key . ': ' . $jid | ||
819 | . ': DEBUG: skip worker ' . $name | ||
820 | . ' because sent jobs(' . $aj . ')' | ||
811 | 821 | . ' >= workers(' . $wi['workers'] . ')'); | . ' >= workers(' . $wi['workers'] . ')'); |
812 | 822 | $reason[] = 'jobs/worker'; | $reason[] = 'jobs/worker'; |
813 | 823 | continue; | continue; |
... | ... | function rg_process_job($db, &$job) | |
827 | 837 | break; | break; |
828 | 838 | } | } |
829 | 839 | if (!$env_found) { | if (!$env_found) { |
830 | $reason[] = 'env_not_found'; | ||
840 | $reason[] = 'env_not_found[' . $req['env'] . ']'; | ||
841 | $total_time_allowed = 24 * 3600; | ||
842 | $delta = 3600; | ||
831 | 843 | continue; | continue; |
832 | 844 | } | } |
833 | 845 | ||
... | ... | function rg_process_job($db, &$job) | |
858 | 870 | } | } |
859 | 871 | unset($i); | unset($i); |
860 | 872 | ||
873 | rg_log($key . ': ' . $jid . ': No workers found [' | ||
874 | . implode(' ', $reason) . ']!'); | ||
875 | |||
876 | if (($total_time_allowed > 0) | ||
877 | && array_key_exists('start', $job) | ||
878 | && ($job['start'] + $total_time_allowed < time())) { | ||
879 | rg_log($key . ': ' . $jid . ': cancel job because' | ||
880 | . ' start + total_time_allowed < now'); | ||
881 | $status = array(); | ||
882 | $status['error'] = 'Env not found after a lot of time'; | ||
883 | $r = rg_builder_done($db, $job, $status); | ||
884 | if ($r === TRUE) { | ||
885 | @unlink($state_dir . '/job-' . $jid . '.ser'); | ||
886 | $job['delete_me'] = 1; | ||
887 | } | ||
888 | return TRUE; | ||
889 | } | ||
890 | |||
861 | 891 | // TODO: we should signal this and prevent the call if the list of | // TODO: we should signal this and prevent the call if the list of |
862 | 892 | // workers does not change. | // workers does not change. |
863 | rg_log('No workers found [' . implode(' ', $reason) . ']! Suspend job for 10s'); | ||
864 | $job['next_try'] = time() + 10; | ||
893 | rg_log($key . ': ' . $jid . ': Suspend job for ' . $delta . 's'); | ||
894 | $job['next_try'] = time() + $delta; | ||
895 | $job['next_try_reason'] = implode(',', $reason); | ||
865 | 896 | return TRUE; | return TRUE; |
866 | 897 | } | } |
867 | 898 | ||
... | ... | if (rg_struct_ok($db) === FALSE) | |
904 | 935 | rg_debug_set(rg_state_get($db, 'debug')); | rg_debug_set(rg_state_get($db, 'debug')); |
905 | 936 | ||
906 | 937 | // Prepare socket | // Prepare socket |
907 | $socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); | ||
938 | $socket = @socket_create(AF_INET6, SOCK_STREAM, SOL_TCP); | ||
908 | 939 | if ($socket === FALSE) { | if ($socket === FALSE) { |
909 | 940 | rg_internal_error('Cannot create socket!'); | rg_internal_error('Cannot create socket!'); |
910 | 941 | exit(1); | exit(1); |
... | ... | do { | |
991 | 1022 | ||
992 | 1023 | if (isset($saved_jobs[$jid])) { | if (isset($saved_jobs[$jid])) { |
993 | 1024 | rg_log($jid . ': We restored data from disk.'); | rg_log($jid . ': We restored data from disk.'); |
994 | rg_log_ml($jid . ':DEBUG: ' . rg_array2string($saved_jobs[$jid])); | ||
1025 | rg_log_ml($jid . ':DEBUG: ' | ||
1026 | . rg_array2string($saved_jobs[$jid])); | ||
995 | 1027 | $jobs[$jid] = $saved_jobs[$jid]; | $jobs[$jid] = $saved_jobs[$jid]; |
996 | 1028 | unset($saved_jobs[$jid]); | unset($saved_jobs[$jid]); |
997 | 1029 | } | } |
998 | 1030 | ||
999 | 1031 | if (!isset($jobs[$jid])) { | if (!isset($jobs[$jid])) { |
1000 | 1032 | rg_log($jid . ': New job loaded from db'); | rg_log($jid . ': New job loaded from db'); |
1001 | rg_log_ml($jid . ': DEBUG: job: ' . rg_array2string($job)); | ||
1033 | rg_log_ml($jid . ': DEBUG: job: ' | ||
1034 | . rg_array2string($job)); | ||
1002 | 1035 | $job['worker_id'] = 0; | $job['worker_id'] = 0; |
1003 | 1036 | $job['avoid'] = array(); // list of workers to avoid | $job['avoid'] = array(); // list of workers to avoid |
1037 | $job['start'] = time(); | ||
1004 | 1038 | $jobs[$jid] = $job; | $jobs[$jid] = $job; |
1005 | 1039 | } | } |
1006 | 1040 | ||
1007 | 1041 | $_r = rg_process_job($db, $jobs[$jid]); | $_r = rg_process_job($db, $jobs[$jid]); |
1042 | if (array_key_exists('delete_me', $jobs[$jid])) | ||
1043 | unset($jobs[$jid]); | ||
1008 | 1044 | if ($_r === FALSE) | if ($_r === FALSE) |
1009 | 1045 | break; | break; |
1010 | 1046 | } | } |
File scripts/remote.php changed (mode: 100644) (index 1e3202a..e6d6569) | |||
... | ... | $rg['start'] = microtime(TRUE); | |
30 | 30 | ||
31 | 31 | function info($str) | function info($str) |
32 | 32 | { | { |
33 | rg_log('Sending: ' . $str); | ||
33 | rg_log('Sending (info): ' . $str); | ||
34 | 34 | $str2 = 'RocketGit: Info: ' . $str . "\n"; | $str2 = 'RocketGit: Info: ' . $str . "\n"; |
35 | 35 | if (isset($_SERVER['SSH_CONNECTION'])) { | if (isset($_SERVER['SSH_CONNECTION'])) { |
36 | 36 | // ssh | // ssh |
... | ... | function info($str) | |
43 | 43 | ||
44 | 44 | function fatal($str) | function fatal($str) |
45 | 45 | { | { |
46 | rg_log('Sending: ' . $str); | ||
46 | rg_log('Sending (fatal): ' . $str); | ||
47 | 47 | $str2 = 'RocketGit: Error: ' . $str . "\n"; | $str2 = 'RocketGit: Error: ' . $str . "\n"; |
48 | 48 | if (isset($_SERVER['SSH_CONNECTION'])) { | if (isset($_SERVER['SSH_CONNECTION'])) { |
49 | 49 | // ssh | // ssh |
... | ... | if (isset($_SERVER['SSH_CONNECTION'])) { | |
118 | 118 | rg_ip_set($_t[0]); | rg_ip_set($_t[0]); |
119 | 119 | ||
120 | 120 | info('== Welcome to RocketGit! =='); | info('== Welcome to RocketGit! =='); |
121 | info('you are connecting from IP ' . rg_ip() . ' by ssh (key ' . $key_id . ').'); | ||
121 | info('you are connecting from IP ' . rg_ip() | ||
122 | . ' by ssh (key ' . $key_id . ').'); | ||
122 | 123 | info('date/time: ' . gmdate('Y-m-d H:i:s') | info('date/time: ' . gmdate('Y-m-d H:i:s') |
123 | 124 | . ', debug id ' . $rg_log_sid . '.'); | . ', debug id ' . $rg_log_sid . '.'); |
124 | 125 |
File scripts/worker.php changed (mode: 100644) (index beb0593..b972dee) | |||
... | ... | function rg_worker_connect() | |
2961 | 2961 | . ' with proto ' . $conf['master_proto'] | . ' with proto ' . $conf['master_proto'] |
2962 | 2962 | . ' with url [' . $conf['master_url'] . ']'); | . ' with url [' . $conf['master_url'] . ']'); |
2963 | 2963 | if (strcmp($conf['master_proto'], 'tcp') == 0) { | if (strcmp($conf['master_proto'], 'tcp') == 0) { |
2964 | $socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); | ||
2964 | $socket = @socket_create(AF_INET6, SOCK_STREAM, SOL_TCP); | ||
2965 | 2965 | if ($socket === FALSE) { | if ($socket === FALSE) { |
2966 | 2966 | rg_log('Cannot create socket: ' . rg_php_err()); | rg_log('Cannot create socket: ' . rg_php_err()); |
2967 | 2967 | exit(1); | exit(1); |
... | ... | function rg_worker_connect() | |
2969 | 2969 | ||
2970 | 2970 | $r = @socket_connect($socket, $conf['master_host'], $conf['master_port']); | $r = @socket_connect($socket, $conf['master_host'], $conf['master_port']); |
2971 | 2971 | if ($r === FALSE) { | if ($r === FALSE) { |
2972 | rg_log('Cannot connect: ' . rg_php_err()); | ||
2973 | exit(1); | ||
2972 | rg_log('Cannot connect to ' . $conf['master_host'] | ||
2973 | . '/' . $conf['master_port'] | ||
2974 | . ' by IPv6: ' . rg_php_err()); | ||
2975 | } | ||
2976 | |||
2977 | if ($r === FALSE) { | ||
2978 | socket_close($socket); | ||
2979 | |||
2980 | $socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); | ||
2981 | if ($socket === FALSE) { | ||
2982 | rg_log('Cannot create socket: ' . rg_php_err()); | ||
2983 | exit(1); | ||
2984 | } | ||
2985 | |||
2986 | $r = @socket_connect($socket, $conf['master_host'], $conf['master_port']); | ||
2987 | if ($r === FALSE) { | ||
2988 | rg_log('Cannot connect to ' . $conf['master_host'] | ||
2989 | . '/' . $conf['master_port'] | ||
2990 | . ' by IPv4: ' . rg_php_err()); | ||
2991 | socket_close($socket); | ||
2992 | exit(1); | ||
2993 | } | ||
2974 | 2994 | } | } |
2975 | 2995 | } else if (strcmp($conf['master_proto'], 'proxy_tls') == 0) { | } else if (strcmp($conf['master_proto'], 'proxy_tls') == 0) { |
2976 | 2996 | $context = stream_context_create(); | $context = stream_context_create(); |
... | ... | function rg_worker_connect() | |
3018 | 3038 | $rg_conns['master']['exit_on_close'] = 1; | $rg_conns['master']['exit_on_close'] = 1; |
3019 | 3039 | $rg_conns['master']['func_data'] = 'xhandle'; | $rg_conns['master']['func_data'] = 'xhandle'; |
3020 | 3040 | ||
3021 | // announce ourselves | ||
3041 | rg_log('Sending announce...'); | ||
3022 | 3042 | $ann = $conf; | $ann = $conf; |
3023 | 3043 | unset($ann['key']); | unset($ann['key']); |
3024 | 3044 | $ann['op'] = 'ANN'; | $ann['op'] = 'ANN'; |
... | ... | function rg_worker_connect() | |
3029 | 3049 | $ann['sign'] = hash_hmac('sha512', $ann['boot_time'], $conf['key']); | $ann['sign'] = hash_hmac('sha512', $ann['boot_time'], $conf['key']); |
3030 | 3050 | $j_ann = @json_encode($ann); | $j_ann = @json_encode($ann); |
3031 | 3051 | if ($j_ann === FALSE) { | if ($j_ann === FALSE) { |
3032 | rg_log('Cannot encode json: ' . json_last_error_msg()); | ||
3052 | rg_log(' Cannot encode json: ' . json_last_error_msg()); | ||
3033 | 3053 | exit(1); | exit(1); |
3034 | 3054 | } | } |
3035 | 3055 | rg_conn_enq('master', $j_ann . "\n"); | rg_conn_enq('master', $j_ann . "\n"); |
File tests/helpers.inc.php changed (mode: 100644) (index d2d93a7..8930506) | |||
... | ... | function rg_test_create_user($db, &$rg_ui) | |
39 | 39 | $new['git_mb'] = 0; | $new['git_mb'] = 0; |
40 | 40 | $new['artifacts_mb'] = 0; | $new['artifacts_mb'] = 0; |
41 | 41 | $new['last_ip'] = '?'; | $new['last_ip'] = '?'; |
42 | $_user_id++; | ||
42 | $_user_id = time() . '-' . rg_id(8); | ||
43 | 43 | ||
44 | 44 | // Delete old user | // Delete old user |
45 | 45 | $sql = 'DELETE FROM users WHERE username = @@username@@'; | $sql = 'DELETE FROM users WHERE username = @@username@@'; |