hastebin-build/dockerhub.md

3.5 KiB

This repository provides the missing tagged releases for haste-server. It is built continuously from upstream. haste-server is a pretty, simple, and easy to set up and use pastebin software written in node.js.

Most other haste docker repositories are unfortunately out of date and/or are not built automatically on a regular basis. Haste itself has no versioned releases or an official docker build. However, it is mature and stable. It might as well be considered a 1.x release at this point in time.

Table of Contents

Features

  • Rolling release with weekly or yearly schedule
  • Built from upstream
  • Runs as non-root
  • Easy to get started
  • Tested and works well with podman too

Tags

  • latest: built on a weekly basis from master
  • stable: built on a yearly basis from master

Run

The simplest way to try out this hastebin build is to

docker run -d -p7777:7777 arminfriedl/hastebin:latest

and open http://localhost:7777/ in your browser.

Compose

A simple docker-compose file with a persistent volume might look like:

version: '3'

services:
  haste:
    container_name: haste
    image: arminfriedl/hastebin:latest
    restart: always
    volumes:
      - /var/services/bin:/app/data
    ports:
      - 7777:7777

Configuration

Default

The default configuration (i.e. what goes into the config.json) for this hastebin build is intentionally simple. It uses reasonable defaults and stores it's data into a directory located at /app/data in the container. For personal and small scale usage it may be sufficient to just run the image without any further configuration.

{
    "host": "0.0.0.0",
    "port": 7777,
    "keyLength": 10,
    "maxLength": 400000,
    "staticMaxAge": 86400,
    "recompressStaticAssets": true,
    "logging": [{
        "level": "error",
        "type": "Console",
        "colorize": true
    }],
    "keyGenerator": {
        "type": "phonetic"
    },
    "rateLimits": {
        "categories": {
            "normal": {
                "totalRequests": 500,
                "every": 60000
            }
        }
    },
    "storage": {
        "type": "file",
        "path": "./data"
    },
    "documents": {
        "about": "./about.md"
    }
}

Custom

For more advanced usage, create your own config.js with your settings according to haste-server. You can then derive your own docker image with your custom configuration like so:

FROM arminfriedl/hastebin:latest
COPY ./config.js /app/config.js

This hastebin exposes a volume that you can persist outside the container. It contains all the pastes of your hastebin instance (if the default file-based storage is used). To persist the volume you can start the container like this:

docker run -d -p7777:7777 -v /var/hastebin:/app/data arminfriedl/hastebin:latest

where /var/hastebin is the local folder outside the container and /app/data is the volume inside the container.