Ruby: Creating a Ruby project
This documentation is part of the Development platform guide. You can view the complete guide here: Prepare your development platform to be pleasant and efficient.
👋 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 and dedicated VM.
Save time and simplify your life: it only takes 5 minutes to try Stackhero's Ruby cloud hosting solution!
Creating a Ruby project is a straightforward process.
First, install the latest version of Ruby with:
asdf install ruby latest \
&& asdf global ruby latest
Then, install Rails. Since Rails is available as a Gem, you can easily install it by running:
gem install rails
Finally, create your application (here named my_app) and set the Ruby version using these commands:
rails new my_app
cd my_app
asdf local ruby latest
To start the Rails server, run:
bin/rails server
Ruby on Rails welcome screen
These steps set the foundation for your Ruby project and ensure that the correct Ruby version is used.
It's worth noting that a local Git repository for your Ruby project is created by default, but it is not yet connected to a remote repository hosting service.
To ensure proper version control and backup, consider connecting your project to a remote repository on your preferred platform, such as GitLab, GitHub, or Bitbucket.
If you are looking for a Git repository hosting service, Stackhero offers a GitLab cloud service that can be set up in just 2 minutes. It runs on a private and dedicated VM for maximum confidentiality and security and is available in Europe or the USA depending on your choice.
Special case with Code-Hero
If you are using an online development solution such as Stackhero Code-Hero, you will need to adjust your configuration. Edit the file config/environments/development.rb and add the following line just before the final end keyword, replacing <XXXXXX>.stackhero-network.com with your server's hostname:
config.hosts << "<XXXXXX>.stackhero-network.com"
Hosts configurations example
After making this change, start the Rails server using:
bin/rails server -b 0.0.0.0