generate tar.bz2 instead of zip
[phorkie.git] / README.rst
1 ************************************
2 phorkie - PHP and Git based pastebin
3 ************************************
4 Self-hosted pastebin software written in PHP.
5 Pastes are editable, may have multiple files and are stored in git repositories.
6
7 Project page: http://sourceforge.net/p/phorkie/
8
9 .. contents:: Table of Contents
10
11 ========
12 Features
13 ========
14 - every paste is a git repository
15
16   - repositories can be cloned
17   - clone url can be displayed
18 - paste editing
19
20   - add new files
21   - delete existing files
22   - replace file with upload
23 - multiple files in one paste
24 - syntax highlighting with GeSHi
25 - rST rendering
26 - image upload + display
27 - external tool support
28
29   - xmllint
30   - php syntax check
31 - history in the sidebar
32
33   - old files can be downloaded easily
34 - search across pastes: description, file names and file content
35
36   - options: quoting, logical and, or, not, partial words
37
38
39 ============
40 Installation
41 ============
42 1. Unzip the phorkie release file::
43
44    $ tar xjvf phorkie-0.2.0.tar.bz2
45
46 2. Create the git directories::
47
48    $ mkdir -p repos/git repos/work
49    $ chmod og+w repos/git repos/work
50
51 3. Install dependencies_
52
53 4. Copy ``data/config.php.dist`` to ``data/config.php`` and adjust it
54    to your needs::
55
56    $ cp data/config.php.dist data/config.php
57    $ $EDITOR data/config.php
58
59 5. Set your web server's document root to ``/path/to/phorkie-0.2.0/www/``
60
61 6. Open phorkie in your web browser
62
63
64 Dependencies
65 ============
66 phorkie stands on the shoulders of giants.
67
68 ::
69
70   $ pear install versioncontrol_git-alpha
71   $ pear install services_libravatar-alpha
72   $ pear install http_request2
73   $ pear install pager
74   $ pear install https://github.com/downloads/cweiske/Date_HumanDiff/Date_HumanDiff-0.1.0.tgz
75
76   $ pear channel-discover pear.twig-project.org
77   $ pear install twig/Twig
78
79   $ pear channel-discover mediawiki.googlecode.com/svn
80   $ pear install mediawiki/geshi
81
82 Note that this version of GeSHi is a bit outdated, but it's the fastest
83 way to install it.
84
85
86 ======
87 Search
88 ======
89
90 phorkie makes use of an Elasticsearch__ installation if you have one.
91
92 It is used to provide search capabilities and the list of recent pastes.
93
94 __ http://www.elasticsearch.org/
95
96 Setup
97 =====
98 Edit ``config.php``, setting the ``elasticsearch`` property to the HTTP URL
99 of the index, e.g. ::
100
101   http://localhost:9200/phorkie/
102
103 Run the index script to import all existing pastes into the index::
104
105   php scripts/index.php
106
107 That's all. Open phorkie in your browser, and you'll notice the search box
108 in the top menu.
109
110
111 =====
112 HowTo
113 =====
114
115 Make git repositories clonable
116 ==============================
117 To make git repositories clonable, you need to install ``git-daemon``
118 (``git-daemon-run`` package on Debian/Ubuntu).
119
120 Now make the repositories available by symlinking the paste repository
121 directory (``$GLOBALS['phorkie']['cfg']['repos']`` setting) into
122 ``/var/cache/git``, e.g.::
123
124   $ ln -s /home/user/www/paste/repos/git /var/cache/git/paste
125
126 Edit your ``config.php`` and set the ``$GLOBALS['phorkie']['cfg']['git']['public']``
127 setting to ``git://$yourhostname/git/paste/``.
128 The rest will be appended automatically.
129
130
131 You're on your own to setup writable repositories.
132
133
134 =================
135 Technical details
136 =================
137
138 TODO
139 ====
140 - OpenID-Login to get username+email as authorship information
141 - filters (``xmllint --format``, ``rapper``)
142 - document how to keep disk usage low (block size)
143 - comments
144 - when 2 people edit, merge changes
145 - diff changes
146 - configurable highlights
147 - Atom feed for new pastes
148 - Atom feed for paste changes
149
150
151 URLs
152 ====
153
154 ``/``
155   Index page. Shows form for new paste
156 ``/[0-9]+``
157   Display page for paste
158 ``/[0-9]/edit``
159   Edit the paste
160 ``/[0-9]+/raw/(.+)``
161   Display raw file contents
162 ``/[0-9]/tool/[a-zA-Z]+/(.+)``
163   Run a tool on the given file
164 ``/[0-9]/rev/[a-z0-9]+``
165   Show specific revision of the paste
166 ``/[0-9]/delete``
167   Delete the paste
168 ``/[0-9]/fork``
169   Create a fork of the paste
170 ``/search?q=..(&page=[0-9]+)?``
171   Search for term, with optional page
172 ``/list(/[0-9])?``
173   List all pastes, with optional page
174
175
176 Internal directory layout
177 =========================
178 ::
179
180   repos/
181     work/
182       1/ - work directory for paste #1
183       2/ - work directory for paste #2
184     git/
185       1.git/ - git repository for paste #1
186         description - Description for the repository
187       2.git/ - git repository for paste #2