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.mdKeep 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 dependenciesRUN 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 extensionsRUN 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 ComposerCOPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set working directoryWORKDIR /var/www/html
# Clone Hi-events repository (or copy your fork)# Pin to a specific version/tag for reproducible buildsRUN git clone --depth 1 --branch main https://github.com/HiEventsDev/Hi.Events.git . \ || echo "Adjust repository URL and branch/tag as needed"
# Install PHP dependenciesRUN composer install --no-dev --optimize-autoloader --no-interaction
# Install Node dependencies and build assetsRUN npm ci && npm run build
# Set proper 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
# Copy entrypoint scriptCOPY docker-entrypoint.sh /usr/local/bin/RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Expose port 8080 for HTTP trafficEXPOSE 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/shset -e
# Wait for database to be readyecho "Waiting for database connection..."until php artisan db:show 2>/dev/null; do echo "Database is unavailable - sleeping" sleep 2done
echo "Database is up - executing commands"
# Run migrationsphp artisan migrate --force
# Cache configurationphp artisan config:cachephp artisan route:cachephp artisan view:cache
# Optimize applicationphp artisan optimize
echo "Hi-events initialization complete"
# Execute the main commandexec "$@"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-eventsAPP_ENV=productionAPP_KEY=base64:YOUR_GENERATED_APP_KEY_HEREAPP_DEBUG=falseAPP_URL=https://example-app.klutch.shImportant: Generate the APP_KEY using Laravel’s key generation command: php artisan key:generate --show
Database Configuration (PostgreSQL)
DB_CONNECTION=pgsqlDB_HOST=your-postgres-hostDB_PORT=5432DB_DATABASE=hieventsDB_USERNAME=your-db-userDB_PASSWORD=your-secure-passwordDatabase Configuration (MySQL - Alternative)
DB_CONNECTION=mysqlDB_HOST=your-mysql-hostDB_PORT=3306DB_DATABASE=hieventsDB_USERNAME=your-db-userDB_PASSWORD=your-secure-passwordMail Configuration
MAIL_MAILER=smtpMAIL_HOST=your-smtp-hostMAIL_PORT=587MAIL_USERNAME=your-smtp-usernameMAIL_PASSWORD=your-smtp-passwordMAIL_ENCRYPTION=tlsMAIL_FROM_ADDRESS=noreply@yourdomain.comMAIL_FROM_NAME=Hi-eventsSession and Cache
SESSION_DRIVER=fileCACHE_DRIVER=fileQUEUE_CONNECTION=databasePayment Gateways (Optional)
STRIPE_KEY=your-stripe-publishable-keySTRIPE_SECRET=your-stripe-secret-keySecurity 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:
-
Navigate to your app in the Klutch.sh dashboard at klutch.sh/app
-
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)
- Mount Path:
-
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.
Option 1: PostgreSQL (Recommended)
-
Provision a PostgreSQL database on Klutch.sh or use an external provider
-
Create the database:
CREATE DATABASE hievents; -
Create a dedicated user:
CREATE USER hievents_user WITH PASSWORD 'secure_password';GRANT ALL PRIVILEGES ON DATABASE hievents TO hievents_user; -
Configure the connection using the environment variables listed above
Option 2: MySQL
-
Provision a MySQL database (see MySQL deployment guide)
-
Create the database:
CREATE DATABASE hievents CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; -
Create a dedicated user:
CREATE USER 'hievents_user'@'%' IDENTIFIED BY 'secure_password';GRANT ALL PRIVILEGES ON hievents.* TO 'hievents_user'@'%';FLUSH PRIVILEGES; -
Configure the connection using the MySQL environment variables
Deploying to Klutch.sh
Follow these steps to deploy Hi-events on Klutch.sh:
-
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
-
Create a new app in the Klutch.sh dashboard at klutch.sh/app
-
Connect your GitHub repository:
- Select your repository from the list
- Klutch.sh will automatically detect your Dockerfile
-
Configure the application:
- Set the internal port to
8080(Hi-events listens on this port) - Select HTTP traffic type in the Klutch.sh UI
- Set the internal port to
-
Attach persistent storage:
- Add a volume with mount path
/var/www/html/storage - Set appropriate size (minimum 5GB recommended)
- Add a volume with mount path
-
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
-
Configure database connection:
- Ensure your database is provisioned and accessible
- Verify network connectivity between your app and database
- Test credentials before deployment
-
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
-
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
- Access your app at the provided Klutch.sh URL (e.g.,
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=8080Custom Build Command
Set the following buildtime environment variable:
NIXPACKS_BUILD_CMD=composer install --no-dev && npm ci && npm run buildCustom PHP Version
NIXPACKS_PHP_VERSION=8.2Note: 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:
-
Access the admin panel at
https://example-app.klutch.sh/admin -
Complete initial setup:
- Create your admin account
- Configure organization details
- Set up payment gateways (Stripe, PayPal, etc.)
- Configure email settings for ticket delivery
-
Customize branding:
- Upload your logo and brand colors
- Customize email templates
- Set up custom domains (optional)
-
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
-
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:
-
Add your domain in the Klutch.sh dashboard (klutch.sh/app)
-
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
-
Update environment variables:
- Set
APP_URLto your custom domain (e.g.,https://events.yourdomain.com) - Clear and rebuild cache:
php artisan config:cache
- Set
-
Verify TLS certificate:
- Klutch.sh automatically manages TLS certificates
- Ensure HTTPS is working correctly
-
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_URLto 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/storagevolume 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-dsnSENTRY_TRACES_SAMPLE_RATE=0.2Scaling 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=redisSESSION_DRIVER=redisREDIS_HOST=your-redis-hostREDIS_PORT=6379REDIS_PASSWORD=your-redis-passwordBackup and Disaster Recovery
Implement a comprehensive backup strategy:
-
Database backups:
- Schedule automated daily backups using pg_dump (PostgreSQL) or mysqldump (MySQL)
- Store backups in object storage (S3-compatible)
- Test restoration procedures regularly
-
Storage volume backups:
- Back up
/var/www/html/storagedaily - Include uploaded images, tickets, and logs
- Verify backup integrity
- Back up
-
Configuration backups:
- Keep version-controlled copies of environment variables
- Document custom configurations
- Store securely in a password manager or secrets vault
-
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 backupsexport 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 storageaws 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 productionpsql -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
- Hi-events Official Website
- Hi-events GitHub Repository
- Hi-events Documentation
- Klutch.sh Quick Start Guide
- Klutch.sh Volumes Documentation
- Klutch.sh Custom Domains Guide
- MySQL Deployment Guide
- Laravel Documentation
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.