Skip to content

Commit

Permalink
imrpvoe readme for CGI installation
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki-kimoto committed Jun 27, 2015
1 parent b977722 commit 4e57585
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 156 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
- add --ignore-space-change feature in diff page by using w= query string
for example, http://some.com/kimoto/gitprep_t/commit/3cf14ade5e28ee0cd83b9a3b1e1c332aed66df53?w=
- remove password length limit
- improve CGI installation and change CGI script path. This is not backword compatible.
you need to change CGI script path, path/gitprep.cgi to path/gitprep/gitprep/cgi
- remove setup.php

1.9.2
- fix atom feed entry url bug
1.9.1
Expand Down
270 changes: 115 additions & 155 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
Github clone. You can install portable github system into Unix/Linux.

<img src="http://cdn-ak.f.st-hatena.com/images/fotolife/p/perlcodesample/20130421/20130421180903_original.png" width="850">

# Features
## Features

* Github clone: GitPrep has the same interface as GitHub.
* Portable: You can install GitPrep on your own Unix/Linux server.
Expand All @@ -14,216 +13,129 @@ Github clone. You can install portable github system into Unix/Linux.
* CGI support, built-in web server, and reverse proxy support.
* SSL support.

# Installation into own Unix/Linux Server

GitPrep has its own web server,
so you can start using the application very easily.
This is much better than the way shown above
because you do not need to setup the Apache environment
and performance will be much better.

You can also install GitPrep into Cygwin.
If you want to install GitPrep into Cygwin,
gcc4 and make program are needed.

## Create gitprep user

Create a **gitprep** user. This is not necessary, but recommended:

useradd gitprep
su - gitprep
cd ~

## Download

Download tar.gz archive, expand it and change directory:

curl -kL https://github.com/yuki-kimoto/gitprep/archive/latest.tar.gz > gitprep-latest.tar.gz
tar xf gitprep-latest.tar.gz
mv gitprep-latest gitprep
cd gitprep

## Setup
## Check Perl Version

To setup GitPrep, execute the following command. All of the needed modules will be installed:
Check Perl version. You can use GitPrep if the Perl version is 5.8.7+;

./setup.sh

## Test

Run the test to check if the setup process was successful or not:

prove t

If "All tests successful" is shown, the setup process was successful.
perl -v

## Configuration

GitPrep needs the git command. You must install git by yourself.
If you haven't set user.name and user.email, you must set them.
For example:

git config --global user.name "gitprep"
git config --global user.email "[email protected]"

You must add the correct git command path to the **gitprep.conf** config file.
If you install git in your local directry,
you must add the correct git command path to the **gitprep.conf** config file

[basic]
;;; Git command path
git_bin=/home/yourname/local/bin/git

## Operation

### Start

You can start the application by running the provided gitprep script.
The application is run in the background and the port is **10020** by default.

./gitprep

Then access the following URL.

http://localhost:10020

If you want to change the port, edit gitprep.conf.
If you cannot access this port, you might change the firewall settings.

### Stop

You can stop the application by adding the **--stop** option.

./gitprep --stop

### Operation from root user

You can manage the application from the root user.

Start the application

sudo -u gitprep /home/gitprep/gitprep/gitprep

Stop the application

sudo -u gitprep /home/gitprep/gitprep/gitprep --stop

If you want to start the application when the OS starts,
add the start application command to **rc.local**(Linux).

If you want to make it easy to manage gitprep,
then create a run script.

mkdir -p /webapp
echo '#!/bin/sh' > /webapp/gitprep
echo 'su - gitprep -c "/home/gitprep/gitprep/gitprep $*"' >> /webapp/gitprep
chmod 755 /webapp/gitprep

You can start and stop the application with the following command.

# Start or Restart
/webapp/gitprep

# Stop
/webapp/gitprep --stop

## Developer

If you are a developer, you can start the application in development mode.

./morbo

Then access the following URL.
## A. Installation when you run GitPrep as CGI script

http://localhost:3000
Download tar.gz archive, expand it and change directory:

If you have git, it is easy to install from git.
curl -kL https://github.com/yuki-kimoto/gitprep/archive/latest.tar.gz > gitprep-latest.tar.gz
tar xf gitprep-latest.tar.gz
mv gitprep-latest gitprep
cd gitprep

git clone git://github.com/yuki-kimoto/gitprep.git
Setup. Needed module is installed.

It is useful to write configuration in ***gitprep.my.conf***, not gitprep.conf.
./setup.sh

# Installation into Shared Server
Check setup. Run the following command.

Shared Server must support **Linux/Unix**, **Apache**, **SuExec**,
**CGI**.
prove t

**Note that CGI script only work on shared server which support CGI + SuExec.
At first, you should check the shared server support CGI + SuExec.**
If "syntax OK" is displayed, setup is sucseed.

## Download
You can access the following URL.

First you need to [download gitprep](https://github.com/yuki-kimoto/gitprep/archive/latest.zip).
http://yourhost/somepath/gitprep/gitprep.cgi

Expand the zip file. You will see the following directory:
### If you see Internal Server Error

gitprep-latest
If you see an internal server error, look at the log file (gitprep/log/production.log)
to see what problem has occurred.

Rename the gitprep-latest directory to gitprep.
### Additional work when you don't run CGI script by your user authority.

gitprep-latest -> gitprep
If CGI script isn't run by your user authority, you need the following work.
For example, CGI script is run by apache authority.

If you know latest gitprep release, I inform you in the following blog
or mailing list.
Change user and group of all files in gitprep directory to apache

[Yuki Kimoto Perl Blog](http://blogs.perl.org/users/yuki_kimoto/)
chown -R apache:apache gitprep

[Google GitPrep Group](https://groups.google.com/forum/#!forum/gitprep)
In this case, you server need to execute CGI.
Check apache config file.

## Configuration
For example, you need the following config.

Same as "Installation into own Unix/Linux Server" Configuration section.
<Directory /var/www/html>
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>

## Upload Server by FTP
## B. Installation when you run GitPrep as embdded web server

You should upload these directories into server document root by FTP.
GitPrep has its own web server,
so you can start using the application very easily.
In this way, performance is much better than CGI.

## Setup
### Create gitprep user

Access the following URL by browser:
Create a **gitprep** user. This is not necessary, but recommended:

http://(Your host name)/gitprep/setup/setup.php
useradd gitprep
su - gitprep
cd ~

If you don't access PHP file or don't have PHP,
you can use CGI script. Please set this CGI script permission to `755`.
### Download

http://(Your host name)/gitprep/setup/setup.cgi
Download tar.gz archive, expand it and change directory:

Click the Setup button once and wait about 5 minutes.
curl -kL https://github.com/yuki-kimoto/gitprep/archive/latest.tar.gz > gitprep-latest.tar.gz
tar xf gitprep-latest.tar.gz
mv gitprep-latest gitprep
cd gitprep

## Go to application
Setup. Needed module is installed.

If you see the result screen, click "Go to Application".
./setup.sh

## Getting started
Check setup. Run the following command.

On a fresh install, you will be asked to create the admin user.
prove t

Log in as the admin user, then create a new regular user.
If "syntax OK" is displayed, setup is sucseed.

Logout and log in as the regular user. Create repos and use the system!
### Start

Note: the admin user cannot create repos.
You can start the application by running the provided gitprep script.
The application is run in the background and the port is **10020** by default.

## Importing data
./gitprep

One way to import data:
Then access the following URL.

1. Create your new repo in gitprep.
2. In your local git repo, add a new remote target:
```
git remote add gitprep [email protected]:new-repo.git
```
3. Push all your repo content up in to this new gitprep target.
4. Update your local git repo config such that gitprep is now the origin.
http://localhost:10020

Copy from `/var/lib/gitolite` or `/var/lib/gitosis`
If you want to change the port, edit gitprep.conf.
If you cannot access this port, you might change the firewall settings.

TBD
### Stop

## Internal Server Error
You can stop the application by adding the **--stop** option.

If you receive an internal server error, look at the log file (gitprep/log/production.log)
to see what problem has occurred.
./gitprep --stop

# FAQ
## FAQ

### blame don't work

Expand Down Expand Up @@ -466,6 +378,53 @@ You can get atom feed of commits page by the following URL

http://somehost.com/kimoto/gitprep/commits/master.atom

### How to run GitPrep from root user

You can manage the application from the root user.

Start the application

sudo -u gitprep /home/gitprep/gitprep/gitprep

Stop the application

sudo -u gitprep /home/gitprep/gitprep/gitprep --stop

If you want to start the application when the OS starts,
add the start application command to **rc.local**(Linux).

If you want to make it easy to manage gitprep,
then create a run script.

mkdir -p /webapp
echo '#!/bin/sh' > /webapp/gitprep
echo 'su - gitprep -c "/home/gitprep/gitprep/gitprep $*"' >> /webapp/gitprep
chmod 755 /webapp/gitprep

You can start and stop the application with the following command.

# Start or Restart
/webapp/gitprep

# Stop
/webapp/gitprep --stop

## For Developer

If you are a developer, you can start the application in development mode.

./morbo

Then access the following URL.

http://localhost:3000

If you have git, it is easy to install from git.

git clone git://github.com/yuki-kimoto/gitprep.git

It is useful to write configuration in ***gitprep.my.conf***, not gitprep.conf.

## Web Site

[GitPrep Web Site](http://perlcodesample.sakura.ne.jp/gitprep-site/)
Expand All @@ -484,6 +443,7 @@ You can get atom feed of commits page by the following URL
* [Text::Markdown::Hoedown](http://search.cpan.org/~tokuhirom/Text-Markdown-Hoedown-1.01/lib/Text/Markdown/Hoedown.pm)
* [Validator::Custom](http://search.cpan.org/dist/Validator-Custom/lib/Validator/Custom.pm)


## Sister project

These are my Perl web application projects.
Expand Down
2 changes: 1 addition & 1 deletion lib/Gitprep.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use Mojolicious::Plugin::AutoRoute::Util 'template';
eval {require Digest::SHA; import Digest::SHA qw(sha1 sha1_hex)};
}

our $VERSION = 'v1.10_dev';
our $VERSION = 'v1.10';

has 'dbi';
has 'git';
Expand Down
1 change: 1 addition & 0 deletions script/gitprep
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env perl

use Mojo::Base -strict;

use File::Basename 'dirname';
Expand Down

0 comments on commit 4e57585

Please sign in to comment.