Skip to content

Commit 3942708

Browse files
committed
allow for workflows that export all env vars
when developing locally, I really like the following flow: - launch a new postgres db with `./run-postgres-latest.sh` - be able to *programmatically* set the necessary env vars so that Metabase connects to that new postgres DB - later, being able to *programmatically* switch to a different AppDB (e.g. back and forth between postgres and mariadb) I've been using a hacky version of these dev tools for a while to accomplish that and figured I'd fix things up and push to see if this workflow appealed to anyone else. The following scripts have changed in the exact same way for mariadb, mysql, and postgres: First, `./run-$db-latest.sh` now sets one additional context variable: `[DATABASE]_BROAD_VERSION`. This allows us to figure out the right container for, e.g. `oldest` postgres, without worrying about whether the oldest version when you started the DB was v1 and now it's v2 Second, `./_run-$db.sh` now: - starts the container, then - runs `source ./env-$db.sh`, before - spitting out a human-readable message about how to connect to the database. Finally, `./env-$db.sh` now: - takes a "broad version" (latest or oldest) - is an *output*, not an *input*, to the process of starting an instance (i.e. before you would run it before running the container, now you run it *after* running the container) - pulls data *from the container itself*, reducing duplication (e.g. it figures out what the `MYSQL_DATABASE` you launched mysql with was, rather than making sure it's in sync) - `export`s all relevant env vars required to set up metabase with that database, e.g. `MB_DB_HOST` or `MB_DB_PORT`. One other change: the `docker run` commands no longer explicitly set a host port. Instead we just expose a public port, and the `./env-$db.sh` scripts use `port=$(docker port ${container} 3306/tcp | cut -d: -f2)` to figure out the appropriate host port. Personally, I use this like so: ``` (defun metabase-mariadb-jack-in! () (interactive) (shell-command "/Users/jds/src/dev-scripts/run-mariadb-latest.sh") (metabase-mariadb-jack-in "latest")) (defun metabase-mariadb-oldest-jack-in! () (interactive) (shell-command "/Users/jds/src/dev-scripts/run-mariadb-oldest.sh") (metabase-mariadb-jack-in "oldest")) (defun metabase-mariadb-jack-in (version) "Connect to MariaDB and start metabase" (interactive) (ignore-errors (cider-quit)) (metabase-reset-env!) (set-env-from-shell "/Users/jds/src/dev-scripts/env-mariadb.sh" version) (metabase-jack-in)) ``` This way, in emacs, I can run `metabase-mariadb-oldest-jack-in!` and automatically: - blow away the old `mariadb` DB and launch a new one - set the env up to connect to the new container - and restart cider to actually connect to it Similarly, `(metabase-mariadb-jack-in "latest")` kills cider, sets up the env to connect to the *existing* latest mariadb container I have running, and then relaunches cider.
1 parent dbeb200 commit 3942708

13 files changed

+157
-69
lines changed

_run-mariadb.sh

+17-12
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,34 @@
22

33
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
44

5-
source "$SOURCE_DIR/env-mariadb.sh"
6-
75
source "$SOURCE_DIR/common.sh"
6+
CONTAINER_NAME=mb-mariadb-db-${MARIADB_BROAD_VERSION}
87

98
kill-existing ${CONTAINER_NAME}
109

11-
docker run -p ${HOST_PORT}:3306 \
12-
-e MYSQL_DATABASE=${DB_NAME} \
13-
-e MYSQL_USER=${DB_USER} \
10+
docker run -p 3306 \
11+
-e MYSQL_DATABASE=metabase \
12+
-e MYSQL_USER=mbuser \
1413
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
1514
--name ${CONTAINER_NAME} \
1615
--rm \
1716
-d mariadb:${MARIADB_VERSION}
1817

19-
cat <<EOF
20-
21-
Started MariaDB ${MARIADB_VERSION} on port ${HOST_PORT}.
18+
source ./env-mariadb.sh ${MARIADB_BROAD_VERSION}
2219

23-
Connect with the MySQL CLI tool:
24-
mysql --user=${DB_USER} --host=127.0.0.1 --port=${HOST_PORT} --database=${DB_NAME}
20+
function print-mariadb-vars() {
21+
cat <<EOF
22+
Java properties:
23+
-Dmb.mysql.test.host=localhost -Dmb.mysql.test.port=${MB_DB_PORT} -Dmb.mysql.test.db=${MB_DB_DBNAME} -Dmb.mysql.test.user=${MB_DB_USER} -Dmb.mysql.test.password=
2524
26-
JDBC URL: jdbc:mysql://localhost:${HOST_PORT}/${DB_NAME}?user=${DB_USER}
25+
Clojure pairs:
26+
:mb-mysql-test-host "localhost" :mb-mysql-test-port "${MB_DB_PORT}" :mb-mysql-test-db "${MB_DB_DBNAME}" :mb-mysql-test-user "${MB_DB_USER}" :mb-mysql-test-password ""
2727
28+
Bash variables:
29+
MB_MYSQL_TEST_HOST=localhost MB_MYSQL_TEST_PORT=${MB_DB_PORT} MB_MYSQL_TEST_DB=${MB_DB_DBNAME} MB_MYSQL_TEST_USER=${MB_DB_USER} MB_MYSQL_TEST_PASSWORD=''
2830
EOF
31+
}
2932

30-
print-mariadb-vars
33+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
34+
print-mariadb-vars
35+
fi

_run-mysql.sh

+10-9
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@
22

33
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
44

5-
source "$SOURCE_DIR/env-mysql.sh"
6-
75
source "$SOURCE_DIR/common.sh"
6+
CONTAINER_NAME=mb-mysql-db-${MYSQL_BROAD_VERSION}
87

98
kill-existing ${CONTAINER_NAME}
109

11-
docker run -p ${HOST_PORT}:3306 \
12-
-e MYSQL_DATABASE=${DB_NAME} \
10+
docker run \
11+
-p 3306 \
12+
-e MYSQL_DATABASE=metabase \
13+
-e MYSQL_USER=mbuser \
1314
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
1415
--name ${CONTAINER_NAME} \
1516
--rm \
1617
-d mysql:${MYSQL_VERSION}
1718

19+
source ./env-mysql.sh ${MYSQL_BROAD_VERSION}
20+
1821
cat <<EOF
1922
20-
Started MySQL ${MYSQL_VERSION} on port ${HOST_PORT}.
23+
Started MySQL ${MYSQL_VERSION} on port ${MB_DB_PORT}.
2124
2225
Connect with the MySQL CLI tool:
23-
mysql --user=${DB_USER} --host=127.0.0.1 --port=${HOST_PORT} --database=${DB_NAME}
26+
mysql --user=${MB_DB_USER} --host=127.0.0.1 --port=${MB_DB_PORT} --database=${MB_DB_DBNAME}
2427
25-
JDBC URL: jdbc:mysql://localhost:${HOST_PORT}/${DB_NAME}?user=${DB_USER}
28+
JDBC URL: jdbc:mysql://localhost:${MB_DB_PORT}/${MB_DB_DBNAME}?user=${MB_DB_USER}
2629
2730
EOF
28-
29-
print-mysql-vars

_run-postgres.sh

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
#!/usr/bin/env bash
2+
set -euo pipefail
23

34
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
45

5-
source "$SOURCE_DIR/env-postgres.sh"
6-
76
source "$SOURCE_DIR/common.sh"
8-
7+
CONTAINER_NAME=mb-postgres-db-${PG_BROAD_VERSION}
98
DATA_DIR=${HOME}/metabase-pgsql-${PG_VERSION}-data
109
DOCKER_NETWORK=psql-metabase-network
1110

1211
kill-existing ${CONTAINER_NAME}
1312
create-network-if-needed ${DOCKER_NETWORK}
1413

1514
docker run \
16-
--rm \
1715
-d \
18-
-p ${HOST_PORT}:5432 \
16+
-p 5432 \
1917
--network ${DOCKER_NETWORK} \
20-
-e POSTGRES_USER=${DB_USER} \
21-
-e POSTGRES_DB=${DB_NAME} \
22-
-e POSTGRES_PASSWORD=${DB_PASSWORD} \
18+
-e POSTGRES_USER=mbuser \
19+
-e POSTGRES_DB=metabase \
20+
-e POSTGRES_PASSWORD=password \
2321
-e PGDATA=/var/lib/postgresql/data \
2422
-v ${DATA_DIR}:/var/lib/postgresql/data:Z \
2523
--name ${CONTAINER_NAME} \
2624
postgres:${PG_VERSION}
2725

28-
cat << EOF
26+
source ./env-postgres.sh ${PG_BROAD_VERSION}
2927

30-
Started PostgreSQL ${PG_VERSION} on port ${HOST_PORT} via Docker (container name: ${CONTAINER_NAME}).
28+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
29+
cat << EOF
30+
Started PostgreSQL ${PG_VERSION} on port ${MB_DB_PORT} via Docker (container name: ${CONTAINER_NAME}).
3131
Data will be persisted in ${DATA_DIR} on the host machine (delete it to reset).
3232
3333
To open a SQL client session:
34-
docker run -it --rm --network ${DOCKER_NETWORK} postgres:${PG_VERSION} psql -h ${CONTAINER_NAME} -U ${DB_USER}
35-
And enter the DB user password for ${DB_USER}: ${DB_PASSWORD}
34+
docker run -it --rm --network ${DOCKER_NETWORK} postgres:${PG_VERSION} psql -h ${CONTAINER_NAME} -U ${MB_DB_USER}
35+
And enter the DB user password for ${MB_DB_USER}: ${MB_DB_PASS}
3636
37-
JDBC URL: jdbc:postgres://localhost:${HOST_PORT}/${DB_NAME}?user=${DB_USER}
37+
JDBC URL: jdbc:postgres://localhost:${MB_DB_PORT}/${MB_DB_DBNAME}?user=${MB_DB_USER}
3838
3939
EOF
4040

41-
print-postgres-vars
41+
fi

env-mariadb.sh

+28-9
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,45 @@
11
#! /usr/bin/env bash
2+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
3+
set -euo pipefail
4+
fi
5+
6+
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
7+
cd "$(dirname "$0")"
28

3-
set -euo pipefail
9+
if [[ $# -eq 0 ]] && [[ -z "${MARIADB_BROAD_VERSION:-}" ]]; then
10+
echo "Usage: ./$(basename "$0") [latest/oldest]" >&2
11+
exit 1
12+
fi
13+
container=mb-mariadb-db-${1:-$MARIADB_BROAD_VERSION}
14+
port=$(docker port ${container} 3306/tcp | cut -d: -f2)
15+
source ${SOURCE_DIR}/getenv.sh ${container} MYSQL_USER MYSQL_DATABASE
16+
17+
export MB_DB_TYPE=mysql
18+
export MB_DB_DBNAME=${MYSQL_DATABASE}
19+
export MB_DB_HOST=127.0.0.1
20+
export MB_DB_PASS=
21+
export MB_DB_PORT=${port}
22+
export MB_DB_USER=${MYSQL_USER}
423

5-
CONTAINER_NAME=mb-mariadb-db
6-
HOST_PORT=3307
7-
DB_NAME=metabase_test
8-
DB_USER=root
24+
export MB_MYSQL_TEST_USER=${MB_DB_USER}
25+
export MB_MYSQL_TEST_PASSWORD=
26+
export MB_MYSQL_TEST_DBNAME=${MYSQL_DATABASE}
27+
export MB_MYSQL_TEST_HOST=${MB_DB_HOST}
28+
export MB_MYSQL_TEST_PORT=${MB_DB_PORT}
929

1030
function print-mariadb-vars() {
1131
cat <<EOF
1232
Java properties:
13-
-Dmb.mysql.test.host=localhost -Dmb.mysql.test.port=${HOST_PORT} -Dmb.mysql.test.db=${DB_NAME} -Dmb.mysql.test.user=${DB_USER} -Dmb.mysql.test.password=
33+
-Dmb.mysql.test.host=localhost -Dmb.mysql.test.port=${MB_DB_PORT} -Dmb.mysql.test.db=${MB_DB_DBNAME} -Dmb.mysql.test.user=${MB_DB_USER} -Dmb.mysql.test.password=
1434
1535
Clojure pairs:
16-
:mb-mysql-test-host "localhost" :mb-mysql-test-port "${HOST_PORT}" :mb-mysql-test-db "${DB_NAME}" :mb-mysql-test-user "${DB_USER}" :mb-mysql-test-password ""
36+
:mb-mysql-test-host "localhost" :mb-mysql-test-port "${MB_DB_PORT}" :mb-mysql-test-db "${MB_DB_DBNAME}" :mb-mysql-test-user "${MB_DB_USER}" :mb-mysql-test-password ""
1737
1838
Bash variables:
19-
MB_MYSQL_TEST_HOST=localhost MB_MYSQL_TEST_PORT=${HOST_PORT} MB_MYSQL_TEST_DB=${DB_NAME} MB_MYSQL_TEST_USER=${DB_USER} MB_MYSQL_TEST_PASSWORD=''
39+
MB_MYSQL_TEST_HOST=localhost MB_MYSQL_TEST_PORT=${MB_DB_PORT} MB_MYSQL_TEST_DB=${MB_DB_DBNAME} MB_MYSQL_TEST_USER=${MB_DB_USER} MB_MYSQL_TEST_PASSWORD=''
2040
EOF
2141
}
2242

2343
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
2444
print-mariadb-vars
2545
fi
26-

env-mysql.sh

+28-9
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,45 @@
11
#! /usr/bin/env bash
2+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
3+
set -euo pipefail
4+
fi
5+
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
6+
cd "$(dirname "$0")"
7+
8+
if [[ $# -eq 0 ]] && [[ -z "${MYSQL_BROAD_VERSION:-}" ]]; then
9+
echo "Usage: ./$(basename "$0") [latest/oldest]" >&2
10+
exit 1
11+
fi
12+
13+
container=mb-mysql-db-${1:-$MYSQL_BROAD_VERSION}
14+
port=$(docker port ${container} 3306/tcp | cut -d: -f2)
15+
source ${SOURCE_DIR}/getenv.sh ${container} MYSQL_DATABASE MYSQL_USER
216

3-
set -euo pipefail
17+
export MB_DB_TYPE=mysql
18+
export MB_DB_DBNAME=${MYSQL_DATABASE}
19+
export MB_DB_HOST=127.0.0.1
20+
export MB_DB_PASS=
21+
export MB_DB_PORT=${port}
22+
export MB_DB_USER=${MYSQL_USER}
423

5-
CONTAINER_NAME=mb-mysql-db
6-
HOST_PORT=3306
7-
DB_NAME=metabase_test
8-
DB_USER=root
24+
export MB_MYSQL_TEST_USER=${MB_DB_USER}
25+
export MB_MYSQL_TEST_PASSWORD=
26+
export MB_MYSQL_TEST_DBNAME=${MYSQL_DATABASE}
27+
export MB_MYSQL_TEST_HOST=${MB_DB_HOST}
28+
export MB_MYSQL_TEST_PORT=${MB_DB_PORT}
929

1030
function print-mysql-vars() {
1131
cat <<EOF
1232
Java properties:
13-
-Dmb.mysql.test.host=localhost -Dmb.mysql.test.port=${HOST_PORT} -Dmb.mysql.test.db=${DB_NAME} -Dmb.mysql.test.user=${DB_USER} -Dmb.mysql.test.password=
33+
-Dmb.mysql.test.host=localhost -Dmb.mysql.test.port=${MB_DB_PORT} -Dmb.mysql.test.db=${MB_DB_DBNAME} -Dmb.mysql.test.user=${MB_DB_USER} -Dmb.mysql.test.password=
1434
1535
Clojure pairs:
16-
:mb-mysql-test-host "localhost" :mb-mysql-test-port "${HOST_PORT}" :mb-mysql-test-db "${DB_NAME}" :mb-mysql-test-user "${DB_USER}" :mb-mysql-test-password ""
36+
:mb-mysql-test-host "localhost" :mb-mysql-test-port "${MB_DB_PORT}" :mb-mysql-test-db "${MB_DB_DBNAME}" :mb-mysql-test-user "${MB_DB_USER}" :mb-mysql-test-password ""
1737
1838
Bash variables:
19-
MB_MYSQL_TEST_HOST=localhost MB_MYSQL_TEST_PORT=${HOST_PORT} MB_MYSQL_TEST_DB=${DB_NAME} MB_MYSQL_TEST_USER=${DB_USER} MB_MYSQL_TEST_PASSWORD=''
39+
MB_MYSQL_TEST_HOST=localhost MB_MYSQL_TEST_PORT=${MB_DB_PORT} MB_MYSQL_TEST_DB=${MB_DB_DBNAME} MB_MYSQL_TEST_USER=${MB_DB_USER} MB_MYSQL_TEST_PASSWORD=''
2040
EOF
2141
}
2242

2343
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
2444
print-mysql-vars
2545
fi
26-

env-postgres.sh

+35-10
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,48 @@
1-
#! /usr/bin/env bash
1+
#!/usr/bin/env bash
2+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
3+
set -euo pipefail
4+
fi
5+
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
6+
cd "$(dirname "$0")"
7+
8+
if [[ $# -eq 0 ]] && [[ -z "${PG_BROAD_VERSION:-}" ]]; then
9+
echo "Usage: ./$(basename "$0") [latest/oldest]" >&2
10+
exit 1
11+
fi
12+
# `oldest` or `latest`
13+
container=mb-postgres-db-${1:-$PG_BROAD_VERSION}
14+
port=$(docker port ${container} 5432/tcp | cut -d: -f2)
15+
source ${SOURCE_DIR}/getenv.sh ${container} POSTGRES_USER POSTGRES_DB POSTGRES_PASSWORD
16+
17+
export MB_DB_TYPE=postgres
18+
export MB_DB_DBNAME=${POSTGRES_DB}
19+
export MB_DB_HOST=127.0.0.1
20+
export MB_DB_PASS=${POSTGRES_PASSWORD}
21+
export MB_DB_PORT=${port}
22+
export MB_DB_USER=${POSTGRES_USER}
223

3-
set -euo pipefail
24+
export MB_POSTGRESQL_TEST_USER=${MB_DB_USER}
25+
export MB_POSTGRESQL_TEST_PASSWORD=${MB_DB_PASS}
26+
export MB_POSTGRESQL_TEST_DBNAME=${MB_DB_DBNAME}
27+
export MB_POSTGRESQL_TEST_HOST=${MB_DB_HOST}
28+
export MB_POSTGRESQL_TEST_PORT=${MB_DB_PORT}
429

5-
CONTAINER_NAME=mb-postgres-db
6-
HOST_PORT=${PGSQL_PORT:-5432}
7-
DB_NAME=metabase
8-
DB_USER=metabase
9-
DB_PASSWORD=password
30+
export PGHOST=${MB_DB_HOST}
31+
export PGPORT=${MB_DB_PORT}
32+
export PGUSER=${MB_DB_USER}
33+
export PGPASSWORD=${MB_DB_PASS}
34+
export PGDATABASE=${MB_DB_DBNAME}
1035

1136
function print-postgres-vars() {
1237
cat <<EOF
1338
Java properties:
14-
-Dmb.postgresql.test.host=localhost -Dmb.postgresql.test.port=${HOST_PORT} -Dmb.postgresql.test.db=${DB_NAME} -Dmb.postgresql.test.user=${DB_USER} -Dmb.postgresql.test.password=${DB_PASSWORD}
39+
-Dmb.postgresql.test.host=localhost -Dmb.postgresql.test.port=${MB_DB_PORT} -Dmb.postgresql.test.db=${MB_DB_DBNAME} -Dmb.postgresql.test.user=${MB_DB_USER} -Dmb.postgresql.test.password=${MB_DB_PASS}
1540
1641
Clojure pairs:
17-
:mb-postgresql-test-host "localhost" :mb-postgresql-test-port "${HOST_PORT}" :mb-postgresql-test-db "${DB_NAME}" :mb-postgresql-test-user "${DB_USER}" :mb-postgresql-test-password "${DB_PASSWORD}"
42+
:mb-postgresql-test-host "localhost" :mb-postgresql-test-port "${MB_DB_PORT}" :mb-postgresql-test-db "${MB_DB_DBNAME}" :mb-postgresql-test-user "${MB_DB_USER}" :mb-postgresql-test-password "${MB_DB_PASS}"
1843
1944
Bash variables:
20-
MB_POSTGRESQL_TEST_HOST=localhost MB_POSTGRESQL_TEST_PORT=${HOST_PORT} MB_POSTGRESQL_TEST_DB=${DB_NAME} MB_POSTGRESQL_TEST_USER=${DB_USER} MB_POSTGRESQL_TEST_PASSWORD=${DB_PASSWORD}
45+
MB_POSTGRESQL_TEST_HOST=localhost MB_POSTGRESQL_TEST_PORT=${MB_DB_PORT} MB_POSTGRESQL_TEST_DB=${MB_DB_DBNAME} MB_POSTGRESQL_TEST_USER=${MB_DB_USER} MB_POSTGRESQL_TEST_PASSWORD=${MB_DB_PASS}
2146
EOF
2247
}
2348

getenv.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash -euo pipefail
2+
3+
container_name="$1"
4+
shift
5+
6+
env_vars=$(docker inspect ${container_name} -f '{{range .Config.Env}}{{println .}}{{end}}')
7+
8+
output=""
9+
10+
for var_name in "$@"
11+
do
12+
env_var=$(echo "$env_vars" | grep "$var_name=")
13+
if [[ -z "$env_var" ]]; then
14+
echo "environment variable ${var_name} not found in the container ${container_name}" >&2
15+
return 1
16+
fi
17+
18+
export "$env_var"
19+
done

run-mariadb-latest.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
44

5-
MARIADB_VERSION=latest $SOURCE_DIR/_run-mariadb.sh
5+
MARIADB_BROAD_VERSION=latest MARIADB_VERSION=latest $SOURCE_DIR/_run-mariadb.sh

run-mariadb-oldest.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
55
MARIADB_VERSION=$(curl -s --request GET --url https://endoflife.date/api/mariadb.json |
66
jq -r --arg today $(date +%Y%m%d) 'map(select((.eol == false) or ((.eol | gsub("-";"") | tonumber) > ($today | tonumber)))) | min_by(.cycle) | .cycle')
77

8-
MARIADB_VERSION=$MARIADB_VERSION $SOURCE_DIR/_run-mariadb.sh
8+
MARIADB_BROAD_VERSION=oldest MARIADB_VERSION=$MARIADB_VERSION $SOURCE_DIR/_run-mariadb.sh

run-mysql-latest.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
44

5-
MYSQL_VERSION=latest $SOURCE_DIR/_run-mysql.sh
5+
MYSQL_BROAD_VERSION=latest MYSQL_VERSION=latest $SOURCE_DIR/_run-mysql.sh

run-mysql-oldest.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
55
MYSQL_VERSION=$(curl -s --request GET --url https://endoflife.date/api/mysql.json |
66
jq -r --arg today $(date +%Y%m%d) 'map(select((.eol == false) or ((.eol | gsub("-";"") | tonumber) > ($today | tonumber)))) | min_by(.cycle) | .cycle')
77

8-
MYSQL_VERSION=$MYSQL_VERSION $SOURCE_DIR/_run-mysql.sh
8+
MYSQL_BROAD_VERSION=oldest MYSQL_VERSION=$MYSQL_VERSION $SOURCE_DIR/_run-mysql.sh

run-postgres-latest.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
44

5-
PG_VERSION=latest $SOURCE_DIR/_run-postgres.sh
5+
PG_BROAD_VERSION=latest PG_VERSION=latest $SOURCE_DIR/_run-postgres.sh

run-postgres-oldest.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
55
PG_VERSION=$(curl -s --request GET --url https://endoflife.date/api/postgresql.json |
66
jq -r --arg today $(date +%Y%m%d) 'map(select((.eol == false) or ((.eol | gsub("-";"") | tonumber) > ($today | tonumber)))) | min_by(.cycle) | .cycle')
77

8-
PG_VERSION=$PG_VERSION $SOURCE_DIR/_run-postgres.sh
8+
PG_BROAD_VERSION=oldest PG_VERSION=$PG_VERSION $SOURCE_DIR/_run-postgres.sh

0 commit comments

Comments
 (0)