Deploying Firefish
Introduction
Firefish is a powerful, open-source federated social network platform built on ActivityPub, offering a modern alternative to centralized social media. As a fork of Misskey, Firefish provides robust features for creating decentralized communities with support for custom emojis, rich text formatting, polls, and seamless federation with other ActivityPub platforms like Mastodon and Pleroma.
Deploying Firefish on Klutch.sh gives you enterprise-grade infrastructure with automatic HTTPS, scalable compute resources, and simplified container management. This comprehensive guide walks you through deploying Firefish using a Dockerfile, configuring persistent storage for media and database files, setting up Redis and PostgreSQL databases, and implementing production-ready security practices.
Whether you’re launching a personal instance or building a social network for your community, this guide provides everything you need to get Firefish running reliably on Klutch.sh with minimal configuration overhead.
Prerequisites
Before you begin deploying Firefish on Klutch.sh, ensure you have:
- A Klutch.sh account (sign up here)
- A GitHub repository for your Firefish project (you can fork the official Firefish repository)
- Basic understanding of Docker, PostgreSQL, and Redis
- A PostgreSQL database instance (version 12 or higher recommended)
- A Redis instance for caching and job queues
- Domain name (optional, for custom domain configuration)
Understanding Firefish Architecture
Firefish consists of several key components:
- Web Server: Node.js application serving the web interface and API
- PostgreSQL Database: Stores users, posts, and relational data
- Redis: Handles caching, real-time updates, and background job queues
- Object Storage: Stores uploaded media files (local filesystem or S3-compatible storage)
For a production deployment on Klutch.sh, you’ll need to provision separate PostgreSQL and Redis services, which can be deployed as additional apps on the platform.
Sample Dockerfile for Firefish
Klutch.sh automatically detects and uses a Dockerfile when present in the root directory of your repository. Create a Dockerfile in your project root with the following production-ready configuration:
FROM node:20-bullseye-slim
# Set working directoryWORKDIR /firefish
# Install system dependenciesRUN apt-get update && apt-get install -y \ build-essential \ python3 \ ffmpeg \ git \ postgresql-client \ && rm -rf /var/lib/apt/lists/*
# Clone Firefish repository (or copy your files)# For production, consider using a specific version tag: --branch v1.x.xRUN git clone --depth=1 https://github.com/firefish-dev/firefish.git . && \ git submodule update --init --recursive
# Install Node.js dependenciesRUN corepack enable && \ corepack prepare pnpm@latest --activate && \ pnpm install --frozen-lockfile
# Build the applicationRUN NODE_ENV=production pnpm run build
# Create uploads directory for persistent storageRUN mkdir -p /firefish/files
# Expose the application portEXPOSE 3000
# Start FirefishCMD ["pnpm", "run", "start"]This Dockerfile:
- Uses Node.js 20 on Debian Bullseye for stability
- Installs required system dependencies including FFmpeg for media processing
- Clones the latest Firefish code (replace with
COPYif using your own fork) - Builds the application with production optimizations
- Exposes port 3000 for HTTP traffic
- Creates a directory for persistent file storage
For advanced customization, you can modify the build command or start command using Nixpacks environment variables:
NIXPACKS_BUILD_CMD: Override the build commandNIXPACKS_START_CMD: Override the start command
Setting Up Your GitHub Repository
-
Create or fork the Firefish repository
Fork the official Firefish repository on GitHub, or create a new repository for your custom deployment.
-
Add the Dockerfile
Create the
Dockerfileshown above in the root of your repository. -
Create a configuration file
Create a
.config/default.ymlfile for Firefish configuration (this will be overridden by environment variables in production): - Commit and push your changes
# Basic configuration template# Most values will come from environment variablesurl: https://example-app.klutch.shport: 3000
db: host: localhost port: 5432 db: firefish user: firefish pass: your-password
redis: host: localhost port: 6379git add Dockerfile .config/default.ymlgit commit -m "Add Firefish Dockerfile and configuration"git push origin mainInstalling Firefish on Klutch.sh
Follow these detailed steps to deploy your Firefish instance on Klutch.sh:
-
Create a new app in Klutch.sh
- Navigate to klutch.sh/app
- Click “Create New App”
- Connect your GitHub account if you haven’t already
- Select the repository containing your Firefish Dockerfile
-
Configure the build settings
Klutch.sh will automatically detect your Dockerfile in the root directory. You don’t need to manually select Docker as a deployment option—the platform handles this automatically when a Dockerfile is present.
-
Set up persistent storage
Firefish requires persistent volumes for storing uploaded media, avatars, and cached files. In the Klutch.sh dashboard:
- Navigate to the “Volumes” section
- Click “Add Volume”
- Set the mount path to
/firefish/files - Choose a volume size based on your expected media storage needs (start with 10GB minimum)
- Click “Create Volume”
Note: You only specify the mount path and size; Klutch.sh automatically manages volume names.
-
Configure environment variables
Add the following environment variables in the Klutch.sh app settings. These are essential for Firefish to connect to your database and configure the instance:
Required Variables:
NODE_ENV:productionFIREFISH_URL: Your app URL (e.g.,https://example-app.klutch.sh)FIREFISH_DB_HOST: Your PostgreSQL hostFIREFISH_DB_PORT:5432(or your PostgreSQL port)FIREFISH_DB_USER: Your PostgreSQL usernameFIREFISH_DB_PASS: Your PostgreSQL password (mark as secret)FIREFISH_DB_NAME:firefishFIREFISH_REDIS_HOST: Your Redis hostFIREFISH_REDIS_PORT:6379(or your Redis port)
Optional Variables:
FIREFISH_REDIS_PASS: Redis password if authentication is enabledFIREFISH_ADMIN_EMAIL: Administrator email for notificationsFIREFISH_MAX_NOTE_LENGTH: Maximum post length (default: 3000)
-
Configure traffic routing
- In the app settings, select HTTP traffic type (Firefish is a web application)
- Set the internal port to
3000(the port Firefish listens on) - This tells Klutch.sh to route incoming HTTP traffic to port 3000 inside your container
-
Deploy the application
- Review your configuration
- Click “Deploy” to start the build and deployment process
- Klutch.sh will build your Docker image and start the container
- Monitor the build logs to track progress
-
Initial setup and administration
Once deployed, access your Firefish instance at the provided URL (e.g.,
https://example-app.klutch.sh):- Complete the initial setup wizard
- Create your administrator account
- Configure instance settings (name, description, rules)
- Customize appearance and branding
Database Configuration
Firefish requires PostgreSQL 12 or higher. You can deploy PostgreSQL on Klutch.sh or use an external managed database service.
Deploying PostgreSQL on Klutch.sh
-
Create a new app for PostgreSQL using the official PostgreSQL Docker image
-
Configure the PostgreSQL app:
- Select TCP traffic type (PostgreSQL uses TCP protocol)
- Set the internal port to
5432(PostgreSQL’s default port inside the container) - Klutch.sh will expose this on port
8000for external connections - Your Firefish app will connect to PostgreSQL using port
8000 - Add a persistent volume mounted to
/var/lib/postgresql/data(minimum 5GB)
-
Set PostgreSQL environment variables:
POSTGRES_DB:firefishPOSTGRES_USER:firefishPOSTGRES_PASSWORD: (generate a strong password and mark as secret)
-
After deployment, use the internal connection details in your Firefish environment variables
Database Initialization
Firefish will automatically initialize the database schema on first run. Monitor the application logs to ensure successful database migration.
Redis Configuration
Redis is essential for Firefish’s real-time features and background job processing.
Deploying Redis on Klutch.sh
-
Create a new app for Redis using the official Redis Docker image
-
Configure the Redis app:
- Select TCP traffic type
- Set the internal port to
6379(Redis’s default port inside the container) - Klutch.sh will expose this on port
8000for external connections - Your Firefish app will connect to Redis using port
8000 - Add a persistent volume mounted to
/data(2-5GB recommended)
-
For security, configure Redis authentication by setting:
REDIS_PASSWORD: (generate a strong password and mark as secret)
-
Use the internal connection details in your Firefish configuration
Persistent Storage and Media Management
Firefish stores user-uploaded content including:
- Profile pictures and banners
- Post attachments (images, videos, audio)
- Custom emoji
- Cached remote media
Configuring Persistent Volumes
In the Klutch.sh dashboard, ensure you have created a volume mounted at /firefish/files as described in the installation steps. This directory must persist across deployments to prevent data loss.
Storage Recommendations
- Small instances (< 100 users): 10-20GB
- Medium instances (100-1000 users): 50-100GB
- Large instances (1000+ users): 200GB+
You can increase volume size at any time through the Klutch.sh dashboard without data loss.
Object Storage (S3-Compatible)
For production deployments with high media storage requirements, consider using S3-compatible object storage:
-
Configure environment variables for S3:
FIREFISH_USE_OBJECT_STORAGE:trueFIREFISH_OBJECT_STORAGE_ENDPOINT: Your S3 endpointFIREFISH_OBJECT_STORAGE_BUCKET: Bucket nameFIREFISH_OBJECT_STORAGE_ACCESS_KEY: Access key (mark as secret)FIREFISH_OBJECT_STORAGE_SECRET_KEY: Secret key (mark as secret)
-
Firefish will automatically upload new media to object storage while keeping local cache
Production Best Practices
Security Hardening
- Use strong passwords for all database and Redis connections
- Enable rate limiting in Firefish settings to prevent abuse
- Configure SMTP for email verification and notifications
- Set up regular backups of your PostgreSQL database and persistent volumes
- Keep Firefish updated by regularly rebuilding with the latest version
- Use environment variables for all secrets—never commit credentials to your repository
Performance Optimization
- Database connection pooling: Firefish manages this automatically
- Redis caching: Ensure Redis has sufficient memory (2GB minimum recommended)
- Media processing: FFmpeg handles image and video optimization
- CDN integration: Consider using a CDN for media delivery at scale
Monitoring and Maintenance
- Review application logs regularly through the Klutch.sh dashboard
- Monitor resource usage (CPU, memory, disk) and scale accordingly
- Set up health checks to detect and restart failed instances
- Database maintenance: Perform regular PostgreSQL
VACUUMoperations - Backup strategy: Automate daily backups of PostgreSQL and uploaded media
Scaling Considerations
For high-traffic instances:
- Scale your PostgreSQL database vertically (more CPU/RAM)
- Consider Redis clustering for distributed caching
- Use object storage to offload media serving
- Implement a CDN for static assets and media delivery
Troubleshooting Common Issues
Application Won’t Start
Symptoms: Container exits immediately or crashes on startup
Solutions:
- Check that all required environment variables are set correctly
- Verify database connectivity:
FIREFISH_DB_HOST,FIREFISH_DB_PORT,FIREFISH_DB_USER,FIREFISH_DB_PASS - Ensure PostgreSQL is running and accessible
- Review application logs in the Klutch.sh dashboard for specific error messages
- Confirm the database user has necessary permissions
Database Connection Errors
Symptoms: “Connection refused” or “Authentication failed” errors
Solutions:
- Verify PostgreSQL is accepting connections on port 8000 (Klutch.sh TCP routing)
- Check that the internal port for PostgreSQL is set to
5432 - Confirm database credentials match between Firefish and PostgreSQL environment variables
- Test database connectivity from the Firefish container using
psql
Redis Connection Issues
Symptoms: Real-time features not working, background jobs failing
Solutions:
- Verify Redis is running and accessible
- Check
FIREFISH_REDIS_HOSTandFIREFISH_REDIS_PORTsettings - If using Redis authentication, ensure
FIREFISH_REDIS_PASSis set correctly - Test Redis connectivity:
redis-cli -h $FIREFISH_REDIS_HOST -p 8000 ping
Media Upload Failures
Symptoms: Users can’t upload images or videos
Solutions:
- Confirm persistent volume is mounted at
/firefish/files - Check volume has sufficient free space
- Verify FFmpeg is installed in the container (included in sample Dockerfile)
- Review file permission issues in application logs
- Ensure the upload directory is writable
Performance Issues
Symptoms: Slow page loads, timeouts, high resource usage
Solutions:
- Increase instance size in Klutch.sh dashboard (more CPU/RAM)
- Verify Redis is functioning properly for caching
- Optimize PostgreSQL configuration for your workload
- Consider enabling object storage for media
- Review slow query logs in PostgreSQL
Environment Variables Reference
Complete list of Firefish environment variables for Klutch.sh:
| Variable | Required | Description | Example |
|---|---|---|---|
NODE_ENV | Yes | Node environment | production |
FIREFISH_URL | Yes | Public URL | https://example-app.klutch.sh |
FIREFISH_DB_HOST | Yes | PostgreSQL host | postgres-app.klutch.sh |
FIREFISH_DB_PORT | Yes | PostgreSQL port | 8000 |
FIREFISH_DB_USER | Yes | Database user | firefish |
FIREFISH_DB_PASS | Yes | Database password | (secret) |
FIREFISH_DB_NAME | Yes | Database name | firefish |
FIREFISH_REDIS_HOST | Yes | Redis host | redis-app.klutch.sh |
FIREFISH_REDIS_PORT | Yes | Redis port | 8000 |
FIREFISH_REDIS_PASS | No | Redis password | (secret) |
FIREFISH_ADMIN_EMAIL | No | Admin email | admin@example.com |
FIREFISH_MAX_NOTE_LENGTH | No | Max post length | 3000 |
FIREFISH_USE_OBJECT_STORAGE | No | Enable S3 storage | true |
FIREFISH_OBJECT_STORAGE_ENDPOINT | No | S3 endpoint | s3.amazonaws.com |
FIREFISH_OBJECT_STORAGE_BUCKET | No | S3 bucket | firefish-media |
FIREFISH_OBJECT_STORAGE_ACCESS_KEY | No | S3 access key | (secret) |
FIREFISH_OBJECT_STORAGE_SECRET_KEY | No | S3 secret key | (secret) |
Updating Firefish
To update your Firefish instance to the latest version:
- Pull latest changes in your GitHub repository (if using the official repo)
- Trigger a rebuild in the Klutch.sh dashboard by pushing a commit or manually triggering a deployment
- Review release notes at Firefish Releases for breaking changes
- Backup your database before major version upgrades
- Monitor deployment logs to ensure successful migration
For custom deployments, update your Dockerfile with the desired Firefish version tag.
Custom Domain Configuration
To use your own domain with Firefish on Klutch.sh:
- Add custom domain in the Klutch.sh dashboard (e.g.,
social.yourdomain.com) - Update DNS records as instructed by Klutch.sh (typically a CNAME or A record)
- Update
FIREFISH_URLenvironment variable to match your custom domain - Redeploy the application to apply changes
- SSL/TLS certificates are automatically provisioned by Klutch.sh
Federation and ActivityPub
Once deployed, your Firefish instance can federate with other ActivityPub-compatible platforms:
- Mastodon: Users can follow and interact with Mastodon accounts
- Pleroma: Full interoperability with Pleroma instances
- Misskey: Compatible with other Misskey and Misskey-based forks
- Other platforms: Works with any ActivityPub-compliant service
Configure federation settings in the Firefish admin panel to control:
- Blocked instances
- Media proxy settings
- Federation limits and rate limiting
Resources and Further Reading
- Firefish Official Repository
- Firefish Documentation
- Klutch.sh Quick Start Guide
- Klutch.sh Volumes Guide
- Klutch.sh Deployments Guide
- Klutch.sh Networking Guide
- ActivityPub Specification
Conclusion
Deploying Firefish on Klutch.sh provides a robust, scalable platform for running your own federated social network. With automatic Dockerfile detection, persistent storage, and simplified database management, you can focus on building your community rather than managing infrastructure.
This guide has covered everything from basic deployment to advanced production configurations, security best practices, and troubleshooting. Your Firefish instance on Klutch.sh is now ready to serve your federated social network with enterprise-grade reliability and performance.
For additional support, refer to the official Firefish documentation and Klutch.sh guides linked above. Happy federating!