Skip to content

Commit acf731d

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 acf731d

13 files changed

+152
-69
lines changed

Diff for: _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

Diff for: _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

Diff for: _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

Diff for: env-mariadb.sh

+29-9
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,46 @@
11
#! /usr/bin/env bash
22

3-
set -euo pipefail
3+
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
4+
cd "$(dirname "$0")"
45

5-
CONTAINER_NAME=mb-mariadb-db
6-
HOST_PORT=3307
7-
DB_NAME=metabase_test
8-
DB_USER=root
6+
# oldest or latest
7+
container=mb-mariadb-db-${1:-$MARIADB_BROAD_VERSION}
8+
port=$(docker port ${container} 3306/tcp | cut -d: -f2)
9+
source ${SOURCE_DIR}/getenv.sh ${container} MYSQL_USER MYSQL_DATABASE
10+
11+
export DRIVERS=mysql
12+
export MB_DB_TYPE=mysql
13+
export MB_DB_DBNAME=${MYSQL_DATABASE}
14+
export MB_DB_HOST=127.0.0.1
15+
export MB_DB_PASS=
16+
export MB_DB_PORT=${port}
17+
export MB_DB_USER=${MYSQL_USER}
18+
19+
export MB_MYSQL_TEST_USER=${MB_DB_USER}
20+
export MB_MYSQL_TEST_PASSWORD=
21+
export MB_MYSQL_TEST_DBNAME=${MYSQL_DATABASE}
22+
export MB_MYSQL_TEST_HOST=${MB_DB_HOST}
23+
export MB_MYSQL_TEST_PORT=${MB_DB_PORT}
24+
25+
export MYSQL_HOST=${MB_DB_HOST}
26+
export MYSQL_PORT=${MB_DB_PORT}
27+
export MYSQL_USER=${MB_DB_USER}
28+
export MYSQL_PASSWORD=
29+
export MYSQL_DATABASE=${MYSQL_DATABASE}
930

1031
function print-mariadb-vars() {
1132
cat <<EOF
1233
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=
34+
-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=
1435
1536
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 ""
37+
: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 ""
1738
1839
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=''
40+
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=''
2041
EOF
2142
}
2243

2344
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
2445
print-mariadb-vars
2546
fi
26-

Diff for: env-mysql.sh

+27-9
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,44 @@
11
#! /usr/bin/env bash
2+
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
3+
cd "$(dirname "$0")"
24

3-
set -euo pipefail
5+
container=mb-mysql-db-${1:-$MYSQL_BROAD_VERSION}
6+
port=$(docker port ${container} 3306/tcp | cut -d: -f2)
7+
source ${SOURCE_DIR}/getenv.sh ${container} MYSQL_DATABASE MYSQL_USER
48

5-
CONTAINER_NAME=mb-mysql-db
6-
HOST_PORT=3306
7-
DB_NAME=metabase_test
8-
DB_USER=root
9+
export DRIVERS=mysql
10+
export MB_DB_TYPE=mysql
11+
export MB_DB_DBNAME=${MYSQL_DATABASE}
12+
export MB_DB_HOST=127.0.0.1
13+
export MB_DB_PASS=
14+
export MB_DB_PORT=${port}
15+
export MB_DB_USER=${MYSQL_USER}
16+
17+
export MB_MYSQL_TEST_USER=${MB_DB_USER}
18+
export MB_MYSQL_TEST_PASSWORD=
19+
export MB_MYSQL_TEST_DBNAME=${MYSQL_DATABASE}
20+
export MB_MYSQL_TEST_HOST=${MB_DB_HOST}
21+
export MB_MYSQL_TEST_PORT=${MB_DB_PORT}
22+
23+
export MYSQL_HOST=${MB_DB_HOST}
24+
export MYSQL_PORT=${MB_DB_PORT}
25+
export MYSQL_USER=${MB_DB_USER}
26+
export MYSQL_PASSWORD=
27+
export MYSQL_DATABASE=${MYSQL_DATABASE}
928

1029
function print-mysql-vars() {
1130
cat <<EOF
1231
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=
32+
-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=
1433
1534
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 ""
35+
: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 ""
1736
1837
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=''
38+
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=''
2039
EOF
2140
}
2241

2342
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
2443
print-mysql-vars
2544
fi
26-

Diff for: env-postgres.sh

+30-10
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,43 @@
1-
#! /usr/bin/env bash
1+
#!/usr/bin/env bash
22

3-
set -euo pipefail
3+
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
4+
cd "$(dirname "$0")"
45

5-
CONTAINER_NAME=mb-postgres-db
6-
HOST_PORT=${PGSQL_PORT:-5432}
7-
DB_NAME=metabase
8-
DB_USER=metabase
9-
DB_PASSWORD=password
6+
# `oldest` or `latest`
7+
container=mb-postgres-db-${1:-$PG_BROAD_VERSION}
8+
port=$(docker port ${container} 5432/tcp | cut -d: -f2)
9+
source ${SOURCE_DIR}/getenv.sh ${container} POSTGRES_USER POSTGRES_DB POSTGRES_PASSWORD
10+
11+
export DRIVERS=postgres
12+
export MB_DB_TYPE=postgres
13+
export MB_DB_DBNAME=${POSTGRES_DB}
14+
export MB_DB_HOST=127.0.0.1
15+
export MB_DB_PASS=${POSTGRES_PASSWORD}
16+
export MB_DB_PORT=${port}
17+
export MB_DB_USER=${POSTGRES_USER}
18+
19+
export MB_POSTGRESQL_TEST_USER=${MB_DB_USER}
20+
export MB_POSTGRESQL_TEST_PASSWORD=${MB_DB_PASS}
21+
export MB_POSTGRESQL_TEST_DBNAME=${MB_DB_DBNAME}
22+
export MB_POSTGRESQL_TEST_HOST=${MB_DB_HOST}
23+
export MB_POSTGRESQL_TEST_PORT=${MB_DB_PORT}
24+
25+
export PGHOST=${MB_DB_HOST}
26+
export PGPORT=${MB_DB_PORT}
27+
export PGUSER=${MB_DB_USER}
28+
export PGPASSWORK=${MB_DB_PASS}
29+
export PGDATABASE=${MB_DB_DBNAME}
1030

1131
function print-postgres-vars() {
1232
cat <<EOF
1333
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}
34+
-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}
1535
1636
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}"
37+
: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}"
1838
1939
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}
40+
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}
2141
EOF
2242
}
2343

Diff for: 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

Diff for: 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

Diff for: 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

Diff for: 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

Diff for: 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

Diff for: 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

Diff for: 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)