From 3b155a9f32ded1439fa1f1540c670ec0e5c6c61b Mon Sep 17 00:00:00 2001 From: asdfsx Date: Thu, 9 Jan 2025 11:24:44 +0800 Subject: [PATCH 1/2] update mssql to 22-latest --- Dockerfile | 3 +-- README.md | 4 ++-- root/setup-db-for-moodle.sh | 2 +- root/wait-for-mssql-to-come-up.sh | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index ed8f784..83a2dbd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ -FROM mcr.microsoft.com/mssql/server:2019-CU22-ubuntu-20.04 - +FROM mcr.microsoft.com/mssql/server:2022-latest # Starting with SQL*Server 2017-CU6, by default, flushing became # more aggresive, in order to guarantee consistency under power diff --git a/README.md b/README.md index 231c40f..65945b8 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A Microsoft SQL Server for Linux instance configured for Moodle development. Bas # Example usage ```bash -docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -d moodlehq/moodle-db-mssql +docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -d moodlehq/moodle-db-mssql ``` # Features: @@ -17,7 +17,7 @@ docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:143 Requires the following environment flags: * ACCEPT_EULA=Y -* SA_PASSWORD= +* MSSQL_SA_PASSWORD= # See also This container is part of a set of containers for Moodle development, see also: diff --git a/root/setup-db-for-moodle.sh b/root/setup-db-for-moodle.sh index 034f7bb..42d8f41 100755 --- a/root/setup-db-for-moodle.sh +++ b/root/setup-db-for-moodle.sh @@ -5,5 +5,5 @@ set -e ./wait-for-mssql-to-come-up.sh echo "[moodle-db-mssql] Setting up Moodle data" -/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $SA_PASSWORD -d master -i setup.sql +/opt/mssql-tools18/bin/sqlcmd -No -S localhost -U sa -P $MSSQL_SA_PASSWORD -d master -i setup.sql echo "[moodle-db-mssql] Setup complete." diff --git a/root/wait-for-mssql-to-come-up.sh b/root/wait-for-mssql-to-come-up.sh index 707b664..27ae27d 100755 --- a/root/wait-for-mssql-to-come-up.sh +++ b/root/wait-for-mssql-to-come-up.sh @@ -3,7 +3,7 @@ set -e i=0 -until /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$SA_PASSWORD" -d master -l 1 -Q "SELECT 1" > /dev/null 2>&1 +until /opt/mssql-tools18/bin/sqlcmd -No -S localhost -U sa -P "$MSSQL_SA_PASSWORD" -d master -l 1 -Q "SELECT 1" > /dev/null 2>&1 do echo "[moodle-db-mssql] Waiting for SQL to accept connections" sleep 1 From f82a908ef7552c8e60aef7aa2270039d878291e0 Mon Sep 17 00:00:00 2001 From: asdfsx Date: Thu, 9 Jan 2025 13:40:06 +0800 Subject: [PATCH 2/2] update waiting script --- root/wait-for-mssql-to-come-up.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/root/wait-for-mssql-to-come-up.sh b/root/wait-for-mssql-to-come-up.sh index 27ae27d..da879ed 100755 --- a/root/wait-for-mssql-to-come-up.sh +++ b/root/wait-for-mssql-to-come-up.sh @@ -6,10 +6,10 @@ i=0 until /opt/mssql-tools18/bin/sqlcmd -No -S localhost -U sa -P "$MSSQL_SA_PASSWORD" -d master -l 1 -Q "SELECT 1" > /dev/null 2>&1 do echo "[moodle-db-mssql] Waiting for SQL to accept connections" - sleep 1 + sleep 10 i=$((i+1)) - if [ $i -gt 60 ]; then + if [ $i -gt ${MSSQL_WAIT4READY:-60} ]; then echo "[moodle-db-mssql] timed out waiting for server to accept connections" exit 1; fi