A barebones Ruby on Rails app, ready to deploy to Build.
Use it as a starting point for your own app, or as a sandbox to learn the Build deployment workflow: buildpacks, Procfiles, config vars, and automatic deploys.
.
├── Procfile # Tells Build how to start the web process
├── config/routes.rb # Routes — pages and API endpoints
├── app/controllers/pages_controller.rb # Landing page controller
├── app/controllers/api_controller.rb # JSON API endpoints
├── app/views/pages/index.html.erb # Landing page template
├── app/assets/stylesheets/ # Static assets
├── .env.example # Sample local config (copy to .env)
└── Dockerfile # Optional: for the "dockerfile" stack
No database is configured — this app skips Active Record to stay minimal.
First, get your own copy of this template: click Use this template on buildio/rails-getting-started, or fork it, into your own GitHub account.
You'll need Ruby 4.0 or later and Bundler.
git clone https://github.com/<your-org>/rails-getting-started.git
cd rails-getting-started
bundle install
cp .env.example .env
bin/rails serverOpen http://localhost:3000. Rails reloads code on each request in development, so edits show up on refresh.
Build deploys directly from GitHub. If you haven't already, push the repo you cloned in Run it locally to your own GitHub account:
git push -u origin mainThen, in the Build dashboard:
- Create an app — click New + → New App, give it a name, and pick a region.
- Check the stack — in Settings, the default stack with the Ruby buildpack auto-detected from
Gemfileworks out of the box. (Optionally addhttps://github.com/heroku/heroku-buildpack-rubyexplicitly.) - Connect GitHub — in Deploy → Connection, select your organisation and connect this repository.
- Set the secret — in Settings → Config Vars, add
SECRET_KEY_BASE(generate one withbin/rails secret). Skip this if you deploy via the Deploy to Build button —app.jsongenerates it for you. - Deploy — in Deploy → Manual Deploy, choose
mainand click Deploy Branch. Watch the build run, then click Go on the Overview tab to open your live app.
For continuous deployment, enable Automatic Deploys on the Deploy tab — every push to main then triggers a new build.
The landing page greeting is read from the GREETING environment variable. Change it with the Build CLI — no redeploy needed:
brew install buildio/cli/bld
bld login
bld config:set GREETING="こんにちは, Build!" -a <your-app>Refresh the page or hit the API:
curl https://<your-app>.build.io/api/greeting- Procfile — declares the web process:
web: bundle exec puma -C config/puma.rb. Build's router sends HTTP traffic only towebprocesses. $PORT— Build injects the port at runtime;config/puma.rbreadsENV["PORT"]. Never hardcode a port.- Config vars — settings live in environment variables, not in code (twelve-factor style). Locally,
dotenv-railsloads them from.env, which stays out of git. SECRET_KEY_BASE— Rails needs this in production to sign cookies and sessions. On Build it's a config var;app.jsongenerates it automatically for one-click deploys.
Prefer Docker? A Dockerfile is included. In Settings → Stack, select dockerfile, then deploy as normal — Build builds the image and runs it instead of using buildpacks.
| Path | Description |
|---|---|
/ |
Landing page with runtime info |
/api/status |
JSON health/uptime endpoint |
/api/greeting |
Returns the GREETING config var |
/up |
Rails' built-in health check |
- Uncomment the sample route in
config/routes.rband the matching action inapp/controllers/pages_controller.rb, then redeploy. - Add a
worker:process to the Procfile for background jobs. - Attach a database from the dashboard and re-enable Active Record — see Databases & Add-ons.