|
| 1 | +[settings] |
| 2 | + |
| 3 | +trusted_config_paths = ["./env/mise.passthrough.toml"] |
| 4 | + |
| 5 | +[task_config] |
| 6 | +includes = ["./tasks"] |
| 7 | + |
| 8 | + |
| 9 | +[env] |
| 10 | +CS_DATABASE__HOST = "host.docker.internal" |
| 11 | +POSTGRES_DB = "{{env.CS_DATABASE__NAME}}" |
| 12 | +PGUSER = "{{env.CS_DATABASE__USERNAME}}" |
| 13 | +PGPASSWORD = "{{env.CS_DATABASE__PASSWORD}}" |
| 14 | +PGHOST = "{{env.CS_DATABASE__HOST}}" |
| 15 | +PGPORT = "{{env.CS_DATABASE__PORT}}" |
| 16 | + |
| 17 | +# ==================================================================================================== |
| 18 | + |
| 19 | +[tasks."benchmark"] |
| 20 | +alias = 'b' |
| 21 | +description = "Run benchmarks" |
| 22 | +run = """ |
| 23 | +set -e |
| 24 | +
|
| 25 | +mise run benchmark:clean |
| 26 | +
|
| 27 | +mise run benchmark:setup |
| 28 | +
|
| 29 | +# # 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 |
| 33 | +
|
| 34 | +# Extended protocol with plaintext script |
| 35 | +mise run benchmark_service --target=postgres --transaction=plaintext --protocol=extended --port=5532 --time=5 |
| 36 | +mise run benchmark_service --target=pgbouncer --transaction=plaintext --protocol=extended --port=6433 --time=5 |
| 37 | +mise run benchmark_service --target=proxy --transaction=plaintext --protocol=extended --port=6432 --time=5 |
| 38 | +
|
| 39 | +# Extended protocol with encrypted script |
| 40 | +mise run benchmark_service --target=proxy --transaction=encrypted --protocol=extended --port=6432 --time=5 |
| 41 | +
|
| 42 | +mise run benchmark:plot |
| 43 | +""" |
| 44 | + |
| 45 | +[tasks."benchmark:setup"] |
| 46 | +run = """ |
| 47 | +cat 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- |
| 48 | +
|
| 49 | +# Initialize pgbench |
| 50 | +docker compose run --rm postgres${CONTAINER_SUFFIX:-} pgbench --host=${CS_DATABASE__HOST} --port=${CS_DATABASE__PORT} --scale=1 -i --no-vacuum |
| 51 | +""" |
| 52 | + |
| 53 | +[tasks."benchmark:plot"] |
| 54 | +alias = 'b' |
| 55 | +description = "Plot graphs from benchmark results" |
| 56 | +run = """ |
| 57 | +python plot.py |
| 58 | +""" |
| 59 | + |
| 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 | + |
| 72 | +[tasks."benchmark:clean"] |
| 73 | +description = "Clean old benchmark results" |
| 74 | +run = """ |
| 75 | +rm -rf {{config_root}}/results/*.csv |
| 76 | +""" |
| 77 | + |
| 78 | +[tasks."pgbouncer:up"] |
| 79 | +alias = 'u' |
| 80 | +description = "Run pgbouncer" |
| 81 | +run = """ |
| 82 | +set -e |
| 83 | +docker compose up --build pgbouncer --detach |
| 84 | +""" |
| 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