Skip to content

Deploying Pacebin

Introduction

Pacebin is a minimal, fast, and efficient pastebin service designed for developers who need a simple way to share code snippets, logs, and text content. Built with performance in mind, Pacebin focuses on doing one thing well: providing a clean interface for creating and sharing pastes without unnecessary complexity.

The application features a lightweight architecture that minimizes resource usage while delivering quick response times. Its straightforward design makes it easy to deploy and maintain, making it an excellent choice for personal use, small teams, or organizations that need a private pastebin solution.

Key highlights of Pacebin:

  • Minimal Design: Clean, distraction-free interface focused on functionality
  • Fast Performance: Lightweight architecture optimized for speed
  • Syntax Highlighting: Code highlighting for popular programming languages
  • Raw View: Access paste content in raw format for easy copying
  • No Registration Required: Create pastes without user accounts
  • API Support: Simple API for programmatic paste creation
  • Self-Hosted: Full control over your paste data and infrastructure
  • Low Resource Usage: Minimal CPU and memory requirements
  • Easy Deployment: Simple Docker-based deployment

This guide walks through deploying Pacebin on Klutch.sh using Docker, configuring the service for paste sharing, and customizing the deployment for your requirements.

Why Deploy Pacebin on Klutch.sh

Deploying Pacebin on Klutch.sh provides several advantages:

Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds Pacebin without complex configuration. Push to GitHub, and your pastebin deploys automatically.

Persistent Storage: Attach persistent volumes for paste data, ensuring content survives container restarts.

HTTPS by Default: Klutch.sh provides automatic SSL certificates for secure access to your pastebin.

GitHub Integration: Connect your configuration repository directly from GitHub for easy updates.

Scalable Resources: Allocate minimal resources for cost efficiency, scaling up only when needed.

Environment Variable Management: Configure the application through Klutch.sh’s environment variable system.

Custom Domains: Assign a custom domain for a professional pastebin experience.

Always-On Availability: Your pastebin remains accessible 24/7 for instant sharing.

Prerequisites

Before deploying Pacebin on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your Pacebin configuration
  • Basic familiarity with Docker and containerization concepts
  • (Optional) A custom domain for your pastebin instance

Understanding Pacebin Architecture

Pacebin uses a simple, efficient architecture:

Web Server: Handles HTTP requests for creating, viewing, and retrieving pastes. The server is optimized for low latency responses.

Storage Backend: Pastes are stored in a configurable backend, typically file-based for simplicity or database-backed for larger deployments.

Frontend: Minimal HTML/CSS interface with JavaScript for syntax highlighting and enhanced user experience.

API Layer: RESTful API endpoints for programmatic access, enabling integration with CLI tools and scripts.

Preparing Your Repository

To deploy Pacebin on Klutch.sh, create a GitHub repository with your Dockerfile.

Repository Structure

pacebin-deploy/
├── Dockerfile
├── README.md
└── .dockerignore

Creating the Dockerfile

Create a Dockerfile in the root of your repository:

FROM golang:1.21-alpine AS builder
# Install git for fetching dependencies
RUN apk add --no-cache git
# Set working directory
WORKDIR /app
# Clone Pacebin repository
RUN git clone https://github.com/pacebin/pacebin.git .
# Build the application
RUN go build -o pacebin .
# Production image
FROM alpine:latest
# Install ca-certificates for HTTPS
RUN apk --no-cache add ca-certificates
WORKDIR /app
# Copy binary from builder
COPY --from=builder /app/pacebin .
# Create data directory
RUN mkdir -p /data
# Set environment variables
ENV PACEBIN_PORT=8080
ENV PACEBIN_DATA_DIR=/data
ENV PACEBIN_BASE_URL=${PACEBIN_BASE_URL}
# Expose port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
CMD ["./pacebin"]

Alternative Dockerfile (if official image exists)

FROM pacebin/pacebin:latest
# Set environment variables
ENV PACEBIN_PORT=8080
ENV PACEBIN_DATA_DIR=/data
ENV PACEBIN_BASE_URL=${PACEBIN_BASE_URL}
# Create data directory
RUN mkdir -p /data
# Expose port
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1

Creating the .dockerignore File

.git
.github
*.md
LICENSE
.gitignore
*.log
.DS_Store
.env

Environment Variables Reference

VariableRequiredDefaultDescription
PACEBIN_PORTNo8080Port for the web server
PACEBIN_DATA_DIRNo/dataDirectory for paste storage
PACEBIN_BASE_URLYes-Public URL of your Pacebin instance
PACEBIN_MAX_SIZENo1048576Maximum paste size in bytes
PACEBIN_EXPIRYNo-Default paste expiration time

Deploying Pacebin on Klutch.sh

    Push Your Repository to GitHub

    Initialize your repository and push to GitHub:

    Terminal window
    git init
    git add Dockerfile .dockerignore README.md
    git commit -m "Initial Pacebin deployment configuration"
    git remote add origin https://github.com/yourusername/pacebin-deploy.git
    git push -u origin main

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project. Give it a descriptive name like “pacebin” or “paste”.

    Create a New App

    Within your project, create a new app. Connect your GitHub account if you haven’t already, then select the repository containing your Pacebin Dockerfile.

    Configure HTTP Traffic

    In the deployment settings:

    • Select HTTP as the traffic type
    • Set the internal port to 8080

    Set Environment Variables

    In the environment variables section, add:

    VariableValue
    PACEBIN_BASE_URLhttps://your-app-name.klutch.sh
    PACEBIN_DATA_DIR/data
    PACEBIN_MAX_SIZE5242880 (5MB)

    Attach Persistent Volumes

    Add the following volume:

    Mount PathRecommended SizePurpose
    /data5 GBPaste storage

    Deploy Your Application

    Click Deploy to start the build process. Klutch.sh will build and deploy your Pacebin instance.

    Access Pacebin

    Once deployment completes, access your pastebin at https://your-app-name.klutch.sh.

Using Pacebin

Creating a Paste via Web Interface

  1. Navigate to your Pacebin instance
  2. Enter your content in the text area
  3. Select the language for syntax highlighting (optional)
  4. Click Create or Submit
  5. Copy and share the generated URL

Creating a Paste via API

Terminal window
curl -X POST https://your-pacebin.klutch.sh/api/paste \
-H "Content-Type: text/plain" \
-d "Your paste content here"

Creating a Paste via CLI

For frequent use, create a shell alias:

Terminal window
alias paste='curl -X POST -d @- https://your-pacebin.klutch.sh/api/paste'
# Usage
echo "Hello World" | paste
cat file.txt | paste

Viewing Raw Content

Access the raw content by appending /raw to the paste URL:

https://your-pacebin.klutch.sh/paste/abc123/raw

Customization Options

Syntax Highlighting Languages

Pacebin typically supports common languages:

  • JavaScript, TypeScript
  • Python, Ruby, Go, Rust
  • Java, C, C++
  • HTML, CSS, JSON, YAML
  • Bash, SQL, Markdown

Paste Expiration

Configure default expiration or allow users to set expiration:

  • 10 minutes
  • 1 hour
  • 1 day
  • 1 week
  • Never

Troubleshooting Common Issues

Pastes Not Saving

  • Verify persistent volume is mounted
  • Check disk space availability
  • Ensure write permissions on data directory

Syntax Highlighting Not Working

  • Verify language detection is enabled
  • Check that the language is supported
  • Try manually selecting the language

Performance Issues

  • Monitor container resource usage
  • Consider increasing allocated resources
  • Check for disk I/O bottlenecks

Additional Resources

Conclusion

Deploying Pacebin on Klutch.sh provides a minimal, efficient pastebin solution that you fully control. The lightweight design ensures fast performance with minimal resource usage, making it cost-effective for personal or small team use.

Whether you need to quickly share code snippets, exchange log files, or collaborate on text content, Pacebin on Klutch.sh delivers a clean, fast solution without unnecessary complexity.