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└── .dockerignoreCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM golang:1.21-alpine AS builder
# Install git for fetching dependenciesRUN apk add --no-cache git
# Set working directoryWORKDIR /app
# Clone Pacebin repositoryRUN git clone https://github.com/pacebin/pacebin.git .
# Build the applicationRUN go build -o pacebin .
# Production imageFROM alpine:latest
# Install ca-certificates for HTTPSRUN apk --no-cache add ca-certificates
WORKDIR /app
# Copy binary from builderCOPY --from=builder /app/pacebin .
# Create data directoryRUN mkdir -p /data
# Set environment variablesENV PACEBIN_PORT=8080ENV PACEBIN_DATA_DIR=/dataENV PACEBIN_BASE_URL=${PACEBIN_BASE_URL}
# Expose portEXPOSE 8080
# Health checkHEALTHCHECK --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 variablesENV PACEBIN_PORT=8080ENV PACEBIN_DATA_DIR=/dataENV PACEBIN_BASE_URL=${PACEBIN_BASE_URL}
# Create data directoryRUN mkdir -p /data
# Expose portEXPOSE 8080
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1Creating the .dockerignore File
.git.github*.mdLICENSE.gitignore*.log.DS_Store.envEnvironment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
PACEBIN_PORT | No | 8080 | Port for the web server |
PACEBIN_DATA_DIR | No | /data | Directory for paste storage |
PACEBIN_BASE_URL | Yes | - | Public URL of your Pacebin instance |
PACEBIN_MAX_SIZE | No | 1048576 | Maximum paste size in bytes |
PACEBIN_EXPIRY | No | - | Default paste expiration time |
Deploying Pacebin on Klutch.sh
- Select HTTP as the traffic type
- Set the internal port to 8080
Push Your Repository to GitHub
Initialize your repository and push to GitHub:
git initgit add Dockerfile .dockerignore README.mdgit commit -m "Initial Pacebin deployment configuration"git remote add origin https://github.com/yourusername/pacebin-deploy.gitgit push -u origin mainCreate 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:
Set Environment Variables
In the environment variables section, add:
| Variable | Value |
|---|---|
PACEBIN_BASE_URL | https://your-app-name.klutch.sh |
PACEBIN_DATA_DIR | /data |
PACEBIN_MAX_SIZE | 5242880 (5MB) |
Attach Persistent Volumes
Add the following volume:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/data | 5 GB | Paste 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
- Navigate to your Pacebin instance
- Enter your content in the text area
- Select the language for syntax highlighting (optional)
- Click Create or Submit
- Copy and share the generated URL
Creating a Paste via API
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:
alias paste='curl -X POST -d @- https://your-pacebin.klutch.sh/api/paste'
# Usageecho "Hello World" | pastecat file.txt | pasteViewing Raw Content
Access the raw content by appending /raw to the paste URL:
https://your-pacebin.klutch.sh/paste/abc123/rawCustomization 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.