Ruby: Creating a Makefile for Stackhero deployment

This documentation is part of the Deploy to production guide. You can view the complete guide here: Deploy Ruby code to production in minutes with Stackhero.

👋 Welcome to the Stackhero documentation!

Stackhero provides a ready-to-use Ruby cloud solution that delivers numerous advantages, including:

  • Deploy your application in just a few seconds with a simple git push.
  • Use your own domain name and take advantage of automatic configuration of HTTPS certificates for enhanced security.
  • Benefit from automatic backups, one-click updates, and clear, transparent, and predictable pricing.
  • Enjoy optimal performance and enhanced security thanks to a private, dedicated VM.

Save time and make your life easier: 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’re new to Makefiles or the make command, 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:

  1. The run rule is required. Stackhero looks for this rule as the entry point during deployment. Keep this rule name.
  2. The example uses rake and bundle, but you can adjust these commands to fit your application.
  3. Each command line must start with a tab character, not spaces. If you see a *** missing separator error, check for tabs.

In the example above, deployment will:

  1. Precompile assets such as JavaScript and CSS into the public/assets directory.
  2. Run database migrations.
  3. Start the Puma server to serve your application.