Skip to content

docker-entrypoint.sh: Docker entrypoint user management fix, log improvements, and bats testing - #9830

Merged
elianddb merged 23 commits into
mainfrom
elian/dbvr-tests
Sep 17, 2025
Merged

elianddb merged 23 commits into
mainfrom
elian/dbvr-tests

Conversation

@elianddb

@elianddb elianddb commented Sep 11, 2025 •

Copy link
Copy Markdown
Contributor

Companion dolthub/go-mysql-server#3217

The Docker entry point script now properly creates and configures root and custom users with appropriate host restrictions, and validates environment variables with detailed error messages. Additionally, there is proper handling of reserved keywords in database and user names.

Added comprehensive test coverage for authentication flows, user creation, and configuration handling to ensure reliability.

2025-09-15 17:30:42+00:00 [Note] [Entrypoint]: Entrypoint script for Dolt Server 1.59.8 starting...
2025-09-15 17:30:42+00:00 [Warn] [Entrypoint]: No files found in /docker-entrypoint-initdb.d/ to process
2025-09-15 17:30:42+00:00 [Note] [Entrypoint]: Starting Dolt server in background...
2025-09-15 17:30:42+00:00 [Note] [Entrypoint]: Server initialization complete!
2025-09-15 17:30:42+00:00 [Note] [Entrypoint]: Ensuring root@% superuser exists with password
2025-09-15 17:30:42+00:00 [Note] [Entrypoint]: Configuring root@% user
2025-09-15 17:30:42+00:00 [Note] [Entrypoint]: Creating database 'test'
2025-09-15 17:30:42+00:00 [Note] [Entrypoint]: Creating user 'elian'
2025-09-15 17:30:43+00:00 [Note] [Entrypoint]: Granting server access to user 'elian'
2025-09-15 17:30:43+00:00 [Note] [Entrypoint]: Giving user 'elian' access to schema 'test'
2025-09-15 17:30:44+00:00 [Note] [Entrypoint]: Current users in the system:
+---------------------+-----------+
| User                | Host      |
+---------------------+-----------+
| event_scheduler     | localhost |
| root                | %         |
| __dolt_local_user__ | localhost |
| elian               | %         |
+---------------------+-----------+
2025-09-15 17:30:44+00:00 [Note] [Entrypoint]: Reattaching to server process...
Starting server with Config HP="0.0.0.0:3306"|T="28800000"|R="false"|L="info"
time="2025-09-15T17:30:42Z" level=info msg="Overriding root user host with value from DOLT_ROOT_HOST: %"
time="2025-09-15T17:30:42Z" level=info msg="Overriding root user password with value from DOLT_ROOT_PASSWORD"
time="2025-09-15T17:30:42Z" level=info msg="Creating root@% superuser"
time="2025-09-15T17:30:42Z" level=info msg="Server ready. Accepting connections."

You may not be familiar with the latest version no. of Dolt, so we've added the latest keyword as an option for DOLT_VERSION when building a custom Docker image.

docker build -f docker/serverDockerfile --build-arg DOLT_VERSION=latest -t dolt-sql-server:latest .

We've also added new parameters MYSQL_USER_HOST and DOLT_USER_HOST to, you guessed it, specify the host for your custom user! Otherwise, it'll use the ROOT_USER_HOST, or default to localhost if neither parameter is provided.

docker run
-e DOLT_ROOT_PASSWORD=secret2
-e DOLT_USER=testname
-e DOLT_PASSWORD=testpass
-e DOLT_USER_HOST=%
-p 3307:3306 dolthub/dolt-sql-server:latest

The Docker build now supports building from local source code instead of downloading pre-built binaries. This is useful for development, testing local changes, and custom builds.

# Build from local source code (requires workspace directory with source dependencies)
docker build -f dolt/docker/serverDockerfile --build-arg DOLT_VERSION=source -t dolt-sql-server:source .

@elianddb
elianddb force-pushed the elian/dbvr-tests branch 2 times, most recently from ee95611 to dc38004 Compare September 11, 2025 21:17
@elianddb elianddb changed the title add bats testing for docker entrypoint and amend root user creation docker-entrypoint.sh: Docker entrypoint user management fix, log improvements, and bats testing Sep 11, 2025
@elianddb
elianddb force-pushed the elian/dbvr-tests branch 3 times, most recently from 95c8fda to 4279a32 Compare September 16, 2025 00:22
@coffeegoddd

Copy link
Copy Markdown
Contributor

@elianddb DOLT

comparing_percentages
100.000000 to 100.000000
version result total
4279a32 ok 5937471
version total_tests
4279a32 5937471
correctness_percentage
100.0

@coffeegoddd

Copy link
Copy Markdown
Contributor

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
0be1abf ok 5937471
version total_tests
0be1abf 5937471
correctness_percentage
100.0

@elianddb
elianddb force-pushed the elian/dbvr-tests branch 3 times, most recently from ad5644c to 69c294c Compare September 16, 2025 17:16
@coffeegoddd

Copy link
Copy Markdown
Contributor

@elianddb DOLT

comparing_percentages
100.000000 to 100.000000
version result total
69c294c ok 5937471
version total_tests
69c294c 5937471
correctness_percentage
100.0

@coffeegoddd

Copy link
Copy Markdown
Contributor

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
758bbbd ok 5937471
version total_tests
758bbbd 5937471
correctness_percentage
100.0

@elianddb
elianddb force-pushed the elian/dbvr-tests branch 2 times, most recently from d550162 to 1cab68a Compare September 16, 2025 21:35
@coffeegoddd

Copy link
Copy Markdown
Contributor

@elianddb DOLT

comparing_percentages
100.000000 to 100.000000
version result total
1cab68a ok 5937471
version total_tests
1cab68a 5937471
correctness_percentage
100.0

@coffeegoddd

Copy link
Copy Markdown
Contributor

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
90d7a18 ok 5937471
version total_tests
90d7a18 5937471
correctness_percentage
100.0

@coffeegoddd

Copy link
Copy Markdown
Contributor

@elianddb DOLT

comparing_percentages
100.000000 to 100.000000
version result total
aafdd97 ok 5937471
version total_tests
aafdd97 5937471
correctness_percentage
100.0

@coffeegoddd

Copy link
Copy Markdown
Contributor

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
af23d7a ok 5937471
version total_tests
af23d7a 5937471
correctness_percentage
100.0

@elianddb
elianddb force-pushed the elian/dbvr-tests branch 2 times, most recently from 77fe07e to bc9b0cc Compare September 17, 2025 16:39
@coffeegoddd

Copy link
Copy Markdown
Contributor

@elianddb DOLT

comparing_percentages
100.000000 to 100.000000
version result total
bc9b0cc ok 5937471
version total_tests
bc9b0cc 5937471
correctness_percentage
100.0

@coffeegoddd

Copy link
Copy Markdown
Contributor

@coffeegoddd DOLT

comparing_percentages
100.000000 to 100.000000
version result total
011b2cd ok 5937471
version total_tests
011b2cd 5937471
correctness_percentage
100.0

@elianddb
elianddb marked this pull request as ready for review September 17, 2025 17:25
@elianddb
elianddb requested a review from fulghum September 17, 2025 18:51

@fulghum fulghum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Great thinking to get these tests in place! 👏

@coffeegoddd

Copy link
Copy Markdown
Contributor

@elianddb DOLT

comparing_percentages
100.000000 to 100.000000
version result total
011b2cd ok 5937471
version total_tests
011b2cd 5937471
correctness_percentage
100.0

@elianddb
elianddb merged commit 89749ff into main Sep 17, 2025
@Hydrocharged
Hydrocharged deleted the elian/dbvr-tests branch December 15, 2025 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants