Deploying Chartbrew
Chartbrew is an open-source web application that enables users to create interactive, real-time dashboards and visualizations from multiple data sources. It supports connections to various databases including PostgreSQL, MySQL, MongoDB, and APIs, making it ideal for business intelligence, data analysis, and performance monitoring. Chartbrew simplifies the process of turning raw data into actionable insights through intuitive visualization tools.
This guide will walk you through deploying Chartbrew on Klutch.sh, a modern cloud platform that simplifies containerized application deployment. By the end of this guide, you’ll have a fully functional Chartbrew instance ready for your team’s data visualization and analytics needs.
Why Deploy Chartbrew on Klutch.sh?
Klutch.sh provides an excellent platform for hosting Chartbrew:
- Docker-native deployment - Klutch.sh automatically detects and deploys Dockerized applications
- Real-time dashboards - Enable your team to create and share data visualizations
- Custom domains - Point your domain to your Chartbrew instance for team access
- Environment configuration - Manage secrets and configuration through the dashboard
- Data persistence - Attach volumes for dashboards, databases, and user data
- Scalability - Easily scale resources as your analytics needs grow
Prerequisites
Before deploying Chartbrew 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 Chartbrew deployment configuration
- A custom domain (optional but recommended for team access)
- Basic understanding of Docker and containerization
Deployment Steps
Create a Dockerfile
Create a
Dockerfilein the root of your repository to containerize Chartbrew:FROM node:20-alpine# Install system dependenciesRUN apk add --no-cache \build-base \python3 \git \curl \cairo-dev \jpeg-dev \pango-dev \giflib-dev# Set working directoryWORKDIR /app# Clone Chartbrew repositoryRUN git clone https://github.com/chartbrew/chartbrew.git . && \git checkout main# Install dependencies for client and serverRUN npm install# Build the client applicationWORKDIR /app/clientRUN npm run build# Move back to root directoryWORKDIR /app# Create necessary directoriesRUN mkdir -p /app/uploads /app/data /app/logs# Expose portsEXPOSE 3000 3210# Health checkHEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \CMD node -e "require('http').get('http://localhost:3000/health', (r) => {if (r.statusCode !== 200) throw new Error(r.statusCode)})"# Start the applicationCMD ["npm", "run", "start:prod"]Create Environment Configuration File
Create a
.env.examplefile to document required environment variables:# Chartbrew Environment Configuration# Application SettingsNODE_ENV=productionPORT=3000API_PORT=3210# Server ConfigurationHOST=0.0.0.0REACT_APP_API_HOST=https://example-app.klutch.sh# Database ConfigurationDB_HOST=localhostDB_PORT=5432DB_NAME=chartbrewDB_USER=chartbrewDB_PASSWORD=chartbrewpassDATABASE_URL=postgresql://chartbrew:chartbrewpass@localhost:5432/chartbrew# Session ManagementSESSION_SECRET=your-session-secret-change-in-productionSESSION_TIMEOUT=86400# JWT ConfigurationJWT_SECRET=your-jwt-secret-change-in-productionJWT_EXPIRATION=7d# File Upload ConfigurationMAX_FILE_SIZE=52428800UPLOAD_DIR=/app/uploads# Redis Configuration (for caching and sessions)REDIS_URL=redis://redis:6379REDIS_DB=0# Email Configuration (Optional)SMTP_HOST=smtp.gmail.comSMTP_PORT=587SMTP_USER=your-email@gmail.comSMTP_PASSWORD=your-app-passwordSMTP_FROM=noreply@example-app.klutch.sh# AuthenticationENABLE_SIGNUP=trueENABLE_LOCAL_AUTH=trueENABLE_OAUTH=false# Google OAuth (Optional)GOOGLE_CLIENT_ID=GOOGLE_CLIENT_SECRET=# Monitoring and AnalyticsSENTRY_DSN=LOG_LEVEL=info# API Rate LimitingRATE_LIMIT_WINDOW=900000RATE_LIMIT_MAX_REQUESTS=100# CORS SettingsCORS_ORIGIN=https://example-app.klutch.shCORS_CREDENTIALS=true# SecuritySECURE_COOKIES=trueHTTPS_REDIRECT=trueCreate Application Configuration File
Create a
config.jsfile for application-specific settings:module.exports = {app: {name: 'Chartbrew',version: '1.0.0',environment: process.env.NODE_ENV || 'production',port: process.env.PORT || 3000,apiPort: process.env.API_PORT || 3210,host: process.env.HOST || '0.0.0.0'},server: {apiHost: process.env.REACT_APP_API_HOST || 'http://localhost:3000',ssl: process.env.HTTPS_REDIRECT === 'true'},database: {host: process.env.DB_HOST,port: parseInt(process.env.DB_PORT) || 5432,user: process.env.DB_USER,password: process.env.DB_PASSWORD,database: process.env.DB_NAME,url: process.env.DATABASE_URL,pool: {min: 2,max: 10,idleTimeoutMillis: 30000,connectionTimeoutMillis: 2000}},redis: {url: process.env.REDIS_URL,db: parseInt(process.env.REDIS_DB) || 0,retryStrategy: (times) => Math.min(times * 50, 2000),maxRetriesPerRequest: null},session: {secret: process.env.SESSION_SECRET,timeout: parseInt(process.env.SESSION_TIMEOUT) || 86400,cookie: {secure: process.env.SECURE_COOKIES === 'true',httpOnly: true,sameSite: 'lax'}},jwt: {secret: process.env.JWT_SECRET,expiresIn: process.env.JWT_EXPIRATION || '7d',algorithm: 'HS256'},fileUpload: {maxFileSize: parseInt(process.env.MAX_FILE_SIZE) || 52428800,uploadDir: process.env.UPLOAD_DIR || '/app/uploads',allowedMimeTypes: ['application/json','text/csv','application/vnd.ms-excel','text/plain']},cors: {origin: process.env.CORS_ORIGIN || 'http://localhost:3000',credentials: process.env.CORS_CREDENTIALS === 'true'},auth: {enableSignup: process.env.ENABLE_SIGNUP === 'true',enableLocalAuth: process.env.ENABLE_LOCAL_AUTH === 'true',enableOAuth: process.env.ENABLE_OAUTH === 'true',googleClientId: process.env.GOOGLE_CLIENT_ID,googleClientSecret: process.env.GOOGLE_CLIENT_SECRET},email: {host: process.env.SMTP_HOST,port: parseInt(process.env.SMTP_PORT) || 587,user: process.env.SMTP_USER,password: process.env.SMTP_PASSWORD,from: process.env.SMTP_FROM || 'noreply@chartbrew.local'},rateLimit: {windowMs: parseInt(process.env.RATE_LIMIT_WINDOW) || 900000,max: parseInt(process.env.RATE_LIMIT_MAX_REQUESTS) || 100}};Create Database Initialization Script
Create an
init-db.shfile to set up the PostgreSQL database:#!/bin/bashset -eecho "Initializing Chartbrew database..."# Wait for PostgreSQL to be readyuntil PGPASSWORD=$DB_PASSWORD psql -h "$DB_HOST" -U "$DB_USER" -d "postgres" -c "\q"; doecho 'Waiting for postgres...'sleep 1doneecho "PostgreSQL is ready!"# Create database if it doesn't existPGPASSWORD=$DB_PASSWORD psql -h "$DB_HOST" -U "$DB_USER" -d "postgres" << EOFCREATE DATABASE $DB_NAME;EOFecho "Database created!"# Run migrationsecho "Running database migrations..."npm run migrateecho "Database initialization complete!"# Run seeders (optional)echo "Seeding initial data..."npm run seed || trueecho "Setup complete!"Make it executable:
Terminal window chmod +x init-db.shCreate Docker Compose for Local Development
Create a
docker-compose.ymlfile for local development and testing (not used for Klutch.sh deployment):version: '3.8'services:chartbrew:build: .container_name: chartbrew-devports:- "3000:3000"- "3210:3210"environment:- NODE_ENV=development- DB_HOST=db- DB_PORT=5432- DB_NAME=chartbrew- DB_USER=chartbrew- DB_PASSWORD=chartbrewpass- DATABASE_URL=postgresql://chartbrew:chartbrewpass@db:5432/chartbrew- REDIS_URL=redis://redis:6379- SESSION_SECRET=dev-secret-key-change-in-production- JWT_SECRET=dev-jwt-secret-change-in-production- REACT_APP_API_HOST=http://localhost:3000- CORS_ORIGIN=http://localhost:3000- ENABLE_SIGNUP=truedepends_on:- db- redisvolumes:- ./uploads:/app/uploads- ./src:/app/srcnetworks:- chartbrew-networkdb:image: postgres:16-alpinecontainer_name: chartbrew-dbenvironment:- POSTGRES_USER=chartbrew- POSTGRES_PASSWORD=chartbrewpass- POSTGRES_DB=chartbrewvolumes:- chartbrew_db_data:/var/lib/postgresql/datanetworks:- chartbrew-networkhealthcheck:test: ["CMD-SHELL", "pg_isready -U chartbrew"]interval: 10stimeout: 5sretries: 5redis:image: redis:7-alpinecontainer_name: chartbrew-redisnetworks:- chartbrew-networkhealthcheck:test: ["CMD", "redis-cli", "ping"]interval: 10stimeout: 5sretries: 5volumes:chartbrew_db_data:networks:chartbrew-network:driver: bridgeCreate .gitignore File
Create a
.gitignorefile to exclude sensitive data from version control:# Environment files.env.env.local.env.*.local# Node.jsnode_modules/npm-debug.logyarn-error.logpackage-lock.jsonyarn.lock# Build artifactsdist/build/.next/out/client/build/# Uploads and datauploads/data/public/uploads/# Database*.sqlite*.sqlite3# IDE.vscode/.idea/*.swp*.swo*~.DS_Store# Logslogs/*.log# Cache.cache/.turbo/Push Configuration to GitHub
Push your repository to GitHub with all configuration files:
Terminal window git add Dockerfile .env.example config.js init-db.sh \docker-compose.yml .gitignoregit commit -m "Initial Chartbrew deployment configuration for Klutch.sh"git push origin mainDeploy on Klutch.sh
- Navigate to klutch.sh/app and log in to your dashboard
- Click Create New App
- Connect your GitHub repository containing the Chartbrew deployment files (the Dockerfile will be automatically detected)
- Configure your application settings:
- Set your preferred app name
- Review the detected Dockerfile configuration
- Select a region for deployment
- Click Deploy to start the deployment process
- Monitor the deployment progress in the dashboard
- Wait for the deployment to complete and your app to become active
Configure Environment Variables
- In your app dashboard, navigate to Environment Variables section
- Add all required variables from your
.env.examplefile:DB_HOST: Your PostgreSQL hostnameDB_NAME: Database name (chartbrew)DB_USER: Database userDB_PASSWORD: Secure database passwordDATABASE_URL: Full PostgreSQL connection stringREDIS_URL: Your Redis connection stringJWT_SECRET: Generate a secure secret withopenssl rand -base64 32SESSION_SECRET: Generate a secure session secretREACT_APP_API_HOST: Set tohttps://example-app.klutch.sh(or your custom domain)CORS_ORIGIN: Set tohttps://example-app.klutch.sh(or your custom domain)
- Click Save to apply the environment variables
- Your application will automatically restart with the new configuration
Configure Traffic Routes
- In your app dashboard, navigate to Traffic settings
- Select HTTP as the traffic type
- Set the internal port to 3000 (Chartbrew frontend server default)
- Configure any custom domain settings if you have a domain
- Save your traffic configuration
Attach Persistent Volumes
Chartbrew requires persistent storage for uploaded files, databases, and application data.
- In your app dashboard, navigate to Volumes settings
- Click Add Volume to create storage for uploaded data:
- Enter mount path:
/app/uploads - Set volume size to 50GB (adjust based on expected file uploads)
- Click Attach to create and mount the volume
- Enter mount path:
- Click Add Volume again for application logs:
- Enter mount path:
/app/logs - Set volume size to 10GB
- Click Attach to create and mount the volume
- Enter mount path:
Your Chartbrew application will now be accessible at your configured domain or at
example-app.klutch.sh.
Initial Setup and Configuration
After deploying Chartbrew on Klutch.sh, complete the initial setup to prepare your data visualization platform.
Access Your Chartbrew Instance
- Navigate to
https://example-app.klutch.shin your web browser - You’ll see the Chartbrew login page
- Click Sign Up to create your first administrator account
- Enter your email and set a strong password
- Complete the email verification process
- Log in to your new Chartbrew instance
Configure Your Chartbrew Instance
Once logged in, configure these essential settings:
Workspace Settings:
- Set your workspace name and description
- Configure workspace branding and logo
- Set up user roles and permissions
- Enable team collaboration features
Data Source Connections:
- Add connections to your data sources (PostgreSQL, MySQL, MongoDB, APIs)
- Configure connection strings and credentials
- Test each connection to ensure accessibility
- Set up SSL/TLS for secure connections
Dashboard Creation:
- Create your first dashboard for testing
- Add various chart types (bar, line, pie, table, etc.)
- Connect charts to your data sources
- Configure chart filters and parameters
- Set up real-time data refresh intervals
Team Management:
- Invite team members to your workspace
- Assign roles (Owner, Editor, Viewer)
- Configure project access permissions
- Set up audit logging for compliance
Set Up User Authentication
To enable secure team collaboration:
- In your app dashboard, navigate to Authentication settings
- Configure email verification for new users
- Set password requirements and complexity rules
- Enable two-factor authentication for administrators
- Configure session timeout policies
Configure Backup Strategy
To protect your dashboards and configurations:
- In your app dashboard, navigate to Database settings
- Enable automated daily backups
- Set backup retention to at least 7 days
- Configure backup notifications to your email
- Test backup restoration procedures
Set Up Scheduled Reports (Optional)
For advanced analytics features:
- Configure email settings for report delivery
- Set up scheduled dashboard exports
- Configure report recipients and frequency
- Enable automated data snapshot exports
- Set up alert thresholds for anomaly detection
Dashboard Creation Best Practices
Organizing Your Dashboards
- Create separate dashboards for different departments or metrics
- Use consistent naming conventions for easy navigation
- Group related charts and metrics together
- Establish a dashboard hierarchy for complex setups
Data Connection Best Practices
- Use database views to simplify complex queries
- Implement proper indexing on frequently queried columns
- Use connection pooling for better performance
- Secure sensitive credentials using environment variables
Chart Configuration
- Choose appropriate chart types for your data
- Use meaningful labels and titles
- Configure color schemes for visual consistency
- Set up interactive filters for data exploration
- Enable drill-down capabilities for detailed analysis
Deployment Best Practices
Security Measures
- Keep Chartbrew 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
- Encrypt sensitive data connections
Monitoring and Maintenance
- Monitor disk usage for uploads and logs
- 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 query performance
Scaling Considerations
As your analytics needs grow:
- Increase volume sizes proactively before running out of space
- Monitor database performance and optimize queries
- Implement caching strategies for frequently accessed data
- Consider query optimization for large datasets
- Archive completed projects and old dashboards
Accessing Chartbrew
Once deployment is complete and configured:
- Users access Chartbrew at your configured domain or
example-app.klutch.sh - Users can create projects and dashboards
- Real-time data visualization and exploration
- Scheduled report generation and delivery
- Export functionality for dashboards and charts
- Admin panel for workspace 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 Redis is accessible
- Review application logs in the dashboard
- Verify client build completed successfully
Database Connection Errors
Steps to resolve:
- Verify DATABASE_URL environment variable format
- Ensure database is running and accessible
- Check database user credentials and permissions
- Verify network connectivity between services
- Test database connectivity from application logs
Dashboard Loading Issues
Possible solutions:
- Verify data source connections are active
- Check query performance and timeouts
- Review browser console for JavaScript errors
- Verify API responses with network inspection
- Check user permissions for data source access
Performance Issues
Optimization steps:
- Increase application memory allocation
- Enable Redis caching for frequently accessed data
- Optimize database queries and add indexes
- Implement pagination for large datasets
- Consider query result caching
Advanced Configuration
Environment Variables for Customization
You can customize Chartbrew behavior with these environment variables:
# Data Query SettingsQUERY_TIMEOUT=30000MAX_QUERY_SIZE=1000000
# Cache ConfigurationCACHE_TTL=3600CACHE_ENABLED=true
# Database Connection PoolDB_POOL_MIN=2DB_POOL_MAX=10DB_IDLE_TIMEOUT=30000
# File Upload RestrictionsMAX_FILE_SIZE=52428800MAX_CONCURRENT_UPLOADS=5
# Feature FlagsENABLE_REAL_TIME_CHARTS=trueENABLE_EXPORTS=trueENABLE_SCHEDULED_REPORTS=trueENABLE_ANOMALY_DETECTION=false
# Performance TuningREDIS_MAX_RETRIES=3DB_QUERY_TIMEOUT=30000API_RATE_LIMIT=100Custom Domain Setup
To use a custom domain with your Chartbrew instance:
- In your Klutch.sh dashboard, navigate to Domains
- Add your custom domain
- Follow the DNS configuration instructions
- Update your environment variables with the new domain:
REACT_APP_API_HOST=https://your-domain.comCORS_ORIGIN=https://your-domain.com
- Save and redeploy your application
Integrating External Data Sources
To add connections to various databases:
- In Chartbrew dashboard, navigate to Data Sources
- Click Add New Data Source
- Select your database type (PostgreSQL, MySQL, MongoDB, etc.)
- Enter connection credentials and test connectivity
- Configure query limits and timeout settings
- Save the data source for use in dashboards
Additional Resources
Learn more about Chartbrew and Klutch.sh:
- Chartbrew GitHub Repository - Source code and contribution guidelines
- Chartbrew Documentation - Comprehensive platform documentation
- Chartbrew Issue Tracker - Report bugs and request features
- Klutch.sh Official Website - Learn more about the deployment platform
- Klutch.sh Documentation - Platform guides and API reference
Conclusion
You now have a fully functional Chartbrew instance running on Klutch.sh! Your collaborative data visualization and analytics platform is ready for your team to explore and analyze data.
With the robust infrastructure provided by Klutch.sh and the powerful features of Chartbrew, you can create compelling dashboards and gain insights from your data. Remember to:
- Keep your application updated with the latest Chartbrew releases
- Monitor system performance and storage usage regularly
- Maintain regular backups of your dashboards and configurations
- Follow security best practices for data access
- Scale your infrastructure as your data volume grows
For additional support or questions about deploying Chartbrew on Klutch.sh, refer to the documentation and community resources linked above.