Deploying Chevereto
Chevereto is a powerful open-source image hosting and sharing platform that enables users to create their own image gallery or photo sharing service. It provides features like private image uploads, albums, user accounts, analytics, and customizable branding, making it ideal for photographers, content creators, and organizations that want to host and share images privately. Chevereto gives you complete control over your visual content without relying on third-party image hosting services.
This guide will walk you through deploying Chevereto on Klutch.sh, a modern cloud platform that simplifies containerized application deployment. By the end of this guide, you’ll have a fully functional Chevereto instance ready for image hosting and sharing.
Why Deploy Chevereto on Klutch.sh?
Klutch.sh provides an excellent platform for hosting Chevereto:
- Docker-native deployment - Klutch.sh automatically detects and deploys Dockerized applications
- Image storage - Attach volumes for storing user images and data
- Custom domains - Point your domain to your Chevereto instance
- Environment configuration - Manage secrets and configuration through the dashboard
- Data persistence - Reliable storage for images and databases
- Scalability - Easily scale resources as your platform grows
Prerequisites
Before deploying Chevereto on Klutch.sh, you’ll need:
- A Klutch.sh account (sign up for free)
- Access to the Klutch.sh dashboard
- A GitHub repository to store your Chevereto deployment configuration
- A custom domain (optional but recommended for production use)
- Basic understanding of Docker and containerization
Deployment Steps
Create a Dockerfile
Create a
Dockerfilein the root of your repository to containerize Chevereto:FROM php:8.2-apache# Install system dependenciesRUN apt-get update && apt-get install -y \git \curl \libfreetype6-dev \libjpeg62-turbo-dev \libpng-dev \libwebp-dev \libzip-dev \libssl-dev \libicu-dev \imagemagick \libmagickwand-dev \memcached \libmemcached-dev \&& rm -rf /var/lib/apt/lists/*# Install PHP extensionsRUN docker-php-ext-configure gd \--with-freetype \--with-jpeg \--with-webpRUN docker-php-ext-install -j$(nproc) \gd \zip \pdo_mysql \intl \opcache# Install ImagickRUN pecl install imagick && docker-php-ext-enable imagick# Install MemcachedRUN pecl install memcached && docker-php-ext-enable memcached# Enable Apache mod_rewriteRUN a2enmod rewrite headers# Set working directoryWORKDIR /var/www/html# Clone Chevereto repositoryRUN git clone https://github.com/Chevereto/Chevereto-Free.git . && \git checkout main# Create necessary directoriesRUN mkdir -p /var/www/html/storage && \mkdir -p /var/www/html/images && \chown -R www-data:www-data /var/www/html# Copy Apache configurationCOPY apache.conf /etc/apache2/sites-available/000-default.conf# Copy PHP configurationCOPY php.ini /usr/local/etc/php/conf.d/chevereto.ini# Expose portEXPOSE 80# Health checkHEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \CMD curl -f http://localhost/ || exit 1# Start ApacheCMD ["apache2-foreground"]Create Apache Configuration
Create an
apache.conffile for Apache virtual host settings:<VirtualHost *:80>ServerName chevereto.localServerAdmin admin@example.comDocumentRoot /var/www/html/public<Directory /var/www/html/public>Options Indexes FollowSymLinksAllowOverride AllRequire all granted<IfModule mod_rewrite.c>RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^ index.php [QSA,L]</IfModule></Directory><Directory /var/www/html>Options -IndexesAllowOverride NoneRequire all denied</Directory><FilesMatch "\.php$">SetHandler application/x-httpd-php</FilesMatch>ErrorLog ${APACHE_LOG_DIR}/error.logCustomLog ${APACHE_LOG_DIR}/access.log combined</VirtualHost>Create PHP Configuration
Create a
php.inifile for PHP settings:; Chevereto PHP Configurationupload_max_filesize = 512Mpost_max_size = 512Mmax_execution_time = 300memory_limit = 512Mdefault_socket_timeout = 60; Display errors in development (disable in production)display_errors = Offlog_errors = Onerror_log = /var/log/apache2/php_errors.log; Session configurationsession.gc_maxlifetime = 1440session.cookie_httponly = 1session.cookie_secure = 1session.cookie_samesite = Lax; Opcache configurationopcache.enable = 1opcache.memory_consumption = 128opcache.interned_strings_buffer = 8opcache.max_accelerated_files = 4000opcache.revalidate_freq = 0; Timezonedate.timezone = UTCCreate Environment Configuration File
Create a
.env.examplefile to document required environment variables:# Chevereto Environment Configuration# Application SettingsAPP_ENV=productionAPP_DEBUG=falseAPP_URL=https://example-app.klutch.sh# Database ConfigurationDB_CONNECTION=mysqlDB_HOST=dbDB_PORT=3306DB_DATABASE=cheveretoDB_USERNAME=cheveretoDB_PASSWORD=chevereto_secure_password# Redis Configuration (for cache)REDIS_HOST=redisREDIS_PORT=6379REDIS_DB=0CACHE_DRIVER=redis# Storage ConfigurationSTORAGE_PATH=/var/www/html/storageIMAGES_PATH=/var/www/html/imagesUPLOADS_PATH=/var/www/html/uploads# File Upload ConfigurationMAX_UPLOAD_SIZE=512MALLOWED_IMAGE_EXTENSIONS=jpg,jpeg,png,gif,webp,bmp,svg+xmlALLOWED_VIDEO_EXTENSIONS=mp4,webm,ogg# Image ProcessingENABLE_IMAGE_RESIZING=trueENABLE_THUMBNAILS=trueTHUMBNAIL_SIZE=350x350ENABLE_WATERMARK=false# Email Configuration (Optional)MAIL_DRIVER=smtpMAIL_HOST=smtp.gmail.comMAIL_PORT=587MAIL_USERNAME=your-email@gmail.comMAIL_PASSWORD=your-app-passwordMAIL_ENCRYPTION=tlsMAIL_FROM_ADDRESS=noreply@example-app.klutch.shMAIL_FROM_NAME=Chevereto# AuthenticationENABLE_USER_REGISTRATION=trueREQUIRE_EMAIL_VERIFICATION=true# Admin SettingsADMIN_EMAIL=admin@example.comADMIN_USERNAME=adminADMIN_PASSWORD=change-me-in-production# Application SecurityAPP_KEY=base64:your-generated-app-key-hereJWT_SECRET=your-jwt-secret-here-change-in-production# CORS SettingsCORS_ALLOWED_ORIGINS=https://example-app.klutch.sh# API ConfigurationAPI_ENABLED=trueAPI_RATE_LIMIT=100# AnalyticsENABLE_ANALYTICS=falseGOOGLE_ANALYTICS_ID=# Advanced SettingsLOG_CHANNEL=stackQUEUE_CONNECTION=syncSESSION_DRIVER=cookieSESSION_LIFETIME=120Create Database Initialization Script
Create an
init-db.shfile to set up the MySQL database:#!/bin/bashset -eecho "Initializing Chevereto database..."# Wait for MySQL to be readyuntil mysqladmin ping -h"$DB_HOST" -u"$DB_USERNAME" -p"$DB_PASSWORD" --silent; doecho 'Waiting for mysql...'sleep 1doneecho "MySQL is ready!"# Check if database existsif ! mysql -h"$DB_HOST" -u"$DB_USERNAME" -p"$DB_PASSWORD" -e "use $DB_DATABASE" 2>/dev/null; thenecho "Creating database $DB_DATABASE..."mysql -h"$DB_HOST" -u"$DB_USERNAME" -p"$DB_PASSWORD" -e "CREATE DATABASE $DB_DATABASE;"echo "Database created!"fi# Run migrationsecho "Running database migrations..."php artisan migrate --force# Create symlinks for storageecho "Creating storage symlinks..."php artisan storage:linkecho "Database initialization complete!"Make it executable:
Terminal window chmod +x init-db.shCreate Docker Compose for Local Development
Create a
docker-compose.ymlfile for local development and testing (not used for Klutch.sh deployment):version: '3.8'services:chevereto:build: .container_name: chevereto-devports:- "80:80"environment:- APP_ENV=development- APP_DEBUG=true- DB_HOST=db- DB_PORT=3306- DB_DATABASE=chevereto- DB_USERNAME=chevereto- DB_PASSWORD=chevereto_password- REDIS_HOST=redis- REDIS_PORT=6379- STORAGE_PATH=/var/www/html/storage- IMAGES_PATH=/var/www/html/images- APP_URL=http://localhost- ENABLE_USER_REGISTRATION=truedepends_on:- db- redisvolumes:- ./storage:/var/www/html/storage- ./images:/var/www/html/images- ./src:/var/www/html/srcnetworks:- chevereto-networkdb:image: mysql:8.0container_name: chevereto-dbenvironment:- MYSQL_ROOT_PASSWORD=root_password- MYSQL_DATABASE=chevereto- MYSQL_USER=chevereto- MYSQL_PASSWORD=chevereto_passwordvolumes:- chevereto_db_data:/var/lib/mysqlnetworks:- chevereto-networkhealthcheck:test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]interval: 10stimeout: 5sretries: 5redis:image: redis:7-alpinecontainer_name: chevereto-redisnetworks:- chevereto-networkhealthcheck:test: ["CMD", "redis-cli", "ping"]interval: 10stimeout: 5sretries: 5volumes:chevereto_db_data:networks:chevereto-network:driver: bridgeCreate .gitignore File
Create a
.gitignorefile to exclude sensitive data from version control:# Environment files.env.env.local.env.*.local# PHPvendor/composer.lock.composer.lock# Storage and uploadsstorage/images/uploads/bootstrap/cache/# Logslogs/*.log# IDE.vscode/.idea/*.swp*.swo*~.DS_Store# Build artifactsdist/build/node_modules/# Cache.cache/.turbo/# Database*.sqlite*.sqlite3# Misc.env.backup.env.*.backupPush Configuration to GitHub
Push your repository to GitHub with all configuration files:
Terminal window git add Dockerfile apache.conf php.ini .env.example init-db.sh \docker-compose.yml .gitignoregit commit -m "Initial Chevereto deployment configuration for Klutch.sh"git push origin mainDeploy on Klutch.sh
- Navigate to klutch.sh/app and log in to your dashboard
- Click Create New App
- Connect your GitHub repository containing the Chevereto deployment files (the Dockerfile will be automatically detected)
- Configure your application settings:
- Set your preferred app name
- Review the detected Dockerfile configuration
- Select a region for deployment
- Click Deploy to start the deployment process
- Monitor the deployment progress in the dashboard
- Wait for the deployment to complete and your app to become active
Configure Environment Variables
- In your app dashboard, navigate to Environment Variables section
- Add all required variables from your
.env.examplefile:APP_URL: Set tohttps://example-app.klutch.sh(or your custom domain)DB_HOST: Your MySQL hostnameDB_DATABASE: Database name (chevereto)DB_USERNAME: Database userDB_PASSWORD: Secure database passwordREDIS_HOST: Your Redis hostnameAPP_KEY: Generate withphp artisan key:generateJWT_SECRET: Generate a secure secret withopenssl rand -base64 32ADMIN_EMAIL,ADMIN_USERNAME,ADMIN_PASSWORD: Administrator credentials
- Click Save to apply the environment variables
- Your application will automatically restart with the new configuration
Configure Traffic Routes
- In your app dashboard, navigate to Traffic settings
- Select HTTP as the traffic type
- Set the internal port to 80 (Apache default)
- Configure any custom domain settings if you have a domain
- Save your traffic configuration
Attach Persistent Volumes
Chevereto requires persistent storage for images, uploads, and application data.
- In your app dashboard, navigate to Volumes settings
- Click Add Volume to create storage for uploaded images:
- Enter mount path:
/var/www/html/images - Set volume size to 500GB or more (adjust based on expected image volume)
- Click Attach to create and mount the volume
- Enter mount path:
- Click Add Volume again for application storage:
- Enter mount path:
/var/www/html/storage - Set volume size to 100GB (for cache and metadata)
- Click Attach to create and mount the volume
- Enter mount path:
- Click Add Volume for application uploads:
- Enter mount path:
/var/www/html/uploads - Set volume size to 50GB
- Click Attach to create and mount the volume
- Enter mount path:
Your Chevereto application will now be accessible at your configured domain or at
example-app.klutch.sh.
Initial Setup and Configuration
After deploying Chevereto on Klutch.sh, complete the initial setup to prepare your image hosting platform.
Access Your Chevereto Instance
- Navigate to
https://example-app.klutch.shin your web browser - You’ll see the Chevereto welcome page
- Click Register or navigate to
/adminfor administrator access - Create your administrator account with the credentials you set in environment variables
- Log in to your Chevereto instance
Configure Your Chevereto Instance
Once logged in, configure these essential settings:
Site Settings:
- Set your site name and description
- Configure site branding and logo
- Set privacy policy and terms of service URLs
- Configure contact email address
User Management:
- Create additional administrator accounts if needed
- Configure user registration policies
- Set email verification requirements
- Configure user roles and permissions
Image Settings:
- Set maximum image upload size (512MB in our config)
- Configure allowed image formats
- Enable/disable image resizing options
- Set thumbnail dimensions
Storage Configuration:
- Configure image storage paths
- Enable/disable image optimization
- Set image quality settings
- Configure CDN integration (optional)
Email Configuration:
- Set up SMTP for user notifications
- Configure password reset emails
- Enable user registration emails
- Test email delivery
Create Administrator Account
- Access the admin panel at
/admin - Use the credentials you configured in environment variables
- Change the default password immediately
- Set up two-factor authentication
- Configure additional admin users as needed
Set Up Image Upload Policies
To control image sharing:
- In admin panel, navigate to Settings → Image
- Configure maximum upload file size
- Enable/disable specific image formats
- Set privacy levels (public, unlisted, private)
- Configure album creation policies
Image Hosting Best Practices
Managing Image Storage
- Monitor storage volume usage regularly
- Implement image cleanup policies for deleted content
- Archive old content to reduce storage costs
- Set up automated backup procedures
- Configure image optimization to reduce file sizes
User Account Management
- Implement strong password requirements
- Enable email verification for new users
- Set up account suspension policies
- Configure user quotas and limits
- Monitor account activity for security
Performance Optimization
- Enable image caching where possible
- Configure CDN for image delivery (optional)
- Optimize image processing settings
- Set up database indexes for quick queries
- Monitor server performance metrics
Privacy and Security
- Configure private and unlisted image options
- Implement content moderation tools
- Set up abuse reporting mechanisms
- Enable HTTPS for all connections (automatic with Klutch.sh)
- Regular security audits and updates
Deployment Best Practices
Security Measures
- Keep Chevereto updated to the latest version
- Use strong, unique passwords for all accounts
- Enable two-factor authentication for administrators
- Configure firewall rules to restrict access if needed
- Use HTTPS for all communications (automatic with Klutch.sh)
- Regularly review user access permissions
- Monitor file uploads for malicious content
Monitoring and Maintenance
- Monitor disk usage for image storage
- Set up alerts for deployment failures
- Review logs regularly for errors or security issues
- Schedule maintenance windows for updates
- Test backup restoration procedures monthly
- Monitor database performance
Scaling Considerations
As your image hosting platform grows:
- Increase volume sizes proactively before running out of space
- Monitor database performance and optimize queries
- Implement image compression for better storage efficiency
- Consider implementing CDN for global content delivery
- Archive or delete old images based on retention policies
Accessing Chevereto
Once deployment is complete and configured:
- Users access Chevereto at your configured domain or
example-app.klutch.sh - Users can register and create accounts
- Users can upload and manage images
- Users can create and organize albums
- Share images with public, unlisted, or private access levels
- Admin panel provides full site management
Troubleshooting Deployment Issues
Application Won’t Start
Check the following:
- Verify all required environment variables are set
- Ensure database connection string is correct
- Check that MySQL and Redis are accessible
- Review application logs in the dashboard
- Verify Apache modules are loaded (mod_rewrite, mod_headers)
Database Connection Errors
Steps to resolve:
- Verify DB_HOST and database credentials
- Ensure database is running and accessible
- Check database user permissions
- Verify network connectivity between services
- Test database connectivity from logs
Image Upload Issues
Possible solutions:
- Verify persistent volumes are properly attached
- Check available disk space on volumes
- Ensure upload directory has write permissions
- Verify file size limits match your needs
- Check image format restrictions
Performance Issues
Optimization steps:
- Increase application memory allocation
- Enable Redis caching
- Optimize image processing settings
- Configure image compression
- Review and optimize database queries
Advanced Configuration
Environment Variables for Customization
You can customize Chevereto behavior with these environment variables:
# Image ProcessingENABLE_IMAGE_RESIZING=trueENABLE_THUMBNAILS=trueTHUMBNAIL_SIZE=350x350IMAGE_QUALITY=90
# Upload RestrictionsMAX_UPLOAD_SIZE=512MALLOWED_IMAGE_EXTENSIONS=jpg,jpeg,png,gif,webpCHUNK_UPLOAD_SIZE=10M
# PerformanceCACHE_DRIVER=redisSESSION_DRIVER=cookieQUEUE_CONNECTION=sync
# SecurityENABLE_2FA=trueFORCE_HTTPS=trueSECURE_COOKIES=true
# Feature FlagsENABLE_API=trueENABLE_USER_REGISTRATION=trueENABLE_ALBUM_CREATION=trueENABLE_SHARING=trueCustom Domain Setup
To use a custom domain with your Chevereto instance:
- In your Klutch.sh dashboard, navigate to Domains
- Add your custom domain
- Follow the DNS configuration instructions
- Update your environment variables with the new domain:
APP_URL=https://your-domain.com
- Save and redeploy your application
Image Processing Optimization
For better image handling:
- Configure image quality settings in admin panel
- Enable automatic thumbnail generation
- Set up image optimization pipeline
- Configure CDN integration for faster delivery
- Enable WebP format for modern browsers
Additional Resources
Learn more about Chevereto and Klutch.sh:
- Chevereto GitHub Repository - Source code and contribution guidelines
- Chevereto Documentation - Comprehensive platform documentation
- Chevereto Issue Tracker - Report bugs and request features
- Klutch.sh Official Website - Learn more about the deployment platform
- Klutch.sh Documentation - Platform guides and API reference
Conclusion
You now have a fully functional Chevereto instance running on Klutch.sh! Your self-hosted image hosting and sharing platform is ready for users to upload and share images.
With the robust infrastructure provided by Klutch.sh and the powerful features of Chevereto, you can create a private image hosting solution with complete control. Remember to:
- Keep your application updated with the latest Chevereto releases
- Monitor storage usage and scale volumes as needed
- Maintain regular backups of your database and images
- Follow security best practices for user authentication
- Implement content moderation and abuse prevention
For additional support or questions about deploying Chevereto on Klutch.sh, refer to the documentation and community resources linked above.