Ruby on Rails is a popular web application framework that you can use to build dynamic websites on your hosting account. While the classic Ruby on Rails interface has been deprecated in modern control panels, you can still deploy Rails applications through alternative methods that offer better performance and flexibility.
This guide explains how to set up and deploy Ruby on Rails applications on your OBHost hosting account using current best practices.
What Happened to the Ruby on Rails Interface?
The traditional Ruby on Rails interface was deprecated in cPanel version 66. This change was made to encourage more modern and flexible deployment methods that give you greater control over your application environment. Instead of the old interface, you now create Ruby applications manually and register them through the Application Manager.
How to Deploy Ruby on Rails Applications (Current Method)
To create a Ruby on Rails application on your hosting account today, follow these steps:
- Request Ruby Installation: Contact your hosting provider to ensure Ruby is installed on your server. The system requires specific Apache modules (mod_env) and Ruby development packages to run Rails applications properly.
- Create Your Rails Application: Use SSH access to your server to create a new Rails application. Navigate to your desired directory and run the Rails generator commands to scaffold your application structure.
- Configure Your Application: Set up your database connections, environment variables, and application settings according to your project requirements.
- Register the Application: Use the Application Manager interface in your control panel (Software section) to register your Ruby application. This tells the server how to route requests to your Rails app.
- Deploy Your Code: Upload your application files to the specified directory on your server, ensuring proper file permissions are set.
Important Considerations for Rails Deployment
Application Path Security
Never place your Rails application directly in your public_html directory. Doing so exposes your source code, configuration files, and sensitive credentials to anyone on the internet. Instead, create your application in a private directory and configure only the public folder to be web-accessible.
Environment Configuration
Choose the appropriate Rails environment for your needs:
- Development: Use this for testing and debugging on your local machine or staging server. It provides detailed error messages and automatic code reloading.
- Production: Use this for your live website. It optimizes performance, enables caching, and hides detailed error messages from visitors.
- Test: Use this environment specifically for running automated tests.
Server Requirements
Ruby on Rails applications run on their own application server (like Puma or Passenger), which operates differently from traditional PHP applications. Your hosting environment must support persistent application processes and proxy connections from the web server to your Rails server.
Alternative Deployment Options
If you need more control over your Rails environment, consider these alternatives:
- Git Integration: Use Git-based deployment workflows to push code changes directly to your server.
- Custom Application Servers: Configure Passenger, Puma, or Unicorn according to your specific performance requirements.
- Containerization: Deploy your Rails application using Docker containers for better isolation and consistency across environments.
Troubleshooting Common Issues
Application Won't Start
If your Rails application fails to start, check these common issues:
- Verify that all required gems are installed by running bundle install
- Ensure database credentials are correct in your database.yml file
- Check file permissions on your application directory
- Review server error logs for specific error messages
Performance Problems
Rails applications can be resource-intensive. If you experience slow performance:
- Enable Rails caching in production mode
- Optimize database queries using Rails query analysis tools
- Consider upgrading to a hosting plan with more resources
- Implement background job processing for time-consuming tasks
Best Practices for Rails Hosting
Follow these recommendations to ensure your Rails application runs smoothly:
- Always use the production environment for live websites
- Keep your Rails version and gems updated for security patches
- Use environment variables for sensitive configuration data
- Implement regular database backups
- Monitor application performance and error rates
- Use a CDN for static assets to improve load times
Frequently Asked Questions
Can I Run Multiple Rails Applications on One Account?
Yes, you can run multiple Ruby on Rails applications on a single hosting account. Each application should be registered separately in the Application Manager with its own unique port or subdomain configuration. Make sure your hosting plan has sufficient resources to handle multiple concurrent applications.
What Ruby Versions Are Supported?
The specific Ruby versions available depend on your hosting provider's configuration. Most modern hosting environments support Ruby 2.4 and later versions. Contact your hosting provider to confirm which Ruby versions are installed and available for your applications. You may be able to request installation of specific versions if needed.
Do I Need SSH Access to Deploy Rails Applications?
While SSH access makes Rails deployment significantly easier, it's not always required. You can upload application files via FTP and use the control panel to manage basic configuration. However, SSH access is highly recommended because it allows you to run Rails commands, install gems, manage your database, and troubleshoot issues much more effectively.
How Do I Update My Rails Application After Initial Deployment?
To update your Rails application, upload your new code files to the server (via SSH, FTP, or Git), run bundle install to update dependencies, run any pending database migrations, and then restart your application server through the Application Manager or SSH. Always test updates in a development environment before applying them to your production site.
If you need assistance deploying Ruby on Rails applications or have questions about your hosting environment, our support team is available 24/7. Visit our contact page or email us at support@obhost.org for technical support.