Ruby: Development platform

Set up your development environment for a smooth and efficient workflow

👋 Welcome to the Stackhero documentation!

Stackhero provides a ready-to-use Ruby cloud solution offering a range of advantages, including:

  • Deploy your application within seconds using a simple git push.
  • Use your own domain name and benefit from the automatic configuration of HTTPS certificates for enhanced security.
  • Take advantage of automatic backups, one-click updates, and clear, transparent, and predictable pricing.
  • Enjoy optimal performance and enhanced security thanks to a private, dedicated infrastructure.

Save time and make your life easier: 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 you how to start a new Ruby project.

You can run Ruby projects in two ways: locally on your computer or in the cloud using a ready-to-code service such as Code-Hero. Each method has its advantages, so you can select the one that best suits your workflow.

Local development is ideal if you want to work offline. Everything is installed on your own machine, but setup and maintenance take more time, especially if you are new to programming or require several tools. You are responsible for updates, backups, and security, and you are limited by your computer’s resources. Accessing your work from another device can also be challenging.

Remote development with Code-Hero provides you with a preconfigured environment that is ready within seconds. It includes an easy-to-use fork of Visual Studio Code and native support for tools such as Git, Docker, Ruby, Rails, and more. Cloud servers generally offer more CPU, RAM, and storage than local machines. Since everything runs in your browser, you can work from any device or operating system.

Integrated tools like Docker and Traefik make it easy to use TLS and real domains (for example, https://your-project.you.your-company.dev). This closely replicates a real production environment, allowing you to test webhooks (from GitHub, Slack, Stripe, etc.), handle CORS, and develop against production-like services without additional configuration.

Choose the option that matches your workflow, skills, and project requirements:

  1. Local development:

    • ✅ Works offline: No internet connection required
    • ❌ Limited resources: Restricted by your computer’s performance
    • ❌ Manual setup: You install and configure tools yourself
    • ❌ Ongoing maintenance: Updates and backups are your responsibility
  2. Remote development (on Code-Hero):

    • ✅ Instantly ready: 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

A remote environment removes manual setup and speeds up your first commit. Code-Hero runs on high-performance servers, allowing you to focus on building features rather than configuring tools. You get a fresh, ready-to-code workspace for each project, and setup takes just a few seconds.

If you are using Code-Hero, you can skip ahead to Creating a Ruby project. For local development, continue reading.

A local Ruby environment gives you full control, but requires a few extra steps. You install Ruby, dependencies, and tools yourself.

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 avoids conflicts between tools.

To get started, install asdf by following the official installation guide.

Once installed, you can check that asdf is working by running:

asdf version

If you see a version number, asdf is correctly installed.

To install the latest version of Ruby:

asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf install ruby latest
asdf global ruby latest

Check that Ruby is working:

ruby --version

This confirms Ruby is ready to use.

Once Ruby is installed:

asdf install ruby latest \
  && asdf global ruby latest

Install Rails:

gem install rails

Create your application (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 screenRuby on Rails welcome screen

These steps provide you with a clean starting point for your project, and asdf ensures you always use the correct 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 such as GitHub, GitLab, or Bitbucket. Stackhero offers a GitLab cloud service running on dedicated infrastructure, providing you with privacy and security in Europe or the USA.

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 exampleHosts configurations example

Then start the server, binding to all network interfaces:

bin/rails server -b 0.0.0.0