Ruby: Development platform
Set up your development environment for a smooth and efficient workflow
👋 Welcome to the Stackhero documentation!
Stackhero offers a ready-to-use Ruby cloud solution that provides a host of benefits, including:
- Deploy your application in seconds with a simple
git push.- Use your own domain name and benefit from the automatic configuration of HTTPS certificates for enhanced security.
- Enjoy peace of mind with automatic backups, one-click updates, and straightforward, transparent, and predictable pricing.
- Get optimal performance and robust security thanks to a private, dedicated infrastructure.
Save time and simplify your life: it only takes 5 minutes to try Stackhero's Ruby cloud hosting solution!
A well-prepared development platform makes your work faster, more enjoyable, and more reliable.
This guide helps you choose between local and remote development, walks you through installing Ruby with asdf, and shows how to start a new Ruby project.
Choosing your development environment: local or remote
You can run Ruby projects in two ways: with a local environment on your computer or in the cloud using a ready-to-code service like Code-Hero. Each approach has strengths, so you can pick what fits your workflow best.
Local development is ideal if you prefer working offline. It puts everything on your own machine, but setup and maintenance require more time, especially if you are new to programming or need several tools. You handle updates, backups, and security, and you are limited by your computer's resources. Accessing your work from another device can also be a challenge.
Remote development with Code-Hero gives you a preconfigured environment that is ready within seconds. It includes an easy-to-use Visual Studio Code fork and built-in support for tools like Git, Docker, Ruby, Rails, and more. Cloud servers typically offer more CPU, RAM, and storage than local machines. Since everything runs in the browser, you can work from any device or operating system.
Integrated tools like Docker and Traefik make it simple to use TLS and real domains (for example, https://your-project.you.your-company.dev). This closely matches real production setups, so you can test webhooks (from GitHub, Slack, Stripe, etc.), handle CORS, and develop against live-like services without extra configuration.
Choose the option that matches your workflow, skills, and project needs:
-
Local development:
- ✅ Works offline: No internet required
- ❌ Limited resources: Bound by your computer's performance
- ❌ Manual setup: You install and configure tools yourself
- ❌ Ongoing maintenance: Updates and backups are your responsibility
-
Remote development (on Code-Hero):
- ✅ Ready instantly: All tools are installed and configured
- ✅ High performance: Uses powerful, dedicated cloud servers
- ✅ Work anywhere: Access your environment from any device
- ✅ Live integrations: Built-in HTTPS domains for webhooks and third-party services
- ❌ Internet required: Needs a network connection
Developing in Ruby: remote setup
A remote environment removes manual setup and speeds up your first commit. Code-Hero runs on high-performance servers, so you can focus on building features, not configuring tools. You get a fresh, ready-to-code workspace with every project, and setup takes seconds.
If you are using Code-Hero, you can skip to Creating a Ruby project. For local development, read on.
Developing in Ruby: local setup
A local Ruby environment gives you full control, but requires a few extra steps. You install Ruby, dependencies, and tools yourself.
Installing Ruby with asdf
asdf is a flexible version manager for multiple languages including Ruby, Node.js, Python, and PHP. It makes it easy to keep projects on different versions and prevents conflicts between tools.
To get started, install asdf by following the official installation guide.
Once installed, you can verify asdf is working by running:
asdf version
If you see a version number, asdf is set up correctly.
To install the latest Ruby version:
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf install ruby latest
asdf global ruby latest
Check Ruby is working:
ruby --version
This confirms Ruby is ready for use.
Creating a Ruby project
Once Ruby is installed:
asdf install ruby latest \
&& asdf global ruby latest
Install Rails:
gem install rails
Create your app (replace my_app with your project name):
rails new my_app
cd my_app
asdf local ruby latest
Start the Rails server:
bin/rails server
Ruby on Rails welcome screen
These steps give you a clean starting point for your project, and asdf ensures you always use the right Ruby version.
By default, Rails creates a local Git repository for your project, but it is not connected to any remote hosting service.
For reliable version control and backups, you can connect your repository to a service like GitHub, GitLab, or Bitbucket. Stackhero offers a GitLab cloud service that runs on dedicated infrastructure, giving you privacy and security in Europe or the USA.
Special setup for Code-Hero
If you are working in Stackhero Code-Hero, adjust your Rails configuration for remote access. Open config/environments/development.rb and add this line just before the final end, replacing <XXXXXX>.stackhero-network.com with your Code-Hero server's hostname:
config.hosts << "<XXXXXX>.stackhero-network.com"
Hosts configurations example
Then start the server, binding to all network interfaces:
bin/rails server -b 0.0.0.0