This README outlines the steps to set up and use a Buildkite pipeline for testing a Rails application within a Docker environment. This setup is intended for the loftwah
organization's test pipeline on Buildkite, running on the latest Ubuntu on AWS and WSL2 locally.
Before proceeding, ensure you have the following:
- An account on Buildkite linked to the
loftwah
organization. - A starter pipeline created on Buildkite.
- Docker and Docker Compose installed on your system.
- The latest version of Ubuntu running on AWS or WSL2 for local development.
First, install and configure the Buildkite agent on your Ubuntu system. This agent will handle job execution for your pipeline.
sudo sh -c 'echo "deb https://apt.buildkite.com/buildkite-agent stable main" > /etc/apt/sources.list.d/buildkite-agent.list'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 32A37959C2FA5C3C99EFBC32A79206696452D198
sudo apt-get update && sudo apt-get install -y buildkite-agent
Replace your-agent-token-here
with your actual Buildkite agent token.
sudo sed -i "s/xxx/your-agent-token-here/g" /etc/buildkite-agent/buildkite-agent.cfg
For Ubuntu 20.04 and above:
sudo systemctl enable buildkite-agent && sudo systemctl start buildkite-agent
Pipeline needs to be set up on Buildkite before running it. The pipeline configuration file is located at .buildkite/pipeline.yml
. This file contains the steps and commands to be executed by the Buildkite agent.
Commit and push your changes to your repository to trigger a build in Buildkite. Monitor the build's progress and output directly from the Buildkite dashboard.
To view the Buildkite agent's logs on your system:
journalctl -f -u buildkite-agent
To run the pipeline locally, use the following command:
curl -H "Authorization: Bearer bkua_thisisademokey" "https://api.buildkite.com/v2/organizations/loftwah/pipelines/rails-demo/builds" \
-X "POST" \
-F "commit=HEAD" \
-F "branch=main" \
-F "message=First build :rocket:"
This setup provides a basic continuous integration pipeline for a Rails application using Docker and Buildkite. Adjust the Docker and pipeline configurations according to your project's requirements.
For more detailed information on Buildkite plugins, Docker setup, or Rails configurations, refer to their respective documentation.