pb
is a lightweight pastebin (and url shortener) built using
flask.
The official instance of pb
can be found at ptpb.pw. Feel free to deploy pb
elsewhere.
- npm
- graphicsmagick
- python >= 3.4 requirements.txt
- mongodb >= 2.6
- varnish >= 4.0 (optional)
- gunicorn >= 19.1 (optional, or any other WSGI server)
This assumes you have at least a working python
and mongodb
with
versions strictly matching the the above. Consult your distribution's
documentation on how to do that.
Start by cloning pb
:
$ git clone https://github.com/silverp1/pb.git --recursive
Next, copy pb/config.yaml.example
to ~/.config/pb/config.yaml
,
and edit it appropriately. For development, its configuration might
look something like:
DEBUG: true
MONGO:
host: localhost
port: 27017
MONGO_DATABASE: pb
You'll also need to build pbs
, which requires
grunt-cli
:
# npm install -g grunt-cli
$ npm install
$ grunt
A pb
development environment could
be created with something like:
$ pip install virtualenv
$ virtualenv pbenv
$ source pbenv/bin/activate
(pbenv)$ pip install -r pb/requirements.txt
You should use runonce.py
to create indexes before you run pb
for the first time on a new database:
(pbenv)$ cd pb
(pbenv)$ ./runonce.py
You can then start a pb
instance via werkzeug's built-in WSGI
server.
(pbenv)$ ./run.py
Arch Linux
pb-git
is available in the AUR. This package provides
pb.service
which starts a uwsgi server on port 8080
by
default.
For now this requires aur/python-flask-git
, until 1.0 is released
upstream:
$ cower -dd pb-git
$ (cd python-flask-git && makepkg -si)
$ (cd pb-git && makepkg -si)
Next, start pb
with:
# systemctl start pb
You can play with pb's uwsgi configuration in /etc/uwsgi/pb.ini
.