logo

Improved the DX of Ruby

New features to enhance the DX for Ruby projects.

PanPan

We are excited to announce several new features to enhance the deployment experience for Ruby applications on Zeabur. These updates provide greater flexibility and control over your Ruby service setup, allowing for a smoother and more customized deployment process.

Build command

First, you can define the command used to initialize your Ruby service during the build process with the environment variable, ZBPACK_BUILD_COMMAND:

ZBPACK_BUILD_COMMAND="bash scripts/build-ruby-assets.sh"

or build_command in zbpack.json:

{
  "build_command": "bash scripts/build-ruby-assets.sh"
}

It will be run at the final stage before completing the build of the service.

Start command

We also allow user to specify the command that will be used to start your Ruby service by setting the environment variable ZBPACK_START_COMMAND or start_command in zbpack.json:

ZBPACK_START_COMMAND="bundle exec puma -C config/puma.rb"

Or in zbpack.json:

{
  "start_command": "bundle exec puma -C config/puma.rb"
}

Note that this option overrides the ZBPACK_RUBY_ENTRY option.

Set the Ruby version to use

By setting the environment variable ZBPACK_RUBY_VERSION or ruby.version in zbpack.json, you can customize the version of Ruby used for your service.

ZBPACK_RUBY_VERSION="3.0.2"

Or in zbpack.json:

{
  "ruby": {
    "version": "3.0.2"
  }
}

Set the Entry point of your Ruby project

By setting the environment variable ZBPACK_RUBY_ENTRY or ruby.entry in zbpack.json, you can override the default entry point of your service.

ZBPACK_RUBY_ENTRY="app.rb"

Or in zbpack.json:

{
  "ruby": {
    "version": "3.0.2"
  }
}

This is the simplified option of ZBPACK_START_COMMAND that allows you to specify the Ruby file to run:

ruby [the-entrypoint-to-run.rb]

If you have set ZBPACK_START_COMMAND, we pick up ZBPACK_START_COMMAND instead of this option.

Example zbpack.json Configuration

Here is an example of how you can configure these settings in your zbpack.json file:

{
  "build_command": "bash scripts/build-ruby-assets.sh",
  "start_command": "bundle exec puma -C config/puma.rb",
  "ruby": {
    "version": "3.0.2"
  }
}

Or using entry instead of start_command:

{
  "build_command": "bash scripts/build-ruby-assets.sh",
  "ruby": {
    "version": "3.0.2"
  },
  "entry": "app.rb"
}

Summary

These new configurations empower you to tailor the build and runtime environments of your Ruby applications precisely to your needs. By leveraging ZBPACK_BUILD_COMMAND, ZBPACK_START_COMMAND, ZBPACK_RUBY_VERSION, and ZBPACK_RUBY_ENTRY, you can ensure a more predictable and streamlined deployment process on Zeabur.

We hope these enhancements will improve your deployment experience. Happy coding!