Building RR with a custom plugin
Last updated
Was this helpful?
Last updated
Was this helpful?
Developers can take advantage of the customization options available with RoadRunner to create a server optimized for their particular project.
This can include:
Adding custom plugins.
Forking existing ones to make changes.
Building a lightweight server with only the necessary plugins.
We created a tool called Velox that lets developers build a RoadRunner server binary. It uses a configuration file to determine which plugins and repositories are required for building a RoadRunner server binary.
The configuration file is written in TOML format and contains a list of repositories to add to the build. For each repository, you can specify the owner and version. You can also add private repositories from GitHub or Gitlab, and authenticate with access tokens.
Here is an example of a configuration file:
When using official plugins for RoadRunner, it is recommended avoid using the master
branch as it may contain
unstable code. Instead, use tags with the same major version (e.g., logger:v4.x.x
+ amqp:v4.x.x
, but
not logger:v4.0.0
+ amqp:v3.0.5
). Please note that the currently supported plugin version is v5.x.x
, and the
supported RoadRunner version is >=v2024.2.x
.
Failure to follow these guidelines may result in compatibility issues and other problems. Please pay close attention to your configuration file to ensure proper use of plugins.
You can use environment variables in the configuration file. This is useful when you want to keep the configuration file
in the repository, but you don't want to expose your tokens or just want to pass them as arguments to the vx
command.
Here is the list of environment variables from the example above:
${GL_TOKEN}
GitLab token.
${RT_TOKEN}
GitHub token.
${VERSION}
RR version to write into the binary (will be shown with ./rr --version
).
${TIME}
Build time (will be shown with ./rr --version
).
ref
Tag, commit hash or branch name.
owner
Repository owner (might be the user or organization).
repository
Repository name.
folder
If the plugin is in some folder in your repository, you may specify it via this configuration option.
For example: cache = { ref = "v1.6.18", owner = "darkweak", repository = "souin", folder="plugins/roadrunner" }
replace
Exclude your organization package prefix from the Go environment variables:
Using the Docker image simplifies the build process by automatically building the RoadRunner binary and storing it in
the /usr/bin/
folder. This eliminates the need to install Golang or other dependencies on your computer. Once the
build is complete, Docker will automatically start the RoadRunner server.
Here is an example of Dockerfile:
v2023.x.x
updateAt the moment only GitHub and GitLab repositories are supported.
You can find the latest version of the example configuration file in the .
Go.mod .
Make sure the ssh-agent
is running and the ssh key has been
added:
To download Velox and build an application server you need on you local server.
To build the application server, you need to download Velox binary
the and unpack it to your PATH
.
To build an application server you need on you local server.