xaizek / rocketgit (License: AGPLv3+) (since 2018-12-09)
Light and fast Git hosting solution suitable to serve both as a hub or as a personal code storage with its tickets, pull requests, API and much more.
Commit 3477c411854eb1749cfb1e423eab6455d9302ec5

Small fixes for init part
Author: Catalin(ux) M. BOIE
Author date (UTC): 2015-03-29 21:48
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2015-03-29 21:48
Parent(s): e19235372a5c1f19ce6e070ad6d0173571ebc50b
Signing key:
Tree: 4acacc9e4455a7e26d9e89f8ac13ba5eb3e70dec
File Lines added Lines deleted
Makefile.in 1 1
README.vm 3 0
TODO 9 2
duilder.conf 1 1
inc/admin.inc.php 6 1
inc/bug.inc.php 2 1
inc/state.inc.php 3 1
root/index.php 5 6
root/themes/default/admin/db_error.html 1 1
root/themes/default/download.html 4 2
root/themes/default/main.html 3 3
root/themes/default/pricing.html 12 2
samples/logrotate 1 1
samples/rg.conf 4 0
scripts/cron.php 4 5
File Makefile.in changed (mode: 100644) (index 791ede4..7528f39)
... ... tests:
22 22
23 23 install: all install: all
24 24 @mkdir -pv $(I_USR_SHARE)/$(PRJ) @mkdir -pv $(I_USR_SHARE)/$(PRJ)
25 cp -vdr admin inc hooks root scripts $(I_USR_SHARE)/$(PRJ)
25 cp -vdr inc hooks root scripts $(I_USR_SHARE)/$(PRJ)
26 26 @mkdir -pv $(I_ETC)/xinetd.d @mkdir -pv $(I_ETC)/xinetd.d
27 27 cp -vd --no-clobber samples/rg $(I_ETC)/xinetd.d/$(PRJ) cp -vd --no-clobber samples/rg $(I_ETC)/xinetd.d/$(PRJ)
28 28 @mkdir -pv $(I_ETC)/cron.d @mkdir -pv $(I_ETC)/cron.d
File README.vm changed (mode: 100644) (index 6df554d..a29cbbe)
... ... How to customize Fedora virtual machine image
8 8 - Allow this virtual machine to send mail (add it to the relay allow list). - Allow this virtual machine to send mail (add it to the relay allow list).
9 9 - You may want to set to it a static IP address instead of DHCP. - You may want to set to it a static IP address instead of DHCP.
10 10 - You may want to add it to the DNS server - You may want to add it to the DNS server
11 - Add a RNG device inside virtual machine?
12
13 It takes around 2 minutes for the first boot to setup needed things to run.
File TODO changed (mode: 100644) (index f441cb0..da7761b)
13 13 Apoi as putea elimina description_nice. Apoi as putea elimina description_nice.
14 14 [ ] Security: Link-uri + xss (Ionut) [ ] Security: Link-uri + xss (Ionut)
15 15 [ ] Only one daemon should update the structure, else they will conflict. [ ] Only one daemon should update the structure, else they will conflict.
16 [ ] Seems I must get rid of init.php: locks are owned by root and I cannot
17 do struct_update&fixes as the rocketgit user.
18 16 [ ] Beta sign. [ ] Beta sign.
17 [ ] Use a cache var to signal all daemons that we are ready to go.
18 Or better, a file in /var/lib/rocketgit?
19 [ ] Recheck what may be run as root in scripts/ folder
20 [ ] We need to be able to delete old files! We cannot release the vm without
21 this!
22 [ ] Upload kvm image to downloads.rocketgit.com. Sign it? sha256 it?
23 [ ] Secutiry: validate sparas!
19 24 [ ] [ ]
20 25
21 26 == BEFORE NEXT RELEASE == == BEFORE NEXT RELEASE ==
27 [ ] Warn users on the first page for behind-the-firewall installations
28 that a new version is avilable. Maybe also the severity level.
22 29 [ ] Add unit test for 'copy to' into git_log1. There is already one but does [ ] Add unit test for 'copy to' into git_log1. There is already one but does
23 30 not trigger the detection. Maybe we need a bigger file. not trigger the detection. Maybe we need a bigger file.
24 31 [ ] Make the blob show nicer and remove rg_template_list (replace [ ] Make the blob show nicer and remove rg_template_list (replace
File duilder.conf changed (mode: 100644) (index cc2e9cd..8ede7ca)
1 1 PRJ="rocketgit" PRJ="rocketgit"
2 VER="0.22"
2 VER="0.23"
3 3 REV="1" REV="1"
4 4 EXCLUDE=".exclude" EXCLUDE=".exclude"
5 5 EXPORT_PATH="/data/www/umbrella/kernel/us/rocketgit" EXPORT_PATH="/data/www/umbrella/kernel/us/rocketgit"
File inc/admin.inc.php changed (mode: 100644) (index 23bedb9..2a818a7)
... ... function rg_init($db, $rg)
165 165 global $rg_admin_email; global $rg_admin_email;
166 166
167 167 rg_prof_start("rg_init"); rg_prof_start("rg_init");
168 rg_log_enter("rg_init");
169
170 $ret = '';
168 171
169 172 $doit = rg_var_uint('doit'); $doit = rg_var_uint('doit');
170 173 if ($doit == 0) { if ($doit == 0) {
 
... ... function rg_init($db, $rg)
182 185 $rg['init'] = array(); $rg['init'] = array();
183 186 $rg['init']['uid'] = 0; $rg['init']['uid'] = 0;
184 187 $rg['init']['is_admin'] = 1; $rg['init']['is_admin'] = 1;
185 $rg['init']['rights'] = rg_rights_all('init::user');
188 $rg['init']['rights'] = rg_rights_all('user');
186 189 $rg['init']['confirm_token'] = ''; $rg['init']['confirm_token'] = '';
187 190 $rg['init']['plan_id'] = 1; $rg['init']['plan_id'] = 1;
188 191 $rg['init']['username'] = rg_var_str('init::username'); $rg['init']['username'] = rg_var_str('init::username');
 
... ... function rg_init($db, $rg)
191 194 $rg['init']['pass'] = rg_var_str('init::pass'); $rg['init']['pass'] = rg_var_str('init::pass');
192 195 $rg['init']['pass2'] = rg_var_str('init::pass2'); $rg['init']['pass2'] = rg_var_str('init::pass2');
193 196 $rg['init']['session_time'] = rg_var_uint('init::session_time'); $rg['init']['session_time'] = rg_var_uint('init::session_time');
197 $rg['init']['confirmed'] = 1; /* = no need to confirm */
194 198
195 199 if (!rg_valid_referer()) { if (!rg_valid_referer()) {
196 200 $errmsg[] = "invalid referer; try again"; $errmsg[] = "invalid referer; try again";
 
... ... function rg_init($db, $rg)
221 225 $ret .= rg_template("admin/init.html", $rg); $ret .= rg_template("admin/init.html", $rg);
222 226 } }
223 227
228 rg_log_exit();
224 229 rg_prof_end("rg_init"); rg_prof_end("rg_init");
225 230 return $ret; return $ret;
226 231 } }
File inc/bug.inc.php changed (mode: 100644) (index 6c14725..a24d26a)
... ... function rg_bug_edit($db, $login_ui, $ri, $data)
522 522 break; break;
523 523 } }
524 524
525 $rollback = 0;
526
525 527 // update cache // update cache
526 528 $data['ok'] = 1; $data['ok'] = 1;
527 529 $data['exists'] = 1; $data['exists'] = 1;
 
... ... function rg_bug_edit($db, $login_ui, $ri, $data)
532 534 rg_event_signal_daemon("", 0); rg_event_signal_daemon("", 0);
533 535
534 536 $ret = $data['bug_id']; $ret = $data['bug_id'];
535 $rollback = 0;
536 537 break; break;
537 538 } }
538 539
File inc/state.inc.php changed (mode: 100644) (index c9eae14..99cd7a5)
... ... function rg_state_get($db, $var)
41 41 break; break;
42 42 } }
43 43
44 // Not found in cache, try the database
44 45 $params = array("var" => $var); $params = array("var" => $var);
45 46 $sql = "SELECT value FROM state WHERE var = @@var@@ LIMIT 1"; $sql = "SELECT value FROM state WHERE var = @@var@@ LIMIT 1";
46 47 $res = rg_sql_query_params($db, $sql, $params); $res = rg_sql_query_params($db, $sql, $params);
 
... ... function rg_state_get($db, $var)
59 60 rg_sql_free_result($res); rg_sql_free_result($res);
60 61
61 62 // We cache it even if is not found // We cache it even if is not found
62 rg_cache_set("state::" . $var, $ret);
63 // TODO: I do not think it is OK to cache negative responses!
64 //rg_cache_set("state::" . $var, $ret);
63 65
64 66 break; break;
65 67 } }
File root/index.php changed (mode: 100644) (index fafbdc5..65bccd1)
... ... $rg['first_install_text'] = "?";
123 123 $r = rg_state_get($db, "first_install"); $r = rg_state_get($db, "first_install");
124 124 if ($r === FALSE) { if ($r === FALSE) {
125 125 // Probably we cannot connect to database/cache // Probably we cannot connect to database/cache
126 } else if ($r == 0) {
126 $body .= rg_template('admin/db_error.html');
127 } else if ($r === '') {
127 128 $body .= rg_init($db, $rg); $body .= rg_init($db, $rg);
128 129 } else if ($r > 0) { } else if ($r > 0) {
129 130 $rg['first_install_text'] = gmdate("Y-m-d", $r); $rg['first_install_text'] = gmdate("Y-m-d", $r);
130 }
131
132
133 rg_log("Dispatching to [$_op]");
134 include($INC . "/dispatch/dispatch.php");
135 131
132 rg_log("Dispatching to [$_op]");
133 include($INC . "/dispatch/dispatch.php");
134 }
136 135
137 136 if ($rg['login_ui']['uid'] > 0) { if ($rg['login_ui']['uid'] > 0) {
138 137 $rg['login_ui']['homepage'] = rg_re_userpage($rg['login_ui']); $rg['login_ui']['homepage'] = rg_re_userpage($rg['login_ui']);
File root/themes/default/admin/db_error.html copied from file root/themes/default/access_denied.html (similarity 50%) (mode: 100644) (index e5e4ea1..73148e6)
1 1 <div class="warning"> <div class="warning">
2 Access is not allowed!
2 Cannot connect to database.
3 3 </div> </div>
File root/themes/default/download.html changed (mode: 100644) (index 415ce32..13f9b92)
32 32 <div class="island_cell"> <div class="island_cell">
33 33 <div class="island"> <div class="island">
34 34 <div class="island_title">Virtual machines images</div> <div class="island_title">Virtual machines images</div>
35 Please allow us few days to provide images for KVM, VirtualBox and VMWare.
36 We will do our best to go under 100MiB per image.
35 For KVM based machines, use this
36 <a href="http://downloads.embedromix.ro/rocketgit-kvm-0.22.qcow2">link</a> (193MiB).
37 Please allow us few days to provide images for VirtualBox and VMWare.
38 We will do our best to go under 200MiB per image.
37 39 </div> </div>
38 40 </div> </div>
39 41 </div> </div>
File root/themes/default/main.html changed (mode: 100644) (index e238814..f748fad)
21 21
22 22 <div class="island_cell"> <div class="island_cell">
23 23 <div class="island"> <div class="island">
24 <div class="island_title">No Enterprise Edition</div>
24 <div class="island_title">No separate Enterprise Edition</div>
25 25 In case you are wondering about the Enterprise Edition, we are happy to In case you are wondering about the Enterprise Edition, we are happy to
26 26 inform you that this is the same version as the one running here, on inform you that this is the same version as the one running here, on
27 27 rocketgit.com. Therefore, you can choose to run RocketGit rocketgit.com. Therefore, you can choose to run RocketGit
 
34 34 <div class="island_cell"> <div class="island_cell">
35 35 <div class="island"> <div class="island">
36 36 <div class="island_title">Business</div> <div class="island_title">Business</div>
37 Perhaps you want to know how we intend to sustain this business without a
38 mandatory fee for using the Enterprise Edition. We plan to do this by
37 Perhaps you want to know how we intend to sustain this business without
38 a mandatory fee for using our software. We plan to do this by
39 39 offering paid support, by charging for customization, by accepting ads offering paid support, by charging for customization, by accepting ads
40 40 (very targeted and no Flash/JavaScript) and (very targeted and no Flash/JavaScript) and
41 41 <a href="/op/donate">donations</a>. <a href="/op/donate">donations</a>.
File root/themes/default/pricing.html changed (mode: 100644) (index 19d0bc5..10acfb4)
21 21 <div class="island_cell"> <div class="island_cell">
22 22 <div class="island"> <div class="island">
23 23 <div class="island_title">Support</div> <div class="island_title">Support</div>
24 If you need support, please contact us at support@rocketgit.com
25 to discuss your options.
24 Contact us at support@rocketgit.com for best-effort support.
25 In the near future we will setup a mailing list for support.
26 </div>
27 </div>
28 </div>
29
30 <div class="island_row">
31 <div class="island_cell">
32 <div class="island">
33 <div class="island_title">Paid support</div>
34 If you need paid support, please contact us at
35 paid-support@rocketgit.com to discuss your options.
26 36 </div> </div>
27 37 </div> </div>
28 38 </div> </div>
File samples/logrotate changed (mode: 100644) (index 24e5e14..9c3efe9)
1 # Files will be rotated baesd on config.php file
1 # Files will be rotated based on config.php file
File samples/rg.conf changed (mode: 100644) (index 05c4c57..fb8da8e)
13 13 Require all granted Require all granted
14 14 </Directory> </Directory>
15 15
16 KeepAlive On
17 MaxKeepAliveRequests 1000
18 KeepAliveTimeout 10
19
16 20 RewriteEngine On RewriteEngine On
17 21 #RewriteLog /var/log/httpd/rg-Rewrite.log #RewriteLog /var/log/httpd/rg-Rewrite.log
18 22 #RewriteLogLevel 3 #RewriteLogLevel 3
File scripts/cron.php changed (mode: 100644) (index e14d92c..e0d2586)
... ... $r = rg_fixes_update($db);
41 41 if ($r !== TRUE) if ($r !== TRUE)
42 42 exit(1); exit(1);
43 43
44 // Store the timestamp of the first install
45 $first_install = rg_state_get($db, "first_install");
46 if ($first_install == 0)
47 rg_state_set($db, "first_install", time());
48
49 44 $install_id = rg_state_get($db, "install_id"); $install_id = rg_state_get($db, "install_id");
50 45 if (empty($install_id)) if (empty($install_id))
51 46 rg_state_set($db, "install_id", sha512(microtime(TRUE))); rg_state_set($db, "install_id", sha512(microtime(TRUE)));
52 47
48 $first_install = rg_state_get($db, 'first_install');
49 if ($first_install === '')
50 exit(0);
51
53 52 if ((gmdate("H") == 0) && (gmdate("i") == 3)) { if ((gmdate("H") == 0) && (gmdate("i") == 3)) {
54 53 while (1) { while (1) {
55 54 rg_log("Compute repository sizes if dirty..."); rg_log("Compute repository sizes if dirty...");
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master