Skip to content

toolbox: Update with scripts to ease db check/migration

Antoine R. Dumont requested to merge update-toolbox-with-scripts into production

This includes a bump in the toolbox image version (which includes the swh.storage deps now).

minikube tests happy:

swh@swh-toolbox-849c67c66b-6l2ls:~$ ls -lah /etc/swh/config-*
-rw-r--r-- 1 root root 107 Sep 12 15:20 /etc/swh/config-scheduler.yml
-rw-r--r-- 1 root root 106 Sep 12 15:20 /etc/swh/config-storage.yml
swh@swh-toolbox-849c67c66b-6l2ls:~$ cat /etc/swh/config-*

scheduler:
  cls: postgresql
  db: host=db1.i.s.s.n port=5432 user=swh dbname=swh-scheduler password=test

storage:
 - cls: postgresql
  db: host=db1.i.s.s.n port=5432 user=swh dbname=swh-scheduler password=test
swh@swh-toolbox-849c67c66b-6l2ls:~$ ls -lah bin/
total 7.0K
drwxrwxrwx 3 root root 10 Sep 12 15:20 .
drwxr-xr-x 1 swh  swh   4 Sep 12 15:24 ..
drwxr-xr-x 2 root root  8 Sep 12 15:20 ..2023_09_12_15_20_47.2192295155
lrwxrwxrwx 1 root root 32 Sep 12 15:20 ..data -> ..2023_09_12_15_20_47.2192295155
lrwxrwxrwx 1 root root 26 Sep 12 15:20 check-db-version.sh -> ..data/check-db-version.sh
lrwxrwxrwx 1 root root 36 Sep 12 15:20 check-scheduler-db-version.sh -> ..data/check-scheduler-db-version.sh
lrwxrwxrwx 1 root root 34 Sep 12 15:20 check-storage-db-version.sh -> ..data/check-storage-db-version.sh
lrwxrwxrwx 1 root root 28 Sep 12 15:20 migrate-db-version.sh -> ..data/migrate-db-version.sh
lrwxrwxrwx 1 root root 38 Sep 12 15:20 migrate-scheduler-db-version.sh -> ..data/migrate-scheduler-db-version.sh
lrwxrwxrwx 1 root root 36 Sep 12 15:20 migrate-storage-db-version.sh -> ..data/migrate-storage-db-version.sh
swh@swh-toolbox-849c67c66b-6l2ls:~$ head bin/check-db-version.sh
#!/bin/bash

set -eu

TEMP_FILE=/tmp/db-version.txt

MODULE=$1
CODE_VERSION=${2-""}
DB_VERSION=${3-""}

swh@swh-toolbox-849c67c66b-6l2ls:~$ head bin/migrate-db-version.sh
#!/bin/bash

set -eu

TEMP_FILE=/tmp/db-version.txt

MODULE=$1
CODE_VERSION=${2-""}

if [ -z ${MODULE} ]; then
swh@swh-toolbox-849c67c66b-6l2ls:~$ head bin/migrate-scheduler-db-version.sh
#!/bin/bash

set -eu

/opt/swh/bin/migrate-db-version.sh scheduler
swh@swh-toolbox-849c67c66b-6l2ls:~$ head bin/migrate-storage-db-version.sh
#!/bin/bash

set -eu

/opt/swh/bin/migrate-db-version.sh storage

Refs. swh/infra/sysadm-environment#5034 (closed)

Edited by Antoine R. Dumont

Merge request reports

Loading