Introduction

Hasty Paste, a lightweight self-hosted clipboard, allows you to quickly paste and save text, and share it with others. You can access it without logging in, using a randomly generated number to uniquely identify each paste, and it provides a long number to resist brute-force cracking attacks. It supports configurable expiration times and night mode, and you can optionally highlight syntax. It runs without needing JavaScript.

Screenshots:

Deployment Method:

Step One: Update Sources

Ubuntu/Debian:

apt update -y && apt upgrade -y    

Centos:

yum update -y && yum upgrade -y   

Step Two: Install and Configure Docker

Install Docker:

curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh ./get-docker.sh

Start Docker:

sudo systemctl start docker

Set Docker to Start Automatically at Boot:

sudo systemctl enable docker

Step Three: Create docker-compose.yml

  1. Create a directory:

    mkdir hastypaste && cd hastypaste/
  2. Create and open docker-compose.yml:

    nano docker-compose.yml
  3. Fill in the following content (you can change the port number on the left to an unoccupied port):

    version: "3"
    
    services:
      paste-bin:
     container_name: paste-bin
     image: ghcr.io/enchant97/hasty-paste:1
     restart: unless-stopped
     volumes:
       - data:/app/data
     ports:
       - 8000:8000
     environment:
       - "TIME_ZONE=Europe/London"
    
    volumes:
      data:
  4. Save and exit:
    Use Ctrl+X/Command+X

Step Four: Install and Run the Hasty Paste Container

docker compose up -d

After deployment, you can access "Hasty Paste" at http://<your-ip>:8000 (modify the port number to the one you entered).

Step Five: Reverse Proxy to Domain

Here's a very simple method: Cloud flare's Origin Rules
Configuration is as follows:

Modify Field to Hostname, Value to the selected full domain name, Rewrite to the port you just filled in on the left.

Remember to resolve your subdomain to the server IP:
Use an A record, Name as the domain prefix, Content as the server address.

Related Links:

GitHub address: https://github.com/enchant97/hasty-paste

Tag:Configure, Clipboard for Code Sharing, Hasty Paste

Original link:http://enblog.fuyiran.link/Technology/37.html

Copyright: All posts on this blog, unless otherwise stated, are published using theCC BY-NC-SA 4.0 license agreement. Please indicate the source for reprinting Fu Speaking (enblog.fuyiran.link)

Add a new comment.