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└── .dockerignoreCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM php:8.2-apache
# Install system dependenciesRUN apt-get update && apt-get install -y \ git \ curl \ libpng-dev \ libonig-dev \ libxml2-dev \ zip \ unzip \ libzip-dev \ nodejs \ npm
# Install PHP extensionsRUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip intl
# Enable Apache mod_rewriteRUN a2enmod rewrite
# Install ComposerCOPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set working directoryWORKDIR /var/www/html
# Clone Krayin CRMRUN git clone https://github.com/krayin/laravel-crm.git .
# Install PHP dependenciesRUN composer install --no-dev --optimize-autoloader
# Install and build frontend assetsRUN npm install && npm run build
# Set permissionsRUN 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 ApacheRUN sed -i 's|/var/www/html|/var/www/html/public|g' /etc/apache2/sites-available/000-default.conf
# Set environment variablesENV APP_ENV=productionENV APP_DEBUG=false
# Expose portEXPOSE 80
# Start ApacheCMD ["apache2-foreground"]Environment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
APP_KEY | Yes | - | Laravel application key (generate with php artisan key:generate) |
APP_URL | Yes | - | Your Krayin instance URL |
DB_CONNECTION | Yes | mysql | Database driver |
DB_HOST | Yes | - | Database host |
DB_PORT | No | 3306 | Database port |
DB_DATABASE | Yes | - | Database name |
DB_USERNAME | Yes | - | Database username |
DB_PASSWORD | Yes | - | Database password |
MAIL_MAILER | No | smtp | Mail driver |
MAIL_HOST | No | - | SMTP host |
MAIL_PORT | No | 587 | SMTP port |
MAIL_USERNAME | No | - | SMTP username |
MAIL_PASSWORD | No | - | SMTP password |
Deploying Krayin on Klutch.sh
- Select HTTP as the traffic type
- Set the internal port to 80
- Detect your Dockerfile automatically
- Build the container image
- Attach the persistent volumes
- Start the Krayin container
- Provision an HTTPS certificate
Generate an App Key
Generate a Laravel application key:
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:
git initgit add Dockerfile .dockerignore README.mdgit commit -m "Initial Krayin deployment configuration"git remote add origin https://github.com/yourusername/krayin-deploy.gitgit push -u origin mainCreate 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:
Set Environment Variables
Add the following environment variables:
| Variable | Value |
|---|---|
APP_KEY | Your generated Laravel key |
APP_URL | https://your-app-name.klutch.sh |
APP_ENV | production |
DB_CONNECTION | mysql |
DB_HOST | Your database host |
DB_PORT | 3306 |
DB_DATABASE | Your database name |
DB_USERNAME | Your database user |
DB_PASSWORD | Your database password |
Attach Persistent Volumes
Add volumes for data persistence:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/var/www/html/storage | 10 GB | Application storage and uploads |
/var/www/html/bootstrap/cache | 1 GB | Framework cache |
Deploy Your Application
Click Deploy to start the build process. Klutch.sh will:
Run Database Migrations
After the first deployment, run migrations through the container:
php artisan migrate --seedAccess 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:
- Log in with the default admin credentials (check documentation)
- Change the admin password immediately
- Configure your company information
- Set up email integration
- Create user accounts for your team
Setting Up Sales Pipelines
Configure your sales process:
- Navigate to Settings > Pipelines
- Create or modify pipeline stages
- Set stage probabilities for forecasting
- Configure stage automation
Creating Custom Attributes
Add fields specific to your business:
- Go to Settings > Attributes
- Select the entity type (Lead, Person, Organization)
- Add custom fields
- 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.