Pastey

Pastey

Docker app from CorneliousJD's Repository

Overview

A lightweight, self-hosted paste platform (Pastebin alternative) with language detection and on-disk encryption.

logo

A minimal, self-hosted paste platform

Features

  • Self-contained system without external database dependencies
  • Automatic programming language detection
  • Optional on-disk encryption
  • Optional single use pastes
  • Optional expiration date
  • QR code generation
  • Theme system
  • IP/network whitelisting and blocking
  • Endpoint rate limiting
  • JSON API
  • Fully configurable via environment variables
  • Included script for uploading files/content from stdin

Screenshots

Browser

home new view

Dark

dark

CLI

screenshot5

Installation

Docker

It is highly recommended that you use the official Docker image to run Pastey. To do so, simply run:

$ docker run -d -p 5000:5000 -v /path/to/local/dir:/app/data cesura/pastey:latest

Change /path/to/local/dir to a local folder you would like to use for persistent paste storage. It will be mounted in the container at /app/data.

Pastey will then be accessible at http://localhost:5000

Docker (slim image OR non-AVX processor)

If you're interested in a slimmer image (or your processor does not have support for AVX instructions required by Tensorflow), a slim image without language detection is also maintained:

$ docker run -d -p 5000:5000 -v /path/to/local/dir:/app/data cesura/pastey:latest-slim

docker-compose

If you prefer to use docker-compose:

$ wget https://raw.githubusercontent.com/Cesura/pastey/main/docker-compose.yml && docker-compose up -d

Note that this must be modified if you wish to use a local directory for storage, rather than a Docker volume.

Local

With language detection

Requirements:

  • Python 3.8
  • AVX-enabled processor (or a Python environment configured to use Anaconda's Tensorflow)
$ git clone https://github.com/Cesura/pastey.git && cd pastey && mkdir ./data
$ pip3 install -r requirements.txt
$ python3 app.py 

Without language detection

If you prefer to not use the language detection feature, use the included patch_no_tensorflow.sh script to remove the guesslang requirements:

$ git clone https://github.com/Cesura/pastey.git && cd pastey && mkdir ./data
$ ./patch_no_tensorflow.sh && pip3 install -r requirements.txt
$ python3 app.py 

Configuration

Here is a list of the available configuration options:

Environment Variable config.py Variable Description Default Value
PASTEY_DATA_DIRECTORY data_directory Local directory for paste storage ./data
PASTEY_LISTEN_ADDRESS listen_address Address to listen on 0.0.0.0
PASTEY_LISTEN_PORT listen_port Port to listen on 5000
PASTEY_USE_WHITELIST use_whitelist Enable/disable whitelisting for admin tasks (view recent, delete, config) True
PASTEY_WHITELIST_CIDR whitelist_cidr List of whitelisted IP addresses or networks (in CIDR format). When passed as an environment variable, it should be a comma-separated list. [ '127.0.0.1/32' , '10.0.0.0/8' , '172.16.0.0/12' , '192.168.0.0/16' ]
PASTEY_BLACKLIST_CIDR blacklist_cidr List of blocked IP addresses or networks (in CIDR format). When passed as an environment variable, it should be a comma-separated list. []
PASTEY_RESTRICT_PASTING restrict_pasting Enable/disable restricting of pasting to whitelisted users False
PASTEY_RATE_LIMIT rate_limit Rate limit for pasting, for non-whitelisted users 5/hour
PASTEY_GUESS_THRESHOLD guess_threshold Threshold for automatic language detection guesses. If a result is below this value, it is treated as Plaintext. 0.20
PASTEY_RECENT_PASTES recent_pastes Number of recent pastes to show on the home page 10
PASTEY_BEHIND_PROXY behind_proxy Inform Pastey if it is behind a reverse proxy (nginx, etc.). If this is the case, it will rely on HTTP headers X-Real-IP or X-Forwarded-For. NOTE: Make sure your proxy config sets these values False
PASTEY_DEFAULT_THEME default_theme Select which theme Pastey should use by default. This is overridden by client options. Light
PASTEY_PURGE_INTERVAL purge_interval Purge interval (in seconds) for checking expired pastes in background thread 3600
PASTEY_FORCE_SHOW_RECENT force_show_recent Show recent pastes on the home page, even to non-whitelisted users (without delete button) False
PASTEY_IGNORE_GUESS ignore_guess Ignore these classifications for language detection ['TeX', 'SQL']
PASTEY_SHOW_CLI_BUTTON show_cli_button Enable/disabling showing of CLI button on home page True

Docker configuration

For Docker environments, it is recommended that the options be passed to the container on startup:

$ docker run -d -p 5000:5000 -e PASTEY_LISTEN_PORT=80 -e PASTEY_BEHIND_PROXY="True" cesura/pastey:latest

Install Pastey on Unraid in a few clicks.

Find Pastey in Community Apps on your Unraid server, review the template, and click Install. Unraid handles the Docker app or plugin setup from the published template.

Open the Apps tab on your Unraid server Search Community Apps for Pastey Review the template variables and paths Click Install

Download Statistics

113,006
Total Downloads
2,117
This Month
1,685
Avg / Month

Total Downloads Over Time

Loading chart...

Related apps

Details

Repository
cesura/pastey
Last Updated2022-09-06
First Seen2021-04-14

Runtime arguments

Web UI
http://[IP]:[PORT:5000]/
Network
bridge
Shell
sh
Privileged
false

Template configuration

Web InterfacePorttcp

Container Port: 5000

Target
5000
Default
5000
Value
5000
AppDataPathrw

Container Path: /app/data

Target
/app/data
Default
/mnt/user/appdata/pastey
Value
/mnt/user/appdata/pastey
PASTEY_RESTRICT_PASTINGVariable

Enable/disable restricting of pasting to whitelisted users.

Default
False
Value
False
PASTEY_RESTRICT_RAW_PASTINGVariable

Enable/disable restricting of pasting via /raw to whitelisted users.

Default
True
Value
True
PASTEY_RATE_LIMITVariable

Rate limit for pasting, for non-whitelisted users.

Default
5/hour
Value
5/hour
PASTEY_RECENT_PASTESVariable

Number of recent pastes to show on the home page.

Default
10
Value
10
PASTEY_BEHIND_PROXYVariable

Inform Pastey if it is behind a reverse proxy (nginx, etc.). If this is the case, it will rely on HTTP headers X-Real-IP or X-Forwarded-For. NOTE: Make sure your proxy config sets these values.

Default
False
Value
False
PASTEY_USE_WHITELISTVariable

Enable/disable whitelisting for admin tasks (view recent, delete, config).

Default
True
Value
True
PASTEY_WHITELIST_CIDRVariable

List of whitelisted IP addresses or networks (in CIDR format).

Value
127.0.0.1/32,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
PASTEY_GUESS_THRESHOLDVariable

Threshold for automatic language detection guesses. If a result is below this value, it is treated as Plaintext.

Default
0.20
Value
0.20