Skip to content

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

  1. Create a Dockerfile

    Create a Dockerfile in the root of your repository to containerize Chevereto:

    FROM php:8.2-apache
    # Install system dependencies
    RUN 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 extensions
    RUN docker-php-ext-configure gd \
    --with-freetype \
    --with-jpeg \
    --with-webp
    RUN docker-php-ext-install -j$(nproc) \
    gd \
    zip \
    pdo_mysql \
    intl \
    opcache
    # Install Imagick
    RUN pecl install imagick && docker-php-ext-enable imagick
    # Install Memcached
    RUN pecl install memcached && docker-php-ext-enable memcached
    # Enable Apache mod_rewrite
    RUN a2enmod rewrite headers
    # Set working directory
    WORKDIR /var/www/html
    # Clone Chevereto repository
    RUN git clone https://github.com/Chevereto/Chevereto-Free.git . && \
    git checkout main
    # Create necessary directories
    RUN mkdir -p /var/www/html/storage && \
    mkdir -p /var/www/html/images && \
    chown -R www-data:www-data /var/www/html
    # Copy Apache configuration
    COPY apache.conf /etc/apache2/sites-available/000-default.conf
    # Copy PHP configuration
    COPY php.ini /usr/local/etc/php/conf.d/chevereto.ini
    # Expose port
    EXPOSE 80
    # Health check
    HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
    CMD curl -f http://localhost/ || exit 1
    # Start Apache
    CMD ["apache2-foreground"]
  2. Create Apache Configuration

    Create an apache.conf file for Apache virtual host settings:

    <VirtualHost *:80>
    ServerName chevereto.local
    ServerAdmin admin@example.com
    DocumentRoot /var/www/html/public
    <Directory /var/www/html/public>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ index.php [QSA,L]
    </IfModule>
    </Directory>
    <Directory /var/www/html>
    Options -Indexes
    AllowOverride None
    Require all denied
    </Directory>
    <FilesMatch "\.php$">
    SetHandler application/x-httpd-php
    </FilesMatch>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
  3. Create PHP Configuration

    Create a php.ini file for PHP settings:

    ; Chevereto PHP Configuration
    upload_max_filesize = 512M
    post_max_size = 512M
    max_execution_time = 300
    memory_limit = 512M
    default_socket_timeout = 60
    ; Display errors in development (disable in production)
    display_errors = Off
    log_errors = On
    error_log = /var/log/apache2/php_errors.log
    ; Session configuration
    session.gc_maxlifetime = 1440
    session.cookie_httponly = 1
    session.cookie_secure = 1
    session.cookie_samesite = Lax
    ; Opcache configuration
    opcache.enable = 1
    opcache.memory_consumption = 128
    opcache.interned_strings_buffer = 8
    opcache.max_accelerated_files = 4000
    opcache.revalidate_freq = 0
    ; Timezone
    date.timezone = UTC
  4. Create Environment Configuration File

    Create a .env.example file to document required environment variables:

    # Chevereto Environment Configuration
    # Application Settings
    APP_ENV=production
    APP_DEBUG=false
    APP_URL=https://example-app.klutch.sh
    # Database Configuration
    DB_CONNECTION=mysql
    DB_HOST=db
    DB_PORT=3306
    DB_DATABASE=chevereto
    DB_USERNAME=chevereto
    DB_PASSWORD=chevereto_secure_password
    # Redis Configuration (for cache)
    REDIS_HOST=redis
    REDIS_PORT=6379
    REDIS_DB=0
    CACHE_DRIVER=redis
    # Storage Configuration
    STORAGE_PATH=/var/www/html/storage
    IMAGES_PATH=/var/www/html/images
    UPLOADS_PATH=/var/www/html/uploads
    # File Upload Configuration
    MAX_UPLOAD_SIZE=512M
    ALLOWED_IMAGE_EXTENSIONS=jpg,jpeg,png,gif,webp,bmp,svg+xml
    ALLOWED_VIDEO_EXTENSIONS=mp4,webm,ogg
    # Image Processing
    ENABLE_IMAGE_RESIZING=true
    ENABLE_THUMBNAILS=true
    THUMBNAIL_SIZE=350x350
    ENABLE_WATERMARK=false
    # Email Configuration (Optional)
    MAIL_DRIVER=smtp
    MAIL_HOST=smtp.gmail.com
    MAIL_PORT=587
    MAIL_USERNAME=your-email@gmail.com
    MAIL_PASSWORD=your-app-password
    MAIL_ENCRYPTION=tls
    MAIL_FROM_ADDRESS=noreply@example-app.klutch.sh
    MAIL_FROM_NAME=Chevereto
    # Authentication
    ENABLE_USER_REGISTRATION=true
    REQUIRE_EMAIL_VERIFICATION=true
    # Admin Settings
    ADMIN_EMAIL=admin@example.com
    ADMIN_USERNAME=admin
    ADMIN_PASSWORD=change-me-in-production
    # Application Security
    APP_KEY=base64:your-generated-app-key-here
    JWT_SECRET=your-jwt-secret-here-change-in-production
    # CORS Settings
    CORS_ALLOWED_ORIGINS=https://example-app.klutch.sh
    # API Configuration
    API_ENABLED=true
    API_RATE_LIMIT=100
    # Analytics
    ENABLE_ANALYTICS=false
    GOOGLE_ANALYTICS_ID=
    # Advanced Settings
    LOG_CHANNEL=stack
    QUEUE_CONNECTION=sync
    SESSION_DRIVER=cookie
    SESSION_LIFETIME=120
  5. Create Database Initialization Script

    Create an init-db.sh file to set up the MySQL database:

    #!/bin/bash
    set -e
    echo "Initializing Chevereto database..."
    # Wait for MySQL to be ready
    until mysqladmin ping -h"$DB_HOST" -u"$DB_USERNAME" -p"$DB_PASSWORD" --silent; do
    echo 'Waiting for mysql...'
    sleep 1
    done
    echo "MySQL is ready!"
    # Check if database exists
    if ! mysql -h"$DB_HOST" -u"$DB_USERNAME" -p"$DB_PASSWORD" -e "use $DB_DATABASE" 2>/dev/null; then
    echo "Creating database $DB_DATABASE..."
    mysql -h"$DB_HOST" -u"$DB_USERNAME" -p"$DB_PASSWORD" -e "CREATE DATABASE $DB_DATABASE;"
    echo "Database created!"
    fi
    # Run migrations
    echo "Running database migrations..."
    php artisan migrate --force
    # Create symlinks for storage
    echo "Creating storage symlinks..."
    php artisan storage:link
    echo "Database initialization complete!"

    Make it executable:

    Terminal window
    chmod +x init-db.sh
  6. Create Docker Compose for Local Development

    Create a docker-compose.yml file for local development and testing (not used for Klutch.sh deployment):

    version: '3.8'
    services:
    chevereto:
    build: .
    container_name: chevereto-dev
    ports:
    - "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=true
    depends_on:
    - db
    - redis
    volumes:
    - ./storage:/var/www/html/storage
    - ./images:/var/www/html/images
    - ./src:/var/www/html/src
    networks:
    - chevereto-network
    db:
    image: mysql:8.0
    container_name: chevereto-db
    environment:
    - MYSQL_ROOT_PASSWORD=root_password
    - MYSQL_DATABASE=chevereto
    - MYSQL_USER=chevereto
    - MYSQL_PASSWORD=chevereto_password
    volumes:
    - chevereto_db_data:/var/lib/mysql
    networks:
    - chevereto-network
    healthcheck:
    test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
    interval: 10s
    timeout: 5s
    retries: 5
    redis:
    image: redis:7-alpine
    container_name: chevereto-redis
    networks:
    - chevereto-network
    healthcheck:
    test: ["CMD", "redis-cli", "ping"]
    interval: 10s
    timeout: 5s
    retries: 5
    volumes:
    chevereto_db_data:
    networks:
    chevereto-network:
    driver: bridge
  7. Create .gitignore File

    Create a .gitignore file to exclude sensitive data from version control:

    # Environment files
    .env
    .env.local
    .env.*.local
    # PHP
    vendor/
    composer.lock
    .composer.lock
    # Storage and uploads
    storage/
    images/
    uploads/
    bootstrap/cache/
    # Logs
    logs/
    *.log
    # IDE
    .vscode/
    .idea/
    *.swp
    *.swo
    *~
    .DS_Store
    # Build artifacts
    dist/
    build/
    node_modules/
    # Cache
    .cache/
    .turbo/
    # Database
    *.sqlite
    *.sqlite3
    # Misc
    .env.backup
    .env.*.backup
  8. Push 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 .gitignore
    git commit -m "Initial Chevereto deployment configuration for Klutch.sh"
    git push origin main
  9. Deploy on Klutch.sh

    1. Navigate to klutch.sh/app and log in to your dashboard
    2. Click Create New App
    3. Connect your GitHub repository containing the Chevereto deployment files (the Dockerfile will be automatically detected)
    4. Configure your application settings:
      • Set your preferred app name
      • Review the detected Dockerfile configuration
      • Select a region for deployment
    5. Click Deploy to start the deployment process
    6. Monitor the deployment progress in the dashboard
    7. Wait for the deployment to complete and your app to become active
  10. Configure Environment Variables

    1. In your app dashboard, navigate to Environment Variables section
    2. Add all required variables from your .env.example file:
      • APP_URL: Set to https://example-app.klutch.sh (or your custom domain)
      • DB_HOST: Your MySQL hostname
      • DB_DATABASE: Database name (chevereto)
      • DB_USERNAME: Database user
      • DB_PASSWORD: Secure database password
      • REDIS_HOST: Your Redis hostname
      • APP_KEY: Generate with php artisan key:generate
      • JWT_SECRET: Generate a secure secret with openssl rand -base64 32
      • ADMIN_EMAIL, ADMIN_USERNAME, ADMIN_PASSWORD: Administrator credentials
    3. Click Save to apply the environment variables
    4. Your application will automatically restart with the new configuration
  11. Configure Traffic Routes

    1. In your app dashboard, navigate to Traffic settings
    2. Select HTTP as the traffic type
    3. Set the internal port to 80 (Apache default)
    4. Configure any custom domain settings if you have a domain
    5. Save your traffic configuration
  12. Attach Persistent Volumes

    Chevereto requires persistent storage for images, uploads, and application data.

    1. In your app dashboard, navigate to Volumes settings
    2. 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
    3. 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
    4. 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

    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

  1. Navigate to https://example-app.klutch.sh in your web browser
  2. You’ll see the Chevereto welcome page
  3. Click Register or navigate to /admin for administrator access
  4. Create your administrator account with the credentials you set in environment variables
  5. 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

  1. Access the admin panel at /admin
  2. Use the credentials you configured in environment variables
  3. Change the default password immediately
  4. Set up two-factor authentication
  5. Configure additional admin users as needed

Set Up Image Upload Policies

To control image sharing:

  1. In admin panel, navigate to SettingsImage
  2. Configure maximum upload file size
  3. Enable/disable specific image formats
  4. Set privacy levels (public, unlisted, private)
  5. 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:

  1. Users access Chevereto at your configured domain or example-app.klutch.sh
  2. Users can register and create accounts
  3. Users can upload and manage images
  4. Users can create and organize albums
  5. Share images with public, unlisted, or private access levels
  6. 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:

Terminal window
# Image Processing
ENABLE_IMAGE_RESIZING=true
ENABLE_THUMBNAILS=true
THUMBNAIL_SIZE=350x350
IMAGE_QUALITY=90
# Upload Restrictions
MAX_UPLOAD_SIZE=512M
ALLOWED_IMAGE_EXTENSIONS=jpg,jpeg,png,gif,webp
CHUNK_UPLOAD_SIZE=10M
# Performance
CACHE_DRIVER=redis
SESSION_DRIVER=cookie
QUEUE_CONNECTION=sync
# Security
ENABLE_2FA=true
FORCE_HTTPS=true
SECURE_COOKIES=true
# Feature Flags
ENABLE_API=true
ENABLE_USER_REGISTRATION=true
ENABLE_ALBUM_CREATION=true
ENABLE_SHARING=true

Custom Domain Setup

To use a custom domain with your Chevereto instance:

  1. In your Klutch.sh dashboard, navigate to Domains
  2. Add your custom domain
  3. Follow the DNS configuration instructions
  4. Update your environment variables with the new domain:
    • APP_URL=https://your-domain.com
  5. Save and redeploy your application

Image Processing Optimization

For better image handling:

  1. Configure image quality settings in admin panel
  2. Enable automatic thumbnail generation
  3. Set up image optimization pipeline
  4. Configure CDN integration for faster delivery
  5. Enable WebP format for modern browsers

Additional Resources

Learn more about Chevereto and Klutch.sh:

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.