@@ -7,7 +7,7 @@ includes = ["./tasks"]
77
88
99[env ]
10- CS_DATABASE__HOST = " host.docker.internal "
10+
1111POSTGRES_DB = " {{env.CS_DATABASE__NAME}}"
1212PGUSER = " {{env.CS_DATABASE__USERNAME}}"
1313PGPASSWORD = " {{env.CS_DATABASE__PASSWORD}}"
@@ -16,6 +16,48 @@ PGPORT = "{{env.CS_DATABASE__PORT}}"
1616
1717# ====================================================================================================
1818
19+ [tasks ."benchmark:continuous" ]
20+ description = " Run proxy encryption benchmark for CI"
21+ run = """
22+ set -e
23+ mise run benchmark:clean
24+
25+ set -e
26+
27+ echo
28+ echo '###############################################'
29+ echo '# Preflight'
30+ echo '###############################################'
31+ echo
32+
33+ # Ensure Postgres instances are running
34+ mise run test:integration:preflight
35+
36+ echo
37+ echo '###############################################'
38+ echo '# Setup'
39+ echo '###############################################'
40+ echo
41+
42+ # Ensure EQL is set up before we try and start Proxy
43+ mise --env tcp run postgres:setup
44+
45+ mise run benchmark:setup
46+
47+ mise --env tcp run proxy:up proxy --extra-args "--detach --wait"
48+ mise --env tcp run test:wait_for_postgres_to_quack --port 6432 --max-retries 20
49+
50+ echo
51+ echo '###############################################'
52+ echo '# Extended protocol with encrypted transaction'
53+ echo '###############################################'
54+ echo
55+
56+ # Extended protocol with encrypted script
57+ mise run benchmark_service --target=proxy --transaction=encrypted --protocol=extended --port=6432 --time=30 --clients=10
58+ """
59+
60+
1961[tasks ."benchmark" ]
2062alias = ' b'
2163description = " Run benchmarks"
@@ -24,21 +66,72 @@ set -e
2466
2567mise run benchmark:clean
2668
69+ set -e
70+
71+ echo
72+ echo '###############################################'
73+ echo '# Preflight'
74+ echo '###############################################'
75+ echo
76+
77+ # Ensure Postgres instances are running
78+ mise run test:integration:preflight
79+
80+ echo
81+ echo '###############################################'
82+ echo '# Setup'
83+ echo '###############################################'
84+ echo
85+
86+ # Ensure EQL is set up before we try and start Proxy
87+ mise --env tcp run postgres:setup
88+
2789mise run benchmark:setup
2890
91+ mise --env tcp run pgbouncer:up --extra-args "--detach --wait"
92+ mise --env tcp run proxy:up proxy --extra-args "--detach --wait"
93+ mise --env tcp run test:wait_for_postgres_to_quack --port 6432 --max-retries 20
94+
95+
96+ echo
97+ echo '###############################################'
98+ echo '# Extended protocol with default pgbench transaction'
99+ echo '###############################################'
100+ echo
101+
29102# # Extended protocol with default script
30- # mise run benchmark_service --target=postgres --protocol=extended --port=5532 --time=5
31- # mise run benchmark_service --target=pgbouncer --protocol=extended --port=6433 --time=5
32- # mise run benchmark_service --target=proxy --protocol=extended --port=6432 --time=5
103+ mise run benchmark_service --target=postgres --protocol=extended --port=5532 --time=5
104+ mise run benchmark_service --target=pgbouncer --protocol=extended --port=6433 --time=5
105+ mise run benchmark_service --target=proxy --protocol=extended --port=6432 --time=5
106+
107+
108+ echo
109+ echo '###############################################'
110+ echo '# Extended protocol with plaintext transaction'
111+ echo '###############################################'
112+ echo
33113
34- # Extended protocol with plaintext script
35114mise run benchmark_service --target=postgres --transaction=plaintext --protocol=extended --port=5532 --time=5
36115mise run benchmark_service --target=pgbouncer --transaction=plaintext --protocol=extended --port=6433 --time=5
37116mise run benchmark_service --target=proxy --transaction=plaintext --protocol=extended --port=6432 --time=5
38117
118+
119+ echo
120+ echo '###############################################'
121+ echo '# Extended protocol with encrypted transaction'
122+ echo '###############################################'
123+ echo
124+
39125# Extended protocol with encrypted script
40126mise run benchmark_service --target=proxy --transaction=encrypted --protocol=extended --port=6432 --time=5
41127
128+
129+ echo
130+ echo '###############################################'
131+ echo '# Process results'
132+ echo '###############################################'
133+ echo
134+
42135mise run benchmark:plot
43136"""
44137
@@ -47,7 +140,7 @@ run = """
47140cat sql/benchmark-schema.sql | docker exec -i postgres${CONTAINER_SUFFIX} psql postgresql://${CS_DATABASE__USERNAME}:${CS_DATABASE__PASSWORD}@${CS_DATABASE__HOST}:${CS_DATABASE__PORT}/${CS_DATABASE__NAME} -f-
48141
49142# Initialize pgbench
50- docker compose run --rm postgres${CONTAINER_SUFFIX:-} pgbench --host=${CS_DATABASE__HOST} --port=${CS_DATABASE__PORT} --scale=1 -i --no-vacuum
143+ docker compose run --rm postgres${CONTAINER_SUFFIX:-} pgbench --host=host.docker.internal --port=${CS_DATABASE__PORT} --scale=1 -i --no-vacuum
51144"""
52145
53146[tasks ."benchmark:plot" ]
@@ -57,18 +150,6 @@ run = """
57150python plot.py
58151"""
59152
60- [tasks ."benchmark:up" ]
61- alias = ' u'
62- description = " Run PostgreSQL with docker compose"
63- run = """
64- set -e
65-
66- mise run postgres:up
67- mise run pgbouncer:up
68- mise run proxy:up
69-
70- """
71-
72153[tasks ."benchmark:clean" ]
73154description = " Clean old benchmark results"
74155run = """
@@ -80,50 +161,5 @@ alias = 'u'
80161description = " Run pgbouncer"
81162run = """
82163set -e
83- docker compose up --build pgbouncer --detach
164+ echo docker compose up --build {{arg(name="service",default=" pgbouncer")}} {{option(name="extra-args",default="")}} | bash
84165"""
85-
86-
87- # [tasks."down"]
88- # alias = 'u'
89- # description = "Tear down PostgreSQL and Proxy containers"
90- # run = """
91- # set -e
92- # if [[ -z "${CS_BENCHMARK_BUILD}" ]]; then
93- # mise run proxy:down
94- # mise run postgres:down
95- # fi
96- # """
97-
98- # [tasks."proxy:up"]
99- # alias = 'u'
100- # description = "Run CipherStash Proxy with docker compose"
101- # run = """
102- # set -e
103-
104- # docker compose up --build proxy --detach
105- # """
106-
107- # [tasks."proxy:down"]
108- # alias = 'pd'
109- # description = "Tear down Proxy container"
110- # run = """
111- # set -e
112- # docker compose down proxy
113- # """
114-
115- # [tasks."postgres:up"]
116- # alias = 'pgu'
117- # description = "Run PostgreSQL with docker compose"
118- # run = """
119- # set -e
120- # docker compose up postgres --detach
121- # """
122-
123- # [tasks."postgres:down"]
124- # alias = 'pgd'
125- # description = "Tear down PostgreSQL container"
126- # run = """
127- # set -e
128- # docker compose down postgres
129- # """
0 commit comments