Skip to content

Deploying Krayin

Introduction

Krayin is a free and open source Customer Relationship Management (CRM) solution built on the Laravel PHP framework. Designed for small to medium businesses, Krayin provides a comprehensive platform for managing leads, contacts, organizations, sales pipelines, and customer interactions.

Built with a modular architecture, Krayin offers flexibility for customization while providing essential CRM features out of the box. The application features a clean, modern interface that makes it easy for sales teams to track their deals and manage customer relationships effectively.

Key features of Krayin:

  • Lead Management: Capture, track, and nurture leads through your sales funnel
  • Contact Management: Store and organize customer and prospect information
  • Pipeline Management: Visual Kanban-style pipeline for tracking deals
  • Activity Tracking: Log calls, meetings, emails, and notes
  • Email Integration: Connect with email providers for communication tracking
  • Workflow Automation: Automate repetitive tasks and notifications
  • Reports and Analytics: Track sales performance and team productivity
  • Role-Based Access: Control who can view and edit different data
  • Custom Attributes: Add custom fields to match your business needs
  • API Access: REST API for integration with other systems
  • Multi-language Support: Internationalization for global teams
  • Open Source: MIT licensed with active community development

This guide walks through deploying Krayin on Klutch.sh using Docker, configuring the database, and setting up the CRM for your team.

Why Deploy Krayin on Klutch.sh

Deploying Krayin on Klutch.sh provides several advantages for CRM hosting:

Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds Krayin without complex orchestration.

Persistent Storage: Attach persistent volumes for your database and file uploads. Your CRM data survives container restarts.

HTTPS by Default: Klutch.sh provides automatic SSL certificates, securing your customer data in transit.

GitHub Integration: Connect your configuration repository directly from GitHub. Updates trigger automatic redeployments.

Scalable Resources: Allocate CPU and memory based on your team size and data volume.

Environment Variable Management: Securely store database credentials and API keys.

Custom Domains: Assign a professional domain to your CRM instance.

Always-On Availability: Your CRM remains accessible 24/7 for your sales team.

Prerequisites

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

  • A Klutch.sh account
  • A GitHub account with a repository for your configuration
  • Basic familiarity with Docker and PHP/Laravel concepts
  • A MySQL or PostgreSQL database (or use the embedded option)
  • (Optional) A custom domain for your CRM

Preparing Your Repository

Create a GitHub repository containing your Dockerfile for deploying Krayin on Klutch.sh.

Repository Structure

krayin-deploy/
├── Dockerfile
├── .env.example
├── README.md
└── .dockerignore

Creating the Dockerfile

Create a Dockerfile in the root of your repository:

FROM php:8.2-apache
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
libzip-dev \
nodejs \
npm
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip intl
# Enable Apache mod_rewrite
RUN a2enmod rewrite
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /var/www/html
# Clone Krayin CRM
RUN git clone https://github.com/krayin/laravel-crm.git .
# Install PHP dependencies
RUN composer install --no-dev --optimize-autoloader
# Install and build frontend assets
RUN npm install && npm run build
# Set permissions
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html/storage \
&& chmod -R 755 /var/www/html/bootstrap/cache
# Configure Apache
RUN sed -i 's|/var/www/html|/var/www/html/public|g' /etc/apache2/sites-available/000-default.conf
# Set environment variables
ENV APP_ENV=production
ENV APP_DEBUG=false
# Expose port
EXPOSE 80
# Start Apache
CMD ["apache2-foreground"]

Environment Variables Reference

VariableRequiredDefaultDescription
APP_KEYYes-Laravel application key (generate with php artisan key:generate)
APP_URLYes-Your Krayin instance URL
DB_CONNECTIONYesmysqlDatabase driver
DB_HOSTYes-Database host
DB_PORTNo3306Database port
DB_DATABASEYes-Database name
DB_USERNAMEYes-Database username
DB_PASSWORDYes-Database password
MAIL_MAILERNosmtpMail driver
MAIL_HOSTNo-SMTP host
MAIL_PORTNo587SMTP port
MAIL_USERNAMENo-SMTP username
MAIL_PASSWORDNo-SMTP password

Deploying Krayin on Klutch.sh

    Generate an App Key

    Generate a Laravel application key:

    Terminal window
    php -r "echo 'base64:' . base64_encode(random_bytes(32)) . PHP_EOL;"

    Or use an online Laravel key generator.

    Push Your Repository to GitHub

    Initialize your repository and push to GitHub:

    Terminal window
    git init
    git add Dockerfile .dockerignore README.md
    git commit -m "Initial Krayin deployment configuration"
    git remote add origin https://github.com/yourusername/krayin-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. Give it a descriptive name like “krayin” or “crm”.

    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 Krayin Dockerfile.

    Configure HTTP Traffic

    In the deployment settings:

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

    Set Environment Variables

    Add the following environment variables:

    VariableValue
    APP_KEYYour generated Laravel key
    APP_URLhttps://your-app-name.klutch.sh
    APP_ENVproduction
    DB_CONNECTIONmysql
    DB_HOSTYour database host
    DB_PORT3306
    DB_DATABASEYour database name
    DB_USERNAMEYour database user
    DB_PASSWORDYour database password

    Attach Persistent Volumes

    Add volumes for data persistence:

    Mount PathRecommended SizePurpose
    /var/www/html/storage10 GBApplication storage and uploads
    /var/www/html/bootstrap/cache1 GBFramework cache

    Deploy Your Application

    Click Deploy to start the build process. Klutch.sh will:

    • Detect your Dockerfile automatically
    • Build the container image
    • Attach the persistent volumes
    • Start the Krayin container
    • Provision an HTTPS certificate

    Run Database Migrations

    After the first deployment, run migrations through the container:

    Terminal window
    php artisan migrate --seed

    Access Krayin

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

Initial Configuration

First-Time Setup

When you first access Krayin:

  1. Log in with the default admin credentials (check documentation)
  2. Change the admin password immediately
  3. Configure your company information
  4. Set up email integration
  5. Create user accounts for your team

Setting Up Sales Pipelines

Configure your sales process:

  1. Navigate to Settings > Pipelines
  2. Create or modify pipeline stages
  3. Set stage probabilities for forecasting
  4. Configure stage automation

Creating Custom Attributes

Add fields specific to your business:

  1. Go to Settings > Attributes
  2. Select the entity type (Lead, Person, Organization)
  3. Add custom fields
  4. Configure validation rules

Troubleshooting Common Issues

Database Connection Errors

  • Verify database credentials are correct
  • Check network connectivity to database server
  • Ensure database exists and user has permissions

Permission Errors

  • Verify storage and cache directories are writable
  • Check file ownership matches web server user
  • Run chmod -R 755 storage bootstrap/cache

Email Not Working

  • Verify SMTP credentials
  • Check mail port and encryption settings
  • Test with a simple email first

Additional Resources

Conclusion

Deploying Krayin on Klutch.sh gives you a powerful, open source CRM with automatic builds, persistent storage, and secure HTTPS access. Manage your leads, contacts, and sales pipelines without the cost of proprietary CRM solutions.