kartoza/docker-postgis

Bug in documentation pertaining to lock file location?

lewismc opened this issue · 5 comments

What is the bug or the crash?

Thanks for publishing this project, it is fantastic and has saved us a lot of time. Excellent work 🥇

I have a question regarding the location of the lock file and the corresponding documentation. The documentation states

Additionally, a lock file is generated in /docker-entrypoint-initdb.d, which will ...

This appears to be incorrect. Instead the lock file is created in /docker-entrypoint.initdb.d. Can someone please confirm?

Additionally, the documentation then goes on to state

which will prevent the scripts from getting executed after the first container startup. Provide IGNORE_INIT_HOOK_LOCKFILE=true to execute the scripts on every container start.

I have found this setting to NOT have any effect. Regardless of whether I configure my docker-compose with this setting or not. Can someone also verify this?

Thanks again.

Steps to reproduce the issue

  1. Build and run a container
  2. docker exec -it ${container_id} /bin/bash
  3. cat /docker-entrypoint-initdb.d # note you will NOT see the lock file
  4. cat /docker-entrypoint.initdb.d # note you WILL see the lock file

Versions

kartoza/postgis:15-3.3

Additional context

No response

Ideally I do wish to execute a script once and only once the very first time I run the image. Right now the script is being executed every time I run the image.
Relevant code block from docker-compose.yml

Can you try to set the following env variable like

SCRIPTS_LOCKFILE_DIR=/opt/data/

and then mount a volume to that location

-v lockfiles:/opt/data/

@lewismc does this still occur even after my suggestion?

Hi @NyakudyaA apologies for my delayed answer and thank you for assisting with this one.
I am glad to repor that yes your suggestion DOES fix the issue. The mounted SQL script is only executed once the first time around. The lockfile now resides in the correct location /docker-entrypoint-initdb.d/tagbase_schema.sql and also the lockfile exists at /opt/data/.entry_point.lock.
Thank you sincerely for your assistance.
Do you want me to provide a PR to augment the documentation or are you happy with it as is? Thank you again 👍

@lewismc feel free to submit a pull request to improve the documentation about the lock file situation