Ruby: Creating a Makefile for Stackhero deployment
This documentation is part of the Deploy to production guide. View the full guide here: Deploy Ruby code to production in minutes with Stackhero.
👋 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!
To tell Stackhero how to run your application, add a Makefile at the root of your project. This file defines the commands Stackhero will use during deployment.
If you are new to Makefiles or the
makecommand, the steps below will guide you through creating a working Makefile.
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
What this Makefile does:
- The
runrule is required. Stackhero looks for this rule as the entry point during deployment. Keep this rule name. - The example uses
rakeandbundle, but you can adjust these commands to fit your application. - Each command line must start with a tab character, not spaces. If you see a
*** missing separatorerror, check for tabs.
In the example above, deployment will:
- Precompile assets such as JavaScript and CSS into the
public/assetsdirectory. - Run database migrations.
- Start the Puma server to serve your application.