Set up BuildWise CT Server in Production Mode

Configure a MySQL database for BuildWise Production Mode

Courtney Zhan
3 min readAug 2, 2024

This article is a modified excerpt from my father’s book: “Practical Continuous Testing: make Agile/DevOps real

In my previous article, “Set up BuildWise CT Server Step by Step,” I explained the steps to install and set up a BuildWise CT server on Windows. We start the server with the command start-demo.bat, which suggests it is for demonstration purposes. After a few successful runs, you should switch to production mode. This article explains how to do that.

BuildWise Server’s Demo and Production Mode

The good news is that the actual BuildWise server setup is already complete if you have done some runs in BuildWise Demo mode; you just need to set up and configure a proper SQL database.

A BuildWise server in demo mode runs on a single-file-based SQLite3 database, which is not optimal for production use. For production use, we suggest using MySQL (or a variant such as MariaDB), “the world’s most popular open-source database”.

A quick summary of the differences between BuildWise Demo and Production.

BuildWise Server Demo:

  1. A bit slower than the Production mode.
  2. File-based database, under db folder, named buildwise_demo.db
    - does not support a big number of buildwise agents (might get file-locked error)
  3. Default working folder: c:\agileway\.tmp\.buildwise(Windows)

BuildWise Server Production:

  1. Faster.
  2. MySQL database
    - supporting high concurrency, which is a must when you have multiple build agents.
    - easier to backup and restore (standard procedure for any SQL servers)
    - easier during the upgrade. In demo mode, you need to copy the database file over.
  3. Default working folder: c:\agileway\.buildwise

Again, there is no code difference here.

Set up BuildWise Server for Production Use

Firstly, here is a database configuration of the BuildWise server, in the config/database.yml file:

demo:
adapter: sqlite3
database: db/buildwise_demo.db
timeout: 15000

production:
adapter: mysql2
encoding: utf8
database: buildwise_production
host: 127.0.0.1
pool: 10
username: root
password: buildwise

You need to configure a MySQL database, as in the above configuration. MySQL installation is quite easy, and most back-end software engineers have done it before. Hence, I will just be brief.

1. Install MySQL Community Server

Download and install the free MySQL Community Server. Make sure you note down the password you set for the root user.

Tip: During MySQL setup, select ‘Use Legacy Authentication Method’.

2. Verify mysql2 gem

mysql2 is the standard Ruby library to work with a MySQL database. Run gem list mysql2 to verify whether it is installed on your server machine. If not, run gem install mysql2 to install it.

Tip: If you encounter an error, most likely, you are missing the MySQL client on your machine. The command like below will help.
`gem install mysql2 -- -- with-mysql-dir=/usr/local/Cellar/mysql/8.3.0`

3. Create BuildWise Database

Create a new MySQL database for the BuildWise server:

mysqladmin -uroot -p create buildwise_production

Tip: You might want to set up a dedicated MySQL user for this. My father often chose the username “cto”, continuous testing officer.

4. Edit config/database.yml to point

Change the entries under config/database.yml’s production section, including database location and login details.

Tip: A good practice is to verify the login first from the CT machine, running mysql -u cto -p -h … from command line. Yes, the database might be a different server.

5. Start BuildWise Server in production mode

Run the command startup-production.bat on Windows (or startup.sh on macOS/Linux) to start the server.

The first time the start-up command is run, it will auto-create the database schemas in the buildwise_production database.

Tip: for Ruby beginners, if BuildWise fails to start due to gem (library) related issues. Run bundle command to install required gems, then start with bundle-startup.bat (Windows) orbundle-startup.sh (macOS/Linux).

--

--