psi-4ward / docker-powerdns

PowerDNS Docker Image based on Alpine
107 stars 110 forks source link

Custom SQL hook #27

Closed BlaM closed 5 years ago

BlaM commented 5 years ago

Can you add a custom SQL "initialization" hook into entrypoint.sh?

Background: Currently when starting entrypoint.sh will execute schema.sql and then immediately start pdns. In my use case I need to add some entries into the supermasters table between DB initialization and service start.

So far my options are to replace either entrypoint.sh or schema.sql in my own Dockerfile. As soon as I do that and you update your Image I would then risk overwriting an improved file with a file based on an older version.

Can you include something like this in your script?

if [ -f "/etc/pdns/post-schema.sql" ]; then
  cat /etc/pdns/post-schema.sql | $MYSQLCMD
fi

... immediately after "sending" schema.sql to MySQL?

I would then be able to just add a post-schema.sql that would be triggered on database init.

psi-4ward commented 5 years ago

Pls give it a try