Ruby: Creating a Makefile for Stackhero deployment
This documentation is part of the Deploy to production guide. You can view the complete guide here: How to deploy your Ruby code to production in just a few minutes.
👋 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!
To let Stackhero know how to run your application, you need to create a Makefile at the root of your project. This file defines the commands Stackhero will use during deployment.
If you’re new to Makefiles or the
makecommand, don’t worry—the steps below will guide you through everything you need.
Create a Makefile with the following content:
run:
rake assets:precompile
rake db:migrate RAILS_ENV=production
RAILS_ENV=production bundle exec puma -C config/puma.rb
Here’s what’s happening in this Makefile:
- The
runrule is required—Stackhero will automatically execute it during deployment. Make sure to keep this name, as it serves as the entry point. - The commands use
rakeandbundle, but you can adjust them as needed for your application. - Make sure each command line starts with a tab character, not spaces. If you see an error like
*** missing separator, double-check this formatting.
In the example above, deployment will:
- Precompile assets like JavaScript and CSS into the
public/assetsdirectory. - Run any necessary database migrations.
- Start the Puma server to serve your application.