Skip to content

Deploying Hi-events

Introduction

Hi-events is a powerful open-source event management and ticketing platform designed to help organizers create, manage, and sell tickets for events of all sizes. Built with modern web technologies, Hi-events offers a comprehensive suite of features including event creation, ticket sales, attendee management, check-in functionality, and detailed analytics. The platform provides a user-friendly interface for both event organizers and attendees, making it an excellent choice for conferences, concerts, workshops, meetups, and various other event types.

This guide provides a detailed walkthrough for deploying Hi-events on Klutch.sh using a Dockerfile. You’ll learn how to set up the complete infrastructure, configure persistent storage, manage environment variables, connect to a database, and implement production-ready best practices for running Hi-events at scale.


Prerequisites

Before deploying Hi-events on Klutch.sh, ensure you have:

  • A Klutch.sh account (sign up here)
  • A GitHub repository for your Hi-events deployment
  • Basic familiarity with Docker, environment variables, and database concepts
  • A PostgreSQL or MySQL database (can be provisioned on Klutch.sh or from an external provider)
  • Understanding of persistent storage and volume management

Project Structure

A typical Hi-events deployment repository should contain:

hi-events-docker/
├── Dockerfile
├── docker-entrypoint.sh
├── .env.example
├── nginx.conf (optional - for custom routing)
└── README.md

Keep sensitive configuration files and credentials out of the repository. Use Klutch.sh environment variables for all secrets and sensitive data.


Sample Dockerfile for Hi-events

Here’s a production-ready Dockerfile for deploying Hi-events. This example uses PHP with necessary extensions and dependencies:

FROM php:8.2-fpm-alpine
# Install system dependencies
RUN apk add --no-cache \
nginx \
supervisor \
git \
curl \
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
zip \
unzip \
libzip-dev \
postgresql-dev \
mysql-client \
oniguruma-dev \
nodejs \
npm
# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
gd \
pdo \
pdo_mysql \
pdo_pgsql \
mbstring \
zip \
bcmath \
exif \
pcntl
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /var/www/html
# Clone Hi-events repository (or copy your fork)
# Pin to a specific version/tag for reproducible builds
RUN git clone --depth 1 --branch main https://github.com/HiEventsDev/Hi.Events.git . \
|| echo "Adjust repository URL and branch/tag as needed"
# Install PHP dependencies
RUN composer install --no-dev --optimize-autoloader --no-interaction
# Install Node dependencies and build assets
RUN npm ci && npm run build
# Set proper 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
# Copy entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Expose port 8080 for HTTP traffic
EXPOSE 8080
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]

Note: Klutch.sh automatically detects a Dockerfile if present in the root directory of your repository. There is no need to specify this in the dashboard.


Docker Entrypoint Script

Create a docker-entrypoint.sh file to handle initialization tasks:

#!/bin/sh
set -e
# Wait for database to be ready
echo "Waiting for database connection..."
until php artisan db:show 2>/dev/null; do
echo "Database is unavailable - sleeping"
sleep 2
done
echo "Database is up - executing commands"
# Run migrations
php artisan migrate --force
# Cache configuration
php artisan config:cache
php artisan route:cache
php artisan view:cache
# Optimize application
php artisan optimize
echo "Hi-events initialization complete"
# Execute the main command
exec "$@"

Environment Variables Configuration

Hi-events requires several environment variables for proper operation. Set these in the Klutch.sh dashboard under your app’s environment variables section:

Core Application Settings

APP_NAME=Hi-events
APP_ENV=production
APP_KEY=base64:YOUR_GENERATED_APP_KEY_HERE
APP_DEBUG=false
APP_URL=https://example-app.klutch.sh

Important: Generate the APP_KEY using Laravel’s key generation command: php artisan key:generate --show

Database Configuration (PostgreSQL)

DB_CONNECTION=pgsql
DB_HOST=your-postgres-host
DB_PORT=5432
DB_DATABASE=hievents
DB_USERNAME=your-db-user
DB_PASSWORD=your-secure-password

Database Configuration (MySQL - Alternative)

DB_CONNECTION=mysql
DB_HOST=your-mysql-host
DB_PORT=3306
DB_DATABASE=hievents
DB_USERNAME=your-db-user
DB_PASSWORD=your-secure-password

Mail Configuration

MAIL_MAILER=smtp
MAIL_HOST=your-smtp-host
MAIL_PORT=587
MAIL_USERNAME=your-smtp-username
MAIL_PASSWORD=your-smtp-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@yourdomain.com
MAIL_FROM_NAME=Hi-events

Session and Cache

SESSION_DRIVER=file
CACHE_DRIVER=file
QUEUE_CONNECTION=database

Payment Gateways (Optional)

STRIPE_KEY=your-stripe-publishable-key
STRIPE_SECRET=your-stripe-secret-key

Security Note: Always store sensitive credentials as encrypted environment variables in Klutch.sh. Never commit secrets to your repository.


Persistent Storage Configuration

Hi-events requires persistent storage for uploaded files, images, generated tickets, and temporary data. Configure a persistent volume in Klutch.sh:

    1. Navigate to your app in the Klutch.sh dashboard at klutch.sh/app

    2. Add a persistent volume with the following configuration:

      • Mount Path: /var/www/html/storage
      • Size: Minimum 5GB (adjust based on expected event volume and file uploads)
    3. Verify permissions after deployment to ensure the web server can write to the storage directory

The storage directory contains:

  • Event images and promotional materials
  • Ticket attachments and PDFs
  • Session data
  • Cache files
  • Logs
  • Framework storage files

Database Setup

Hi-events requires a relational database. You can use either PostgreSQL (recommended) or MySQL.

    1. Provision a PostgreSQL database on Klutch.sh or use an external provider

    2. Create the database:

      CREATE DATABASE hievents;
    3. Create a dedicated user:

      CREATE USER hievents_user WITH PASSWORD 'secure_password';
      GRANT ALL PRIVILEGES ON DATABASE hievents TO hievents_user;
    4. Configure the connection using the environment variables listed above

Option 2: MySQL

    1. Provision a MySQL database (see MySQL deployment guide)

    2. Create the database:

      CREATE DATABASE hievents CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    3. Create a dedicated user:

      CREATE USER 'hievents_user'@'%' IDENTIFIED BY 'secure_password';
      GRANT ALL PRIVILEGES ON hievents.* TO 'hievents_user'@'%';
      FLUSH PRIVILEGES;
    4. Configure the connection using the MySQL environment variables


Deploying to Klutch.sh

Follow these steps to deploy Hi-events on Klutch.sh:

    1. Prepare your repository:

      • Ensure your Dockerfile and docker-entrypoint.sh are in the root directory
      • Add a .gitignore file to exclude sensitive files
      • Commit and push to GitHub
    2. Create a new app in the Klutch.sh dashboard at klutch.sh/app

    3. Connect your GitHub repository:

      • Select your repository from the list
      • Klutch.sh will automatically detect your Dockerfile
    4. Configure the application:

      • Set the internal port to 8080 (Hi-events listens on this port)
      • Select HTTP traffic type in the Klutch.sh UI
    5. Attach persistent storage:

      • Add a volume with mount path /var/www/html/storage
      • Set appropriate size (minimum 5GB recommended)
    6. Set environment variables:

      • Add all required environment variables from the configuration section above
      • Mark sensitive values (passwords, API keys) as secret
      • Generate APP_KEY using: php artisan key:generate --show
    7. Configure database connection:

      • Ensure your database is provisioned and accessible
      • Verify network connectivity between your app and database
      • Test credentials before deployment
    8. Deploy the application:

      • Click “Create” or “Deploy”
      • Klutch.sh will build the Docker image and start the container
      • Monitor the build logs for any errors
    9. Verify deployment:

      • Access your app at the provided Klutch.sh URL (e.g., https://example-app.klutch.sh)
      • Complete the initial Hi-events setup wizard
      • Create your first admin user
      • Test event creation and ticket generation

Nixpacks Customization

If you need to customize the build or start commands without using a Dockerfile, you can leverage Nixpacks environment variables:

Custom Start Command

Set the following runtime environment variable in Klutch.sh:

NIXPACKS_START_CMD=php artisan serve --host=0.0.0.0 --port=8080

Custom Build Command

Set the following buildtime environment variable:

NIXPACKS_BUILD_CMD=composer install --no-dev && npm ci && npm run build

Custom PHP Version

NIXPACKS_PHP_VERSION=8.2

Note: Since Klutch.sh uses Nixpacks, these environment variables allow you to customize the build and runtime behavior without modifying the Dockerfile.


Post-Deployment Configuration

After successful deployment:

    1. Access the admin panel at https://example-app.klutch.sh/admin

    2. Complete initial setup:

      • Create your admin account
      • Configure organization details
      • Set up payment gateways (Stripe, PayPal, etc.)
      • Configure email settings for ticket delivery
    3. Customize branding:

      • Upload your logo and brand colors
      • Customize email templates
      • Set up custom domains (optional)
    4. Create your first event:

      • Navigate to “Events” → “Create New”
      • Fill in event details, date, time, and location
      • Configure ticket types and pricing
      • Set capacity limits and early-bird pricing
    5. Test the complete flow:

      • Purchase a test ticket
      • Verify email delivery
      • Test the check-in functionality
      • Review the analytics dashboard

Custom Domain Configuration

To use a custom domain with your Hi-events deployment:

    1. Add your domain in the Klutch.sh dashboard (klutch.sh/app)

    2. Update DNS records:

      • Create an A record pointing to the IP provided by Klutch.sh
      • Or create a CNAME record as instructed in the dashboard
    3. Update environment variables:

      • Set APP_URL to your custom domain (e.g., https://events.yourdomain.com)
      • Clear and rebuild cache: php artisan config:cache
    4. Verify TLS certificate:

      • Klutch.sh automatically manages TLS certificates
      • Ensure HTTPS is working correctly
    5. Test the domain:

      • Access your Hi-events installation at the custom domain
      • Verify all assets load correctly
      • Test email links and payment callbacks

Security Best Practices

Ensure your Hi-events deployment is secure:

  • Use HTTPS only: Set APP_URL to use HTTPS protocol
  • Keep dependencies updated: Regularly update PHP, Composer packages, and Node modules
  • Strong passwords: Use complex passwords for database and admin accounts
  • Environment variable security: Store all secrets as encrypted environment variables in Klutch.sh
  • Database backups: Implement regular automated backups of your database
  • Storage backups: Back up the /var/www/html/storage volume regularly
  • Monitor logs: Regularly review application logs for suspicious activity
  • Rate limiting: Configure rate limiting for ticket sales and API endpoints
  • CSRF protection: Ensure Laravel’s CSRF protection is enabled (default)
  • Two-factor authentication: Enable 2FA for admin accounts
  • PCI compliance: If handling card data, ensure PCI DSS compliance

Monitoring and Logging

Monitor your Hi-events deployment:

  • Application logs: Located in /var/www/html/storage/logs/laravel.log
  • Web server logs: Check Nginx or Apache access and error logs
  • Database performance: Monitor query performance and connection pools
  • Resource usage: Track CPU, memory, and disk usage in Klutch.sh dashboard
  • Uptime monitoring: Set up external uptime monitoring for critical events
  • Error tracking: Consider integrating Sentry or similar error tracking services

Add error tracking by setting these environment variables:

SENTRY_LARAVEL_DSN=your-sentry-dsn
SENTRY_TRACES_SAMPLE_RATE=0.2

Scaling Considerations

As your events grow, consider these scaling strategies:

  • Vertical scaling: Increase instance size in Klutch.sh for more CPU/memory
  • Database optimization: Use connection pooling and query optimization
  • CDN integration: Serve static assets and images through a CDN
  • Queue workers: Implement Redis and queue workers for background jobs
  • Cache layer: Use Redis for session and cache storage in high-traffic scenarios
  • Load balancing: Deploy multiple instances behind a load balancer for high availability
  • Read replicas: Use database read replicas for reporting and analytics queries

To enable Redis caching, add these environment variables:

CACHE_DRIVER=redis
SESSION_DRIVER=redis
REDIS_HOST=your-redis-host
REDIS_PORT=6379
REDIS_PASSWORD=your-redis-password

Backup and Disaster Recovery

Implement a comprehensive backup strategy:

    1. Database backups:

      • Schedule automated daily backups using pg_dump (PostgreSQL) or mysqldump (MySQL)
      • Store backups in object storage (S3-compatible)
      • Test restoration procedures regularly
    2. Storage volume backups:

      • Back up /var/www/html/storage daily
      • Include uploaded images, tickets, and logs
      • Verify backup integrity
    3. Configuration backups:

      • Keep version-controlled copies of environment variables
      • Document custom configurations
      • Store securely in a password manager or secrets vault
    4. Disaster recovery plan:

      • Document restoration procedures
      • Maintain staging environment for testing
      • Keep emergency contact information updated

Example backup script:

#!/bin/bash
# PostgreSQL backup
# Note: Set PGPASSWORD environment variable or use .pgpass file for automated backups
export PGPASSWORD="$DB_PASSWORD"
pg_dump -h $DB_HOST -U $DB_USERNAME -d $DB_DATABASE | \
gzip > "hievents-backup-$(date +%Y%m%d).sql.gz"
unset PGPASSWORD
# Upload to S3-compatible storage
aws s3 cp "hievents-backup-$(date +%Y%m%d).sql.gz" \
s3://your-backup-bucket/hievents/

Troubleshooting Common Issues

Application won’t start

  • Check logs: Review application logs in /var/www/html/storage/logs/
  • Verify environment variables: Ensure all required variables are set
  • Database connectivity: Test database connection using php artisan db:show
  • Permissions: Verify storage directory has write permissions

Database connection errors

  • Network access: Ensure app can reach database host
  • Credentials: Verify database username and password
  • Port configuration: Confirm correct port (5432 for PostgreSQL, 3306 for MySQL)
  • Test manually:
    Terminal window
    # Note: Ensure credentials are not logged. Use with caution in production
    psql -h $DB_HOST -U $DB_USERNAME -d $DB_DATABASE

File upload issues

  • Storage permissions: Run chmod -R 755 /var/www/html/storage
  • Volume mounted: Verify persistent volume is attached correctly
  • Disk space: Check available disk space on volume
  • PHP configuration: Increase upload limits if needed

Performance issues

  • Enable caching: Run php artisan config:cache && php artisan route:cache
  • Optimize autoloader: Run composer dump-autoload --optimize
  • Database indexing: Review and optimize database indexes
  • Monitor queries: Use Laravel Debugbar to identify slow queries
  • Scale resources: Increase instance size or add more instances

Payment gateway issues

  • Webhook configuration: Ensure webhooks are properly configured
  • SSL/TLS: Verify HTTPS is working correctly
  • API credentials: Confirm Stripe/PayPal credentials are correct
  • Test mode: Use test credentials for development and staging

Resources


Conclusion

You now have a complete, production-ready Hi-events deployment on Klutch.sh. This setup provides a scalable, secure platform for managing events and selling tickets. Remember to regularly update dependencies, monitor performance, maintain backups, and follow security best practices to ensure a reliable service for your event attendees.

For advanced configurations, custom integrations, or specific use cases, refer to the official Hi-events documentation and the Klutch.sh guides linked above.