fix readme
|
1 |
# GitPrep version v1.12 document |
add the document link of ver...
|
2 | |
3 |
Github clone. You can install portable github system into Unix/Linux. |
|
4 | ||
5 |
See GitPrep example site. [GitPrep example site](http://perlcodesample.sakura.ne.jp/gitprep/gitprep.cgi/kimoto/gitprep) |
|
6 | ||
fix readme
|
7 |
![GitPrep Image](../gitprep_image.png "Gitprep image example") |
add the document link of ver...
|
8 | |
9 |
## Features |
|
10 | ||
11 |
* Github clone: GitPrep has the same interface as GitHub. |
|
12 |
* Portable: You can install GitPrep on your own Unix/Linux server. |
|
13 |
* Supports Windows installation via cygwin for Windows (need gcc4 package). |
|
14 |
* Only needs Perl 5.8.7+. |
|
15 |
* Smart HTTP support: you can pull and push via HTTP |
|
16 |
* CGI support, built-in web server, and reverse proxy support. |
|
17 |
* SSL support. |
|
18 | ||
19 |
## Check Perl Version |
|
20 | ||
21 |
Check Perl version. You can use GitPrep if the Perl version is 5.8.7+; |
|
22 | ||
23 |
perl -v |
|
24 | ||
25 |
### Checki git command existance |
|
26 | ||
27 |
git --version |
|
28 |
|
|
29 |
## A. Installation when you run GitPrep as CGI script |
|
30 | ||
31 |
Download tar.gz archive, expand it and change directory: |
|
32 | ||
33 |
curl -kL https://github.com/yuki-kimoto/gitprep/archive/latest.tar.gz > gitprep-latest.tar.gz |
|
34 |
tar xf gitprep-latest.tar.gz |
|
35 |
mv gitprep-latest gitprep |
|
36 |
cd gitprep |
|
37 | ||
38 |
Setup. Needed module is installed. |
|
39 | ||
40 |
./setup.sh |
|
41 | ||
42 |
If you install git in your local directry, |
|
43 |
you must add the correct git command path to the **gitprep.conf** config file. |
|
44 | ||
45 |
[basic] |
|
46 |
;;; Git command path |
|
47 |
git_bin=/home/yourname/local/bin/git |
|
48 | ||
49 |
Check setup. Run the following command. |
|
50 | ||
51 |
prove t |
|
52 | ||
53 |
If "syntax OK" is displayed, setup is sucseed. |
|
54 | ||
55 |
You can access the following URL. |
|
56 | ||
57 |
http://yourhost/somepath/gitprep/gitprep.cgi |
|
58 | ||
59 |
### If you see Internal Server Error |
|
60 | ||
61 |
If you see an internal server error, look at the log file (gitprep/log/production.log) |
|
62 |
to see what problem has occurred. |
|
63 | ||
64 |
### Additional work when you don't run CGI script by your user. |
|
65 | ||
66 |
If CGI script isn't run by your user, you need the following work. |
|
67 |
For example, CGI script is run by apache user. |
|
68 | ||
69 |
Change user and group of all files in gitprep directory to apache |
|
70 | ||
71 |
chown -R apache:apache gitprep |
|
72 | ||
73 |
In this case, you server need to execute CGI. |
|
74 |
Check apache config file. |
|
75 | ||
76 |
For example, you need the following config. |
|
77 | ||
78 |
<Directory /var/www/html> |
|
79 |
Options +ExecCGI |
|
80 |
AddHandler cgi-script .cgi |
|
81 |
</Directory> |
|
82 | ||
83 |
## B. Installation when you run GitPrep as embdded web server |
|
84 | ||
85 |
GitPrep has its own web server, |
|
86 |
so you can start using the application very easily. |
|
87 |
In this way, performance is much better than CGI. |
|
88 | ||
89 |
### Create gitprep user |
|
90 | ||
91 |
Create a **gitprep** user. This is not necessary, but recommended: |
|
92 | ||
93 |
useradd gitprep |
|
94 |
su - gitprep |
|
95 |
cd ~ |
|
96 | ||
97 |
And config global git config |
|
98 | ||
99 |
git config --global user.name "gitprep" |
|
100 |
git config --global user.email "gitprep@example.com" |
|
101 | ||
102 |
### Download |
|
103 | ||
104 |
Download tar.gz archive, expand it and change directory: |
|
105 | ||
106 |
curl -kL https://github.com/yuki-kimoto/gitprep/archive/latest.tar.gz > gitprep-latest.tar.gz |
|
107 |
tar xf gitprep-latest.tar.gz |
|
108 |
mv gitprep-latest gitprep |
|
109 |
cd gitprep |
|
110 | ||
111 |
Setup. Needed module is installed. |
|
112 | ||
113 |
./setup.sh |
|
114 | ||
115 |
Check setup. Run the following command. |
|
116 | ||
117 |
prove t |
|
118 | ||
119 |
If "syntax OK" is displayed, setup is sucseed. |
|
120 | ||
121 |
### Start |
|
122 | ||
123 |
You can start the application by running the provided gitprep script. |
|
124 |
The application is run in the background and the port is **10020** by default. |
|
125 | ||
126 |
./gitprep |
|
127 | ||
128 |
Then access the following URL. |
|
129 | ||
130 |
http://localhost:10020 |
|
131 | ||
132 |
If you want to change the port, edit gitprep.conf. |
|
133 |
If you cannot access this port, you might change the firewall settings. |
|
134 | ||
135 |
### Stop |
|
136 | ||
137 |
You can stop the application by adding the **--stop** option. |
|
138 | ||
139 |
./gitprep --stop |
|
140 | ||
141 |
## FAQ |
|
142 | ||
143 |
## Can't find git command from GitPrep |
|
144 | ||
145 |
If you install git into your local directry, |
|
146 |
you must add the correct git command path to the config file **gitprep.conf** . |
|
147 | ||
148 |
[basic] |
|
149 |
;;; Git command path |
|
150 |
git_bin=/home/yourname/local/bin/git |
|
151 | ||
152 |
### blame don't work |
|
153 | ||
154 |
In Gitprep, blame page use "git blame --line-porcelain". In old git, there is no --line-porcelain option. |
|
155 |
We don't know when --line-porcelain was added to git. |
|
156 |
At least, blame page work well in git 1.8.2.1. |
|
157 | ||
158 |
### How to upgrade GitPrep |
|
159 | ||
160 |
It is very easy. you only overwrite all files except for "gitprep.conf". |
|
161 | ||
162 |
If you want to upgrade by "git pull", you can do it. |
|
163 |
you create "gitprep.my.conf" copied from "gitprep.my.conf", |
|
164 |
and do "git pull" |
|
165 | ||
166 |
If you get a rainbow unicorn t-rex error after upgrading, you might be missing |
|
167 |
a new CPAN dependency. Run again "setup.sh". |
|
168 | ||
169 |
### I can't push large repository by http protocol |
|
170 | ||
171 |
There are some reasons. |
|
172 | ||
173 |
**1. Git version is old** |
|
174 | ||
175 |
If you see "error: RPC failed; result=56, HTTP code = 200" , your git maybe old. |
|
176 |
Please upgrade to latest git. I checked git version 1.8.5.5. |
|
177 | ||
178 |
**2. GitPrep restriction** |
|
179 | ||
180 |
GitPrep restrict max post message size 10MB(This is default of Mojolicious) |
|
181 | ||
182 |
You maybe see the following error |
|
183 | ||
184 |
Delta compression using up to 4 threads. |
|
185 |
Compressing objects: 100% (17830/17830), done. |
|
186 |
Writing objects: 100% (18281/18281), 687.05 MiB | 129.92 MiB/s, done. |
|
187 |
Total 18281 (delta 295), reused 18281 (delta 295) |
|
188 |
error: RPC failed; result=22, HTTP code = 413 |
|
189 |
fatal: The remote end hung up unexpectedly |
|
190 |
fatal: The remote end hung up unexpectedly |
|
191 | ||
192 |
Please increase increase the value of MOJO_MAX_MESSAGE_SIZE |
|
193 |
|
|
194 |
# 1GB |
|
195 |
export MOJO_MAX_MESSAGE_SIZE=1024000000 |
|
196 | ||
197 |
**3. git restriction** |
|
198 | ||
199 |
git restrict post max size via http protocol. |
|
200 |
http.postBuffer value of git config is maybe small. |
|
201 | ||
202 |
You maybe see the following error message. |
|
203 | ||
204 |
error: RPC failed; result=56, HTTP code = 200 |
|
205 |
fatal: The remote end hung up unexpectedly |
|
206 |
Counting objects: 18281, done. |
|
207 |
Delta compression using up to 4 threads. |
|
208 |
Compressing objects: 100% (17830/17830), done. |
|
209 |
Writing objects: 100% (18281/18281), 687.05 MiB | 133.23 MiB/s, done. |
|
210 |
Total 18281 (delta 295), reused 18281 (delta 295) |
|
211 |
fatal: The remote end hung up unexpectedly |
|
212 |
Everything up-to-date |
|
213 | ||
214 |
Please increase the value of http.postBuffer. |
|
215 |
|
|
216 |
# 1GB |
|
217 |
git config http.postBuffer 1024000000 |
|
218 | ||
219 |
### I can't create repository and see error message when I create repository with readme |
|
220 | ||
221 |
If you see the following error message in log/production.log |
|
222 | ||
223 |
[Wed Feb 12 15:27:02 2014] [error] ... Can't execute git commit ... |
|
224 | ||
225 |
you need to set User name and Email of git. |
|
226 |
Please set user.name and user.email. |
|
227 | ||
228 |
git config --global user.name "gitprep" |
|
229 |
git config --global user.email "gitprep@example.com" |
|
230 | ||
231 |
### How to use reverse proxy? |
|
232 | ||
233 |
You can use GitPrep via reverse proxy access |
|
234 | ||
235 |
---------------------------- ------------ |
|
236 |
---->| Web Server(Reverse proxy)|---->|GitPrep | |
|
237 |
<----| (Apache, etc) |<----| | |
|
238 |
---------------------------- ------------ |
|
239 | ||
240 |
I show apache config example. |
|
241 |
You can use Name virtual host. |
|
242 |
|
|
243 |
# HTTP |
|
244 |
<VirtualHost *:80> |
|
245 | ||
246 |
ServerName myhost.com |
|
247 |
<Proxy *> |
|
248 |
Order deny,allow |
|
249 |
Allow from all |
|
250 |
</Proxy> |
|
251 |
|
|
252 |
ProxyRequests Off |
|
253 |
ProxyPreserveHost On |
|
254 |
ProxyPass / http://localhost:10020/ keepalive=On |
|
255 |
ProxyPassReverse / http://localhost:10020/ |
|
256 |
RequestHeader set X-Forwarded-HTTPS "0" |
|
257 |
|
|
258 |
</VirtualHost> |
|
259 | ||
260 |
If you use GitPrep vis https, you should set X-Forwarded-HTTPS Request Header. |
|
261 | ||
262 |
# HTTPS |
|
263 |
<VirtualHost *:443> |
|
264 | ||
265 |
ServerName myhost.com |
|
266 |
<Proxy *> |
|
267 |
Order deny,allow |
|
268 |
Allow from all |
|
269 |
</Proxy> |
|
270 |
|
|
271 |
ProxyRequests Off |
|
272 |
ProxyPreserveHost On |
|
273 |
ProxyPass / http://localhost:10020/ keepalive=On |
|
274 |
ProxyPassReverse / http://localhost:10020/ |
|
275 |
RequestHeader set X-Forwarded-HTTPS "1" |
|
276 |
</VirtualHost> |
|
277 | ||
278 |
### How to use reverse proxy with sub directory? |
|
279 | ||
280 |
GitPrep support reverse proxy with sub directory. |
|
281 | ||
282 |
At first, set [reverse_proxy]path_depth option. |
|
283 | ||
284 |
[reverse_proxy] |
|
285 | ||
286 |
;;; Reverse proxy path depth (default: none) |
|
287 |
;;; If proxy path is http://somehost.com/foo, you set path_depth to 1. |
|
288 |
;;; If proxy path is http://somehost.com/foo/bar, you set path_depth to 2. |
|
289 |
path_depth=1 |
|
290 | ||
291 |
Next you set http server config file. The following is apache example. |
|
292 | ||
293 |
<VirtualHost *:80> |
|
294 |
ServerName perlcodesample.com |
|
295 |
<Proxy *> |
|
296 |
Order deny,allow |
|
297 |
Allow from all |
|
298 |
</Proxy> |
|
299 |
ProxyRequests Off |
|
300 |
ProxyPreserveHost On |
|
301 | ||
302 |
ProxyPass /app1 http://localhost:10020/app1 keepalive=On |
|
303 |
ProxyPassReverse /app1 http://localhost:3000/app1 |
|
304 | ||
305 |
ProxyPass /app2 http://localhost:10021/app2 keepalive=On |
|
306 |
ProxyPassReverse /app2 http://localhost:3001/app2 |
|
307 | ||
308 |
RequestHeader set X-Forwarded-HTTPS "0" |
|
309 |
</VirtualHost> |
|
310 | ||
311 |
### How to import already existing repositories? |
|
312 | ||
313 |
You can import already existing repositories by **script/import_rep** script. |
|
314 | ||
315 |
cd script |
|
316 |
./import_rep -u kimoto rep_dir |
|
317 | ||
318 |
**-u** is user name. rep_dir must contains git respoitories like the following. |
|
319 | ||
320 |
rep_dir/project1.git |
|
321 |
/project2.git |
|
322 |
/project3.git |
|
323 |
/project3.git |
|
324 | ||
325 |
If **description** file exists in git repository, it is copied. |
|
326 | ||
327 |
### I can't add collabortor more than one |
|
328 | ||
329 |
This is GitPrep bug before version 1.5.1. |
|
330 |
Please use after version 1.5.2. |
|
331 | ||
332 |
If you continue to use GitPrep before version 1.5.1, |
|
333 |
collaboration table is broken. |
|
334 |
Please fix it by the following way. |
|
335 | ||
336 |
# Run SQLite client |
|
337 |
sqlite3 data/gitprep.db |
|
338 |
|
|
339 |
# drop collaboration table |
|
340 |
drop table collaboration; |
|
341 |
|
|
342 |
# Restart |
|
343 |
./gitprep |
|
344 | ||
345 |
### I want to set time zone. |
|
346 | ||
347 |
OK. GitPrep suport time zone. You can set time_zone option in conig file. |
|
348 | ||
349 |
[basic] |
|
350 |
;;; Time Zone |
|
351 |
;;; GitPrep time zone is GMT by default |
|
352 |
;;; You can set your local time zone. |
|
353 |
time_zone=+9:00 |
|
354 | ||
355 |
### How to hide user home directory in ssh repository URL? |
|
356 | ||
357 |
**1. Use symbolic link and ssh_rep_url_base option** |
|
358 | ||
359 |
At first, set [basic]ssh_rep_url_base option to /git |
|
360 | ||
361 |
;;; SSH repository url base |
|
362 |
; For exampke, If you set this value to /git, SSH repository url become |
|
363 |
; ssh://kimoto@59.106.185.196/git/kimoto/gitprep.git |
|
364 |
ssh_rep_url_base=/git |
|
365 | ||
366 |
And you create symbolic link to /home/gitprep/gitprep/data/rep |
|
367 |
|
|
368 |
cd / |
|
369 |
ln -s /home/gitprep/gitprep/data/rep /git |
|
370 |
chown gitprep:gitprep /git |
|
371 | ||
372 |
**2. Use only public key authentication and set [basic]ssh_rep_url_base to empty** |
|
373 | ||
374 |
If you use only public key authentication, you can access ssh repository |
|
375 |
using the following url. |
|
376 | ||
377 |
ssh://kimoto@59.106.185.196/kimoto/gitprep.git |
|
378 | ||
379 |
If you set [basic]ssh_rep_url_base to empty string, this URL is shown on Browser. |
|
380 | ||
381 |
;;; SSH repository url base |
|
382 |
; For exampke, If you set this value to /git, SSH repository url become |
|
383 |
; ssh://kimoto@59.106.185.196/git/kimoto/gitprep.git |
|
384 |
ssh_rep_url_base= |
|
385 | ||
386 |
### How to get atom feed of commits page |
|
387 | ||
388 |
You can get atom feed of commits page by the following URL |
|
389 | ||
390 |
http://somehost.com/kimoto/gitprep/commits/master.atom |
|
391 | ||
392 |
### How to run GitPrep from root user |
|
393 | ||
394 |
You can manage the application from the root user. |
|
395 | ||
396 |
Start the application |
|
397 | ||
398 |
sudo -u gitprep /home/gitprep/gitprep/gitprep |
|
399 | ||
400 |
Stop the application |
|
401 | ||
402 |
sudo -u gitprep /home/gitprep/gitprep/gitprep --stop |
|
403 | ||
404 |
If you want to start the application when the OS starts, |
|
405 |
add the start application command to **rc.local**(Linux). |
|
406 | ||
407 |
If you want to make it easy to manage gitprep, |
|
408 |
then create a run script. |
|
409 | ||
410 |
mkdir -p /webapp |
|
411 |
echo '#!/bin/sh' > /webapp/gitprep |
|
412 |
echo 'su - gitprep -c "/home/gitprep/gitprep/gitprep $*"' >> /webapp/gitprep |
|
413 |
chmod 755 /webapp/gitprep |
|
414 | ||
415 |
You can start and stop the application with the following command. |
|
416 | ||
417 |
# Start or Restart |
|
418 |
/webapp/gitprep |
|
419 | ||
420 |
# Stop |
|
421 |
/webapp/gitprep --stop |
|
422 | ||
423 |
## For Developer |
|
424 | ||
425 |
If you are a developer, you can start the application in development mode. |
|
426 | ||
427 |
./morbo |
|
428 | ||
429 |
Then access the following URL. |
|
430 | ||
431 |
http://localhost:3000 |
|
432 | ||
433 |
If you have git, it is easy to install from git. |
|
434 | ||
435 |
git clone git://github.com/yuki-kimoto/gitprep.git |
|
436 | ||
437 |
It is useful to write configuration in ***gitprep.my.conf***, not gitprep.conf. |
|
438 | ||
439 |
## Web Site |
|
440 | ||
441 |
[GitPrep Web Site](http://gitprep.yukikimoto.com/) |
|
442 | ||
443 |
## Internally Using Library |
|
444 | ||
445 |
* [Config::Tiny](http://search.cpan.org/dist/Config-Tiny/lib/Config/Tiny.pm) |
|
446 |
* [DBD::SQLite](http://search.cpan.org/dist/DBD-SQLite/lib/DBD/SQLite.pm) |
|
447 |
* [DBI](http://search.cpan.org/dist/DBI/DBI.pm) |
|
448 |
* [DBIx::Connector](http://search.cpan.org/dist/DBIx-Connector/lib/DBIx/Connector.pm) |
|
449 |
* [DBIx::Custom](http://search.cpan.org/dist/DBIx-Custom/lib/DBIx/Custom.pm) |
|
450 |
* [Mojolicious](http://search.cpan.org/~sri/Mojolicious/lib/Mojolicious.pm) |
|
451 |
* [Mojolicious::Plugin::INIConfig](http://search.cpan.org/dist/Mojolicious-Plugin-INIConfig/lib/Mojolicious/Plugin/INIConfig.pm) |
|
452 |
* [mojo-legacy](https://github.com/jamadam/mojo-legacy) |
|
453 |
* [Object::Simple](http://search.cpan.org/dist/Object-Simple/lib/Object/Simple.pm) |
|
454 |
* [Text::Markdown::Hoedown](http://search.cpan.org/~tokuhirom/Text-Markdown-Hoedown-1.01/lib/Text/Markdown/Hoedown.pm) |
|
455 |
* [Validator::Custom](http://search.cpan.org/dist/Validator-Custom/lib/Validator/Custom.pm) |
|
456 | ||
457 | ||
458 |
## Sister project |
|
459 | ||
460 |
These are my Perl web application projects. |
|
461 | ||
462 |
* [WebDBViewer](https://github.com/yuki-kimoto/webdbviewer) - Database viewer to see database information on web browser. |
|
463 | ||
464 |
## Bug |
|
465 | ||
466 |
If you find bug, plese tell me on GitHub issue. |
|
467 | ||
468 |
Please post only bug information. |
|
469 | ||
470 |
* [Github Issue](https://github.com/yuki-kimoto/gitprep/issues?state=open) |
|
471 | ||
472 |
## Mailing list (Asking questions and feature requests) |
|
473 | ||
474 |
* [Google GitPrep Group](https://groups.google.com/forum/#!forum/gitprep) |
|
475 | ||
476 |
You can ask questions about usage of GitPrep in this mailing list. |
|
477 | ||
478 |
If you want new features, please post the request to this mailing list. |
|
479 | ||
480 |
## Copyright & license |
|
481 | ||
482 |
Copyright 2012-2014 Yuki Kimoto. All rights reserved. |
|
483 | ||
484 |
This program is free software; you can redistribute it and/or modify it |
|
485 |
under the same terms as Perl itself. |