bitnami / charts

Bitnami Helm Charts
https://bitnami.com
Other
9.02k stars 9.22k forks source link

Inconsistencies between docker-entrypoint-initdb.d and docker-entrypoint-init.d #9360

Closed mamiu closed 1 year ago

mamiu commented 2 years ago

Name and Version

bitnami/wordpress:13.0.22 (and probably many other charts as well)

What steps will reproduce the bug?

@carrodher Sorry for bothering you once more with this (after mentioning you in this comment), but I've seen that you've been involved in a few issues in different projects regarding the docker-entrypoint-initdb.d container scripts topic.

Actually I'm a bit confused right now after researching that whole docker-entrypoint-init.d and docker-entrypoint-initdb.d thing.

First of all I couldn't find any type of documentation around it, so I guess it's not an official Docker feature but just a convention or something like that, am I right?

Secondly what is the difference between the docker-entrypoint-init.d and docker-entrypoint-initdb.d folders? I can see that both versions (the one with db and the one without) are used many times in several different Bitnami repositories, but I can't tell the difference and when to use which one. Is there a rule?

As an example: If I use the Bitnami WordPress Helm Chart with the bitnami-docker-wordpress-nginx image and pass a script to customPostInitScripts like that:

customPostInitScripts:
  init-script.sh: |
    #!/bin/bash
    echo "do something"

... the logs say that there are No custom scripts in /docker-entrypoint-initdb.d because there are none in the /docker-entrypoint-initdb.d folder but in the /docker-entrypoint-init.d folder (without db), because of this part in the WordPress Helm Chart config:

{{- if or .Values.customPostInitScripts .Values.wordpressConfigureCache }}
- mountPath: /docker-entrypoint-init.d
  name: custom-postinit
{{- end }}

Just search for docker-entrypoint-initdb.d and docker-entrypoint-init.d in different Bitnami repositories like for example this one (the Bitnami Helm Charts repo):

When to use which and why are they sometimes incompatible (like in the example above)?


BTW, here's the full WordPress NGINX container launch log:

wordpress 06:18:36.10
wordpress 06:18:36.11 Welcome to the Bitnami wordpress-nginx container
wordpress 06:18:36.11 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-wordpress-nginx
wordpress 06:18:36.11 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-wordpress-nginx/issues
wordpress 06:18:36.11
wordpress 06:18:36.11 INFO  ==> ** Starting WordPress setup **
wordpress 06:18:36.13 INFO  ==> Validating settings in NGINX_* env vars
wordpress 06:18:36.14 INFO  ==> No custom scripts in /docker-entrypoint-initdb.d
wordpress 06:18:36.14 INFO  ==> Initializing NGINX
realpath: /bitnami/nginx/conf/vhosts: No such file or directory
wordpress 06:18:36.17 INFO  ==> Configuring PHP options
wordpress 06:18:36.18 INFO  ==> Validating settings in MYSQL_CLIENT_* env vars
wordpress 06:18:36.28 INFO  ==> Restoring persisted WordPress installation
wordpress 06:18:36.73 INFO  ==> Trying to connect to the database server
wordpress 06:18:37.49 INFO  ==> ** WordPress setup finished! **

wordpress 06:18:37.50 INFO  ==> Starting PHP-FPM...
wordpress 06:18:37.50 INFO  ==> Starting NGINX...
wordpress 06:18:37.51 INFO  ==> ** Starting PHP-FPM **
wordpress 06:18:37.51 INFO  ==> ** Starting NGINX **

Are you using any custom parameters or values?

Yes, customPostInitScripts. See above.

What is the expected behavior?

To get customPostInitScripts to work across all Bitnami docker images.

What do you see instead?

See above.

Additional information

No response

carrodher commented 2 years ago

Thanks for creating this issue, please note the combination of Bitnami WordPress Helm Chart with the bitnami-docker-wordpress-nginx container image is not supported out of the box.

The Bitnami WordPress Helm Chart is designed to work with the regular bitnami-docker-wordpress container image which uses Apache as the webserver.

Apart from that, I just redirected this ticket to the team to clarify other open questions.

mamiu commented 2 years ago

Thanks for redirecting this ticket to your team members.

And yes, I'm aware that the NGINX image is not the official one and that it's marked as "Community supported solution". It was just an example where I discovered this inconsistency, but it's likely that other applications are affected by this as well.

I've tried to find more about the origin of the docker-entrypoint-initdb.d and docker-entrypoint-init.d folders and it seems like a non-obligatory, non-documented, community-derived convention.

The earliest usage I could find are:

After that other docker images (mainly databases) adopted this style of extendibility to their docker images. According to Google search results docker-entrypoint-initdb.d (mostly used by databases) is found ~30 times more often than docker-entrypoint-init.d (mostly used by non-databases) which might explain the incompatibility for some charts and images.

In case you are planning to change all occurrences to make them consistent, it also might make sense to think about the name of this folder, because this repository is all about Helm charts and therefore deployments in Kubernetes environments. And since Kubernetes isn't using Docker by default (and soon doesn't even support it) anymore a rename of this folder would certainly be justified. BTW: It's not just Kubernetes, but the whole container community is more and more moving away from Docker.

juan131 commented 2 years ago

Hi @mamiu

Thank you for the detailed analysis.

I agree with you 100%, this is something that was adopted from other projects and then, we've been replicating (copy-pasting and adapting the logic to support custom scripts) through the many containers in the Bitnami catalog. However, I don't think we didn't pay attention to the differences between initdb.d vs initd.d.

I'll proceed to create an internal task to evaluate what we want to consider "the standard" and apply it through the whole catalog.

mamiu commented 2 years ago

@juan131 Thanks a lot for taking this on.

And you're right, I couldn't find any problem with current Bitnami charts. So it's probably only if somebody wants to use a different image that uses the other custom scripts folder name (e.g. init.d instead of initdb.d) as it happened in my case (the example from above).

If you need any help let me know.

carrodher commented 1 year ago

After some internal discussion and due to other priorities we didn't find the bandwidth to work on this feature during the last months and it is very unlikely that we can find it in the short term. Because of that, we will proceed to close this ticket unless there is a contribution from the community regarding this topic.