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.
7 Project page: http://sourceforge.net/p/phorkie/
9 .. contents:: Table of Contents
14 - every paste is a git repository
16 - repositories can be cloned
17 - clone url can be displayed
21 - delete existing files
22 - replace file with upload
23 - OpenID authentication
24 - multiple files in one paste
25 - syntax highlighting with GeSHi
26 - rST and Markdown rendering
27 - image upload + display
28 - external tool support
32 - history in the sidebar
34 - old files can be downloaded easily
35 - search across pastes: description, file names and file content
37 - options: quoting, logical and, or, not, partial words
43 1. Unzip the phorkie release file::
45 $ tar xjvf phorkie-0.3.0.tar.bz2
47 2. Create the git directories::
49 $ mkdir -p repos/git repos/work
50 $ chmod og+w repos/git repos/work
52 3. Install dependencies_
54 4. Copy ``data/config.php.dist`` to ``data/config.php`` and adjust it
57 $ cp data/config.php.dist data/config.php
58 $ $EDITOR data/config.php
60 Look at ``config.default.php`` for values that you may adjust.
62 5. Set your web server's document root to ``/path/to/phorkie/www/``
64 6. Open phorkie in your web browser
69 phorkie stands on the shoulders of giants.
77 $ pear install versioncontrol_git-alpha
78 $ pear install services_libravatar-alpha
79 $ pear install http_request2
81 $ pear install date_humandiff-alpha
83 $ pear channel-discover pear.twig-project.org
84 $ pear install twig/Twig
86 $ pear channel-discover mediawiki.googlecode.com/svn
87 $ pear install mediawiki/geshi
89 $ pear channel-discover zustellzentrum.cweiske.de
90 $ pear install zz/mime_type_plaindetect-alpha
92 $ pear channel-discover pear.michelf.ca
93 $ pear install michelf/Markdown
95 Note that this version of GeSHi is a bit outdated, but it's the fastest
96 way to install it. If you install it manually be sure to update the
97 path in ``data/config.default.php``.
103 phorkie makes use of an Elasticsearch__ installation, if you have one.
105 It is used to provide search capabilities and the list of recent pastes.
107 __ http://www.elasticsearch.org/
111 Edit ``config.php``, setting the ``elasticsearch`` property to the HTTP URL
112 of the index, e.g. ::
114 http://localhost:9200/phorkie/
116 Run the index script to import all existing pastes into the index::
118 php scripts/index.php
120 That's all. Open phorkie in your browser, and you'll notice the search box
126 In case something really went wrong and you need to reset the search
127 index, run the following command::
129 $ curl -XDELETE http://localhost:9200/phorkie/
130 {"ok":true,"acknowledged"}
132 Phorkie will automatically re-index everything when ``setupcheck`` is enabled
133 in the configuration file.
140 Make git repositories clonable
141 ==============================
142 To make git repositories clonable, you need to install ``git-daemon``
143 (``git-daemon-run`` package on Debian/Ubuntu).
145 Make the repositories available by symlinking the paste repository
146 directory (``$GLOBALS['phorkie']['cfg']['repos']`` setting) into
147 ``/var/cache/git``, e.g.::
149 $ ln -s /home/user/www/paste/repos/git /var/cache/git/paste
151 Edit your ``config.php`` and set the ``$GLOBALS['phorkie']['cfg']['git']['public']``
152 setting to ``git://$yourhostname/git/paste/``.
153 The rest will be appended automatically.
155 You're on your own to setup writable repositories.
157 Protect your site with OpenID
158 =============================
159 You have the option of enabling OpenID authentication to help secure your
160 pastes on phorkie. Set the ``$GLOBALS['phorkie']['auth']`` values in the
161 ``data/config.php`` file as desired.
163 There are two different types of security you can apply. First, you can
164 restrict to one of three ``securityLevels``; completely open (``0``), protection
165 of write-enabled functions such as add, edit, etc. (``1``), and full site
166 protection (``2``). Additionally, you can restrict your site to ``listedUsersOnly``.
167 You will need to add the individual OpenIDs identity urls to the
168 ``$GLOBALS['phorkie']['auth']['users']`` variable.
177 - filters (``xmllint --format``, ``rapper``)
178 - document how to keep disk usage low (block size)
180 - when 2 people edit, merge changes
182 - configurable highlights
183 - Atom feed for new pastes
184 - Atom feed for paste changes
193 Display page for paste
197 Display raw file contents
198 ``/[0-9]/tool/[a-zA-Z]+/(.+)``
199 Run a tool on the given file
200 ``/[0-9]/rev/[a-z0-9]+``
201 Show specific revision of the paste
205 Show DOAP document for paste
207 Create a fork of the paste
208 ``/search?q=..(&page=[0-9]+)?``
209 Search for term, with optional page
211 List all pastes, with optional page
213 Shows form for new paste
215 Login page for protecting site
217 Edit logged-in user information
220 Internal directory layout
221 =========================
226 1/ - work directory for paste #1
227 2/ - work directory for paste #2
229 1.git/ - git repository for paste #1
230 description - Description for the repository
231 2.git/ - git repository for paste #2
235 If you use nginx, place the following lines into your ``server`` block:
239 if (!-e $request_uri) {
240 rewrite ^/([0-9]+)$ /display.php?id=$1;
241 rewrite ^/([0-9]+)/delete$ /delete.php?id=$1;
242 rewrite ^/([0-9]+)/delete/confirm$ /delete.php?id=$1&confirm=1;
243 rewrite ^/([0-9]+)/doap$ /doap.php?id=$1;
244 rewrite ^/([0-9]+)/edit$ /edit.php?id=$1;
245 rewrite ^/([0-9]+)/fork$ /fork.php?id=$1;
246 rewrite ^/([0-9]+)/raw/(.+)$ /raw.php?id=$1&file=$2;
247 rewrite ^/([0-9]+)/rev/(.+)$ /revision.php?id=$1&rev=$2;
248 rewrite ^/([0-9]+)/rev-raw/(.+)$ /raw.php?id=$1&rev=$2&file=$3;
249 rewrite ^/([0-9]+)/tool/([^/]+)/(.+)$ /tool.php?id=$1&tool=$2&file=$3;
251 rewrite ^/new$ /new.php;
252 rewrite ^/list$ /list.php;
253 rewrite ^/list/([0-9]+)$ /list.php?page=$1;
255 rewrite ^/search$ /search.php;
256 rewrite ^/search/([0-9]+)$ /search.php?page=$1;
258 rewrite ^/login$ /login.php;
259 rewrite ^/user$ /user.php;