Docs menu
Ruby on Primcloud
How Primcloud detects a Ruby app, installs gems with Bundler, runs your asset build, and picks the default web process.
On this page
Detection#
Primcloud builds your app as Ruby when the root of your repo has a Gemfile.lock. A Gemfile alone isn't enough; commit the lockfile.
What else is in the repo decides what else the build installs:
package.jsonoryarn.lockat the root: Node.js is installed too, for asset tools likejsbundling-railsandcssbundling-rails.- A Bun lockfile (
bun.lockorbun.lockb) besidepackage.json: Bun installs your JavaScript dependencies withbun install --frozen-lockfileand is on thePATHwhenrake assets:precompileruns. YourProcfile, or thewebprocess detected from your gems, still starts the app. See Bun package managers. - JRuby in the lockfile: a JDK is installed.
The build#
Ruby is installed at the version in the RUBY VERSION block of Gemfile.lock:
RUBY VERSION
ruby 3.3.9p0
Without that block you get the default Ruby, which changes over time, so set it. See Runtime versions.
Bundler is installed at the version in the BUNDLED WITH block, or a default version without one.
Gems are installed with bundle install, skipping the development and test groups. It fails if Gemfile.lock doesn't match Gemfile; see Package managers.
Rake tasks. After bundle install, the build lists your rake tasks with rake -P, and fails if that fails. An app with no Rakefile and no rake in its lockfile skips this.
rake assets:precompileruns if you define it, unless a.sprockets-manifest-*.jsonormanifest-*.jsonis committed underpublic/assets.rake assets:cleanruns after it if you define it, and also keeps compiled assets between builds, so later asset builds are faster.
Ruby, Bundler, and your gems are reused from the previous build when they haven't changed, and gems no longer in your lockfile are removed.
The web process#
A Procfile decides your processes; see Formations. Without one, your gems decide the web process:
-
Rails (any app whose lockfile includes
railties):Terminalbin/rails server --binding "[::]" --port "$PORT" --environment "$RAILS_ENV" -
Rack (lockfile includes
rack,config.rupresent at the root):Terminalbundle exec rackup --host "[::]" --port "$PORT" -
Neither: no
webprocess; declare one in aProcfile.
Workers and other processes always need a Procfile.
Port. The default commands listen on $PORT. A command of your own must too. Only web gets a PORT.
Environment. Every process gets these defaults, plus your secrets, which take precedence:
| Variable | Value | Purpose |
|---|---|---|
RACK_ENV |
production |
Read by Rack-based apps to select environment. |
RAILS_ENV |
production |
Read by Rails to select environment. |
RAILS_LOG_TO_STDOUT |
enabled |
Sends Rails logs to stdout so they land in the Logs page. |
RAILS_SERVE_STATIC_FILES |
enabled |
Enables ActionDispatch::Static so Puma serves files from public/. |
SECRET_KEY_BASE |
Generated once for your app | Rails' secret key. Set your own to rotate it. |
MALLOC_ARENA_MAX |
2 |
Reduces glibc memory arena count for a smaller footprint on multi-threaded Ruby. |
DISABLE_SPRING |
1 |
Disables the Spring preloader in production. |
PUMA_PERSISTENT_TIMEOUT |
95 |
Keep-alive idle timeout for Puma. |
JRUBY_OPTS |
-Xcompile.invokedynamic=false |
JRuby-only tuning; harmless on MRI. |
PORT |
Assigned by Primcloud | Set on web process types only. |
PATH |
With <app>/bin, gem binstubs, and the Ruby binary prepended |
So bundle exec, rails, and app binstubs are on PATH. |
<app>/bin sits ahead of gem-installed binstubs on PATH, so a committed bin/rails overrides the one Bundler would generate.