Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-entrypoint.sh—get_config_file_path_if_exists—.$CONFIG_DIR makes path relative #4866

Closed
almereyda opened this issue Nov 28, 2022 · 4 comments
Assignees
Labels
bug Something isn't working docker

Comments

@almereyda
Copy link

almereyda commented Nov 28, 2022

In

number_of_files_found=( `find .$CONFIG_DIR -type f -name "*.$FILE_TYPE" | wc -l` )

there is a check for a variable $CONFIG_DIR that contains an absolute path, and it is prefixed with a little, tiny ., which renders the path a relative path, and which can only succeed when the volume mount is put into the unknown place.

version: "3.8"

services:
  server:
    image: dolthub/dolt-sql-server:latest
    volumes:
    - "${PWD}/.state/dolt-sql-server:/var/lib/dolt"
    - "${PWD}/.state/dolt-servercfg.d:/etc/dolt/servercfg.d"
    - "${PWD}/.state/dolt-doltcfg.d:/etc/dolt/doltcfg.d"
server_1  | 2022-11-28 14:31:10+00:00 [Note] [Entrypoint]: Entrypoint script for Dolt Server 0.51.5 starting.
server_1  | 2022-11-28 14:31:10+00:00 [Note] [Entrypoint]: Checking for config provided in /etc/dolt/doltcfg.d
server_1  | find: './etc/dolt/doltcfg.d': No such file or directory
dolt_server_1 exited with code 1

This dot appears to be a sibling of the regex to the right of it of the same line, and could have been easily overlooked.

It boots up fine with a patched entrypoint:

wget https://github.com/dolthub/dolt/raw/84c9ee2e977da58b09976f988c851e5b03254015/docker/docker-entrypoint.sh -O docker-entrypoint.sh.84c9ee2e
cp docker-entrypoint.sh.84c9ee2e docker-entrypoint.sh
sed -i 's/find \.$CONFIG_DIR/find $CONFIG_DIR/g' docker-entrypoint.sh
chmod u+x docker-entrypoint.sh
16a17
>     - "${PWD}/docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh"
$ docker-compose up                  
Recreating dolt_server_1 ... done
Attaching to dolt_server_1
server_1  | 2022-11-28 15:01:47+00:00 [Note] [Entrypoint]: Entrypoint script for Dolt Server 0.51.5 starting.
server_1  | 2022-11-28 15:01:47+00:00 [Note] [Entrypoint]: Checking for config provided in /etc/dolt/servercfg.d
server_1  | 2022-11-28 15:01:47+00:00 [Note] [Entrypoint]: Running init scripts
server_1  | 
server_1  | 2022-11-28 15:01:47+00:00 [Warn] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
server_1  | Starting server with Config HP="0.0.0.0:3306"|T="28800000"|R="false"|L="info"
@fulghum
Copy link
Contributor

fulghum commented Nov 28, 2022

Hey @almereyda, thanks for taking the time to report this. Assigning this one to @jennifersp to take a look at today.

@almereyda
Copy link
Author

All you will need is

sed -i 's/find \.$CONFIG_DIR/find $CONFIG_DIR/g' docker-entrypoint.sh

to run against this repository, and commit.

@fulghum
Copy link
Contributor

fulghum commented Nov 28, 2022

amazing! thank you @almereyda! 🙏 We'll take care of this today.

@timsehn timsehn added bug Something isn't working docker labels Nov 28, 2022
@jennifersp
Copy link
Contributor

Hey @almereyda, thank you for catching this issue! I merged in the fix, it will be used and published on Dockerhub in the next Dolt release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docker
Projects
None yet
Development

No branches or pull requests

4 participants