Skip to content

Deploying Sharry

Introduction

Sharry is a self-hosted file sharing application that makes it easy to share files with others securely. Unlike cloud storage services, Sharry focuses specifically on the use case of sharing files through expiring links, with features like password protection, download limits, and resumable uploads for large files.

Built with Scala on the backend and Elm on the frontend, Sharry provides a clean, responsive interface for uploading and sharing files. The application supports multiple authentication methods, including OAuth2 for SSO integration, and can store files on the local filesystem or in compatible object storage.

Key highlights of Sharry:

  • Resumable Uploads: Chunked uploads that can resume after interruptions
  • Expiring Links: Set expiration times and download limits
  • Password Protection: Add passwords to shared files
  • Multiple Users: Support for accounts with quotas
  • Share Aliases: Receive files from others via personalized URLs
  • OAuth2/OIDC: SSO integration with identity providers
  • Email Notifications: Notify recipients when files are shared
  • File Previews: Preview images and documents in browser
  • Storage Backends: Local filesystem or S3-compatible storage
  • 100% Open Source: Licensed under GPL-3.0

This guide walks through deploying Sharry on Klutch.sh using Docker, configuring authentication, and setting up secure file sharing.

Why Deploy Sharry on Klutch.sh

Deploying Sharry on Klutch.sh provides several advantages:

Simplified Deployment: Klutch.sh handles container orchestration without complex JVM setup.

Persistent Storage: Attach persistent volumes for file storage and database.

HTTPS by Default: Klutch.sh provides automatic SSL certificates for secure file transfers.

Scalable Resources: Allocate memory and CPU based on file sizes and user load.

Custom Domains: Use your own domain for professional file sharing.

Prerequisites

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

  • A Klutch.sh account
  • A GitHub account with a repository for your Sharry configuration
  • Basic familiarity with Docker and containerization concepts
  • (Optional) A PostgreSQL database for multi-instance deployments

Preparing Your Repository

Create a GitHub repository with your Sharry configuration.

Repository Structure

sharry-deploy/
├── Dockerfile
├── sharry.conf
└── .dockerignore

Creating the Dockerfile

Create a Dockerfile in the root of your repository:

FROM eikek/sharry:latest
# Copy custom configuration
COPY sharry.conf /opt/sharry.conf
# Environment variables
ENV SHARRY_BASE_URL=${SHARRY_BASE_URL}
ENV SHARRY_BIND_ADDRESS=0.0.0.0
ENV SHARRY_BIND_PORT=9090
# Expose the web interface port
EXPOSE 9090
# Start Sharry with custom config
CMD ["/opt/sharry.conf"]

Creating the Configuration File

Create a sharry.conf file:

sharry.restserver {
# Base URL of your Sharry instance
base-url = ${?SHARRY_BASE_URL}
bind {
address = "0.0.0.0"
port = 9090
}
# Backend settings
backend {
# Authentication
auth {
# Fixed accounts (for simple setup)
fixed {
enabled = true
user = "admin"
password = ${?SHARRY_ADMIN_PASSWORD}
order = 10
}
# OAuth2 (optional)
oauth = []
}
# Database - H2 for single instance
jdbc {
url = "jdbc:h2:/data/sharry.db;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE"
user = "sa"
password = ""
}
# File storage
files {
default-store = "database"
stores = {
database = {
enabled = true
type = "default-database"
}
filesystem = {
enabled = true
type = "file-system"
directory = "/data/files"
}
}
}
# Share settings
share {
max-size = "1.5 GB"
max-validity = "365 days"
}
# Signup settings
signup {
mode = "closed"
invite-time = "7 days"
}
}
}

Environment Variables Reference

VariableRequiredDefaultDescription
SHARRY_BASE_URLYes-Public URL of your Sharry instance
SHARRY_ADMIN_PASSWORDYes-Password for the admin account
SHARRY_DB_URLNoH2JDBC URL for database
SHARRY_MAX_SIZENo1.5GBMaximum file size for uploads
JAVA_OPTSNo-JVM options for memory tuning

Deploying Sharry on Klutch.sh

    Push Your Repository to GitHub

    Initialize and push your repository:

    Terminal window
    git init
    git add Dockerfile sharry.conf .dockerignore
    git commit -m "Initial Sharry deployment configuration"
    git remote add origin https://github.com/yourusername/sharry-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 with a descriptive name like “sharry” or “file-sharing”.

    Create a New App

    Within your project, create a new app. Connect your GitHub account and select your Sharry repository.

    Configure HTTP Traffic

    In the deployment settings:

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

    Set Environment Variables

    Add the following environment variables:

    VariableValue
    SHARRY_BASE_URLhttps://your-app-name.klutch.sh
    SHARRY_ADMIN_PASSWORDSecure admin password
    JAVA_OPTS-Xmx512m (adjust for your needs)

    Attach Persistent Volumes

    Add the following volume:

    Mount PathRecommended SizePurpose
    /data50+ GBDatabase and file storage

    Deploy Your Application

    Click Deploy to start the build process.

    Access Sharry

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

Using Sharry

Uploading Files

  1. Log in to Sharry
  2. Click Upload
  3. Drag and drop files or click to browse
  4. Configure share settings:
    • Expiration time
    • Maximum downloads
    • Password (optional)
  5. Click Submit
  6. Copy the share link

Receiving Files (Aliases)

  1. Go to Aliases in the menu
  2. Create a new alias with a custom name
  3. Share the alias URL with others
  4. Others can upload files to your account via the alias

Managing Shares

  1. Go to Shares to see all your shared files
  2. View download statistics
  3. Extend expiration if needed
  4. Delete shares

Account Management

Admins can manage users through the configuration file or enable signup modes:

  • Closed: Only admins create accounts
  • Open: Anyone can sign up
  • Invite: Users need invitation links

Advanced Configuration

Email Notifications

Add SMTP configuration to sharry.conf:

backend {
mail {
enabled = true
smtp {
host = "smtp.example.com"
port = 587
user = "user@example.com"
password = "password"
ssl-type = "starttls"
}
}
}

OAuth2 Authentication

Add OAuth2 providers in the configuration:

auth {
oauth = [
{
enabled = true
id = "keycloak"
name = "Keycloak"
authorize-url = "https://keycloak.example.com/auth/realms/master/protocol/openid-connect/auth"
token-url = "https://keycloak.example.com/auth/realms/master/protocol/openid-connect/token"
user-url = "https://keycloak.example.com/auth/realms/master/protocol/openid-connect/userinfo"
client-id = "sharry"
client-secret = ${?OAUTH_CLIENT_SECRET}
}
]
}

Troubleshooting

Upload Fails

Symptoms: Large file uploads fail or timeout.

Solutions:

  • Check file size against configured maximum
  • Verify sufficient disk space
  • Increase JVM memory with JAVA_OPTS
  • Check network timeout settings

Cannot Log In

Symptoms: Login fails with correct credentials.

Solutions:

  • Verify password in configuration
  • Check database connectivity
  • Clear browser cookies
  • Review server logs

Additional Resources

Conclusion

Deploying Sharry on Klutch.sh gives you a powerful, self-hosted file sharing solution with enterprise features like OAuth2 integration and resumable uploads. With expiring links, password protection, and receive aliases, Sharry provides everything needed for secure file exchange while keeping your data under your control.