Skip to content

Commit 9ff699c

Browse files
committed
Add blog post about ovdb development and helper script
1 parent b065d9b commit 9ff699c

1 file changed

Lines changed: 234 additions & 0 deletions

File tree

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
---
2+
layout: post
3+
title: Getting Started with OpenVoxDB Development
4+
date: 2026-01-30
5+
github_username: austb
6+
---
7+
8+
Welcome to OpenVoxDB development. We recently added a helper script called
9+
`ovdb` that makes local development much easier. This post covers how to get
10+
started.
11+
12+
## What is OpenVoxDB?
13+
14+
OpenVoxDB is a database for OpenVox run information. It stores OpenVox-generated
15+
data in PostgreSQL and exposes a query API. This dependency on PostgreSQL makes
16+
OpenVoxDB slightly harder to start development on than OpenVox or
17+
OpenVox-Server, which don't generally have external dependencies to configure.
18+
19+
## The `ovdb` Helper Script
20+
21+
Setting up a local OpenVoxDB instance usually means initializing Postgres,
22+
configuring databases and configuring OpenVoxDB to connect to your Postgres.
23+
The project contains many standalone scripts for automating these operations.
24+
The `ovdb` script handles knowing how to invoke each script for you for the
25+
most common development workflows.
26+
27+
It can:
28+
- Initialize and manage Postgres sandboxes
29+
- Run unit, parallel, and integration tests
30+
- Start and stop services
31+
- Manage multiple environments
32+
33+
## Prerequisites
34+
35+
You'll need:
36+
- PostgreSQL 16+
37+
- Java 17+
38+
- Leiningen
39+
- [pgbox](https://gitlab.com/pgbox-org/pgbox) (added to your PATH)
40+
41+
## Getting Started
42+
43+
### Step 1: Configure PostgreSQL Location
44+
45+
Copy the example config file:
46+
```bash
47+
cp dev-resources/ovdb.conf.example .ovdb.conf
48+
```
49+
50+
Edit `.ovdb.conf` and set `pg_bin` to your PostgreSQL bin directory. Common paths:
51+
52+
**macOS (Homebrew)**
53+
```bash
54+
pg_bin=/opt/homebrew/opt/postgresql@17/bin
55+
```
56+
57+
**macOS (Postgres.app)**
58+
```bash
59+
pg_bin=/Applications/Postgres.app/Contents/Versions/17/bin
60+
```
61+
62+
**Linux (Debian/Ubuntu)**
63+
```bash
64+
pg_bin=/usr/lib/postgresql/17/bin
65+
```
66+
67+
**Linux (RHEL/CentOS)**
68+
```bash
69+
pg_bin=/usr/pgsql-17/bin
70+
```
71+
72+
Not sure where yours is? You can often find it by running `which psql`.
73+
74+
### Step 2: Verify Configuration
75+
76+
Run the doctor command to check your setup:
77+
```bash
78+
./ovdb doctor
79+
```
80+
81+
This validates that `pg_bin` points to Postgres and checks that your sandbox
82+
directory is writable.
83+
84+
### Step 3: Initialize the Database
85+
86+
Now, set up your Postgres sandbox and create the OpenVoxDB database:
87+
88+
```bash
89+
./ovdb init
90+
```
91+
92+
This command:
93+
1. Creates a Postgres sandbox in `dev-resources/sandboxes/tmp_pg`
94+
2. Initializes the database and roles
95+
3. Installs necessary Postgres extensions
96+
4. Writes the configuration files needed to connect OpenVoxDB to the newly
97+
created Postgres sandbox
98+
5. Starts the Postgres server
99+
100+
### Step 4: Run OpenVoxDB
101+
102+
Start the application:
103+
104+
```bash
105+
./ovdb run
106+
```
107+
108+
OpenVoxDB will start and listen on `http://localhost:8080`.
109+
110+
## Running Tests
111+
112+
Testing is crucial for maintaining code quality. The `ovdb` script makes it
113+
easy to run different test suites.
114+
115+
### Unit Tests
116+
117+
Run the complete unit test suite:
118+
119+
```bash
120+
./ovdb test
121+
```
122+
123+
To run a specific test:
124+
125+
```bash
126+
./ovdb test :only puppetlabs.puppetdb.scf.migrate-test/some-test
127+
```
128+
129+
Unit tests verify individual functions and components without requiring other
130+
OpenVox projects.
131+
132+
### Integration Tests
133+
134+
Test OpenVoxDB's interaction with OpenVox and OpenVox-Server:
135+
136+
```bash
137+
./ovdb integration
138+
```
139+
140+
Integration tests clone and configure the OpenVox and OpenVox-Server
141+
repositories, then run tests that exercise the full catalog compilation
142+
process. This is more comprehensive (and slower) than unit tests, but often
143+
catches compatibility issues between the three projects.
144+
145+
### External Tests
146+
147+
Test the built uberjar (packaged application) to verify CLI argument handling,
148+
database migrations, error handling, and upgrade paths:
149+
150+
```bash
151+
lein uberjar
152+
./ovdb ext
153+
```
154+
155+
## Working with Multiple Environments
156+
157+
Sometimes you need multiple sandboxes—perhaps for testing against different
158+
Postgres versions or keeping separate test data. The `--name` flag lets you
159+
create and manage multiple environments:
160+
161+
```bash
162+
# Configure multiple pg versions in .ovdb.conf
163+
pg_bin_17=/usr/lib/postgresql/17/bin
164+
pg_bin_18=/usr/lib/postgresql/18/bin
165+
```
166+
167+
```bash
168+
# Create sandboxes for each pg 17 & 18
169+
./ovdb --name pg-17-test --pgver 17 init
170+
./ovdb --name pg-18-test --pgver 18 init
171+
172+
# Run against that sandbox
173+
./ovdb --name pg-18-test run
174+
175+
# Switch to running against postgres 17
176+
./ovdb --name pg-17-test run
177+
178+
# Run tests against pg18
179+
./ovdb --name pg-18-test test
180+
```
181+
182+
Each named sandbox is isolated and maintains its own database and configuration.
183+
Postgres configurations are initialized with random ports so you can leave
184+
multiple running and just swap between which `name` you reference for running
185+
or testing OpenVoxDB.
186+
187+
## Troubleshooting
188+
189+
### "pg_bin is not configured"
190+
191+
**Solution**: Edit `.ovdb.conf` and ensure `pg_bin` points to your Postgres
192+
bin directory. Run `./ovdb doctor` to verify.
193+
194+
### "pg_ctl not found"
195+
196+
**Solution**: Your `pg_bin` path is incorrect. Verify it contains:
197+
- `pg_ctl`
198+
- `psql`
199+
- Other Postgres binaries
200+
201+
Run `ls $pg_bin` to check.
202+
203+
### "Cannot connect to database"
204+
205+
**Solution**: Ensure the Postgres server is running:
206+
```bash
207+
./ovdb start
208+
```
209+
210+
If it still fails, check the logs:
211+
```bash
212+
./ovdb pglog
213+
```
214+
215+
### Debugging Issues
216+
217+
If you are debugging issues with Postgres you can see the logs of the sandbox
218+
with:
219+
```bash
220+
./ovdb pglog
221+
```
222+
223+
## Next Steps
224+
225+
OpenVoxDB is a complicated project, but you should be ready to start developing
226+
with the processes outlined in this post. There are still more commands that
227+
you might find useful. There is `ptest` to run unit tests in parallel,
228+
`benchmark` for populating your sandbox with test data, and `query` for running
229+
PQL queries against a running OpenVoxDB. Run `./ovdb --help` to see all
230+
available commands.
231+
232+
The `ovdb` script has been my personal tool to develop against this codebase
233+
for many years. It is likely to have some rough edges that I just never
234+
encounter, so please suggest any improvements you think would help you.

0 commit comments

Comments
 (0)