Skip to content

Commit efdd95b

Browse files
authored
make release-notes script executable and update justfile (#115)
* make release-notes.py file executable * update justfile * wip: fix benchmarks * wip: fix benchmarks * wip: fix benchmarks * wip: fix benchmarks * wip: fix benchmarks * wip: fix benchmarks * wip: fix benchmarks - add double quotes around the connection string * wip: fix benchmarks - update start.sh
1 parent 076a497 commit efdd95b

18 files changed

+54
-50
lines changed

.github/workflows/benchmarks.yaml

+6-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
- name: Build the Docker image 🔨
2929
run: |
30-
docker load < $(nix build --no-link --print-out-paths '.#docker')
30+
docker load --input="$(nix build --no-link --print-out-paths '.#docker')"
3131
3232
- name: Start dependencies ▶️
3333
run: |
@@ -39,11 +39,14 @@ jobs:
3939
cd benchmarks/component
4040
for benchmark in $(ls benchmarks); do
4141
echo "Starting agent..."
42-
docker compose up --wait agent
42+
docker compose up --wait agent || {
43+
docker compose logs agent
44+
exit 1
45+
}
4346
echo "Running ${benchmark}..."
4447
docker compose run --rm benchmark run "/benchmarks/$benchmark"
4548
echo "Saving metrics for ${benchmark}..."
46-
./metrics.sh localhost:8100 ${benchmark}
49+
./metrics.sh localhost:8080 ${benchmark}
4750
echo "Stopping agent..."
4851
docker compose down agent
4952
done

benchmarks/component/benchmarks/select-by-pk.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import http from "k6/http";
33
import { newSummaryHandler } from "../common.js";
44

55
const testid = "select-by-pk";
6-
const agentSocket = __ENV.AGENT_SOCKET || "localhost:8100";
6+
const agentSocket = __ENV.AGENT_SOCKET || "localhost:8080";
77
const url = `http://${agentSocket}/query`;
88
const data = {
99
collection: "Album",

benchmarks/component/benchmarks/select-variables.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import http from "k6/http";
33
import { newSummaryHandler } from "../common.js";
44

55
const testid = "select-variables";
6-
const agentSocket = __ENV.AGENT_SOCKET || "localhost:8100";
6+
const agentSocket = __ENV.AGENT_SOCKET || "localhost:8080";
77
const url = `http://${agentSocket}/query`;
88
const data = {
99
collection: "Album",

benchmarks/component/benchmarks/select-where.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import http from "k6/http";
33
import { newSummaryHandler } from "../common.js";
44

55
const testid = "select-where";
6-
const agentSocket = __ENV.AGENT_SOCKET || "localhost:8100";
6+
const agentSocket = __ENV.AGENT_SOCKET || "localhost:8080";
77
const url = `http://${agentSocket}/query`;
88
const data = {
99
collection: "Album",

benchmarks/component/benchmarks/select.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import http from "k6/http";
33
import { newSummaryHandler } from "../common.js";
44

55
const testid = "select";
6-
const agentSocket = __ENV.AGENT_SOCKET || "localhost:8100";
6+
const agentSocket = __ENV.AGENT_SOCKET || "localhost:8080";
77
const url = `http://${agentSocket}/query`;
88
const data = {
99
collection: "Album",

benchmarks/component/docker-compose.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
benchmark:
77
image: grafana/k6
88
environment:
9-
AGENT_SOCKET: "agent:8100"
9+
AGENT_SOCKET: "agent:8080"
1010
OUTPUT_DIRECTORY: "/home/k6/output"
1111
K6_OUT: "experimental-prometheus-rw"
1212
K6_PROMETHEUS_RW_SERVER_URL: "http://prometheus:9090/api/v1/write"
@@ -59,16 +59,16 @@ services:
5959
- serve
6060
init: true
6161
ports:
62-
- "8100:8100"
62+
- "8080:8080"
6363
environment:
64-
CONFIGURATION_FILE: "/deployment.json"
64+
CONNECTION_URI: "Driver={ODBC Driver 19 for SQL Server};Server=127.0.0.1,1433;Database=Chinook;Uid=sa;Pwd=Password!;TrustServerCertificate=True"
6565
# we don't care about traces right now, and the benchmarks flood the batch buffer
6666
OTEL_TRACES_SAMPLER: "always_off"
67-
PORT: 8100
67+
PORT: 8080
6868
volumes:
6969
- type: bind
7070
source: ../../static
71-
target: /deployment.json
71+
target: /etc/connector
7272
read_only: true
7373
healthcheck:
7474
test:

benchmarks/component/metrics.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44
set -u
55
set -o pipefail
66

7-
# given an address like `localhost:8100`, call metrics endpoint and extract
7+
# given an address like `localhost:8080`, call metrics endpoint and extract
88
# useful things like the time our agent spends doing work that isn't query execution or
99
# waiting for connections
1010

benchmarks/component/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ export K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM="true"
4848
k6 run "./benchmarks/$BENCHMARK" "$@"
4949

5050
info 'Printing metrics'
51-
curl -fsS http://localhost:8100/metrics
51+
curl -fsS http://localhost:8080/metrics

benchmarks/component/start.sh

+5-22
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,17 @@ info 'Starting the dependencies'
2626
docker compose up --wait sqlserver grafana
2727
SQLSERVER_SOCKET="$(docker compose port sqlserver 1433 | cut -f2 -d":")"
2828

29-
info 'Generating the deployment configuration'
30-
mkdir -p generated
31-
cargo run -p ndc-sqlserver --quiet --release -- configuration serve &
32-
AGENT_PID=$!
33-
echo "$AGENT_PID" > ./agent.pid
34-
../../scripts/wait-until --timeout=30 --report -- cargo run -p ndc-sqlserver --quiet -- check-health --port=9100
35-
if ! kill -0 "$AGENT_PID"; then
36-
echo >&2 'The agent stopped abruptly. Take a look at agent.log for details.'
37-
exit 1
38-
fi
39-
40-
SQLSERVER_CONNECTION_STRING="DRIVER={ODBC Driver 18 for SQL Server};SERVER=127.0.0.1,${SQLSERVER_SOCKET};Uid=SA;Database=Chinook;Pwd=Password!"
41-
42-
../../scripts/new-configuration.sh localhost:9100 "${SQLSERVER_CONNECTION_STRING}" \
43-
> ./generated/deployment.json
44-
kill "$AGENT_PID" && wait "$AGENT_PID" || :
45-
rm -f ./agent.pid
46-
4729
info 'Starting the agent'
48-
if nc -z localhost 8100; then
49-
echo >&2 'ERROR: There is already an agent running on port 8100.'
30+
if nc -z localhost 8080; then
31+
echo >&2 'ERROR: There is already an agent running on port 8080.'
5032
exit 1
5133
fi
5234

35+
CONNECTION_URI="DRIVER={ODBC Driver 18 for SQL Server};SERVER=127.0.0.1,${SQLSERVER_SOCKET};Uid=SA;Database=Chinook;Pwd=Password!"
5336
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT='http://localhost:4317' \
54-
OTEL_SERVICE_NAME='ndc-sqlserver' \
37+
OTEL_SERVICE_NAME='ndc-sqlserver' \
5538
cargo run -p ndc-sqlserver --quiet --release -- \
56-
serve --configuration=./generated/deployment.json \
39+
serve --configuration='../../static' \
5740
>& agent.log &
5841
AGENT_PID=$!
5942
echo "$AGENT_PID" > ./agent.pid

debugging.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Using host libthread_db library "/lib64/libthread_db.so.1".
3333
[New Thread 0x7ffff753f6c0 (LWP 143305)]
3434
...
3535
[New Thread 0x7ffff57306c0 (LWP 143320)]
36-
Starting server on 0.0.0.0:8100
36+
Starting server on 0.0.0.0:8080
3737
3838
```
3939
@@ -43,7 +43,7 @@ For example, running a test:
4343
```sh
4444
curl -H "Content-Type: application/json" \
4545
--data "@crates/ndc-sqlserver/tests/goldenfiles/dup_array_relationship.json" \
46-
http://localhost:8100/query
46+
http://localhost:8080/query
4747
```
4848
4949
Then we can go back to our GDB window:

justfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ set shell := ["bash", "-c"]
33
CONNECTOR_IMAGE_NAME := "ghcr.io/hasura/sqlserver-agent-rs"
44
CONNECTOR_IMAGE_TAG := "dev"
55
CONNECTOR_IMAGE := CONNECTOR_IMAGE_NAME + ":" + CONNECTOR_IMAGE_TAG
6-
CHINOOK_DEPLOYMENT := "static/configuration.json"
7-
SQLSERVER_CONNECTION_STRING := "DRIVER={ODBC Driver 18 for SQL Server};SERVER=127.0.0.1,64003;Uid=SA;Database=Chinook;Pwd=Password!;TrustServerCertificate=true"
6+
CHINOOK_DEPLOYMENT := "static/"
7+
SQLSERVER_CONNECTION_STRING := "DRIVER={ODBC Driver 19 for SQL Server};SERVER=127.0.0.1,64003;Uid=SA;Database=Chinook;Pwd=Password!;TrustServerCertificate=true"
8+
SQLSERVER_BROKEN_QUERIES_NDC_METADATA := "static/broken-queries-ndc-metadata"
89

910
# check everything
1011
check: format-check find-unused-dependencies build lint test
@@ -46,7 +47,9 @@ dev-config: start-dependencies
4647
# re-generate the deployment configuration file
4748
generate-chinook-configuration: build start-dependencies
4849
./scripts/archive-old-deployment.sh '{{CHINOOK_DEPLOYMENT}}'
49-
./scripts/generate-chinook-configuration.sh 'ndc-sqlserver' '{{SQLSERVER_CONNECTION_STRING}}' '{{CHINOOK_DEPLOYMENT}}'
50+
51+
CONNECTION_URI='{{SQLSERVER_CONNECTION_STRING}}' cargo run --bin ndc-sqlserver-cli -- --context='{{CHINOOK_DEPLOYMENT}}new_configuration/' initialize
52+
CONNECTION_URI='{{SQLSERVER_CONNECTION_STRING}}' cargo run --bin ndc-sqlserver-cli -- --context='{{CHINOOK_DEPLOYMENT}}new_configuration/' update
5053

5154
test-introspection:
5255
#!/bin/bash

metrics/grafana/dashboards/ndc-sqlserver.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@
470470
{
471471
"matcher": {
472472
"id": "byName",
473-
"options": "{instance=\"host.docker.internal:8100\", job=\"ndc-sqlserver\", le=\"0.005\"}"
473+
"options": "{instance=\"host.docker.internal:8080\", job=\"ndc-sqlserver\", le=\"0.005\"}"
474474
},
475475
"properties": [
476476
{

metrics/prometheus/prometheus.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ scrape_configs:
2727
scheme: http
2828
static_configs:
2929
- targets:
30-
- host.docker.internal:8100
30+
- host.docker.internal:8080

nix/docker.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let
2020
Env = [
2121
''HASURA_CONFIGURATION_DIRECTORY=/etc/connector''
2222
];
23-
ExposedPorts = { "8100/tcp" = { }; };
23+
ExposedPorts = { "8080/tcp" = { }; };
2424
} // extraConfig;
2525
}
2626
// lib.optionalAttrs (tag != null) {

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ just run
6868
```
6969
curl -H "Content-Type: application/json" \
7070
--data "@crates/ndc-sqlserver/tests/goldenfiles/select_where_variable.json" \
71-
http://localhost:8100/query \
71+
http://localhost:8080/query \
7272
| jq
7373
```
7474

scripts/archive-old-deployment.sh

+19-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,23 @@ SNAPSHOT_DIR="$(realpath ${CURRENT_DIR}/../static/deployment-snapshots)"
1414
# create snapshot dir if does not exist
1515
mkdir -p "$SNAPSHOT_DIR"
1616

17-
# create filename from hash of contents
18-
NEW_FILENAME="$(sha256sum "${CHINOOK_DEPLOYMENT}" | cut -f1 -d' ').json"
17+
if [ -f ${CHINOOK_DEPLOYMENT}new_configuration/configuration.json ]; then
18+
# create filename from hash of contents
19+
NEW_DIRECTORY="$(sha256sum "${CHINOOK_DEPLOYMENT}new_configuration/configuration.json" | cut -f1 -d' ')"
20+
21+
mkdir -p "${SNAPSHOT_DIR}/${NEW_DIRECTORY}"
22+
23+
# copy current deployment to new filename
24+
cp -r "${CHINOOK_DEPLOYMENT}new_configuration"* "${SNAPSHOT_DIR}/${NEW_DIRECTORY}"
25+
26+
rm -r "${CHINOOK_DEPLOYMENT}new_configuration"
27+
else
28+
# create filename from hash of contents
29+
NEW_DIRECTORY="$(sha256sum "${CHINOOK_DEPLOYMENT}configuration.json" | cut -f1 -d' ')"
30+
31+
mkdir -p "${SNAPSHOT_DIR}/${NEW_DIRECTORY}"
32+
33+
# copy current deployment to new filename
34+
cp -r "${CHINOOK_DEPLOYMENT}configuration.json"* "${SNAPSHOT_DIR}/${NEW_DIRECTORY}"
35+
fi
1936

20-
# copy current deployment to new filename
21-
cp "${CHINOOK_DEPLOYMENT}" "${SNAPSHOT_DIR}/${NEW_FILENAME}"

scripts/release-notes.py

100644100755
File mode changed.

static/chinook-metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"definition": {
44
"name": "db",
55
"url": {
6-
"singleUrl": "http://localhost:8100"
6+
"singleUrl": "http://localhost:8080"
77
},
88
"schema": {
99
"scalar_types": {

0 commit comments

Comments
 (0)