Deploying Gokapi
Introduction
Gokapi is a lightweight, self-hosted file sharing server that allows you to share files with expiring links. Similar to the discontinued Firefox Send, Gokapi lets you upload files and share them with customizable download limits and expiration dates, ensuring your shared files don’t remain accessible forever.
Built with Go for excellent performance and minimal resource usage, Gokapi runs as a single binary with no external dependencies. The server supports multiple storage backends including local storage, AWS S3, and Backblaze B2, making it flexible for various deployment scenarios.
Key highlights of Gokapi:
- Expiring Links: Files automatically expire after a set time or number of downloads
- Download Limits: Set maximum download counts for each shared file
- Password Protection: Optionally encrypt files with passwords
- Multiple Storage Backends: Support for local storage, AWS S3, and Backblaze B2
- Admin-Only Uploads: Only administrators can upload files (no public upload)
- End-to-End Encryption: Optional client-side encryption for sensitive files
- API Access: Full API for automation and integration
- Single Binary: No dependencies, easy deployment
- Lightweight: Minimal resource usage
- 100% Open Source: Licensed under AGPL-3.0
This guide walks through deploying Gokapi on Klutch.sh using Docker, configuring storage options, and sharing files securely.
Why Deploy Gokapi on Klutch.sh
Deploying Gokapi on Klutch.sh provides several advantages for file sharing:
Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds Gokapi without complex orchestration. Push to GitHub and your file sharing server deploys automatically.
Persistent Storage: Attach persistent volumes for your uploaded files and database. Files survive container restarts.
HTTPS by Default: Klutch.sh provides automatic SSL certificates for secure file transfers.
GitHub Integration: Connect your configuration repository directly from GitHub. Updates trigger automatic redeployments.
Scalable Resources: Allocate CPU and memory based on expected file sizes and traffic.
Custom Domains: Assign a custom domain for professional file sharing links.
Always-On Availability: Your file sharing server remains accessible 24/7.
Prerequisites
Before deploying Gokapi on Klutch.sh, ensure you have:
- A Klutch.sh account
- A GitHub account with a repository for your Gokapi configuration
- Basic familiarity with Docker and containerization concepts
- (Optional) AWS S3 or Backblaze B2 credentials for cloud storage
Understanding Gokapi Architecture
Gokapi is designed for simplicity:
Go Backend: Written in Go for performance and a single binary deployment.
SQLite Database: Stores file metadata, download counts, and expiration information.
Storage Options: Supports local filesystem, AWS S3, and Backblaze B2.
Admin Interface: Web-based interface for uploading and managing files.
API: RESTful API for automation and external integrations.
Preparing Your Repository
To deploy Gokapi on Klutch.sh, create a GitHub repository containing your Dockerfile.
Repository Structure
gokapi-deploy/├── Dockerfile├── README.md└── .dockerignoreCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM f0rc3/gokapi:latest
# Set environment variablesENV GOKAPI_PORT=53842ENV GOKAPI_EXTERNAL_URL=${GOKAPI_EXTERNAL_URL}
# Create data directoryRUN mkdir -p /app/data /app/data/files
# Expose the web interface portEXPOSE 53842
# The base image includes the default entrypointAdvanced Dockerfile with S3 Storage
For cloud storage backends:
FROM f0rc3/gokapi:latest
# Application ConfigurationENV GOKAPI_PORT=53842ENV GOKAPI_EXTERNAL_URL=${GOKAPI_EXTERNAL_URL}ENV GOKAPI_CONFIG_DIR=/app/dataENV GOKAPI_DATA_DIR=/app/data
# AWS S3 Configuration (optional)ENV AWS_REGION=${AWS_REGION}ENV AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}ENV AWS_BUCKET=${AWS_BUCKET}
# Create data directoryRUN mkdir -p /app/data
# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:53842/ || exit 1
# Expose the web interface portEXPOSE 53842Creating the .dockerignore File
Create a .dockerignore file:
.git.github*.mdREADME.mdLICENSE.gitignore*.log.DS_Store.env.env.localEnvironment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
GOKAPI_PORT | No | 53842 | Port to listen on |
GOKAPI_EXTERNAL_URL | Yes | - | External URL for share links |
GOKAPI_CONFIG_DIR | No | ./data | Directory for configuration |
GOKAPI_DATA_DIR | No | ./data | Directory for uploaded files |
AWS_REGION | No* | - | AWS region for S3 storage |
AWS_ACCESS_KEY_ID | No* | - | AWS access key |
AWS_SECRET_ACCESS_KEY | No* | - | AWS secret key |
AWS_BUCKET | No* | - | S3 bucket name |
*Required if using S3 storage
Deploying Gokapi on Klutch.sh
Once your repository is prepared, follow these steps to deploy Gokapi:
- Select HTTP as the traffic type
- Set the internal port to 53842
- Detect your Dockerfile automatically
- Build the container image
- Attach the persistent volumes
- Start the Gokapi container
- Provision an HTTPS certificate
- Access
https://your-app-name.klutch.sh - Create your admin username and password
- Configure storage settings (local or cloud)
- Complete the setup wizard
Push Your Repository to GitHub
Initialize your repository and push to GitHub:
git initgit add Dockerfile .dockerignore README.mdgit commit -m "Initial Gokapi deployment configuration"git remote add origin https://github.com/yourusername/gokapi-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 “gokapi” or “file-share”.
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 Gokapi Dockerfile.
Configure HTTP Traffic
Gokapi serves its web interface over HTTP. In the deployment settings:
Set Environment Variables
In the environment variables section, add:
| Variable | Value |
|---|---|
GOKAPI_EXTERNAL_URL | https://your-app-name.klutch.sh |
For S3 storage, add your AWS credentials.
Attach Persistent Volumes
Persistent storage is essential for Gokapi. Add the following volume:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/app/data | 50 GB | Configuration, database, and uploaded files |
Deploy Your Application
Click Deploy to start the build process. Klutch.sh will:
Complete Initial Setup
On first launch, Gokapi will guide you through initial setup:
Access Gokapi
Once setup completes, access your Gokapi admin panel at https://your-app-name.klutch.sh/admin.
Using Gokapi
Uploading Files
To upload a file:
- Log in to the admin panel at
/admin - Click Upload File or drag and drop
- Configure sharing options:
- Expiry Time: How long the link remains valid
- Download Limit: Maximum number of downloads
- Password: Optional password protection
- Click Upload
- Copy the generated share link
Sharing Options
Configure how files are shared:
| Option | Description |
|---|---|
| Expiry Days | Number of days until the link expires |
| Downloads | Maximum download count (0 = unlimited) |
| Password | Optional password for download access |
| Unlimited | Override to allow unlimited time/downloads |
Managing Files
View and manage uploaded files:
- Navigate to the admin panel
- See all uploaded files with:
- Filename
- Upload date
- Downloads remaining
- Expiry date
- Delete files manually if needed
- Copy share links for existing files
Password-Protected Files
For sensitive files:
- Enable password during upload
- Enter a strong password
- Share the password separately from the link
- Recipients must enter the password to download
API Integration
Gokapi provides an API for automation:
Upload via API
curl -X POST "https://your-app-name.klutch.sh/api/files/add" \ -H "apikey: YOUR_API_KEY" \ -F "file=@/path/to/file.pdf" \ -F "allowedDownloads=5" \ -F "expiryDays=7"List Files
curl "https://your-app-name.klutch.sh/api/files/list" \ -H "apikey: YOUR_API_KEY"Delete a File
curl -X DELETE "https://your-app-name.klutch.sh/api/files/delete/FILE_ID" \ -H "apikey: YOUR_API_KEY"Getting an API Key
- Log in to the admin panel
- Navigate to Settings
- Generate or view your API key
Storage Backends
Local Storage
Default option, stores files on the persistent volume:
GOKAPI_DATA_DIR=/app/dataAWS S3
Store files in Amazon S3:
AWS_REGION=us-east-1AWS_ACCESS_KEY_ID=your_access_keyAWS_SECRET_ACCESS_KEY=your_secret_keyAWS_BUCKET=your-bucket-nameBackblaze B2
Store files in Backblaze B2 (using S3-compatible API):
AWS_REGION=us-west-002AWS_ACCESS_KEY_ID=your_b2_key_idAWS_SECRET_ACCESS_KEY=your_b2_application_keyAWS_BUCKET=your-bucket-name# Set endpoint to B2's S3-compatible URLSecurity Considerations
Access Control
- Strong Admin Password: Use a strong, unique password
- API Key Security: Treat API keys as sensitive credentials
- HTTPS Only: Always use HTTPS (automatic on Klutch.sh)
File Security
- Password Protection: Use passwords for sensitive files
- Download Limits: Set appropriate limits to prevent abuse
- Expiration: Always set reasonable expiration times
- No Public Upload: Only admins can upload (by design)
Data Protection
- Regular Backups: Back up the data directory
- Encryption at Rest: Consider S3 bucket encryption
- Access Logs: Monitor access patterns for anomalies
Troubleshooting Common Issues
Upload Failures
Symptoms: Files fail to upload.
Solutions:
- Check file size limits
- Verify disk space on persistent volume
- Check storage backend connectivity (S3)
- Review application logs for errors
Share Links Not Working
Symptoms: Recipients cannot access files.
Solutions:
- Verify
GOKAPI_EXTERNAL_URLis set correctly - Check file hasn’t expired
- Verify download limit hasn’t been reached
- Ensure HTTPS certificate is valid
Admin Login Issues
Symptoms: Cannot access admin panel.
Solutions:
- Verify you’re using the correct URL (
/admin) - Check credentials are correct
- Clear browser cache/cookies
- Review application logs
S3 Connection Problems
Symptoms: Cannot connect to S3 storage.
Solutions:
- Verify AWS credentials are correct
- Check bucket exists and is accessible
- Verify region setting matches bucket region
- Test credentials with AWS CLI
Additional Resources
- Gokapi GitHub Repository
- Gokapi Releases
- Gokapi Wiki
- Klutch.sh Persistent Volumes
- Klutch.sh Deployments
Conclusion
Deploying Gokapi on Klutch.sh gives you a lightweight, secure file sharing server with automatic expiration and download limits. The combination of Gokapi’s simplicity and Klutch.sh’s deployment ease means you can share files securely without complex infrastructure.
With support for multiple storage backends, password protection, and API integration, Gokapi provides enterprise-grade file sharing in a minimal package. Whether you’re sharing documents with clients or distributing files to team members, Gokapi on Klutch.sh delivers reliable, controlled file sharing on your terms.