From faba08d3430a7c5247012e6538b99365ab3050c1 Mon Sep 17 00:00:00 2001 From: David Gomez Date: Tue, 10 Dec 2024 09:42:37 +0100 Subject: [PATCH] [bitnami/*] Support only the latest LTS branch Signed-off-by: David Gomez --- bitnami/aspnet-core/9/README.md | 5 + bitnami/aspnet-core/9/debian-12/Dockerfile | 61 - .../9/debian-12/docker-compose.yml | 12 - .../opt/bitnami/.bitnami_components.json | 8 - .../prebuildfs/opt/bitnami/base/functions | 123 - .../prebuildfs/opt/bitnami/base/helpers | 42 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../bitnami/scripts/aspnet-core/entrypoint.sh | 12 - .../bitnami/scripts/aspnet-core/postunpack.sh | 13 - .../aspnet-core/9/debian-12/tags-info.yaml | 5 - bitnami/aws-cli/1/README.md | 5 + bitnami/aws-cli/1/debian-12/Dockerfile | 57 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/aws-cli/1/debian-12/tags-info.yaml | 4 - bitnami/cassandra/4.0/README.md | 5 + bitnami/cassandra/4.0/debian-12/Dockerfile | 66 - .../4.0/debian-12/docker-compose-cluster.yml | 40 - .../4.0/debian-12/docker-compose.yml | 18 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/cassandra-env.sh | 260 -- .../bitnami/scripts/cassandra/entrypoint.sh | 33 - .../bitnami/scripts/cassandra/postunpack.sh | 40 - .../opt/bitnami/scripts/cassandra/run.sh | 68 - .../opt/bitnami/scripts/cassandra/setup.sh | 34 - .../opt/bitnami/scripts/java/entrypoint.sh | 19 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../opt/bitnami/scripts/libcassandra.sh | 1319 ---------- .../cassandra/4.0/debian-12/tags-info.yaml | 4 - bitnami/cassandra/4.1/README.md | 5 + bitnami/cassandra/4.1/debian-12/Dockerfile | 66 - .../4.1/debian-12/docker-compose-cluster.yml | 40 - .../4.1/debian-12/docker-compose.yml | 18 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/cassandra-env.sh | 264 -- .../bitnami/scripts/cassandra/entrypoint.sh | 33 - .../bitnami/scripts/cassandra/postunpack.sh | 40 - .../opt/bitnami/scripts/cassandra/run.sh | 68 - .../opt/bitnami/scripts/cassandra/setup.sh | 34 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../opt/bitnami/scripts/libcassandra.sh | 1319 ---------- .../cassandra/4.1/debian-12/tags-info.yaml | 4 - bitnami/clickhouse/24.3/README.md | 5 + bitnami/clickhouse/24.3/debian-12/Dockerfile | 60 - .../24.3/debian-12/docker-compose.yml | 15 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/clickhouse-env.sh | 83 - .../bitnami/scripts/clickhouse/entrypoint.sh | 34 - .../bitnami/scripts/clickhouse/postunpack.sh | 84 - .../opt/bitnami/scripts/clickhouse/run.sh | 30 - .../opt/bitnami/scripts/clickhouse/setup.sh | 33 - .../opt/bitnami/scripts/libclickhouse.sh | 284 --- .../clickhouse/24.3/debian-12/tags-info.yaml | 4 - bitnami/clickhouse/24.8/README.md | 5 + bitnami/clickhouse/24.8/debian-12/Dockerfile | 60 - .../24.8/debian-12/docker-compose.yml | 15 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/clickhouse-env.sh | 83 - .../bitnami/scripts/clickhouse/entrypoint.sh | 34 - .../bitnami/scripts/clickhouse/postunpack.sh | 84 - .../opt/bitnami/scripts/clickhouse/run.sh | 30 - .../opt/bitnami/scripts/clickhouse/setup.sh | 33 - .../opt/bitnami/scripts/libclickhouse.sh | 284 --- .../clickhouse/24.8/debian-12/tags-info.yaml | 4 - bitnami/contour/1.28/README.md | 5 + bitnami/contour/1.28/debian-12/Dockerfile | 55 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/contour/1.28/debian-12/tags-info.yaml | 4 - bitnami/contour/1.29/README.md | 5 + bitnami/contour/1.29/debian-12/Dockerfile | 55 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/contour/1.29/debian-12/tags-info.yaml | 4 - bitnami/dotnet-sdk/9/README.md | 5 + bitnami/dotnet-sdk/9/debian-12/Dockerfile | 60 - .../dotnet-sdk/9/debian-12/docker-compose.yml | 12 - .../opt/bitnami/.bitnami_components.json | 8 - .../prebuildfs/opt/bitnami/base/functions | 123 - .../prebuildfs/opt/bitnami/base/helpers | 42 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../bitnami/scripts/dotnet-sdk/entrypoint.sh | 12 - .../bitnami/scripts/dotnet-sdk/postunpack.sh | 13 - bitnami/dotnet-sdk/9/debian-12/tags-info.yaml | 5 - bitnami/dotnet/9/README.md | 5 + bitnami/dotnet/9/debian-12/Dockerfile | 60 - bitnami/dotnet/9/debian-12/docker-compose.yml | 12 - .../opt/bitnami/.bitnami_components.json | 8 - .../prebuildfs/opt/bitnami/base/functions | 123 - .../prebuildfs/opt/bitnami/base/helpers | 42 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/dotnet/entrypoint.sh | 12 - .../opt/bitnami/scripts/dotnet/postunpack.sh | 13 - bitnami/dotnet/9/debian-12/tags-info.yaml | 5 - bitnami/drupal/10/README.md | 5 + bitnami/drupal/10/debian-12/Dockerfile | 70 - .../drupal/10/debian-12/docker-compose.yml | 34 - .../opt/bitnami/.bitnami_components.json | 38 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/apache/conf/deflate.conf | 5 - .../apache/conf/vhosts/00_status-vhost.conf | 7 - .../rootfs/opt/bitnami/scripts/apache-env.sh | 81 - .../scripts/apache-modphp/postunpack.sh | 43 - .../app-generic-http-vhost.conf.tpl | 7 - .../app-generic-https-vhost.conf.tpl | 10 - .../app-generic-prefix.conf.tpl | 1 - .../bitnami-templates/app-http-vhost.conf.tpl | 15 - .../app-https-vhost.conf.tpl | 18 - .../bitnami-templates/app-prefix.conf.tpl | 9 - .../app-proxy-http-vhost.conf.tpl | 11 - .../app-proxy-https-vhost.conf.tpl | 14 - .../app-proxy-prefix.conf.tpl | 11 - .../app-ruby-passenger-http-vhost.conf.tpl | 16 - .../app-ruby-passenger-https-vhost.conf.tpl | 19 - .../app-ruby-passenger-prefix.conf.tpl | 9 - .../bitnami-templates/bitnami-ssl.conf.tpl | 29 - .../apache/bitnami-templates/bitnami.conf.tpl | 17 - .../opt/bitnami/scripts/apache/entrypoint.sh | 35 - .../opt/bitnami/scripts/apache/postunpack.sh | 132 - .../opt/bitnami/scripts/apache/reload.sh | 20 - .../opt/bitnami/scripts/apache/restart.sh | 19 - .../rootfs/opt/bitnami/scripts/apache/run.sh | 20 - .../opt/bitnami/scripts/apache/setup.sh | 98 - .../opt/bitnami/scripts/apache/start.sh | 34 - .../opt/bitnami/scripts/apache/status.sh | 23 - .../rootfs/opt/bitnami/scripts/apache/stop.sh | 34 - .../rootfs/opt/bitnami/scripts/drupal-env.sh | 120 - .../opt/bitnami/scripts/drupal/entrypoint.sh | 33 - .../opt/bitnami/scripts/drupal/postunpack.sh | 68 - .../opt/bitnami/scripts/drupal/setup.sh | 38 - .../rootfs/opt/bitnami/scripts/libapache.sh | 808 ------ .../rootfs/opt/bitnami/scripts/libdrupal.sh | 548 ---- .../opt/bitnami/scripts/libmysqlclient.sh | 1046 -------- .../rootfs/opt/bitnami/scripts/libphp.sh | 265 -- .../opt/bitnami/scripts/mysql-client-env.sh | 128 - .../scripts/mysql-client/postunpack.sh | 21 - .../opt/bitnami/scripts/mysql-client/setup.sh | 21 - .../rootfs/opt/bitnami/scripts/php-env.sh | 91 - .../opt/bitnami/scripts/php/postunpack.sh | 47 - .../rootfs/opt/bitnami/scripts/php/reload.sh | 37 - .../rootfs/opt/bitnami/scripts/php/restart.sh | 19 - .../rootfs/opt/bitnami/scripts/php/run.sh | 21 - .../rootfs/opt/bitnami/scripts/php/setup.sh | 34 - .../rootfs/opt/bitnami/scripts/php/start.sh | 34 - .../rootfs/opt/bitnami/scripts/php/status.sh | 23 - .../rootfs/opt/bitnami/scripts/php/stop.sh | 34 - .../10/debian-12/rootfs/post-init.d/php.sh | 33 - .../10/debian-12/rootfs/post-init.d/shell.sh | 38 - .../debian-12/rootfs/post-init.d/sql-mysql.sh | 48 - .../drupal/10/debian-12/rootfs/post-init.sh | 25 - bitnami/drupal/10/debian-12/tags-info.yaml | 4 - bitnami/elasticsearch/7/README.md | 5 + bitnami/elasticsearch/7/debian-12/Dockerfile | 66 - .../7/debian-12/docker-compose-cluster.yml | 44 - .../7/debian-12/docker-compose.yml | 14 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/elasticsearch-env.sh | 258 -- .../scripts/elasticsearch/entrypoint.sh | 47 - .../scripts/elasticsearch/healthcheck.sh | 18 - .../scripts/elasticsearch/postunpack.sh | 49 - .../opt/bitnami/scripts/elasticsearch/run.sh | 35 - .../bitnami/scripts/elasticsearch/setup.sh | 35 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../opt/bitnami/scripts/libelasticsearch.sh | 932 ------- .../elasticsearch/7/debian-12/tags-info.yaml | 4 - bitnami/envoy/1.29/README.md | 5 + bitnami/envoy/1.29/debian-12/Dockerfile | 55 - .../1.29/debian-12/docker-compose-testing.yml | 16 - .../envoy/1.29/debian-12/docker-compose.yml | 6 - .../1.29/debian-12/examples/frontend.yaml | 58 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/envoy/1.29/debian-12/tags-info.yaml | 4 - bitnami/envoy/1.30/README.md | 5 + bitnami/envoy/1.30/debian-12/Dockerfile | 55 - .../1.30/debian-12/docker-compose-testing.yml | 16 - .../envoy/1.30/debian-12/docker-compose.yml | 6 - .../1.30/debian-12/examples/frontend.yaml | 58 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/envoy/1.30/debian-12/tags-info.yaml | 4 - bitnami/envoy/1.31/README.md | 5 + bitnami/envoy/1.31/debian-12/Dockerfile | 55 - .../1.31/debian-12/docker-compose-testing.yml | 16 - .../envoy/1.31/debian-12/docker-compose.yml | 6 - .../1.31/debian-12/examples/frontend.yaml | 58 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/envoy/1.31/debian-12/tags-info.yaml | 4 - bitnami/etcd/3.4/README.md | 5 + bitnami/etcd/3.4/debian-12/Dockerfile | 62 - .../3.4/debian-12/docker-compose-cluster.yml | 40 - bitnami/etcd/3.4/debian-12/docker-compose.yml | 13 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/etcd-env.sh | 117 - .../opt/bitnami/scripts/etcd/entrypoint.sh | 37 - .../opt/bitnami/scripts/etcd/healthcheck.sh | 35 - .../opt/bitnami/scripts/etcd/postunpack.sh | 27 - .../opt/bitnami/scripts/etcd/prestop.sh | 31 - .../rootfs/opt/bitnami/scripts/etcd/run.sh | 42 - .../rootfs/opt/bitnami/scripts/etcd/setup.sh | 26 - .../opt/bitnami/scripts/etcd/snapshot.sh | 40 - .../rootfs/opt/bitnami/scripts/libetcd.sh | 832 ------- bitnami/etcd/3.4/debian-12/tags-info.yaml | 4 - bitnami/express/4/README.md | 5 + bitnami/express/4/debian-12/Dockerfile | 60 - .../4/debian-12/docker-compose-mariadb.yml | 25 - .../4/debian-12/docker-compose-postgresql.yml | 25 - .../express/4/debian-12/docker-compose.yml | 24 - .../opt/bitnami/.bitnami_components.json | 26 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../4/debian-12/rootfs/dist/.dockerignore | 4 - .../4/debian-12/rootfs/dist/.gitignore | 1 - .../4/debian-12/rootfs/dist/Dockerfile.tpl | 24 - .../debian-12/rootfs/dist/samples/mariadb.js | 19 - .../debian-12/rootfs/dist/samples/mongodb.js | 20 - .../rootfs/opt/bitnami/scripts/express-env.sh | 79 - .../opt/bitnami/scripts/express/entrypoint.sh | 29 - .../opt/bitnami/scripts/express/postunpack.sh | 22 - .../opt/bitnami/scripts/express/setup.sh | 22 - .../rootfs/opt/bitnami/scripts/libexpress.sh | 187 -- .../4/debian-12/rootfs/post-init.d/shell.sh | 38 - .../express/4/debian-12/rootfs/post-init.sh | 25 - bitnami/express/4/debian-12/tags-info.yaml | 4 - bitnami/fluent-bit/2/README.md | 5 + bitnami/fluent-bit/2/debian-12/Dockerfile | 59 - .../fluent-bit/2/debian-12/docker-compose.yml | 8 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/fluent-bit/2/debian-12/tags-info.yaml | 4 - bitnami/golang/1.22/README.md | 5 + bitnami/golang/1.22/debian-12/Dockerfile | 54 - .../golang/1.22/debian-12/docker-compose.yml | 8 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/golang/1.22/debian-12/tags-info.yaml | 4 - bitnami/grafana/10/README.md | 5 + bitnami/grafana/10/debian-12/Dockerfile | 61 - .../grafana/10/debian-12/docker-compose.yml | 15 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/grafana-env.sh | 95 - .../opt/bitnami/scripts/grafana/entrypoint.sh | 55 - .../opt/bitnami/scripts/grafana/postunpack.sh | 78 - .../rootfs/opt/bitnami/scripts/grafana/run.sh | 42 - .../opt/bitnami/scripts/grafana/setup.sh | 32 - .../rootfs/opt/bitnami/scripts/libgrafana.sh | 387 --- .../10/debian-12/rootfs/post-init.d/shell.sh | 38 - .../grafana/10/debian-12/rootfs/post-init.sh | 25 - bitnami/grafana/10/debian-12/tags-info.yaml | 4 - bitnami/haproxy/2/README.md | 5 + bitnami/haproxy/2/debian-12/Dockerfile | 55 - .../2/debian-12/docker-compose-testing.yml | 14 - .../haproxy/2/debian-12/docker-compose.yml | 6 - .../haproxy/2/debian-12/examples/frontend.cfg | 31 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/haproxy/2/debian-12/tags-info.yaml | 4 - .../hyperledger-fabric-orderer/2/README.md | 5 + .../2/debian-12/Dockerfile | 58 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../2/debian-12/tags-info.yaml | 4 - bitnami/hyperledger-fabric-peer/2/README.md | 5 + .../2/debian-12/Dockerfile | 58 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../2/debian-12/tags-info.yaml | 4 - bitnami/hyperledger-fabric-tools/2/README.md | 5 + .../2/debian-12/Dockerfile | 55 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../2/debian-12/tags-info.yaml | 4 - bitnami/jaeger/1/README.md | 5 + bitnami/jaeger/1/debian-12/Dockerfile | 55 - bitnami/jaeger/1/debian-12/docker-compose.yml | 20 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/jaeger/1/debian-12/tags-info.yaml | 4 - bitnami/java/1.8/README.md | 5 + bitnami/java/1.8/debian-12/Dockerfile | 66 - bitnami/java/1.8/debian-12/docker-compose.yml | 12 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 19 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../scripts/locales/add-extra-locales.sh | 46 - bitnami/java/1.8/debian-12/tags-info.yaml | 4 - bitnami/java/11/README.md | 5 + bitnami/java/11/debian-12/Dockerfile | 66 - bitnami/java/11/debian-12/docker-compose.yml | 12 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 19 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../scripts/locales/add-extra-locales.sh | 46 - bitnami/java/11/debian-12/tags-info.yaml | 4 - bitnami/java/17/README.md | 5 + bitnami/java/17/debian-12/Dockerfile | 66 - bitnami/java/17/debian-12/docker-compose.yml | 12 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 19 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../scripts/locales/add-extra-locales.sh | 46 - bitnami/java/17/debian-12/tags-info.yaml | 4 - bitnami/java/22/README.md | 5 + bitnami/java/22/debian-12/Dockerfile | 66 - bitnami/java/22/debian-12/docker-compose.yml | 12 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 19 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../scripts/locales/add-extra-locales.sh | 46 - bitnami/java/22/debian-12/tags-info.yaml | 5 - bitnami/jupyter-base-notebook/4/README.md | 5 + .../4/debian-12/Dockerfile | 57 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../4/debian-12/tags-info.yaml | 4 - bitnami/jupyterhub/4/README.md | 5 + bitnami/jupyterhub/4/debian-12/Dockerfile | 55 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/jupyterhub/4/debian-12/tags-info.yaml | 5 - bitnami/kafka/3.4/README.md | 5 + bitnami/kafka/3.4/debian-12/Dockerfile | 66 - .../3.4/debian-12/docker-compose-cluster.yml | 78 - .../kafka/3.4/debian-12/docker-compose.yml | 24 - .../opt/bitnami/.bitnami_components.json | 26 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/kafka-env.sh | 121 - .../opt/bitnami/scripts/kafka/entrypoint.sh | 29 - .../opt/bitnami/scripts/kafka/postunpack.sh | 46 - .../rootfs/opt/bitnami/scripts/kafka/run.sh | 32 - .../rootfs/opt/bitnami/scripts/kafka/setup.sh | 60 - .../rootfs/opt/bitnami/scripts/libkafka.sh | 1176 --------- bitnami/kafka/3.4/debian-12/tags-info.yaml | 4 - bitnami/kafka/3.5/README.md | 5 + bitnami/kafka/3.5/debian-12/Dockerfile | 66 - .../3.5/debian-12/docker-compose-cluster.yml | 78 - .../kafka/3.5/debian-12/docker-compose.yml | 24 - .../opt/bitnami/.bitnami_components.json | 26 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/kafka-env.sh | 121 - .../opt/bitnami/scripts/kafka/entrypoint.sh | 29 - .../opt/bitnami/scripts/kafka/postunpack.sh | 46 - .../rootfs/opt/bitnami/scripts/kafka/run.sh | 32 - .../rootfs/opt/bitnami/scripts/kafka/setup.sh | 60 - .../rootfs/opt/bitnami/scripts/libkafka.sh | 1176 --------- bitnami/kafka/3.5/debian-12/tags-info.yaml | 4 - bitnami/kafka/3.6/README.md | 5 + bitnami/kafka/3.6/debian-12/Dockerfile | 66 - .../3.6/debian-12/docker-compose-cluster.yml | 78 - .../kafka/3.6/debian-12/docker-compose.yml | 24 - .../opt/bitnami/.bitnami_components.json | 26 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/kafka-env.sh | 121 - .../opt/bitnami/scripts/kafka/entrypoint.sh | 29 - .../opt/bitnami/scripts/kafka/postunpack.sh | 46 - .../rootfs/opt/bitnami/scripts/kafka/run.sh | 32 - .../rootfs/opt/bitnami/scripts/kafka/setup.sh | 60 - .../rootfs/opt/bitnami/scripts/libkafka.sh | 1176 --------- bitnami/kafka/3.6/debian-12/tags-info.yaml | 4 - bitnami/kafka/3.7/README.md | 5 + bitnami/kafka/3.7/debian-12/Dockerfile | 66 - .../3.7/debian-12/docker-compose-cluster.yml | 78 - .../kafka/3.7/debian-12/docker-compose.yml | 24 - .../opt/bitnami/.bitnami_components.json | 26 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/kafka-env.sh | 121 - .../opt/bitnami/scripts/kafka/entrypoint.sh | 29 - .../opt/bitnami/scripts/kafka/postunpack.sh | 46 - .../rootfs/opt/bitnami/scripts/kafka/run.sh | 32 - .../rootfs/opt/bitnami/scripts/kafka/setup.sh | 60 - .../rootfs/opt/bitnami/scripts/libkafka.sh | 1176 --------- bitnami/kafka/3.7/debian-12/tags-info.yaml | 4 - bitnami/kafka/3.8/README.md | 5 + bitnami/kafka/3.8/debian-12/Dockerfile | 66 - .../3.8/debian-12/docker-compose-cluster.yml | 78 - .../kafka/3.8/debian-12/docker-compose.yml | 24 - .../opt/bitnami/.bitnami_components.json | 26 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/kafka-env.sh | 121 - .../opt/bitnami/scripts/kafka/entrypoint.sh | 29 - .../opt/bitnami/scripts/kafka/postunpack.sh | 46 - .../rootfs/opt/bitnami/scripts/kafka/run.sh | 32 - .../rootfs/opt/bitnami/scripts/kafka/setup.sh | 60 - .../rootfs/opt/bitnami/scripts/libkafka.sh | 1176 --------- bitnami/kafka/3.8/debian-12/tags-info.yaml | 4 - bitnami/keycloak/25/README.md | 5 + bitnami/keycloak/25/debian-12/Dockerfile | 63 - .../keycloak/25/debian-12/docker-compose.yml | 24 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 19 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../opt/bitnami/scripts/keycloak-env.sh | 198 -- .../bitnami/scripts/keycloak/entrypoint.sh | 35 - .../bitnami/scripts/keycloak/postunpack.sh | 31 - .../opt/bitnami/scripts/keycloak/run.sh | 46 - .../opt/bitnami/scripts/keycloak/setup.sh | 28 - .../rootfs/opt/bitnami/scripts/libkeycloak.sh | 357 --- bitnami/keycloak/25/debian-12/tags-info.yaml | 4 - bitnami/kibana/7/README.md | 5 + bitnami/kibana/7/debian-12/Dockerfile | 59 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/kibana-env.sh | 182 -- .../opt/bitnami/scripts/kibana/entrypoint.sh | 48 - .../opt/bitnami/scripts/kibana/postunpack.sh | 41 - .../rootfs/opt/bitnami/scripts/kibana/run.sh | 26 - .../opt/bitnami/scripts/kibana/setup.sh | 32 - .../rootfs/opt/bitnami/scripts/libkibana.sh | 540 ---- bitnami/kibana/7/debian-12/tags-info.yaml | 4 - bitnami/kong-ingress-controller/2/README.md | 5 + .../2/debian-12/Dockerfile | 56 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../2/debian-12/tags-info.yaml | 4 - bitnami/ksql/7.4/README.md | 5 + bitnami/ksql/7.4/debian-12/Dockerfile | 61 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/ksql-env.sh | 71 - .../opt/bitnami/scripts/ksql/entrypoint.sh | 29 - .../opt/bitnami/scripts/ksql/postunpack.sh | 73 - .../rootfs/opt/bitnami/scripts/ksql/run.sh | 28 - .../rootfs/opt/bitnami/scripts/ksql/setup.sh | 31 - .../rootfs/opt/bitnami/scripts/libksql.sh | 230 -- bitnami/ksql/7.4/debian-12/tags-info.yaml | 4 - bitnami/ksql/7.5/README.md | 5 + bitnami/ksql/7.5/debian-12/Dockerfile | 61 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/ksql-env.sh | 71 - .../opt/bitnami/scripts/ksql/entrypoint.sh | 29 - .../opt/bitnami/scripts/ksql/postunpack.sh | 73 - .../rootfs/opt/bitnami/scripts/ksql/run.sh | 28 - .../rootfs/opt/bitnami/scripts/ksql/setup.sh | 31 - .../rootfs/opt/bitnami/scripts/libksql.sh | 230 -- bitnami/ksql/7.5/debian-12/tags-info.yaml | 4 - bitnami/ksql/7.6/README.md | 5 + bitnami/ksql/7.6/debian-12/Dockerfile | 61 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/ksql-env.sh | 71 - .../opt/bitnami/scripts/ksql/entrypoint.sh | 29 - .../opt/bitnami/scripts/ksql/postunpack.sh | 73 - .../rootfs/opt/bitnami/scripts/ksql/run.sh | 28 - .../rootfs/opt/bitnami/scripts/ksql/setup.sh | 31 - .../rootfs/opt/bitnami/scripts/libksql.sh | 230 -- bitnami/ksql/7.6/debian-12/tags-info.yaml | 4 - bitnami/ksql/7.7/README.md | 5 + bitnami/ksql/7.7/debian-12/Dockerfile | 61 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/ksql-env.sh | 71 - .../opt/bitnami/scripts/ksql/entrypoint.sh | 29 - .../opt/bitnami/scripts/ksql/postunpack.sh | 73 - .../rootfs/opt/bitnami/scripts/ksql/run.sh | 28 - .../rootfs/opt/bitnami/scripts/ksql/setup.sh | 31 - .../rootfs/opt/bitnami/scripts/libksql.sh | 230 -- bitnami/ksql/7.7/debian-12/tags-info.yaml | 4 - bitnami/kubectl/1.29/README.md | 5 + bitnami/kubectl/1.29/debian-12/Dockerfile | 57 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/kubectl/1.29/debian-12/tags-info.yaml | 4 - bitnami/kubectl/1.30/README.md | 5 + bitnami/kubectl/1.30/debian-12/Dockerfile | 57 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/kubectl/1.30/debian-12/tags-info.yaml | 4 - bitnami/kubescape/3.0.3/README.md | 5 + bitnami/kubescape/3.0.3/debian-12/Dockerfile | 56 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/kubescape-env.sh | 30 - .../bitnami/scripts/kubescape/entrypoint.sh | 26 - .../bitnami/scripts/kubescape/postunpack.sh | 29 - .../opt/bitnami/scripts/libkubescape.sh | 204 -- .../kubescape/3.0.3/debian-12/tags-info.yaml | 4 - bitnami/laravel/10/README.md | 5 + bitnami/laravel/10/debian-12/Dockerfile | 64 - .../prebuildfs/build/bitnami-user.sh | 8 - .../opt/bitnami/.bitnami_components.json | 32 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/laravel-env.sh | 86 - .../opt/bitnami/scripts/laravel/entrypoint.sh | 31 - .../opt/bitnami/scripts/laravel/postunpack.sh | 22 - .../rootfs/opt/bitnami/scripts/laravel/run.sh | 26 - .../opt/bitnami/scripts/laravel/setup.sh | 25 - .../rootfs/opt/bitnami/scripts/liblaravel.sh | 104 - .../rootfs/opt/bitnami/scripts/libphp.sh | 265 -- .../rootfs/opt/bitnami/scripts/php-env.sh | 91 - .../opt/bitnami/scripts/php/postunpack.sh | 47 - .../rootfs/opt/bitnami/scripts/php/reload.sh | 37 - .../rootfs/opt/bitnami/scripts/php/restart.sh | 19 - .../rootfs/opt/bitnami/scripts/php/run.sh | 21 - .../rootfs/opt/bitnami/scripts/php/setup.sh | 34 - .../rootfs/opt/bitnami/scripts/php/start.sh | 34 - .../rootfs/opt/bitnami/scripts/php/status.sh | 23 - .../rootfs/opt/bitnami/scripts/php/stop.sh | 34 - .../10/debian-12/rootfs/post-init.d/php.sh | 33 - .../10/debian-12/rootfs/post-init.d/shell.sh | 38 - .../laravel/10/debian-12/rootfs/post-init.sh | 25 - bitnami/laravel/10/debian-12/tags-info.yaml | 4 - bitnami/logstash/7/README.md | 5 + bitnami/logstash/7/debian-12/Dockerfile | 66 - .../7/debian-12/docker-compose-testing.yml | 15 - .../logstash/7/debian-12/docker-compose.yml | 13 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/liblogstash.sh | 379 --- .../opt/bitnami/scripts/logstash-env.sh | 125 - .../bitnami/scripts/logstash/entrypoint.sh | 42 - .../bitnami/scripts/logstash/postunpack.sh | 71 - .../opt/bitnami/scripts/logstash/run.sh | 44 - .../opt/bitnami/scripts/logstash/setup.sh | 27 - bitnami/logstash/7/debian-12/tags-info.yaml | 4 - bitnami/mariadb-galera/10.11/README.md | 5 + .../mariadb-galera/10.11/debian-12/Dockerfile | 61 - .../10.11/debian-12/docker-compose-ldap.yml | 47 - .../10.11/debian-12/docker-compose.yml | 26 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/libldapclient.sh | 222 -- .../opt/bitnami/scripts/libmariadbgalera.sh | 2211 ----------------- .../rootfs/opt/bitnami/scripts/mariadb-env.sh | 264 -- .../scripts/mariadb-galera/entrypoint.sh | 34 - .../scripts/mariadb-galera/healthcheck.sh | 18 - .../scripts/mariadb-galera/postunpack.sh | 45 - .../opt/bitnami/scripts/mariadb-galera/run.sh | 50 - .../bitnami/scripts/mariadb-galera/setup.sh | 48 - .../10.11/debian-12/tags-info.yaml | 4 - bitnami/mariadb-galera/10.5/README.md | 5 + .../mariadb-galera/10.5/debian-12/Dockerfile | 61 - .../10.5/debian-12/docker-compose-ldap.yml | 47 - .../10.5/debian-12/docker-compose.yml | 26 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/libldapclient.sh | 222 -- .../opt/bitnami/scripts/libmariadbgalera.sh | 2211 ----------------- .../rootfs/opt/bitnami/scripts/mariadb-env.sh | 264 -- .../scripts/mariadb-galera/entrypoint.sh | 34 - .../scripts/mariadb-galera/healthcheck.sh | 18 - .../scripts/mariadb-galera/postunpack.sh | 45 - .../opt/bitnami/scripts/mariadb-galera/run.sh | 50 - .../bitnami/scripts/mariadb-galera/setup.sh | 48 - .../10.5/debian-12/tags-info.yaml | 4 - bitnami/mariadb-galera/10.6/README.md | 5 + .../mariadb-galera/10.6/debian-12/Dockerfile | 61 - .../10.6/debian-12/docker-compose-ldap.yml | 47 - .../10.6/debian-12/docker-compose.yml | 26 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/libldapclient.sh | 222 -- .../opt/bitnami/scripts/libmariadbgalera.sh | 2211 ----------------- .../rootfs/opt/bitnami/scripts/mariadb-env.sh | 264 -- .../scripts/mariadb-galera/entrypoint.sh | 34 - .../scripts/mariadb-galera/healthcheck.sh | 18 - .../scripts/mariadb-galera/postunpack.sh | 45 - .../opt/bitnami/scripts/mariadb-galera/run.sh | 50 - .../bitnami/scripts/mariadb-galera/setup.sh | 48 - .../10.6/debian-12/tags-info.yaml | 4 - bitnami/mariadb-galera/11.2/README.md | 5 + .../mariadb-galera/11.2/debian-12/Dockerfile | 61 - .../11.2/debian-12/docker-compose-ldap.yml | 47 - .../11.2/debian-12/docker-compose.yml | 26 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/libldapclient.sh | 222 -- .../opt/bitnami/scripts/libmariadbgalera.sh | 2211 ----------------- .../rootfs/opt/bitnami/scripts/mariadb-env.sh | 264 -- .../scripts/mariadb-galera/entrypoint.sh | 34 - .../scripts/mariadb-galera/healthcheck.sh | 18 - .../scripts/mariadb-galera/postunpack.sh | 45 - .../opt/bitnami/scripts/mariadb-galera/run.sh | 50 - .../bitnami/scripts/mariadb-galera/setup.sh | 48 - .../11.2/debian-12/tags-info.yaml | 4 - bitnami/mariadb-galera/11.5/README.md | 5 + .../mariadb-galera/11.5/debian-12/Dockerfile | 61 - .../11.5/debian-12/docker-compose-ldap.yml | 47 - .../11.5/debian-12/docker-compose.yml | 26 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/libldapclient.sh | 222 -- .../opt/bitnami/scripts/libmariadbgalera.sh | 2211 ----------------- .../rootfs/opt/bitnami/scripts/mariadb-env.sh | 264 -- .../scripts/mariadb-galera/entrypoint.sh | 34 - .../scripts/mariadb-galera/healthcheck.sh | 18 - .../scripts/mariadb-galera/postunpack.sh | 45 - .../opt/bitnami/scripts/mariadb-galera/run.sh | 50 - .../bitnami/scripts/mariadb-galera/setup.sh | 48 - .../11.5/debian-12/tags-info.yaml | 4 - bitnami/mariadb-galera/11.6/README.md | 5 + .../mariadb-galera/11.6/debian-12/Dockerfile | 61 - .../11.6/debian-12/docker-compose-ldap.yml | 47 - .../11.6/debian-12/docker-compose.yml | 26 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/libldapclient.sh | 222 -- .../opt/bitnami/scripts/libmariadbgalera.sh | 2211 ----------------- .../rootfs/opt/bitnami/scripts/mariadb-env.sh | 264 -- .../scripts/mariadb-galera/entrypoint.sh | 34 - .../scripts/mariadb-galera/healthcheck.sh | 18 - .../scripts/mariadb-galera/postunpack.sh | 45 - .../opt/bitnami/scripts/mariadb-galera/run.sh | 50 - .../bitnami/scripts/mariadb-galera/setup.sh | 48 - .../11.6/debian-12/tags-info.yaml | 4 - bitnami/mariadb/10.11/README.md | 5 + bitnami/mariadb/10.11/debian-12/Dockerfile | 61 - .../debian-12/docker-compose-replication.yml | 49 - .../10.11/debian-12/docker-compose.yml | 22 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libmariadb.sh | 1417 ----------- .../rootfs/opt/bitnami/scripts/mariadb-env.sh | 180 -- .../opt/bitnami/scripts/mariadb/entrypoint.sh | 34 - .../bitnami/scripts/mariadb/healthcheck.sh | 18 - .../opt/bitnami/scripts/mariadb/postunpack.sh | 37 - .../rootfs/opt/bitnami/scripts/mariadb/run.sh | 41 - .../opt/bitnami/scripts/mariadb/setup.sh | 40 - .../mariadb/10.11/debian-12/tags-info.yaml | 4 - bitnami/mariadb/10.5/README.md | 5 + bitnami/mariadb/10.5/debian-12/Dockerfile | 61 - .../debian-12/docker-compose-replication.yml | 49 - .../mariadb/10.5/debian-12/docker-compose.yml | 22 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libmariadb.sh | 1417 ----------- .../rootfs/opt/bitnami/scripts/mariadb-env.sh | 180 -- .../opt/bitnami/scripts/mariadb/entrypoint.sh | 34 - .../bitnami/scripts/mariadb/healthcheck.sh | 18 - .../opt/bitnami/scripts/mariadb/postunpack.sh | 37 - .../rootfs/opt/bitnami/scripts/mariadb/run.sh | 41 - .../opt/bitnami/scripts/mariadb/setup.sh | 40 - bitnami/mariadb/10.5/debian-12/tags-info.yaml | 4 - bitnami/mariadb/10.6/README.md | 5 + bitnami/mariadb/10.6/debian-12/Dockerfile | 61 - .../debian-12/docker-compose-replication.yml | 49 - .../mariadb/10.6/debian-12/docker-compose.yml | 22 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libmariadb.sh | 1417 ----------- .../rootfs/opt/bitnami/scripts/mariadb-env.sh | 180 -- .../opt/bitnami/scripts/mariadb/entrypoint.sh | 34 - .../bitnami/scripts/mariadb/healthcheck.sh | 18 - .../opt/bitnami/scripts/mariadb/postunpack.sh | 37 - .../rootfs/opt/bitnami/scripts/mariadb/run.sh | 41 - .../opt/bitnami/scripts/mariadb/setup.sh | 40 - bitnami/mariadb/10.6/debian-12/tags-info.yaml | 4 - bitnami/mariadb/11.2/README.md | 5 + bitnami/mariadb/11.2/debian-12/Dockerfile | 61 - .../debian-12/docker-compose-replication.yml | 49 - .../mariadb/11.2/debian-12/docker-compose.yml | 22 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libmariadb.sh | 1417 ----------- .../rootfs/opt/bitnami/scripts/mariadb-env.sh | 180 -- .../opt/bitnami/scripts/mariadb/entrypoint.sh | 34 - .../bitnami/scripts/mariadb/healthcheck.sh | 18 - .../opt/bitnami/scripts/mariadb/postunpack.sh | 37 - .../rootfs/opt/bitnami/scripts/mariadb/run.sh | 41 - .../opt/bitnami/scripts/mariadb/setup.sh | 40 - bitnami/mariadb/11.2/debian-12/tags-info.yaml | 4 - bitnami/mariadb/11.5/README.md | 5 + bitnami/mariadb/11.5/debian-12/Dockerfile | 61 - .../debian-12/docker-compose-replication.yml | 49 - .../mariadb/11.5/debian-12/docker-compose.yml | 22 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libmariadb.sh | 1417 ----------- .../rootfs/opt/bitnami/scripts/mariadb-env.sh | 180 -- .../opt/bitnami/scripts/mariadb/entrypoint.sh | 34 - .../bitnami/scripts/mariadb/healthcheck.sh | 18 - .../opt/bitnami/scripts/mariadb/postunpack.sh | 37 - .../rootfs/opt/bitnami/scripts/mariadb/run.sh | 41 - .../opt/bitnami/scripts/mariadb/setup.sh | 40 - bitnami/mariadb/11.5/debian-12/tags-info.yaml | 4 - bitnami/mariadb/11.6/README.md | 5 + bitnami/mariadb/11.6/debian-12/Dockerfile | 61 - .../debian-12/docker-compose-replication.yml | 49 - .../mariadb/11.6/debian-12/docker-compose.yml | 22 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libmariadb.sh | 1417 ----------- .../rootfs/opt/bitnami/scripts/mariadb-env.sh | 180 -- .../opt/bitnami/scripts/mariadb/entrypoint.sh | 34 - .../bitnami/scripts/mariadb/healthcheck.sh | 18 - .../opt/bitnami/scripts/mariadb/postunpack.sh | 37 - .../rootfs/opt/bitnami/scripts/mariadb/run.sh | 41 - .../opt/bitnami/scripts/mariadb/setup.sh | 40 - bitnami/mariadb/11.6/debian-12/tags-info.yaml | 4 - bitnami/mongodb-sharded/7.0/README.md | 5 + .../mongodb-sharded/7.0/debian-12/Dockerfile | 65 - .../docker-compose-multiple-shards.yml | 154 -- .../7.0/debian-12/docker-compose.yml | 46 - .../opt/bitnami/.bitnami_components.json | 32 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../mongodb/templates/mongodb.conf.tpl | 52 - .../bitnami/mongodb/templates/mongos.conf.tpl | 38 - .../opt/bitnami/scripts/libmongodb-sharded.sh | 378 --- .../rootfs/opt/bitnami/scripts/libmongodb.sh | 1712 ------------- .../rootfs/opt/bitnami/scripts/mongodb-env.sh | 182 -- .../scripts/mongodb-sharded/entrypoint.sh | 36 - .../scripts/mongodb-sharded/postunpack.sh | 44 - .../bitnami/scripts/mongodb-sharded/run.sh | 46 - .../bitnami/scripts/mongodb-sharded/setup.sh | 45 - .../7.0/debian-12/tags-info.yaml | 4 - bitnami/mongodb/7.0/README.md | 5 + bitnami/mongodb/7.0/debian-12/Dockerfile | 63 - .../debian-12/docker-compose-replicaset.yml | 39 - .../mongodb/7.0/debian-12/docker-compose.yml | 14 - .../opt/bitnami/.bitnami_components.json | 32 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../mongodb/templates/mongodb.conf.tpl | 52 - .../rootfs/opt/bitnami/scripts/libmongodb.sh | 1712 ------------- .../rootfs/opt/bitnami/scripts/mongodb-env.sh | 166 -- .../opt/bitnami/scripts/mongodb/entrypoint.sh | 35 - .../opt/bitnami/scripts/mongodb/postunpack.sh | 44 - .../rootfs/opt/bitnami/scripts/mongodb/run.sh | 43 - .../opt/bitnami/scripts/mongodb/setup.sh | 47 - bitnami/mongodb/7.0/debian-12/tags-info.yaml | 4 - bitnami/moodle/4.1/README.md | 5 + bitnami/moodle/4.1/debian-12/Dockerfile | 79 - .../moodle/4.1/debian-12/docker-compose.yml | 39 - .../opt/bitnami/.bitnami_components.json | 44 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/apache/conf/deflate.conf | 5 - .../apache/conf/vhosts/00_status-vhost.conf | 7 - .../rootfs/opt/bitnami/scripts/apache-env.sh | 81 - .../scripts/apache-modphp/postunpack.sh | 43 - .../app-generic-http-vhost.conf.tpl | 7 - .../app-generic-https-vhost.conf.tpl | 10 - .../app-generic-prefix.conf.tpl | 1 - .../bitnami-templates/app-http-vhost.conf.tpl | 15 - .../app-https-vhost.conf.tpl | 18 - .../bitnami-templates/app-prefix.conf.tpl | 9 - .../app-proxy-http-vhost.conf.tpl | 11 - .../app-proxy-https-vhost.conf.tpl | 14 - .../app-proxy-prefix.conf.tpl | 11 - .../app-ruby-passenger-http-vhost.conf.tpl | 16 - .../app-ruby-passenger-https-vhost.conf.tpl | 19 - .../app-ruby-passenger-prefix.conf.tpl | 9 - .../bitnami-templates/bitnami-ssl.conf.tpl | 29 - .../apache/bitnami-templates/bitnami.conf.tpl | 17 - .../opt/bitnami/scripts/apache/entrypoint.sh | 35 - .../opt/bitnami/scripts/apache/postunpack.sh | 132 - .../opt/bitnami/scripts/apache/reload.sh | 20 - .../opt/bitnami/scripts/apache/restart.sh | 19 - .../rootfs/opt/bitnami/scripts/apache/run.sh | 20 - .../opt/bitnami/scripts/apache/setup.sh | 98 - .../opt/bitnami/scripts/apache/start.sh | 34 - .../opt/bitnami/scripts/apache/status.sh | 23 - .../rootfs/opt/bitnami/scripts/apache/stop.sh | 34 - .../rootfs/opt/bitnami/scripts/libapache.sh | 808 ------ .../rootfs/opt/bitnami/scripts/libmoodle.sh | 434 ---- .../opt/bitnami/scripts/libmysqlclient.sh | 1046 -------- .../rootfs/opt/bitnami/scripts/libphp.sh | 265 -- .../bitnami/scripts/libpostgresqlclient.sh | 424 ---- .../scripts/locales/add-extra-locales.sh | 46 - .../rootfs/opt/bitnami/scripts/moodle-env.sh | 128 - .../opt/bitnami/scripts/moodle/entrypoint.sh | 34 - .../opt/bitnami/scripts/moodle/postunpack.sh | 77 - .../rootfs/opt/bitnami/scripts/moodle/run.sh | 46 - .../opt/bitnami/scripts/moodle/setup.sh | 48 - .../opt/bitnami/scripts/mysql-client-env.sh | 128 - .../scripts/mysql-client/postunpack.sh | 21 - .../opt/bitnami/scripts/mysql-client/setup.sh | 21 - .../rootfs/opt/bitnami/scripts/php-env.sh | 91 - .../opt/bitnami/scripts/php/postunpack.sh | 47 - .../rootfs/opt/bitnami/scripts/php/reload.sh | 37 - .../rootfs/opt/bitnami/scripts/php/restart.sh | 19 - .../rootfs/opt/bitnami/scripts/php/run.sh | 21 - .../rootfs/opt/bitnami/scripts/php/setup.sh | 34 - .../rootfs/opt/bitnami/scripts/php/start.sh | 34 - .../rootfs/opt/bitnami/scripts/php/status.sh | 23 - .../rootfs/opt/bitnami/scripts/php/stop.sh | 34 - .../bitnami/scripts/postgresql-client-env.sh | 88 - .../scripts/postgresql-client/setup.sh | 21 - .../4.1/debian-12/rootfs/post-init.d/php.sh | 33 - .../4.1/debian-12/rootfs/post-init.d/shell.sh | 38 - .../debian-12/rootfs/post-init.d/sql-mysql.sh | 48 - .../moodle/4.1/debian-12/rootfs/post-init.sh | 25 - bitnami/moodle/4.1/debian-12/tags-info.yaml | 4 - bitnami/moodle/4.3/README.md | 5 + bitnami/moodle/4.3/debian-12/Dockerfile | 79 - .../moodle/4.3/debian-12/docker-compose.yml | 39 - .../opt/bitnami/.bitnami_components.json | 44 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/apache/conf/deflate.conf | 5 - .../apache/conf/vhosts/00_status-vhost.conf | 7 - .../rootfs/opt/bitnami/scripts/apache-env.sh | 81 - .../scripts/apache-modphp/postunpack.sh | 43 - .../app-generic-http-vhost.conf.tpl | 7 - .../app-generic-https-vhost.conf.tpl | 10 - .../app-generic-prefix.conf.tpl | 1 - .../bitnami-templates/app-http-vhost.conf.tpl | 15 - .../app-https-vhost.conf.tpl | 18 - .../bitnami-templates/app-prefix.conf.tpl | 9 - .../app-proxy-http-vhost.conf.tpl | 11 - .../app-proxy-https-vhost.conf.tpl | 14 - .../app-proxy-prefix.conf.tpl | 11 - .../app-ruby-passenger-http-vhost.conf.tpl | 16 - .../app-ruby-passenger-https-vhost.conf.tpl | 19 - .../app-ruby-passenger-prefix.conf.tpl | 9 - .../bitnami-templates/bitnami-ssl.conf.tpl | 29 - .../apache/bitnami-templates/bitnami.conf.tpl | 17 - .../opt/bitnami/scripts/apache/entrypoint.sh | 35 - .../opt/bitnami/scripts/apache/postunpack.sh | 132 - .../opt/bitnami/scripts/apache/reload.sh | 20 - .../opt/bitnami/scripts/apache/restart.sh | 19 - .../rootfs/opt/bitnami/scripts/apache/run.sh | 20 - .../opt/bitnami/scripts/apache/setup.sh | 98 - .../opt/bitnami/scripts/apache/start.sh | 34 - .../opt/bitnami/scripts/apache/status.sh | 23 - .../rootfs/opt/bitnami/scripts/apache/stop.sh | 34 - .../rootfs/opt/bitnami/scripts/libapache.sh | 808 ------ .../rootfs/opt/bitnami/scripts/libmoodle.sh | 434 ---- .../opt/bitnami/scripts/libmysqlclient.sh | 1046 -------- .../rootfs/opt/bitnami/scripts/libphp.sh | 265 -- .../bitnami/scripts/libpostgresqlclient.sh | 424 ---- .../scripts/locales/add-extra-locales.sh | 46 - .../rootfs/opt/bitnami/scripts/moodle-env.sh | 128 - .../opt/bitnami/scripts/moodle/entrypoint.sh | 34 - .../opt/bitnami/scripts/moodle/postunpack.sh | 77 - .../rootfs/opt/bitnami/scripts/moodle/run.sh | 46 - .../opt/bitnami/scripts/moodle/setup.sh | 48 - .../opt/bitnami/scripts/mysql-client-env.sh | 128 - .../scripts/mysql-client/postunpack.sh | 21 - .../opt/bitnami/scripts/mysql-client/setup.sh | 21 - .../rootfs/opt/bitnami/scripts/php-env.sh | 91 - .../opt/bitnami/scripts/php/postunpack.sh | 47 - .../rootfs/opt/bitnami/scripts/php/reload.sh | 37 - .../rootfs/opt/bitnami/scripts/php/restart.sh | 19 - .../rootfs/opt/bitnami/scripts/php/run.sh | 21 - .../rootfs/opt/bitnami/scripts/php/setup.sh | 34 - .../rootfs/opt/bitnami/scripts/php/start.sh | 34 - .../rootfs/opt/bitnami/scripts/php/status.sh | 23 - .../rootfs/opt/bitnami/scripts/php/stop.sh | 34 - .../bitnami/scripts/postgresql-client-env.sh | 88 - .../scripts/postgresql-client/setup.sh | 21 - .../4.3/debian-12/rootfs/post-init.d/php.sh | 33 - .../4.3/debian-12/rootfs/post-init.d/shell.sh | 38 - .../debian-12/rootfs/post-init.d/sql-mysql.sh | 48 - .../moodle/4.3/debian-12/rootfs/post-init.sh | 25 - bitnami/moodle/4.3/debian-12/tags-info.yaml | 4 - bitnami/moodle/4.4/README.md | 5 + bitnami/moodle/4.4/debian-12/Dockerfile | 79 - .../moodle/4.4/debian-12/docker-compose.yml | 39 - .../opt/bitnami/.bitnami_components.json | 44 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/apache/conf/deflate.conf | 5 - .../apache/conf/vhosts/00_status-vhost.conf | 7 - .../rootfs/opt/bitnami/scripts/apache-env.sh | 81 - .../scripts/apache-modphp/postunpack.sh | 43 - .../app-generic-http-vhost.conf.tpl | 7 - .../app-generic-https-vhost.conf.tpl | 10 - .../app-generic-prefix.conf.tpl | 1 - .../bitnami-templates/app-http-vhost.conf.tpl | 15 - .../app-https-vhost.conf.tpl | 18 - .../bitnami-templates/app-prefix.conf.tpl | 9 - .../app-proxy-http-vhost.conf.tpl | 11 - .../app-proxy-https-vhost.conf.tpl | 14 - .../app-proxy-prefix.conf.tpl | 11 - .../app-ruby-passenger-http-vhost.conf.tpl | 16 - .../app-ruby-passenger-https-vhost.conf.tpl | 19 - .../app-ruby-passenger-prefix.conf.tpl | 9 - .../bitnami-templates/bitnami-ssl.conf.tpl | 29 - .../apache/bitnami-templates/bitnami.conf.tpl | 17 - .../opt/bitnami/scripts/apache/entrypoint.sh | 35 - .../opt/bitnami/scripts/apache/postunpack.sh | 132 - .../opt/bitnami/scripts/apache/reload.sh | 20 - .../opt/bitnami/scripts/apache/restart.sh | 19 - .../rootfs/opt/bitnami/scripts/apache/run.sh | 20 - .../opt/bitnami/scripts/apache/setup.sh | 98 - .../opt/bitnami/scripts/apache/start.sh | 34 - .../opt/bitnami/scripts/apache/status.sh | 23 - .../rootfs/opt/bitnami/scripts/apache/stop.sh | 34 - .../rootfs/opt/bitnami/scripts/libapache.sh | 808 ------ .../rootfs/opt/bitnami/scripts/libmoodle.sh | 434 ---- .../opt/bitnami/scripts/libmysqlclient.sh | 1046 -------- .../rootfs/opt/bitnami/scripts/libphp.sh | 265 -- .../bitnami/scripts/libpostgresqlclient.sh | 424 ---- .../scripts/locales/add-extra-locales.sh | 46 - .../rootfs/opt/bitnami/scripts/moodle-env.sh | 128 - .../opt/bitnami/scripts/moodle/entrypoint.sh | 34 - .../opt/bitnami/scripts/moodle/postunpack.sh | 77 - .../rootfs/opt/bitnami/scripts/moodle/run.sh | 46 - .../opt/bitnami/scripts/moodle/setup.sh | 48 - .../opt/bitnami/scripts/mysql-client-env.sh | 128 - .../scripts/mysql-client/postunpack.sh | 21 - .../opt/bitnami/scripts/mysql-client/setup.sh | 21 - .../rootfs/opt/bitnami/scripts/php-env.sh | 91 - .../opt/bitnami/scripts/php/postunpack.sh | 47 - .../rootfs/opt/bitnami/scripts/php/reload.sh | 37 - .../rootfs/opt/bitnami/scripts/php/restart.sh | 19 - .../rootfs/opt/bitnami/scripts/php/run.sh | 21 - .../rootfs/opt/bitnami/scripts/php/setup.sh | 34 - .../rootfs/opt/bitnami/scripts/php/start.sh | 34 - .../rootfs/opt/bitnami/scripts/php/status.sh | 23 - .../rootfs/opt/bitnami/scripts/php/stop.sh | 34 - .../bitnami/scripts/postgresql-client-env.sh | 88 - .../scripts/postgresql-client/setup.sh | 21 - .../4.4/debian-12/rootfs/post-init.d/php.sh | 33 - .../4.4/debian-12/rootfs/post-init.d/shell.sh | 38 - .../debian-12/rootfs/post-init.d/sql-mysql.sh | 48 - .../moodle/4.4/debian-12/rootfs/post-init.sh | 25 - bitnami/moodle/4.4/debian-12/tags-info.yaml | 4 - bitnami/mysql/8.0/README.md | 5 + bitnami/mysql/8.0/debian-12/Dockerfile | 61 - .../debian-12/docker-compose-replication.yml | 51 - .../mysql/8.0/debian-12/docker-compose.yml | 22 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libmysql.sh | 1411 ----------- .../rootfs/opt/bitnami/scripts/mysql-env.sh | 180 -- .../opt/bitnami/scripts/mysql/entrypoint.sh | 34 - .../opt/bitnami/scripts/mysql/healthcheck.sh | 18 - .../opt/bitnami/scripts/mysql/postunpack.sh | 34 - .../rootfs/opt/bitnami/scripts/mysql/run.sh | 41 - .../rootfs/opt/bitnami/scripts/mysql/setup.sh | 40 - bitnami/mysql/8.0/debian-12/tags-info.yaml | 4 - bitnami/mysql/9.0/README.md | 5 + bitnami/mysql/9.0/debian-12/Dockerfile | 61 - .../debian-12/docker-compose-replication.yml | 51 - .../mysql/9.0/debian-12/docker-compose.yml | 22 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libmysql.sh | 1411 ----------- .../rootfs/opt/bitnami/scripts/mysql-env.sh | 180 -- .../opt/bitnami/scripts/mysql/entrypoint.sh | 34 - .../opt/bitnami/scripts/mysql/healthcheck.sh | 18 - .../opt/bitnami/scripts/mysql/postunpack.sh | 34 - .../rootfs/opt/bitnami/scripts/mysql/run.sh | 41 - .../rootfs/opt/bitnami/scripts/mysql/setup.sh | 40 - bitnami/mysql/9.0/debian-12/tags-info.yaml | 4 - bitnami/neo4j/4/README.md | 5 + bitnami/neo4j/4/debian-12/Dockerfile | 64 - bitnami/neo4j/4/debian-12/docker-compose.yml | 15 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/libneo4j.sh | 358 --- .../rootfs/opt/bitnami/scripts/neo4j-env.sh | 105 - .../opt/bitnami/scripts/neo4j/entrypoint.sh | 33 - .../opt/bitnami/scripts/neo4j/postunpack.sh | 70 - .../rootfs/opt/bitnami/scripts/neo4j/run.sh | 41 - .../rootfs/opt/bitnami/scripts/neo4j/setup.sh | 28 - bitnami/neo4j/4/debian-12/tags-info.yaml | 4 - bitnami/nginx/1.26/README.md | 5 + bitnami/nginx/1.26/debian-12/Dockerfile | 65 - .../nginx/1.26/debian-12/docker-compose.yml | 8 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../conf/bitnami/protect-hidden-files.conf | 4 - .../rootfs/opt/bitnami/nginx/conf/nginx.conf | 60 - .../rootfs/opt/bitnami/scripts/libnginx.sh | 685 ----- .../rootfs/opt/bitnami/scripts/nginx-env.sh | 84 - .../app-http-server-block.conf.tpl | 16 - .../app-https-server-block.conf.tpl | 19 - .../bitnami-templates/app-php-prefix.conf.tpl | 10 - .../bitnami-templates/app-prefix.conf.tpl | 9 - .../default-https-server-block.conf | 17 - .../opt/bitnami/scripts/nginx/entrypoint.sh | 35 - .../opt/bitnami/scripts/nginx/postunpack.sh | 80 - .../opt/bitnami/scripts/nginx/reload.sh | 20 - .../opt/bitnami/scripts/nginx/restart.sh | 19 - .../rootfs/opt/bitnami/scripts/nginx/run.sh | 20 - .../rootfs/opt/bitnami/scripts/nginx/setup.sh | 45 - .../rootfs/opt/bitnami/scripts/nginx/start.sh | 34 - .../opt/bitnami/scripts/nginx/status.sh | 23 - .../rootfs/opt/bitnami/scripts/nginx/stop.sh | 34 - bitnami/nginx/1.26/debian-12/tags-info.yaml | 4 - bitnami/node/18/README.md | 5 + bitnami/node/18/debian-12/Dockerfile | 60 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/node/postunpack.sh | 18 - bitnami/node/18/debian-12/tags-info.yaml | 4 - bitnami/node/20/README.md | 5 + bitnami/node/20/debian-12/Dockerfile | 60 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/node/postunpack.sh | 18 - bitnami/node/20/debian-12/tags-info.yaml | 4 - bitnami/odoo/16/README.md | 6 +- bitnami/odoo/16/debian-12/Dockerfile | 67 - bitnami/odoo/16/debian-12/docker-compose.yml | 33 - .../opt/bitnami/.bitnami_components.json | 32 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libodoo.sh | 358 --- .../bitnami/scripts/libpostgresqlclient.sh | 424 ---- .../rootfs/opt/bitnami/scripts/odoo-env.sh | 133 - .../odoo/bitnami-templates/odoo.conf.tpl | 45 - .../opt/bitnami/scripts/odoo/entrypoint.sh | 29 - .../opt/bitnami/scripts/odoo/postunpack.sh | 43 - .../rootfs/opt/bitnami/scripts/odoo/run.sh | 28 - .../rootfs/opt/bitnami/scripts/odoo/setup.sh | 29 - .../bitnami/scripts/postgresql-client-env.sh | 88 - .../scripts/postgresql-client/setup.sh | 21 - .../16/debian-12/rootfs/post-init.d/python.sh | 33 - .../16/debian-12/rootfs/post-init.d/shell.sh | 38 - .../rootfs/post-init.d/sql-postgresql.sh | 52 - bitnami/odoo/16/debian-12/rootfs/post-init.sh | 25 - bitnami/odoo/16/debian-12/tags-info.yaml | 4 - bitnami/odoo/17/README.md | 6 +- bitnami/odoo/17/debian-12/Dockerfile | 67 - bitnami/odoo/17/debian-12/docker-compose.yml | 33 - .../opt/bitnami/.bitnami_components.json | 32 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libodoo.sh | 358 --- .../bitnami/scripts/libpostgresqlclient.sh | 424 ---- .../rootfs/opt/bitnami/scripts/odoo-env.sh | 133 - .../odoo/bitnami-templates/odoo.conf.tpl | 45 - .../opt/bitnami/scripts/odoo/entrypoint.sh | 29 - .../opt/bitnami/scripts/odoo/postunpack.sh | 43 - .../rootfs/opt/bitnami/scripts/odoo/run.sh | 28 - .../rootfs/opt/bitnami/scripts/odoo/setup.sh | 29 - .../bitnami/scripts/postgresql-client-env.sh | 88 - .../scripts/postgresql-client/setup.sh | 21 - .../17/debian-12/rootfs/post-init.d/python.sh | 33 - .../17/debian-12/rootfs/post-init.d/shell.sh | 38 - .../rootfs/post-init.d/sql-postgresql.sh | 52 - bitnami/odoo/17/debian-12/rootfs/post-init.sh | 25 - bitnami/odoo/17/debian-12/tags-info.yaml | 4 - bitnami/openldap/2.5/README.md | 5 + bitnami/openldap/2.5/debian-12/Dockerfile | 59 - .../2.5/debian-12/docker-compose-testing.yml | 15 - .../openldap/2.5/debian-12/docker-compose.yml | 20 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libopenldap.sh | 951 ------- .../bitnami/scripts/openldap/entrypoint.sh | 21 - .../bitnami/scripts/openldap/postunpack.sh | 29 - .../opt/bitnami/scripts/openldap/run.sh | 80 - .../opt/bitnami/scripts/openldap/setup.sh | 27 - bitnami/openldap/2.5/debian-12/tags-info.yaml | 4 - bitnami/openresty/1.25/README.md | 5 + bitnami/openresty/1.25/debian-12/Dockerfile | 59 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../conf/bitnami/protect-hidden-files.conf | 4 - .../bitnami/openresty/nginx/conf/nginx.conf | 57 - .../opt/bitnami/scripts/libopenresty.sh | 191 -- .../opt/bitnami/scripts/openresty-env.sh | 71 - .../bitnami/scripts/openresty/entrypoint.sh | 28 - .../bitnami/scripts/openresty/postunpack.sh | 71 - .../opt/bitnami/scripts/openresty/run.sh | 20 - .../opt/bitnami/scripts/openresty/setup.sh | 36 - .../openresty/1.25/debian-12/tags-info.yaml | 4 - bitnami/opensearch-dashboards/1/README.md | 5 + .../1/debian-12/Dockerfile | 59 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../scripts/libopensearchdashboards.sh | 459 ---- .../scripts/opensearch-dashboards-env.sh | 166 -- .../opensearch-dashboards/entrypoint.sh | 48 - .../opensearch-dashboards/postunpack.sh | 41 - .../scripts/opensearch-dashboards/run.sh | 26 - .../scripts/opensearch-dashboards/setup.sh | 29 - .../1/debian-12/tags-info.yaml | 4 - bitnami/opensearch/1/README.md | 5 + bitnami/opensearch/1/debian-12/Dockerfile | 66 - .../opensearch/1/debian-12/docker-compose.yml | 12 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../opt/bitnami/scripts/libopensearch.sh | 962 ------- .../opt/bitnami/scripts/opensearch-env.sh | 273 -- .../bitnami/scripts/opensearch/entrypoint.sh | 47 - .../bitnami/scripts/opensearch/healthcheck.sh | 18 - .../bitnami/scripts/opensearch/postunpack.sh | 50 - .../opt/bitnami/scripts/opensearch/run.sh | 40 - .../opt/bitnami/scripts/opensearch/setup.sh | 37 - bitnami/opensearch/1/debian-12/tags-info.yaml | 4 - bitnami/parse-dashboard/5/README.md | 5 + .../parse-dashboard/5/debian-12/Dockerfile | 61 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/libparsedashboard.sh | 239 -- .../bitnami/scripts/parse-dashboard-env.sh | 102 - .../scripts/parse-dashboard/entrypoint.sh | 28 - .../scripts/parse-dashboard/postunpack.sh | 28 - .../bitnami/scripts/parse-dashboard/run.sh | 32 - .../bitnami/scripts/parse-dashboard/setup.sh | 26 - .../scripts/parse-dashboard/updatehost.sh | 29 - .../5/debian-12/rootfs/post-init.d/shell.sh | 38 - .../5/debian-12/rootfs/post-init.sh | 25 - .../5/debian-12/tags-info.yaml | 4 - bitnami/percona-mysql/8.0/README.md | 5 + .../percona-mysql/8.0/debian-12/Dockerfile | 63 - .../debian-12/docker-compose-replication.yml | 46 - .../8.0/debian-12/docker-compose.yml | 22 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libmysql.sh | 1411 ----------- .../rootfs/opt/bitnami/scripts/mysql-env.sh | 181 -- .../opt/bitnami/scripts/mysql/entrypoint.sh | 28 - .../opt/bitnami/scripts/mysql/healthcheck.sh | 18 - .../opt/bitnami/scripts/mysql/postunpack.sh | 30 - .../rootfs/opt/bitnami/scripts/mysql/run.sh | 41 - .../rootfs/opt/bitnami/scripts/mysql/setup.sh | 40 - .../8.0/debian-12/tags-info.yaml | 4 - bitnami/percona-mysql/8.1/README.md | 5 + .../percona-mysql/8.1/debian-12/Dockerfile | 63 - .../debian-12/docker-compose-replication.yml | 46 - .../8.1/debian-12/docker-compose.yml | 22 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libmysql.sh | 1411 ----------- .../rootfs/opt/bitnami/scripts/mysql-env.sh | 181 -- .../opt/bitnami/scripts/mysql/entrypoint.sh | 28 - .../opt/bitnami/scripts/mysql/healthcheck.sh | 18 - .../opt/bitnami/scripts/mysql/postunpack.sh | 30 - .../rootfs/opt/bitnami/scripts/mysql/run.sh | 41 - .../rootfs/opt/bitnami/scripts/mysql/setup.sh | 40 - .../8.1/debian-12/tags-info.yaml | 4 - bitnami/percona-mysql/8.2/README.md | 5 + .../percona-mysql/8.2/debian-12/Dockerfile | 63 - .../debian-12/docker-compose-replication.yml | 46 - .../8.2/debian-12/docker-compose.yml | 22 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libmysql.sh | 1411 ----------- .../rootfs/opt/bitnami/scripts/mysql-env.sh | 181 -- .../opt/bitnami/scripts/mysql/entrypoint.sh | 28 - .../opt/bitnami/scripts/mysql/healthcheck.sh | 18 - .../opt/bitnami/scripts/mysql/postunpack.sh | 30 - .../rootfs/opt/bitnami/scripts/mysql/run.sh | 41 - .../rootfs/opt/bitnami/scripts/mysql/setup.sh | 40 - .../8.2/debian-12/tags-info.yaml | 4 - bitnami/percona-mysql/8.3/README.md | 5 + .../percona-mysql/8.3/debian-12/Dockerfile | 63 - .../debian-12/docker-compose-replication.yml | 46 - .../8.3/debian-12/docker-compose.yml | 22 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libmysql.sh | 1411 ----------- .../rootfs/opt/bitnami/scripts/mysql-env.sh | 181 -- .../opt/bitnami/scripts/mysql/entrypoint.sh | 28 - .../opt/bitnami/scripts/mysql/healthcheck.sh | 18 - .../opt/bitnami/scripts/mysql/postunpack.sh | 30 - .../rootfs/opt/bitnami/scripts/mysql/run.sh | 41 - .../rootfs/opt/bitnami/scripts/mysql/setup.sh | 40 - .../8.3/debian-12/tags-info.yaml | 4 - bitnami/php-fpm/8.1/README.md | 5 + bitnami/php-fpm/8.1/debian-12/Dockerfile | 56 - .../php-fpm/8.1/debian-12/docker-compose.yml | 11 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/php-fpm/8.1/debian-12/tags-info.yaml | 4 - bitnami/php-fpm/8.2/README.md | 5 + bitnami/php-fpm/8.2/debian-12/Dockerfile | 56 - .../php-fpm/8.2/debian-12/docker-compose.yml | 11 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/php-fpm/8.2/debian-12/tags-info.yaml | 4 - bitnami/php-fpm/8.3/README.md | 5 + bitnami/php-fpm/8.3/debian-12/Dockerfile | 56 - .../php-fpm/8.3/debian-12/docker-compose.yml | 11 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/php-fpm/8.3/debian-12/tags-info.yaml | 4 - bitnami/postgresql-repmgr/13/README.md | 5 + .../postgresql-repmgr/13/debian-12/Dockerfile | 68 - .../13/debian-12/docker-compose.yml | 45 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../includes/anotate_event_processing.sh | 22 - .../events/execs/includes/lock_primary.sh | 12 - .../events/execs/includes/lock_standby.sh | 16 - .../events/execs/includes/unlock_primary.sh | 12 - .../events/execs/includes/unlock_standby.sh | 12 - .../rootfs/events/execs/primary_register.sh | 14 - .../events/execs/repmgrd_failover_follow.sh | 13 - .../rootfs/events/execs/standby_follow.sh | 13 - .../rootfs/events/execs/standby_promote.sh | 14 - .../13/debian-12/rootfs/events/router.sh | 26 - .../opt/bitnami/scripts/libpostgresql.sh | 1338 ---------- .../rootfs/opt/bitnami/scripts/librepmgr.sh | 915 ------- .../scripts/locales/add-extra-locales.sh | 46 - .../opt/bitnami/scripts/postgresql-env.sh | 463 ---- .../scripts/postgresql-repmgr/entrypoint.sh | 41 - .../scripts/postgresql-repmgr/postunpack.sh | 32 - .../bitnami/scripts/postgresql-repmgr/run.sh | 31 - .../scripts/postgresql-repmgr/setup.sh | 43 - .../13/debian-12/tags-info.yaml | 4 - bitnami/postgresql-repmgr/14/README.md | 5 + .../postgresql-repmgr/14/debian-12/Dockerfile | 68 - .../14/debian-12/docker-compose.yml | 45 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../includes/anotate_event_processing.sh | 22 - .../events/execs/includes/lock_primary.sh | 12 - .../events/execs/includes/lock_standby.sh | 16 - .../events/execs/includes/unlock_primary.sh | 12 - .../events/execs/includes/unlock_standby.sh | 12 - .../rootfs/events/execs/primary_register.sh | 14 - .../events/execs/repmgrd_failover_follow.sh | 13 - .../rootfs/events/execs/standby_follow.sh | 13 - .../rootfs/events/execs/standby_promote.sh | 14 - .../14/debian-12/rootfs/events/router.sh | 26 - .../opt/bitnami/scripts/libpostgresql.sh | 1338 ---------- .../rootfs/opt/bitnami/scripts/librepmgr.sh | 915 ------- .../scripts/locales/add-extra-locales.sh | 46 - .../opt/bitnami/scripts/postgresql-env.sh | 463 ---- .../scripts/postgresql-repmgr/entrypoint.sh | 41 - .../scripts/postgresql-repmgr/postunpack.sh | 32 - .../bitnami/scripts/postgresql-repmgr/run.sh | 31 - .../scripts/postgresql-repmgr/setup.sh | 43 - .../14/debian-12/tags-info.yaml | 4 - bitnami/postgresql-repmgr/15/README.md | 5 + .../postgresql-repmgr/15/debian-12/Dockerfile | 68 - .../15/debian-12/docker-compose.yml | 45 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../includes/anotate_event_processing.sh | 22 - .../events/execs/includes/lock_primary.sh | 12 - .../events/execs/includes/lock_standby.sh | 16 - .../events/execs/includes/unlock_primary.sh | 12 - .../events/execs/includes/unlock_standby.sh | 12 - .../rootfs/events/execs/primary_register.sh | 14 - .../events/execs/repmgrd_failover_follow.sh | 13 - .../rootfs/events/execs/standby_follow.sh | 13 - .../rootfs/events/execs/standby_promote.sh | 14 - .../15/debian-12/rootfs/events/router.sh | 26 - .../opt/bitnami/scripts/libpostgresql.sh | 1338 ---------- .../rootfs/opt/bitnami/scripts/librepmgr.sh | 915 ------- .../scripts/locales/add-extra-locales.sh | 46 - .../opt/bitnami/scripts/postgresql-env.sh | 463 ---- .../scripts/postgresql-repmgr/entrypoint.sh | 41 - .../scripts/postgresql-repmgr/postunpack.sh | 32 - .../bitnami/scripts/postgresql-repmgr/run.sh | 31 - .../scripts/postgresql-repmgr/setup.sh | 43 - .../15/debian-12/tags-info.yaml | 4 - bitnami/postgresql-repmgr/16/README.md | 5 + .../postgresql-repmgr/16/debian-12/Dockerfile | 68 - .../16/debian-12/docker-compose.yml | 45 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../includes/anotate_event_processing.sh | 22 - .../events/execs/includes/lock_primary.sh | 12 - .../events/execs/includes/lock_standby.sh | 16 - .../events/execs/includes/unlock_primary.sh | 12 - .../events/execs/includes/unlock_standby.sh | 12 - .../rootfs/events/execs/primary_register.sh | 14 - .../events/execs/repmgrd_failover_follow.sh | 13 - .../rootfs/events/execs/standby_follow.sh | 13 - .../rootfs/events/execs/standby_promote.sh | 14 - .../16/debian-12/rootfs/events/router.sh | 26 - .../opt/bitnami/scripts/libpostgresql.sh | 1338 ---------- .../rootfs/opt/bitnami/scripts/librepmgr.sh | 915 ------- .../scripts/locales/add-extra-locales.sh | 46 - .../opt/bitnami/scripts/postgresql-env.sh | 463 ---- .../scripts/postgresql-repmgr/entrypoint.sh | 41 - .../scripts/postgresql-repmgr/postunpack.sh | 32 - .../bitnami/scripts/postgresql-repmgr/run.sh | 31 - .../scripts/postgresql-repmgr/setup.sh | 43 - .../16/debian-12/tags-info.yaml | 4 - bitnami/postgresql/13/README.md | 5 + bitnami/postgresql/13/debian-12/Dockerfile | 71 - .../debian-12/docker-compose-replication.yml | 36 - .../13/debian-12/docker-compose.yml | 16 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libautoctl.sh | 308 --- .../opt/bitnami/scripts/libpostgresql.sh | 1338 ---------- .../scripts/locales/add-extra-locales.sh | 46 - .../opt/bitnami/scripts/postgresql-env.sh | 357 --- .../bitnami/scripts/postgresql/entrypoint.sh | 38 - .../bitnami/scripts/postgresql/postunpack.sh | 32 - .../bitnami/scripts/postgresql/run-autoctl.sh | 32 - .../opt/bitnami/scripts/postgresql/run.sh | 39 - .../opt/bitnami/scripts/postgresql/setup.sh | 55 - .../postgresql/13/debian-12/tags-info.yaml | 4 - bitnami/postgresql/14/README.md | 5 + bitnami/postgresql/14/debian-12/Dockerfile | 71 - .../debian-12/docker-compose-replication.yml | 36 - .../14/debian-12/docker-compose.yml | 16 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libautoctl.sh | 308 --- .../opt/bitnami/scripts/libpostgresql.sh | 1338 ---------- .../scripts/locales/add-extra-locales.sh | 46 - .../opt/bitnami/scripts/postgresql-env.sh | 357 --- .../bitnami/scripts/postgresql/entrypoint.sh | 38 - .../bitnami/scripts/postgresql/postunpack.sh | 32 - .../bitnami/scripts/postgresql/run-autoctl.sh | 32 - .../opt/bitnami/scripts/postgresql/run.sh | 39 - .../opt/bitnami/scripts/postgresql/setup.sh | 55 - .../postgresql/14/debian-12/tags-info.yaml | 4 - bitnami/postgresql/15/README.md | 5 + bitnami/postgresql/15/debian-12/Dockerfile | 71 - .../debian-12/docker-compose-replication.yml | 36 - .../15/debian-12/docker-compose.yml | 16 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libautoctl.sh | 308 --- .../opt/bitnami/scripts/libpostgresql.sh | 1338 ---------- .../scripts/locales/add-extra-locales.sh | 46 - .../opt/bitnami/scripts/postgresql-env.sh | 357 --- .../bitnami/scripts/postgresql/entrypoint.sh | 38 - .../bitnami/scripts/postgresql/postunpack.sh | 32 - .../bitnami/scripts/postgresql/run-autoctl.sh | 32 - .../opt/bitnami/scripts/postgresql/run.sh | 39 - .../opt/bitnami/scripts/postgresql/setup.sh | 55 - .../postgresql/15/debian-12/tags-info.yaml | 4 - bitnami/postgresql/16/README.md | 5 + bitnami/postgresql/16/debian-12/Dockerfile | 71 - .../debian-12/docker-compose-replication.yml | 36 - .../16/debian-12/docker-compose.yml | 16 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libautoctl.sh | 308 --- .../opt/bitnami/scripts/libpostgresql.sh | 1338 ---------- .../scripts/locales/add-extra-locales.sh | 46 - .../opt/bitnami/scripts/postgresql-env.sh | 357 --- .../bitnami/scripts/postgresql/entrypoint.sh | 38 - .../bitnami/scripts/postgresql/postunpack.sh | 32 - .../bitnami/scripts/postgresql/run-autoctl.sh | 32 - .../opt/bitnami/scripts/postgresql/run.sh | 39 - .../opt/bitnami/scripts/postgresql/setup.sh | 55 - .../postgresql/16/debian-12/tags-info.yaml | 4 - bitnami/prometheus/3/README.md | 5 + bitnami/prometheus/3/debian-12/Dockerfile | 62 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/prometheus/3/debian-12/tags-info.yaml | 5 - bitnami/python/3.10/README.md | 5 + bitnami/python/3.10/debian-12/Dockerfile | 56 - .../python/3.10/debian-12/docker-compose.yml | 11 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/python/3.10/debian-12/tags-info.yaml | 4 - bitnami/python/3.11/README.md | 5 + bitnami/python/3.11/debian-12/Dockerfile | 56 - .../python/3.11/debian-12/docker-compose.yml | 11 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/python/3.11/debian-12/tags-info.yaml | 4 - bitnami/python/3.12/README.md | 5 + bitnami/python/3.12/debian-12/Dockerfile | 56 - .../python/3.12/debian-12/docker-compose.yml | 11 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/python/3.12/debian-12/tags-info.yaml | 4 - bitnami/python/3.9/README.md | 5 + bitnami/python/3.9/debian-12/Dockerfile | 56 - .../python/3.9/debian-12/docker-compose.yml | 11 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/python/3.9/debian-12/tags-info.yaml | 4 - bitnami/rails/7/README.md | 5 + bitnami/rails/7/debian-12/Dockerfile | 62 - .../7/debian-12/docker-compose-testing.yml | 19 - bitnami/rails/7/debian-12/docker-compose.yml | 20 - .../prebuildfs/build/bitnami-user.sh | 8 - .../opt/bitnami/.bitnami_components.json | 38 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/librails.sh | 159 -- .../rootfs/opt/bitnami/scripts/rails-env.sh | 84 - .../opt/bitnami/scripts/rails/entrypoint.sh | 28 - .../opt/bitnami/scripts/rails/postunpack.sh | 22 - .../rootfs/opt/bitnami/scripts/rails/setup.sh | 25 - .../7/debian-12/rootfs/post-init.d/shell.sh | 38 - bitnami/rails/7/debian-12/rootfs/post-init.sh | 25 - bitnami/rails/7/debian-12/tags-info.yaml | 4 - bitnami/redis-cluster/6.2/README.md | 5 + .../redis-cluster/6.2/debian-12/Dockerfile | 60 - .../6.2/debian-12/docker-compose.yml | 74 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libredis.sh | 463 ---- .../opt/bitnami/scripts/librediscluster.sh | 260 -- .../opt/bitnami/scripts/redis-cluster-env.sh | 154 -- .../scripts/redis-cluster/entrypoint.sh | 34 - .../scripts/redis-cluster/postunpack.sh | 39 - .../opt/bitnami/scripts/redis-cluster/run.sh | 54 - .../bitnami/scripts/redis-cluster/setup.sh | 31 - .../6.2/debian-12/tags-info.yaml | 4 - bitnami/redis-sentinel/6.2/README.md | 5 + .../redis-sentinel/6.2/debian-12/Dockerfile | 59 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/libredissentinel.sh | 263 -- .../opt/bitnami/scripts/redis-sentinel-env.sh | 123 - .../scripts/redis-sentinel/entrypoint.sh | 29 - .../scripts/redis-sentinel/postunpack.sh | 36 - .../opt/bitnami/scripts/redis-sentinel/run.sh | 27 - .../bitnami/scripts/redis-sentinel/setup.sh | 26 - .../6.2/debian-12/tags-info.yaml | 4 - bitnami/redis/6.2/README.md | 5 + bitnami/redis/6.2/debian-12/Dockerfile | 62 - .../debian-12/docker-compose-replicaset.yml | 32 - .../redis/6.2/debian-12/docker-compose.yml | 18 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libredis.sh | 463 ---- .../rootfs/opt/bitnami/scripts/redis-env.sh | 134 - .../opt/bitnami/scripts/redis/entrypoint.sh | 34 - .../opt/bitnami/scripts/redis/postunpack.sh | 42 - .../rootfs/opt/bitnami/scripts/redis/run.sh | 32 - .../rootfs/opt/bitnami/scripts/redis/setup.sh | 25 - bitnami/redis/6.2/debian-12/tags-info.yaml | 4 - bitnami/redmine/5/README.md | 5 + bitnami/redmine/5/debian-12/Dockerfile | 61 - .../5/debian-12/docker-compose-postgresql.yml | 32 - .../redmine/5/debian-12/docker-compose.yml | 33 - .../opt/bitnami/.bitnami_components.json | 32 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/libmysqlclient.sh | 1046 -------- .../bitnami/scripts/libpostgresqlclient.sh | 424 ---- .../rootfs/opt/bitnami/scripts/libredmine.sh | 467 ---- .../opt/bitnami/scripts/mysql-client-env.sh | 128 - .../scripts/mysql-client/postunpack.sh | 21 - .../opt/bitnami/scripts/mysql-client/setup.sh | 21 - .../bitnami/scripts/postgresql-client-env.sh | 88 - .../scripts/postgresql-client/setup.sh | 21 - .../rootfs/opt/bitnami/scripts/redmine-env.sh | 155 -- .../opt/bitnami/scripts/redmine/entrypoint.sh | 30 - .../opt/bitnami/scripts/redmine/postunpack.sh | 55 - .../rootfs/opt/bitnami/scripts/redmine/run.sh | 30 - .../opt/bitnami/scripts/redmine/setup.sh | 31 - .../5/debian-12/rootfs/post-init.d/ruby.sh | 33 - .../5/debian-12/rootfs/post-init.d/shell.sh | 38 - .../debian-12/rootfs/post-init.d/sql-mysql.sh | 48 - .../redmine/5/debian-12/rootfs/post-init.sh | 25 - bitnami/redmine/5/debian-12/tags-info.yaml | 4 - bitnami/ruby/3.1/README.md | 5 + bitnami/ruby/3.1/debian-12/Dockerfile | 56 - bitnami/ruby/3.1/debian-12/docker-compose.yml | 12 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/ruby/3.1/debian-12/tags-info.yaml | 4 - bitnami/ruby/3.2/README.md | 5 + bitnami/ruby/3.2/debian-12/Dockerfile | 56 - bitnami/ruby/3.2/debian-12/docker-compose.yml | 12 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - bitnami/ruby/3.2/debian-12/tags-info.yaml | 4 - bitnami/schema-registry/7.4/README.md | 5 + .../schema-registry/7.4/debian-12/Dockerfile | 61 - .../7.4/debian-12/docker-compose.yml | 52 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../opt/bitnami/scripts/libschemaregistry.sh | 333 --- .../bitnami/scripts/schema-registry-env.sh | 91 - .../scripts/schema-registry/entrypoint.sh | 35 - .../scripts/schema-registry/postunpack.sh | 102 - .../bitnami/scripts/schema-registry/run.sh | 28 - .../bitnami/scripts/schema-registry/setup.sh | 31 - .../7.4/debian-12/tags-info.yaml | 4 - bitnami/schema-registry/7.5/README.md | 5 + .../schema-registry/7.5/debian-12/Dockerfile | 61 - .../7.5/debian-12/docker-compose.yml | 52 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../opt/bitnami/scripts/libschemaregistry.sh | 333 --- .../bitnami/scripts/schema-registry-env.sh | 91 - .../scripts/schema-registry/entrypoint.sh | 35 - .../scripts/schema-registry/postunpack.sh | 102 - .../bitnami/scripts/schema-registry/run.sh | 28 - .../bitnami/scripts/schema-registry/setup.sh | 31 - .../7.5/debian-12/tags-info.yaml | 4 - bitnami/schema-registry/7.6/README.md | 5 + .../schema-registry/7.6/debian-12/Dockerfile | 61 - .../7.6/debian-12/docker-compose.yml | 52 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 19 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../opt/bitnami/scripts/libschemaregistry.sh | 333 --- .../bitnami/scripts/schema-registry-env.sh | 91 - .../scripts/schema-registry/entrypoint.sh | 35 - .../scripts/schema-registry/postunpack.sh | 102 - .../bitnami/scripts/schema-registry/run.sh | 28 - .../bitnami/scripts/schema-registry/setup.sh | 31 - .../7.6/debian-12/tags-info.yaml | 4 - bitnami/scylladb/6.0/README.md | 5 + bitnami/scylladb/6.0/debian-12/Dockerfile | 62 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/libscylladb.sh | 1322 ---------- .../opt/bitnami/scripts/scylladb-env.sh | 273 -- .../bitnami/scripts/scylladb/entrypoint.sh | 39 - .../bitnami/scripts/scylladb/postunpack.sh | 78 - .../opt/bitnami/scripts/scylladb/run.sh | 35 - .../opt/bitnami/scripts/scylladb/setup.sh | 37 - bitnami/scylladb/6.0/debian-12/tags-info.yaml | 4 - bitnami/scylladb/6.1/README.md | 5 + bitnami/scylladb/6.1/debian-12/Dockerfile | 62 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/libscylladb.sh | 1322 ---------- .../opt/bitnami/scripts/scylladb-env.sh | 273 -- .../bitnami/scripts/scylladb/entrypoint.sh | 39 - .../bitnami/scripts/scylladb/postunpack.sh | 78 - .../opt/bitnami/scripts/scylladb/run.sh | 35 - .../opt/bitnami/scripts/scylladb/setup.sh | 37 - bitnami/scylladb/6.1/debian-12/tags-info.yaml | 4 - bitnami/solr/8/README.md | 5 + bitnami/solr/8/debian-12/Dockerfile | 62 - .../solr/8/debian-12/docker-compose-cloud.yml | 33 - bitnami/solr/8/debian-12/docker-compose.yml | 15 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/libsolr.sh | 680 ----- .../rootfs/opt/bitnami/scripts/solr-env.sh | 113 - .../opt/bitnami/scripts/solr/entrypoint.sh | 29 - .../opt/bitnami/scripts/solr/postunpack.sh | 30 - .../rootfs/opt/bitnami/scripts/solr/run.sh | 33 - .../rootfs/opt/bitnami/scripts/solr/setup.sh | 22 - bitnami/solr/8/debian-12/tags-info.yaml | 4 - bitnami/sonarqube/9/README.md | 5 + bitnami/sonarqube/9/debian-12/Dockerfile | 63 - .../sonarqube/9/debian-12/docker-compose.yml | 33 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../bitnami/scripts/libpostgresqlclient.sh | 424 ---- .../opt/bitnami/scripts/libsonarqube.sh | 405 --- .../bitnami/scripts/postgresql-client-env.sh | 88 - .../scripts/postgresql-client/setup.sh | 21 - .../opt/bitnami/scripts/sonarqube-env.sh | 150 -- .../bitnami/scripts/sonarqube/entrypoint.sh | 29 - .../bitnami/scripts/sonarqube/postunpack.sh | 40 - .../opt/bitnami/scripts/sonarqube/run.sh | 31 - .../opt/bitnami/scripts/sonarqube/setup.sh | 29 - .../9/debian-12/rootfs/post-init.d/shell.sh | 38 - .../rootfs/post-init.d/sql-postgresql.sh | 52 - .../sonarqube/9/debian-12/rootfs/post-init.sh | 25 - bitnami/sonarqube/9/debian-12/tags-info.yaml | 4 - bitnami/suitecrm/7/README.md | 5 + bitnami/suitecrm/7/debian-12/Dockerfile | 67 - .../suitecrm/7/debian-12/docker-compose.yml | 36 - .../opt/bitnami/.bitnami_components.json | 38 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/apache/conf/deflate.conf | 5 - .../apache/conf/vhosts/00_status-vhost.conf | 7 - .../rootfs/opt/bitnami/scripts/apache-env.sh | 81 - .../scripts/apache-modphp/postunpack.sh | 43 - .../app-generic-http-vhost.conf.tpl | 7 - .../app-generic-https-vhost.conf.tpl | 10 - .../app-generic-prefix.conf.tpl | 1 - .../bitnami-templates/app-http-vhost.conf.tpl | 15 - .../app-https-vhost.conf.tpl | 18 - .../bitnami-templates/app-prefix.conf.tpl | 9 - .../app-proxy-http-vhost.conf.tpl | 11 - .../app-proxy-https-vhost.conf.tpl | 14 - .../app-proxy-prefix.conf.tpl | 11 - .../app-ruby-passenger-http-vhost.conf.tpl | 16 - .../app-ruby-passenger-https-vhost.conf.tpl | 19 - .../app-ruby-passenger-prefix.conf.tpl | 9 - .../bitnami-templates/bitnami-ssl.conf.tpl | 29 - .../apache/bitnami-templates/bitnami.conf.tpl | 17 - .../opt/bitnami/scripts/apache/entrypoint.sh | 35 - .../opt/bitnami/scripts/apache/postunpack.sh | 132 - .../opt/bitnami/scripts/apache/reload.sh | 20 - .../opt/bitnami/scripts/apache/restart.sh | 19 - .../rootfs/opt/bitnami/scripts/apache/run.sh | 20 - .../opt/bitnami/scripts/apache/setup.sh | 98 - .../opt/bitnami/scripts/apache/start.sh | 34 - .../opt/bitnami/scripts/apache/status.sh | 23 - .../rootfs/opt/bitnami/scripts/apache/stop.sh | 34 - .../rootfs/opt/bitnami/scripts/libapache.sh | 808 ------ .../opt/bitnami/scripts/libmysqlclient.sh | 1046 -------- .../rootfs/opt/bitnami/scripts/libphp.sh | 265 -- .../rootfs/opt/bitnami/scripts/libsuitecrm.sh | 480 ---- .../opt/bitnami/scripts/mysql-client-env.sh | 128 - .../scripts/mysql-client/postunpack.sh | 21 - .../opt/bitnami/scripts/mysql-client/setup.sh | 21 - .../rootfs/opt/bitnami/scripts/php-env.sh | 91 - .../opt/bitnami/scripts/php/postunpack.sh | 47 - .../rootfs/opt/bitnami/scripts/php/reload.sh | 37 - .../rootfs/opt/bitnami/scripts/php/restart.sh | 19 - .../rootfs/opt/bitnami/scripts/php/run.sh | 21 - .../rootfs/opt/bitnami/scripts/php/setup.sh | 34 - .../rootfs/opt/bitnami/scripts/php/start.sh | 34 - .../rootfs/opt/bitnami/scripts/php/status.sh | 23 - .../rootfs/opt/bitnami/scripts/php/stop.sh | 34 - .../opt/bitnami/scripts/suitecrm-env.sh | 120 - .../bitnami-templates/config_db.php.tpl | 23 - .../bitnami-templates/config_si.php.tpl | 39 - .../bitnami/scripts/suitecrm/entrypoint.sh | 33 - .../bitnami/scripts/suitecrm/postunpack.sh | 55 - .../opt/bitnami/scripts/suitecrm/run.sh | 42 - .../opt/bitnami/scripts/suitecrm/setup.sh | 41 - .../bitnami/scripts/suitecrm/updatehost.sh | 28 - .../7/debian-12/rootfs/post-init.d/php.sh | 33 - .../7/debian-12/rootfs/post-init.d/shell.sh | 38 - .../debian-12/rootfs/post-init.d/sql-mysql.sh | 48 - .../suitecrm/7/debian-12/rootfs/post-init.sh | 25 - bitnami/suitecrm/7/debian-12/tags-info.yaml | 4 - bitnami/tomcat/9.0/README.md | 5 + bitnami/tomcat/9.0/debian-12/Dockerfile | 64 - .../tomcat/9.0/debian-12/docker-compose.yml | 16 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 24 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/libtomcat.sh | 312 --- .../rootfs/opt/bitnami/scripts/tomcat-env.sh | 94 - .../tomcat/bitnami-templates/setenv.sh.tpl | 10 - .../opt/bitnami/scripts/tomcat/entrypoint.sh | 35 - .../opt/bitnami/scripts/tomcat/postunpack.sh | 55 - .../opt/bitnami/scripts/tomcat/restart.sh | 19 - .../rootfs/opt/bitnami/scripts/tomcat/run.sh | 25 - .../opt/bitnami/scripts/tomcat/setup.sh | 24 - .../opt/bitnami/scripts/tomcat/start.sh | 38 - .../opt/bitnami/scripts/tomcat/status.sh | 22 - .../rootfs/opt/bitnami/scripts/tomcat/stop.sh | 34 - bitnami/tomcat/9.0/debian-12/tags-info.yaml | 4 - bitnami/valkey-cluster/7.2/README.md | 5 + .../valkey-cluster/7.2/debian-12/Dockerfile | 60 - .../7.2/debian-12/docker-compose.yml | 74 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libvalkey.sh | 460 ---- .../opt/bitnami/scripts/libvalkeycluster.sh | 260 -- .../opt/bitnami/scripts/valkey-cluster-env.sh | 154 -- .../scripts/valkey-cluster/entrypoint.sh | 34 - .../scripts/valkey-cluster/postunpack.sh | 39 - .../opt/bitnami/scripts/valkey-cluster/run.sh | 54 - .../bitnami/scripts/valkey-cluster/setup.sh | 31 - .../7.2/debian-12/tags-info.yaml | 4 - bitnami/valkey-sentinel/7.2/README.md | 5 + .../valkey-sentinel/7.2/debian-12/Dockerfile | 59 - .../opt/bitnami/.bitnami_components.json | 8 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/libvalkeysentinel.sh | 264 -- .../bitnami/scripts/valkey-sentinel-env.sh | 123 - .../scripts/valkey-sentinel/entrypoint.sh | 29 - .../scripts/valkey-sentinel/postunpack.sh | 36 - .../bitnami/scripts/valkey-sentinel/run.sh | 27 - .../bitnami/scripts/valkey-sentinel/setup.sh | 26 - .../7.2/debian-12/tags-info.yaml | 4 - bitnami/valkey/7.2/README.md | 5 + bitnami/valkey/7.2/debian-12/Dockerfile | 62 - .../debian-12/docker-compose-replicaset.yml | 32 - .../valkey/7.2/debian-12/docker-compose.yml | 18 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../rootfs/opt/bitnami/scripts/libvalkey.sh | 460 ---- .../rootfs/opt/bitnami/scripts/valkey-env.sh | 134 - .../opt/bitnami/scripts/valkey/entrypoint.sh | 34 - .../opt/bitnami/scripts/valkey/postunpack.sh | 42 - .../rootfs/opt/bitnami/scripts/valkey/run.sh | 32 - .../opt/bitnami/scripts/valkey/setup.sh | 25 - bitnami/valkey/7.2/debian-12/tags-info.yaml | 4 - bitnami/wildfly/33/README.md | 5 + bitnami/wildfly/33/debian-12/Dockerfile | 64 - .../wildfly/33/debian-12/docker-compose.yml | 17 - .../opt/bitnami/.bitnami_components.json | 14 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/java/entrypoint.sh | 19 - .../opt/bitnami/scripts/java/postunpack.sh | 26 - .../rootfs/opt/bitnami/scripts/libwildfly.sh | 223 -- .../rootfs/opt/bitnami/scripts/wildfly-env.sh | 103 - .../opt/bitnami/scripts/wildfly/entrypoint.sh | 36 - .../opt/bitnami/scripts/wildfly/postunpack.sh | 40 - .../rootfs/opt/bitnami/scripts/wildfly/run.sh | 27 - .../opt/bitnami/scripts/wildfly/setup.sh | 30 - bitnami/wildfly/33/debian-12/tags-info.yaml | 4 - bitnami/zookeeper/3.8/README.md | 5 + bitnami/zookeeper/3.8/debian-12/Dockerfile | 62 - .../3.8/debian-12/docker-compose-cluster.yml | 42 - .../3.8/debian-12/docker-compose.yml | 16 - .../opt/bitnami/.bitnami_components.json | 20 - .../opt/bitnami/licenses/licenses.txt | 2 - .../opt/bitnami/scripts/libbitnami.sh | 54 - .../prebuildfs/opt/bitnami/scripts/libfile.sh | 141 -- .../prebuildfs/opt/bitnami/scripts/libfs.sh | 193 -- .../prebuildfs/opt/bitnami/scripts/libhook.sh | 18 - .../prebuildfs/opt/bitnami/scripts/liblog.sh | 114 - .../prebuildfs/opt/bitnami/scripts/libnet.sh | 171 -- .../prebuildfs/opt/bitnami/scripts/libos.sh | 657 ----- .../opt/bitnami/scripts/libpersistence.sh | 124 - .../opt/bitnami/scripts/libservice.sh | 496 ---- .../opt/bitnami/scripts/libvalidations.sh | 304 --- .../opt/bitnami/scripts/libversion.sh | 51 - .../opt/bitnami/scripts/libwebserver.sh | 476 ---- .../prebuildfs/usr/sbin/install_packages | 27 - .../debian-12/prebuildfs/usr/sbin/run-script | 24 - .../opt/bitnami/scripts/libzookeeper.sh | 630 ----- .../opt/bitnami/scripts/zookeeper-env.sh | 169 -- .../bitnami/scripts/zookeeper/entrypoint.sh | 35 - .../bitnami/scripts/zookeeper/healthcheck.sh | 18 - .../bitnami/scripts/zookeeper/postunpack.sh | 30 - .../opt/bitnami/scripts/zookeeper/run.sh | 27 - .../opt/bitnami/scripts/zookeeper/setup.sh | 34 - .../zookeeper/3.8/debian-12/tags-info.yaml | 4 - 3015 files changed, 593 insertions(+), 403742 deletions(-) create mode 100644 bitnami/aspnet-core/9/README.md delete mode 100644 bitnami/aspnet-core/9/debian-12/Dockerfile delete mode 100644 bitnami/aspnet-core/9/debian-12/docker-compose.yml delete mode 100644 bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/base/functions delete mode 100644 bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/base/helpers delete mode 100644 bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/aspnet-core/9/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/aspnet-core/9/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/aspnet-core/9/debian-12/rootfs/opt/bitnami/scripts/aspnet-core/entrypoint.sh delete mode 100755 bitnami/aspnet-core/9/debian-12/rootfs/opt/bitnami/scripts/aspnet-core/postunpack.sh delete mode 100644 bitnami/aspnet-core/9/debian-12/tags-info.yaml create mode 100644 bitnami/aws-cli/1/README.md delete mode 100644 bitnami/aws-cli/1/debian-12/Dockerfile delete mode 100644 bitnami/aws-cli/1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/aws-cli/1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/aws-cli/1/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/aws-cli/1/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/aws-cli/1/debian-12/tags-info.yaml create mode 100644 bitnami/cassandra/4.0/README.md delete mode 100644 bitnami/cassandra/4.0/debian-12/Dockerfile delete mode 100644 bitnami/cassandra/4.0/debian-12/docker-compose-cluster.yml delete mode 100644 bitnami/cassandra/4.0/debian-12/docker-compose.yml delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/cassandra/4.0/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/cassandra/4.0/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra-env.sh delete mode 100755 bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/entrypoint.sh delete mode 100755 bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/postunpack.sh delete mode 100755 bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/run.sh delete mode 100755 bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/setup.sh delete mode 100755 bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/libcassandra.sh delete mode 100644 bitnami/cassandra/4.0/debian-12/tags-info.yaml create mode 100644 bitnami/cassandra/4.1/README.md delete mode 100644 bitnami/cassandra/4.1/debian-12/Dockerfile delete mode 100644 bitnami/cassandra/4.1/debian-12/docker-compose-cluster.yml delete mode 100644 bitnami/cassandra/4.1/debian-12/docker-compose.yml delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/cassandra/4.1/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/cassandra/4.1/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra-env.sh delete mode 100755 bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/entrypoint.sh delete mode 100755 bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/postunpack.sh delete mode 100755 bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/run.sh delete mode 100755 bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/setup.sh delete mode 100755 bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/libcassandra.sh delete mode 100644 bitnami/cassandra/4.1/debian-12/tags-info.yaml create mode 100644 bitnami/clickhouse/24.3/README.md delete mode 100644 bitnami/clickhouse/24.3/debian-12/Dockerfile delete mode 100644 bitnami/clickhouse/24.3/debian-12/docker-compose.yml delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/clickhouse/24.3/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/clickhouse/24.3/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse-env.sh delete mode 100755 bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/entrypoint.sh delete mode 100755 bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/postunpack.sh delete mode 100755 bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/run.sh delete mode 100755 bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/setup.sh delete mode 100644 bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/libclickhouse.sh delete mode 100644 bitnami/clickhouse/24.3/debian-12/tags-info.yaml create mode 100644 bitnami/clickhouse/24.8/README.md delete mode 100644 bitnami/clickhouse/24.8/debian-12/Dockerfile delete mode 100644 bitnami/clickhouse/24.8/debian-12/docker-compose.yml delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/clickhouse/24.8/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/clickhouse/24.8/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse-env.sh delete mode 100755 bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/entrypoint.sh delete mode 100755 bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/postunpack.sh delete mode 100755 bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/run.sh delete mode 100755 bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/setup.sh delete mode 100644 bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/libclickhouse.sh delete mode 100644 bitnami/clickhouse/24.8/debian-12/tags-info.yaml create mode 100644 bitnami/contour/1.28/README.md delete mode 100644 bitnami/contour/1.28/debian-12/Dockerfile delete mode 100644 bitnami/contour/1.28/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/contour/1.28/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/contour/1.28/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/contour/1.28/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/contour/1.28/debian-12/tags-info.yaml create mode 100644 bitnami/contour/1.29/README.md delete mode 100644 bitnami/contour/1.29/debian-12/Dockerfile delete mode 100644 bitnami/contour/1.29/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/contour/1.29/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/contour/1.29/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/contour/1.29/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/contour/1.29/debian-12/tags-info.yaml create mode 100644 bitnami/dotnet-sdk/9/README.md delete mode 100644 bitnami/dotnet-sdk/9/debian-12/Dockerfile delete mode 100644 bitnami/dotnet-sdk/9/debian-12/docker-compose.yml delete mode 100644 bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/base/functions delete mode 100644 bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/base/helpers delete mode 100644 bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/dotnet-sdk/9/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/dotnet-sdk/9/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/dotnet-sdk/9/debian-12/rootfs/opt/bitnami/scripts/dotnet-sdk/entrypoint.sh delete mode 100755 bitnami/dotnet-sdk/9/debian-12/rootfs/opt/bitnami/scripts/dotnet-sdk/postunpack.sh delete mode 100644 bitnami/dotnet-sdk/9/debian-12/tags-info.yaml create mode 100644 bitnami/dotnet/9/README.md delete mode 100644 bitnami/dotnet/9/debian-12/Dockerfile delete mode 100644 bitnami/dotnet/9/debian-12/docker-compose.yml delete mode 100644 bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/base/functions delete mode 100644 bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/base/helpers delete mode 100644 bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/dotnet/9/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/dotnet/9/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/dotnet/9/debian-12/rootfs/opt/bitnami/scripts/dotnet/entrypoint.sh delete mode 100755 bitnami/dotnet/9/debian-12/rootfs/opt/bitnami/scripts/dotnet/postunpack.sh delete mode 100644 bitnami/dotnet/9/debian-12/tags-info.yaml create mode 100644 bitnami/drupal/10/README.md delete mode 100644 bitnami/drupal/10/debian-12/Dockerfile delete mode 100644 bitnami/drupal/10/debian-12/docker-compose.yml delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/drupal/10/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/drupal/10/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/apache/conf/deflate.conf delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/apache/conf/vhosts/00_status-vhost.conf delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache-env.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache-modphp/postunpack.sh delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-http-vhost.conf.tpl delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-https-vhost.conf.tpl delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-prefix.conf.tpl delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-http-vhost.conf.tpl delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-https-vhost.conf.tpl delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-prefix.conf.tpl delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-http-vhost.conf.tpl delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-https-vhost.conf.tpl delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-prefix.conf.tpl delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-http-vhost.conf.tpl delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-https-vhost.conf.tpl delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-prefix.conf.tpl delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami-ssl.conf.tpl delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami.conf.tpl delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/entrypoint.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/postunpack.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/reload.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/restart.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/run.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/setup.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/start.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/status.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/stop.sh delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal-env.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal/entrypoint.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal/postunpack.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal/setup.sh delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libapache.sh delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libdrupal.sh delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libmysqlclient.sh delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libphp.sh delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/mysql-client-env.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/mysql-client/postunpack.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/mysql-client/setup.sh delete mode 100644 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php-env.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/postunpack.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/reload.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/restart.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/run.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/setup.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/start.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/status.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/stop.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/post-init.d/php.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/post-init.d/sql-mysql.sh delete mode 100755 bitnami/drupal/10/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/drupal/10/debian-12/tags-info.yaml create mode 100644 bitnami/elasticsearch/7/README.md delete mode 100644 bitnami/elasticsearch/7/debian-12/Dockerfile delete mode 100644 bitnami/elasticsearch/7/debian-12/docker-compose-cluster.yml delete mode 100644 bitnami/elasticsearch/7/debian-12/docker-compose.yml delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/elasticsearch/7/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/elasticsearch/7/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch-env.sh delete mode 100755 bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/entrypoint.sh delete mode 100755 bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/healthcheck.sh delete mode 100755 bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/postunpack.sh delete mode 100755 bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/run.sh delete mode 100755 bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/setup.sh delete mode 100755 bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/libelasticsearch.sh delete mode 100644 bitnami/elasticsearch/7/debian-12/tags-info.yaml create mode 100644 bitnami/envoy/1.29/README.md delete mode 100644 bitnami/envoy/1.29/debian-12/Dockerfile delete mode 100644 bitnami/envoy/1.29/debian-12/docker-compose-testing.yml delete mode 100644 bitnami/envoy/1.29/debian-12/docker-compose.yml delete mode 100644 bitnami/envoy/1.29/debian-12/examples/frontend.yaml delete mode 100644 bitnami/envoy/1.29/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/envoy/1.29/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/envoy/1.29/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/envoy/1.29/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/envoy/1.29/debian-12/tags-info.yaml create mode 100644 bitnami/envoy/1.30/README.md delete mode 100644 bitnami/envoy/1.30/debian-12/Dockerfile delete mode 100644 bitnami/envoy/1.30/debian-12/docker-compose-testing.yml delete mode 100644 bitnami/envoy/1.30/debian-12/docker-compose.yml delete mode 100644 bitnami/envoy/1.30/debian-12/examples/frontend.yaml delete mode 100644 bitnami/envoy/1.30/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/envoy/1.30/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/envoy/1.30/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/envoy/1.30/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/envoy/1.30/debian-12/tags-info.yaml create mode 100644 bitnami/envoy/1.31/README.md delete mode 100644 bitnami/envoy/1.31/debian-12/Dockerfile delete mode 100644 bitnami/envoy/1.31/debian-12/docker-compose-testing.yml delete mode 100644 bitnami/envoy/1.31/debian-12/docker-compose.yml delete mode 100644 bitnami/envoy/1.31/debian-12/examples/frontend.yaml delete mode 100644 bitnami/envoy/1.31/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/envoy/1.31/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/envoy/1.31/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/envoy/1.31/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/envoy/1.31/debian-12/tags-info.yaml create mode 100644 bitnami/etcd/3.4/README.md delete mode 100644 bitnami/etcd/3.4/debian-12/Dockerfile delete mode 100644 bitnami/etcd/3.4/debian-12/docker-compose-cluster.yml delete mode 100644 bitnami/etcd/3.4/debian-12/docker-compose.yml delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/etcd/3.4/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/etcd/3.4/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd-env.sh delete mode 100755 bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/entrypoint.sh delete mode 100755 bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/healthcheck.sh delete mode 100755 bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/postunpack.sh delete mode 100755 bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/prestop.sh delete mode 100755 bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/run.sh delete mode 100755 bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/setup.sh delete mode 100755 bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/snapshot.sh delete mode 100644 bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/libetcd.sh delete mode 100644 bitnami/etcd/3.4/debian-12/tags-info.yaml create mode 100644 bitnami/express/4/README.md delete mode 100644 bitnami/express/4/debian-12/Dockerfile delete mode 100644 bitnami/express/4/debian-12/docker-compose-mariadb.yml delete mode 100644 bitnami/express/4/debian-12/docker-compose-postgresql.yml delete mode 100644 bitnami/express/4/debian-12/docker-compose.yml delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/express/4/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/express/4/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/express/4/debian-12/rootfs/dist/.dockerignore delete mode 100644 bitnami/express/4/debian-12/rootfs/dist/.gitignore delete mode 100644 bitnami/express/4/debian-12/rootfs/dist/Dockerfile.tpl delete mode 100644 bitnami/express/4/debian-12/rootfs/dist/samples/mariadb.js delete mode 100644 bitnami/express/4/debian-12/rootfs/dist/samples/mongodb.js delete mode 100644 bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express-env.sh delete mode 100755 bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express/entrypoint.sh delete mode 100755 bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express/postunpack.sh delete mode 100755 bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express/setup.sh delete mode 100644 bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/libexpress.sh delete mode 100755 bitnami/express/4/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/express/4/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/express/4/debian-12/tags-info.yaml create mode 100644 bitnami/fluent-bit/2/README.md delete mode 100644 bitnami/fluent-bit/2/debian-12/Dockerfile delete mode 100644 bitnami/fluent-bit/2/debian-12/docker-compose.yml delete mode 100644 bitnami/fluent-bit/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/fluent-bit/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/fluent-bit/2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/fluent-bit/2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/fluent-bit/2/debian-12/tags-info.yaml create mode 100644 bitnami/golang/1.22/README.md delete mode 100644 bitnami/golang/1.22/debian-12/Dockerfile delete mode 100644 bitnami/golang/1.22/debian-12/docker-compose.yml delete mode 100644 bitnami/golang/1.22/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/golang/1.22/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/golang/1.22/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/golang/1.22/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/golang/1.22/debian-12/tags-info.yaml create mode 100644 bitnami/grafana/10/README.md delete mode 100644 bitnami/grafana/10/debian-12/Dockerfile delete mode 100644 bitnami/grafana/10/debian-12/docker-compose.yml delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/grafana/10/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/grafana/10/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana-env.sh delete mode 100755 bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/entrypoint.sh delete mode 100755 bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/postunpack.sh delete mode 100755 bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/run.sh delete mode 100755 bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/setup.sh delete mode 100644 bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/libgrafana.sh delete mode 100755 bitnami/grafana/10/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/grafana/10/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/grafana/10/debian-12/tags-info.yaml create mode 100644 bitnami/haproxy/2/README.md delete mode 100644 bitnami/haproxy/2/debian-12/Dockerfile delete mode 100644 bitnami/haproxy/2/debian-12/docker-compose-testing.yml delete mode 100644 bitnami/haproxy/2/debian-12/docker-compose.yml delete mode 100644 bitnami/haproxy/2/debian-12/examples/frontend.cfg delete mode 100644 bitnami/haproxy/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/haproxy/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/haproxy/2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/haproxy/2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/haproxy/2/debian-12/tags-info.yaml create mode 100644 bitnami/hyperledger-fabric-orderer/2/README.md delete mode 100644 bitnami/hyperledger-fabric-orderer/2/debian-12/Dockerfile delete mode 100644 bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/hyperledger-fabric-orderer/2/debian-12/tags-info.yaml create mode 100644 bitnami/hyperledger-fabric-peer/2/README.md delete mode 100644 bitnami/hyperledger-fabric-peer/2/debian-12/Dockerfile delete mode 100644 bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/hyperledger-fabric-peer/2/debian-12/tags-info.yaml create mode 100644 bitnami/hyperledger-fabric-tools/2/README.md delete mode 100644 bitnami/hyperledger-fabric-tools/2/debian-12/Dockerfile delete mode 100644 bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/hyperledger-fabric-tools/2/debian-12/tags-info.yaml create mode 100644 bitnami/jaeger/1/README.md delete mode 100644 bitnami/jaeger/1/debian-12/Dockerfile delete mode 100644 bitnami/jaeger/1/debian-12/docker-compose.yml delete mode 100644 bitnami/jaeger/1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/jaeger/1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/jaeger/1/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/jaeger/1/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/jaeger/1/debian-12/tags-info.yaml create mode 100644 bitnami/java/1.8/README.md delete mode 100644 bitnami/java/1.8/debian-12/Dockerfile delete mode 100644 bitnami/java/1.8/debian-12/docker-compose.yml delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/java/1.8/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/java/1.8/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/java/1.8/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/java/1.8/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100755 bitnami/java/1.8/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/java/1.8/debian-12/tags-info.yaml create mode 100644 bitnami/java/11/README.md delete mode 100644 bitnami/java/11/debian-12/Dockerfile delete mode 100644 bitnami/java/11/debian-12/docker-compose.yml delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/java/11/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/java/11/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/java/11/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/java/11/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100755 bitnami/java/11/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/java/11/debian-12/tags-info.yaml create mode 100644 bitnami/java/17/README.md delete mode 100644 bitnami/java/17/debian-12/Dockerfile delete mode 100644 bitnami/java/17/debian-12/docker-compose.yml delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/java/17/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/java/17/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/java/17/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/java/17/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100755 bitnami/java/17/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/java/17/debian-12/tags-info.yaml create mode 100644 bitnami/java/22/README.md delete mode 100644 bitnami/java/22/debian-12/Dockerfile delete mode 100644 bitnami/java/22/debian-12/docker-compose.yml delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/java/22/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/java/22/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/java/22/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/java/22/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100755 bitnami/java/22/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/java/22/debian-12/tags-info.yaml create mode 100644 bitnami/jupyter-base-notebook/4/README.md delete mode 100644 bitnami/jupyter-base-notebook/4/debian-12/Dockerfile delete mode 100644 bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/jupyter-base-notebook/4/debian-12/tags-info.yaml create mode 100644 bitnami/jupyterhub/4/README.md delete mode 100644 bitnami/jupyterhub/4/debian-12/Dockerfile delete mode 100644 bitnami/jupyterhub/4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/jupyterhub/4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/jupyterhub/4/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/jupyterhub/4/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/jupyterhub/4/debian-12/tags-info.yaml create mode 100644 bitnami/kafka/3.4/README.md delete mode 100644 bitnami/kafka/3.4/debian-12/Dockerfile delete mode 100644 bitnami/kafka/3.4/debian-12/docker-compose-cluster.yml delete mode 100644 bitnami/kafka/3.4/debian-12/docker-compose.yml delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/kafka/3.4/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/kafka/3.4/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh delete mode 100755 bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh delete mode 100755 bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh delete mode 100755 bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh delete mode 100755 bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh delete mode 100644 bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh delete mode 100644 bitnami/kafka/3.4/debian-12/tags-info.yaml create mode 100644 bitnami/kafka/3.5/README.md delete mode 100644 bitnami/kafka/3.5/debian-12/Dockerfile delete mode 100644 bitnami/kafka/3.5/debian-12/docker-compose-cluster.yml delete mode 100644 bitnami/kafka/3.5/debian-12/docker-compose.yml delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/kafka/3.5/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/kafka/3.5/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh delete mode 100755 bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh delete mode 100755 bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh delete mode 100755 bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh delete mode 100755 bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh delete mode 100644 bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh delete mode 100644 bitnami/kafka/3.5/debian-12/tags-info.yaml create mode 100644 bitnami/kafka/3.6/README.md delete mode 100644 bitnami/kafka/3.6/debian-12/Dockerfile delete mode 100644 bitnami/kafka/3.6/debian-12/docker-compose-cluster.yml delete mode 100644 bitnami/kafka/3.6/debian-12/docker-compose.yml delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/kafka/3.6/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/kafka/3.6/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh delete mode 100755 bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh delete mode 100755 bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh delete mode 100755 bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh delete mode 100755 bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh delete mode 100644 bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh delete mode 100644 bitnami/kafka/3.6/debian-12/tags-info.yaml create mode 100644 bitnami/kafka/3.7/README.md delete mode 100644 bitnami/kafka/3.7/debian-12/Dockerfile delete mode 100644 bitnami/kafka/3.7/debian-12/docker-compose-cluster.yml delete mode 100644 bitnami/kafka/3.7/debian-12/docker-compose.yml delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/kafka/3.7/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/kafka/3.7/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh delete mode 100755 bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh delete mode 100755 bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh delete mode 100755 bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh delete mode 100755 bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh delete mode 100644 bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh delete mode 100644 bitnami/kafka/3.7/debian-12/tags-info.yaml create mode 100644 bitnami/kafka/3.8/README.md delete mode 100644 bitnami/kafka/3.8/debian-12/Dockerfile delete mode 100644 bitnami/kafka/3.8/debian-12/docker-compose-cluster.yml delete mode 100644 bitnami/kafka/3.8/debian-12/docker-compose.yml delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/kafka/3.8/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/kafka/3.8/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh delete mode 100755 bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh delete mode 100755 bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh delete mode 100755 bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh delete mode 100755 bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh delete mode 100644 bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh delete mode 100644 bitnami/kafka/3.8/debian-12/tags-info.yaml create mode 100644 bitnami/keycloak/25/README.md delete mode 100644 bitnami/keycloak/25/debian-12/Dockerfile delete mode 100644 bitnami/keycloak/25/debian-12/docker-compose.yml delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/keycloak/25/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/keycloak/25/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak-env.sh delete mode 100755 bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/entrypoint.sh delete mode 100755 bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/postunpack.sh delete mode 100755 bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/run.sh delete mode 100755 bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/setup.sh delete mode 100644 bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/libkeycloak.sh delete mode 100644 bitnami/keycloak/25/debian-12/tags-info.yaml create mode 100644 bitnami/kibana/7/README.md delete mode 100644 bitnami/kibana/7/debian-12/Dockerfile delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/kibana/7/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/kibana/7/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana-env.sh delete mode 100755 bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/entrypoint.sh delete mode 100755 bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/postunpack.sh delete mode 100755 bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/run.sh delete mode 100755 bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/setup.sh delete mode 100644 bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/libkibana.sh delete mode 100644 bitnami/kibana/7/debian-12/tags-info.yaml create mode 100644 bitnami/kong-ingress-controller/2/README.md delete mode 100644 bitnami/kong-ingress-controller/2/debian-12/Dockerfile delete mode 100644 bitnami/kong-ingress-controller/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/kong-ingress-controller/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/kong-ingress-controller/2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/kong-ingress-controller/2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/kong-ingress-controller/2/debian-12/tags-info.yaml create mode 100644 bitnami/ksql/7.4/README.md delete mode 100644 bitnami/ksql/7.4/debian-12/Dockerfile delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/ksql/7.4/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/ksql/7.4/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh delete mode 100755 bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh delete mode 100755 bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh delete mode 100755 bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh delete mode 100755 bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh delete mode 100644 bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/libksql.sh delete mode 100644 bitnami/ksql/7.4/debian-12/tags-info.yaml create mode 100644 bitnami/ksql/7.5/README.md delete mode 100644 bitnami/ksql/7.5/debian-12/Dockerfile delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/ksql/7.5/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/ksql/7.5/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh delete mode 100755 bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh delete mode 100755 bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh delete mode 100755 bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh delete mode 100755 bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh delete mode 100644 bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/libksql.sh delete mode 100644 bitnami/ksql/7.5/debian-12/tags-info.yaml create mode 100644 bitnami/ksql/7.6/README.md delete mode 100644 bitnami/ksql/7.6/debian-12/Dockerfile delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/ksql/7.6/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/ksql/7.6/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh delete mode 100755 bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh delete mode 100755 bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh delete mode 100755 bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh delete mode 100755 bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh delete mode 100644 bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/libksql.sh delete mode 100644 bitnami/ksql/7.6/debian-12/tags-info.yaml create mode 100644 bitnami/ksql/7.7/README.md delete mode 100644 bitnami/ksql/7.7/debian-12/Dockerfile delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/ksql/7.7/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/ksql/7.7/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh delete mode 100755 bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh delete mode 100755 bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh delete mode 100755 bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh delete mode 100755 bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh delete mode 100644 bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/libksql.sh delete mode 100644 bitnami/ksql/7.7/debian-12/tags-info.yaml create mode 100644 bitnami/kubectl/1.29/README.md delete mode 100644 bitnami/kubectl/1.29/debian-12/Dockerfile delete mode 100644 bitnami/kubectl/1.29/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/kubectl/1.29/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/kubectl/1.29/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/kubectl/1.29/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/kubectl/1.29/debian-12/tags-info.yaml create mode 100644 bitnami/kubectl/1.30/README.md delete mode 100644 bitnami/kubectl/1.30/debian-12/Dockerfile delete mode 100644 bitnami/kubectl/1.30/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/kubectl/1.30/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/kubectl/1.30/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/kubectl/1.30/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/kubectl/1.30/debian-12/tags-info.yaml create mode 100644 bitnami/kubescape/3.0.3/README.md delete mode 100644 bitnami/kubescape/3.0.3/debian-12/Dockerfile delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/kubescape/3.0.3/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/kubescape/3.0.3/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/kubescape-env.sh delete mode 100755 bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/kubescape/entrypoint.sh delete mode 100755 bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/kubescape/postunpack.sh delete mode 100644 bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/libkubescape.sh delete mode 100644 bitnami/kubescape/3.0.3/debian-12/tags-info.yaml create mode 100644 bitnami/laravel/10/README.md delete mode 100644 bitnami/laravel/10/debian-12/Dockerfile delete mode 100755 bitnami/laravel/10/debian-12/prebuildfs/build/bitnami-user.sh delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/laravel/10/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/laravel/10/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel-env.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/entrypoint.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/postunpack.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/run.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/setup.sh delete mode 100644 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/liblaravel.sh delete mode 100644 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/libphp.sh delete mode 100644 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php-env.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/postunpack.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/reload.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/restart.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/run.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/setup.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/start.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/status.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/stop.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/post-init.d/php.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/laravel/10/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/laravel/10/debian-12/tags-info.yaml create mode 100644 bitnami/logstash/7/README.md delete mode 100644 bitnami/logstash/7/debian-12/Dockerfile delete mode 100644 bitnami/logstash/7/debian-12/docker-compose-testing.yml delete mode 100644 bitnami/logstash/7/debian-12/docker-compose.yml delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/logstash/7/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/logstash/7/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/liblogstash.sh delete mode 100644 bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash-env.sh delete mode 100755 bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/entrypoint.sh delete mode 100755 bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/postunpack.sh delete mode 100755 bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/run.sh delete mode 100755 bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/setup.sh delete mode 100644 bitnami/logstash/7/debian-12/tags-info.yaml create mode 100644 bitnami/mariadb-galera/10.11/README.md delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/Dockerfile delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/docker-compose-ldap.yml delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/docker-compose.yml delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mariadb-galera/10.11/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/libmariadbgalera.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh delete mode 100755 bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh delete mode 100755 bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh delete mode 100755 bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh delete mode 100755 bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh delete mode 100755 bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh delete mode 100644 bitnami/mariadb-galera/10.11/debian-12/tags-info.yaml create mode 100644 bitnami/mariadb-galera/10.5/README.md delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/Dockerfile delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/docker-compose-ldap.yml delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/docker-compose.yml delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mariadb-galera/10.5/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/libmariadbgalera.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh delete mode 100755 bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh delete mode 100755 bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh delete mode 100755 bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh delete mode 100755 bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh delete mode 100755 bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh delete mode 100644 bitnami/mariadb-galera/10.5/debian-12/tags-info.yaml create mode 100644 bitnami/mariadb-galera/10.6/README.md delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/Dockerfile delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/docker-compose-ldap.yml delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/docker-compose.yml delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mariadb-galera/10.6/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/libmariadbgalera.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh delete mode 100755 bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh delete mode 100755 bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh delete mode 100755 bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh delete mode 100755 bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh delete mode 100755 bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh delete mode 100644 bitnami/mariadb-galera/10.6/debian-12/tags-info.yaml create mode 100644 bitnami/mariadb-galera/11.2/README.md delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/Dockerfile delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/docker-compose-ldap.yml delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/docker-compose.yml delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mariadb-galera/11.2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/libmariadbgalera.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh delete mode 100755 bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh delete mode 100755 bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh delete mode 100755 bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh delete mode 100755 bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh delete mode 100755 bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh delete mode 100644 bitnami/mariadb-galera/11.2/debian-12/tags-info.yaml create mode 100644 bitnami/mariadb-galera/11.5/README.md delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/Dockerfile delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/docker-compose-ldap.yml delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/docker-compose.yml delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mariadb-galera/11.5/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/libmariadbgalera.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh delete mode 100755 bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh delete mode 100755 bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh delete mode 100755 bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh delete mode 100755 bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh delete mode 100755 bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh delete mode 100644 bitnami/mariadb-galera/11.5/debian-12/tags-info.yaml create mode 100644 bitnami/mariadb-galera/11.6/README.md delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/Dockerfile delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/docker-compose-ldap.yml delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/docker-compose.yml delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mariadb-galera/11.6/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/libmariadbgalera.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh delete mode 100755 bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh delete mode 100755 bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh delete mode 100755 bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh delete mode 100755 bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh delete mode 100755 bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh delete mode 100644 bitnami/mariadb-galera/11.6/debian-12/tags-info.yaml create mode 100644 bitnami/mariadb/10.11/README.md delete mode 100644 bitnami/mariadb/10.11/debian-12/Dockerfile delete mode 100644 bitnami/mariadb/10.11/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/mariadb/10.11/debian-12/docker-compose.yml delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mariadb/10.11/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mariadb/10.11/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh delete mode 100644 bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh delete mode 100755 bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh delete mode 100755 bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh delete mode 100755 bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh delete mode 100755 bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh delete mode 100755 bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh delete mode 100644 bitnami/mariadb/10.11/debian-12/tags-info.yaml create mode 100644 bitnami/mariadb/10.5/README.md delete mode 100644 bitnami/mariadb/10.5/debian-12/Dockerfile delete mode 100644 bitnami/mariadb/10.5/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/mariadb/10.5/debian-12/docker-compose.yml delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mariadb/10.5/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mariadb/10.5/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh delete mode 100644 bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh delete mode 100755 bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh delete mode 100755 bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh delete mode 100755 bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh delete mode 100755 bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh delete mode 100755 bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh delete mode 100644 bitnami/mariadb/10.5/debian-12/tags-info.yaml create mode 100644 bitnami/mariadb/10.6/README.md delete mode 100644 bitnami/mariadb/10.6/debian-12/Dockerfile delete mode 100644 bitnami/mariadb/10.6/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/mariadb/10.6/debian-12/docker-compose.yml delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mariadb/10.6/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mariadb/10.6/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh delete mode 100644 bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh delete mode 100755 bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh delete mode 100755 bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh delete mode 100755 bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh delete mode 100755 bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh delete mode 100755 bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh delete mode 100644 bitnami/mariadb/10.6/debian-12/tags-info.yaml create mode 100644 bitnami/mariadb/11.2/README.md delete mode 100644 bitnami/mariadb/11.2/debian-12/Dockerfile delete mode 100644 bitnami/mariadb/11.2/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/mariadb/11.2/debian-12/docker-compose.yml delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mariadb/11.2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mariadb/11.2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh delete mode 100644 bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh delete mode 100755 bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh delete mode 100755 bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh delete mode 100755 bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh delete mode 100755 bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh delete mode 100755 bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh delete mode 100644 bitnami/mariadb/11.2/debian-12/tags-info.yaml create mode 100644 bitnami/mariadb/11.5/README.md delete mode 100644 bitnami/mariadb/11.5/debian-12/Dockerfile delete mode 100644 bitnami/mariadb/11.5/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/mariadb/11.5/debian-12/docker-compose.yml delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mariadb/11.5/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mariadb/11.5/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh delete mode 100644 bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh delete mode 100755 bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh delete mode 100755 bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh delete mode 100755 bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh delete mode 100755 bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh delete mode 100755 bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh delete mode 100644 bitnami/mariadb/11.5/debian-12/tags-info.yaml create mode 100644 bitnami/mariadb/11.6/README.md delete mode 100644 bitnami/mariadb/11.6/debian-12/Dockerfile delete mode 100644 bitnami/mariadb/11.6/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/mariadb/11.6/debian-12/docker-compose.yml delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mariadb/11.6/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mariadb/11.6/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh delete mode 100644 bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh delete mode 100755 bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh delete mode 100755 bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh delete mode 100755 bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh delete mode 100755 bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh delete mode 100755 bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh delete mode 100644 bitnami/mariadb/11.6/debian-12/tags-info.yaml create mode 100644 bitnami/mongodb-sharded/7.0/README.md delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/Dockerfile delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/docker-compose-multiple-shards.yml delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/docker-compose.yml delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/mongodb/templates/mongodb.conf.tpl delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/mongodb/templates/mongos.conf.tpl delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/scripts/libmongodb-sharded.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/scripts/libmongodb.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/scripts/mongodb-env.sh delete mode 100755 bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/scripts/mongodb-sharded/entrypoint.sh delete mode 100755 bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/scripts/mongodb-sharded/postunpack.sh delete mode 100755 bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/scripts/mongodb-sharded/run.sh delete mode 100755 bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/scripts/mongodb-sharded/setup.sh delete mode 100644 bitnami/mongodb-sharded/7.0/debian-12/tags-info.yaml create mode 100644 bitnami/mongodb/7.0/README.md delete mode 100644 bitnami/mongodb/7.0/debian-12/Dockerfile delete mode 100644 bitnami/mongodb/7.0/debian-12/docker-compose-replicaset.yml delete mode 100644 bitnami/mongodb/7.0/debian-12/docker-compose.yml delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mongodb/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mongodb/7.0/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mongodb/7.0/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mongodb/7.0/debian-12/rootfs/opt/bitnami/mongodb/templates/mongodb.conf.tpl delete mode 100644 bitnami/mongodb/7.0/debian-12/rootfs/opt/bitnami/scripts/libmongodb.sh delete mode 100644 bitnami/mongodb/7.0/debian-12/rootfs/opt/bitnami/scripts/mongodb-env.sh delete mode 100755 bitnami/mongodb/7.0/debian-12/rootfs/opt/bitnami/scripts/mongodb/entrypoint.sh delete mode 100755 bitnami/mongodb/7.0/debian-12/rootfs/opt/bitnami/scripts/mongodb/postunpack.sh delete mode 100755 bitnami/mongodb/7.0/debian-12/rootfs/opt/bitnami/scripts/mongodb/run.sh delete mode 100755 bitnami/mongodb/7.0/debian-12/rootfs/opt/bitnami/scripts/mongodb/setup.sh delete mode 100644 bitnami/mongodb/7.0/debian-12/tags-info.yaml create mode 100644 bitnami/moodle/4.1/README.md delete mode 100644 bitnami/moodle/4.1/debian-12/Dockerfile delete mode 100644 bitnami/moodle/4.1/debian-12/docker-compose.yml delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/moodle/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/moodle/4.1/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/moodle/4.1/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/apache/conf/deflate.conf delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/apache/conf/vhosts/00_status-vhost.conf delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache-env.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache-modphp/postunpack.sh delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-http-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-https-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-prefix.conf.tpl delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-http-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-https-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-prefix.conf.tpl delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-http-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-https-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-prefix.conf.tpl delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-http-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-https-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-prefix.conf.tpl delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami-ssl.conf.tpl delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami.conf.tpl delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/entrypoint.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/postunpack.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/reload.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/restart.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/run.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/setup.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/start.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/status.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/apache/stop.sh delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/libapache.sh delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/libmoodle.sh delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/libmysqlclient.sh delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/libphp.sh delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/libpostgresqlclient.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/moodle-env.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/moodle/entrypoint.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/moodle/postunpack.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/moodle/run.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/moodle/setup.sh delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/mysql-client-env.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/mysql-client/postunpack.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/mysql-client/setup.sh delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/php-env.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/php/postunpack.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/php/reload.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/php/restart.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/php/run.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/php/setup.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/php/start.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/php/status.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/php/stop.sh delete mode 100644 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/postgresql-client-env.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/opt/bitnami/scripts/postgresql-client/setup.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/post-init.d/php.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/post-init.d/sql-mysql.sh delete mode 100755 bitnami/moodle/4.1/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/moodle/4.1/debian-12/tags-info.yaml create mode 100644 bitnami/moodle/4.3/README.md delete mode 100644 bitnami/moodle/4.3/debian-12/Dockerfile delete mode 100644 bitnami/moodle/4.3/debian-12/docker-compose.yml delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/moodle/4.3/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/moodle/4.3/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/moodle/4.3/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/apache/conf/deflate.conf delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/apache/conf/vhosts/00_status-vhost.conf delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache-env.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache-modphp/postunpack.sh delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-http-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-https-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-prefix.conf.tpl delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-http-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-https-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-prefix.conf.tpl delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-http-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-https-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-prefix.conf.tpl delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-http-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-https-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-prefix.conf.tpl delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami-ssl.conf.tpl delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami.conf.tpl delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/entrypoint.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/postunpack.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/reload.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/restart.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/run.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/setup.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/start.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/status.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/apache/stop.sh delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/libapache.sh delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/libmoodle.sh delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/libmysqlclient.sh delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/libphp.sh delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/libpostgresqlclient.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/moodle-env.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/moodle/entrypoint.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/moodle/postunpack.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/moodle/run.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/moodle/setup.sh delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/mysql-client-env.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/mysql-client/postunpack.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/mysql-client/setup.sh delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/php-env.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/php/postunpack.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/php/reload.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/php/restart.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/php/run.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/php/setup.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/php/start.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/php/status.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/php/stop.sh delete mode 100644 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/postgresql-client-env.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/opt/bitnami/scripts/postgresql-client/setup.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/post-init.d/php.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/post-init.d/sql-mysql.sh delete mode 100755 bitnami/moodle/4.3/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/moodle/4.3/debian-12/tags-info.yaml create mode 100644 bitnami/moodle/4.4/README.md delete mode 100644 bitnami/moodle/4.4/debian-12/Dockerfile delete mode 100644 bitnami/moodle/4.4/debian-12/docker-compose.yml delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/moodle/4.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/moodle/4.4/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/moodle/4.4/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/apache/conf/deflate.conf delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/apache/conf/vhosts/00_status-vhost.conf delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache-env.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache-modphp/postunpack.sh delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-http-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-https-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-prefix.conf.tpl delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-http-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-https-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-prefix.conf.tpl delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-http-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-https-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-prefix.conf.tpl delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-http-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-https-vhost.conf.tpl delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-prefix.conf.tpl delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami-ssl.conf.tpl delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami.conf.tpl delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/entrypoint.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/postunpack.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/reload.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/restart.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/run.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/setup.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/start.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/status.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/apache/stop.sh delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/libapache.sh delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/libmoodle.sh delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/libmysqlclient.sh delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/libphp.sh delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/libpostgresqlclient.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/moodle-env.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/moodle/entrypoint.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/moodle/postunpack.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/moodle/run.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/moodle/setup.sh delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/mysql-client-env.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/mysql-client/postunpack.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/mysql-client/setup.sh delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/php-env.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/php/postunpack.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/php/reload.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/php/restart.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/php/run.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/php/setup.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/php/start.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/php/status.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/php/stop.sh delete mode 100644 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/postgresql-client-env.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/opt/bitnami/scripts/postgresql-client/setup.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/post-init.d/php.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/post-init.d/sql-mysql.sh delete mode 100755 bitnami/moodle/4.4/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/moodle/4.4/debian-12/tags-info.yaml create mode 100644 bitnami/mysql/8.0/README.md delete mode 100644 bitnami/mysql/8.0/debian-12/Dockerfile delete mode 100644 bitnami/mysql/8.0/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/mysql/8.0/debian-12/docker-compose.yml delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mysql/8.0/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mysql/8.0/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/libmysql.sh delete mode 100644 bitnami/mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/mysql-env.sh delete mode 100755 bitnami/mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/mysql/entrypoint.sh delete mode 100755 bitnami/mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/mysql/healthcheck.sh delete mode 100755 bitnami/mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/mysql/postunpack.sh delete mode 100755 bitnami/mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/mysql/run.sh delete mode 100755 bitnami/mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/mysql/setup.sh delete mode 100644 bitnami/mysql/8.0/debian-12/tags-info.yaml create mode 100644 bitnami/mysql/9.0/README.md delete mode 100644 bitnami/mysql/9.0/debian-12/Dockerfile delete mode 100644 bitnami/mysql/9.0/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/mysql/9.0/debian-12/docker-compose.yml delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/mysql/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/mysql/9.0/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/mysql/9.0/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/mysql/9.0/debian-12/rootfs/opt/bitnami/scripts/libmysql.sh delete mode 100644 bitnami/mysql/9.0/debian-12/rootfs/opt/bitnami/scripts/mysql-env.sh delete mode 100755 bitnami/mysql/9.0/debian-12/rootfs/opt/bitnami/scripts/mysql/entrypoint.sh delete mode 100755 bitnami/mysql/9.0/debian-12/rootfs/opt/bitnami/scripts/mysql/healthcheck.sh delete mode 100755 bitnami/mysql/9.0/debian-12/rootfs/opt/bitnami/scripts/mysql/postunpack.sh delete mode 100755 bitnami/mysql/9.0/debian-12/rootfs/opt/bitnami/scripts/mysql/run.sh delete mode 100755 bitnami/mysql/9.0/debian-12/rootfs/opt/bitnami/scripts/mysql/setup.sh delete mode 100644 bitnami/mysql/9.0/debian-12/tags-info.yaml create mode 100644 bitnami/neo4j/4/README.md delete mode 100644 bitnami/neo4j/4/debian-12/Dockerfile delete mode 100644 bitnami/neo4j/4/debian-12/docker-compose.yml delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/neo4j/4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/neo4j/4/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/neo4j/4/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/neo4j/4/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/neo4j/4/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/neo4j/4/debian-12/rootfs/opt/bitnami/scripts/libneo4j.sh delete mode 100644 bitnami/neo4j/4/debian-12/rootfs/opt/bitnami/scripts/neo4j-env.sh delete mode 100755 bitnami/neo4j/4/debian-12/rootfs/opt/bitnami/scripts/neo4j/entrypoint.sh delete mode 100755 bitnami/neo4j/4/debian-12/rootfs/opt/bitnami/scripts/neo4j/postunpack.sh delete mode 100755 bitnami/neo4j/4/debian-12/rootfs/opt/bitnami/scripts/neo4j/run.sh delete mode 100755 bitnami/neo4j/4/debian-12/rootfs/opt/bitnami/scripts/neo4j/setup.sh delete mode 100644 bitnami/neo4j/4/debian-12/tags-info.yaml create mode 100644 bitnami/nginx/1.26/README.md delete mode 100644 bitnami/nginx/1.26/debian-12/Dockerfile delete mode 100644 bitnami/nginx/1.26/debian-12/docker-compose.yml delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/nginx/1.26/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/nginx/1.26/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/nginx/1.26/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/nginx/conf/bitnami/protect-hidden-files.conf delete mode 100644 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/nginx/conf/nginx.conf delete mode 100644 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/libnginx.sh delete mode 100644 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx-env.sh delete mode 100644 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/bitnami-templates/app-http-server-block.conf.tpl delete mode 100644 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/bitnami-templates/app-https-server-block.conf.tpl delete mode 100644 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/bitnami-templates/app-php-prefix.conf.tpl delete mode 100644 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/bitnami-templates/app-prefix.conf.tpl delete mode 100644 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/bitnami-templates/default-https-server-block.conf delete mode 100755 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/entrypoint.sh delete mode 100755 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/postunpack.sh delete mode 100755 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/reload.sh delete mode 100755 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/restart.sh delete mode 100755 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/run.sh delete mode 100755 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/setup.sh delete mode 100755 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/start.sh delete mode 100755 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/status.sh delete mode 100755 bitnami/nginx/1.26/debian-12/rootfs/opt/bitnami/scripts/nginx/stop.sh delete mode 100644 bitnami/nginx/1.26/debian-12/tags-info.yaml create mode 100644 bitnami/node/18/README.md delete mode 100644 bitnami/node/18/debian-12/Dockerfile delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/node/18/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/node/18/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/node/18/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/node/18/debian-12/rootfs/opt/bitnami/scripts/node/postunpack.sh delete mode 100644 bitnami/node/18/debian-12/tags-info.yaml create mode 100644 bitnami/node/20/README.md delete mode 100644 bitnami/node/20/debian-12/Dockerfile delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/node/20/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/node/20/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/node/20/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/node/20/debian-12/rootfs/opt/bitnami/scripts/node/postunpack.sh delete mode 100644 bitnami/node/20/debian-12/tags-info.yaml delete mode 100644 bitnami/odoo/16/debian-12/Dockerfile delete mode 100644 bitnami/odoo/16/debian-12/docker-compose.yml delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/odoo/16/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/odoo/16/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/odoo/16/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/odoo/16/debian-12/rootfs/opt/bitnami/scripts/libodoo.sh delete mode 100644 bitnami/odoo/16/debian-12/rootfs/opt/bitnami/scripts/libpostgresqlclient.sh delete mode 100644 bitnami/odoo/16/debian-12/rootfs/opt/bitnami/scripts/odoo-env.sh delete mode 100644 bitnami/odoo/16/debian-12/rootfs/opt/bitnami/scripts/odoo/bitnami-templates/odoo.conf.tpl delete mode 100755 bitnami/odoo/16/debian-12/rootfs/opt/bitnami/scripts/odoo/entrypoint.sh delete mode 100755 bitnami/odoo/16/debian-12/rootfs/opt/bitnami/scripts/odoo/postunpack.sh delete mode 100755 bitnami/odoo/16/debian-12/rootfs/opt/bitnami/scripts/odoo/run.sh delete mode 100755 bitnami/odoo/16/debian-12/rootfs/opt/bitnami/scripts/odoo/setup.sh delete mode 100644 bitnami/odoo/16/debian-12/rootfs/opt/bitnami/scripts/postgresql-client-env.sh delete mode 100755 bitnami/odoo/16/debian-12/rootfs/opt/bitnami/scripts/postgresql-client/setup.sh delete mode 100755 bitnami/odoo/16/debian-12/rootfs/post-init.d/python.sh delete mode 100755 bitnami/odoo/16/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/odoo/16/debian-12/rootfs/post-init.d/sql-postgresql.sh delete mode 100755 bitnami/odoo/16/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/odoo/16/debian-12/tags-info.yaml delete mode 100644 bitnami/odoo/17/debian-12/Dockerfile delete mode 100644 bitnami/odoo/17/debian-12/docker-compose.yml delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/odoo/17/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/odoo/17/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/odoo/17/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/odoo/17/debian-12/rootfs/opt/bitnami/scripts/libodoo.sh delete mode 100644 bitnami/odoo/17/debian-12/rootfs/opt/bitnami/scripts/libpostgresqlclient.sh delete mode 100644 bitnami/odoo/17/debian-12/rootfs/opt/bitnami/scripts/odoo-env.sh delete mode 100644 bitnami/odoo/17/debian-12/rootfs/opt/bitnami/scripts/odoo/bitnami-templates/odoo.conf.tpl delete mode 100755 bitnami/odoo/17/debian-12/rootfs/opt/bitnami/scripts/odoo/entrypoint.sh delete mode 100755 bitnami/odoo/17/debian-12/rootfs/opt/bitnami/scripts/odoo/postunpack.sh delete mode 100755 bitnami/odoo/17/debian-12/rootfs/opt/bitnami/scripts/odoo/run.sh delete mode 100755 bitnami/odoo/17/debian-12/rootfs/opt/bitnami/scripts/odoo/setup.sh delete mode 100644 bitnami/odoo/17/debian-12/rootfs/opt/bitnami/scripts/postgresql-client-env.sh delete mode 100755 bitnami/odoo/17/debian-12/rootfs/opt/bitnami/scripts/postgresql-client/setup.sh delete mode 100755 bitnami/odoo/17/debian-12/rootfs/post-init.d/python.sh delete mode 100755 bitnami/odoo/17/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/odoo/17/debian-12/rootfs/post-init.d/sql-postgresql.sh delete mode 100755 bitnami/odoo/17/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/odoo/17/debian-12/tags-info.yaml create mode 100644 bitnami/openldap/2.5/README.md delete mode 100644 bitnami/openldap/2.5/debian-12/Dockerfile delete mode 100644 bitnami/openldap/2.5/debian-12/docker-compose-testing.yml delete mode 100644 bitnami/openldap/2.5/debian-12/docker-compose.yml delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/openldap/2.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/openldap/2.5/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/openldap/2.5/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/openldap/2.5/debian-12/rootfs/opt/bitnami/scripts/libopenldap.sh delete mode 100755 bitnami/openldap/2.5/debian-12/rootfs/opt/bitnami/scripts/openldap/entrypoint.sh delete mode 100755 bitnami/openldap/2.5/debian-12/rootfs/opt/bitnami/scripts/openldap/postunpack.sh delete mode 100755 bitnami/openldap/2.5/debian-12/rootfs/opt/bitnami/scripts/openldap/run.sh delete mode 100755 bitnami/openldap/2.5/debian-12/rootfs/opt/bitnami/scripts/openldap/setup.sh delete mode 100644 bitnami/openldap/2.5/debian-12/tags-info.yaml create mode 100644 bitnami/openresty/1.25/README.md delete mode 100644 bitnami/openresty/1.25/debian-12/Dockerfile delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/openresty/1.25/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/openresty/1.25/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/openresty/1.25/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/openresty/1.25/debian-12/rootfs/opt/bitnami/openresty/nginx/conf/bitnami/protect-hidden-files.conf delete mode 100644 bitnami/openresty/1.25/debian-12/rootfs/opt/bitnami/openresty/nginx/conf/nginx.conf delete mode 100644 bitnami/openresty/1.25/debian-12/rootfs/opt/bitnami/scripts/libopenresty.sh delete mode 100644 bitnami/openresty/1.25/debian-12/rootfs/opt/bitnami/scripts/openresty-env.sh delete mode 100755 bitnami/openresty/1.25/debian-12/rootfs/opt/bitnami/scripts/openresty/entrypoint.sh delete mode 100755 bitnami/openresty/1.25/debian-12/rootfs/opt/bitnami/scripts/openresty/postunpack.sh delete mode 100755 bitnami/openresty/1.25/debian-12/rootfs/opt/bitnami/scripts/openresty/run.sh delete mode 100755 bitnami/openresty/1.25/debian-12/rootfs/opt/bitnami/scripts/openresty/setup.sh delete mode 100644 bitnami/openresty/1.25/debian-12/tags-info.yaml create mode 100644 bitnami/opensearch-dashboards/1/README.md delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/Dockerfile delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/opensearch-dashboards/1/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/rootfs/opt/bitnami/scripts/libopensearchdashboards.sh delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/rootfs/opt/bitnami/scripts/opensearch-dashboards-env.sh delete mode 100755 bitnami/opensearch-dashboards/1/debian-12/rootfs/opt/bitnami/scripts/opensearch-dashboards/entrypoint.sh delete mode 100755 bitnami/opensearch-dashboards/1/debian-12/rootfs/opt/bitnami/scripts/opensearch-dashboards/postunpack.sh delete mode 100755 bitnami/opensearch-dashboards/1/debian-12/rootfs/opt/bitnami/scripts/opensearch-dashboards/run.sh delete mode 100755 bitnami/opensearch-dashboards/1/debian-12/rootfs/opt/bitnami/scripts/opensearch-dashboards/setup.sh delete mode 100644 bitnami/opensearch-dashboards/1/debian-12/tags-info.yaml create mode 100644 bitnami/opensearch/1/README.md delete mode 100644 bitnami/opensearch/1/debian-12/Dockerfile delete mode 100644 bitnami/opensearch/1/debian-12/docker-compose.yml delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/opensearch/1/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/opensearch/1/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/opensearch/1/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/opensearch/1/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/opensearch/1/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/opensearch/1/debian-12/rootfs/opt/bitnami/scripts/libopensearch.sh delete mode 100644 bitnami/opensearch/1/debian-12/rootfs/opt/bitnami/scripts/opensearch-env.sh delete mode 100755 bitnami/opensearch/1/debian-12/rootfs/opt/bitnami/scripts/opensearch/entrypoint.sh delete mode 100755 bitnami/opensearch/1/debian-12/rootfs/opt/bitnami/scripts/opensearch/healthcheck.sh delete mode 100755 bitnami/opensearch/1/debian-12/rootfs/opt/bitnami/scripts/opensearch/postunpack.sh delete mode 100755 bitnami/opensearch/1/debian-12/rootfs/opt/bitnami/scripts/opensearch/run.sh delete mode 100755 bitnami/opensearch/1/debian-12/rootfs/opt/bitnami/scripts/opensearch/setup.sh delete mode 100644 bitnami/opensearch/1/debian-12/tags-info.yaml create mode 100644 bitnami/parse-dashboard/5/README.md delete mode 100644 bitnami/parse-dashboard/5/debian-12/Dockerfile delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/parse-dashboard/5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/parse-dashboard/5/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/parse-dashboard/5/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/parse-dashboard/5/debian-12/rootfs/opt/bitnami/scripts/libparsedashboard.sh delete mode 100644 bitnami/parse-dashboard/5/debian-12/rootfs/opt/bitnami/scripts/parse-dashboard-env.sh delete mode 100755 bitnami/parse-dashboard/5/debian-12/rootfs/opt/bitnami/scripts/parse-dashboard/entrypoint.sh delete mode 100755 bitnami/parse-dashboard/5/debian-12/rootfs/opt/bitnami/scripts/parse-dashboard/postunpack.sh delete mode 100755 bitnami/parse-dashboard/5/debian-12/rootfs/opt/bitnami/scripts/parse-dashboard/run.sh delete mode 100755 bitnami/parse-dashboard/5/debian-12/rootfs/opt/bitnami/scripts/parse-dashboard/setup.sh delete mode 100755 bitnami/parse-dashboard/5/debian-12/rootfs/opt/bitnami/scripts/parse-dashboard/updatehost.sh delete mode 100755 bitnami/parse-dashboard/5/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/parse-dashboard/5/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/parse-dashboard/5/debian-12/tags-info.yaml create mode 100644 bitnami/percona-mysql/8.0/README.md delete mode 100644 bitnami/percona-mysql/8.0/debian-12/Dockerfile delete mode 100644 bitnami/percona-mysql/8.0/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/percona-mysql/8.0/debian-12/docker-compose.yml delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/percona-mysql/8.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/percona-mysql/8.0/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/percona-mysql/8.0/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/percona-mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/libmysql.sh delete mode 100644 bitnami/percona-mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/mysql-env.sh delete mode 100755 bitnami/percona-mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/mysql/entrypoint.sh delete mode 100755 bitnami/percona-mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/mysql/healthcheck.sh delete mode 100755 bitnami/percona-mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/mysql/postunpack.sh delete mode 100755 bitnami/percona-mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/mysql/run.sh delete mode 100755 bitnami/percona-mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/mysql/setup.sh delete mode 100644 bitnami/percona-mysql/8.0/debian-12/tags-info.yaml create mode 100644 bitnami/percona-mysql/8.1/README.md delete mode 100644 bitnami/percona-mysql/8.1/debian-12/Dockerfile delete mode 100644 bitnami/percona-mysql/8.1/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/percona-mysql/8.1/debian-12/docker-compose.yml delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/percona-mysql/8.1/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/percona-mysql/8.1/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/percona-mysql/8.1/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/percona-mysql/8.1/debian-12/rootfs/opt/bitnami/scripts/libmysql.sh delete mode 100644 bitnami/percona-mysql/8.1/debian-12/rootfs/opt/bitnami/scripts/mysql-env.sh delete mode 100755 bitnami/percona-mysql/8.1/debian-12/rootfs/opt/bitnami/scripts/mysql/entrypoint.sh delete mode 100755 bitnami/percona-mysql/8.1/debian-12/rootfs/opt/bitnami/scripts/mysql/healthcheck.sh delete mode 100755 bitnami/percona-mysql/8.1/debian-12/rootfs/opt/bitnami/scripts/mysql/postunpack.sh delete mode 100755 bitnami/percona-mysql/8.1/debian-12/rootfs/opt/bitnami/scripts/mysql/run.sh delete mode 100755 bitnami/percona-mysql/8.1/debian-12/rootfs/opt/bitnami/scripts/mysql/setup.sh delete mode 100644 bitnami/percona-mysql/8.1/debian-12/tags-info.yaml create mode 100644 bitnami/percona-mysql/8.2/README.md delete mode 100644 bitnami/percona-mysql/8.2/debian-12/Dockerfile delete mode 100644 bitnami/percona-mysql/8.2/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/percona-mysql/8.2/debian-12/docker-compose.yml delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/percona-mysql/8.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/percona-mysql/8.2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/percona-mysql/8.2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/percona-mysql/8.2/debian-12/rootfs/opt/bitnami/scripts/libmysql.sh delete mode 100644 bitnami/percona-mysql/8.2/debian-12/rootfs/opt/bitnami/scripts/mysql-env.sh delete mode 100755 bitnami/percona-mysql/8.2/debian-12/rootfs/opt/bitnami/scripts/mysql/entrypoint.sh delete mode 100755 bitnami/percona-mysql/8.2/debian-12/rootfs/opt/bitnami/scripts/mysql/healthcheck.sh delete mode 100755 bitnami/percona-mysql/8.2/debian-12/rootfs/opt/bitnami/scripts/mysql/postunpack.sh delete mode 100755 bitnami/percona-mysql/8.2/debian-12/rootfs/opt/bitnami/scripts/mysql/run.sh delete mode 100755 bitnami/percona-mysql/8.2/debian-12/rootfs/opt/bitnami/scripts/mysql/setup.sh delete mode 100644 bitnami/percona-mysql/8.2/debian-12/tags-info.yaml create mode 100644 bitnami/percona-mysql/8.3/README.md delete mode 100644 bitnami/percona-mysql/8.3/debian-12/Dockerfile delete mode 100644 bitnami/percona-mysql/8.3/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/percona-mysql/8.3/debian-12/docker-compose.yml delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/percona-mysql/8.3/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/percona-mysql/8.3/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/percona-mysql/8.3/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/percona-mysql/8.3/debian-12/rootfs/opt/bitnami/scripts/libmysql.sh delete mode 100644 bitnami/percona-mysql/8.3/debian-12/rootfs/opt/bitnami/scripts/mysql-env.sh delete mode 100755 bitnami/percona-mysql/8.3/debian-12/rootfs/opt/bitnami/scripts/mysql/entrypoint.sh delete mode 100755 bitnami/percona-mysql/8.3/debian-12/rootfs/opt/bitnami/scripts/mysql/healthcheck.sh delete mode 100755 bitnami/percona-mysql/8.3/debian-12/rootfs/opt/bitnami/scripts/mysql/postunpack.sh delete mode 100755 bitnami/percona-mysql/8.3/debian-12/rootfs/opt/bitnami/scripts/mysql/run.sh delete mode 100755 bitnami/percona-mysql/8.3/debian-12/rootfs/opt/bitnami/scripts/mysql/setup.sh delete mode 100644 bitnami/percona-mysql/8.3/debian-12/tags-info.yaml create mode 100644 bitnami/php-fpm/8.1/README.md delete mode 100644 bitnami/php-fpm/8.1/debian-12/Dockerfile delete mode 100644 bitnami/php-fpm/8.1/debian-12/docker-compose.yml delete mode 100644 bitnami/php-fpm/8.1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/php-fpm/8.1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/php-fpm/8.1/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/php-fpm/8.1/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/php-fpm/8.1/debian-12/tags-info.yaml create mode 100644 bitnami/php-fpm/8.2/README.md delete mode 100644 bitnami/php-fpm/8.2/debian-12/Dockerfile delete mode 100644 bitnami/php-fpm/8.2/debian-12/docker-compose.yml delete mode 100644 bitnami/php-fpm/8.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/php-fpm/8.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/php-fpm/8.2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/php-fpm/8.2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/php-fpm/8.2/debian-12/tags-info.yaml create mode 100644 bitnami/php-fpm/8.3/README.md delete mode 100644 bitnami/php-fpm/8.3/debian-12/Dockerfile delete mode 100644 bitnami/php-fpm/8.3/debian-12/docker-compose.yml delete mode 100644 bitnami/php-fpm/8.3/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/php-fpm/8.3/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/php-fpm/8.3/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/php-fpm/8.3/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/php-fpm/8.3/debian-12/tags-info.yaml create mode 100644 bitnami/postgresql-repmgr/13/README.md delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/Dockerfile delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/docker-compose.yml delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/events/execs/includes/anotate_event_processing.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/events/execs/includes/lock_primary.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/events/execs/includes/lock_standby.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/events/execs/includes/unlock_primary.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/events/execs/includes/unlock_standby.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/events/execs/primary_register.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/events/execs/repmgrd_failover_follow.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/events/execs/standby_follow.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/events/execs/standby_promote.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/events/router.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/rootfs/opt/bitnami/scripts/libpostgresql.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/entrypoint.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/postunpack.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/run.sh delete mode 100755 bitnami/postgresql-repmgr/13/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/setup.sh delete mode 100644 bitnami/postgresql-repmgr/13/debian-12/tags-info.yaml create mode 100644 bitnami/postgresql-repmgr/14/README.md delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/Dockerfile delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/docker-compose.yml delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/events/execs/includes/anotate_event_processing.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/events/execs/includes/lock_primary.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/events/execs/includes/lock_standby.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/events/execs/includes/unlock_primary.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/events/execs/includes/unlock_standby.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/events/execs/primary_register.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/events/execs/repmgrd_failover_follow.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/events/execs/standby_follow.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/events/execs/standby_promote.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/events/router.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/rootfs/opt/bitnami/scripts/libpostgresql.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/entrypoint.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/postunpack.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/run.sh delete mode 100755 bitnami/postgresql-repmgr/14/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/setup.sh delete mode 100644 bitnami/postgresql-repmgr/14/debian-12/tags-info.yaml create mode 100644 bitnami/postgresql-repmgr/15/README.md delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/Dockerfile delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/docker-compose.yml delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/events/execs/includes/anotate_event_processing.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/events/execs/includes/lock_primary.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/events/execs/includes/lock_standby.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/events/execs/includes/unlock_primary.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/events/execs/includes/unlock_standby.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/events/execs/primary_register.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/events/execs/repmgrd_failover_follow.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/events/execs/standby_follow.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/events/execs/standby_promote.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/events/router.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/rootfs/opt/bitnami/scripts/libpostgresql.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/entrypoint.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/postunpack.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/run.sh delete mode 100755 bitnami/postgresql-repmgr/15/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/setup.sh delete mode 100644 bitnami/postgresql-repmgr/15/debian-12/tags-info.yaml create mode 100644 bitnami/postgresql-repmgr/16/README.md delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/Dockerfile delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/docker-compose.yml delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/events/execs/includes/anotate_event_processing.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/events/execs/includes/lock_primary.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/events/execs/includes/lock_standby.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/events/execs/includes/unlock_primary.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/events/execs/includes/unlock_standby.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/events/execs/primary_register.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/events/execs/repmgrd_failover_follow.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/events/execs/standby_follow.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/events/execs/standby_promote.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/events/router.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/rootfs/opt/bitnami/scripts/libpostgresql.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/entrypoint.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/postunpack.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/run.sh delete mode 100755 bitnami/postgresql-repmgr/16/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/setup.sh delete mode 100644 bitnami/postgresql-repmgr/16/debian-12/tags-info.yaml create mode 100644 bitnami/postgresql/13/README.md delete mode 100644 bitnami/postgresql/13/debian-12/Dockerfile delete mode 100644 bitnami/postgresql/13/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/postgresql/13/debian-12/docker-compose.yml delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/postgresql/13/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/postgresql/13/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/postgresql/13/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/postgresql/13/debian-12/rootfs/opt/bitnami/scripts/libautoctl.sh delete mode 100644 bitnami/postgresql/13/debian-12/rootfs/opt/bitnami/scripts/libpostgresql.sh delete mode 100755 bitnami/postgresql/13/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/postgresql/13/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh delete mode 100755 bitnami/postgresql/13/debian-12/rootfs/opt/bitnami/scripts/postgresql/entrypoint.sh delete mode 100755 bitnami/postgresql/13/debian-12/rootfs/opt/bitnami/scripts/postgresql/postunpack.sh delete mode 100755 bitnami/postgresql/13/debian-12/rootfs/opt/bitnami/scripts/postgresql/run-autoctl.sh delete mode 100755 bitnami/postgresql/13/debian-12/rootfs/opt/bitnami/scripts/postgresql/run.sh delete mode 100755 bitnami/postgresql/13/debian-12/rootfs/opt/bitnami/scripts/postgresql/setup.sh delete mode 100644 bitnami/postgresql/13/debian-12/tags-info.yaml create mode 100644 bitnami/postgresql/14/README.md delete mode 100644 bitnami/postgresql/14/debian-12/Dockerfile delete mode 100644 bitnami/postgresql/14/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/postgresql/14/debian-12/docker-compose.yml delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/postgresql/14/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/postgresql/14/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/postgresql/14/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/libautoctl.sh delete mode 100644 bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/libpostgresql.sh delete mode 100755 bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh delete mode 100755 bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/postgresql/entrypoint.sh delete mode 100755 bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/postgresql/postunpack.sh delete mode 100755 bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/postgresql/run-autoctl.sh delete mode 100755 bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/postgresql/run.sh delete mode 100755 bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/postgresql/setup.sh delete mode 100644 bitnami/postgresql/14/debian-12/tags-info.yaml create mode 100644 bitnami/postgresql/15/README.md delete mode 100644 bitnami/postgresql/15/debian-12/Dockerfile delete mode 100644 bitnami/postgresql/15/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/postgresql/15/debian-12/docker-compose.yml delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/postgresql/15/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/postgresql/15/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/postgresql/15/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/postgresql/15/debian-12/rootfs/opt/bitnami/scripts/libautoctl.sh delete mode 100644 bitnami/postgresql/15/debian-12/rootfs/opt/bitnami/scripts/libpostgresql.sh delete mode 100755 bitnami/postgresql/15/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/postgresql/15/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh delete mode 100755 bitnami/postgresql/15/debian-12/rootfs/opt/bitnami/scripts/postgresql/entrypoint.sh delete mode 100755 bitnami/postgresql/15/debian-12/rootfs/opt/bitnami/scripts/postgresql/postunpack.sh delete mode 100755 bitnami/postgresql/15/debian-12/rootfs/opt/bitnami/scripts/postgresql/run-autoctl.sh delete mode 100755 bitnami/postgresql/15/debian-12/rootfs/opt/bitnami/scripts/postgresql/run.sh delete mode 100755 bitnami/postgresql/15/debian-12/rootfs/opt/bitnami/scripts/postgresql/setup.sh delete mode 100644 bitnami/postgresql/15/debian-12/tags-info.yaml create mode 100644 bitnami/postgresql/16/README.md delete mode 100644 bitnami/postgresql/16/debian-12/Dockerfile delete mode 100644 bitnami/postgresql/16/debian-12/docker-compose-replication.yml delete mode 100644 bitnami/postgresql/16/debian-12/docker-compose.yml delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/postgresql/16/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/postgresql/16/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/postgresql/16/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/postgresql/16/debian-12/rootfs/opt/bitnami/scripts/libautoctl.sh delete mode 100644 bitnami/postgresql/16/debian-12/rootfs/opt/bitnami/scripts/libpostgresql.sh delete mode 100755 bitnami/postgresql/16/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh delete mode 100644 bitnami/postgresql/16/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh delete mode 100755 bitnami/postgresql/16/debian-12/rootfs/opt/bitnami/scripts/postgresql/entrypoint.sh delete mode 100755 bitnami/postgresql/16/debian-12/rootfs/opt/bitnami/scripts/postgresql/postunpack.sh delete mode 100755 bitnami/postgresql/16/debian-12/rootfs/opt/bitnami/scripts/postgresql/run-autoctl.sh delete mode 100755 bitnami/postgresql/16/debian-12/rootfs/opt/bitnami/scripts/postgresql/run.sh delete mode 100755 bitnami/postgresql/16/debian-12/rootfs/opt/bitnami/scripts/postgresql/setup.sh delete mode 100644 bitnami/postgresql/16/debian-12/tags-info.yaml create mode 100644 bitnami/prometheus/3/README.md delete mode 100644 bitnami/prometheus/3/debian-12/Dockerfile delete mode 100644 bitnami/prometheus/3/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/prometheus/3/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/prometheus/3/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/prometheus/3/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/prometheus/3/debian-12/tags-info.yaml create mode 100644 bitnami/python/3.10/README.md delete mode 100644 bitnami/python/3.10/debian-12/Dockerfile delete mode 100644 bitnami/python/3.10/debian-12/docker-compose.yml delete mode 100644 bitnami/python/3.10/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/python/3.10/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/python/3.10/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/python/3.10/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/python/3.10/debian-12/tags-info.yaml create mode 100644 bitnami/python/3.11/README.md delete mode 100644 bitnami/python/3.11/debian-12/Dockerfile delete mode 100644 bitnami/python/3.11/debian-12/docker-compose.yml delete mode 100644 bitnami/python/3.11/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/python/3.11/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/python/3.11/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/python/3.11/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/python/3.11/debian-12/tags-info.yaml create mode 100644 bitnami/python/3.12/README.md delete mode 100644 bitnami/python/3.12/debian-12/Dockerfile delete mode 100644 bitnami/python/3.12/debian-12/docker-compose.yml delete mode 100644 bitnami/python/3.12/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/python/3.12/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/python/3.12/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/python/3.12/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/python/3.12/debian-12/tags-info.yaml create mode 100644 bitnami/python/3.9/README.md delete mode 100644 bitnami/python/3.9/debian-12/Dockerfile delete mode 100644 bitnami/python/3.9/debian-12/docker-compose.yml delete mode 100644 bitnami/python/3.9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/python/3.9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/python/3.9/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/python/3.9/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/python/3.9/debian-12/tags-info.yaml create mode 100644 bitnami/rails/7/README.md delete mode 100644 bitnami/rails/7/debian-12/Dockerfile delete mode 100644 bitnami/rails/7/debian-12/docker-compose-testing.yml delete mode 100644 bitnami/rails/7/debian-12/docker-compose.yml delete mode 100755 bitnami/rails/7/debian-12/prebuildfs/build/bitnami-user.sh delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/rails/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/rails/7/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/rails/7/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/rails/7/debian-12/rootfs/opt/bitnami/scripts/librails.sh delete mode 100644 bitnami/rails/7/debian-12/rootfs/opt/bitnami/scripts/rails-env.sh delete mode 100755 bitnami/rails/7/debian-12/rootfs/opt/bitnami/scripts/rails/entrypoint.sh delete mode 100755 bitnami/rails/7/debian-12/rootfs/opt/bitnami/scripts/rails/postunpack.sh delete mode 100755 bitnami/rails/7/debian-12/rootfs/opt/bitnami/scripts/rails/setup.sh delete mode 100755 bitnami/rails/7/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/rails/7/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/rails/7/debian-12/tags-info.yaml create mode 100644 bitnami/redis-cluster/6.2/README.md delete mode 100644 bitnami/redis-cluster/6.2/debian-12/Dockerfile delete mode 100644 bitnami/redis-cluster/6.2/debian-12/docker-compose.yml delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/redis-cluster/6.2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/redis-cluster/6.2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/redis-cluster/6.2/debian-12/rootfs/opt/bitnami/scripts/libredis.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/rootfs/opt/bitnami/scripts/librediscluster.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/rootfs/opt/bitnami/scripts/redis-cluster-env.sh delete mode 100755 bitnami/redis-cluster/6.2/debian-12/rootfs/opt/bitnami/scripts/redis-cluster/entrypoint.sh delete mode 100755 bitnami/redis-cluster/6.2/debian-12/rootfs/opt/bitnami/scripts/redis-cluster/postunpack.sh delete mode 100755 bitnami/redis-cluster/6.2/debian-12/rootfs/opt/bitnami/scripts/redis-cluster/run.sh delete mode 100755 bitnami/redis-cluster/6.2/debian-12/rootfs/opt/bitnami/scripts/redis-cluster/setup.sh delete mode 100644 bitnami/redis-cluster/6.2/debian-12/tags-info.yaml create mode 100644 bitnami/redis-sentinel/6.2/README.md delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/Dockerfile delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/redis-sentinel/6.2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/rootfs/opt/bitnami/scripts/libredissentinel.sh delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/rootfs/opt/bitnami/scripts/redis-sentinel-env.sh delete mode 100755 bitnami/redis-sentinel/6.2/debian-12/rootfs/opt/bitnami/scripts/redis-sentinel/entrypoint.sh delete mode 100755 bitnami/redis-sentinel/6.2/debian-12/rootfs/opt/bitnami/scripts/redis-sentinel/postunpack.sh delete mode 100755 bitnami/redis-sentinel/6.2/debian-12/rootfs/opt/bitnami/scripts/redis-sentinel/run.sh delete mode 100755 bitnami/redis-sentinel/6.2/debian-12/rootfs/opt/bitnami/scripts/redis-sentinel/setup.sh delete mode 100644 bitnami/redis-sentinel/6.2/debian-12/tags-info.yaml create mode 100644 bitnami/redis/6.2/README.md delete mode 100644 bitnami/redis/6.2/debian-12/Dockerfile delete mode 100644 bitnami/redis/6.2/debian-12/docker-compose-replicaset.yml delete mode 100644 bitnami/redis/6.2/debian-12/docker-compose.yml delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/redis/6.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/redis/6.2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/redis/6.2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/redis/6.2/debian-12/rootfs/opt/bitnami/scripts/libredis.sh delete mode 100644 bitnami/redis/6.2/debian-12/rootfs/opt/bitnami/scripts/redis-env.sh delete mode 100755 bitnami/redis/6.2/debian-12/rootfs/opt/bitnami/scripts/redis/entrypoint.sh delete mode 100755 bitnami/redis/6.2/debian-12/rootfs/opt/bitnami/scripts/redis/postunpack.sh delete mode 100755 bitnami/redis/6.2/debian-12/rootfs/opt/bitnami/scripts/redis/run.sh delete mode 100755 bitnami/redis/6.2/debian-12/rootfs/opt/bitnami/scripts/redis/setup.sh delete mode 100644 bitnami/redis/6.2/debian-12/tags-info.yaml create mode 100644 bitnami/redmine/5/README.md delete mode 100644 bitnami/redmine/5/debian-12/Dockerfile delete mode 100644 bitnami/redmine/5/debian-12/docker-compose-postgresql.yml delete mode 100644 bitnami/redmine/5/debian-12/docker-compose.yml delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/redmine/5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/redmine/5/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/redmine/5/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/redmine/5/debian-12/rootfs/opt/bitnami/scripts/libmysqlclient.sh delete mode 100644 bitnami/redmine/5/debian-12/rootfs/opt/bitnami/scripts/libpostgresqlclient.sh delete mode 100644 bitnami/redmine/5/debian-12/rootfs/opt/bitnami/scripts/libredmine.sh delete mode 100644 bitnami/redmine/5/debian-12/rootfs/opt/bitnami/scripts/mysql-client-env.sh delete mode 100755 bitnami/redmine/5/debian-12/rootfs/opt/bitnami/scripts/mysql-client/postunpack.sh delete mode 100755 bitnami/redmine/5/debian-12/rootfs/opt/bitnami/scripts/mysql-client/setup.sh delete mode 100644 bitnami/redmine/5/debian-12/rootfs/opt/bitnami/scripts/postgresql-client-env.sh delete mode 100755 bitnami/redmine/5/debian-12/rootfs/opt/bitnami/scripts/postgresql-client/setup.sh delete mode 100644 bitnami/redmine/5/debian-12/rootfs/opt/bitnami/scripts/redmine-env.sh delete mode 100755 bitnami/redmine/5/debian-12/rootfs/opt/bitnami/scripts/redmine/entrypoint.sh delete mode 100755 bitnami/redmine/5/debian-12/rootfs/opt/bitnami/scripts/redmine/postunpack.sh delete mode 100755 bitnami/redmine/5/debian-12/rootfs/opt/bitnami/scripts/redmine/run.sh delete mode 100755 bitnami/redmine/5/debian-12/rootfs/opt/bitnami/scripts/redmine/setup.sh delete mode 100755 bitnami/redmine/5/debian-12/rootfs/post-init.d/ruby.sh delete mode 100755 bitnami/redmine/5/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/redmine/5/debian-12/rootfs/post-init.d/sql-mysql.sh delete mode 100755 bitnami/redmine/5/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/redmine/5/debian-12/tags-info.yaml create mode 100644 bitnami/ruby/3.1/README.md delete mode 100644 bitnami/ruby/3.1/debian-12/Dockerfile delete mode 100644 bitnami/ruby/3.1/debian-12/docker-compose.yml delete mode 100644 bitnami/ruby/3.1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/ruby/3.1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/ruby/3.1/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/ruby/3.1/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/ruby/3.1/debian-12/tags-info.yaml create mode 100644 bitnami/ruby/3.2/README.md delete mode 100644 bitnami/ruby/3.2/debian-12/Dockerfile delete mode 100644 bitnami/ruby/3.2/debian-12/docker-compose.yml delete mode 100644 bitnami/ruby/3.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/ruby/3.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100755 bitnami/ruby/3.2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/ruby/3.2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/ruby/3.2/debian-12/tags-info.yaml create mode 100644 bitnami/schema-registry/7.4/README.md delete mode 100644 bitnami/schema-registry/7.4/debian-12/Dockerfile delete mode 100644 bitnami/schema-registry/7.4/debian-12/docker-compose.yml delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/schema-registry/7.4/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/schema-registry/7.4/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/schema-registry/7.4/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/schema-registry/7.4/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/rootfs/opt/bitnami/scripts/libschemaregistry.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/rootfs/opt/bitnami/scripts/schema-registry-env.sh delete mode 100755 bitnami/schema-registry/7.4/debian-12/rootfs/opt/bitnami/scripts/schema-registry/entrypoint.sh delete mode 100755 bitnami/schema-registry/7.4/debian-12/rootfs/opt/bitnami/scripts/schema-registry/postunpack.sh delete mode 100755 bitnami/schema-registry/7.4/debian-12/rootfs/opt/bitnami/scripts/schema-registry/run.sh delete mode 100755 bitnami/schema-registry/7.4/debian-12/rootfs/opt/bitnami/scripts/schema-registry/setup.sh delete mode 100644 bitnami/schema-registry/7.4/debian-12/tags-info.yaml create mode 100644 bitnami/schema-registry/7.5/README.md delete mode 100644 bitnami/schema-registry/7.5/debian-12/Dockerfile delete mode 100644 bitnami/schema-registry/7.5/debian-12/docker-compose.yml delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/schema-registry/7.5/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/schema-registry/7.5/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/schema-registry/7.5/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/schema-registry/7.5/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/rootfs/opt/bitnami/scripts/libschemaregistry.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/rootfs/opt/bitnami/scripts/schema-registry-env.sh delete mode 100755 bitnami/schema-registry/7.5/debian-12/rootfs/opt/bitnami/scripts/schema-registry/entrypoint.sh delete mode 100755 bitnami/schema-registry/7.5/debian-12/rootfs/opt/bitnami/scripts/schema-registry/postunpack.sh delete mode 100755 bitnami/schema-registry/7.5/debian-12/rootfs/opt/bitnami/scripts/schema-registry/run.sh delete mode 100755 bitnami/schema-registry/7.5/debian-12/rootfs/opt/bitnami/scripts/schema-registry/setup.sh delete mode 100644 bitnami/schema-registry/7.5/debian-12/tags-info.yaml create mode 100644 bitnami/schema-registry/7.6/README.md delete mode 100644 bitnami/schema-registry/7.6/debian-12/Dockerfile delete mode 100644 bitnami/schema-registry/7.6/debian-12/docker-compose.yml delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/schema-registry/7.6/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/schema-registry/7.6/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/schema-registry/7.6/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/schema-registry/7.6/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/rootfs/opt/bitnami/scripts/libschemaregistry.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/rootfs/opt/bitnami/scripts/schema-registry-env.sh delete mode 100755 bitnami/schema-registry/7.6/debian-12/rootfs/opt/bitnami/scripts/schema-registry/entrypoint.sh delete mode 100755 bitnami/schema-registry/7.6/debian-12/rootfs/opt/bitnami/scripts/schema-registry/postunpack.sh delete mode 100755 bitnami/schema-registry/7.6/debian-12/rootfs/opt/bitnami/scripts/schema-registry/run.sh delete mode 100755 bitnami/schema-registry/7.6/debian-12/rootfs/opt/bitnami/scripts/schema-registry/setup.sh delete mode 100644 bitnami/schema-registry/7.6/debian-12/tags-info.yaml create mode 100644 bitnami/scylladb/6.0/README.md delete mode 100644 bitnami/scylladb/6.0/debian-12/Dockerfile delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/scylladb/6.0/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/scylladb/6.0/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/scylladb/6.0/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/scylladb/6.0/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/rootfs/opt/bitnami/scripts/libscylladb.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/rootfs/opt/bitnami/scripts/scylladb-env.sh delete mode 100755 bitnami/scylladb/6.0/debian-12/rootfs/opt/bitnami/scripts/scylladb/entrypoint.sh delete mode 100755 bitnami/scylladb/6.0/debian-12/rootfs/opt/bitnami/scripts/scylladb/postunpack.sh delete mode 100755 bitnami/scylladb/6.0/debian-12/rootfs/opt/bitnami/scripts/scylladb/run.sh delete mode 100755 bitnami/scylladb/6.0/debian-12/rootfs/opt/bitnami/scripts/scylladb/setup.sh delete mode 100644 bitnami/scylladb/6.0/debian-12/tags-info.yaml create mode 100644 bitnami/scylladb/6.1/README.md delete mode 100644 bitnami/scylladb/6.1/debian-12/Dockerfile delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/scylladb/6.1/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/scylladb/6.1/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/scylladb/6.1/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/scylladb/6.1/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/rootfs/opt/bitnami/scripts/libscylladb.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/rootfs/opt/bitnami/scripts/scylladb-env.sh delete mode 100755 bitnami/scylladb/6.1/debian-12/rootfs/opt/bitnami/scripts/scylladb/entrypoint.sh delete mode 100755 bitnami/scylladb/6.1/debian-12/rootfs/opt/bitnami/scripts/scylladb/postunpack.sh delete mode 100755 bitnami/scylladb/6.1/debian-12/rootfs/opt/bitnami/scripts/scylladb/run.sh delete mode 100755 bitnami/scylladb/6.1/debian-12/rootfs/opt/bitnami/scripts/scylladb/setup.sh delete mode 100644 bitnami/scylladb/6.1/debian-12/tags-info.yaml create mode 100644 bitnami/solr/8/README.md delete mode 100644 bitnami/solr/8/debian-12/Dockerfile delete mode 100644 bitnami/solr/8/debian-12/docker-compose-cloud.yml delete mode 100644 bitnami/solr/8/debian-12/docker-compose.yml delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/solr/8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/solr/8/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/solr/8/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/solr/8/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/solr/8/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/solr/8/debian-12/rootfs/opt/bitnami/scripts/libsolr.sh delete mode 100644 bitnami/solr/8/debian-12/rootfs/opt/bitnami/scripts/solr-env.sh delete mode 100755 bitnami/solr/8/debian-12/rootfs/opt/bitnami/scripts/solr/entrypoint.sh delete mode 100755 bitnami/solr/8/debian-12/rootfs/opt/bitnami/scripts/solr/postunpack.sh delete mode 100755 bitnami/solr/8/debian-12/rootfs/opt/bitnami/scripts/solr/run.sh delete mode 100755 bitnami/solr/8/debian-12/rootfs/opt/bitnami/scripts/solr/setup.sh delete mode 100644 bitnami/solr/8/debian-12/tags-info.yaml create mode 100644 bitnami/sonarqube/9/README.md delete mode 100644 bitnami/sonarqube/9/debian-12/Dockerfile delete mode 100644 bitnami/sonarqube/9/debian-12/docker-compose.yml delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/sonarqube/9/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/sonarqube/9/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/sonarqube/9/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/sonarqube/9/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/sonarqube/9/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/sonarqube/9/debian-12/rootfs/opt/bitnami/scripts/libpostgresqlclient.sh delete mode 100644 bitnami/sonarqube/9/debian-12/rootfs/opt/bitnami/scripts/libsonarqube.sh delete mode 100644 bitnami/sonarqube/9/debian-12/rootfs/opt/bitnami/scripts/postgresql-client-env.sh delete mode 100755 bitnami/sonarqube/9/debian-12/rootfs/opt/bitnami/scripts/postgresql-client/setup.sh delete mode 100644 bitnami/sonarqube/9/debian-12/rootfs/opt/bitnami/scripts/sonarqube-env.sh delete mode 100755 bitnami/sonarqube/9/debian-12/rootfs/opt/bitnami/scripts/sonarqube/entrypoint.sh delete mode 100755 bitnami/sonarqube/9/debian-12/rootfs/opt/bitnami/scripts/sonarqube/postunpack.sh delete mode 100755 bitnami/sonarqube/9/debian-12/rootfs/opt/bitnami/scripts/sonarqube/run.sh delete mode 100755 bitnami/sonarqube/9/debian-12/rootfs/opt/bitnami/scripts/sonarqube/setup.sh delete mode 100755 bitnami/sonarqube/9/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/sonarqube/9/debian-12/rootfs/post-init.d/sql-postgresql.sh delete mode 100755 bitnami/sonarqube/9/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/sonarqube/9/debian-12/tags-info.yaml create mode 100644 bitnami/suitecrm/7/README.md delete mode 100644 bitnami/suitecrm/7/debian-12/Dockerfile delete mode 100644 bitnami/suitecrm/7/debian-12/docker-compose.yml delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/suitecrm/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/suitecrm/7/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/suitecrm/7/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/apache/conf/deflate.conf delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/apache/conf/vhosts/00_status-vhost.conf delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache-env.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache-modphp/postunpack.sh delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-http-vhost.conf.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-https-vhost.conf.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-prefix.conf.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-http-vhost.conf.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-https-vhost.conf.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-prefix.conf.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-http-vhost.conf.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-https-vhost.conf.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-prefix.conf.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-http-vhost.conf.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-https-vhost.conf.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-prefix.conf.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami-ssl.conf.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami.conf.tpl delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/entrypoint.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/postunpack.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/reload.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/restart.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/run.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/setup.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/start.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/status.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/apache/stop.sh delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/libapache.sh delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/libmysqlclient.sh delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/libphp.sh delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/libsuitecrm.sh delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/mysql-client-env.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/mysql-client/postunpack.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/mysql-client/setup.sh delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/php-env.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/php/postunpack.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/php/reload.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/php/restart.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/php/run.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/php/setup.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/php/start.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/php/status.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/php/stop.sh delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/suitecrm-env.sh delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/suitecrm/bitnami-templates/config_db.php.tpl delete mode 100644 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/suitecrm/bitnami-templates/config_si.php.tpl delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/suitecrm/entrypoint.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/suitecrm/postunpack.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/suitecrm/run.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/suitecrm/setup.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/opt/bitnami/scripts/suitecrm/updatehost.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/post-init.d/php.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/post-init.d/shell.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/post-init.d/sql-mysql.sh delete mode 100755 bitnami/suitecrm/7/debian-12/rootfs/post-init.sh delete mode 100644 bitnami/suitecrm/7/debian-12/tags-info.yaml create mode 100644 bitnami/tomcat/9.0/README.md delete mode 100644 bitnami/tomcat/9.0/debian-12/Dockerfile delete mode 100644 bitnami/tomcat/9.0/debian-12/docker-compose.yml delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/tomcat/9.0/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/tomcat/9.0/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/tomcat/9.0/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/tomcat/9.0/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/rootfs/opt/bitnami/scripts/libtomcat.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/rootfs/opt/bitnami/scripts/tomcat-env.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/rootfs/opt/bitnami/scripts/tomcat/bitnami-templates/setenv.sh.tpl delete mode 100755 bitnami/tomcat/9.0/debian-12/rootfs/opt/bitnami/scripts/tomcat/entrypoint.sh delete mode 100755 bitnami/tomcat/9.0/debian-12/rootfs/opt/bitnami/scripts/tomcat/postunpack.sh delete mode 100755 bitnami/tomcat/9.0/debian-12/rootfs/opt/bitnami/scripts/tomcat/restart.sh delete mode 100755 bitnami/tomcat/9.0/debian-12/rootfs/opt/bitnami/scripts/tomcat/run.sh delete mode 100755 bitnami/tomcat/9.0/debian-12/rootfs/opt/bitnami/scripts/tomcat/setup.sh delete mode 100755 bitnami/tomcat/9.0/debian-12/rootfs/opt/bitnami/scripts/tomcat/start.sh delete mode 100755 bitnami/tomcat/9.0/debian-12/rootfs/opt/bitnami/scripts/tomcat/status.sh delete mode 100755 bitnami/tomcat/9.0/debian-12/rootfs/opt/bitnami/scripts/tomcat/stop.sh delete mode 100644 bitnami/tomcat/9.0/debian-12/tags-info.yaml create mode 100644 bitnami/valkey-cluster/7.2/README.md delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/Dockerfile delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/docker-compose.yml delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/valkey-cluster/7.2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/rootfs/opt/bitnami/scripts/libvalkey.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/rootfs/opt/bitnami/scripts/libvalkeycluster.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey-cluster-env.sh delete mode 100755 bitnami/valkey-cluster/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey-cluster/entrypoint.sh delete mode 100755 bitnami/valkey-cluster/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey-cluster/postunpack.sh delete mode 100755 bitnami/valkey-cluster/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey-cluster/run.sh delete mode 100755 bitnami/valkey-cluster/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey-cluster/setup.sh delete mode 100644 bitnami/valkey-cluster/7.2/debian-12/tags-info.yaml create mode 100644 bitnami/valkey-sentinel/7.2/README.md delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/Dockerfile delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/valkey-sentinel/7.2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/rootfs/opt/bitnami/scripts/libvalkeysentinel.sh delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey-sentinel-env.sh delete mode 100755 bitnami/valkey-sentinel/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey-sentinel/entrypoint.sh delete mode 100755 bitnami/valkey-sentinel/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey-sentinel/postunpack.sh delete mode 100755 bitnami/valkey-sentinel/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey-sentinel/run.sh delete mode 100755 bitnami/valkey-sentinel/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey-sentinel/setup.sh delete mode 100644 bitnami/valkey-sentinel/7.2/debian-12/tags-info.yaml create mode 100644 bitnami/valkey/7.2/README.md delete mode 100644 bitnami/valkey/7.2/debian-12/Dockerfile delete mode 100644 bitnami/valkey/7.2/debian-12/docker-compose-replicaset.yml delete mode 100644 bitnami/valkey/7.2/debian-12/docker-compose.yml delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/valkey/7.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/valkey/7.2/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/valkey/7.2/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/valkey/7.2/debian-12/rootfs/opt/bitnami/scripts/libvalkey.sh delete mode 100644 bitnami/valkey/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey-env.sh delete mode 100755 bitnami/valkey/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey/entrypoint.sh delete mode 100755 bitnami/valkey/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey/postunpack.sh delete mode 100755 bitnami/valkey/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey/run.sh delete mode 100755 bitnami/valkey/7.2/debian-12/rootfs/opt/bitnami/scripts/valkey/setup.sh delete mode 100644 bitnami/valkey/7.2/debian-12/tags-info.yaml create mode 100644 bitnami/wildfly/33/README.md delete mode 100644 bitnami/wildfly/33/debian-12/Dockerfile delete mode 100644 bitnami/wildfly/33/debian-12/docker-compose.yml delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/wildfly/33/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/wildfly/33/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/wildfly/33/debian-12/prebuildfs/usr/sbin/run-script delete mode 100755 bitnami/wildfly/33/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh delete mode 100755 bitnami/wildfly/33/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh delete mode 100644 bitnami/wildfly/33/debian-12/rootfs/opt/bitnami/scripts/libwildfly.sh delete mode 100644 bitnami/wildfly/33/debian-12/rootfs/opt/bitnami/scripts/wildfly-env.sh delete mode 100755 bitnami/wildfly/33/debian-12/rootfs/opt/bitnami/scripts/wildfly/entrypoint.sh delete mode 100755 bitnami/wildfly/33/debian-12/rootfs/opt/bitnami/scripts/wildfly/postunpack.sh delete mode 100755 bitnami/wildfly/33/debian-12/rootfs/opt/bitnami/scripts/wildfly/run.sh delete mode 100755 bitnami/wildfly/33/debian-12/rootfs/opt/bitnami/scripts/wildfly/setup.sh delete mode 100644 bitnami/wildfly/33/debian-12/tags-info.yaml create mode 100644 bitnami/zookeeper/3.8/README.md delete mode 100644 bitnami/zookeeper/3.8/debian-12/Dockerfile delete mode 100644 bitnami/zookeeper/3.8/debian-12/docker-compose-cluster.yml delete mode 100644 bitnami/zookeeper/3.8/debian-12/docker-compose.yml delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libvalidations.sh delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh delete mode 100644 bitnami/zookeeper/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh delete mode 100755 bitnami/zookeeper/3.8/debian-12/prebuildfs/usr/sbin/install_packages delete mode 100755 bitnami/zookeeper/3.8/debian-12/prebuildfs/usr/sbin/run-script delete mode 100644 bitnami/zookeeper/3.8/debian-12/rootfs/opt/bitnami/scripts/libzookeeper.sh delete mode 100644 bitnami/zookeeper/3.8/debian-12/rootfs/opt/bitnami/scripts/zookeeper-env.sh delete mode 100755 bitnami/zookeeper/3.8/debian-12/rootfs/opt/bitnami/scripts/zookeeper/entrypoint.sh delete mode 100755 bitnami/zookeeper/3.8/debian-12/rootfs/opt/bitnami/scripts/zookeeper/healthcheck.sh delete mode 100755 bitnami/zookeeper/3.8/debian-12/rootfs/opt/bitnami/scripts/zookeeper/postunpack.sh delete mode 100755 bitnami/zookeeper/3.8/debian-12/rootfs/opt/bitnami/scripts/zookeeper/run.sh delete mode 100755 bitnami/zookeeper/3.8/debian-12/rootfs/opt/bitnami/scripts/zookeeper/setup.sh delete mode 100644 bitnami/zookeeper/3.8/debian-12/tags-info.yaml diff --git a/bitnami/aspnet-core/9/README.md b/bitnami/aspnet-core/9/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/aspnet-core/9/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/aspnet-core/9/debian-12/Dockerfile b/bitnami/aspnet-core/9/debian-12/Dockerfile deleted file mode 100644 index 38f5b4d63d6a0..0000000000000 --- a/bitnami/aspnet-core/9/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-25T00:14:44Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/aspnet-core/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="9.0.0-debian-12-r1" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/aspnet-core" \ - org.opencontainers.image.title="aspnet-core" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="9.0.0" - -ENV HOME="/app" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages build-essential ca-certificates curl git libcap2-bin libgcc-s1 libicu-dev liblttng-ust-dev libsqlite3-dev libssl-dev libstdc++6 pkg-config procps unzip wget -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "aspnet-core-9.0.0-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \ - sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \ - sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password - -COPY rootfs / -RUN /opt/bitnami/scripts/aspnet-core/postunpack.sh -ENV APP_VERSION="9.0.0" \ - BITNAMI_APP_NAME="aspnet-core" \ - DOTNET_CLI_HOME="/app" \ - DOTNET_ROOT="/opt/bitnami/aspnet-core/bin" \ - PATH="/opt/bitnami/aspnet-core/bin:$PATH" - -WORKDIR /app -ENTRYPOINT [ "/opt/bitnami/scripts/aspnet-core/entrypoint.sh" ] -CMD [ "/bin/bash" ] diff --git a/bitnami/aspnet-core/9/debian-12/docker-compose.yml b/bitnami/aspnet-core/9/debian-12/docker-compose.yml deleted file mode 100644 index 155ff07fd8a92..0000000000000 --- a/bitnami/aspnet-core/9/debian-12/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - aspnet-core: - image: docker.io/bitnami/aspnet-core:9 - command: ["tail", "-f", "/dev/null"] # To keep the container running - volumes: - - aspnet-core_data:/app -volumes: - aspnet-core_data: - driver: local diff --git a/bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 4dd9304f411df..0000000000000 --- a/bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "aspnet-core": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "9.0.0-0" - } -} \ No newline at end of file diff --git a/bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/base/functions b/bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/base/functions deleted file mode 100644 index b8b756d42617a..0000000000000 --- a/bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/base/functions +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -[[ ${BASH_DEBUG:-false} = true ]] && set -x - -# Constants -MODULE="$(basename "$0")" -BITNAMI_PREFIX=/opt/bitnami - -# Color Palette -RESET='\033[0m' -BOLD='\033[1m' - -## Foreground -BLACK='\033[38;5;0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -BLUE='\033[38;5;4m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' -WHITE='\033[38;5;7m' - -## Background -ON_BLACK='\033[48;5;0m' -ON_RED='\033[48;5;1m' -ON_GREEN='\033[48;5;2m' -ON_YELLOW='\033[48;5;3m' -ON_BLUE='\033[48;5;4m' -ON_MAGENTA='\033[48;5;5m' -ON_CYAN='\033[48;5;6m' -ON_WHITE='\033[48;5;7m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - printf "%b\\n" "${*}" >&2 -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${NAMI_DEBUG:+${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")}${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - log "" - log "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - log "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - log "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - log "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - log "" -} diff --git a/bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/base/helpers b/bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/base/helpers deleted file mode 100644 index a6d909869eca3..0000000000000 --- a/bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/base/helpers +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -. /opt/bitnami/base/functions - -######################## -# Helper function to initialize a single nami module -# Arguments: -# Module to initialize -# Returns: -# None -# Description: -# Initialize an unpacked nami module with the `nami initialize` command. -# Command arguments can be specified as function argumnts after the module name. -# `--log-level trace` flag is added to the command if `NAMI_DEBUG` env variable exists. -# The log level can be overridden using the `NAMI_LOG_LEVEL` env variable. -######################### -nami_initialize_one() { - local module="${1:?module not specified}" - if nami inspect $module | grep -q '"lifecycle": "unpacked"'; then - local inputs= - if [[ -f "/${module}-inputs.json" ]]; then - inputs="--inputs-file=/${module}-inputs.json" - fi - nami ${NAMI_DEBUG:+--log-level ${NAMI_LOG_LEVEL:-trace}} initialize $module $inputs "${@:2}" - fi -} - -######################## -# Helper function to initialize one or more nami modules -# Arguments: -# Module to initialize -# Returns: -# None -######################### -nami_initialize() { - local module="${1:?module not specified}" - for module in "${@}"; do - nami_initialize_one $module - done -} diff --git a/bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/aspnet-core/9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/aspnet-core/9/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/aspnet-core/9/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/aspnet-core/9/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/aspnet-core/9/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/aspnet-core/9/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/aspnet-core/9/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/aspnet-core/9/debian-12/rootfs/opt/bitnami/scripts/aspnet-core/entrypoint.sh b/bitnami/aspnet-core/9/debian-12/rootfs/opt/bitnami/scripts/aspnet-core/entrypoint.sh deleted file mode 100755 index b9a949e6c0809..0000000000000 --- a/bitnami/aspnet-core/9/debian-12/rootfs/opt/bitnami/scripts/aspnet-core/entrypoint.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -e -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -. /opt/bitnami/base/functions -. /opt/bitnami/base/helpers - -print_welcome_page - -exec "$@" diff --git a/bitnami/aspnet-core/9/debian-12/rootfs/opt/bitnami/scripts/aspnet-core/postunpack.sh b/bitnami/aspnet-core/9/debian-12/rootfs/opt/bitnami/scripts/aspnet-core/postunpack.sh deleted file mode 100755 index 6f8dca6ae5650..0000000000000 --- a/bitnami/aspnet-core/9/debian-12/rootfs/opt/bitnami/scripts/aspnet-core/postunpack.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purpose -mkdir /app -chmod g+rwx /app -setcap CAP_NET_BIND_SERVICE=+eip /opt/bitnami/aspnet-core/bin/dotnet diff --git a/bitnami/aspnet-core/9/debian-12/tags-info.yaml b/bitnami/aspnet-core/9/debian-12/tags-info.yaml deleted file mode 100644 index 3bbb3bc79c382..0000000000000 --- a/bitnami/aspnet-core/9/debian-12/tags-info.yaml +++ /dev/null @@ -1,5 +0,0 @@ -rolling-tags: -- "9" -- 9-debian-12 -- 9.0.0 -- latest diff --git a/bitnami/aws-cli/1/README.md b/bitnami/aws-cli/1/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/aws-cli/1/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/aws-cli/1/debian-12/Dockerfile b/bitnami/aws-cli/1/debian-12/Dockerfile deleted file mode 100644 index b1344ff348607..0000000000000 --- a/bitnami/aws-cli/1/debian-12/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-25T22:08:08Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/aws-cli/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="1.36.10-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/aws-cli" \ - org.opencontainers.image.title="aws-cli" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="1.36.10" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl groff-base libbz2-1.0 libcom-err2 libcrypt1 libffi8 libgssapi-krb5-2 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 liblzma5 libncursesw6 libnsl2 libreadline8 libsqlite3-0 libssl3 libtinfo6 libtirpc3 procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "python-3.11.10-12-linux-${OS_ARCH}-debian-12" \ - "aws-cli-1.36.10-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -ENV APP_VERSION="1.36.10" \ - AWS_CA_BUNDLE="/etc/ssl/certs/ca-certificates.crt" \ - BITNAMI_APP_NAME="aws-cli" \ - PATH="/opt/bitnami/python/bin:/opt/bitnami/aws-cli/bin:/opt/bitnami/aws-cli/venv/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "aws" ] -CMD [ "--help" ] diff --git a/bitnami/aws-cli/1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/aws-cli/1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 5238f19cd7585..0000000000000 --- a/bitnami/aws-cli/1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "aws-cli": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.36.10-0" - }, - "python": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "3.11.10-12" - } -} \ No newline at end of file diff --git a/bitnami/aws-cli/1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/aws-cli/1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/aws-cli/1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/aws-cli/1/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/aws-cli/1/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/aws-cli/1/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/aws-cli/1/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/aws-cli/1/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/aws-cli/1/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/aws-cli/1/debian-12/tags-info.yaml b/bitnami/aws-cli/1/debian-12/tags-info.yaml deleted file mode 100644 index cb2f8ecccc961..0000000000000 --- a/bitnami/aws-cli/1/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "1" -- 1-debian-12 -- 1.36.10 diff --git a/bitnami/cassandra/4.0/README.md b/bitnami/cassandra/4.0/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/cassandra/4.0/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/cassandra/4.0/debian-12/Dockerfile b/bitnami/cassandra/4.0/debian-12/Dockerfile deleted file mode 100644 index 4b778912f758a..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-18T18:05:44Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/cassandra/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="4.0.15-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/cassandra" \ - org.opencontainers.image.title="cassandra" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="4.0.15" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libbz2-1.0 libcom-err2 libcrypt1 libffi8 libgssapi-krb5-2 libjemalloc2 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 liblzma5 libncursesw6 libnsl2 libreadline8 libsqlite3-0 libssl3 libtinfo6 libtirpc3 procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "python-3.11.10-10-linux-${OS_ARCH}-debian-12" \ - "java-11.0.25-11-1-linux-${OS_ARCH}-debian-12" \ - "cassandra-4.0.15-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN ln -s /opt/bitnami/scripts/cassandra/entrypoint.sh /entrypoint.sh -RUN ln -s /opt/bitnami/scripts/cassandra/run.sh /run.sh -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/cassandra/postunpack.sh -RUN /opt/bitnami/scripts/java/postunpack.sh -ENV APP_VERSION="4.0.15" \ - BITNAMI_APP_NAME="cassandra" \ - JAVA_HOME="/opt/bitnami/java" \ - PATH="/opt/bitnami/python/bin:/opt/bitnami/java/bin:/opt/bitnami/cassandra/bin:$PATH" - -EXPOSE 7000 9042 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/cassandra/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/cassandra/run.sh" ] diff --git a/bitnami/cassandra/4.0/debian-12/docker-compose-cluster.yml b/bitnami/cassandra/4.0/debian-12/docker-compose-cluster.yml deleted file mode 100644 index 41f5f5f6a9fe2..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/docker-compose-cluster.yml +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - cassandra: - image: docker.io/bitnami/cassandra:4.0 - ports: - - 7000:7000 - - 9042:9042 - volumes: - - cassandra_data:/bitnami - environment: - - CASSANDRA_SEEDS=cassandra,cassandra2 - - CASSANDRA_CLUSTER_NAME=cassandra-cluster - - CASSANDRA_PASSWORD_SEEDER=yes - - CASSANDRA_PASSWORD=cassandra - # By default, Cassandra autodetects the available host memory and takes as much as it can. - # Therefore, memory options are mandatory if multiple Cassandras are launched in the same node. - - MAX_HEAP_SIZE=2G - - HEAP_NEWSIZE=200M - cassandra2: - image: docker.io/bitnami/cassandra:4.0 - ports: - - 7001:7000 - - 9043:9042 - volumes: - - cassandra2_data:/bitnami - environment: - - CASSANDRA_SEEDS=cassandra,cassandra2 - - CASSANDRA_CLUSTER_NAME=cassandra-cluster - - CASSANDRA_PASSWORD=cassandra - # By default, Cassandra autodetects the available host memory and takes as much as it can. - # Therefore, memory options are mandatory if multiple Cassandras are launched in the same node. - - MAX_HEAP_SIZE=2G - - HEAP_NEWSIZE=200M -volumes: - cassandra_data: - driver: local - cassandra2_data: - driver: local diff --git a/bitnami/cassandra/4.0/debian-12/docker-compose.yml b/bitnami/cassandra/4.0/debian-12/docker-compose.yml deleted file mode 100644 index 545b90d75a56b..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/docker-compose.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - cassandra: - image: docker.io/bitnami/cassandra:4.0 - ports: - - '7000:7000' - - '9042:9042' - volumes: - - 'cassandra_data:/bitnami' - environment: - - CASSANDRA_SEEDS=cassandra - - CASSANDRA_PASSWORD_SEEDER=yes - - CASSANDRA_PASSWORD=cassandra -volumes: - cassandra_data: - driver: local diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 0f1950c62ff3e..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "cassandra": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "4.0.15-0" - }, - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "11.0.25-11-1" - }, - "python": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "3.11.10-10" - } -} \ No newline at end of file diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/cassandra/4.0/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/cassandra/4.0/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/cassandra/4.0/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra-env.sh b/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra-env.sh deleted file mode 100644 index 39fc56833bd2a..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra-env.sh +++ /dev/null @@ -1,260 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for cassandra - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-cassandra}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -cassandra_env_vars=( - CASSANDRA_MOUNTED_CONF_DIR - CASSANDRA_CLIENT_ENCRYPTION - CASSANDRA_CLUSTER_NAME - CASSANDRA_DATACENTER - CASSANDRA_ENABLE_REMOTE_CONNECTIONS - CASSANDRA_ENABLE_RPC - CASSANDRA_ENABLE_USER_DEFINED_FUNCTIONS - CASSANDRA_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS - CASSANDRA_ENDPOINT_SNITCH - CASSANDRA_HOST - CASSANDRA_INTERNODE_ENCRYPTION - CASSANDRA_NUM_TOKENS - CASSANDRA_PASSWORD_SEEDER - CASSANDRA_SEEDS - CASSANDRA_PEERS - CASSANDRA_NODES - CASSANDRA_RACK - CASSANDRA_BROADCAST_ADDRESS - CASSANDRA_AUTOMATIC_SSTABLE_UPGRADE - CASSANDRA_STARTUP_CQL - CASSANDRA_IGNORE_INITDB_SCRIPTS - CASSANDRA_CQL_PORT_NUMBER - CASSANDRA_JMX_PORT_NUMBER - CASSANDRA_TRANSPORT_PORT_NUMBER - CASSANDRA_CQL_MAX_RETRIES - CASSANDRA_CQL_SLEEP_TIME - CASSANDRA_INIT_MAX_RETRIES - CASSANDRA_INIT_SLEEP_TIME - CASSANDRA_PEER_CQL_MAX_RETRIES - CASSANDRA_PEER_CQL_SLEEP_TIME - CASSANDRA_DELAY_START_TIME - CASSANDRA_AUTO_SNAPSHOT_TTL - ALLOW_EMPTY_PASSWORD - CASSANDRA_AUTHORIZER - CASSANDRA_AUTHENTICATOR - CASSANDRA_USER - CASSANDRA_PASSWORD - CASSANDRA_KEYSTORE_PASSWORD - CASSANDRA_TRUSTSTORE_PASSWORD - CASSANDRA_KEYSTORE_LOCATION - CASSANDRA_TRUSTSTORE_LOCATION - CASSANDRA_TMP_P12_FILE - CASSANDRA_SSL_CERT_FILE - CASSANDRA_SSL_KEY_FILE - CASSANDRA_SSL_CA_FILE - CASSANDRA_SSL_VALIDATE - SSL_VERSION -) -for env_var in "${cassandra_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset cassandra_env_vars -export DB_FLAVOR="cassandra" - -# Paths -export CASSANDRA_BASE_DIR="/opt/bitnami/cassandra" -export DB_BASE_DIR="$CASSANDRA_BASE_DIR" -export CASSANDRA_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_BIN_DIR="$CASSANDRA_BIN_DIR" -export CASSANDRA_VOLUME_DIR="/bitnami/cassandra" -export DB_VOLUME_DIR="$CASSANDRA_VOLUME_DIR" -export CASSANDRA_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_DATA_DIR="$CASSANDRA_DATA_DIR" -export CASSANDRA_COMMITLOG_DIR="${DB_DATA_DIR}/commitlog" -export DB_COMMITLOG_DIR="$CASSANDRA_COMMITLOG_DIR" -export CASSANDRA_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d" -export DB_INITSCRIPTS_DIR="$CASSANDRA_INITSCRIPTS_DIR" -export CASSANDRA_LOG_DIR="${DB_BASE_DIR}/logs" -export DB_LOG_DIR="$CASSANDRA_LOG_DIR" -export CASSANDRA_MOUNTED_CONF_DIR="${CASSANDRA_MOUNTED_CONF_DIR:-${DB_VOLUME_DIR}/conf}" -export DB_MOUNTED_CONF_DIR="$CASSANDRA_MOUNTED_CONF_DIR" -export CASSANDRA_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_TMP_DIR="$CASSANDRA_TMP_DIR" -export JAVA_BASE_DIR="${BITNAMI_ROOT_DIR}/java" -export JAVA_BIN_DIR="${JAVA_BASE_DIR}/bin" -export PYTHON_BASE_DIR="${BITNAMI_ROOT_DIR}/python" -export PYTHON_BIN_DIR="${PYTHON_BASE_DIR}/bin" -export CASSANDRA_LOG_FILE="${DB_LOG_DIR}/cassandra.log" -export DB_LOG_FILE="$CASSANDRA_LOG_FILE" -export CASSANDRA_FIRST_BOOT_LOG_FILE="${DB_LOG_DIR}/cassandra_first_boot.log" -export DB_FIRST_BOOT_LOG_FILE="$CASSANDRA_FIRST_BOOT_LOG_FILE" -export CASSANDRA_INITSCRIPTS_BOOT_LOG_FILE="${DB_LOG_DIR}/cassandra_init_scripts_boot.log" -export DB_INITSCRIPTS_BOOT_LOG_FILE="$CASSANDRA_INITSCRIPTS_BOOT_LOG_FILE" -export CASSANDRA_PID_FILE="${DB_TMP_DIR}/cassandra.pid" -export DB_PID_FILE="$CASSANDRA_PID_FILE" -export PATH="${DB_BIN_DIR}:${BITNAMI_ROOT_DIR}/common/bin:${BITNAMI_ROOT_DIR}/python/bin:${BITNAMI_ROOT_DIR}/java/bin:$PATH" - -# System users (when running with a privileged user) -export CASSANDRA_DAEMON_USER="cassandra" -export DB_DAEMON_USER="$CASSANDRA_DAEMON_USER" -export CASSANDRA_DAEMON_GROUP="cassandra" -export DB_DAEMON_GROUP="$CASSANDRA_DAEMON_GROUP" - -# Cassandra cluster settings -export CASSANDRA_CLIENT_ENCRYPTION="${CASSANDRA_CLIENT_ENCRYPTION:-false}" -export DB_CLIENT_ENCRYPTION="$CASSANDRA_CLIENT_ENCRYPTION" -export CASSANDRA_CLUSTER_NAME="${CASSANDRA_CLUSTER_NAME:-My Cluster}" -export DB_CLUSTER_NAME="$CASSANDRA_CLUSTER_NAME" -export CASSANDRA_DATACENTER="${CASSANDRA_DATACENTER:-dc1}" -export DB_DATACENTER="$CASSANDRA_DATACENTER" -export CASSANDRA_ENABLE_REMOTE_CONNECTIONS="${CASSANDRA_ENABLE_REMOTE_CONNECTIONS:-true}" -export DB_ENABLE_REMOTE_CONNECTIONS="$CASSANDRA_ENABLE_REMOTE_CONNECTIONS" -export CASSANDRA_ENABLE_RPC="${CASSANDRA_ENABLE_RPC:-false}" -export DB_ENABLE_RPC="$CASSANDRA_ENABLE_RPC" -export CASSANDRA_ENABLE_USER_DEFINED_FUNCTIONS="${CASSANDRA_ENABLE_USER_DEFINED_FUNCTIONS:-false}" -export DB_ENABLE_USER_DEFINED_FUNCTIONS="$CASSANDRA_ENABLE_USER_DEFINED_FUNCTIONS" -export CASSANDRA_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS="${CASSANDRA_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS:-false}" -export DB_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS="$CASSANDRA_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS" -export CASSANDRA_ENDPOINT_SNITCH="${CASSANDRA_ENDPOINT_SNITCH:-SimpleSnitch}" -export DB_ENDPOINT_SNITCH="$CASSANDRA_ENDPOINT_SNITCH" -export CASSANDRA_HOST="${CASSANDRA_HOST:-}" -export DB_HOST="$CASSANDRA_HOST" -export CASSANDRA_INTERNODE_ENCRYPTION="${CASSANDRA_INTERNODE_ENCRYPTION:-none}" -export DB_INTERNODE_ENCRYPTION="$CASSANDRA_INTERNODE_ENCRYPTION" -export CASSANDRA_NUM_TOKENS="${CASSANDRA_NUM_TOKENS:-256}" -export DB_NUM_TOKENS="$CASSANDRA_NUM_TOKENS" -export CASSANDRA_PASSWORD_SEEDER="${CASSANDRA_PASSWORD_SEEDER:-no}" -export DB_PASSWORD_SEEDER="$CASSANDRA_PASSWORD_SEEDER" -export CASSANDRA_SEEDS="${CASSANDRA_SEEDS:-$DB_HOST}" -export DB_SEEDS="$CASSANDRA_SEEDS" -export CASSANDRA_PEERS="${CASSANDRA_PEERS:-$DB_SEEDS}" -export DB_PEERS="$CASSANDRA_PEERS" -export CASSANDRA_NODES="${CASSANDRA_NODES:-}" -export DB_NODES="$CASSANDRA_NODES" -export CASSANDRA_RACK="${CASSANDRA_RACK:-rack1}" -export DB_RACK="$CASSANDRA_RACK" -export CASSANDRA_BROADCAST_ADDRESS="${CASSANDRA_BROADCAST_ADDRESS:-}" -export DB_BROADCAST_ADDRESS="$CASSANDRA_BROADCAST_ADDRESS" -export CASSANDRA_AUTOMATIC_SSTABLE_UPGRADE="${CASSANDRA_AUTOMATIC_SSTABLE_UPGRADE:-false}" -export DB_AUTOMATIC_SSTABLE_UPGRADE="$CASSANDRA_AUTOMATIC_SSTABLE_UPGRADE" - -# Database initialization settings -export CASSANDRA_STARTUP_CQL="${CASSANDRA_STARTUP_CQL:-}" -export DB_STARTUP_CQL="$CASSANDRA_STARTUP_CQL" -export CASSANDRA_IGNORE_INITDB_SCRIPTS="${CASSANDRA_IGNORE_INITDB_SCRIPTS:-no}" -export DB_IGNORE_INITDB_SCRIPTS="$CASSANDRA_IGNORE_INITDB_SCRIPTS" - -# Port configuration -export CASSANDRA_CQL_PORT_NUMBER="${CASSANDRA_CQL_PORT_NUMBER:-9042}" -export DB_CQL_PORT_NUMBER="$CASSANDRA_CQL_PORT_NUMBER" -export CASSANDRA_JMX_PORT_NUMBER="${CASSANDRA_JMX_PORT_NUMBER:-7199}" -export DB_JMX_PORT_NUMBER="$CASSANDRA_JMX_PORT_NUMBER" -export CASSANDRA_TRANSPORT_PORT_NUMBER="${CASSANDRA_TRANSPORT_PORT_NUMBER:-7000}" -export DB_TRANSPORT_PORT_NUMBER="$CASSANDRA_TRANSPORT_PORT_NUMBER" - -# Retries and sleep time configuration -export CASSANDRA_CQL_MAX_RETRIES="${CASSANDRA_CQL_MAX_RETRIES:-20}" -export DB_CQL_MAX_RETRIES="$CASSANDRA_CQL_MAX_RETRIES" -export CASSANDRA_CQL_SLEEP_TIME="${CASSANDRA_CQL_SLEEP_TIME:-5}" -export DB_CQL_SLEEP_TIME="$CASSANDRA_CQL_SLEEP_TIME" -export CASSANDRA_INIT_MAX_RETRIES="${CASSANDRA_INIT_MAX_RETRIES:-100}" -export DB_INIT_MAX_RETRIES="$CASSANDRA_INIT_MAX_RETRIES" -export CASSANDRA_INIT_SLEEP_TIME="${CASSANDRA_INIT_SLEEP_TIME:-5}" -export DB_INIT_SLEEP_TIME="$CASSANDRA_INIT_SLEEP_TIME" -export CASSANDRA_PEER_CQL_MAX_RETRIES="${CASSANDRA_PEER_CQL_MAX_RETRIES:-100}" -export DB_PEER_CQL_MAX_RETRIES="$CASSANDRA_PEER_CQL_MAX_RETRIES" -export CASSANDRA_PEER_CQL_SLEEP_TIME="${CASSANDRA_PEER_CQL_SLEEP_TIME:-10}" -export DB_PEER_CQL_SLEEP_TIME="$CASSANDRA_PEER_CQL_SLEEP_TIME" -export CASSANDRA_DELAY_START_TIME="${CASSANDRA_DELAY_START_TIME:-10}" -export DB_DELAY_START_TIME="$CASSANDRA_DELAY_START_TIME" - -# Snapshot settings -export CASSANDRA_AUTO_SNAPSHOT_TTL="${CASSANDRA_AUTO_SNAPSHOT_TTL:-30d}" -export DB_AUTO_SNAPSHOT_TTL="$CASSANDRA_AUTO_SNAPSHOT_TTL" - -# Authentication, Authorization and Credentials -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export CASSANDRA_AUTHORIZER="${CASSANDRA_AUTHORIZER:-CassandraAuthorizer}" -export DB_AUTHORIZER="$CASSANDRA_AUTHORIZER" -export CASSANDRA_AUTHENTICATOR="${CASSANDRA_AUTHENTICATOR:-PasswordAuthenticator}" -export DB_AUTHENTICATOR="$CASSANDRA_AUTHENTICATOR" -export CASSANDRA_USER="${CASSANDRA_USER:-cassandra}" -export DB_USER="$CASSANDRA_USER" -export CASSANDRA_PASSWORD="${CASSANDRA_PASSWORD:-}" -export DB_PASSWORD="$CASSANDRA_PASSWORD" -export CASSANDRA_KEYSTORE_PASSWORD="${CASSANDRA_KEYSTORE_PASSWORD:-cassandra}" -export DB_KEYSTORE_PASSWORD="$CASSANDRA_KEYSTORE_PASSWORD" -export CASSANDRA_TRUSTSTORE_PASSWORD="${CASSANDRA_TRUSTSTORE_PASSWORD:-cassandra}" -export DB_TRUSTSTORE_PASSWORD="$CASSANDRA_TRUSTSTORE_PASSWORD" -export CASSANDRA_KEYSTORE_LOCATION="${CASSANDRA_KEYSTORE_LOCATION:-${DB_VOLUME_DIR}/secrets/keystore}" -export DB_KEYSTORE_LOCATION="$CASSANDRA_KEYSTORE_LOCATION" -export CASSANDRA_TRUSTSTORE_LOCATION="${CASSANDRA_TRUSTSTORE_LOCATION:-${DB_VOLUME_DIR}/secrets/truststore}" -export DB_TRUSTSTORE_LOCATION="$CASSANDRA_TRUSTSTORE_LOCATION" -export CASSANDRA_TMP_P12_FILE="${CASSANDRA_TMP_P12_FILE:-${DB_TMP_DIR}/keystore.p12}" -export DB_TMP_P12_FILE="$CASSANDRA_TMP_P12_FILE" -export CASSANDRA_SSL_CERT_FILE="${CASSANDRA_SSL_CERT_FILE:-${DB_VOLUME_DIR}/certs/tls.crt}" -export DB_SSL_CERT_FILE="$CASSANDRA_SSL_CERT_FILE" -export SSL_CERTFILE="$CASSANDRA_SSL_CERT_FILE" -export CASSANDRA_SSL_KEY_FILE="${CASSANDRA_SSL_KEY_FILE:-${DB_VOLUME_DIR}/certs/tls.key}" -export DB_SSL_KEY_FILE="$CASSANDRA_SSL_KEY_FILE" -export SSL_KEYFILE="$CASSANDRA_SSL_KEY_FILE" -export CASSANDRA_SSL_CA_FILE="${CASSANDRA_SSL_CA_FILE:-}" -export DB_SSL_CA_FILE="$CASSANDRA_SSL_CA_FILE" -export SSL_CAFILE="$CASSANDRA_SSL_CA_FILE" -export CASSANDRA_SSL_VALIDATE="${CASSANDRA_SSL_VALIDATE:-false}" -export DB_SSL_VALIDATE="$CASSANDRA_SSL_VALIDATE" -export SSL_VALIDATE="$CASSANDRA_SSL_VALIDATE" - -# cqlsh settings -export SSL_VERSION="${SSL_VERSION:-TLSv1_2}" - -# Configuration paths -export CASSANDRA_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_CONF_DIR="$CASSANDRA_CONF_DIR" -export CASSANDRA_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_DEFAULT_CONF_DIR="$CASSANDRA_DEFAULT_CONF_DIR" -export CASSANDRA_CONF_FILE="${DB_CONF_DIR}/cassandra.yaml" -export DB_CONF_FILE="$CASSANDRA_CONF_FILE" -export CASSANDRA_RACKDC_FILE="${DB_CONF_DIR}/cassandra-rackdc.properties" -export DB_RACKDC_FILE="$CASSANDRA_RACKDC_FILE" -export CASSANDRA_LOGBACK_FILE="${DB_CONF_DIR}/logback.xml" -export DB_LOGBACK_FILE="$CASSANDRA_LOGBACK_FILE" -export CASSANDRA_COMMITLOG_ARCHIVING_FILE="${DB_CONF_DIR}/commitlog_archiving.properties" -export DB_COMMITLOG_ARCHIVING_FILE="$CASSANDRA_COMMITLOG_ARCHIVING_FILE" -export CASSANDRA_ENV_FILE="${DB_CONF_DIR}/cassandra-env.sh" -export DB_ENV_FILE="$CASSANDRA_ENV_FILE" -export CASSANDRA_MOUNTED_CONF_PATH="cassandra.yaml" -export DB_MOUNTED_CONF_PATH="$CASSANDRA_MOUNTED_CONF_PATH" -export CASSANDRA_MOUNTED_RACKDC_PATH="cassandra-rackdc.properties" -export DB_MOUNTED_RACKDC_PATH="$CASSANDRA_MOUNTED_RACKDC_PATH" -export CASSANDRA_MOUNTED_ENV_PATH="cassandra-env.sh" -export DB_MOUNTED_ENV_PATH="$CASSANDRA_MOUNTED_ENV_PATH" -export CASSANDRA_MOUNTED_LOGBACK_PATH="logback.xml" -export DB_MOUNTED_LOGBACK_PATH="$CASSANDRA_MOUNTED_LOGBACK_PATH" - -# Custom environment variables may be defined below diff --git a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/entrypoint.sh b/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/entrypoint.sh deleted file mode 100755 index da37e4e4dd153..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/entrypoint.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -#set -o xtrace - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libcassandra.sh - -# Load Cassandra environment variables -. /opt/bitnami/scripts/cassandra-env.sh - -print_welcome_page - -if is_positive_int "$DB_DELAY_START_TIME" && [[ "$DB_DELAY_START_TIME" -gt 0 ]]; then - info "** Delaying Cassandra start by ${DB_DELAY_START_TIME} seconds **" - sleep "$DB_DELAY_START_TIME" -fi - -if [[ "$*" = *"/opt/bitnami/scripts/cassandra/run.sh"* || "$*" = *"/run.sh"* ]]; then - info "** Starting Cassandra setup **" - /opt/bitnami/scripts/cassandra/setup.sh - info "** Cassandra setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/postunpack.sh b/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/postunpack.sh deleted file mode 100755 index 3acce795b328e..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/postunpack.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libcassandra.sh - -# Load Cassandra environment variables -. /opt/bitnami/scripts/cassandra-env.sh - -# Starting with version 5.0.2, we found that the Cassandra official configuration -# was in a file called cassandra_latest.yaml. We copy that file to ensure that it is using -# the latest settings -if [[ -f "${DB_DEFAULT_CONF_DIR}/cassandra_latest.yaml" ]]; then - cp "${DB_DEFAULT_CONF_DIR}/cassandra_latest.yaml" "${DB_DEFAULT_CONF_DIR}/cassandra.yaml" -fi - -for dir in "$DB_INITSCRIPTS_DIR" "$DB_TMP_DIR" "$DB_LOG_DIR" "$DB_MOUNTED_CONF_DIR" "$DB_VOLUME_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# Copy configuration files for the scripts to work -ensure_dir_exists "$DB_CONF_DIR" -cassandra_copy_default_config -chmod -R g+rwX "$DB_CONF_DIR" - -# Create wrapper for cqlsh -cat <"${DB_BIN_DIR}/cqlsh" -#!/bin/sh -exec "${PYTHON_BIN_DIR}/python" "${DB_BIN_DIR}/cqlsh.py" "\$@" -EOF - -chmod +x "${DB_BIN_DIR}/cqlsh" - -ensure_dir_exists "${HOME}/.cassandra" -chmod -R g+rwX "${HOME}/.cassandra" diff --git a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/run.sh b/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/run.sh deleted file mode 100755 index b3f222c3661c5..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/run.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libcassandra.sh -. /opt/bitnami/scripts/libos.sh - -# Load Cassandra environment variables -. /opt/bitnami/scripts/cassandra-env.sh - -# As we cannot use "local" we will use "readonly" for read-only variables. -# The scope of "readonly" is global, so we attach "__run_" to avoid conflicts -# with other variables in libcassandra.sh - -info "** Starting Cassandra **" - -# During the startup logic, we bootstap Cassandra. This is because Cassandra seeder nodes -# need to be able to connect to each other, and after that authentication can be configured. -# However, some applications may detect at this point that the database is ready. -# While in other bitnami containers we would stop the database and run it in foreground, -# we prefer keeping it running in this case. -# So, in this run.sh script, we first check if Cassandra was already running in -# one of the two cases: -# -# 1) Initial cluster initialization -# 2) Init scripts -# -# If none of the two cases apply, we assume it is an error and exit -if is_cassandra_running; then - __run_pid="$(get_pid_from_file "$DB_PID_FILE")" - running_log_file="" - - if [[ -f "$DB_FIRST_BOOT_LOG_FILE" ]]; then - running_log_file="$DB_FIRST_BOOT_LOG_FILE" - info "Cassandra already running with PID $__run_pid because of the initial cluster setup" - elif [[ -f "$DB_INITSCRIPTS_BOOT_LOG_FILE" ]]; then - running_log_file="$DB_INITSCRIPTS_BOOT_LOG_FILE" - info "Cassandra already running PID $__run_pid because of the init scripts execution" - else - error "Cassandra is already running for an unexpected reason. Exiting" - exit 1 - fi - - info "Tailing $running_log_file" - __run_tail_cmd="$(which tail)" - readonly __run_tail_flags=("--pid=${__run_pid}" "-n" "1000" "-f" "$running_log_file") - - if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "${__run_tail_cmd}" "${__run_tail_flags[@]}" - else - exec "${__run_tail_cmd}" "${__run_tail_flags[@]}" - fi -else - readonly __run_cmd="${DB_BIN_DIR}/cassandra" - readonly __run_flags=("-p $DB_PID_FILE" "-R" "-f") - if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "${__run_cmd}" "${__run_flags[@]}" - else - exec "${__run_cmd}" "${__run_flags[@]}" - fi -fi diff --git a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/setup.sh b/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/setup.sh deleted file mode 100755 index 24096cc6cda4e..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/cassandra/setup.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Cassandra setup - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libcassandra.sh - -# Load Cassandra environment variables -. /opt/bitnami/scripts/cassandra-env.sh - -# Set default Cassandra host environment variable -cassandra_set_default_host -# Ensure Cassandra environment variables settings are valid -cassandra_validate -cassandra_validate_tls -# Ensure 'daemon' user exists when running as 'root' -am_i_root && ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" -# Ensure Cassandra is initialized -cassandra_initialize - -# Allow running custom initialization scripts -if ! is_boolean_yes "$DB_IGNORE_INITDB_SCRIPTS"; then - cassandra_custom_init_scripts -fi diff --git a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 8557631d25490..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/libcassandra.sh b/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/libcassandra.sh deleted file mode 100644 index dcce53075b8ae..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/rootfs/opt/bitnami/scripts/libcassandra.sh +++ /dev/null @@ -1,1319 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for Cassandra - -cassandra_validate_tls() { - info "Validating TLS settings in DB_* env vars.." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - check_empty_value() { - if is_empty_value "${!1}"; then - print_validation_error "The $1 environment variable is empty or not set." - fi - } - - check_default_password() { - if [[ "${!1}" = "cassandra" ]]; then - warn "You set the environment variable $1=cassandra. This is the default value when bootstrapping Cassandra and should not be used in production environments." - fi - } - if is_boolean_yes "$DB_CLIENT_ENCRYPTION" || is_boolean_yes "$DB_INTERNODE_ENCRYPTION"; then - check_empty_value DB_KEYSTORE_PASSWORD - check_empty_value DB_TRUSTSTORE_PASSWORD - check_default_password DB_KEYSTORE_PASSWORD - check_default_password DB_TRUSTSTORE_PASSWORD - fi - - [[ "$error_code" -eq 0 ]] || exit "$error_code" - -} - -######################## -# Configure port binding (modifies cassandra.yaml and cassandra-env.sh if not mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_ports() { - cassandra_setup_common_ports -} - -######################## -# Generate the client configurartion if ssl is configured in the server -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_client_ssl() { - info "Configuring client for SSL" - - # The key is store in a jks keystore and needs to be converted to pks12 to be extracted - keytool -importkeystore -srckeystore "${DB_KEYSTORE_LOCATION}" \ - -destkeystore "${DB_TMP_P12_FILE}" \ - -deststoretype PKCS12 \ - -srcstorepass "${DB_KEYSTORE_PASSWORD}" \ - -deststorepass "${DB_KEYSTORE_PASSWORD}" - - mkdir -p "$(dirname "${DB_SSL_CERT_FILE}")" - - openssl pkcs12 -in "${DB_TMP_P12_FILE}" -nokeys \ - -out "${DB_SSL_CERT_FILE}" -passin pass:"${DB_KEYSTORE_PASSWORD}" - rm "${DB_TMP_P12_FILE}" -} - -######################## -# Enable client encryption in configuration -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_enable_client_encryption() { - local cassandra_config - cassandra_config="$(sed -E "/client_encryption_options:.*/ {N;N; s/client_encryption_options:[^\n]*(\n\s+#.*)?(\n\s+enabled:).*/client_encryption_options:\1\2 $DB_CLIENT_ENCRYPTION/g}" "$DB_CONF_FILE")" - echo "$cassandra_config" >"$DB_CONF_FILE" -} - -######################## -# Configure TLS certificates in configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_configure_certificates() { - cassandra_yaml_set "keystore" "$DB_KEYSTORE_LOCATION" - cassandra_yaml_set "keystore_password" "$DB_KEYSTORE_PASSWORD" - cassandra_yaml_set "truststore" "$DB_TRUSTSTORE_LOCATION" - cassandra_yaml_set "truststore_password" "$DB_TRUSTSTORE_PASSWORD" -} - -######################## -# Configure Cassandra configuration files from environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_from_environment_variables() { - # Map environment variables to config properties for cassandra-env.sh - for var in "${!CASSANDRA_CFG_ENV_@}"; do - # shellcheck disable=SC2001 - key="$(echo "$var" | sed -e 's/^CASSANDRA_CFG_ENV_//g')" - value="${!var}" - cassandra_env_conf_set "$key" "$value" - done - # Map environment variables to config properties for cassandra-rackdc.properties - for var in "${!CASSANDRA_CFG_RACKDC_@}"; do - key="$(echo "$var" | sed -e 's/^CASSANDRA_CFG_RACKDC_//g' | tr '[:upper:]' '[:lower:]')" - value="${!var}" - cassandra_rackdc_conf_set "$key" "$value" - done - # Map environment variables to config properties for commitlog_archiving.properties - for var in "${!CASSANDRA_CFG_COMMITLOG_@}"; do - key="$(echo "$var" | sed -e 's/^CASSANDRA_CFG_COMMITLOG_//g' | tr '[:upper:]' '[:lower:]')" - value="${!var}" - cassandra_commitlog_conf_set "$key" "$value" - done - if ! cassandra_is_file_external "$DB_MOUNTED_CONF_PATH"; then - # Map environment variables to config properties for configuration file - for var in "${!CASSANDRA_CFG_YAML_@}"; do - # shellcheck disable=SC2001 - key="$(echo "$var" | sed -e 's/^CASSANDRA_CFG_YAML_//g' | tr '[:upper:]' '[:lower:]')" - value="${!var}" - cassandra_yaml_set "$key" "$value" - done - else - debug "$DB_MOUNTED_CONF_PATH mounted. Skipping data directory configuration" - fi -} - -######################## -# Start Cassandra and wait until it is ready -# Globals: -# DB_* -# Arguments: -# $1 - Log file to write (default /dev/stdout) -# $2 - Maximum number of retries (default $DB_INIT_MAX_RETRIES) -# $3 - Sleep time during retries (default $DB_INIT_SLEEP_TIME) -# Returns: -# None -######################### -cassandra_start_bg() { - local -r logger="${1:-/dev/stdout}" - local -r retries="${2:-$DB_INIT_MAX_RETRIES}" - local -r sleep_time="${3:-$DB_INIT_SLEEP_TIME}" - - info "Starting $DB_FLAVOR" - local -r cmd=("$DB_BIN_DIR/cassandra") - local -r args=("-p" "$DB_PID_FILE" "-R" "-f") - - if am_i_root; then - run_as_user "$DB_DAEMON_USER" "${cmd[@]}" "${args[@]}" >"$logger" 2>&1 & - else - "${cmd[@]}" "${args[@]}" >"$logger" 2>&1 & - fi - - # Even though we set the pid, cassandra is not creating the proper file, so we create it manually - echo $! >"$DB_PID_FILE" - - info "Checking that it started up correctly" - - if [[ "$logger" != "/dev/stdout" ]]; then - am_i_root && chown "$DB_DAEMON_USER":"$DB_DAEMON_GROUP" "$logger" - wait_for_cql_log_entry "$logger" "$retries" "$sleep_time" - fi - wait_for_nodetool_up "$retries" "$sleep_time" -} - -######################## -# Stop Cassandra -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_stop() { - ! is_cassandra_running && return - info "Stopping Cassandra..." - stop_cassandra() { - # Using legacy RMI URL parsing to avoid URISyntaxException: 'Malformed IPv6 address at index 7: rmi://[127.0.0.1]:7199' error - # https://community.datastax.com/questions/13764/java-version-for-cassandra-3113.html - nodetool "-Dcom.sun.jndi.rmiURLParsing=legacy" stopdaemon - is_cassandra_not_running - } - - if ! retry_while "stop_cassandra" "$DB_INIT_MAX_RETRIES" "$DB_INIT_SLEEP_TIME"; then - error "Cassandra failed to stop" - exit 1 - fi - # Manually remove PID file - rm -f "$DB_PID_FILE" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for Cassandra common - -# shellcheck disable=SC1090,SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh - -######################## -# Returns cassandra major version -# Globals: -# CASSANDRA_BASE_DIR -# Arguments: -# None -# Returns: -# None -######################### -cassandra_get_major_version() { - cassandra_version="$("${CASSANDRA_BASE_DIR}/bin/cassandra" -v)" - major_version="$(get_sematic_version "$cassandra_version" 1)" - echo "${major_version:-0}" -} - -######################## -# Change a Cassandra configuration yaml file by setting a property -# Globals: -# DB_* -# Arguments: -# $1 - property -# $2 - value -# $3 - Use quotes in value (default: yes) -# $4 - Path to configuration file (default: $DB_CONF_FILE) -# Returns: -# None -######################### -cassandra_yaml_set() { - local -r property="${1:?missing property}" - local -r value="${2:?missing value}" - local -r use_quotes="${3:-yes}" - local -r conf_file="${4:-$DB_CONF_FILE}" - - if is_boolean_yes "$use_quotes"; then - replace_in_file "$conf_file" "^(\s*)(#\s*)?(\s*)(\-\s*)?${property}:.*" "\1\3\4${property}: '${value}'" - else - replace_in_file "$conf_file" "^(\s*)(#\s*)?(\s*)(\-\s*)?${property}:.*" "\1\3\4${property}: ${value}" - fi -} - -######################### -# Set default Cassandra settings if not set -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_set_default_host() { - if [[ -z "${DB_HOST:-}" ]]; then - warn "DB_HOST not set, defaulting to system hostname" - local -r host="$(hostname)" - export DB_HOST="$host" - export DB_SEEDS="${DB_SEEDS:-$DB_HOST}" - export DB_PEERS="${DB_PEERS:-$DB_SEEDS}" - fi -} - -######################## -# Change a Cassandra configuration yaml file by setting a property as an array -# Globals: -# DB_* -# Arguments: -# $1 - property -# $2 - comma-separated string with the different values -# $3 - Use quotes in value (default: no) -# $4 - Path to configuration file (default: $DB_CONF_FILE) -# Returns: -# None -######################### -cassandra_yaml_set_as_array() { - local -r property="${1:?missing property}" - local -r array="${2:?missing value}" - local -r use_quotes="${3:-no}" - local -r conf_file="${4:-$DB_CONF_FILE}" - local substitution="\2${property}:" - - for value in "${array[@]}"; do - if is_boolean_yes "$use_quotes"; then - substitution+="\n\2 - '${value}'" - else - substitution+="\n\2 - ${value}" - fi - done - replace_in_file "$conf_file" "^(#\s)?(\s*)${property}:.*" "${substitution}" -} - -######################## -# Validate settings in DB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_validate() { - info "Validating settings in DB_* env vars.." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - - empty_password_warn() { - warn "You've not provided a password. Default password \"cassandra\" will be used. For safety reasons, please provide a secure password in a production environment." - } - - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - - check_default_password() { - if [[ "${!1}" = "cassandra" ]]; then - warn "You set the environment variable $1=cassandra. This is the default value when bootstrapping $DB_FLAVOR and should not be used in production environments." - fi - } - - check_yes_no_value() { - if ! is_yes_no_value "${!1}"; then - print_validation_error "The allowed values for $1 are [yes, no]" - fi - } - - check_true_false_value() { - if ! is_true_false_value "${!1}"; then - print_validation_error "The allowed values for $1 are [true, false]" - fi - } - - check_conflicting_ports() { - local -r total="$#" - for i in $(seq 1 "$((total - 1))"); do - for j in $(seq "$((i + 1))" "$total"); do - if (("${!i}" == "${!j}")); then - print_validation_error "${!i} and ${!j} are bound to the same port" - fi - done - done - } - - check_allowed_port() { - local validate_port_args=() - ! am_i_root && validate_port_args+=("-unprivileged") - validate_port_args+=("${!1}") - if ! err=$(validate_port "${validate_port_args[@]}"); then - print_validation_error "An invalid port was specified in the environment variable $1: $err" - fi - } - - check_resolved_hostname() { - if ! is_hostname_resolved "$1"; then - warn "Hostname $1 could not be resolved. This could lead to connection issues" - fi - } - - check_positive_value() { - if ! is_positive_int "${!1}"; then - print_validation_error "The variable $1 must be positive integer" - fi - } - - check_empty_value() { - if is_empty_value "${!1}"; then - print_validation_error "The $1 environment variable is empty or not set." - fi - } - - check_password_file() { - if [[ -n "${!1:-}" ]] && ! [[ -f "${!1:-}" ]]; then - print_validation_error "The variable $1 is defined but the file ${!1} is not accessible or does not exist" - fi - } - - check_password_file DB_PASSWORD_FILE - check_password_file DB_TRUSTSTORE_PASSWORD_FILE - check_password_file DB_KEYSTORE_PASSWORD_FILE - - check_empty_value DB_RACK - check_empty_value DB_DATACENTER - - if [[ -z $DB_PASSWORD ]]; then - if ! is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_warn - export DB_PASSWORD="cassandra" - else - empty_password_enabled_warn - fi - fi - - check_default_password DB_PASSWORD - check_yes_no_value DB_PASSWORD_SEEDER - check_true_false_value DB_ENABLE_REMOTE_CONNECTIONS - check_true_false_value DB_CLIENT_ENCRYPTION - check_true_false_value DB_ENABLE_USER_DEFINED_FUNCTIONS - check_true_false_value DB_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS - check_positive_value DB_NUM_TOKENS - check_positive_value DB_INIT_MAX_RETRIES - check_positive_value DB_CQL_MAX_RETRIES - check_positive_value DB_PEER_CQL_MAX_RETRIES - check_positive_value DB_INIT_SLEEP_TIME - check_positive_value DB_CQL_SLEEP_TIME - check_positive_value DB_PEER_CQL_SLEEP_TIME - check_positive_value DB_CQL_PORT_NUMBER - check_positive_value DB_JMX_PORT_NUMBER - check_positive_value DB_TRANSPORT_PORT_NUMBER - - check_conflicting_ports DB_CQL_PORT_NUMBER DB_JMX_PORT_NUMBER DB_TRANSPORT_PORT_NUMBER - - check_allowed_port DB_CQL_PORT_NUMBER - check_allowed_port DB_TRANSPORT_PORT_NUMBER - check_allowed_port DB_JMX_PORT_NUMBER - - check_resolved_hostname "$DB_HOST" - for peer in ${DB_PEERS//,/ }; do - check_resolved_hostname "$peer" - done - for seed in ${DB_SEEDS//,/ }; do - check_resolved_hostname "$seed" - done - - if [[ ! ${DB_AUTO_SNAPSHOT_TTL} =~ ([1-9]{1}[0-9]{0,}[d|h|m]) ]]; then - print_validation_error "DB_AUTO_SNAPSHOT_TTL accepted units: d (days), h (hours) or m (minutes)" - fi - - check_true_false_value DB_SSL_VALIDATE - check_true_false_value DB_AUTOMATIC_SSTABLE_UPGRADE - - if ((${#DB_PASSWORD} > 512)); then - print_validation_error "The password cannot be longer than 512 characters. Set the environment variable DB_PASSWORD with a shorter value" - fi - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Check if a given configuration file was mounted externally -# Globals: -# DB_* -# Arguments: -# $1 - Filename -# Returns: -# true if the file was mounted externally, false otherwise -######################### -cassandra_is_file_external() { - local -r filename="${1:?file_is_missing}" - if [[ -f "${DB_MOUNTED_CONF_DIR}/${filename}" ]]; then - true - else - false - fi -} - -######################## -# Copy mounted configuration files -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_copy_mounted_config() { - if ! is_dir_empty "$DB_MOUNTED_CONF_DIR"; then - cp -Lr "$DB_MOUNTED_CONF_DIR"/* "$DB_CONF_DIR" - fi -} - -######################## -# Copy default configuration files in case there are no mounted ones -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_copy_default_config() { - local -r tmp_file_list=/tmp/conf_file_list - find "$DB_DEFAULT_CONF_DIR" -type f >$tmp_file_list - while read -r f; do - filename="${f#"${DB_DEFAULT_CONF_DIR}/"}" # Get path with subfolder - dest="${f//$DB_DEFAULT_CONF_DIR/$DB_CONF_DIR}" - if [[ -f "$dest" ]]; then - debug "Found ${filename}. Skipping default" - else - debug "No injected ${filename} file found. Creating default ${filename} file" - # There are conf files in subfolders. We may need to create them - mkdir -p "$(dirname "$dest")" - cp "$f" "$dest" - fi - done <$tmp_file_list - rm "$tmp_file_list" -} - -######################## -# Configure the path to the different data directories (ignored if cassandra.yaml is mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_data_dirs() { - if ! cassandra_is_file_external "${DB_MOUNTED_CONF_PATH}"; then - cassandra_yaml_set_as_array data_file_directories "${DB_DATA_DIR}/data" "$DB_CONF_FILE" - - cassandra_yaml_set commitlog_directory "$DB_COMMITLOG_DIR" - cassandra_yaml_set hints_directory "${DB_DATA_DIR}/hints" - cassandra_yaml_set cdc_raw_directory "${DB_DATA_DIR}/cdc_raw" - cassandra_yaml_set saved_caches_directory "${DB_DATA_DIR}/saved_caches" - else - debug "${DB_MOUNTED_CONF_PATH} mounted. Skipping data directory configuration" - fi -} - -######################## -# Enable password-based authentication (ignored if cassandra.yaml is mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_enable_auth() { - if ! cassandra_is_file_external "${DB_MOUNTED_CONF_PATH}"; then - if [[ "$ALLOW_EMPTY_PASSWORD" = "yes" ]] && [[ -z $DB_PASSWORD ]]; then - if [[ "$DB_FLAVOR" = "scylladb" ]] || [ "$(cassandra_get_major_version)" -lt 5 ]; then - cassandra_yaml_set "authenticator" "AllowAllAuthenticator" - fi - cassandra_yaml_set "authorizer" "AllowAllAuthorizer" - else - if [[ "$DB_FLAVOR" = "cassandra" ]] && [ "$(cassandra_get_major_version)" -ge 5 ]; then - replace_in_file "${DB_CONF_FILE}" "class_name.* AllowAllAuthenticator" "class_name: ${DB_AUTHENTICATOR}" - replace_in_file "${DB_CONF_FILE}" "class_name.* AllowAllAuthorizer" "class_name: ${DB_AUTHORIZER}" - else - cassandra_yaml_set "authenticator" "${DB_AUTHENTICATOR}" - cassandra_yaml_set "authorizer" "${DB_AUTHORIZER}" - fi - fi - else - debug "${DB_MOUNTED_CONF_PATH} mounted. Skipping authentication method configuration" - fi -} - -######################## -# Configure logging settings (ignored if logback.xml is mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_logging() { - if ! cassandra_is_file_external "${DB_MOUNTED_LOGBACK_PATH}"; then - replace_in_file "${DB_LOGBACK_FILE}" "system[.]log" "${DB_FLAVOR}.log" - if [[ "$BITNAMI_DEBUG" = "false" ]]; then - replace_in_file "${DB_LOGBACK_FILE}" "()" "" - fi - else - debug "${DB_MOUNTED_LOGBACK_PATH} mounted. Skipping logging configuration" - fi -} - -######################## -# Configure cluster settings (modifies cassandra.yaml and cassandra-env.sh if not mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_cluster() { - local host="127.0.0.1" - local rpc_address="127.0.0.1" - - if [[ "$DB_ENABLE_REMOTE_CONNECTIONS" = "true" ]]; then - host="$DB_HOST" - rpc_address="0.0.0.0" - fi - # cassandra.yaml changes - if ! cassandra_is_file_external "${DB_MOUNTED_CONF_PATH}"; then - cassandra_yaml_set "num_tokens" "$DB_NUM_TOKENS" "no" - cassandra_yaml_set "cluster_name" "$DB_CLUSTER_NAME" - cassandra_yaml_set "listen_address" "$host" - cassandra_yaml_set "seeds" "$DB_SEEDS" - cassandra_yaml_set "start_rpc" "$DB_ENABLE_RPC" "no" - if [[ "$DB_FLAVOR" = "scylladb" ]]; then - # Ref: https://opensource.docs.scylladb.com/stable/cql/functions.html - cassandra_yaml_set "enable_user_defined_functions" "$DB_ENABLE_USER_DEFINED_FUNCTIONS" "no" - else - # Ref: https://cassandra.apache.org/doc/stable/cassandra/configuration/cass_yaml_file.html#user_defined_functions_enabled - cassandra_yaml_set "user_defined_functions_enabled" "$DB_ENABLE_USER_DEFINED_FUNCTIONS" "no" - cassandra_yaml_set "scripted_user_defined_functions_enabled" "$DB_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS" "no" - fi - cassandra_yaml_set "rpc_address" "$rpc_address" - cassandra_yaml_set "broadcast_rpc_address" "$host" - cassandra_yaml_set "endpoint_snitch" "$DB_ENDPOINT_SNITCH" - cassandra_yaml_set "internode_encryption" "$DB_INTERNODE_ENCRYPTION" - cassandra_configure_certificates - cassandra_yaml_set "auto_snapshot_ttl" "$DB_AUTO_SNAPSHOT_TTL" - - if [[ -n "$DB_BROADCAST_ADDRESS" ]]; then - cassandra_yaml_set "broadcast_address" "$DB_BROADCAST_ADDRESS" - fi - - if [[ -n "$DB_AUTOMATIC_SSTABLE_UPGRADE" ]]; then - cassandra_yaml_set "automatic_sstable_upgrade" "$DB_AUTOMATIC_SSTABLE_UPGRADE" - fi - - cassandra_enable_client_encryption - else - debug "${DB_MOUNTED_CONF_PATH} mounted. Skipping cluster configuration" - fi - - # cassandra-env.sh changes - if ! cassandra_is_file_external "${DB_MOUNTED_ENV_PATH}"; then - replace_in_file "${DB_ENV_FILE}" "#\s*JVM_OPTS=\"\$JVM_OPTS -Djava[.]rmi[.]server[.]hostname=[^\"]*" "JVM_OPTS=\"\$JVM_OPTS -Djava.rmi.server.hostname=${host}" - else - debug "${DB_MOUNTED_ENV_PATH} mounted. Skipping setting server hostname" - fi -} - -######################## -# Configure java path (ignored if cassandra-env.sh is mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_java() { - if ! cassandra_is_file_external "${DB_MOUNTED_ENV_PATH}"; then - replace_in_file "${DB_ENV_FILE}" "(calculate_heap_sizes\(\))" "\nJAVA_HOME=$JAVA_BASE_DIR\nJAVA=$JAVA_BIN_DIR/java\n\n\1" - else - debug "${DB_MOUNTED_ENV_PATH} mounted. Skipping JAVA_HOME configuration" - fi -} - -######################## -# Configure jemalloc path (ignored if cassandra-env.sh is mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_jemalloc() { - if ! cassandra_is_file_external "${DB_MOUNTED_ENV_PATH}"; then - if [[ -n "$(find_jemalloc_lib)" ]]; then - echo "JVM_OPTS=\"\$JVM_OPTS -Dcassandra.libjemalloc=$(find_jemalloc_lib)\"" >>"${DB_CONF_DIR}/cassandra-env.sh" - else - warn "Couldn't find jemalloc installed. Skipping jemalloc configuration." - fi - else - debug "${DB_MOUNTED_ENV_PATH} mounted. Skipping jemalloc configuration." - fi -} - -######################## -# Change the password for the cassandra user -# Globals: -# DB_* -# Arguments: -# 1 - Old password (default: cassandra) -# 2 - New Password (default: $DB_PASSWORD) -# 3 - Maximum number of retries (default: $DB_CQL_MAX_RETRIES) -# 4 - Sleep time between retries (default: $DB_CQL_SLEEP_TIME) -# Returns: -# None -######################### -cassandra_change_cassandra_password() { - local -r old_password="${1:-cassandra}" - local -r new_password="${2:-$DB_PASSWORD}" - local -r retries="${3:-$DB_CQL_MAX_RETRIES}" - local -r sleep_time="${4:-$DB_CQL_SLEEP_TIME}" - - info 'Updating the password for the "cassandra" user...' - local -r user="cassandra" - local -r escaped_password="${new_password//\'/\'\'}" - - if (echo "ALTER USER cassandra WITH PASSWORD \$\$${escaped_password}\$\$;" | cassandra_execute_with_retries "$retries" "$sleep_time" "$user" "$old_password"); then - debug "ALTER USER command executed. Trying to log in" - wait_for_cql_access "$user" "$new_password" "" "$retries" "$sleep_time" - info "Password updated successfully" - fi -} - -######################## -# Create a new admin user -# Globals: -# DB_* -# Arguments: -# 1 - New username (default: $DB_USER) -# 2 - New user password (default: $DB_PASSWORD) -# 3 - Admin username (which will create the new user) (default: cassandra) -# 4 - Admin password (default: cassandra) -# 5 - Maximum number of retries (default: $DB_CQL_MAX_RETRIES) -# 6 - Sleep time between retries (default: $DB_CQL_SLEEP_TIME) -# Returns: -# None -######################### -cassandra_create_admin_user() { - local -r new_user="${1:-$DB_USER}" - local -r password="${2:-$DB_PASSWORD}" - local -r admin_user="${3:-cassandra}" - local -r admin_user_password="${4:-cassandra}" - local -r retries="${5:-$DB_CQL_MAX_RETRIES}" - local -r sleep_time="${6:-$DB_CQL_SLEEP_TIME}" - - info "Creating super-user $new_user" - local -r escaped_password="${password//\'/\'\'}" - - echo "CREATE USER '${new_user}' WITH PASSWORD \$\$${escaped_password}\$\$ SUPERUSER;" | cassandra_execute_with_retries "$retries" "$sleep_time" "$admin_user" "$admin_user_password" -} - -######################## -# Configure common port binding (modifies cassandra.yaml and cassandra-env.sh if not mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_common_ports() { - if ! cassandra_is_file_external "${DB_MOUNTED_CONF_PATH}"; then - cassandra_yaml_set "native_transport_port" "$DB_CQL_PORT_NUMBER" "no" - cassandra_yaml_set "storage_port" "$DB_TRANSPORT_PORT_NUMBER" "no" - else - debug "${DB_MOUNTED_CONF_PATH} mounted. Skipping native and storage ports configuration" - fi - - if ! cassandra_is_file_external "${DB_MOUNTED_ENV_PATH}"; then - replace_in_file "${DB_ENV_FILE}" "JMX_PORT=.*" "JMX_PORT=$DB_JMX_PORT_NUMBER" - else - debug "${DB_MOUNTED_ENV_PATH} mounted. Skipping JMX port configuration" - fi -} - -######################## -# Configure rack and datacenter (ignored if cassandra-rackdc.properties is mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_rack_dc() { - if ! cassandra_is_file_external "${DB_MOUNTED_RACKDC_PATH}"; then - replace_in_file "${DB_RACKDC_FILE}" "dc=.*" "dc=${DB_DATACENTER}" - replace_in_file "${DB_RACKDC_FILE}" "rack=.*" "rack=${DB_RACK}" - else - debug "${DB_MOUNTED_RACKDC_PATH} mounted. Skipping rack and datacenter configuration" - fi -} - -######################## -# Remove PIDs, log files and conf files from a previous run (case of container restart) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_clean_from_restart() { - rm -f "$DB_PID_FILE" - rm -f "$DB_FIRST_BOOT_LOG_FILE" "$DB_INITSCRIPTS_BOOT_LOG_FILE" - if ! is_dir_empty "$DB_CONF_DIR"; then - rm -rf "${DB_CONF_DIR:?}"/* - fi -} - -######################## -# Ensure Cassandra is initialized -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_initialize() { - info "Initializing $DB_FLAVOR database..." - - cassandra_clean_from_restart - cassandra_copy_mounted_config - cassandra_copy_default_config - cassandra_enable_auth - cassandra_setup_java - cassandra_setup_jemalloc - cassandra_setup_logging - cassandra_setup_ports - cassandra_setup_rack_dc - cassandra_setup_data_dirs - cassandra_setup_cluster - cassandra_setup_from_environment_variables # Give priority to users configuration - - is_boolean_yes "$DB_CLIENT_ENCRYPTION" && cassandra_setup_client_ssl - - debug "Ensuring expected directories/files exist..." - for dir in "$DB_DATA_DIR" "$DB_TMP_DIR" "$DB_LOG_DIR"; do - ensure_dir_exists "$dir" - am_i_root && chown -R "$DB_DAEMON_USER:$DB_DAEMON_GROUP" "$dir" - done - - if ! is_dir_empty "$DB_DATA_DIR"; then - info "Deploying $DB_FLAVOR with persisted data" - else - info "Deploying $DB_FLAVOR from scratch" - cassandra_start_bg "$DB_FIRST_BOOT_LOG_FILE" - if is_boolean_yes "$DB_PASSWORD_SEEDER"; then - info "Password seeder node" - # Check that all peers are ready - for peer in ${DB_PEERS//,/ }; do - wait_for_cql_access "cassandra" "cassandra" "$peer" "$DB_PEER_CQL_MAX_RETRIES" "$DB_PEER_CQL_SLEEP_TIME" - done - # Setup user - if [[ "$DB_USER" = "cassandra" ]]; then - cassandra_change_cassandra_password "cassandra" "$DB_PASSWORD" "$DB_CQL_MAX_RETRIES" "$DB_CQL_SLEEP_TIME" - else - cassandra_create_admin_user "$DB_USER" "$DB_PASSWORD" "cassandra" "cassandra" "$DB_CQL_MAX_RETRIES" "$DB_CQL_SLEEP_TIME" - fi - - cassandra_execute_startup_cql - else - info "Non-seeder node. Waiting for synchronization" - wait_for_cql_access "$DB_USER" "$DB_PASSWORD" "" "$DB_PEER_CQL_MAX_RETRIES" "$DB_PEER_CQL_SLEEP_TIME" - fi - fi -} - -######################## -# Execute Cassandra startup cql (defined in DB_STARTUP_CQL) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_execute_startup_cql() { - if [[ -n "$DB_STARTUP_CQL" ]]; then - info "Executing Startup CQL" - if ! (echo "$DB_STARTUP_CQL" | cassandra_execute_with_retries "$DB_CQL_MAX_RETRIES" "$DB_CQL_SLEEP_TIME" "$DB_USER" "$DB_PASSWORD"); then - error "Failed executing startup CQL command" - exit 1 - fi - info "Startup CQL commands executed successfully" - fi -} - -######################## -# Run custom initialization scripts -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_custom_init_scripts() { - if [[ -n "$(find "$DB_INITSCRIPTS_DIR/" \( -type f -o -type l \) -regex ".*\.\(sh\|cql\|cql.gz\)" ! -path "*/.*/*")" ]] && [[ ! -f "$DB_VOLUME_DIR/.user_scripts_initialized" ]]; then - info "Loading user's custom files from $DB_INITSCRIPTS_DIR ..." - local -r tmp_file="/tmp/filelist" - if ! is_cassandra_running; then - cassandra_start_bg "$DB_INITSCRIPTS_BOOT_LOG_FILE" - wait_for_cql_access - fi - find "${DB_INITSCRIPTS_DIR}/" \( -type f -o -type l \) -regex ".*\.\(sh\|cql\|cql.gz\)" ! -path "*/.*/*" | sort >"$tmp_file" - while read -r f; do - case "$f" in - *.sh) - if [[ -x "$f" ]]; then - debug "Executing $f" - "$f" - else - debug "Sourcing $f" - . "$f" - fi - ;; - *.cql) - debug "Executing $f" - cassandra_execute "$DB_USER" "$DB_PASSWORD" <"$f" - ;; - *.cql.gz) - debug "Executing $f" - gunzip -c "$f" | cassandra_execute "$DB_USER" "$DB_PASSWORD" - ;; - *) debug "Ignoring $f" ;; - esac - done <$tmp_file - rm -f "$tmp_file" - touch "$DB_VOLUME_DIR"/.user_scripts_initialized - fi -} - -######################## -# Execute an arbitrary query/queries against the running Cassandra service -# Stdin: -# Query/queries to execute -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - User to run queries -# $2 - Password -# $3 - Keyspace -# $4 - Host (default: localhost) -# $5 - Extra flags -# Returns: -# None -####################### -cassandra_execute() { - local -r user="${1:-$DB_USER}" - local -r pass="${2:-$DB_PASSWORD}" - local -r keyspace="${3:-}" - local -r host="${4:-localhost}" - local -r extra_args="${5:-}" - local -r port="${DB_CQL_PORT_NUMBER}" - local -r cmd=("cqlsh") - local args=("-u" "$user" "-p" "$pass") - - is_boolean_yes "$DB_CLIENT_ENCRYPTION" && args+=("--ssl") - [[ -n "$keyspace" ]] && args+=("-k" "$keyspace") - if [[ -n "$extra_args" ]]; then - local extra_args_array=() - read -r -a extra_args_array <<<"$extra_args" - [[ "${#extra_args[@]}" -gt 0 ]] && args+=("${extra_args_array[@]}") - fi - args+=("$host") - args+=("$port") - if [[ "${BITNAMI_DEBUG}" = true ]]; then - local -r command="$(cat)" - debug "Executing CQL \"$command\"" - echo "$command" | "${cmd[@]}" "${args[@]}" - else - "${cmd[@]}" "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Execute an arbitrary query/queries against the running Cassandra service with retries (in case Cassandra is still initializing or performing consistency operations) -# Stdin: -# Query/queries to execute -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - Maximum number of retries (default: $DB_CQL_MAX_RETRIES) -# $2 - Sleep time between retries (default: $DB_CQL_SLEEP_TIME) -# $3 - User to run queries -# $4 - Password -# $5 - Keyspace -# $6 - Host (default: localhost) -# $7 - Extra flags -# Returns: -# None -####################### -cassandra_execute_with_retries() { - local -r retries="${1:-$DB_CQL_MAX_RETRIES}" - local -r sleep_time="${2:-$DB_CQL_SLEEP_TIME}" - local -r user="${3:-$DB_USER}" - local -r pass="${4:-$DB_PASSWORD}" - local -r keyspace="${5:-}" - local -r host="${6:-localhost}" - local -r extra_args="${7:-}" - - local success=no - - # Get command from stdin as we will retry it several times - local -r command="$(cat)" - - for i in $(seq 1 "$retries"); do - if (echo "$command" | cassandra_execute "$user" "$pass" "$keyspace" "$host" "$extra_args"); then - success=yes - break - fi - sleep "$sleep_time" - done - if is_boolean_yes "$success"; then - true - else - error "CQL command failed $retries times" - false - fi -} - -######################## -# Wait until nodetool checks the node is ready -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - Maximum number of retries (default $DB_INIT_MAX_RETRIES) -# $2 - Sleep time during retries (default $DB_INIT_SLEEP_TIME) -# Returns: -# None -######################### -wait_for_nodetool_up() { - local -r retries="${1:-$DB_INIT_MAX_RETRIES}" - local -r sleep_time="${2:-$DB_INIT_SLEEP_TIME}" - - debug "Checking status with nodetool" - - check_function_nodetool_node_ip() { - # Using legacy RMI URL parsing to avoid URISyntaxException: 'Malformed IPv6 address at index 7: rmi://[127.0.0.1]:7199' error - # https://community.datastax.com/questions/13764/java-version-for-cassandra-3113.html - local -r check_cmd=("nodetool" "-Dcom.sun.jndi.rmiURLParsing=legacy") - local -r check_args=("status" "--port" "$DB_JMX_PORT_NUMBER") - local -r machine_ip="$(dns_lookup "${DB_BROADCAST_ADDRESS:-$DB_HOST}" "v4")" - local -r check_regex="UN\s*(${DB_HOST}|${machine_ip}|127.0.0.1)" - - local output="/dev/null" - if [[ "$BITNAMI_DEBUG" = "true" ]]; then - output="/dev/stdout" - fi - - "${check_cmd[@]}" "${check_args[@]}" | grep -E "${check_regex}" >"${output}" - } - - check_function_nodetool_node_count() { - # Using legacy RMI URL parsing to avoid URISyntaxException: 'Malformed IPv6 address at index 7: rmi://[127.0.0.1]:7199' error - # https://community.datastax.com/questions/13764/java-version-for-cassandra-3113.html - local -r check_cmd=("nodetool" "-Dcom.sun.jndi.rmiURLParsing=legacy") - local -r check_args=("status" "--port" "$DB_JMX_PORT_NUMBER") - local -r machine_ip="$(dns_lookup "${DB_BROADCAST_ADDRESS:-$DB_HOST}" "v4")" - local -r check_regex="UN\s*" - read -r -a host_list <<<"$(tr ',;' ' ' <<<"$DB_NODES")" - local -r expected_node_count="${#host_list[@]}" - local actual_node_count - - local output="/dev/null" - if [[ "$BITNAMI_DEBUG" = "true" ]]; then - output="/dev/stdout" - fi - - actual_node_count=$("${check_cmd[@]}" "${check_args[@]}" | grep -c "${check_regex}" || true) - if [[ "$expected_node_count" != "$actual_node_count" ]]; then - false - fi - } - - if retry_while check_function_nodetool_node_ip "$retries" "$sleep_time"; then - info "Nodetool reported the successful startup of $DB_FLAVOR" - true - else - error "$DB_FLAVOR failed to start up" - if [[ "$BITNAMI_DEBUG" = "true" ]]; then - error "Nodetool output" - "${check_cmd[@]}" "${check_args[@]}" - fi - exit 1 - fi - - if [[ -n "$DB_NODES" ]]; then - if retry_while check_function_nodetool_node_count "$retries" "$sleep_time"; then - info "All nodes reached the UN status (Up/Normal)" - true - else - error "Some nodes did not reach the UN status (Up/Normal)" - if [[ "$BITNAMI_DEBUG" = "true" ]]; then - error "Nodetool output" - "${check_cmd[@]}" "${check_args[@]}" - fi - exit 1 - fi - fi -} - -######################## -# Wait until the log file shows that CQL is ready -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - Log file to check -# $1 - Maximum number of retries (default $DB_INIT_MAX_RETRIES) -# $2 - Sleep time during retries (default $DB_INIT_SLEEP_TIME) -# Returns: -# None -######################### -wait_for_cql_log_entry() { - local -r logger="${1:-/dev/stdout}" - local -r retries="${2:-$DB_INIT_MAX_RETRIES}" - local -r sleep_time="${3:-$DB_INIT_SLEEP_TIME}" - - debug "Checking that log $logger contains entry \"Starting listening for CQL clients\"" - - check_function_log_entry() { - local -r check_cmd=("cat") - local -r check_args=("$logger") - local -r check_regex="Starting listening for CQL clients" - - local output="/dev/null" - if [[ "$BITNAMI_DEBUG" = "true" ]]; then - output="/dev/stdout" - fi - "${check_cmd[@]}" "${check_args[@]}" | grep -E "${check_regex}" >"${output}" - } - - if retry_while check_function_log_entry "$retries" "$sleep_time"; then - info "Found CQL startup log line" - else - error "$DB_FLAVOR failed to start up" - error "Log content" - cat "$logger" - exit 1 - fi -} - -######################## -# Poll until the CQL command DESCRIBE KEYSPACES works successfully -# Globals: -# DB_* -# Arguments: -# 1 - Username (default: $DB_USER) -# 2 - Password (default: $DB_PASSWORD) -# 3 - Hostname (default: $DB_HOST) -# 4 - Maximum number of retries (default: $DB_CQL_MAX_RETRIES) -# 5 - Sleep time between retries (default: $DB_CQL_SLEEP_TIME) -# Returns: -# None -######################### -wait_for_cql_access() { - local -r user="${1:-$DB_USER}" - local -r password="${2:-$DB_PASSWORD}" - local -r host="${3:-$DB_HOST}" - local -r max_retries="${4:-$DB_CQL_MAX_RETRIES}" - local -r sleep_time="${5:-$DB_CQL_SLEEP_TIME}" - - info "Trying to access CQL server @ $host" - if (echo "DESCRIBE KEYSPACES" | cassandra_execute_with_retries "$max_retries" "$sleep_time" "$user" "$password" "" "$host"); then - info "Accessed CQL server successfully" - else - error "Could not access CQL server" - exit 1 - fi -} - -######################## -# Check if Cassandra is running -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Boolean -######################### -is_cassandra_running() { - local -r pid="$(get_pid_from_file "$DB_PID_FILE")" - - if [[ -z "$pid" ]]; then - false - else - is_service_running "$pid" - fi -} - -######################## -# Return true if cassandra is not running -# Globals: -# KONG_* -# Arguments: -# None -# Returns: -# None -######################### -is_cassandra_not_running() { - ! is_cassandra_running -} - -######################## -# Set a configuration setting value to a file -# Globals: -# None -# Arguments: -# $1 - file -# $2 - key -# $3 - values (array) -# Returns: -# None -######################### -cassandra_common_conf_set() { - local -r file="${1:?missing file}" - local -r key="${2:?missing key}" - shift 2 - local values=("$@") - - if [[ "${#values[@]}" -eq 0 ]]; then - stderr_print "missing value" - return 1 - elif [[ "${#values[@]}" -ne 1 ]]; then - for i in "${!values[@]}"; do - cassandra_common_conf_set "$file" "${key[$i]}" "${values[$i]}" - done - else - value="${values[0]}" - # Check if the value was set before - if grep -q "^[#\\s]*$key\s*=.*" "$file"; then - # Update the existing key - replace_in_file "$file" "^[#\\s]*${key}\s*=.*" "${key}=${value}" false - else - # Add a new key - printf '\n%s=%s' "$key" "$value" >>"$file" - fi - fi -} - -######################## -# Set a configuration setting value to cassandra-env.sh -# Globals: -# DB_CONF_DIR -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -cassandra_env_conf_set() { - cassandra_common_conf_set "${DB_ENV_FILE}" "$@" -} - -######################## -# Set a configuration setting value to cassandra-rackdc.properties -# Globals: -# DB_CONF_DIR -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -cassandra_rackdc_conf_set() { - cassandra_common_conf_set "$DB_RACKDC_FILE" "$@" -} - -######################## -# Set a configuration setting value to commitlog_archiving.properties -# Globals: -# DB_CONF_DIR -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -cassandra_commitlog_conf_set() { - cassandra_common_conf_set "${DB_COMMITLOG_ARCHIVING_FILE}" "$@" -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=("/usr/lib" "/usr/lib64") - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} diff --git a/bitnami/cassandra/4.0/debian-12/tags-info.yaml b/bitnami/cassandra/4.0/debian-12/tags-info.yaml deleted file mode 100644 index 4e65b37568d65..0000000000000 --- a/bitnami/cassandra/4.0/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "4.0" -- 4.0-debian-12 -- 4.0.15 diff --git a/bitnami/cassandra/4.1/README.md b/bitnami/cassandra/4.1/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/cassandra/4.1/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/cassandra/4.1/debian-12/Dockerfile b/bitnami/cassandra/4.1/debian-12/Dockerfile deleted file mode 100644 index 9734b16b079d8..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T20:58:58Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/cassandra/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="4.1.7-debian-12-r3" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/cassandra" \ - org.opencontainers.image.title="cassandra" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="4.1.7" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libbz2-1.0 libcom-err2 libcrypt1 libffi8 libgssapi-krb5-2 libjemalloc2 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 liblzma5 libncursesw6 libnsl2 libreadline8 libsqlite3-0 libssl3 libtinfo6 libtirpc3 procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "python-3.11.11-0-linux-${OS_ARCH}-debian-12" \ - "java-11.0.25-11-1-linux-${OS_ARCH}-debian-12" \ - "cassandra-4.1.7-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN ln -s /opt/bitnami/scripts/cassandra/entrypoint.sh /entrypoint.sh -RUN ln -s /opt/bitnami/scripts/cassandra/run.sh /run.sh -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/cassandra/postunpack.sh -RUN /opt/bitnami/scripts/java/postunpack.sh -ENV APP_VERSION="4.1.7" \ - BITNAMI_APP_NAME="cassandra" \ - JAVA_HOME="/opt/bitnami/java" \ - PATH="/opt/bitnami/python/bin:/opt/bitnami/java/bin:/opt/bitnami/cassandra/bin:$PATH" - -EXPOSE 7000 9042 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/cassandra/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/cassandra/run.sh" ] diff --git a/bitnami/cassandra/4.1/debian-12/docker-compose-cluster.yml b/bitnami/cassandra/4.1/debian-12/docker-compose-cluster.yml deleted file mode 100644 index 06225ecd53d80..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/docker-compose-cluster.yml +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - cassandra: - image: docker.io/bitnami/cassandra:4.1 - ports: - - 7000:7000 - - 9042:9042 - volumes: - - cassandra_data:/bitnami - environment: - - CASSANDRA_SEEDS=cassandra,cassandra2 - - CASSANDRA_CLUSTER_NAME=cassandra-cluster - - CASSANDRA_PASSWORD_SEEDER=yes - - CASSANDRA_PASSWORD=cassandra - # By default, Cassandra autodetects the available host memory and takes as much as it can. - # Therefore, memory options are mandatory if multiple Cassandras are launched in the same node. - - MAX_HEAP_SIZE=2G - - HEAP_NEWSIZE=200M - cassandra2: - image: docker.io/bitnami/cassandra:4.1 - ports: - - 7001:7000 - - 9043:9042 - volumes: - - cassandra2_data:/bitnami - environment: - - CASSANDRA_SEEDS=cassandra,cassandra2 - - CASSANDRA_CLUSTER_NAME=cassandra-cluster - - CASSANDRA_PASSWORD=cassandra - # By default, Cassandra autodetects the available host memory and takes as much as it can. - # Therefore, memory options are mandatory if multiple Cassandras are launched in the same node. - - MAX_HEAP_SIZE=2G - - HEAP_NEWSIZE=200M -volumes: - cassandra_data: - driver: local - cassandra2_data: - driver: local diff --git a/bitnami/cassandra/4.1/debian-12/docker-compose.yml b/bitnami/cassandra/4.1/debian-12/docker-compose.yml deleted file mode 100644 index cbbeaa519bd98..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/docker-compose.yml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - cassandra: - image: docker.io/bitnami/cassandra:4.1 - ports: - - '7000:7000' - - '9042:9042' - volumes: - - 'cassandra_data:/bitnami' - environment: - - CASSANDRA_SEEDS=cassandra - - CASSANDRA_PASSWORD_SEEDER=yes - - CASSANDRA_PASSWORD=cassandra -volumes: - cassandra_data: - driver: local diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 73203030032e8..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "cassandra": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "4.1.7-1" - }, - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "11.0.25-11-1" - }, - "python": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "3.11.11-0" - } -} \ No newline at end of file diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/cassandra/4.1/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/cassandra/4.1/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/cassandra/4.1/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra-env.sh b/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra-env.sh deleted file mode 100644 index c87e6e6d1b632..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra-env.sh +++ /dev/null @@ -1,264 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for cassandra - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-cassandra}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -cassandra_env_vars=( - CASSANDRA_MOUNTED_CONF_DIR - CASSANDRA_CLIENT_ENCRYPTION - CASSANDRA_CLUSTER_NAME - CASSANDRA_DATACENTER - CASSANDRA_ENABLE_REMOTE_CONNECTIONS - CASSANDRA_ENABLE_RPC - CASSANDRA_ENABLE_USER_DEFINED_FUNCTIONS - CASSANDRA_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS - CASSANDRA_ENDPOINT_SNITCH - CASSANDRA_HOST - CASSANDRA_INTERNODE_ENCRYPTION - CASSANDRA_NUM_TOKENS - CASSANDRA_PASSWORD_SEEDER - CASSANDRA_SEEDS - CASSANDRA_PEERS - CASSANDRA_NODES - CASSANDRA_RACK - CASSANDRA_BROADCAST_ADDRESS - CASSANDRA_AUTOMATIC_SSTABLE_UPGRADE - CASSANDRA_STARTUP_CQL - CASSANDRA_IGNORE_INITDB_SCRIPTS - CASSANDRA_CQL_PORT_NUMBER - CASSANDRA_JMX_PORT_NUMBER - CASSANDRA_TRANSPORT_PORT_NUMBER - CASSANDRA_CQL_MAX_RETRIES - CASSANDRA_CQL_SLEEP_TIME - CASSANDRA_INIT_MAX_RETRIES - CASSANDRA_INIT_SLEEP_TIME - CASSANDRA_PEER_CQL_MAX_RETRIES - CASSANDRA_PEER_CQL_SLEEP_TIME - CASSANDRA_DELAY_START_TIME - CASSANDRA_AUTO_SNAPSHOT_TTL - ALLOW_EMPTY_PASSWORD - CASSANDRA_AUTHORIZER - CASSANDRA_AUTHENTICATOR - CASSANDRA_USER - CASSANDRA_PASSWORD - CASSANDRA_KEYSTORE_PASSWORD - CASSANDRA_TRUSTSTORE_PASSWORD - CASSANDRA_KEYSTORE_LOCATION - CASSANDRA_TRUSTSTORE_LOCATION - CASSANDRA_TMP_P12_FILE - CASSANDRA_SSL_CERT_FILE - CASSANDRA_SSL_KEY_FILE - CASSANDRA_SSL_CA_FILE - CASSANDRA_SSL_VALIDATE - SSL_VERSION - JAVA_TOOL_OPTIONS -) -for env_var in "${cassandra_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset cassandra_env_vars -export DB_FLAVOR="cassandra" - -# Paths -export CASSANDRA_BASE_DIR="/opt/bitnami/cassandra" -export DB_BASE_DIR="$CASSANDRA_BASE_DIR" -export CASSANDRA_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_BIN_DIR="$CASSANDRA_BIN_DIR" -export CASSANDRA_VOLUME_DIR="/bitnami/cassandra" -export DB_VOLUME_DIR="$CASSANDRA_VOLUME_DIR" -export CASSANDRA_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_DATA_DIR="$CASSANDRA_DATA_DIR" -export CASSANDRA_COMMITLOG_DIR="${DB_DATA_DIR}/commitlog" -export DB_COMMITLOG_DIR="$CASSANDRA_COMMITLOG_DIR" -export CASSANDRA_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d" -export DB_INITSCRIPTS_DIR="$CASSANDRA_INITSCRIPTS_DIR" -export CASSANDRA_LOG_DIR="${DB_BASE_DIR}/logs" -export DB_LOG_DIR="$CASSANDRA_LOG_DIR" -export CASSANDRA_MOUNTED_CONF_DIR="${CASSANDRA_MOUNTED_CONF_DIR:-${DB_VOLUME_DIR}/conf}" -export DB_MOUNTED_CONF_DIR="$CASSANDRA_MOUNTED_CONF_DIR" -export CASSANDRA_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_TMP_DIR="$CASSANDRA_TMP_DIR" -export JAVA_BASE_DIR="${BITNAMI_ROOT_DIR}/java" -export JAVA_BIN_DIR="${JAVA_BASE_DIR}/bin" -export PYTHON_BASE_DIR="${BITNAMI_ROOT_DIR}/python" -export PYTHON_BIN_DIR="${PYTHON_BASE_DIR}/bin" -export CASSANDRA_LOG_FILE="${DB_LOG_DIR}/cassandra.log" -export DB_LOG_FILE="$CASSANDRA_LOG_FILE" -export CASSANDRA_FIRST_BOOT_LOG_FILE="${DB_LOG_DIR}/cassandra_first_boot.log" -export DB_FIRST_BOOT_LOG_FILE="$CASSANDRA_FIRST_BOOT_LOG_FILE" -export CASSANDRA_INITSCRIPTS_BOOT_LOG_FILE="${DB_LOG_DIR}/cassandra_init_scripts_boot.log" -export DB_INITSCRIPTS_BOOT_LOG_FILE="$CASSANDRA_INITSCRIPTS_BOOT_LOG_FILE" -export CASSANDRA_PID_FILE="${DB_TMP_DIR}/cassandra.pid" -export DB_PID_FILE="$CASSANDRA_PID_FILE" -export PATH="${DB_BIN_DIR}:${BITNAMI_ROOT_DIR}/common/bin:${BITNAMI_ROOT_DIR}/python/bin:${BITNAMI_ROOT_DIR}/java/bin:$PATH" - -# System users (when running with a privileged user) -export CASSANDRA_DAEMON_USER="cassandra" -export DB_DAEMON_USER="$CASSANDRA_DAEMON_USER" -export CASSANDRA_DAEMON_GROUP="cassandra" -export DB_DAEMON_GROUP="$CASSANDRA_DAEMON_GROUP" - -# Cassandra cluster settings -export CASSANDRA_CLIENT_ENCRYPTION="${CASSANDRA_CLIENT_ENCRYPTION:-false}" -export DB_CLIENT_ENCRYPTION="$CASSANDRA_CLIENT_ENCRYPTION" -export CASSANDRA_CLUSTER_NAME="${CASSANDRA_CLUSTER_NAME:-My Cluster}" -export DB_CLUSTER_NAME="$CASSANDRA_CLUSTER_NAME" -export CASSANDRA_DATACENTER="${CASSANDRA_DATACENTER:-dc1}" -export DB_DATACENTER="$CASSANDRA_DATACENTER" -export CASSANDRA_ENABLE_REMOTE_CONNECTIONS="${CASSANDRA_ENABLE_REMOTE_CONNECTIONS:-true}" -export DB_ENABLE_REMOTE_CONNECTIONS="$CASSANDRA_ENABLE_REMOTE_CONNECTIONS" -export CASSANDRA_ENABLE_RPC="${CASSANDRA_ENABLE_RPC:-false}" -export DB_ENABLE_RPC="$CASSANDRA_ENABLE_RPC" -export CASSANDRA_ENABLE_USER_DEFINED_FUNCTIONS="${CASSANDRA_ENABLE_USER_DEFINED_FUNCTIONS:-false}" -export DB_ENABLE_USER_DEFINED_FUNCTIONS="$CASSANDRA_ENABLE_USER_DEFINED_FUNCTIONS" -export CASSANDRA_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS="${CASSANDRA_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS:-false}" -export DB_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS="$CASSANDRA_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS" -export CASSANDRA_ENDPOINT_SNITCH="${CASSANDRA_ENDPOINT_SNITCH:-SimpleSnitch}" -export DB_ENDPOINT_SNITCH="$CASSANDRA_ENDPOINT_SNITCH" -export CASSANDRA_HOST="${CASSANDRA_HOST:-}" -export DB_HOST="$CASSANDRA_HOST" -export CASSANDRA_INTERNODE_ENCRYPTION="${CASSANDRA_INTERNODE_ENCRYPTION:-none}" -export DB_INTERNODE_ENCRYPTION="$CASSANDRA_INTERNODE_ENCRYPTION" -export CASSANDRA_NUM_TOKENS="${CASSANDRA_NUM_TOKENS:-256}" -export DB_NUM_TOKENS="$CASSANDRA_NUM_TOKENS" -export CASSANDRA_PASSWORD_SEEDER="${CASSANDRA_PASSWORD_SEEDER:-no}" -export DB_PASSWORD_SEEDER="$CASSANDRA_PASSWORD_SEEDER" -export CASSANDRA_SEEDS="${CASSANDRA_SEEDS:-$DB_HOST}" -export DB_SEEDS="$CASSANDRA_SEEDS" -export CASSANDRA_PEERS="${CASSANDRA_PEERS:-$DB_SEEDS}" -export DB_PEERS="$CASSANDRA_PEERS" -export CASSANDRA_NODES="${CASSANDRA_NODES:-}" -export DB_NODES="$CASSANDRA_NODES" -export CASSANDRA_RACK="${CASSANDRA_RACK:-rack1}" -export DB_RACK="$CASSANDRA_RACK" -export CASSANDRA_BROADCAST_ADDRESS="${CASSANDRA_BROADCAST_ADDRESS:-}" -export DB_BROADCAST_ADDRESS="$CASSANDRA_BROADCAST_ADDRESS" -export CASSANDRA_AUTOMATIC_SSTABLE_UPGRADE="${CASSANDRA_AUTOMATIC_SSTABLE_UPGRADE:-false}" -export DB_AUTOMATIC_SSTABLE_UPGRADE="$CASSANDRA_AUTOMATIC_SSTABLE_UPGRADE" - -# Database initialization settings -export CASSANDRA_STARTUP_CQL="${CASSANDRA_STARTUP_CQL:-}" -export DB_STARTUP_CQL="$CASSANDRA_STARTUP_CQL" -export CASSANDRA_IGNORE_INITDB_SCRIPTS="${CASSANDRA_IGNORE_INITDB_SCRIPTS:-no}" -export DB_IGNORE_INITDB_SCRIPTS="$CASSANDRA_IGNORE_INITDB_SCRIPTS" - -# Port configuration -export CASSANDRA_CQL_PORT_NUMBER="${CASSANDRA_CQL_PORT_NUMBER:-9042}" -export DB_CQL_PORT_NUMBER="$CASSANDRA_CQL_PORT_NUMBER" -export CASSANDRA_JMX_PORT_NUMBER="${CASSANDRA_JMX_PORT_NUMBER:-7199}" -export DB_JMX_PORT_NUMBER="$CASSANDRA_JMX_PORT_NUMBER" -export CASSANDRA_TRANSPORT_PORT_NUMBER="${CASSANDRA_TRANSPORT_PORT_NUMBER:-7000}" -export DB_TRANSPORT_PORT_NUMBER="$CASSANDRA_TRANSPORT_PORT_NUMBER" - -# Retries and sleep time configuration -export CASSANDRA_CQL_MAX_RETRIES="${CASSANDRA_CQL_MAX_RETRIES:-20}" -export DB_CQL_MAX_RETRIES="$CASSANDRA_CQL_MAX_RETRIES" -export CASSANDRA_CQL_SLEEP_TIME="${CASSANDRA_CQL_SLEEP_TIME:-5}" -export DB_CQL_SLEEP_TIME="$CASSANDRA_CQL_SLEEP_TIME" -export CASSANDRA_INIT_MAX_RETRIES="${CASSANDRA_INIT_MAX_RETRIES:-100}" -export DB_INIT_MAX_RETRIES="$CASSANDRA_INIT_MAX_RETRIES" -export CASSANDRA_INIT_SLEEP_TIME="${CASSANDRA_INIT_SLEEP_TIME:-5}" -export DB_INIT_SLEEP_TIME="$CASSANDRA_INIT_SLEEP_TIME" -export CASSANDRA_PEER_CQL_MAX_RETRIES="${CASSANDRA_PEER_CQL_MAX_RETRIES:-100}" -export DB_PEER_CQL_MAX_RETRIES="$CASSANDRA_PEER_CQL_MAX_RETRIES" -export CASSANDRA_PEER_CQL_SLEEP_TIME="${CASSANDRA_PEER_CQL_SLEEP_TIME:-10}" -export DB_PEER_CQL_SLEEP_TIME="$CASSANDRA_PEER_CQL_SLEEP_TIME" -export CASSANDRA_DELAY_START_TIME="${CASSANDRA_DELAY_START_TIME:-10}" -export DB_DELAY_START_TIME="$CASSANDRA_DELAY_START_TIME" - -# Snapshot settings -export CASSANDRA_AUTO_SNAPSHOT_TTL="${CASSANDRA_AUTO_SNAPSHOT_TTL:-30d}" -export DB_AUTO_SNAPSHOT_TTL="$CASSANDRA_AUTO_SNAPSHOT_TTL" - -# Authentication, Authorization and Credentials -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export CASSANDRA_AUTHORIZER="${CASSANDRA_AUTHORIZER:-CassandraAuthorizer}" -export DB_AUTHORIZER="$CASSANDRA_AUTHORIZER" -export CASSANDRA_AUTHENTICATOR="${CASSANDRA_AUTHENTICATOR:-PasswordAuthenticator}" -export DB_AUTHENTICATOR="$CASSANDRA_AUTHENTICATOR" -export CASSANDRA_USER="${CASSANDRA_USER:-cassandra}" -export DB_USER="$CASSANDRA_USER" -export CASSANDRA_PASSWORD="${CASSANDRA_PASSWORD:-}" -export DB_PASSWORD="$CASSANDRA_PASSWORD" -export CASSANDRA_KEYSTORE_PASSWORD="${CASSANDRA_KEYSTORE_PASSWORD:-cassandra}" -export DB_KEYSTORE_PASSWORD="$CASSANDRA_KEYSTORE_PASSWORD" -export CASSANDRA_TRUSTSTORE_PASSWORD="${CASSANDRA_TRUSTSTORE_PASSWORD:-cassandra}" -export DB_TRUSTSTORE_PASSWORD="$CASSANDRA_TRUSTSTORE_PASSWORD" -export CASSANDRA_KEYSTORE_LOCATION="${CASSANDRA_KEYSTORE_LOCATION:-${DB_VOLUME_DIR}/secrets/keystore}" -export DB_KEYSTORE_LOCATION="$CASSANDRA_KEYSTORE_LOCATION" -export CASSANDRA_TRUSTSTORE_LOCATION="${CASSANDRA_TRUSTSTORE_LOCATION:-${DB_VOLUME_DIR}/secrets/truststore}" -export DB_TRUSTSTORE_LOCATION="$CASSANDRA_TRUSTSTORE_LOCATION" -export CASSANDRA_TMP_P12_FILE="${CASSANDRA_TMP_P12_FILE:-${DB_TMP_DIR}/keystore.p12}" -export DB_TMP_P12_FILE="$CASSANDRA_TMP_P12_FILE" -export CASSANDRA_SSL_CERT_FILE="${CASSANDRA_SSL_CERT_FILE:-${DB_VOLUME_DIR}/certs/tls.crt}" -export DB_SSL_CERT_FILE="$CASSANDRA_SSL_CERT_FILE" -export SSL_CERTFILE="$CASSANDRA_SSL_CERT_FILE" -export CASSANDRA_SSL_KEY_FILE="${CASSANDRA_SSL_KEY_FILE:-${DB_VOLUME_DIR}/certs/tls.key}" -export DB_SSL_KEY_FILE="$CASSANDRA_SSL_KEY_FILE" -export SSL_KEYFILE="$CASSANDRA_SSL_KEY_FILE" -export CASSANDRA_SSL_CA_FILE="${CASSANDRA_SSL_CA_FILE:-}" -export DB_SSL_CA_FILE="$CASSANDRA_SSL_CA_FILE" -export SSL_CAFILE="$CASSANDRA_SSL_CA_FILE" -export CASSANDRA_SSL_VALIDATE="${CASSANDRA_SSL_VALIDATE:-false}" -export DB_SSL_VALIDATE="$CASSANDRA_SSL_VALIDATE" -export SSL_VALIDATE="$CASSANDRA_SSL_VALIDATE" - -# cqlsh settings -export SSL_VERSION="${SSL_VERSION:-TLSv1_2}" - -# Configuration paths -export CASSANDRA_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_CONF_DIR="$CASSANDRA_CONF_DIR" -export CASSANDRA_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_DEFAULT_CONF_DIR="$CASSANDRA_DEFAULT_CONF_DIR" -export CASSANDRA_CONF_FILE="${DB_CONF_DIR}/cassandra.yaml" -export DB_CONF_FILE="$CASSANDRA_CONF_FILE" -export CASSANDRA_RACKDC_FILE="${DB_CONF_DIR}/cassandra-rackdc.properties" -export DB_RACKDC_FILE="$CASSANDRA_RACKDC_FILE" -export CASSANDRA_LOGBACK_FILE="${DB_CONF_DIR}/logback.xml" -export DB_LOGBACK_FILE="$CASSANDRA_LOGBACK_FILE" -export CASSANDRA_COMMITLOG_ARCHIVING_FILE="${DB_CONF_DIR}/commitlog_archiving.properties" -export DB_COMMITLOG_ARCHIVING_FILE="$CASSANDRA_COMMITLOG_ARCHIVING_FILE" -export CASSANDRA_ENV_FILE="${DB_CONF_DIR}/cassandra-env.sh" -export DB_ENV_FILE="$CASSANDRA_ENV_FILE" -export CASSANDRA_MOUNTED_CONF_PATH="cassandra.yaml" -export DB_MOUNTED_CONF_PATH="$CASSANDRA_MOUNTED_CONF_PATH" -export CASSANDRA_MOUNTED_RACKDC_PATH="cassandra-rackdc.properties" -export DB_MOUNTED_RACKDC_PATH="$CASSANDRA_MOUNTED_RACKDC_PATH" -export CASSANDRA_MOUNTED_ENV_PATH="cassandra-env.sh" -export DB_MOUNTED_ENV_PATH="$CASSANDRA_MOUNTED_ENV_PATH" -export CASSANDRA_MOUNTED_LOGBACK_PATH="logback.xml" -export DB_MOUNTED_LOGBACK_PATH="$CASSANDRA_MOUNTED_LOGBACK_PATH" - -# Java settings -export JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS:-}" - -# Custom environment variables may be defined below diff --git a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/entrypoint.sh b/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/entrypoint.sh deleted file mode 100755 index da37e4e4dd153..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/entrypoint.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -#set -o xtrace - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libcassandra.sh - -# Load Cassandra environment variables -. /opt/bitnami/scripts/cassandra-env.sh - -print_welcome_page - -if is_positive_int "$DB_DELAY_START_TIME" && [[ "$DB_DELAY_START_TIME" -gt 0 ]]; then - info "** Delaying Cassandra start by ${DB_DELAY_START_TIME} seconds **" - sleep "$DB_DELAY_START_TIME" -fi - -if [[ "$*" = *"/opt/bitnami/scripts/cassandra/run.sh"* || "$*" = *"/run.sh"* ]]; then - info "** Starting Cassandra setup **" - /opt/bitnami/scripts/cassandra/setup.sh - info "** Cassandra setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/postunpack.sh b/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/postunpack.sh deleted file mode 100755 index 3acce795b328e..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/postunpack.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libcassandra.sh - -# Load Cassandra environment variables -. /opt/bitnami/scripts/cassandra-env.sh - -# Starting with version 5.0.2, we found that the Cassandra official configuration -# was in a file called cassandra_latest.yaml. We copy that file to ensure that it is using -# the latest settings -if [[ -f "${DB_DEFAULT_CONF_DIR}/cassandra_latest.yaml" ]]; then - cp "${DB_DEFAULT_CONF_DIR}/cassandra_latest.yaml" "${DB_DEFAULT_CONF_DIR}/cassandra.yaml" -fi - -for dir in "$DB_INITSCRIPTS_DIR" "$DB_TMP_DIR" "$DB_LOG_DIR" "$DB_MOUNTED_CONF_DIR" "$DB_VOLUME_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# Copy configuration files for the scripts to work -ensure_dir_exists "$DB_CONF_DIR" -cassandra_copy_default_config -chmod -R g+rwX "$DB_CONF_DIR" - -# Create wrapper for cqlsh -cat <"${DB_BIN_DIR}/cqlsh" -#!/bin/sh -exec "${PYTHON_BIN_DIR}/python" "${DB_BIN_DIR}/cqlsh.py" "\$@" -EOF - -chmod +x "${DB_BIN_DIR}/cqlsh" - -ensure_dir_exists "${HOME}/.cassandra" -chmod -R g+rwX "${HOME}/.cassandra" diff --git a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/run.sh b/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/run.sh deleted file mode 100755 index b3f222c3661c5..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/run.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libcassandra.sh -. /opt/bitnami/scripts/libos.sh - -# Load Cassandra environment variables -. /opt/bitnami/scripts/cassandra-env.sh - -# As we cannot use "local" we will use "readonly" for read-only variables. -# The scope of "readonly" is global, so we attach "__run_" to avoid conflicts -# with other variables in libcassandra.sh - -info "** Starting Cassandra **" - -# During the startup logic, we bootstap Cassandra. This is because Cassandra seeder nodes -# need to be able to connect to each other, and after that authentication can be configured. -# However, some applications may detect at this point that the database is ready. -# While in other bitnami containers we would stop the database and run it in foreground, -# we prefer keeping it running in this case. -# So, in this run.sh script, we first check if Cassandra was already running in -# one of the two cases: -# -# 1) Initial cluster initialization -# 2) Init scripts -# -# If none of the two cases apply, we assume it is an error and exit -if is_cassandra_running; then - __run_pid="$(get_pid_from_file "$DB_PID_FILE")" - running_log_file="" - - if [[ -f "$DB_FIRST_BOOT_LOG_FILE" ]]; then - running_log_file="$DB_FIRST_BOOT_LOG_FILE" - info "Cassandra already running with PID $__run_pid because of the initial cluster setup" - elif [[ -f "$DB_INITSCRIPTS_BOOT_LOG_FILE" ]]; then - running_log_file="$DB_INITSCRIPTS_BOOT_LOG_FILE" - info "Cassandra already running PID $__run_pid because of the init scripts execution" - else - error "Cassandra is already running for an unexpected reason. Exiting" - exit 1 - fi - - info "Tailing $running_log_file" - __run_tail_cmd="$(which tail)" - readonly __run_tail_flags=("--pid=${__run_pid}" "-n" "1000" "-f" "$running_log_file") - - if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "${__run_tail_cmd}" "${__run_tail_flags[@]}" - else - exec "${__run_tail_cmd}" "${__run_tail_flags[@]}" - fi -else - readonly __run_cmd="${DB_BIN_DIR}/cassandra" - readonly __run_flags=("-p $DB_PID_FILE" "-R" "-f") - if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "${__run_cmd}" "${__run_flags[@]}" - else - exec "${__run_cmd}" "${__run_flags[@]}" - fi -fi diff --git a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/setup.sh b/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/setup.sh deleted file mode 100755 index 24096cc6cda4e..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/cassandra/setup.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Cassandra setup - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libcassandra.sh - -# Load Cassandra environment variables -. /opt/bitnami/scripts/cassandra-env.sh - -# Set default Cassandra host environment variable -cassandra_set_default_host -# Ensure Cassandra environment variables settings are valid -cassandra_validate -cassandra_validate_tls -# Ensure 'daemon' user exists when running as 'root' -am_i_root && ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" -# Ensure Cassandra is initialized -cassandra_initialize - -# Allow running custom initialization scripts -if ! is_boolean_yes "$DB_IGNORE_INITDB_SCRIPTS"; then - cassandra_custom_init_scripts -fi diff --git a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 38802fc0bfe91..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -if [[ "$OS_FLAVOUR" =~ photon && "$APP_VERSION" =~ ^1.8 ]]; then - # Option --module-path is not supported by JAVA 1.8 since modules were added in version 1.9 - unset JAVA_TOOL_OPTIONS -fi - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/libcassandra.sh b/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/libcassandra.sh deleted file mode 100644 index 48d3d50450641..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/rootfs/opt/bitnami/scripts/libcassandra.sh +++ /dev/null @@ -1,1319 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for Cassandra - -cassandra_validate_tls() { - info "Validating TLS settings in DB_* env vars.." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - check_empty_value() { - if is_empty_value "${!1}"; then - print_validation_error "The $1 environment variable is empty or not set." - fi - } - - check_default_password() { - if [[ "${!1}" = "cassandra" ]]; then - warn "You set the environment variable $1=cassandra. This is the default value when bootstrapping Cassandra and should not be used in production environments." - fi - } - if is_boolean_yes "$DB_CLIENT_ENCRYPTION" || is_boolean_yes "$DB_INTERNODE_ENCRYPTION"; then - check_empty_value DB_KEYSTORE_PASSWORD - check_empty_value DB_TRUSTSTORE_PASSWORD - check_default_password DB_KEYSTORE_PASSWORD - check_default_password DB_TRUSTSTORE_PASSWORD - fi - - [[ "$error_code" -eq 0 ]] || exit "$error_code" - -} - -######################## -# Configure port binding (modifies cassandra.yaml and cassandra-env.sh if not mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_ports() { - cassandra_setup_common_ports -} - -######################## -# Generate the client configurartion if ssl is configured in the server -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_client_ssl() { - info "Configuring client for SSL" - - # The key is store in a jks keystore and needs to be converted to pks12 to be extracted - keytool -importkeystore -srckeystore "${DB_KEYSTORE_LOCATION}" \ - -destkeystore "${DB_TMP_P12_FILE}" \ - -deststoretype PKCS12 \ - -srcstorepass "${DB_KEYSTORE_PASSWORD}" \ - -deststorepass "${DB_KEYSTORE_PASSWORD}" - - mkdir -p "$(dirname "${DB_SSL_CERT_FILE}")" - - openssl pkcs12 -in "${DB_TMP_P12_FILE}" -nokeys \ - -out "${DB_SSL_CERT_FILE}" -passin pass:"${DB_KEYSTORE_PASSWORD}" - rm "${DB_TMP_P12_FILE}" -} - -######################## -# Enable client encryption in configuration -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_enable_client_encryption() { - local cassandra_config - cassandra_config="$(sed -E "/client_encryption_options:.*/ {N;N; s/client_encryption_options:[^\n]*(\n\s+#.*)?(\n\s+enabled:).*/client_encryption_options:\1\2 $DB_CLIENT_ENCRYPTION/g}" "$DB_CONF_FILE")" - echo "$cassandra_config" >"$DB_CONF_FILE" -} - -######################## -# Configure TLS certificates in configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_configure_certificates() { - cassandra_yaml_set "keystore" "$DB_KEYSTORE_LOCATION" - cassandra_yaml_set "keystore_password" "$DB_KEYSTORE_PASSWORD" - cassandra_yaml_set "truststore" "$DB_TRUSTSTORE_LOCATION" - cassandra_yaml_set "truststore_password" "$DB_TRUSTSTORE_PASSWORD" -} - -######################## -# Configure Cassandra configuration files from environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_from_environment_variables() { - # Map environment variables to config properties for cassandra-env.sh - for var in "${!CASSANDRA_CFG_ENV_@}"; do - # shellcheck disable=SC2001 - key="$(echo "$var" | sed -e 's/^CASSANDRA_CFG_ENV_//g')" - value="${!var}" - cassandra_env_conf_set "$key" "$value" - done - # Map environment variables to config properties for cassandra-rackdc.properties - for var in "${!CASSANDRA_CFG_RACKDC_@}"; do - key="$(echo "$var" | sed -e 's/^CASSANDRA_CFG_RACKDC_//g' | tr '[:upper:]' '[:lower:]')" - value="${!var}" - cassandra_rackdc_conf_set "$key" "$value" - done - # Map environment variables to config properties for commitlog_archiving.properties - for var in "${!CASSANDRA_CFG_COMMITLOG_@}"; do - key="$(echo "$var" | sed -e 's/^CASSANDRA_CFG_COMMITLOG_//g' | tr '[:upper:]' '[:lower:]')" - value="${!var}" - cassandra_commitlog_conf_set "$key" "$value" - done - if ! cassandra_is_file_external "$DB_MOUNTED_CONF_PATH"; then - # Map environment variables to config properties for configuration file - for var in "${!CASSANDRA_CFG_YAML_@}"; do - # shellcheck disable=SC2001 - key="$(echo "$var" | sed -e 's/^CASSANDRA_CFG_YAML_//g' | tr '[:upper:]' '[:lower:]')" - value="${!var}" - cassandra_yaml_set "$key" "$value" - done - else - debug "$DB_MOUNTED_CONF_PATH mounted. Skipping data directory configuration" - fi -} - -######################## -# Start Cassandra and wait until it is ready -# Globals: -# DB_* -# Arguments: -# $1 - Log file to write (default /dev/stdout) -# $2 - Maximum number of retries (default $DB_INIT_MAX_RETRIES) -# $3 - Sleep time during retries (default $DB_INIT_SLEEP_TIME) -# Returns: -# None -######################### -cassandra_start_bg() { - local -r logger="${1:-/dev/stdout}" - local -r retries="${2:-$DB_INIT_MAX_RETRIES}" - local -r sleep_time="${3:-$DB_INIT_SLEEP_TIME}" - - info "Starting $DB_FLAVOR" - local -r cmd=("$DB_BIN_DIR/cassandra") - local -r args=("-p" "$DB_PID_FILE" "-R" "-f") - - if am_i_root; then - run_as_user "$DB_DAEMON_USER" "${cmd[@]}" "${args[@]}" >"$logger" 2>&1 & - else - "${cmd[@]}" "${args[@]}" >"$logger" 2>&1 & - fi - - # Even though we set the pid, cassandra is not creating the proper file, so we create it manually - echo $! >"$DB_PID_FILE" - - info "Checking that it started up correctly" - - if [[ "$logger" != "/dev/stdout" ]]; then - am_i_root && chown "$DB_DAEMON_USER":"$DB_DAEMON_GROUP" "$logger" - wait_for_cql_log_entry "$logger" "$retries" "$sleep_time" - fi - wait_for_nodetool_up "$retries" "$sleep_time" -} - -######################## -# Stop Cassandra -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_stop() { - ! is_cassandra_running && return - info "Stopping Cassandra..." - stop_cassandra() { - # Using legacy RMI URL parsing to avoid URISyntaxException: 'Malformed IPv6 address at index 7: rmi://[127.0.0.1]:7199' error - # https://community.datastax.com/questions/13764/java-version-for-cassandra-3113.html - nodetool "-Dcom.sun.jndi.rmiURLParsing=legacy" stopdaemon - is_cassandra_not_running - } - - if ! retry_while "stop_cassandra" "$DB_INIT_MAX_RETRIES" "$DB_INIT_SLEEP_TIME"; then - error "Cassandra failed to stop" - exit 1 - fi - # Manually remove PID file - rm -f "$DB_PID_FILE" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for Cassandra common - -# shellcheck disable=SC1090,SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh - -######################## -# Returns cassandra major version -# Globals: -# CASSANDRA_BASE_DIR -# Arguments: -# None -# Returns: -# None -######################### -cassandra_get_major_version() { - cassandra_version="$("${CASSANDRA_BASE_DIR}/bin/cassandra" -v)" - major_version="$(get_sematic_version "$cassandra_version" 1)" - echo "${major_version:-0}" -} - -######################## -# Change a Cassandra configuration yaml file by setting a property -# Globals: -# DB_* -# Arguments: -# $1 - property -# $2 - value -# $3 - Use quotes in value (default: yes) -# $4 - Path to configuration file (default: $DB_CONF_FILE) -# Returns: -# None -######################### -cassandra_yaml_set() { - local -r property="${1:?missing property}" - local -r value="${2:?missing value}" - local -r use_quotes="${3:-yes}" - local -r conf_file="${4:-$DB_CONF_FILE}" - - if is_boolean_yes "$use_quotes"; then - replace_in_file "$conf_file" "^(\s*)(#\s*)?(\s*)(\-\s*)?${property}:.*" "\1\3\4${property}: '${value}'" - else - replace_in_file "$conf_file" "^(\s*)(#\s*)?(\s*)(\-\s*)?${property}:.*" "\1\3\4${property}: ${value}" - fi -} - -######################### -# Set default Cassandra settings if not set -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_set_default_host() { - if [[ -z "${DB_HOST:-}" ]]; then - warn "DB_HOST not set, defaulting to system hostname" - local -r host="$(hostname)" - export DB_HOST="$host" - export DB_SEEDS="${DB_SEEDS:-$DB_HOST}" - export DB_PEERS="${DB_PEERS:-$DB_SEEDS}" - fi -} - -######################## -# Change a Cassandra configuration yaml file by setting a property as an array -# Globals: -# DB_* -# Arguments: -# $1 - property -# $2 - comma-separated string with the different values -# $3 - Use quotes in value (default: no) -# $4 - Path to configuration file (default: $DB_CONF_FILE) -# Returns: -# None -######################### -cassandra_yaml_set_as_array() { - local -r property="${1:?missing property}" - local -r array="${2:?missing value}" - local -r use_quotes="${3:-no}" - local -r conf_file="${4:-$DB_CONF_FILE}" - local substitution="\2${property}:" - - for value in "${array[@]}"; do - if is_boolean_yes "$use_quotes"; then - substitution+="\n\2 - '${value}'" - else - substitution+="\n\2 - ${value}" - fi - done - replace_in_file "$conf_file" "^(#\s)?(\s*)${property}:.*" "${substitution}" -} - -######################## -# Validate settings in DB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_validate() { - info "Validating settings in DB_* env vars.." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - - empty_password_warn() { - warn "You've not provided a password. Default password \"cassandra\" will be used. For safety reasons, please provide a secure password in a production environment." - } - - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - - check_default_password() { - if [[ "${!1}" = "cassandra" ]]; then - warn "You set the environment variable $1=cassandra. This is the default value when bootstrapping $DB_FLAVOR and should not be used in production environments." - fi - } - - check_yes_no_value() { - if ! is_yes_no_value "${!1}"; then - print_validation_error "The allowed values for $1 are [yes, no]" - fi - } - - check_true_false_value() { - if ! is_true_false_value "${!1}"; then - print_validation_error "The allowed values for $1 are [true, false]" - fi - } - - check_conflicting_ports() { - local -r total="$#" - for i in $(seq 1 "$((total - 1))"); do - for j in $(seq "$((i + 1))" "$total"); do - if (("${!i}" == "${!j}")); then - print_validation_error "${!i} and ${!j} are bound to the same port" - fi - done - done - } - - check_allowed_port() { - local validate_port_args=() - ! am_i_root && validate_port_args+=("-unprivileged") - validate_port_args+=("${!1}") - if ! err=$(validate_port "${validate_port_args[@]}"); then - print_validation_error "An invalid port was specified in the environment variable $1: $err" - fi - } - - check_resolved_hostname() { - if ! is_hostname_resolved "$1"; then - warn "Hostname $1 could not be resolved. This could lead to connection issues" - fi - } - - check_positive_value() { - if ! is_positive_int "${!1}"; then - print_validation_error "The variable $1 must be positive integer" - fi - } - - check_empty_value() { - if is_empty_value "${!1}"; then - print_validation_error "The $1 environment variable is empty or not set." - fi - } - - check_password_file() { - if [[ -n "${!1:-}" ]] && ! [[ -f "${!1:-}" ]]; then - print_validation_error "The variable $1 is defined but the file ${!1} is not accessible or does not exist" - fi - } - - check_password_file DB_PASSWORD_FILE - check_password_file DB_TRUSTSTORE_PASSWORD_FILE - check_password_file DB_KEYSTORE_PASSWORD_FILE - - check_empty_value DB_RACK - check_empty_value DB_DATACENTER - - if [[ -z $DB_PASSWORD ]]; then - if ! is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_warn - export DB_PASSWORD="cassandra" - else - empty_password_enabled_warn - fi - fi - - check_default_password DB_PASSWORD - check_yes_no_value DB_PASSWORD_SEEDER - check_true_false_value DB_ENABLE_REMOTE_CONNECTIONS - check_true_false_value DB_CLIENT_ENCRYPTION - check_true_false_value DB_ENABLE_USER_DEFINED_FUNCTIONS - check_true_false_value DB_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS - check_positive_value DB_NUM_TOKENS - check_positive_value DB_INIT_MAX_RETRIES - check_positive_value DB_CQL_MAX_RETRIES - check_positive_value DB_PEER_CQL_MAX_RETRIES - check_positive_value DB_INIT_SLEEP_TIME - check_positive_value DB_CQL_SLEEP_TIME - check_positive_value DB_PEER_CQL_SLEEP_TIME - check_positive_value DB_CQL_PORT_NUMBER - check_positive_value DB_JMX_PORT_NUMBER - check_positive_value DB_TRANSPORT_PORT_NUMBER - - check_conflicting_ports DB_CQL_PORT_NUMBER DB_JMX_PORT_NUMBER DB_TRANSPORT_PORT_NUMBER - - check_allowed_port DB_CQL_PORT_NUMBER - check_allowed_port DB_TRANSPORT_PORT_NUMBER - check_allowed_port DB_JMX_PORT_NUMBER - - check_resolved_hostname "$DB_HOST" - for peer in ${DB_PEERS//,/ }; do - check_resolved_hostname "$peer" - done - for seed in ${DB_SEEDS//,/ }; do - check_resolved_hostname "$seed" - done - - if [[ ! ${DB_AUTO_SNAPSHOT_TTL} =~ ([1-9]{1}[0-9]{0,}[d|h|m]) ]]; then - print_validation_error "DB_AUTO_SNAPSHOT_TTL accepted units: d (days), h (hours) or m (minutes)" - fi - - check_true_false_value DB_SSL_VALIDATE - check_true_false_value DB_AUTOMATIC_SSTABLE_UPGRADE - - if ((${#DB_PASSWORD} > 512)); then - print_validation_error "The password cannot be longer than 512 characters. Set the environment variable DB_PASSWORD with a shorter value" - fi - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Check if a given configuration file was mounted externally -# Globals: -# DB_* -# Arguments: -# $1 - Filename -# Returns: -# true if the file was mounted externally, false otherwise -######################### -cassandra_is_file_external() { - local -r filename="${1:?file_is_missing}" - if [[ -f "${DB_MOUNTED_CONF_DIR}/${filename}" ]]; then - true - else - false - fi -} - -######################## -# Copy mounted configuration files -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_copy_mounted_config() { - if ! is_dir_empty "$DB_MOUNTED_CONF_DIR"; then - cp -Lr "$DB_MOUNTED_CONF_DIR"/* "$DB_CONF_DIR" - fi -} - -######################## -# Copy default configuration files in case there are no mounted ones -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_copy_default_config() { - local -r tmp_file_list=/tmp/conf_file_list - find "$DB_DEFAULT_CONF_DIR" -type f >$tmp_file_list - while read -r f; do - filename="${f#"${DB_DEFAULT_CONF_DIR}/"}" # Get path with subfolder - dest="${f//$DB_DEFAULT_CONF_DIR/$DB_CONF_DIR}" - if [[ -f "$dest" ]]; then - debug "Found ${filename}. Skipping default" - else - debug "No injected ${filename} file found. Creating default ${filename} file" - # There are conf files in subfolders. We may need to create them - mkdir -p "$(dirname "$dest")" - cp "$f" "$dest" - fi - done <$tmp_file_list - rm "$tmp_file_list" -} - -######################## -# Configure the path to the different data directories (ignored if cassandra.yaml is mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_data_dirs() { - if ! cassandra_is_file_external "${DB_MOUNTED_CONF_PATH}"; then - cassandra_yaml_set_as_array data_file_directories "${DB_DATA_DIR}/data" "$DB_CONF_FILE" - - cassandra_yaml_set commitlog_directory "$DB_COMMITLOG_DIR" - cassandra_yaml_set hints_directory "${DB_DATA_DIR}/hints" - cassandra_yaml_set cdc_raw_directory "${DB_DATA_DIR}/cdc_raw" - cassandra_yaml_set saved_caches_directory "${DB_DATA_DIR}/saved_caches" - else - debug "${DB_MOUNTED_CONF_PATH} mounted. Skipping data directory configuration" - fi -} - -######################## -# Enable password-based authentication (ignored if cassandra.yaml is mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_enable_auth() { - if ! cassandra_is_file_external "${DB_MOUNTED_CONF_PATH}"; then - if [[ "$ALLOW_EMPTY_PASSWORD" = "yes" ]] && [[ -z $DB_PASSWORD ]]; then - if [[ "$DB_FLAVOR" = "scylladb" ]] || [ "$(cassandra_get_major_version)" -lt 5 ]; then - cassandra_yaml_set "authenticator" "AllowAllAuthenticator" - fi - cassandra_yaml_set "authorizer" "AllowAllAuthorizer" - else - if [[ "$DB_FLAVOR" = "cassandra" ]] && [ "$(cassandra_get_major_version)" -ge 5 ]; then - replace_in_file "${DB_CONF_FILE}" "class_name.* AllowAllAuthenticator" "class_name: ${DB_AUTHENTICATOR}" - replace_in_file "${DB_CONF_FILE}" "class_name.* AllowAllAuthorizer" "class_name: ${DB_AUTHORIZER}" - else - cassandra_yaml_set "authenticator" "${DB_AUTHENTICATOR}" - cassandra_yaml_set "authorizer" "${DB_AUTHORIZER}" - fi - fi - else - debug "${DB_MOUNTED_CONF_PATH} mounted. Skipping authentication method configuration" - fi -} - -######################## -# Configure logging settings (ignored if logback.xml is mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_logging() { - if ! cassandra_is_file_external "${DB_MOUNTED_LOGBACK_PATH}"; then - replace_in_file "${DB_LOGBACK_FILE}" "system[.]log" "${DB_FLAVOR}.log" - if [[ "$BITNAMI_DEBUG" = "false" ]]; then - replace_in_file "${DB_LOGBACK_FILE}" "()" "" - fi - else - debug "${DB_MOUNTED_LOGBACK_PATH} mounted. Skipping logging configuration" - fi -} - -######################## -# Configure cluster settings (modifies cassandra.yaml and cassandra-env.sh if not mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_cluster() { - local host="127.0.0.1" - local rpc_address="127.0.0.1" - - if [[ "$DB_ENABLE_REMOTE_CONNECTIONS" = "true" ]]; then - host="$DB_HOST" - rpc_address="0.0.0.0" - fi - # cassandra.yaml changes - if ! cassandra_is_file_external "${DB_MOUNTED_CONF_PATH}"; then - cassandra_yaml_set "num_tokens" "$DB_NUM_TOKENS" "no" - cassandra_yaml_set "cluster_name" "$DB_CLUSTER_NAME" - cassandra_yaml_set "listen_address" "$host" - cassandra_yaml_set "seeds" "$DB_SEEDS" - cassandra_yaml_set "start_rpc" "$DB_ENABLE_RPC" "no" - if [[ "$DB_FLAVOR" = "scylladb" ]]; then - # Ref: https://opensource.docs.scylladb.com/stable/cql/functions.html - cassandra_yaml_set "enable_user_defined_functions" "$DB_ENABLE_USER_DEFINED_FUNCTIONS" "no" - else - # Ref: https://cassandra.apache.org/doc/stable/cassandra/configuration/cass_yaml_file.html#user_defined_functions_enabled - cassandra_yaml_set "user_defined_functions_enabled" "$DB_ENABLE_USER_DEFINED_FUNCTIONS" "no" - cassandra_yaml_set "scripted_user_defined_functions_enabled" "$DB_ENABLE_SCRIPTED_USER_DEFINED_FUNCTIONS" "no" - fi - cassandra_yaml_set "rpc_address" "$rpc_address" - cassandra_yaml_set "broadcast_rpc_address" "$host" - cassandra_yaml_set "endpoint_snitch" "$DB_ENDPOINT_SNITCH" - cassandra_yaml_set "internode_encryption" "$DB_INTERNODE_ENCRYPTION" - cassandra_configure_certificates - cassandra_yaml_set "auto_snapshot_ttl" "$DB_AUTO_SNAPSHOT_TTL" - - if [[ -n "$DB_BROADCAST_ADDRESS" ]]; then - cassandra_yaml_set "broadcast_address" "$DB_BROADCAST_ADDRESS" - fi - - if [[ -n "$DB_AUTOMATIC_SSTABLE_UPGRADE" ]]; then - cassandra_yaml_set "automatic_sstable_upgrade" "$DB_AUTOMATIC_SSTABLE_UPGRADE" - fi - - cassandra_enable_client_encryption - else - debug "${DB_MOUNTED_CONF_PATH} mounted. Skipping cluster configuration" - fi - - # cassandra-env.sh changes - if ! cassandra_is_file_external "${DB_MOUNTED_ENV_PATH}"; then - replace_in_file "${DB_ENV_FILE}" "#\s*JVM_OPTS=\"\$JVM_OPTS -Djava[.]rmi[.]server[.]hostname=[^\"]*" "JVM_OPTS=\"\$JVM_OPTS -Djava.rmi.server.hostname=${host}" - else - debug "${DB_MOUNTED_ENV_PATH} mounted. Skipping setting server hostname" - fi -} - -######################## -# Configure java path (ignored if cassandra-env.sh is mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_java() { - if ! cassandra_is_file_external "${DB_MOUNTED_ENV_PATH}"; then - replace_in_file "${DB_ENV_FILE}" "(calculate_heap_sizes\(\))" "\nJAVA_HOME=$JAVA_BASE_DIR\nJAVA=$JAVA_BIN_DIR/java\n\n\1" - else - debug "${DB_MOUNTED_ENV_PATH} mounted. Skipping JAVA_HOME configuration" - fi -} - -######################## -# Configure jemalloc path (ignored if cassandra-env.sh is mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_jemalloc() { - if ! cassandra_is_file_external "${DB_MOUNTED_ENV_PATH}"; then - if [[ -n "$(find_jemalloc_lib)" ]]; then - echo "JVM_OPTS=\"\$JVM_OPTS -Dcassandra.libjemalloc=$(find_jemalloc_lib)\"" >>"${DB_CONF_DIR}/cassandra-env.sh" - else - warn "Couldn't find jemalloc installed. Skipping jemalloc configuration." - fi - else - debug "${DB_MOUNTED_ENV_PATH} mounted. Skipping jemalloc configuration." - fi -} - -######################## -# Change the password for the cassandra user -# Globals: -# DB_* -# Arguments: -# 1 - Old password (default: cassandra) -# 2 - New Password (default: $DB_PASSWORD) -# 3 - Maximum number of retries (default: $DB_CQL_MAX_RETRIES) -# 4 - Sleep time between retries (default: $DB_CQL_SLEEP_TIME) -# Returns: -# None -######################### -cassandra_change_cassandra_password() { - local -r old_password="${1:-cassandra}" - local -r new_password="${2:-$DB_PASSWORD}" - local -r retries="${3:-$DB_CQL_MAX_RETRIES}" - local -r sleep_time="${4:-$DB_CQL_SLEEP_TIME}" - - info 'Updating the password for the "cassandra" user...' - local -r user="cassandra" - local -r escaped_password="${new_password//\'/\'\'}" - - if (echo "ALTER USER cassandra WITH PASSWORD \$\$${escaped_password}\$\$;" | cassandra_execute_with_retries "$retries" "$sleep_time" "$user" "$old_password"); then - debug "ALTER USER command executed. Trying to log in" - wait_for_cql_access "$user" "$new_password" "" "$retries" "$sleep_time" - info "Password updated successfully" - fi -} - -######################## -# Create a new admin user -# Globals: -# DB_* -# Arguments: -# 1 - New username (default: $DB_USER) -# 2 - New user password (default: $DB_PASSWORD) -# 3 - Admin username (which will create the new user) (default: cassandra) -# 4 - Admin password (default: cassandra) -# 5 - Maximum number of retries (default: $DB_CQL_MAX_RETRIES) -# 6 - Sleep time between retries (default: $DB_CQL_SLEEP_TIME) -# Returns: -# None -######################### -cassandra_create_admin_user() { - local -r new_user="${1:-$DB_USER}" - local -r password="${2:-$DB_PASSWORD}" - local -r admin_user="${3:-cassandra}" - local -r admin_user_password="${4:-cassandra}" - local -r retries="${5:-$DB_CQL_MAX_RETRIES}" - local -r sleep_time="${6:-$DB_CQL_SLEEP_TIME}" - - info "Creating super-user $new_user" - local -r escaped_password="${password//\'/\'\'}" - - echo "CREATE USER '${new_user}' WITH PASSWORD \$\$${escaped_password}\$\$ SUPERUSER;" | cassandra_execute_with_retries "$retries" "$sleep_time" "$admin_user" "$admin_user_password" -} - -######################## -# Configure common port binding (modifies cassandra.yaml and cassandra-env.sh if not mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_common_ports() { - if ! cassandra_is_file_external "${DB_MOUNTED_CONF_PATH}"; then - cassandra_yaml_set "native_transport_port" "$DB_CQL_PORT_NUMBER" "no" - cassandra_yaml_set "storage_port" "$DB_TRANSPORT_PORT_NUMBER" "no" - else - debug "${DB_MOUNTED_CONF_PATH} mounted. Skipping native and storage ports configuration" - fi - - if ! cassandra_is_file_external "${DB_MOUNTED_ENV_PATH}"; then - replace_in_file "${DB_ENV_FILE}" "JMX_PORT=.*" "JMX_PORT=$DB_JMX_PORT_NUMBER" - else - debug "${DB_MOUNTED_ENV_PATH} mounted. Skipping JMX port configuration" - fi -} - -######################## -# Configure rack and datacenter (ignored if cassandra-rackdc.properties is mounted) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_setup_rack_dc() { - if ! cassandra_is_file_external "${DB_MOUNTED_RACKDC_PATH}"; then - replace_in_file "${DB_RACKDC_FILE}" "^[#\s]*dc=.*" "dc=${DB_DATACENTER}" - replace_in_file "${DB_RACKDC_FILE}" "^[#\s]*rack=.*" "rack=${DB_RACK}" - else - debug "${DB_MOUNTED_RACKDC_PATH} mounted. Skipping rack and datacenter configuration" - fi -} - -######################## -# Remove PIDs, log files and conf files from a previous run (case of container restart) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_clean_from_restart() { - rm -f "$DB_PID_FILE" - rm -f "$DB_FIRST_BOOT_LOG_FILE" "$DB_INITSCRIPTS_BOOT_LOG_FILE" - if ! is_dir_empty "$DB_CONF_DIR"; then - rm -rf "${DB_CONF_DIR:?}"/* - fi -} - -######################## -# Ensure Cassandra is initialized -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_initialize() { - info "Initializing $DB_FLAVOR database..." - - cassandra_clean_from_restart - cassandra_copy_mounted_config - cassandra_copy_default_config - cassandra_enable_auth - cassandra_setup_java - cassandra_setup_jemalloc - cassandra_setup_logging - cassandra_setup_ports - cassandra_setup_rack_dc - cassandra_setup_data_dirs - cassandra_setup_cluster - cassandra_setup_from_environment_variables # Give priority to users configuration - - is_boolean_yes "$DB_CLIENT_ENCRYPTION" && cassandra_setup_client_ssl - - debug "Ensuring expected directories/files exist..." - for dir in "$DB_DATA_DIR" "$DB_TMP_DIR" "$DB_LOG_DIR"; do - ensure_dir_exists "$dir" - am_i_root && chown -R "$DB_DAEMON_USER:$DB_DAEMON_GROUP" "$dir" - done - - if ! is_dir_empty "$DB_DATA_DIR"; then - info "Deploying $DB_FLAVOR with persisted data" - else - info "Deploying $DB_FLAVOR from scratch" - cassandra_start_bg "$DB_FIRST_BOOT_LOG_FILE" - if is_boolean_yes "$DB_PASSWORD_SEEDER"; then - info "Password seeder node" - # Check that all peers are ready - for peer in ${DB_PEERS//,/ }; do - wait_for_cql_access "cassandra" "cassandra" "$peer" "$DB_PEER_CQL_MAX_RETRIES" "$DB_PEER_CQL_SLEEP_TIME" - done - # Setup user - if [[ "$DB_USER" = "cassandra" ]]; then - cassandra_change_cassandra_password "cassandra" "$DB_PASSWORD" "$DB_CQL_MAX_RETRIES" "$DB_CQL_SLEEP_TIME" - else - cassandra_create_admin_user "$DB_USER" "$DB_PASSWORD" "cassandra" "cassandra" "$DB_CQL_MAX_RETRIES" "$DB_CQL_SLEEP_TIME" - fi - - cassandra_execute_startup_cql - else - info "Non-seeder node. Waiting for synchronization" - wait_for_cql_access "$DB_USER" "$DB_PASSWORD" "" "$DB_PEER_CQL_MAX_RETRIES" "$DB_PEER_CQL_SLEEP_TIME" - fi - fi -} - -######################## -# Execute Cassandra startup cql (defined in DB_STARTUP_CQL) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_execute_startup_cql() { - if [[ -n "$DB_STARTUP_CQL" ]]; then - info "Executing Startup CQL" - if ! (echo "$DB_STARTUP_CQL" | cassandra_execute_with_retries "$DB_CQL_MAX_RETRIES" "$DB_CQL_SLEEP_TIME" "$DB_USER" "$DB_PASSWORD"); then - error "Failed executing startup CQL command" - exit 1 - fi - info "Startup CQL commands executed successfully" - fi -} - -######################## -# Run custom initialization scripts -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -cassandra_custom_init_scripts() { - if [[ -n "$(find "$DB_INITSCRIPTS_DIR/" \( -type f -o -type l \) -regex ".*\.\(sh\|cql\|cql.gz\)" ! -path "*/.*/*")" ]] && [[ ! -f "$DB_VOLUME_DIR/.user_scripts_initialized" ]]; then - info "Loading user's custom files from $DB_INITSCRIPTS_DIR ..." - local -r tmp_file="/tmp/filelist" - if ! is_cassandra_running; then - cassandra_start_bg "$DB_INITSCRIPTS_BOOT_LOG_FILE" - wait_for_cql_access - fi - find "${DB_INITSCRIPTS_DIR}/" \( -type f -o -type l \) -regex ".*\.\(sh\|cql\|cql.gz\)" ! -path "*/.*/*" | sort >"$tmp_file" - while read -r f; do - case "$f" in - *.sh) - if [[ -x "$f" ]]; then - debug "Executing $f" - "$f" - else - debug "Sourcing $f" - . "$f" - fi - ;; - *.cql) - debug "Executing $f" - cassandra_execute "$DB_USER" "$DB_PASSWORD" <"$f" - ;; - *.cql.gz) - debug "Executing $f" - gunzip -c "$f" | cassandra_execute "$DB_USER" "$DB_PASSWORD" - ;; - *) debug "Ignoring $f" ;; - esac - done <$tmp_file - rm -f "$tmp_file" - touch "$DB_VOLUME_DIR"/.user_scripts_initialized - fi -} - -######################## -# Execute an arbitrary query/queries against the running Cassandra service -# Stdin: -# Query/queries to execute -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - User to run queries -# $2 - Password -# $3 - Keyspace -# $4 - Host (default: localhost) -# $5 - Extra flags -# Returns: -# None -####################### -cassandra_execute() { - local -r user="${1:-$DB_USER}" - local -r pass="${2:-$DB_PASSWORD}" - local -r keyspace="${3:-}" - local -r host="${4:-localhost}" - local -r extra_args="${5:-}" - local -r port="${DB_CQL_PORT_NUMBER}" - local -r cmd=("cqlsh") - local args=("-u" "$user" "-p" "$pass") - - is_boolean_yes "$DB_CLIENT_ENCRYPTION" && args+=("--ssl") - [[ -n "$keyspace" ]] && args+=("-k" "$keyspace") - if [[ -n "$extra_args" ]]; then - local extra_args_array=() - read -r -a extra_args_array <<<"$extra_args" - [[ "${#extra_args[@]}" -gt 0 ]] && args+=("${extra_args_array[@]}") - fi - args+=("$host") - args+=("$port") - if [[ "${BITNAMI_DEBUG}" = true ]]; then - local -r command="$(cat)" - debug "Executing CQL \"$command\"" - echo "$command" | "${cmd[@]}" "${args[@]}" - else - "${cmd[@]}" "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Execute an arbitrary query/queries against the running Cassandra service with retries (in case Cassandra is still initializing or performing consistency operations) -# Stdin: -# Query/queries to execute -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - Maximum number of retries (default: $DB_CQL_MAX_RETRIES) -# $2 - Sleep time between retries (default: $DB_CQL_SLEEP_TIME) -# $3 - User to run queries -# $4 - Password -# $5 - Keyspace -# $6 - Host (default: localhost) -# $7 - Extra flags -# Returns: -# None -####################### -cassandra_execute_with_retries() { - local -r retries="${1:-$DB_CQL_MAX_RETRIES}" - local -r sleep_time="${2:-$DB_CQL_SLEEP_TIME}" - local -r user="${3:-$DB_USER}" - local -r pass="${4:-$DB_PASSWORD}" - local -r keyspace="${5:-}" - local -r host="${6:-localhost}" - local -r extra_args="${7:-}" - - local success=no - - # Get command from stdin as we will retry it several times - local -r command="$(cat)" - - for i in $(seq 1 "$retries"); do - if (echo "$command" | cassandra_execute "$user" "$pass" "$keyspace" "$host" "$extra_args"); then - success=yes - break - fi - sleep "$sleep_time" - done - if is_boolean_yes "$success"; then - true - else - error "CQL command failed $retries times" - false - fi -} - -######################## -# Wait until nodetool checks the node is ready -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - Maximum number of retries (default $DB_INIT_MAX_RETRIES) -# $2 - Sleep time during retries (default $DB_INIT_SLEEP_TIME) -# Returns: -# None -######################### -wait_for_nodetool_up() { - local -r retries="${1:-$DB_INIT_MAX_RETRIES}" - local -r sleep_time="${2:-$DB_INIT_SLEEP_TIME}" - - debug "Checking status with nodetool" - - check_function_nodetool_node_ip() { - # Using legacy RMI URL parsing to avoid URISyntaxException: 'Malformed IPv6 address at index 7: rmi://[127.0.0.1]:7199' error - # https://community.datastax.com/questions/13764/java-version-for-cassandra-3113.html - local -r check_cmd=("nodetool" "-Dcom.sun.jndi.rmiURLParsing=legacy") - local -r check_args=("status" "--port" "$DB_JMX_PORT_NUMBER") - local -r machine_ip="$(dns_lookup "${DB_BROADCAST_ADDRESS:-$DB_HOST}" "v4")" - local -r check_regex="UN\s*(${DB_HOST}|${machine_ip}|127.0.0.1)" - - local output="/dev/null" - if [[ "$BITNAMI_DEBUG" = "true" ]]; then - output="/dev/stdout" - fi - - "${check_cmd[@]}" "${check_args[@]}" | grep -E "${check_regex}" >"${output}" - } - - check_function_nodetool_node_count() { - # Using legacy RMI URL parsing to avoid URISyntaxException: 'Malformed IPv6 address at index 7: rmi://[127.0.0.1]:7199' error - # https://community.datastax.com/questions/13764/java-version-for-cassandra-3113.html - local -r check_cmd=("nodetool" "-Dcom.sun.jndi.rmiURLParsing=legacy") - local -r check_args=("status" "--port" "$DB_JMX_PORT_NUMBER") - local -r machine_ip="$(dns_lookup "${DB_BROADCAST_ADDRESS:-$DB_HOST}" "v4")" - local -r check_regex="UN\s*" - read -r -a host_list <<<"$(tr ',;' ' ' <<<"$DB_NODES")" - local -r expected_node_count="${#host_list[@]}" - local actual_node_count - - local output="/dev/null" - if [[ "$BITNAMI_DEBUG" = "true" ]]; then - output="/dev/stdout" - fi - - actual_node_count=$("${check_cmd[@]}" "${check_args[@]}" | grep -c "${check_regex}" || true) - if [[ "$expected_node_count" != "$actual_node_count" ]]; then - false - fi - } - - if retry_while check_function_nodetool_node_ip "$retries" "$sleep_time"; then - info "Nodetool reported the successful startup of $DB_FLAVOR" - true - else - error "$DB_FLAVOR failed to start up" - if [[ "$BITNAMI_DEBUG" = "true" ]]; then - error "Nodetool output" - "${check_cmd[@]}" "${check_args[@]}" - fi - exit 1 - fi - - if [[ -n "$DB_NODES" ]]; then - if retry_while check_function_nodetool_node_count "$retries" "$sleep_time"; then - info "All nodes reached the UN status (Up/Normal)" - true - else - error "Some nodes did not reach the UN status (Up/Normal)" - if [[ "$BITNAMI_DEBUG" = "true" ]]; then - error "Nodetool output" - "${check_cmd[@]}" "${check_args[@]}" - fi - exit 1 - fi - fi -} - -######################## -# Wait until the log file shows that CQL is ready -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - Log file to check -# $1 - Maximum number of retries (default $DB_INIT_MAX_RETRIES) -# $2 - Sleep time during retries (default $DB_INIT_SLEEP_TIME) -# Returns: -# None -######################### -wait_for_cql_log_entry() { - local -r logger="${1:-/dev/stdout}" - local -r retries="${2:-$DB_INIT_MAX_RETRIES}" - local -r sleep_time="${3:-$DB_INIT_SLEEP_TIME}" - - debug "Checking that log $logger contains entry \"Starting listening for CQL clients\"" - - check_function_log_entry() { - local -r check_cmd=("cat") - local -r check_args=("$logger") - local -r check_regex="Starting listening for CQL clients" - - local output="/dev/null" - if [[ "$BITNAMI_DEBUG" = "true" ]]; then - output="/dev/stdout" - fi - "${check_cmd[@]}" "${check_args[@]}" | grep -E "${check_regex}" >"${output}" - } - - if retry_while check_function_log_entry "$retries" "$sleep_time"; then - info "Found CQL startup log line" - else - error "$DB_FLAVOR failed to start up" - error "Log content" - cat "$logger" - exit 1 - fi -} - -######################## -# Poll until the CQL command DESCRIBE KEYSPACES works successfully -# Globals: -# DB_* -# Arguments: -# 1 - Username (default: $DB_USER) -# 2 - Password (default: $DB_PASSWORD) -# 3 - Hostname (default: $DB_HOST) -# 4 - Maximum number of retries (default: $DB_CQL_MAX_RETRIES) -# 5 - Sleep time between retries (default: $DB_CQL_SLEEP_TIME) -# Returns: -# None -######################### -wait_for_cql_access() { - local -r user="${1:-$DB_USER}" - local -r password="${2:-$DB_PASSWORD}" - local -r host="${3:-$DB_HOST}" - local -r max_retries="${4:-$DB_CQL_MAX_RETRIES}" - local -r sleep_time="${5:-$DB_CQL_SLEEP_TIME}" - - info "Trying to access CQL server @ $host" - if (echo "DESCRIBE KEYSPACES" | cassandra_execute_with_retries "$max_retries" "$sleep_time" "$user" "$password" "" "$host"); then - info "Accessed CQL server successfully" - else - error "Could not access CQL server" - exit 1 - fi -} - -######################## -# Check if Cassandra is running -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Boolean -######################### -is_cassandra_running() { - local -r pid="$(get_pid_from_file "$DB_PID_FILE")" - - if [[ -z "$pid" ]]; then - false - else - is_service_running "$pid" - fi -} - -######################## -# Return true if cassandra is not running -# Globals: -# KONG_* -# Arguments: -# None -# Returns: -# None -######################### -is_cassandra_not_running() { - ! is_cassandra_running -} - -######################## -# Set a configuration setting value to a file -# Globals: -# None -# Arguments: -# $1 - file -# $2 - key -# $3 - values (array) -# Returns: -# None -######################### -cassandra_common_conf_set() { - local -r file="${1:?missing file}" - local -r key="${2:?missing key}" - shift 2 - local values=("$@") - - if [[ "${#values[@]}" -eq 0 ]]; then - stderr_print "missing value" - return 1 - elif [[ "${#values[@]}" -ne 1 ]]; then - for i in "${!values[@]}"; do - cassandra_common_conf_set "$file" "${key[$i]}" "${values[$i]}" - done - else - value="${values[0]}" - # Check if the value was set before - if grep -q "^[#\\s]*$key\s*=.*" "$file"; then - # Update the existing key - replace_in_file "$file" "^[#\\s]*${key}\s*=.*" "${key}=${value}" false - else - # Add a new key - printf '\n%s=%s' "$key" "$value" >>"$file" - fi - fi -} - -######################## -# Set a configuration setting value to cassandra-env.sh -# Globals: -# DB_CONF_DIR -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -cassandra_env_conf_set() { - cassandra_common_conf_set "${DB_ENV_FILE}" "$@" -} - -######################## -# Set a configuration setting value to cassandra-rackdc.properties -# Globals: -# DB_CONF_DIR -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -cassandra_rackdc_conf_set() { - cassandra_common_conf_set "$DB_RACKDC_FILE" "$@" -} - -######################## -# Set a configuration setting value to commitlog_archiving.properties -# Globals: -# DB_CONF_DIR -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -cassandra_commitlog_conf_set() { - cassandra_common_conf_set "${DB_COMMITLOG_ARCHIVING_FILE}" "$@" -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=("/usr/lib" "/usr/lib64") - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} diff --git a/bitnami/cassandra/4.1/debian-12/tags-info.yaml b/bitnami/cassandra/4.1/debian-12/tags-info.yaml deleted file mode 100644 index cb3f1b40bae65..0000000000000 --- a/bitnami/cassandra/4.1/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "4.1" -- 4.1-debian-12 -- 4.1.7 diff --git a/bitnami/clickhouse/24.3/README.md b/bitnami/clickhouse/24.3/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/clickhouse/24.3/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/clickhouse/24.3/debian-12/Dockerfile b/bitnami/clickhouse/24.3/debian-12/Dockerfile deleted file mode 100644 index b66777acd5736..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/Dockerfile +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-19T11:16:49Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/clickhouse/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="24.3.14-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/clickhouse" \ - org.opencontainers.image.title="clickhouse" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="24.3.14" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps xmlstarlet -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "clickhouse-24.3.14-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/clickhouse/postunpack.sh -ENV APP_VERSION="24.3.14" \ - BITNAMI_APP_NAME="clickhouse" \ - PATH="/opt/bitnami/clickhouse/bin:/opt/bitnami/common/bin:$PATH" \ - clickhouseCTL_API="3" - -EXPOSE 8123 9000 9004 9005 9009 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/clickhouse/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/clickhouse/run.sh", "--", "--listen_host=0.0.0.0" ] diff --git a/bitnami/clickhouse/24.3/debian-12/docker-compose.yml b/bitnami/clickhouse/24.3/debian-12/docker-compose.yml deleted file mode 100644 index 7ffda50d09490..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/docker-compose.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - clickhouse: - image: docker.io/bitnami/clickhouse:24.3 - environment: - - ALLOW_EMPTY_PASSWORD=yes - ports: - - '8123:8123' - volumes: - - clickhouse_data:/bitnami/clickhouse -volumes: - clickhouse_data: - driver: local diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index feb1d709fdb43..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "clickhouse": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "24.3.14-0" - } -} \ No newline at end of file diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/clickhouse/24.3/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/clickhouse/24.3/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/clickhouse/24.3/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse-env.sh b/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse-env.sh deleted file mode 100644 index 4a82bf3c31c9e..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse-env.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for clickhouse - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-clickhouse}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -clickhouse_env_vars=( - ALLOW_EMPTY_PASSWORD - CLICKHOUSE_ADMIN_USER - CLICKHOUSE_ADMIN_PASSWORD - CLICKHOUSE_HTTP_PORT - CLICKHOUSE_TCP_PORT - CLICKHOUSE_MYSQL_PORT - CLICKHOUSE_POSTGRESQL_PORT - CLICKHOUSE_INTERSERVER_HTTP_PORT - CLICKHOUSE_USER - CLICKHOUSE_PASSWORD -) -for env_var in "${clickhouse_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset clickhouse_env_vars - -# Paths -export CLICKHOUSE_BASE_DIR="${BITNAMI_ROOT_DIR}/clickhouse" -export CLICKHOUSE_VOLUME_DIR="/bitnami/clickhouse" -export CLICKHOUSE_CONF_DIR="${CLICKHOUSE_BASE_DIR}/etc" -export CLICKHOUSE_DEFAULT_CONF_DIR="${CLICKHOUSE_BASE_DIR}/etc.default" -export CLICKHOUSE_MOUNTED_CONF_DIR="${CLICKHOUSE_VOLUME_DIR}/etc" -export CLICKHOUSE_DATA_DIR="${CLICKHOUSE_VOLUME_DIR}/data" -export CLICKHOUSE_LOG_DIR="${CLICKHOUSE_BASE_DIR}/logs" -export CLICKHOUSE_CONF_FILE="${CLICKHOUSE_CONF_DIR}/config.xml" -export CLICKHOUSE_LOG_FILE="${CLICKHOUSE_LOG_DIR}/clickhouse.log" -export CLICKHOUSE_ERROR_LOG_FILE="${CLICKHOUSE_LOG_DIR}/clickhouse_error.log" -export CLICKHOUSE_TMP_DIR="${CLICKHOUSE_BASE_DIR}/tmp" -export CLICKHOUSE_PID_FILE="${CLICKHOUSE_TMP_DIR}/clickhouse.pid" -export CLICKHOUSE_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d" - -# ClickHouse configuration parameters -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -CLICKHOUSE_ADMIN_USER="${CLICKHOUSE_ADMIN_USER:-"${CLICKHOUSE_USER:-}"}" -export CLICKHOUSE_ADMIN_USER="${CLICKHOUSE_ADMIN_USER:-default}" -CLICKHOUSE_ADMIN_PASSWORD="${CLICKHOUSE_ADMIN_PASSWORD:-"${CLICKHOUSE_PASSWORD:-}"}" -export CLICKHOUSE_ADMIN_PASSWORD="${CLICKHOUSE_ADMIN_PASSWORD:-}" -export CLICKHOUSE_HTTP_PORT="${CLICKHOUSE_HTTP_PORT:-8123}" -export CLICKHOUSE_TCP_PORT="${CLICKHOUSE_TCP_PORT:-9000}" -export CLICKHOUSE_MYSQL_PORT="${CLICKHOUSE_MYSQL_PORT:-9004}" -export CLICKHOUSE_POSTGRESQL_PORT="${CLICKHOUSE_POSTGRESQL_PORT:-9005}" -export CLICKHOUSE_INTERSERVER_HTTP_PORT="${CLICKHOUSE_INTERSERVER_HTTP_PORT:-9009}" - -# ClickHouse system parameters -export CLICKHOUSE_DAEMON_USER="clickhouse" -export CLICKHOUSE_DAEMON_GROUP="clickhouse" -export PATH="${CLICKHOUSE_BASE_DIR}/bin:${BITNAMI_ROOT_DIR}/common/bin:$PATH" - -# Custom environment variables may be defined below diff --git a/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/entrypoint.sh b/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/entrypoint.sh deleted file mode 100755 index fcc401e12fdb1..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -# Load ClickHouse environment variables -. /opt/bitnami/scripts/clickhouse-env.sh - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/clickhouse/etc) -debug "Copying files from $CLICKHOUSE_DEFAULT_CONF_DIR to $CLICKHOUSE_CONF_DIR" -cp -nr "$CLICKHOUSE_DEFAULT_CONF_DIR"/. "$CLICKHOUSE_CONF_DIR" - -if [[ "$1" = "/opt/bitnami/scripts/clickhouse/run.sh" ]]; then - info "** Starting ClickHouse setup **" - /opt/bitnami/scripts/clickhouse/setup.sh - info "** ClickHouse setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/postunpack.sh b/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/postunpack.sh deleted file mode 100755 index 80491033079f0..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/postunpack.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libclickhouse.sh - -# Load ClickHouse environment variables -. /opt/bitnami/scripts/clickhouse-env.sh - -# System User -ensure_user_exists "$CLICKHOUSE_DAEMON_USER" --group "$CLICKHOUSE_DAEMON_GROUP" --system - -# Create directories -for dir in "$CLICKHOUSE_DATA_DIR" "$CLICKHOUSE_CONF_DIR" "${CLICKHOUSE_CONF_DIR}/conf.d" "${CLICKHOUSE_CONF_DIR}/users.d" "$CLICKHOUSE_DEFAULT_CONF_DIR" "$CLICKHOUSE_LOG_DIR" "$CLICKHOUSE_TMP_DIR" "$CLICKHOUSE_MOUNTED_CONF_DIR" "/docker-entrypoint-startdb.d" "/docker-entrypoint-initdb.d"; do - ensure_dir_exists "$dir" - configure_permissions_ownership "$dir" -d "775" -f "664" -u "$CLICKHOUSE_DAEMON_USER" -g "root" -done - -# Set default settings in the configuration file - -# Delete default cluster configurations (it contains example configurations that adds noise) and add an empty one -xmlstarlet ed -L -d "/clickhouse/remote_servers" "$CLICKHOUSE_CONF_FILE" - -# Set paths -clickhouse_conf_set "/clickhouse/path" "$CLICKHOUSE_DATA_DIR" -clickhouse_conf_set "/clickhouse/logger/log" "$CLICKHOUSE_LOG_FILE" -clickhouse_conf_set "/clickhouse/logger/errorlog" "$CLICKHOUSE_ERROR_LOG_FILE" - -# ClickHouse allow making settings point to environment variables. This change -# will simplify the container logic substantially because we won't need to modify -# the xml files at runtime -# Source: https://clickhouse.com/docs/en/operations/server-configuration-parameters/settings/ -env_vars_mapping=( - "http_port=CLICKHOUSE_HTTP_PORT" - "tcp_port=CLICKHOUSE_TCP_PORT" - "mysql_port=CLICKHOUSE_MYSQL_PORT" - "postgresql_port=CLICKHOUSE_POSTGRESQL_PORT" - "interserver_http_port=CLICKHOUSE_INTERSERVER_HTTP_PORT" -) - -for pair in "${env_vars_mapping[@]}"; do - setting="${pair%=*}" - env_var="${pair#*=}" - # Delete the existing node - xmlstarlet ed -L -d "/clickhouse/${setting}" "$CLICKHOUSE_CONF_FILE" - # Recreate the node so it has the following structure - # - clickhouse_conf_set "/clickhouse/${setting}" - xmlstarlet ed -L --insert "/clickhouse/${setting}" -type attr -n "from_env" -v "${env_var}" "$CLICKHOUSE_CONF_FILE" -done - -# Set default password to point to the CLICKHOUSE_ADMIN_PASSWORD variable -xmlstarlet ed -L --insert "/clickhouse/users/default/password" -type attr -n "from_env" -v "CLICKHOUSE_ADMIN_PASSWORD" "${CLICKHOUSE_CONF_DIR}/users.xml" - -# Add symlinks to the default paths to make a similar UX as the upstream ClickHouse configuration -# https://github.com/ClickHouse/ClickHouse/blob/master/programs/server/config.xml -ln -s "$CLICKHOUSE_DATA_DIR" "/var/lib/clickhouse" -ln -s "$CLICKHOUSE_CONF_DIR" "/etc/clickhouse-server" -ln -s "$CLICKHOUSE_LOG_DIR" "/var/log/clickhouse-server" -ln -s "$CLICKHOUSE_TMP_DIR" "/var/lib/clickhouse/tmp" - -ln -s /dev/stdout "$CLICKHOUSE_LOG_FILE" -ln -s /dev/stderr "$CLICKHOUSE_ERROR_LOG_FILE" - -touch /.clickhouse-client-history -chmod g+rw /.clickhouse-client-history - -# Set logging to console -xmlstarlet ed -L -d "/clickhouse/logger/log" "$CLICKHOUSE_CONF_FILE" -xmlstarlet ed -L -d "/clickhouse/logger/errorlog" "$CLICKHOUSE_CONF_FILE" -clickhouse_conf_set "/clickhouse/logger/console" "1" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${CLICKHOUSE_CONF_DIR}/"* "$CLICKHOUSE_DEFAULT_CONF_DIR" \ No newline at end of file diff --git a/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/run.sh b/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/run.sh deleted file mode 100755 index c42c1d6426abd..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/run.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1090,SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libclickhouse.sh - -# Load ClickHouse environment variables -. /opt/bitnami/scripts/clickhouse-env.sh - -declare -a cmd=("${CLICKHOUSE_BASE_DIR}/bin/clickhouse-server") -declare -a args=("--config-file=${CLICKHOUSE_CONF_FILE}" "--pid-file=${CLICKHOUSE_PID_FILE}") -args+=("$@") - -info "** Starting ClickHouse **" -if am_i_root; then - exec_as_user "$CLICKHOUSE_DAEMON_USER" "${cmd[@]}" "${args[@]}" -else - exec "${cmd[@]}" "${args[@]}" -fi diff --git a/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/setup.sh b/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/setup.sh deleted file mode 100755 index 75f75f04cf2bc..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/clickhouse/setup.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libclickhouse.sh - -# Load ClickHouse environment settings -. /opt/bitnami/scripts/clickhouse-env.sh - -# Ensure ClickHouse environment settings are valid -clickhouse_validate -# Ensure ClickHouse is stopped when this script ends. -trap "clickhouse_stop" EXIT -# Ensure 'daemon' user exists when running as 'root' -am_i_root && ensure_user_exists "$CLICKHOUSE_DAEMON_USER" --group "$CLICKHOUSE_DAEMON_GROUP" -# Ensure is initialized -clickhouse_initialize -# Allow running custom initialization scripts -clickhouse_custom_scripts 'init' -# Allow running custom start scripts -clickhouse_custom_scripts 'start' -# Stop ClickHouse before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -clickhouse_stop diff --git a/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/libclickhouse.sh b/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/libclickhouse.sh deleted file mode 100644 index ec6386e62e1b0..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/rootfs/opt/bitnami/scripts/libclickhouse.sh +++ /dev/null @@ -1,284 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami ClickHouse library - -# shellcheck disable=SC1090 -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libservice.sh - -######################## -# Validate settings in CLICKHOUSE_* env vars -# Globals: -# CLICKHOUSE_* -# Arguments: -# None -# Returns: -# 0 if the validation succeeded, 1 otherwise -######################### -clickhouse_validate() { - debug "Validating settings in CLICKHOUSE_* environment variables..." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_empty_value() { - if is_empty_value "${!1}"; then - print_validation_error "${1} must be set" - fi - } - check_valid_port() { - local port_var="${1:?missing port variable}" - local err - if ! err="$(validate_port "${!port_var}")"; then - print_validation_error "An invalid port was specified in the environment variable ${port_var}: ${err}." - fi - } - - # Validate user inputs - ! is_empty_value "$CLICKHOUSE_HTTP_PORT" && check_valid_port "CLICKHOUSE_HTTP_PORT" - ! is_empty_value "$CLICKHOUSE_TCP_PORT" && check_valid_port "CLICKHOUSE_TCP_PORT" - ! is_empty_value "$CLICKHOUSE_MYSQL_PORT" && check_valid_port "CLICKHOUSE_MYSQL_PORT" - ! is_empty_value "$CLICKHOUSE_POSTGRESQL_PORT" && check_valid_port "CLICKHOUSE_POSTGRESQL_PORT" - ! is_empty_value "$CLICKHOUSE_INTERSERVER_HTTP_PORT" && check_valid_port "CLICKHOUSE_INTERSERVER_HTTP_PORT" - - # Validate credentials - if is_boolean_yes "${ALLOW_EMPTY_PASSWORD:-}"; then - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD:-}. For safety reasons, do not use this flag in a production environment." - elif is_empty_value "$CLICKHOUSE_ADMIN_PASSWORD"; then - print_validation_error "The CLICKHOUSE_ADMIN_PASSWORD environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow a blank password. This is only recommended for development environments." - fi - - return "$error_code" -} - -######################## -# Copy configuration from the mounted folder to the etc folder -# In charts mounting directly in the configuration folder would not -# allow the use of multiple ConfigMaps and Secrets -# Globals: -# CLICKHOUSE_* -# Arguments: -# None -# Returns: -# None -######################### -clickhouse_copy_mounted_configuration() { - if [[ -w "$CLICKHOUSE_CONF_DIR" ]]; then - if ! is_mounted_dir_empty "$CLICKHOUSE_MOUNTED_CONF_DIR"; then - info "Copying mounted configuration from $CLICKHOUSE_MOUNTED_CONF_DIR" - # Copy first the files at the base of the mounted folder to go to ClickHouse - # base etc folder - find "$CLICKHOUSE_MOUNTED_CONF_DIR" -maxdepth 1 \( -type f -o -type l \) -exec cp -L -r {} "$CLICKHOUSE_CONF_DIR" \; - - # The ClickHouse override directories (etc/conf.d and etc/users.d) do not support subfolders. That means we cannot - # copy directly with cp -RL because we need all override xml files to have at the root of these subfolders. In the helm - # chart we want to allow overrides from different ConfigMaps and Secrets so we need to use the find command - if [[ -d "${CLICKHOUSE_MOUNTED_CONF_DIR}/conf.d" ]]; then - find "${CLICKHOUSE_MOUNTED_CONF_DIR}/conf.d" \( -type f -o -type l \) -exec cp -L -r {} "${CLICKHOUSE_CONF_DIR}/conf.d" \; - fi - if [[ -d "${CLICKHOUSE_MOUNTED_CONF_DIR}/users.d" ]]; then - find "${CLICKHOUSE_MOUNTED_CONF_DIR}/users.d" \( -type f -o -type l \) -exec cp -L -r {} "${CLICKHOUSE_CONF_DIR}/users.d" \; - fi - fi - else - warn "The folder $CLICKHOUSE_CONF_DIR is not writable. This is likely because a read-only filesystem was mounted in that folder. Using $CLICKHOUSE_MOUNTED_DIR is recommended" - fi -} - -######################## -# Add or modify an entry in the ClickHouse configuration file -# Globals: -# CLICKHOUSE_* -# Arguments: -# $1 - XPath expression -# $2 - Value to assign to the variable -# $3 - Configuration file -# Returns: -# None -######################### -clickhouse_conf_set() { - local -r xpath="${1:?key missing}" - # We allow empty values - local -r value="${2:-}" - local -r config_file="${3:-$CLICKHOUSE_CONF_FILE}" - debug "Setting ${xpath} to '${value}' in ClickHouse configuration file $config_file" - # Check if the entry exists in the XML file - if xmlstarlet --quiet sel -t -v "$xpath" "$config_file"; then - # Base case - # It exists, so replace the entry - if ! is_empty_value "$value"; then - xmlstarlet ed -L -u "$xpath" -v "$value" "$config_file" - fi - else - # It does not exist, so add the subnode - local -r parentNode="$(dirname "$xpath")" - local -r newNode="$(basename "$xpath")" - # Recursive call to add parent nodes - clickhouse_conf_set "$parentNode" - if is_empty_value "$value"; then - xmlstarlet ed -L --subnode "${parentNode}" -t "elem" -n "${newNode}" "$config_file" - else - xmlstarlet ed -L --subnode "${parentNode}" -t "elem" -n "${newNode}" -v "$value" "$config_file" - fi - fi -} - -######################## -# Check if ClickHouse daemon is running -# Arguments: -# None -# Returns: -# Boolean -######################### -is_clickhouse_running() { - pid="$(get_pid_from_file "$CLICKHOUSE_PID_FILE")" - if [[ -n "$pid" ]]; then - is_service_running "$pid" - else - false - fi -} - -######################## -# Check if ClickHouse daemon is not running -# Arguments: -# None -# Returns: -# Boolean -######################### -is_clickhouse_not_running() { - ! is_clickhouse_running -} - -######################## -# Stop ClickHouse daemons -# Arguments: -# None -# Returns: -# None -######################### -clickhouse_stop() { - ! is_clickhouse_running && return - stop_service_using_pid "$CLICKHOUSE_PID_FILE" -} - -######################## -# Initialize ClickHouse -# Arguments: -# None -# Returns: -# None -######################### -clickhouse_initialize() { - # Logic based on the upstream ClickHouse container - # For the container itself we keep the logic simple. In the helm chart we rely on the mounting of configuration files with overrides - # Source: https://github.com/ClickHouse/ClickHouse/blob/master/docker/server/entrypoint.sh - - # This fixes an issue where the trap would kill the entrypoint.sh, if a PID was left over from a previous run - # Exec replaces the process without creating a new one, and when the container is restarted it may have the same PID - rm -f "$CLICKHOUSE_PID_FILE" - - clickhouse_copy_mounted_configuration - if [[ "$CLICKHOUSE_ADMIN_USER" != "default" ]]; then - # If we need to set an admin user different from default, we create a configuration override - local -r admin_user_override="${CLICKHOUSE_CONF_DIR}/users.d/__bitnami_default_user.xml" - cat <"${admin_user_override}" - - - - - - - - <${CLICKHOUSE_ADMIN_USER}> - default - - - ::/0 - - default - 1 - - - -EOF - fi - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Start ClickHouse daemon -# Arguments: -# $1 - Log file to check the startup message -# Returns: -# None -######################### -clickhouse_start_bg() { - local -r log_file="${1:-$CLICKHOUSE_LOG_FILE}" - info "Starting ClickHouse in background" - is_clickhouse_running && return - # This function is meant to be called for internal operations like the init scripts - local -r cmd=("${CLICKHOUSE_BASE_DIR}/bin/clickhouse-server") - local -r args=("--config-file=${CLICKHOUSE_CONF_FILE}" "--pid-file=${CLICKHOUSE_PID_FILE}" "--" "--listen_host=0.0.0.0") - if am_i_root; then - run_as_user "$CLICKHOUSE_DAEMON_USER" "${cmd[@]}" "${args[@]}" >"$log_file" 2>&1 & - else - "${cmd[@]}" "${args[@]}" >"$log_file" 2>&1 & - fi - if ! retry_while is_clickhouse_running; then - error "ClickHouse failed to start" - exit 1 - fi - wait_for_log_entry "Application: Ready for connections" "$log_file" - info "ClickHouse started successfully" -} - -######################## -# Run custom scripts -# Globals: -# CLICKHOUSE_* -# Arguments: -# $1 - 'init' or 'start' ('init' runs on first container start, 'start' runs everytime the container starts) -# Returns: -# None -######################### -clickhouse_custom_scripts() { - if [[ -n $(find /docker-entrypoint-"$1"db.d/ -type f -regex ".*\.sh") ]] && { [[ ! -f "$CLICKHOUSE_DATA_DIR/.user_scripts_initialized" ]] || [[ $1 == start ]]; }; then - clickhouse_start_bg "$CLICKHOUSE_LOG_DIR/clickhouse_init_scripts.log" - info "Loading user's custom files from /docker-entrypoint-$1db.d" - for f in /docker-entrypoint-"$1"db.d/*; do - debug "Executing $f" - case "$f" in - *.sh) - if [[ -x "$f" ]]; then - if ! "$f"; then - error "Failed executing $f" - return 1 - fi - else - warn "Sourcing $f as it is not executable by the current user, any error may cause initialization to fail" - . "$f" - fi - ;; - *) - warn "Skipping $f, supported formats are: .sh" - ;; - esac - done - touch "${CLICKHOUSE_DATA_DIR}/.user_scripts_initialized" - fi -} diff --git a/bitnami/clickhouse/24.3/debian-12/tags-info.yaml b/bitnami/clickhouse/24.3/debian-12/tags-info.yaml deleted file mode 100644 index b15da33e0aaca..0000000000000 --- a/bitnami/clickhouse/24.3/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "24.3" -- 24.3-debian-12 -- 24.3.14 diff --git a/bitnami/clickhouse/24.8/README.md b/bitnami/clickhouse/24.8/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/clickhouse/24.8/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/clickhouse/24.8/debian-12/Dockerfile b/bitnami/clickhouse/24.8/debian-12/Dockerfile deleted file mode 100644 index aa9aa2e566e16..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/Dockerfile +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-22T15:59:08Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/clickhouse/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="24.8.8-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/clickhouse" \ - org.opencontainers.image.title="clickhouse" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="24.8.8" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps xmlstarlet -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "clickhouse-24.8.8-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/clickhouse/postunpack.sh -ENV APP_VERSION="24.8.8" \ - BITNAMI_APP_NAME="clickhouse" \ - PATH="/opt/bitnami/clickhouse/bin:/opt/bitnami/common/bin:$PATH" \ - clickhouseCTL_API="3" - -EXPOSE 8123 9000 9004 9005 9009 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/clickhouse/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/clickhouse/run.sh", "--", "--listen_host=0.0.0.0" ] diff --git a/bitnami/clickhouse/24.8/debian-12/docker-compose.yml b/bitnami/clickhouse/24.8/debian-12/docker-compose.yml deleted file mode 100644 index fc8431404595f..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/docker-compose.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - clickhouse: - image: docker.io/bitnami/clickhouse:24.8 - environment: - - ALLOW_EMPTY_PASSWORD=yes - ports: - - '8123:8123' - volumes: - - clickhouse_data:/bitnami/clickhouse -volumes: - clickhouse_data: - driver: local diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index a66844911cab0..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "clickhouse": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "24.8.8-0" - } -} \ No newline at end of file diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/clickhouse/24.8/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/clickhouse/24.8/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/clickhouse/24.8/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse-env.sh b/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse-env.sh deleted file mode 100644 index 4a82bf3c31c9e..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse-env.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for clickhouse - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-clickhouse}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -clickhouse_env_vars=( - ALLOW_EMPTY_PASSWORD - CLICKHOUSE_ADMIN_USER - CLICKHOUSE_ADMIN_PASSWORD - CLICKHOUSE_HTTP_PORT - CLICKHOUSE_TCP_PORT - CLICKHOUSE_MYSQL_PORT - CLICKHOUSE_POSTGRESQL_PORT - CLICKHOUSE_INTERSERVER_HTTP_PORT - CLICKHOUSE_USER - CLICKHOUSE_PASSWORD -) -for env_var in "${clickhouse_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset clickhouse_env_vars - -# Paths -export CLICKHOUSE_BASE_DIR="${BITNAMI_ROOT_DIR}/clickhouse" -export CLICKHOUSE_VOLUME_DIR="/bitnami/clickhouse" -export CLICKHOUSE_CONF_DIR="${CLICKHOUSE_BASE_DIR}/etc" -export CLICKHOUSE_DEFAULT_CONF_DIR="${CLICKHOUSE_BASE_DIR}/etc.default" -export CLICKHOUSE_MOUNTED_CONF_DIR="${CLICKHOUSE_VOLUME_DIR}/etc" -export CLICKHOUSE_DATA_DIR="${CLICKHOUSE_VOLUME_DIR}/data" -export CLICKHOUSE_LOG_DIR="${CLICKHOUSE_BASE_DIR}/logs" -export CLICKHOUSE_CONF_FILE="${CLICKHOUSE_CONF_DIR}/config.xml" -export CLICKHOUSE_LOG_FILE="${CLICKHOUSE_LOG_DIR}/clickhouse.log" -export CLICKHOUSE_ERROR_LOG_FILE="${CLICKHOUSE_LOG_DIR}/clickhouse_error.log" -export CLICKHOUSE_TMP_DIR="${CLICKHOUSE_BASE_DIR}/tmp" -export CLICKHOUSE_PID_FILE="${CLICKHOUSE_TMP_DIR}/clickhouse.pid" -export CLICKHOUSE_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d" - -# ClickHouse configuration parameters -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -CLICKHOUSE_ADMIN_USER="${CLICKHOUSE_ADMIN_USER:-"${CLICKHOUSE_USER:-}"}" -export CLICKHOUSE_ADMIN_USER="${CLICKHOUSE_ADMIN_USER:-default}" -CLICKHOUSE_ADMIN_PASSWORD="${CLICKHOUSE_ADMIN_PASSWORD:-"${CLICKHOUSE_PASSWORD:-}"}" -export CLICKHOUSE_ADMIN_PASSWORD="${CLICKHOUSE_ADMIN_PASSWORD:-}" -export CLICKHOUSE_HTTP_PORT="${CLICKHOUSE_HTTP_PORT:-8123}" -export CLICKHOUSE_TCP_PORT="${CLICKHOUSE_TCP_PORT:-9000}" -export CLICKHOUSE_MYSQL_PORT="${CLICKHOUSE_MYSQL_PORT:-9004}" -export CLICKHOUSE_POSTGRESQL_PORT="${CLICKHOUSE_POSTGRESQL_PORT:-9005}" -export CLICKHOUSE_INTERSERVER_HTTP_PORT="${CLICKHOUSE_INTERSERVER_HTTP_PORT:-9009}" - -# ClickHouse system parameters -export CLICKHOUSE_DAEMON_USER="clickhouse" -export CLICKHOUSE_DAEMON_GROUP="clickhouse" -export PATH="${CLICKHOUSE_BASE_DIR}/bin:${BITNAMI_ROOT_DIR}/common/bin:$PATH" - -# Custom environment variables may be defined below diff --git a/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/entrypoint.sh b/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/entrypoint.sh deleted file mode 100755 index fcc401e12fdb1..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -# Load ClickHouse environment variables -. /opt/bitnami/scripts/clickhouse-env.sh - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/clickhouse/etc) -debug "Copying files from $CLICKHOUSE_DEFAULT_CONF_DIR to $CLICKHOUSE_CONF_DIR" -cp -nr "$CLICKHOUSE_DEFAULT_CONF_DIR"/. "$CLICKHOUSE_CONF_DIR" - -if [[ "$1" = "/opt/bitnami/scripts/clickhouse/run.sh" ]]; then - info "** Starting ClickHouse setup **" - /opt/bitnami/scripts/clickhouse/setup.sh - info "** ClickHouse setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/postunpack.sh b/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/postunpack.sh deleted file mode 100755 index 80491033079f0..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/postunpack.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libclickhouse.sh - -# Load ClickHouse environment variables -. /opt/bitnami/scripts/clickhouse-env.sh - -# System User -ensure_user_exists "$CLICKHOUSE_DAEMON_USER" --group "$CLICKHOUSE_DAEMON_GROUP" --system - -# Create directories -for dir in "$CLICKHOUSE_DATA_DIR" "$CLICKHOUSE_CONF_DIR" "${CLICKHOUSE_CONF_DIR}/conf.d" "${CLICKHOUSE_CONF_DIR}/users.d" "$CLICKHOUSE_DEFAULT_CONF_DIR" "$CLICKHOUSE_LOG_DIR" "$CLICKHOUSE_TMP_DIR" "$CLICKHOUSE_MOUNTED_CONF_DIR" "/docker-entrypoint-startdb.d" "/docker-entrypoint-initdb.d"; do - ensure_dir_exists "$dir" - configure_permissions_ownership "$dir" -d "775" -f "664" -u "$CLICKHOUSE_DAEMON_USER" -g "root" -done - -# Set default settings in the configuration file - -# Delete default cluster configurations (it contains example configurations that adds noise) and add an empty one -xmlstarlet ed -L -d "/clickhouse/remote_servers" "$CLICKHOUSE_CONF_FILE" - -# Set paths -clickhouse_conf_set "/clickhouse/path" "$CLICKHOUSE_DATA_DIR" -clickhouse_conf_set "/clickhouse/logger/log" "$CLICKHOUSE_LOG_FILE" -clickhouse_conf_set "/clickhouse/logger/errorlog" "$CLICKHOUSE_ERROR_LOG_FILE" - -# ClickHouse allow making settings point to environment variables. This change -# will simplify the container logic substantially because we won't need to modify -# the xml files at runtime -# Source: https://clickhouse.com/docs/en/operations/server-configuration-parameters/settings/ -env_vars_mapping=( - "http_port=CLICKHOUSE_HTTP_PORT" - "tcp_port=CLICKHOUSE_TCP_PORT" - "mysql_port=CLICKHOUSE_MYSQL_PORT" - "postgresql_port=CLICKHOUSE_POSTGRESQL_PORT" - "interserver_http_port=CLICKHOUSE_INTERSERVER_HTTP_PORT" -) - -for pair in "${env_vars_mapping[@]}"; do - setting="${pair%=*}" - env_var="${pair#*=}" - # Delete the existing node - xmlstarlet ed -L -d "/clickhouse/${setting}" "$CLICKHOUSE_CONF_FILE" - # Recreate the node so it has the following structure - # - clickhouse_conf_set "/clickhouse/${setting}" - xmlstarlet ed -L --insert "/clickhouse/${setting}" -type attr -n "from_env" -v "${env_var}" "$CLICKHOUSE_CONF_FILE" -done - -# Set default password to point to the CLICKHOUSE_ADMIN_PASSWORD variable -xmlstarlet ed -L --insert "/clickhouse/users/default/password" -type attr -n "from_env" -v "CLICKHOUSE_ADMIN_PASSWORD" "${CLICKHOUSE_CONF_DIR}/users.xml" - -# Add symlinks to the default paths to make a similar UX as the upstream ClickHouse configuration -# https://github.com/ClickHouse/ClickHouse/blob/master/programs/server/config.xml -ln -s "$CLICKHOUSE_DATA_DIR" "/var/lib/clickhouse" -ln -s "$CLICKHOUSE_CONF_DIR" "/etc/clickhouse-server" -ln -s "$CLICKHOUSE_LOG_DIR" "/var/log/clickhouse-server" -ln -s "$CLICKHOUSE_TMP_DIR" "/var/lib/clickhouse/tmp" - -ln -s /dev/stdout "$CLICKHOUSE_LOG_FILE" -ln -s /dev/stderr "$CLICKHOUSE_ERROR_LOG_FILE" - -touch /.clickhouse-client-history -chmod g+rw /.clickhouse-client-history - -# Set logging to console -xmlstarlet ed -L -d "/clickhouse/logger/log" "$CLICKHOUSE_CONF_FILE" -xmlstarlet ed -L -d "/clickhouse/logger/errorlog" "$CLICKHOUSE_CONF_FILE" -clickhouse_conf_set "/clickhouse/logger/console" "1" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${CLICKHOUSE_CONF_DIR}/"* "$CLICKHOUSE_DEFAULT_CONF_DIR" \ No newline at end of file diff --git a/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/run.sh b/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/run.sh deleted file mode 100755 index c42c1d6426abd..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/run.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1090,SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libclickhouse.sh - -# Load ClickHouse environment variables -. /opt/bitnami/scripts/clickhouse-env.sh - -declare -a cmd=("${CLICKHOUSE_BASE_DIR}/bin/clickhouse-server") -declare -a args=("--config-file=${CLICKHOUSE_CONF_FILE}" "--pid-file=${CLICKHOUSE_PID_FILE}") -args+=("$@") - -info "** Starting ClickHouse **" -if am_i_root; then - exec_as_user "$CLICKHOUSE_DAEMON_USER" "${cmd[@]}" "${args[@]}" -else - exec "${cmd[@]}" "${args[@]}" -fi diff --git a/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/setup.sh b/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/setup.sh deleted file mode 100755 index 75f75f04cf2bc..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/clickhouse/setup.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libclickhouse.sh - -# Load ClickHouse environment settings -. /opt/bitnami/scripts/clickhouse-env.sh - -# Ensure ClickHouse environment settings are valid -clickhouse_validate -# Ensure ClickHouse is stopped when this script ends. -trap "clickhouse_stop" EXIT -# Ensure 'daemon' user exists when running as 'root' -am_i_root && ensure_user_exists "$CLICKHOUSE_DAEMON_USER" --group "$CLICKHOUSE_DAEMON_GROUP" -# Ensure is initialized -clickhouse_initialize -# Allow running custom initialization scripts -clickhouse_custom_scripts 'init' -# Allow running custom start scripts -clickhouse_custom_scripts 'start' -# Stop ClickHouse before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -clickhouse_stop diff --git a/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/libclickhouse.sh b/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/libclickhouse.sh deleted file mode 100644 index ec6386e62e1b0..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/rootfs/opt/bitnami/scripts/libclickhouse.sh +++ /dev/null @@ -1,284 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami ClickHouse library - -# shellcheck disable=SC1090 -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libservice.sh - -######################## -# Validate settings in CLICKHOUSE_* env vars -# Globals: -# CLICKHOUSE_* -# Arguments: -# None -# Returns: -# 0 if the validation succeeded, 1 otherwise -######################### -clickhouse_validate() { - debug "Validating settings in CLICKHOUSE_* environment variables..." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_empty_value() { - if is_empty_value "${!1}"; then - print_validation_error "${1} must be set" - fi - } - check_valid_port() { - local port_var="${1:?missing port variable}" - local err - if ! err="$(validate_port "${!port_var}")"; then - print_validation_error "An invalid port was specified in the environment variable ${port_var}: ${err}." - fi - } - - # Validate user inputs - ! is_empty_value "$CLICKHOUSE_HTTP_PORT" && check_valid_port "CLICKHOUSE_HTTP_PORT" - ! is_empty_value "$CLICKHOUSE_TCP_PORT" && check_valid_port "CLICKHOUSE_TCP_PORT" - ! is_empty_value "$CLICKHOUSE_MYSQL_PORT" && check_valid_port "CLICKHOUSE_MYSQL_PORT" - ! is_empty_value "$CLICKHOUSE_POSTGRESQL_PORT" && check_valid_port "CLICKHOUSE_POSTGRESQL_PORT" - ! is_empty_value "$CLICKHOUSE_INTERSERVER_HTTP_PORT" && check_valid_port "CLICKHOUSE_INTERSERVER_HTTP_PORT" - - # Validate credentials - if is_boolean_yes "${ALLOW_EMPTY_PASSWORD:-}"; then - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD:-}. For safety reasons, do not use this flag in a production environment." - elif is_empty_value "$CLICKHOUSE_ADMIN_PASSWORD"; then - print_validation_error "The CLICKHOUSE_ADMIN_PASSWORD environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow a blank password. This is only recommended for development environments." - fi - - return "$error_code" -} - -######################## -# Copy configuration from the mounted folder to the etc folder -# In charts mounting directly in the configuration folder would not -# allow the use of multiple ConfigMaps and Secrets -# Globals: -# CLICKHOUSE_* -# Arguments: -# None -# Returns: -# None -######################### -clickhouse_copy_mounted_configuration() { - if [[ -w "$CLICKHOUSE_CONF_DIR" ]]; then - if ! is_mounted_dir_empty "$CLICKHOUSE_MOUNTED_CONF_DIR"; then - info "Copying mounted configuration from $CLICKHOUSE_MOUNTED_CONF_DIR" - # Copy first the files at the base of the mounted folder to go to ClickHouse - # base etc folder - find "$CLICKHOUSE_MOUNTED_CONF_DIR" -maxdepth 1 \( -type f -o -type l \) -exec cp -L -r {} "$CLICKHOUSE_CONF_DIR" \; - - # The ClickHouse override directories (etc/conf.d and etc/users.d) do not support subfolders. That means we cannot - # copy directly with cp -RL because we need all override xml files to have at the root of these subfolders. In the helm - # chart we want to allow overrides from different ConfigMaps and Secrets so we need to use the find command - if [[ -d "${CLICKHOUSE_MOUNTED_CONF_DIR}/conf.d" ]]; then - find "${CLICKHOUSE_MOUNTED_CONF_DIR}/conf.d" \( -type f -o -type l \) -exec cp -L -r {} "${CLICKHOUSE_CONF_DIR}/conf.d" \; - fi - if [[ -d "${CLICKHOUSE_MOUNTED_CONF_DIR}/users.d" ]]; then - find "${CLICKHOUSE_MOUNTED_CONF_DIR}/users.d" \( -type f -o -type l \) -exec cp -L -r {} "${CLICKHOUSE_CONF_DIR}/users.d" \; - fi - fi - else - warn "The folder $CLICKHOUSE_CONF_DIR is not writable. This is likely because a read-only filesystem was mounted in that folder. Using $CLICKHOUSE_MOUNTED_DIR is recommended" - fi -} - -######################## -# Add or modify an entry in the ClickHouse configuration file -# Globals: -# CLICKHOUSE_* -# Arguments: -# $1 - XPath expression -# $2 - Value to assign to the variable -# $3 - Configuration file -# Returns: -# None -######################### -clickhouse_conf_set() { - local -r xpath="${1:?key missing}" - # We allow empty values - local -r value="${2:-}" - local -r config_file="${3:-$CLICKHOUSE_CONF_FILE}" - debug "Setting ${xpath} to '${value}' in ClickHouse configuration file $config_file" - # Check if the entry exists in the XML file - if xmlstarlet --quiet sel -t -v "$xpath" "$config_file"; then - # Base case - # It exists, so replace the entry - if ! is_empty_value "$value"; then - xmlstarlet ed -L -u "$xpath" -v "$value" "$config_file" - fi - else - # It does not exist, so add the subnode - local -r parentNode="$(dirname "$xpath")" - local -r newNode="$(basename "$xpath")" - # Recursive call to add parent nodes - clickhouse_conf_set "$parentNode" - if is_empty_value "$value"; then - xmlstarlet ed -L --subnode "${parentNode}" -t "elem" -n "${newNode}" "$config_file" - else - xmlstarlet ed -L --subnode "${parentNode}" -t "elem" -n "${newNode}" -v "$value" "$config_file" - fi - fi -} - -######################## -# Check if ClickHouse daemon is running -# Arguments: -# None -# Returns: -# Boolean -######################### -is_clickhouse_running() { - pid="$(get_pid_from_file "$CLICKHOUSE_PID_FILE")" - if [[ -n "$pid" ]]; then - is_service_running "$pid" - else - false - fi -} - -######################## -# Check if ClickHouse daemon is not running -# Arguments: -# None -# Returns: -# Boolean -######################### -is_clickhouse_not_running() { - ! is_clickhouse_running -} - -######################## -# Stop ClickHouse daemons -# Arguments: -# None -# Returns: -# None -######################### -clickhouse_stop() { - ! is_clickhouse_running && return - stop_service_using_pid "$CLICKHOUSE_PID_FILE" -} - -######################## -# Initialize ClickHouse -# Arguments: -# None -# Returns: -# None -######################### -clickhouse_initialize() { - # Logic based on the upstream ClickHouse container - # For the container itself we keep the logic simple. In the helm chart we rely on the mounting of configuration files with overrides - # Source: https://github.com/ClickHouse/ClickHouse/blob/master/docker/server/entrypoint.sh - - # This fixes an issue where the trap would kill the entrypoint.sh, if a PID was left over from a previous run - # Exec replaces the process without creating a new one, and when the container is restarted it may have the same PID - rm -f "$CLICKHOUSE_PID_FILE" - - clickhouse_copy_mounted_configuration - if [[ "$CLICKHOUSE_ADMIN_USER" != "default" ]]; then - # If we need to set an admin user different from default, we create a configuration override - local -r admin_user_override="${CLICKHOUSE_CONF_DIR}/users.d/__bitnami_default_user.xml" - cat <"${admin_user_override}" - - - - - - - - <${CLICKHOUSE_ADMIN_USER}> - default - - - ::/0 - - default - 1 - - - -EOF - fi - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Start ClickHouse daemon -# Arguments: -# $1 - Log file to check the startup message -# Returns: -# None -######################### -clickhouse_start_bg() { - local -r log_file="${1:-$CLICKHOUSE_LOG_FILE}" - info "Starting ClickHouse in background" - is_clickhouse_running && return - # This function is meant to be called for internal operations like the init scripts - local -r cmd=("${CLICKHOUSE_BASE_DIR}/bin/clickhouse-server") - local -r args=("--config-file=${CLICKHOUSE_CONF_FILE}" "--pid-file=${CLICKHOUSE_PID_FILE}" "--" "--listen_host=0.0.0.0") - if am_i_root; then - run_as_user "$CLICKHOUSE_DAEMON_USER" "${cmd[@]}" "${args[@]}" >"$log_file" 2>&1 & - else - "${cmd[@]}" "${args[@]}" >"$log_file" 2>&1 & - fi - if ! retry_while is_clickhouse_running; then - error "ClickHouse failed to start" - exit 1 - fi - wait_for_log_entry "Application: Ready for connections" "$log_file" - info "ClickHouse started successfully" -} - -######################## -# Run custom scripts -# Globals: -# CLICKHOUSE_* -# Arguments: -# $1 - 'init' or 'start' ('init' runs on first container start, 'start' runs everytime the container starts) -# Returns: -# None -######################### -clickhouse_custom_scripts() { - if [[ -n $(find /docker-entrypoint-"$1"db.d/ -type f -regex ".*\.sh") ]] && { [[ ! -f "$CLICKHOUSE_DATA_DIR/.user_scripts_initialized" ]] || [[ $1 == start ]]; }; then - clickhouse_start_bg "$CLICKHOUSE_LOG_DIR/clickhouse_init_scripts.log" - info "Loading user's custom files from /docker-entrypoint-$1db.d" - for f in /docker-entrypoint-"$1"db.d/*; do - debug "Executing $f" - case "$f" in - *.sh) - if [[ -x "$f" ]]; then - if ! "$f"; then - error "Failed executing $f" - return 1 - fi - else - warn "Sourcing $f as it is not executable by the current user, any error may cause initialization to fail" - . "$f" - fi - ;; - *) - warn "Skipping $f, supported formats are: .sh" - ;; - esac - done - touch "${CLICKHOUSE_DATA_DIR}/.user_scripts_initialized" - fi -} diff --git a/bitnami/clickhouse/24.8/debian-12/tags-info.yaml b/bitnami/clickhouse/24.8/debian-12/tags-info.yaml deleted file mode 100644 index c7569ad72b312..0000000000000 --- a/bitnami/clickhouse/24.8/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "24.8" -- 24.8-debian-12 -- 24.8.8 diff --git a/bitnami/contour/1.28/README.md b/bitnami/contour/1.28/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/contour/1.28/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/contour/1.28/debian-12/Dockerfile b/bitnami/contour/1.28/debian-12/Dockerfile deleted file mode 100644 index 626beb698fc74..0000000000000 --- a/bitnami/contour/1.28/debian-12/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T21:07:00Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/contour/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="1.28.7-debian-12-r3" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/contour" \ - org.opencontainers.image.title="contour" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="1.28.7" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "contour-1.28.7-2-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN ln -s /opt/bitnami/contour/bin/contour /bin/contour - -ENV APP_VERSION="1.28.7" \ - BITNAMI_APP_NAME="contour" \ - PATH="/opt/bitnami/contour/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "contour" ] diff --git a/bitnami/contour/1.28/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/contour/1.28/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index ff58bb3877ccb..0000000000000 --- a/bitnami/contour/1.28/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "contour": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.28.7-2" - } -} \ No newline at end of file diff --git a/bitnami/contour/1.28/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/contour/1.28/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/contour/1.28/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/contour/1.28/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/contour/1.28/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/contour/1.28/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/contour/1.28/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/contour/1.28/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/contour/1.28/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/contour/1.28/debian-12/tags-info.yaml b/bitnami/contour/1.28/debian-12/tags-info.yaml deleted file mode 100644 index cd6e3bea86421..0000000000000 --- a/bitnami/contour/1.28/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "1.28" -- 1.28-debian-12 -- 1.28.7 diff --git a/bitnami/contour/1.29/README.md b/bitnami/contour/1.29/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/contour/1.29/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/contour/1.29/debian-12/Dockerfile b/bitnami/contour/1.29/debian-12/Dockerfile deleted file mode 100644 index 01aa04da2527e..0000000000000 --- a/bitnami/contour/1.29/debian-12/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T21:09:11Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/contour/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="1.29.3-debian-12-r3" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/contour" \ - org.opencontainers.image.title="contour" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="1.29.3" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "contour-1.29.3-2-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN ln -s /opt/bitnami/contour/bin/contour /bin/contour - -ENV APP_VERSION="1.29.3" \ - BITNAMI_APP_NAME="contour" \ - PATH="/opt/bitnami/contour/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "contour" ] diff --git a/bitnami/contour/1.29/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/contour/1.29/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 420295b280beb..0000000000000 --- a/bitnami/contour/1.29/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "contour": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.29.3-2" - } -} \ No newline at end of file diff --git a/bitnami/contour/1.29/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/contour/1.29/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/contour/1.29/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/contour/1.29/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/contour/1.29/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/contour/1.29/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/contour/1.29/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/contour/1.29/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/contour/1.29/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/contour/1.29/debian-12/tags-info.yaml b/bitnami/contour/1.29/debian-12/tags-info.yaml deleted file mode 100644 index 24f9c78f2adbb..0000000000000 --- a/bitnami/contour/1.29/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "1.29" -- 1.29-debian-12 -- 1.29.3 diff --git a/bitnami/dotnet-sdk/9/README.md b/bitnami/dotnet-sdk/9/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/dotnet-sdk/9/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/dotnet-sdk/9/debian-12/Dockerfile b/bitnami/dotnet-sdk/9/debian-12/Dockerfile deleted file mode 100644 index 301c552db762f..0000000000000 --- a/bitnami/dotnet-sdk/9/debian-12/Dockerfile +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T19:08:38Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/dotnet-sdk/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="9.0.101-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/dotnet-sdk" \ - org.opencontainers.image.title="dotnet-sdk" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="9.0.101" - -ENV HOME="/app" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages build-essential ca-certificates curl git libcap2-bin libgcc-s1 libicu-dev liblttng-ust-dev libsqlite3-dev libssl-dev libstdc++6 pkg-config procps unzip wget -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "dotnet-sdk-9.0.101-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \ - sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \ - sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password - -COPY rootfs / -RUN /opt/bitnami/scripts/dotnet-sdk/postunpack.sh -ENV APP_VERSION="9.0.101" \ - BITNAMI_APP_NAME="dotnet-sdk" \ - DOTNET_CLI_HOME="/app" \ - DOTNET_ROOT="/opt/bitnami/dotnet-sdk/bin" \ - PATH="/opt/bitnami/dotnet-sdk/bin:$PATH" - -WORKDIR /app -ENTRYPOINT [ "/opt/bitnami/scripts/dotnet-sdk/entrypoint.sh" ] -CMD [ "/bin/bash" ] diff --git a/bitnami/dotnet-sdk/9/debian-12/docker-compose.yml b/bitnami/dotnet-sdk/9/debian-12/docker-compose.yml deleted file mode 100644 index 272f92046e15d..0000000000000 --- a/bitnami/dotnet-sdk/9/debian-12/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - dotnet-sdk: - image: docker.io/bitnami/dotnet-sdk:9 - command: ["tail", "-f", "/dev/null"] # To keep the container running - volumes: - - dotnet_data:/app -volumes: - dotnet_data: - driver: local diff --git a/bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index dabf2061ccccc..0000000000000 --- a/bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "dotnet-sdk": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "9.0.101-0" - } -} \ No newline at end of file diff --git a/bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/base/functions b/bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/base/functions deleted file mode 100644 index b8b756d42617a..0000000000000 --- a/bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/base/functions +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -[[ ${BASH_DEBUG:-false} = true ]] && set -x - -# Constants -MODULE="$(basename "$0")" -BITNAMI_PREFIX=/opt/bitnami - -# Color Palette -RESET='\033[0m' -BOLD='\033[1m' - -## Foreground -BLACK='\033[38;5;0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -BLUE='\033[38;5;4m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' -WHITE='\033[38;5;7m' - -## Background -ON_BLACK='\033[48;5;0m' -ON_RED='\033[48;5;1m' -ON_GREEN='\033[48;5;2m' -ON_YELLOW='\033[48;5;3m' -ON_BLUE='\033[48;5;4m' -ON_MAGENTA='\033[48;5;5m' -ON_CYAN='\033[48;5;6m' -ON_WHITE='\033[48;5;7m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - printf "%b\\n" "${*}" >&2 -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${NAMI_DEBUG:+${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")}${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - log "" - log "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - log "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - log "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - log "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - log "" -} diff --git a/bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/base/helpers b/bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/base/helpers deleted file mode 100644 index a6d909869eca3..0000000000000 --- a/bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/base/helpers +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -. /opt/bitnami/base/functions - -######################## -# Helper function to initialize a single nami module -# Arguments: -# Module to initialize -# Returns: -# None -# Description: -# Initialize an unpacked nami module with the `nami initialize` command. -# Command arguments can be specified as function argumnts after the module name. -# `--log-level trace` flag is added to the command if `NAMI_DEBUG` env variable exists. -# The log level can be overridden using the `NAMI_LOG_LEVEL` env variable. -######################### -nami_initialize_one() { - local module="${1:?module not specified}" - if nami inspect $module | grep -q '"lifecycle": "unpacked"'; then - local inputs= - if [[ -f "/${module}-inputs.json" ]]; then - inputs="--inputs-file=/${module}-inputs.json" - fi - nami ${NAMI_DEBUG:+--log-level ${NAMI_LOG_LEVEL:-trace}} initialize $module $inputs "${@:2}" - fi -} - -######################## -# Helper function to initialize one or more nami modules -# Arguments: -# Module to initialize -# Returns: -# None -######################### -nami_initialize() { - local module="${1:?module not specified}" - for module in "${@}"; do - nami_initialize_one $module - done -} diff --git a/bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/dotnet-sdk/9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/dotnet-sdk/9/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/dotnet-sdk/9/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/dotnet-sdk/9/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/dotnet-sdk/9/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/dotnet-sdk/9/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/dotnet-sdk/9/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/dotnet-sdk/9/debian-12/rootfs/opt/bitnami/scripts/dotnet-sdk/entrypoint.sh b/bitnami/dotnet-sdk/9/debian-12/rootfs/opt/bitnami/scripts/dotnet-sdk/entrypoint.sh deleted file mode 100755 index b9a949e6c0809..0000000000000 --- a/bitnami/dotnet-sdk/9/debian-12/rootfs/opt/bitnami/scripts/dotnet-sdk/entrypoint.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -e -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -. /opt/bitnami/base/functions -. /opt/bitnami/base/helpers - -print_welcome_page - -exec "$@" diff --git a/bitnami/dotnet-sdk/9/debian-12/rootfs/opt/bitnami/scripts/dotnet-sdk/postunpack.sh b/bitnami/dotnet-sdk/9/debian-12/rootfs/opt/bitnami/scripts/dotnet-sdk/postunpack.sh deleted file mode 100755 index 3d1ee85bfacef..0000000000000 --- a/bitnami/dotnet-sdk/9/debian-12/rootfs/opt/bitnami/scripts/dotnet-sdk/postunpack.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purpose -mkdir /app -chmod g+rwx /app -setcap CAP_NET_BIND_SERVICE=+eip /opt/bitnami/dotnet-sdk/bin/dotnet diff --git a/bitnami/dotnet-sdk/9/debian-12/tags-info.yaml b/bitnami/dotnet-sdk/9/debian-12/tags-info.yaml deleted file mode 100644 index 7de48de3a0dfc..0000000000000 --- a/bitnami/dotnet-sdk/9/debian-12/tags-info.yaml +++ /dev/null @@ -1,5 +0,0 @@ -rolling-tags: -- "9" -- 9-debian-12 -- 9.0.101 -- latest diff --git a/bitnami/dotnet/9/README.md b/bitnami/dotnet/9/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/dotnet/9/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/dotnet/9/debian-12/Dockerfile b/bitnami/dotnet/9/debian-12/Dockerfile deleted file mode 100644 index b9133f4c11bbc..0000000000000 --- a/bitnami/dotnet/9/debian-12/Dockerfile +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-25T00:24:13Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/dotnet/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="9.0.0-debian-12-r1" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/dotnet" \ - org.opencontainers.image.title="dotnet" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="9.0.0" - -ENV HOME="/app" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages build-essential ca-certificates curl git libcap2-bin libgcc-s1 libicu-dev liblttng-ust-dev libsqlite3-dev libssl-dev libstdc++6 pkg-config procps unzip wget -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "dotnet-9.0.0-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \ - sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \ - sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password - -COPY rootfs / -RUN /opt/bitnami/scripts/dotnet/postunpack.sh -ENV APP_VERSION="9.0.0" \ - BITNAMI_APP_NAME="dotnet" \ - DOTNET_CLI_HOME="/app" \ - DOTNET_ROOT="/opt/bitnami/dotnet/bin" \ - PATH="/opt/bitnami/dotnet/bin:$PATH" - -WORKDIR /app -ENTRYPOINT [ "/opt/bitnami/scripts/dotnet/entrypoint.sh" ] -CMD [ "/bin/bash" ] diff --git a/bitnami/dotnet/9/debian-12/docker-compose.yml b/bitnami/dotnet/9/debian-12/docker-compose.yml deleted file mode 100644 index f12f0b9dd77bc..0000000000000 --- a/bitnami/dotnet/9/debian-12/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - dotnet: - image: docker.io/bitnami/dotnet:9 - command: ["tail", "-f", "/dev/null"] # To keep the container running - volumes: - - dotnet_data:/app -volumes: - dotnet_data: - driver: local diff --git a/bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 797275e2d6e7c..0000000000000 --- a/bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "dotnet": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "9.0.0-0" - } -} \ No newline at end of file diff --git a/bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/base/functions b/bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/base/functions deleted file mode 100644 index b8b756d42617a..0000000000000 --- a/bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/base/functions +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -[[ ${BASH_DEBUG:-false} = true ]] && set -x - -# Constants -MODULE="$(basename "$0")" -BITNAMI_PREFIX=/opt/bitnami - -# Color Palette -RESET='\033[0m' -BOLD='\033[1m' - -## Foreground -BLACK='\033[38;5;0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -BLUE='\033[38;5;4m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' -WHITE='\033[38;5;7m' - -## Background -ON_BLACK='\033[48;5;0m' -ON_RED='\033[48;5;1m' -ON_GREEN='\033[48;5;2m' -ON_YELLOW='\033[48;5;3m' -ON_BLUE='\033[48;5;4m' -ON_MAGENTA='\033[48;5;5m' -ON_CYAN='\033[48;5;6m' -ON_WHITE='\033[48;5;7m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - printf "%b\\n" "${*}" >&2 -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${NAMI_DEBUG:+${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")}${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - log "" - log "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - log "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - log "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - log "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - log "" -} diff --git a/bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/base/helpers b/bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/base/helpers deleted file mode 100644 index a6d909869eca3..0000000000000 --- a/bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/base/helpers +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -. /opt/bitnami/base/functions - -######################## -# Helper function to initialize a single nami module -# Arguments: -# Module to initialize -# Returns: -# None -# Description: -# Initialize an unpacked nami module with the `nami initialize` command. -# Command arguments can be specified as function argumnts after the module name. -# `--log-level trace` flag is added to the command if `NAMI_DEBUG` env variable exists. -# The log level can be overridden using the `NAMI_LOG_LEVEL` env variable. -######################### -nami_initialize_one() { - local module="${1:?module not specified}" - if nami inspect $module | grep -q '"lifecycle": "unpacked"'; then - local inputs= - if [[ -f "/${module}-inputs.json" ]]; then - inputs="--inputs-file=/${module}-inputs.json" - fi - nami ${NAMI_DEBUG:+--log-level ${NAMI_LOG_LEVEL:-trace}} initialize $module $inputs "${@:2}" - fi -} - -######################## -# Helper function to initialize one or more nami modules -# Arguments: -# Module to initialize -# Returns: -# None -######################### -nami_initialize() { - local module="${1:?module not specified}" - for module in "${@}"; do - nami_initialize_one $module - done -} diff --git a/bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/dotnet/9/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/dotnet/9/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/dotnet/9/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/dotnet/9/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/dotnet/9/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/dotnet/9/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/dotnet/9/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/dotnet/9/debian-12/rootfs/opt/bitnami/scripts/dotnet/entrypoint.sh b/bitnami/dotnet/9/debian-12/rootfs/opt/bitnami/scripts/dotnet/entrypoint.sh deleted file mode 100755 index b9a949e6c0809..0000000000000 --- a/bitnami/dotnet/9/debian-12/rootfs/opt/bitnami/scripts/dotnet/entrypoint.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -e -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -. /opt/bitnami/base/functions -. /opt/bitnami/base/helpers - -print_welcome_page - -exec "$@" diff --git a/bitnami/dotnet/9/debian-12/rootfs/opt/bitnami/scripts/dotnet/postunpack.sh b/bitnami/dotnet/9/debian-12/rootfs/opt/bitnami/scripts/dotnet/postunpack.sh deleted file mode 100755 index 2f359c815a39b..0000000000000 --- a/bitnami/dotnet/9/debian-12/rootfs/opt/bitnami/scripts/dotnet/postunpack.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purpose -mkdir /app -chmod g+rwx /app -setcap CAP_NET_BIND_SERVICE=+eip /opt/bitnami/dotnet/bin/dotnet diff --git a/bitnami/dotnet/9/debian-12/tags-info.yaml b/bitnami/dotnet/9/debian-12/tags-info.yaml deleted file mode 100644 index 3bbb3bc79c382..0000000000000 --- a/bitnami/dotnet/9/debian-12/tags-info.yaml +++ /dev/null @@ -1,5 +0,0 @@ -rolling-tags: -- "9" -- 9-debian-12 -- 9.0.0 -- latest diff --git a/bitnami/drupal/10/README.md b/bitnami/drupal/10/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/drupal/10/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/drupal/10/debian-12/Dockerfile b/bitnami/drupal/10/debian-12/Dockerfile deleted file mode 100644 index 0aafec83f5299..0000000000000 --- a/bitnami/drupal/10/debian-12/Dockerfile +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-24T20:10:39Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/drupal/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="10.3.10-debian-12-r1" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/drupal" \ - org.opencontainers.image.title="drupal" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="10.3.10" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages acl ca-certificates curl gnupg libaudit1 libbrotli1 libbsd0 libbz2-1.0 libcap-ng0 libcom-err2 libcrypt1 libcurl4 libexpat1 libffi8 libfftw3-double3 libfontconfig1 libfreetype6 libgcc-s1 libgcrypt20 libglib2.0-0 libgmp10 libgnutls30 libgomp1 libgpg-error0 libgssapi-krb5-2 libhashkit2 libhogweed6 libicu72 libidn2-0 libjpeg62-turbo libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 liblcms2-2 libldap-2.5-0 liblqr-1-0 libltdl7 liblzma5 libmagickcore-6.q16-6 libmagickwand-6.q16-6 libmd0 libmemcached11 libncurses6 libnettle8 libnghttp2-14 libonig5 libp11-kit0 libpam0g libpcre2-8-0 libpcre3 libpng16-16 libpq5 libpsl5 libreadline8 librtmp1 libsasl2-2 libsodium23 libsqlite3-0 libssh2-1 libssl3 libstdc++6 libsybdb5 libtasn1-6 libtidy5deb1 libtinfo6 libunistring2 libuuid1 libwebp7 libx11-6 libxau6 libxcb1 libxdmcp6 libxext6 libxml2 libxslt1.1 libzip4 libzstd1 openssl procps unzip zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "render-template-1.0.7-7-linux-${OS_ARCH}-debian-12" \ - "php-8.2.26-0-linux-${OS_ARCH}-debian-12" \ - "apache-2.4.62-4-linux-${OS_ARCH}-debian-12" \ - "mysql-client-11.4.4-0-linux-${OS_ARCH}-debian-12" \ - "libphp-8.2.26-0-linux-${OS_ARCH}-debian-12" \ - "drupal-10.3.10-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/apache/postunpack.sh -RUN /opt/bitnami/scripts/php/postunpack.sh -RUN /opt/bitnami/scripts/apache-modphp/postunpack.sh -RUN /opt/bitnami/scripts/drupal/postunpack.sh -RUN /opt/bitnami/scripts/mysql-client/postunpack.sh -ENV APACHE_HTTPS_PORT_NUMBER="" \ - APACHE_HTTP_PORT_NUMBER="" \ - APP_VERSION="10.3.10" \ - BITNAMI_APP_NAME="drupal" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/php/bin:/opt/bitnami/php/sbin:/opt/bitnami/apache/bin:/opt/bitnami/mysql/bin:/opt/bitnami/drupal/vendor/bin:$PATH" - -EXPOSE 8080 8443 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/drupal/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/apache/run.sh" ] diff --git a/bitnami/drupal/10/debian-12/docker-compose.yml b/bitnami/drupal/10/debian-12/docker-compose.yml deleted file mode 100644 index 0098b2ed04623..0000000000000 --- a/bitnami/drupal/10/debian-12/docker-compose.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb: - image: docker.io/bitnami/mariadb:11.4 - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_USER=bn_drupal - - MARIADB_DATABASE=bitnami_drupal - volumes: - - 'mariadb_data:/bitnami/mariadb' - drupal: - image: docker.io/bitnami/drupal:10 - ports: - - '80:8080' - - '443:8443' - environment: - - DRUPAL_DATABASE_HOST=mariadb - - DRUPAL_DATABASE_PORT_NUMBER=3306 - - DRUPAL_DATABASE_USER=bn_drupal - - DRUPAL_DATABASE_NAME=bitnami_drupal - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - volumes: - - 'drupal_data:/bitnami/drupal' - depends_on: - - mariadb -volumes: - mariadb_data: - driver: local - drupal_data: - driver: local diff --git a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 69fe84549ed12..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "apache": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "2.4.62-4" - }, - "drupal": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "10.3.10-1" - }, - "libphp": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "8.2.26-0" - }, - "mysql-client": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "11.4.4-0" - }, - "php": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "8.2.26-0" - }, - "render-template": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.7-7" - } -} \ No newline at end of file diff --git a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/drupal/10/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/drupal/10/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/drupal/10/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/drupal/10/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/drupal/10/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/apache/conf/deflate.conf b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/apache/conf/deflate.conf deleted file mode 100644 index 6016f8fbe5829..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/apache/conf/deflate.conf +++ /dev/null @@ -1,5 +0,0 @@ - - AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript - AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript - AddOutputFilterByType DEFLATE application/rss+xml - diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/apache/conf/vhosts/00_status-vhost.conf b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/apache/conf/vhosts/00_status-vhost.conf deleted file mode 100644 index c0838da2a4e53..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/apache/conf/vhosts/00_status-vhost.conf +++ /dev/null @@ -1,7 +0,0 @@ - - ServerName status.localhost - - Require local - SetHandler server-status - - diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache-env.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache-env.sh deleted file mode 100644 index b8762c6583591..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache-env.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for apache - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-apache}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -apache_env_vars=( - APACHE_HTTP_PORT_NUMBER - APACHE_HTTPS_PORT_NUMBER - APACHE_SERVER_TOKENS - APACHE_HTTP_PORT - APACHE_HTTPS_PORT -) -for env_var in "${apache_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset apache_env_vars -export WEB_SERVER_TYPE="apache" - -# Paths -export APACHE_BASE_DIR="${BITNAMI_ROOT_DIR}/apache" -export APACHE_BIN_DIR="${APACHE_BASE_DIR}/bin" -export APACHE_CONF_DIR="${APACHE_BASE_DIR}/conf" -export APACHE_DEFAULT_CONF_DIR="${APACHE_BASE_DIR}/conf.default" -export APACHE_HTDOCS_DIR="${APACHE_BASE_DIR}/htdocs" -export APACHE_TMP_DIR="${APACHE_BASE_DIR}/var/run" -export APACHE_LOGS_DIR="${APACHE_BASE_DIR}/logs" -export APACHE_VHOSTS_DIR="${APACHE_CONF_DIR}/vhosts" -export APACHE_HTACCESS_DIR="${APACHE_VHOSTS_DIR}/htaccess" -export APACHE_CONF_FILE="${APACHE_CONF_DIR}/httpd.conf" -export APACHE_PID_FILE="${APACHE_TMP_DIR}/httpd.pid" -export PATH="${APACHE_BIN_DIR}:${BITNAMI_ROOT_DIR}/common/bin:${PATH}" - -# System users (when running with a privileged user) -export APACHE_DAEMON_USER="daemon" -export WEB_SERVER_DAEMON_USER="$APACHE_DAEMON_USER" -export APACHE_DAEMON_GROUP="daemon" -export WEB_SERVER_DAEMON_GROUP="$APACHE_DAEMON_GROUP" -export WEB_SERVER_GROUP="$APACHE_DAEMON_GROUP" - -# Apache configuration -export APACHE_DEFAULT_HTTP_PORT_NUMBER="8080" -export WEB_SERVER_DEFAULT_HTTP_PORT_NUMBER="$APACHE_DEFAULT_HTTP_PORT_NUMBER" # only used at build time -export APACHE_DEFAULT_HTTPS_PORT_NUMBER="8443" -export WEB_SERVER_DEFAULT_HTTPS_PORT_NUMBER="$APACHE_DEFAULT_HTTPS_PORT_NUMBER" # only used at build time -APACHE_HTTP_PORT_NUMBER="${APACHE_HTTP_PORT_NUMBER:-"${APACHE_HTTP_PORT:-}"}" -export APACHE_HTTP_PORT_NUMBER="${APACHE_HTTP_PORT_NUMBER:-}" -export WEB_SERVER_HTTP_PORT_NUMBER="$APACHE_HTTP_PORT_NUMBER" -APACHE_HTTPS_PORT_NUMBER="${APACHE_HTTPS_PORT_NUMBER:-"${APACHE_HTTPS_PORT:-}"}" -export APACHE_HTTPS_PORT_NUMBER="${APACHE_HTTPS_PORT_NUMBER:-}" -export WEB_SERVER_HTTPS_PORT_NUMBER="$APACHE_HTTPS_PORT_NUMBER" -export APACHE_SERVER_TOKENS="${APACHE_SERVER_TOKENS:-Prod}" - -# Custom environment variables may be defined below diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache-modphp/postunpack.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache-modphp/postunpack.sh deleted file mode 100755 index f2303ab692fbf..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache-modphp/postunpack.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libversion.sh -. /opt/bitnami/scripts/libapache.sh - -# Load Apache environment -. /opt/bitnami/scripts/apache-env.sh -. /opt/bitnami/scripts/php-env.sh - -# Enable required Apache modules -apache_enable_module "mpm_prefork_module" -php_version="$("${PHP_BIN_DIR}/php" -v | grep ^PHP | cut -d' ' -f2))" -php_major_version="$(get_sematic_version "$php_version" 1)" -if [[ "$php_major_version" -eq "8" ]]; then - apache_enable_module "php_module" "modules/libphp.so" -else - apache_enable_module "php${php_major_version}_module" "modules/libphp${php_major_version}.so" -fi - -# Disable incompatible Apache modules -apache_disable_module "mpm_event_module" - -# Write Apache configuration -apache_php_conf_file="${APACHE_CONF_DIR}/bitnami/php.conf" -cat > "$apache_php_conf_file" < - {{server_name_configuration}} - {{additional_http_configuration}} - {{additional_configuration}} - diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-https-vhost.conf.tpl b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-https-vhost.conf.tpl deleted file mode 100644 index 589538513c9c9..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-https-vhost.conf.tpl +++ /dev/null @@ -1,10 +0,0 @@ -{{https_listen_configuration}} -{{before_vhost_configuration}} - - {{server_name_configuration}} - SSLEngine on - SSLCertificateFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.crt" - SSLCertificateKeyFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.key" - {{additional_https_configuration}} - {{additional_configuration}} - diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-prefix.conf.tpl b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-prefix.conf.tpl deleted file mode 100644 index c895e537502a2..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-generic-prefix.conf.tpl +++ /dev/null @@ -1 +0,0 @@ -{{additional_configuration}} diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-http-vhost.conf.tpl b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-http-vhost.conf.tpl deleted file mode 100644 index 96be8f8227715..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-http-vhost.conf.tpl +++ /dev/null @@ -1,15 +0,0 @@ -{{http_listen_configuration}} -{{before_vhost_configuration}} - - {{server_name_configuration}} - DocumentRoot {{document_root}} - - Options -Indexes +FollowSymLinks -MultiViews - AllowOverride {{allow_override}} - {{acl_configuration}} - {{extra_directory_configuration}} - - {{additional_http_configuration}} - {{additional_configuration}} - {{htaccess_include}} - diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-https-vhost.conf.tpl b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-https-vhost.conf.tpl deleted file mode 100644 index 1ad938929726e..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-https-vhost.conf.tpl +++ /dev/null @@ -1,18 +0,0 @@ -{{https_listen_configuration}} -{{before_vhost_configuration}} - - {{server_name_configuration}} - SSLEngine on - SSLCertificateFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.crt" - SSLCertificateKeyFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.key" - DocumentRoot {{document_root}} - - Options -Indexes +FollowSymLinks -MultiViews - AllowOverride {{allow_override}} - {{acl_configuration}} - {{extra_directory_configuration}} - - {{additional_https_configuration}} - {{additional_configuration}} - {{htaccess_include}} - diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-prefix.conf.tpl b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-prefix.conf.tpl deleted file mode 100644 index fc0f6c2181961..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-prefix.conf.tpl +++ /dev/null @@ -1,9 +0,0 @@ -{{prefix_conf}} - - Options -Indexes +FollowSymLinks -MultiViews - AllowOverride {{allow_override}} - {{acl_configuration}} - {{extra_directory_configuration}} - -{{additional_configuration}} -{{htaccess_include}} diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-http-vhost.conf.tpl b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-http-vhost.conf.tpl deleted file mode 100644 index 9440b89d28bfa..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-http-vhost.conf.tpl +++ /dev/null @@ -1,11 +0,0 @@ -{{http_listen_configuration}} -{{before_vhost_configuration}} - - {{server_name_configuration}} - {{proxy_configuration}} - {{proxy_http_configuration}} - ProxyPass / {{proxy_address}} - ProxyPassReverse / {{proxy_address}} - {{additional_http_configuration}} - {{additional_configuration}} - diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-https-vhost.conf.tpl b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-https-vhost.conf.tpl deleted file mode 100644 index 577cd461eb9dc..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-https-vhost.conf.tpl +++ /dev/null @@ -1,14 +0,0 @@ -{{https_listen_configuration}} -{{before_vhost_configuration}} - - {{server_name_configuration}} - SSLEngine on - SSLCertificateFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.crt" - SSLCertificateKeyFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.key" - {{proxy_configuration}} - {{proxy_https_configuration}} - ProxyPass / {{proxy_address}} - ProxyPassReverse / {{proxy_address}} - {{additional_https_configuration}} - {{additional_configuration}} - diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-prefix.conf.tpl b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-prefix.conf.tpl deleted file mode 100644 index 7ac08b131680b..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-proxy-prefix.conf.tpl +++ /dev/null @@ -1,11 +0,0 @@ -{{prefix_conf}} - - Options -Indexes +FollowSymLinks -MultiViews - AllowOverride {{allow_override}} - {{acl_configuration}} - {{proxy_configuration}} - ProxyPass / {{proxy_address}} - ProxyPassReverse / {{proxy_address}} - {{extra_directory_configuration}} - -{{additional_configuration}} diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-http-vhost.conf.tpl b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-http-vhost.conf.tpl deleted file mode 100644 index f518c7d42aab8..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-http-vhost.conf.tpl +++ /dev/null @@ -1,16 +0,0 @@ -{{http_listen_configuration}} -{{before_vhost_configuration}} -PassengerPreStart http://localhost:{{http_port}}/ - - {{server_name_configuration}} - DocumentRoot {{document_root}} - - Options -Indexes +FollowSymLinks -MultiViews - AllowOverride {{allow_override}} - {{acl_configuration}} - PassengerEnabled on - {{extra_directory_configuration}} - - {{additional_http_configuration}} - {{additional_configuration}} - diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-https-vhost.conf.tpl b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-https-vhost.conf.tpl deleted file mode 100644 index 5aae54c37d3ba..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-https-vhost.conf.tpl +++ /dev/null @@ -1,19 +0,0 @@ -{{https_listen_configuration}} -{{before_vhost_configuration}} -PassengerPreStart https://localhost:{{https_port}}/ - - {{server_name_configuration}} - SSLEngine on - SSLCertificateFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.crt" - SSLCertificateKeyFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.key" - DocumentRoot {{document_root}} - - Options -Indexes +FollowSymLinks -MultiViews - AllowOverride {{allow_override}} - {{acl_configuration}} - PassengerEnabled on - {{extra_directory_configuration}} - - {{additional_https_configuration}} - {{additional_configuration}} - diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-prefix.conf.tpl b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-prefix.conf.tpl deleted file mode 100644 index 2242d656b5a83..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/app-ruby-passenger-prefix.conf.tpl +++ /dev/null @@ -1,9 +0,0 @@ -{{prefix_conf}} - - Options -Indexes +FollowSymLinks -MultiViews - AllowOverride {{allow_override}} - {{acl_configuration}} - PassengerEnabled on - {{extra_directory_configuration}} - -{{additional_configuration}} diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami-ssl.conf.tpl b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami-ssl.conf.tpl deleted file mode 100644 index f1d31ed3ecc35..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami-ssl.conf.tpl +++ /dev/null @@ -1,29 +0,0 @@ -# Default SSL Virtual Host configuration. - - - LoadModule ssl_module modules/mod_ssl.so - - -Listen 443 -SSLProtocol all -SSLv2 -SSLv3 -SSLHonorCipherOrder on -SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !EDH !RC4" -SSLPassPhraseDialog builtin -SSLSessionCache "shmcb:{{APACHE_LOGS_DIR}}/ssl_scache(512000)" -SSLSessionCacheTimeout 300 - - - DocumentRoot "{{APACHE_BASE_DIR}}/htdocs" - SSLEngine on - SSLCertificateFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.crt" - SSLCertificateKeyFile "{{APACHE_CONF_DIR}}/bitnami/certs/server.key" - - - Options Indexes FollowSymLinks - AllowOverride All - Require all granted - - - # Error Documents - ErrorDocument 503 /503.html - diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami.conf.tpl b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami.conf.tpl deleted file mode 100644 index 75a255c3efee8..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/bitnami-templates/bitnami.conf.tpl +++ /dev/null @@ -1,17 +0,0 @@ -# Default Virtual Host configuration. - -# Let Apache know we're behind a SSL reverse proxy -SetEnvIf X-Forwarded-Proto https HTTPS=on - - - DocumentRoot "{{APACHE_BASE_DIR}}/htdocs" - - Options Indexes FollowSymLinks - AllowOverride All - Require all granted - - - # Error Documents - ErrorDocument 503 /503.html - - diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/entrypoint.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/entrypoint.sh deleted file mode 100755 index f43c6c4fe59c6..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/entrypoint.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -#set -o xtrace - -# Load libraries -. /opt/bitnami/scripts/libapache.sh -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -# Load Apache environment -. /opt/bitnami/scripts/apache-env.sh - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/apache/conf) -debug "Copying files from $APACHE_DEFAULT_CONF_DIR to $APACHE_CONF_DIR" -cp -nr "$APACHE_DEFAULT_CONF_DIR"/. "$APACHE_CONF_DIR" - -if [[ "$*" == *"/opt/bitnami/scripts/apache/run.sh"* ]]; then - info "** Starting Apache setup **" - /opt/bitnami/scripts/apache/setup.sh - info "** Apache setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/postunpack.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/postunpack.sh deleted file mode 100755 index 5e39a42f625fa..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/postunpack.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libapache.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh - -######################## -# Sets up the default Bitnami configuration -# Globals: -# APACHE_* -# Arguments: -# None -# Returns: -# None -######################### -apache_setup_bitnami_config() { - local template_dir="${BITNAMI_ROOT_DIR}/scripts/apache/bitnami-templates" - - # Enable Apache modules - local -a modules_to_enable=( - "deflate_module" - "negotiation_module" - "proxy[^\s]*_module" - "rewrite_module" - "slotmem_shm_module" - "socache_shmcb_module" - "ssl_module" - "status_module" - "version_module" - ) - for module in "${modules_to_enable[@]}"; do - apache_enable_module "$module" - done - - # Disable Apache modules - local -a modules_to_disable=( - "http2_module" - "proxy_hcheck_module" - "proxy_html_module" - "proxy_http2_module" - ) - for module in "${modules_to_disable[@]}"; do - apache_disable_module "$module" - done - - # Bitnami customizations - ensure_dir_exists "${APACHE_CONF_DIR}/bitnami" - render-template "${template_dir}/bitnami.conf.tpl" > "${APACHE_CONF_DIR}/bitnami/bitnami.conf" - render-template "${template_dir}/bitnami-ssl.conf.tpl" > "${APACHE_CONF_DIR}/bitnami/bitnami-ssl.conf" - - # Add new configuration only once, to avoid a second postunpack run breaking Apache - local apache_conf_add - apache_conf_add="$(cat <>"$APACHE_CONF_FILE" < - RequestHeader unset Proxy - -EOF - fi -} - -# Load Apache environment -. /opt/bitnami/scripts/apache-env.sh - -apache_setup_bitnami_config - -# Ensure non-root user has write permissions on a set of directories -chmod g+w "$APACHE_BASE_DIR" -for dir in "$APACHE_TMP_DIR" "$APACHE_CONF_DIR" "$APACHE_LOGS_DIR" "$APACHE_VHOSTS_DIR" "$APACHE_HTACCESS_DIR" "$APACHE_HTDOCS_DIR" "$APACHE_DEFAULT_CONF_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# Create 'apache2' symlink pointing to the 'apache' directory, for compatibility with Bitnami Docs guides -ln -sf apache "${BITNAMI_ROOT_DIR}/apache2" - -ln -sf "/dev/stdout" "${APACHE_LOGS_DIR}/access_log" -ln -sf "/dev/stderr" "${APACHE_LOGS_DIR}/error_log" - -# This file is necessary for avoiding the error -# "unable to write random state" -# Source: https://stackoverflow.com/questions/94445/using-openssl-what-does-unable-to-write-random-state-mean - -touch /.rnd && chmod g+rw /.rnd - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "$APACHE_CONF_DIR"/* "$APACHE_DEFAULT_CONF_DIR" diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/reload.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/reload.sh deleted file mode 100755 index b5c43c48391c1..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/reload.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libapache.sh -. /opt/bitnami/scripts/liblog.sh - -# Load Apache environment -. /opt/bitnami/scripts/apache-env.sh - -info "** Reloading Apache configuration **" -exec "${APACHE_BIN_DIR}/apachectl" -k graceful diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/restart.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/restart.sh deleted file mode 100755 index 7735dea1e9626..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/restart.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libapache.sh - -# Load Apache environment variables -. /opt/bitnami/scripts/apache-env.sh - -/opt/bitnami/scripts/apache/stop.sh -/opt/bitnami/scripts/apache/start.sh diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/run.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/run.sh deleted file mode 100755 index 23f1e3179c505..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/run.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libapache.sh -. /opt/bitnami/scripts/liblog.sh - -# Load Apache environment -. /opt/bitnami/scripts/apache-env.sh - -info "** Starting Apache **" -exec "${APACHE_BIN_DIR}/httpd" -f "$APACHE_CONF_FILE" -D "FOREGROUND" diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/setup.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/setup.sh deleted file mode 100755 index c1f6b373c1cd6..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/setup.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libapache.sh - -# Load Apache environment -. /opt/bitnami/scripts/apache-env.sh - -# Ensure Apache environment variables are valid -apache_validate - -# Ensure Apache daemon user exists when running as 'root' -am_i_root && ensure_user_exists "$APACHE_DAEMON_USER" --group "$APACHE_DAEMON_GROUP" - -if ! is_dir_empty "$APACHE_DEFAULT_CONF_DIR"; then - # We add the copy from default config in the initialize function for web applications - # that make use of the Apache setup.sh script - debug "Copying files from $APACHE_DEFAULT_CONF_DIR to $APACHE_CONF_DIR" - cp -nr "$APACHE_DEFAULT_CONF_DIR"/. "$APACHE_CONF_DIR" -fi -# Generate SSL certs (without a passphrase) -ensure_dir_exists "${APACHE_CONF_DIR}/bitnami/certs" -if [[ ! -f "${APACHE_CONF_DIR}/bitnami/certs/server.crt" ]]; then - info "Generating sample certificates" - SSL_KEY_FILE="${APACHE_CONF_DIR}/bitnami/certs/server.key" - SSL_CERT_FILE="${APACHE_CONF_DIR}/bitnami/certs/server.crt" - SSL_CSR_FILE="${APACHE_CONF_DIR}/bitnami/certs/server.csr" - SSL_SUBJ="/CN=example.com" - SSL_EXT="subjectAltName=DNS:example.com,DNS:www.example.com,IP:127.0.0.1" - rm -f "$SSL_KEY_FILE" "$SSL_CERT_FILE" - openssl genrsa -out "$SSL_KEY_FILE" 4096 - # OpenSSL version 1.0.x does not use the same parameters as OpenSSL >= 1.1.x - if [[ "$(openssl version | grep -oE "[0-9]+\.[0-9]+")" == "1.0" ]]; then - openssl req -new -sha256 -out "$SSL_CSR_FILE" -key "$SSL_KEY_FILE" -nodes -subj "$SSL_SUBJ" - else - openssl req -new -sha256 -out "$SSL_CSR_FILE" -key "$SSL_KEY_FILE" -nodes -subj "$SSL_SUBJ" -addext "$SSL_EXT" - fi - openssl x509 -req -sha256 -in "$SSL_CSR_FILE" -signkey "$SSL_KEY_FILE" -out "$SSL_CERT_FILE" -days 1825 -extfile <(echo -n "$SSL_EXT") - rm -f "$SSL_CSR_FILE" -fi -# Load SSL configuration -if [[ -f "${APACHE_CONF_DIR}/bitnami/bitnami.conf" ]] && [[ -f "${APACHE_CONF_DIR}/bitnami/bitnami-ssl.conf" ]]; then - ensure_apache_configuration_exists "Include \"${APACHE_CONF_DIR}/bitnami/bitnami-ssl.conf\"" "bitnami-ssl\.conf" "${APACHE_CONF_DIR}/bitnami/bitnami.conf" -fi - -# Copy vhosts files -if ! is_dir_empty "/vhosts"; then - info "Found mounted virtual hosts in '/vhosts'. Copying them to '${APACHE_BASE_DIR}/conf/vhosts'" - cp -Lr "/vhosts/." "${APACHE_VHOSTS_DIR}" -fi - -# Mount certificate files -if ! is_dir_empty "${APACHE_BASE_DIR}/certs"; then - warn "The directory '${APACHE_BASE_DIR}/certs' was externally mounted. This is a legacy configuration and will be deprecated soon. Please mount certificate files at '/certs' instead. Find an example at: https://github.com/bitnami/containers/tree/main/bitnami/apache#using-custom-ssl-certificates" - warn "Restoring certificates at '${APACHE_BASE_DIR}/certs' to '${APACHE_CONF_DIR}/bitnami/certs'" - rm -rf "${APACHE_CONF_DIR}/bitnami/certs" - ln -sf "${APACHE_BASE_DIR}/certs" "${APACHE_CONF_DIR}/bitnami/certs" -elif ! is_dir_empty "/certs"; then - info "Mounting certificates files from '/certs'" - rm -rf "${APACHE_CONF_DIR}/bitnami/certs" - ln -sf "/certs" "${APACHE_CONF_DIR}/bitnami/certs" -fi - -# Mount application files -if ! is_dir_empty "/app"; then - info "Mounting application files from '/app'" - rm -rf "$APACHE_HTDOCS_DIR" - ln -sf "/app" "$APACHE_HTDOCS_DIR" -fi - -# Restore persisted configuration files (deprecated) -if ! is_dir_empty "/bitnami/apache/conf"; then - warn "The directory '/bitnami/apache/conf' was externally mounted. This is a legacy configuration and will be deprecated soon. Please mount certificate files at '${APACHE_CONF_DIR}' instead. Find an example at: https://github.com/bitnami/containers/tree/main/bitnami/apache#full-configuration" - warn "Restoring configuration at '/bitnami/apache/conf' to '${APACHE_CONF_DIR}'" - rm -rf "$APACHE_CONF_DIR" - ln -sf "/bitnami/apache/conf" "$APACHE_CONF_DIR" -fi - -# Update ports in configuration -[[ -n "$APACHE_HTTP_PORT_NUMBER" ]] && info "Configuring the HTTP port" && apache_configure_http_port "$APACHE_HTTP_PORT_NUMBER" -[[ -n "$APACHE_HTTPS_PORT_NUMBER" ]] && info "Configuring the HTTPS port" && apache_configure_https_port "$APACHE_HTTPS_PORT_NUMBER" - -# Configure ServerTokens with user values -[[ -n "$APACHE_SERVER_TOKENS" ]] && info "Configuring Apache ServerTokens directive" && apache_configure_server_tokens "$APACHE_SERVER_TOKENS" - -# Fix logging issue when running as root -! am_i_root || chmod o+w "$(readlink /dev/stdout)" "$(readlink /dev/stderr)" diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/start.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/start.sh deleted file mode 100755 index b47c8aacba892..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/start.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libapache.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh - -# Load Apache environment variables -. /opt/bitnami/scripts/apache-env.sh - -error_code=0 - -if is_apache_not_running; then - "${APACHE_BIN_DIR}/httpd" -f "$APACHE_CONF_FILE" - if ! retry_while "is_apache_running"; then - error "apache did not start" - error_code=1 - else - info "apache started" - fi -else - info "apache is already running" -fi - -exit "$error_code" diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/status.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/status.sh deleted file mode 100755 index db8c132c0e826..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/status.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libapache.sh -. /opt/bitnami/scripts/liblog.sh - -# Load Apache environment variables -. /opt/bitnami/scripts/apache-env.sh - -if is_apache_running; then - info "apache is already running" -else - info "apache is not running" -fi diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/stop.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/stop.sh deleted file mode 100755 index adc6613b0a9e1..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/apache/stop.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libapache.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh - -# Load Apache environment variables -. /opt/bitnami/scripts/apache-env.sh - -error_code=0 - -if is_apache_running; then - BITNAMI_QUIET=1 apache_stop - if ! retry_while "is_apache_not_running"; then - error "apache could not be stopped" - error_code=1 - else - info "apache stopped" - fi -else - info "apache is not running" -fi - -exit "$error_code" diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal-env.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal-env.sh deleted file mode 100644 index 92e7e7d46d39e..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal-env.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for drupal - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-drupal}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -drupal_env_vars=( - DRUPAL_DATA_TO_PERSIST - DRUPAL_PROFILE - DRUPAL_SITE_NAME - DRUPAL_SKIP_BOOTSTRAP - DRUPAL_ENABLE_MODULES - DRUPAL_CONFIG_SYNC_DIR - DRUPAL_HASH_SALT - DRUPAL_USERNAME - DRUPAL_PASSWORD - DRUPAL_EMAIL - DRUPAL_SMTP_HOST - DRUPAL_SMTP_PORT_NUMBER - DRUPAL_SMTP_USER - DRUPAL_SMTP_PASSWORD - DRUPAL_SMTP_PROTOCOL - DRUPAL_DATABASE_HOST - DRUPAL_DATABASE_PORT_NUMBER - DRUPAL_DATABASE_NAME - DRUPAL_DATABASE_USER - DRUPAL_DATABASE_PASSWORD - DRUPAL_DATABASE_TLS_CA_FILE - SMTP_HOST - SMTP_PORT - DRUPAL_SMTP_PORT - SMTP_USER - SMTP_PASSWORD - SMTP_PROTOCOL - MARIADB_HOST - MARIADB_PORT_NUMBER -) -for env_var in "${drupal_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset drupal_env_vars - -# Paths -export DRUPAL_BASE_DIR="${BITNAMI_ROOT_DIR}/drupal" -export DRUPAL_CONF_FILE="${DRUPAL_BASE_DIR}/sites/default/settings.php" -export DRUPAL_MODULES_DIR="${DRUPAL_BASE_DIR}/modules" - -# Drupal persistence configuration -export DRUPAL_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/drupal" -export DRUPAL_MOUNTED_CONF_FILE="${DRUPAL_VOLUME_DIR}/settings.php" -export DRUPAL_DATA_TO_PERSIST="${DRUPAL_DATA_TO_PERSIST:-sites/ themes/ modules/ profiles/}" - -# Drupal configuration -export DRUPAL_PROFILE="${DRUPAL_PROFILE:-standard}" # only used during the first initialization -export DRUPAL_SITE_NAME="${DRUPAL_SITE_NAME:-My blog}" # only used during the first initialization -export DRUPAL_SKIP_BOOTSTRAP="${DRUPAL_SKIP_BOOTSTRAP:-}" # only used during the first initialization -export DRUPAL_ENABLE_MODULES="${DRUPAL_ENABLE_MODULES:-}" # only used during the first initialization -export DRUPAL_CONFIG_SYNC_DIR="${DRUPAL_CONFIG_SYNC_DIR:-}" # only used during the first initialization -export DRUPAL_HASH_SALT="${DRUPAL_HASH_SALT:-}" # only used during the first initialization - -# Drupal credentials -export DRUPAL_USERNAME="${DRUPAL_USERNAME:-user}" # only used during the first initialization -export DRUPAL_PASSWORD="${DRUPAL_PASSWORD:-bitnami}" # only used during the first initialization -export DRUPAL_EMAIL="${DRUPAL_EMAIL:-user@example.com}" # only used during the first initialization - -# Drupal SMTP credentials -DRUPAL_SMTP_HOST="${DRUPAL_SMTP_HOST:-"${SMTP_HOST:-}"}" -export DRUPAL_SMTP_HOST="${DRUPAL_SMTP_HOST:-}" # only used during the first initialization -DRUPAL_SMTP_PORT_NUMBER="${DRUPAL_SMTP_PORT_NUMBER:-"${SMTP_PORT:-}"}" -DRUPAL_SMTP_PORT_NUMBER="${DRUPAL_SMTP_PORT_NUMBER:-"${DRUPAL_SMTP_PORT:-}"}" -export DRUPAL_SMTP_PORT_NUMBER="${DRUPAL_SMTP_PORT_NUMBER:-25}" # only used during the first initialization -DRUPAL_SMTP_USER="${DRUPAL_SMTP_USER:-"${SMTP_USER:-}"}" -export DRUPAL_SMTP_USER="${DRUPAL_SMTP_USER:-}" # only used during the first initialization -DRUPAL_SMTP_PASSWORD="${DRUPAL_SMTP_PASSWORD:-"${SMTP_PASSWORD:-}"}" -export DRUPAL_SMTP_PASSWORD="${DRUPAL_SMTP_PASSWORD:-}" # only used during the first initialization -DRUPAL_SMTP_PROTOCOL="${DRUPAL_SMTP_PROTOCOL:-"${SMTP_PROTOCOL:-}"}" -export DRUPAL_SMTP_PROTOCOL="${DRUPAL_SMTP_PROTOCOL:-standard}" # only used during the first initialization - -# Database configuration -export DRUPAL_DEFAULT_DATABASE_HOST="mariadb" # only used at build time -DRUPAL_DATABASE_HOST="${DRUPAL_DATABASE_HOST:-"${MARIADB_HOST:-}"}" -export DRUPAL_DATABASE_HOST="${DRUPAL_DATABASE_HOST:-$DRUPAL_DEFAULT_DATABASE_HOST}" # only used during the first initialization -DRUPAL_DATABASE_PORT_NUMBER="${DRUPAL_DATABASE_PORT_NUMBER:-"${MARIADB_PORT_NUMBER:-}"}" -export DRUPAL_DATABASE_PORT_NUMBER="${DRUPAL_DATABASE_PORT_NUMBER:-3306}" # only used during the first initialization -export DRUPAL_DATABASE_NAME="${DRUPAL_DATABASE_NAME:-bitnami_drupal}" # only used during the first initialization -export DRUPAL_DATABASE_USER="${DRUPAL_DATABASE_USER:-bn_drupal}" # only used during the first initialization -export DRUPAL_DATABASE_PASSWORD="${DRUPAL_DATABASE_PASSWORD:-}" # only used during the first initialization -export DRUPAL_DATABASE_TLS_CA_FILE="${DRUPAL_DATABASE_TLS_CA_FILE:-}" # only used during the first initialization - -# PHP configuration -export PHP_DEFAULT_MEMORY_LIMIT="256M" # only used at build time - -# Custom environment variables may be defined below diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal/entrypoint.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal/entrypoint.sh deleted file mode 100755 index 07b42659f520b..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal/entrypoint.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load Drupal environment -. /opt/bitnami/scripts/drupal-env.sh - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libwebserver.sh - -print_welcome_page - -if [[ "$1" = "/opt/bitnami/scripts/$(web_server_type)/run.sh" ]]; then - info "** Starting Drupal setup **" - /opt/bitnami/scripts/"$(web_server_type)"/setup.sh - /opt/bitnami/scripts/php/setup.sh - /opt/bitnami/scripts/mysql-client/setup.sh - /opt/bitnami/scripts/drupal/setup.sh - /post-init.sh - info "** Drupal setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal/postunpack.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal/postunpack.sh deleted file mode 100755 index a5c980b0d5b0b..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal/postunpack.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1090,SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load Drupal environment -. /opt/bitnami/scripts/drupal-env.sh - -# Load PHP environment for 'php_conf_set' (after 'drupal-env.sh' so that MODULE is not set to a wrong value) -. /opt/bitnami/scripts/php-env.sh - -# Load libraries -. /opt/bitnami/scripts/libdrupal.sh -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libphp.sh -. /opt/bitnami/scripts/libwebserver.sh - -# Load web server environment and functions (after Drupal environment file so MODULE is not set to a wrong value) -. "/opt/bitnami/scripts/$(web_server_type)-env.sh" - -# Enable Drupal configuration file -[[ ! -f "$DRUPAL_CONF_FILE" ]] && cp "${DRUPAL_BASE_DIR}/sites/default/default.settings.php" "$DRUPAL_CONF_FILE" - -# Create .htaccess file to avoid warning in Drupal administration panel -drupal_fix_htaccess_warning_protection - -# Ensure the Drupal base directory exists and has proper permissions -info "Configuring file permissions for Drupal" -for dir in "$DRUPAL_BASE_DIR" "${DRUPAL_BASE_DIR}/sites/default/files" "$DRUPAL_VOLUME_DIR" "${HOME}/.drush"; do - ensure_dir_exists "$dir" - configure_permissions_ownership "$dir" -d "775" -f "664" -done -for dir in "${DRUPAL_BASE_DIR}/themes" "${DRUPAL_BASE_DIR}/modules" "${DRUPAL_BASE_DIR}/sites/default/files"; do - ensure_dir_exists "$dir" - configure_permissions_ownership "$dir" -u "$WEB_SERVER_DAEMON_USER" -g "root" -done -chown "$WEB_SERVER_DAEMON_USER" "${DRUPAL_BASE_DIR}/sites/default" -chown "$WEB_SERVER_DAEMON_USER" "$DRUPAL_CONF_FILE" -for script in "${DRUPAL_BASE_DIR}/vendor/bin/drush" "${DRUPAL_BASE_DIR}/vendor/drush/drush/drush" "${DRUPAL_BASE_DIR}/vendor/bin/drush.php" "${DRUPAL_BASE_DIR}/vendor/drush/drush/drush.launcher" "${DRUPAL_BASE_DIR}/vendor/bin/drush.launcher"; do - [[ -f "$script" ]] && chmod +x "$script" -done - -# Configure Drupal based on build-time defaults -drupal_conf_set "\$settings['trusted_host_patterns']" "array('^.*$')" yes - -# Configure required PHP options for application to work properly, based on build-time defaults -info "Configuring default PHP options for Drupal" -php_conf_set memory_limit "$PHP_DEFAULT_MEMORY_LIMIT" - -# Enable default web server configuration for Drupal -info "Creating default web server configuration for Drupal" -web_server_validate -ensure_web_server_app_configuration_exists "drupal" --type php - -# Re-create .htaccess file after being moved into 'apache/conf/vhosts/htaccess' directory, to avoid Drupal warning -drupal_fix_htaccess_warning_protection - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "/opt/bitnami/$(web_server_type)/conf"/* "/opt/bitnami/$(web_server_type)/conf.default" diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal/setup.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal/setup.sh deleted file mode 100755 index acab8a61a0fcd..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/drupal/setup.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1090,SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load Drupal environment -. /opt/bitnami/scripts/drupal-env.sh - -# Load MySQL Client environment for 'mysql_remote_execute' (after 'drupal-env.sh' so that MODULE is not set to a wrong value) -if [[ -f /opt/bitnami/scripts/mysql-client-env.sh ]]; then - . /opt/bitnami/scripts/mysql-client-env.sh -elif [[ -f /opt/bitnami/scripts/mysql-env.sh ]]; then - . /opt/bitnami/scripts/mysql-env.sh -elif [[ -f /opt/bitnami/scripts/mariadb-env.sh ]]; then - . /opt/bitnami/scripts/mariadb-env.sh -fi - -# Load libraries -. /opt/bitnami/scripts/libdrupal.sh -. /opt/bitnami/scripts/libwebserver.sh - -# Load web server environment and functions (after Drupal environment file so MODULE is not set to a wrong value) -. "/opt/bitnami/scripts/$(web_server_type)-env.sh" - -# Ensure Drupal environment variables are valid -drupal_validate - -# Update web server configuration with runtime environment (needs to happen before the initialization) -web_server_update_app_configuration "drupal" - -# Ensure Drupal is initialized -drupal_initialize diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libapache.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libapache.sh deleted file mode 100644 index d6eb686df3f6f..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libapache.sh +++ /dev/null @@ -1,808 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Apache library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libservice.sh - -######################## -# Validate settings in APACHE_* env vars -# Globals: -# APACHE_* -# Arguments: -# None -# Returns: -# None -######################### -apache_validate() { - debug "Validating settings in APACHE_* environment variables" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - check_allowed_port() { - local port_var="${1:?missing port variable}" - local -a validate_port_args=() - ! am_i_root && validate_port_args+=("-unprivileged") - validate_port_args+=("${!port_var}") - if ! err=$(validate_port "${validate_port_args[@]}"); then - print_validation_error "An invalid port was specified in the environment variable ${port_var}: ${err}." - fi - } - - [[ -w "$APACHE_CONF_FILE" ]] || warn "The Apache configuration file '${APACHE_CONF_FILE}' is not writable. Configurations based on environment variables will not be applied." - - if [[ -n "$APACHE_HTTP_PORT_NUMBER" ]] && [[ -n "$APACHE_HTTPS_PORT_NUMBER" ]]; then - if [[ "$APACHE_HTTP_PORT_NUMBER" -eq "$APACHE_HTTPS_PORT_NUMBER" ]]; then - print_validation_error "APACHE_HTTP_PORT_NUMBER and APACHE_HTTPS_PORT_NUMBER are bound to the same port!" - fi - fi - - [[ -n "$APACHE_HTTP_PORT_NUMBER" ]] && check_allowed_port APACHE_HTTP_PORT_NUMBER - [[ -n "$APACHE_HTTPS_PORT_NUMBER" ]] && check_allowed_port APACHE_HTTPS_PORT_NUMBER - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Configure Apache's HTTP port -# Globals: -# APACHE_CONF_FILE, APACHE_CONF_DIR -# Arguments: -# None -# Returns: -# None -######################### -apache_configure_http_port() { - local -r port=${1:?missing port} - local -r listen_exp="s|^\s*Listen\s+([^:]*:)?[0-9]+\s*$|Listen ${port}|" - local -r server_name_exp="s|^\s*#?\s*ServerName\s+([^:\s]+)(:[0-9]+)?$|ServerName \1:${port}|" - local -r vhost_exp="s|VirtualHost\s+([^:>]+)(:[0-9]+)|VirtualHost \1:${port}|" - local apache_configuration - - if [[ -w "$APACHE_CONF_FILE" ]]; then - debug "Configuring port ${port} on file ${APACHE_CONF_FILE}" - apache_configuration="$(sed -E -e "$listen_exp" -e "$server_name_exp" "$APACHE_CONF_FILE")" - echo "$apache_configuration" > "$APACHE_CONF_FILE" - fi - - if [[ -w "${APACHE_CONF_DIR}/bitnami/bitnami.conf" ]]; then - debug "Configuring port ${port} on file ${APACHE_CONF_DIR}/bitnami/bitnami.conf" - apache_configuration="$(sed -E "$vhost_exp" "${APACHE_CONF_DIR}/bitnami/bitnami.conf")" - echo "$apache_configuration" > "${APACHE_CONF_DIR}/bitnami/bitnami.conf" - fi - - if [[ -w "${APACHE_VHOSTS_DIR}/00_status-vhost.conf" ]]; then - debug "Configuring port ${port} on file ${APACHE_VHOSTS_DIR}/00_status-vhost.conf" - apache_configuration="$(sed -E "$vhost_exp" "${APACHE_VHOSTS_DIR}/00_status-vhost.conf")" - echo "$apache_configuration" > "${APACHE_VHOSTS_DIR}/00_status-vhost.conf" - fi -} - -######################## -# Configure Apache's HTTPS port -# Globals: -# APACHE_CONF_DIR -# Arguments: -# None -# Returns: -# None -######################### -apache_configure_https_port() { - local -r port=${1:?missing port} - local -r listen_exp="s|^\s*Listen\s+([^:]*:)?[0-9]+\s*$|Listen ${port}|" - local -r vhost_exp="s|VirtualHost\s+([^:>]+)(:[0-9]+)|VirtualHost \1:${port}|" - local apache_configuration - - if [[ -w "${APACHE_CONF_DIR}/bitnami/bitnami-ssl.conf" ]]; then - debug "Configuring port ${port} on file ${APACHE_CONF_DIR}/bitnami/bitnami-ssl.conf" - apache_configuration="$(sed -E -e "$listen_exp" -e "$vhost_exp" "${APACHE_CONF_DIR}/bitnami/bitnami-ssl.conf")" - echo "$apache_configuration" > "${APACHE_CONF_DIR}/bitnami/bitnami-ssl.conf" - fi -} - -######################## -# Configure Apache's ServerTokens directive -# Globals: -# APACHE_CONF_DIR -# Arguments: -# $1 - Value for ServerTokens directive -# Returns: -# None -######################### -apache_configure_server_tokens() { - local -r value=${1:?missing value} - local -r server_tokens_exp="s|^\s*ServerTokens\s+\w+\s*$|ServerTokens ${value}|" - local apache_configuration - - if [[ -w "$APACHE_CONF_FILE" ]]; then - debug "Configuring ServerTokens ${value} on file ${APACHE_CONF_FILE}" - apache_configuration="$(sed -E -e "$server_tokens_exp" "$APACHE_CONF_FILE")" - echo "$apache_configuration" > "$APACHE_CONF_FILE" - fi -} - -######################## -# Enable a module in the Apache configuration file -# Globals: -# APACHE_CONF_FILE -# Arguments: -# $1 - Module to enable -# $2 - Path to module .so file (optional if already defined in httpd.conf) -# Returns: -# None -######################### -apache_enable_module() { - local -r name="${1:?missing name}" - local -r file="${2:-}" - local -r regex="[#\s]*(LoadModule\s+${name}\s+.*)$" - local apache_configuration - - if [[ -w "$APACHE_CONF_FILE" ]]; then - debug "Enabling module '${name}'" - if grep -q -E "$regex" "$APACHE_CONF_FILE"; then - # Uncomment line if the module was already defined - replace_in_file "$APACHE_CONF_FILE" "$regex" "\1" - elif [[ -n "$file" ]]; then - # Add right after the last LoadModule, so all Apache modules are organized in the same section of the file - append_file_after_last_match "$APACHE_CONF_FILE" "^[#\s]*LoadModule" "LoadModule ${name} ${file}" - else - error "Module ${name} was not defined in ${APACHE_CONF_FILE}. Please specify the 'file' parameter for 'apache_enable_module'." - fi - fi -} - -######################## -# Disable a module in the Apache configuration file -# Globals: -# APACHE_CONF_FILE -# Arguments: -# $1 - Module to disable -# Returns: -# None -######################### -apache_disable_module() { - local -r name="${1:?missing name}" - local -r file="${2:-}" - local -r regex="[#\s]*(LoadModule\s+${name}\s+.*)$" - local apache_configuration - - if [[ -w "$APACHE_CONF_FILE" ]]; then - debug "Disabling module '${name}'" - replace_in_file "$APACHE_CONF_FILE" "$regex" "#\1" - fi -} - -######################## -# Stop Apache -# Globals: -# APACHE_* -# Arguments: -# None -# Returns: -# None -######################### -apache_stop() { - is_apache_not_running && return - stop_service_using_pid "$APACHE_PID_FILE" -} - -######################## -# Check if Apache is running -# Globals: -# APACHE_PID_FILE -# Arguments: -# None -# Returns: -# Whether Apache is running -######################## -is_apache_running() { - local pid - pid="$(get_pid_from_file "$APACHE_PID_FILE")" - if [[ -n "$pid" ]]; then - is_service_running "$pid" - else - false - fi -} - -######################## -# Check if Apache is running -# Globals: -# APACHE_PID_FILE -# Arguments: -# None -# Returns: -# Whether Apache is not running -######################## -is_apache_not_running() { - ! is_apache_running -} - -######################## -# Ensure configuration gets added to the main Apache configuration file -# Globals: -# APACHE_* -# Arguments: -# $1 - configuration string -# $2 - pattern to use for checking if the configuration already exists (default: $1) -# $3 - Apache configuration file (default: $APACHE_CONF_FILE) -# Returns: -# None -######################## -ensure_apache_configuration_exists() { - local -r conf="${1:?conf missing}" - local -r pattern="${2:-"$conf"}" - local -r conf_file="${3:-"$APACHE_CONF_FILE"}" - # Enable configuration by appending to httpd.conf - if ! grep -E -q "$pattern" "$conf_file"; then - if is_file_writable "$conf_file"; then - cat >> "$conf_file" <<< "$conf" - else - error "Could not add the following configuration to '${conf_file}:" - error "" - error "$(indent "$conf" 4)" - error "" - error "Include the configuration manually and try again." - return 1 - fi - fi -} - -######################## -# Collect all the .htaccess files from /opt/bitnami/$name and write the result in the 'htaccess' directory -# Globals: -# APACHE_* -# Arguments: -# $1 - App name -# $2 - Overwrite the original .htaccess with the explanation text (defaults to 'yes') -# Flags: -# --document-root - Path to document root directory -# Returns: -# None -######################## -apache_replace_htaccess_files() { - local -r app="${1:?missing app}" - local -r result_file="${APACHE_HTACCESS_DIR}/${app}-htaccess.conf" - # Default options - local document_root="${BITNAMI_ROOT_DIR}/${app}" - local overwrite="yes" - local -a htaccess_files - local htaccess_dir - local htaccess_contents - # Validate arguments - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --document-root) - shift - document_root="$1" - ;; - --overwrite) - shift - overwrite="$1" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - if is_file_writable "$result_file"; then - # Locate all .htaccess files inside the document root - read -r -a htaccess_files <<< "$(find "$document_root" -name .htaccess -print0 | xargs -0)" - [[ "${#htaccess_files[@]}" = 0 ]] && return - # Create file with root group write privileges, so it can be modified in non-root containers - [[ ! -f "$result_file" ]] && touch "$result_file" && chmod g+rw "$result_file" - for htaccess_file in "${htaccess_files[@]}"; do - htaccess_dir="$(dirname "$htaccess_file")" - htaccess_contents="$(indent "$(< "$htaccess_file")" 2)" - # Skip if it was already included to the resulting htaccess file - if grep -q "^" <<< "$htaccess_contents"; then - continue - fi - # Add to the htaccess file - cat >> "$result_file" < -${htaccess_contents} - -EOF - # Overwrite the original .htaccess with the explanation text - if is_boolean_yes "$overwrite"; then - echo "# This configuration has been moved to the ${result_file} config file for performance and security reasons" > "$htaccess_file" - fi - done - elif [[ ! -f "$result_file" ]]; then - error "Could not create htaccess for ${app} at '${result_file}'. Check permissions and ownership for parent directories." - return 1 - else - warn "The ${app} htaccess file '${result_file}' is not writable. Configurations based on environment variables will not be applied for this file." - return - fi -} - -######################## -# Ensure an Apache application configuration exists (in virtual host format) -# Globals: -# APACHE_* -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on what configuration template will be used, allowed values: php, (empty) -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases (defaults to '*') -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render the app's virtual hosts with a .disabled prefix -# --disable-http - Whether to render the app's HTTP virtual host with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS virtual host with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# --additional-configuration - Additional vhost configuration (no default) -# --additional-http-configuration - Additional HTTP vhost configuration (no default) -# --additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --before-vhost-configuration - Configuration to add before the directive (no default) -# --allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --document-root - Path to document root directory -# --extra-directory-configuration - Extra configuration for the document root directory -# --proxy-address - Address where to proxy requests -# --proxy-configuration - Extra configuration for the proxy -# --proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_apache_app_configuration_exists() { - local -r app="${1:?missing app}" - # Default options - local type="" - local -a hosts=("127.0.0.1" "_default_") - local server_name="www.example.com" # Default ServerName in httpd.conf - local -a server_aliases=("*") - local allow_remote_connections="yes" - local disable="no" - local disable_http="no" - local disable_https="no" - local move_htaccess="yes" - # Template variables defaults - export additional_configuration="" - export additional_http_configuration="" - export additional_https_configuration="" - export before_vhost_configuration="" - export allow_override="All" - export document_root="${BITNAMI_ROOT_DIR}/${app}" - export extra_directory_configuration="" - export default_http_port="${APACHE_HTTP_PORT_NUMBER:-"$APACHE_DEFAULT_HTTP_PORT_NUMBER"}" - export default_https_port="${APACHE_HTTPS_PORT_NUMBER:-"$APACHE_DEFAULT_HTTPS_PORT_NUMBER"}" - export http_port="$default_http_port" - export https_port="$default_https_port" - export proxy_address="" - export proxy_configuration="" - export proxy_http_configuration="" - export proxy_https_configuration="" - # Validate arguments - local var_name - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --hosts \ - | --server-aliases) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - read -r -a "${var_name?}" <<< "$1" - ;; - --disable \ - | --disable-http \ - | --disable-https \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - export "${var_name}=yes" - ;; - --type \ - | --server-name \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --move-htaccess \ - | --additional-configuration \ - | --additional-http-configuration \ - | --additional-https-configuration \ - | --before-vhost-configuration \ - | --allow-override \ - | --document-root \ - | --extra-directory-configuration \ - | --proxy-address \ - | --proxy-configuration \ - | --proxy-http-configuration \ - | --proxy-https-configuration \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - export "${var_name}=${1}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Construct listen ports configuration (only to add when using non-standard ports) - export http_listen_configuration="" - export https_listen_configuration="" - [[ "$http_port" != "$default_http_port" ]] && http_listen_configuration="Listen ${http_port}" - [[ "$https_port" != "$default_https_port" ]] && https_listen_configuration="Listen ${https_port}" - # Construct host string in the format of "host1:port1[ host2:port2[ ...]]" - export http_listen_addresses="" - export https_listen_addresses="" - for host in "${hosts[@]}"; do - http_listen="${host}:${http_port}" - https_listen="${host}:${https_port}" - [[ -z "${http_listen_addresses:-}" ]] && http_listen_addresses="$http_listen" || http_listen_addresses="${http_listen_addresses} ${http_listen}" - [[ -z "${https_listen_addresses:-}" ]] && https_listen_addresses="$https_listen" || https_listen_addresses="${https_listen_addresses} ${https_listen}" - done - # Construct ServerName/ServerAlias block - export server_name_configuration="" - if ! is_empty_value "${server_name:-}"; then - server_name_configuration="ServerName ${server_name}" - fi - if [[ "${#server_aliases[@]}" -gt 0 ]]; then - server_name_configuration+=$'\n'"ServerAlias ${server_aliases[*]}" - fi - # App .htaccess support (only when type is not defined) - export htaccess_include - [[ -z "$type" || "$type" = "php" ]] && is_boolean_yes "$move_htaccess" && apache_replace_htaccess_files "$app" --document-root "$document_root" - if [[ -z "$type" || "$type" = "php" ]] && [[ -f "${APACHE_HTACCESS_DIR}/${app}-htaccess.conf" ]]; then - allow_override="None" - htaccess_include="Include \"${APACHE_HTACCESS_DIR}/${app}-htaccess.conf\"" - else - # allow_override is already set to the expected value - htaccess_include="" - fi - # ACL configuration - export acl_configuration - if is_boolean_yes "$allow_remote_connections"; then - acl_configuration="Require all granted" - else - acl_configuration="$(cat < "$http_vhost" - elif [[ ! -f "$http_vhost" ]]; then - error "Could not create virtual host for ${app} at '${http_vhost}'. Check permissions and ownership for parent directories." - return 1 - else - warn "The ${app} virtual host file '${http_vhost}' is not writable. Configurations based on environment variables will not be applied for this file." - fi - if is_file_writable "$https_vhost"; then - # Create file with root group write privileges, so it can be modified in non-root containers - [[ ! -f "$https_vhost" ]] && touch "$https_vhost" && chmod g+rw "$https_vhost" - render-template "${template_dir}/${template_name}-https-vhost.conf.tpl" | sed '/^\s*$/d' > "$https_vhost" - elif [[ ! -f "$https_vhost" ]]; then - error "Could not create virtual host for ${app} at '${https_vhost}'. Check permissions and ownership for parent directories." - return 1 - else - warn "The ${app} virtual host file '${https_vhost}' is not writable. Configurations based on environment variables will not be applied for this file." - fi -} - -######################## -# Ensure an Apache application configuration does not exist anymore (in virtual hosts format) -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_apache_app_configuration_not_exists() { - local -r app="${1:?missing app}" - local -r http_vhost="${APACHE_VHOSTS_DIR}/${app}-vhost.conf" - local -r https_vhost="${APACHE_VHOSTS_DIR}/${app}-https-vhost.conf" - local -r disable_suffix=".disabled" - # Note that 'rm -f' will not fail if the files don't exist - # However if we lack permissions to remove the file, it will result in a non-zero exit code, as expected by this function - rm -f "$http_vhost" "$https_vhost" "${http_vhost}${disable_suffix}" "${https_vhost}${disable_suffix}" -} - -######################## -# Ensure Apache loads the configuration for an application in a URL prefix -# Globals: -# APACHE_* -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on what configuration template will be used, allowed values: php, (empty) -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --additional-configuration - Additional vhost configuration (no default) -# --allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --document-root - Path to document root directory -# --extra-directory-configuration - Extra configuration for the document root directory -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_apache_prefix_configuration_exists() { - local -r app="${1:?missing app}" - # Default options - local type="" - local allow_remote_connections="yes" - local move_htaccess="yes" - local prefix="/${app}" - # Template variables defaults - export additional_configuration="" - export allow_override="All" - export document_root="${BITNAMI_ROOT_DIR}/${app}" - export extra_directory_configuration="" - # Validate arguments - local var_name - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --type \ - | --allow-remote-connections \ - | --move-htaccess \ - | --prefix \ - | --additional-configuration \ - | --allow-override \ - | --document-root \ - | --extra-directory-configuration \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "${var_name}=${1}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # App .htaccess support (only when type is not defined) - export htaccess_include - [[ -z "$type" || "$type" = "php" ]] && is_boolean_yes "$move_htaccess" && apache_replace_htaccess_files "$app" --document-root "$document_root" - if [[ -z "$type" || "$type" = "php" ]] && [[ -f "${APACHE_HTACCESS_DIR}/${app}-htaccess.conf" ]]; then - allow_override="None" - htaccess_include="Include \"${APACHE_HTACCESS_DIR}/${app}-htaccess.conf\"" - else - # allow_override is already set to the expected value - htaccess_include="" - fi - # ACL configuration - export acl_configuration - if is_boolean_yes "$allow_remote_connections"; then - acl_configuration="Require all granted" - else - acl_configuration="$(cat < "$prefix_file" - ensure_apache_configuration_exists "Include \"$prefix_file\"" - elif [[ ! -f "$prefix_file" ]]; then - error "Could not create web server configuration file for ${app} at '${prefix_file}'. Check permissions and ownership for parent directories." - return 1 - else - warn "The ${app} web server configuration file '${prefix_file}' is not writable. Configurations based on environment variables will not be applied for this file." - fi -} - -######################## -# Ensure Apache application configuration is updated with the runtime configuration (i.e. ports) -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -apache_update_app_configuration() { - local -r app="${1:?missing app}" - # Default options - local -a hosts=("127.0.0.1" "_default_") - local server_name="www.example.com" # Default ServerName in httpd.conf - local -a server_aliases=() - local enable_http="no" - local enable_https="no" - local disable_http="no" - local disable_https="no" - export default_http_port="${APACHE_HTTP_PORT_NUMBER:-"$APACHE_DEFAULT_HTTP_PORT_NUMBER"}" - export default_https_port="${APACHE_HTTPS_PORT_NUMBER:-"$APACHE_DEFAULT_HTTPS_PORT_NUMBER"}" - export http_port="$default_http_port" - export https_port="$default_https_port" - local var_name - # Validate arguments - local var_name - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --hosts \ - | --server-aliases) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - read -r -a "${var_name?}" <<< "$1" - ;; - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - declare "${var_name}=yes" - ;; - --server-name \ - | --http-port \ - | --https-port \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "${var_name}=${1}" - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Construct host string in the format of "host1:port1[ host2:port2[ ...]]" - export http_listen_addresses="" - export https_listen_addresses="" - for host in "${hosts[@]}"; do - http_listen="${host}:${http_port}" - https_listen="${host}:${https_port}" - [[ -z "${http_listen_addresses:-}" ]] && http_listen_addresses="$http_listen" || http_listen_addresses="${http_listen_addresses} ${http_listen}" - [[ -z "${https_listen_addresses:-}" ]] && https_listen_addresses="$https_listen" || https_listen_addresses="${https_listen_addresses} ${https_listen}" - done - # Update configuration - local -r http_vhost="${APACHE_VHOSTS_DIR}/${app}-vhost.conf" - local -r https_vhost="${APACHE_VHOSTS_DIR}/${app}-https-vhost.conf" - local -r disable_suffix=".disabled" - # Helper function to avoid duplicating code - update_common_vhost_config() { - local -r vhost_file="${1:?missing virtual host}" - # Update ServerName - if ! is_empty_value "${server_name:-}"; then - replace_in_file "$vhost_file" "^(\s*ServerName\s+).*" "\1${server_name}" - fi - # Update ServerAlias - if [[ "${#server_aliases[@]}" -gt 0 ]]; then - replace_in_file "$vhost_file" "^(\s*ServerAlias\s+).*" "\1${server_aliases[*]}" - fi - } - # Disable and enable configuration files - rename_conf_file() { - local -r origin="$1" - local -r destination="$2" - if is_file_writable "$origin" && is_file_writable "$destination"; then - warn "Could not rename virtual host file '${origin}' to '${destination}' due to lack of permissions." - else - mv "$origin" "$destination" - fi - } - is_boolean_yes "$disable_http" && [[ -e "$http_vhost" ]] && rename_conf_file "${http_vhost}${disable_suffix}" "$http_vhost" - is_boolean_yes "$disable_https" && [[ -e "$https_vhost" ]] && rename_conf_file "${https_vhost}${disable_suffix}" "$https_vhost" - is_boolean_yes "$enable_http" && [[ -e "${http_vhost}${disable_suffix}" ]] && rename_conf_file "${http_vhost}${disable_suffix}" "$http_vhost" - is_boolean_yes "$enable_https" && [[ -e "${https_vhost}${disable_suffix}" ]] && rename_conf_file "${https_vhost}${disable_suffix}" "$https_vhost" - # Update only configuration files without the '.disabled' suffix - if [[ -e "$http_vhost" ]]; then - if is_file_writable "$http_vhost"; then - update_common_vhost_config "$http_vhost" - # Update vhost-specific config (listen port and addresses) - replace_in_file "$http_vhost" "^Listen .*" "Listen ${http_port}" - replace_in_file "$http_vhost" "^$" "" - else - warn "The ${app} virtual host file '${http_vhost}' is not writable. Configurations based on environment variables will not be applied for this file." - fi - fi - if [[ -e "$https_vhost" ]]; then - if is_file_writable "$https_vhost"; then - update_common_vhost_config "$https_vhost" - # Update vhost-specific config (listen port and addresses) - replace_in_file "$https_vhost" "^Listen .*" "Listen ${https_port}" - replace_in_file "$https_vhost" "^$" "" - else - warn "The ${app} virtual host file '${https_vhost}' is not writable. Configurations based on environment variables will not be applied for this file." - fi - fi -} - -######################## -# Create a password file for basic authentication and restrict its permissions -# Globals: -# * -# Arguments: -# $1 - file -# $2 - username -# $3 - password -# Returns: -# true if the configuration was updated, false otherwise -######################## -apache_create_password_file() { - local -r file="${1:?missing file}" - local -r username="${2:?missing username}" - local -r password="${3:?missing password}" - - "${APACHE_BIN_DIR}/htpasswd" -bc "$file" "$username" "$password" - am_i_root && configure_permissions_ownership "$file" --file-mode "600" --user "$APACHE_DAEMON_USER" --group "$APACHE_DAEMON_GROUP" -} diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libdrupal.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libdrupal.sh deleted file mode 100644 index 9efbf2f8d407b..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libdrupal.sh +++ /dev/null @@ -1,548 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Drupal library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libphp.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh -. /opt/bitnami/scripts/libpersistence.sh -. /opt/bitnami/scripts/libwebserver.sh - -# Load database library -if [[ -f /opt/bitnami/scripts/libmysqlclient.sh ]]; then - . /opt/bitnami/scripts/libmysqlclient.sh -elif [[ -f /opt/bitnami/scripts/libmysql.sh ]]; then - . /opt/bitnami/scripts/libmysql.sh -elif [[ -f /opt/bitnami/scripts/libmariadb.sh ]]; then - . /opt/bitnami/scripts/libmariadb.sh -fi - -######################## -# Validate settings in DRUPAL_* env vars -# Globals: -# DRUPAL_* -# Arguments: -# None -# Returns: -# 0 if the validation succeeded, 1 otherwise -######################### -drupal_validate() { - debug "Validating settings in DRUPAL_* environment variables..." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - check_multi_value() { - if [[ " ${2} " != *" ${!1} "* ]]; then - print_validation_error "The allowed values for ${1} are: ${2}" - fi - } - - check_yes_no_value() { - if ! is_yes_no_value "${!1}" && ! is_true_false_value "${!1}"; then - print_validation_error "The allowed values for ${1} are: yes no" - fi - } - - check_resolved_hostname() { - if ! is_hostname_resolved "$1"; then - warn "Hostname $1 could not be resolved. This could lead to connection issues" - fi - } - - check_mounted_file() { - if [[ -n "${!1:-}" ]] && ! [[ -f "${!1:-}" ]]; then - print_validation_error "The variable ${1} is defined but the file ${!1} is not accessible or does not exist" - fi - } - check_valid_port() { - local port_var="${1:?missing port variable}" - local err - if ! err="$(validate_port "${!port_var}")"; then - print_validation_error "An invalid port was specified in the environment variable ${port_var}: ${err}." - fi - } - - # Warn users in case the configuration file is not writable - is_file_writable "$DRUPAL_CONF_FILE" || warn "The Drupal configuration file '${DRUPAL_CONF_FILE}' is not writable. Configurations based on environment variables will not be applied for this file." - - # Validate user inputs - ! is_empty_value "$DRUPAL_SKIP_BOOTSTRAP" && check_yes_no_value "DRUPAL_SKIP_BOOTSTRAP" - ! is_empty_value "$DRUPAL_DATABASE_PORT_NUMBER" && check_valid_port "DRUPAL_DATABASE_PORT_NUMBER" - ! is_empty_value "$DRUPAL_DATABASE_HOST" && check_resolved_hostname "$DRUPAL_DATABASE_HOST" - check_mounted_file "DRUPAL_DATABASE_TLS_CA_FILE" - - # Validate database credentials - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - else - for empty_env_var in "DRUPAL_DATABASE_PASSWORD" "DRUPAL_PASSWORD"; do - is_empty_value "${!empty_env_var}" && print_validation_error "The ${empty_env_var} environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow a blank password. This is only recommended for development environments." - done - fi - - # Validate SMTP credentials - if ! is_empty_value "$DRUPAL_SMTP_HOST"; then - for empty_env_var in "DRUPAL_SMTP_USER" "DRUPAL_SMTP_PASSWORD"; do - is_empty_value "${!empty_env_var}" && warn "The ${empty_env_var} environment variable is empty or not set." - done - is_empty_value "$DRUPAL_SMTP_PORT_NUMBER" && print_validation_error "The DRUPAL_SMTP_PORT_NUMBER environment variable is empty or not set." - ! is_empty_value "$DRUPAL_SMTP_PORT_NUMBER" && check_valid_port "DRUPAL_SMTP_PORT_NUMBER" - ! is_empty_value "$DRUPAL_SMTP_PROTOCOL" && check_multi_value "DRUPAL_SMTP_PROTOCOL" "standard tls ssl" - fi - - # Check that the web server is properly set up - web_server_validate || print_validation_error "Web server validation failed" - - return "$error_code" -} - -######################## -# Ensure Drupal is initialized -# Globals: -# DRUPAL_* -# Arguments: -# None -# Returns: -# None -######################### -drupal_initialize() { - # Update Drupal configuration via mounted configuration files and environment variables - if is_file_writable "$DRUPAL_CONF_FILE"; then - # Enable mounted configuration files - if [[ -f "$DRUPAL_MOUNTED_CONF_FILE" ]]; then - info "Found mounted Drupal configuration file '${DRUPAL_MOUNTED_CONF_FILE}', copying to '${DRUPAL_CONF_FILE}'" - cp "$DRUPAL_MOUNTED_CONF_FILE" "$DRUPAL_CONF_FILE" - return - fi - fi - - # Check if Drupal has already been initialized and persisted in a previous run - local -r app_name="drupal" - if ! is_app_initialized "$app_name"; then - info "Trying to connect to the database server" - drupal_wait_for_db_connection "$DRUPAL_DATABASE_HOST" "$DRUPAL_DATABASE_PORT_NUMBER" "$DRUPAL_DATABASE_NAME" "$DRUPAL_DATABASE_USER" "$DRUPAL_DATABASE_PASSWORD" - - # Ensure the Drupal base directory exists and has proper permissions - info "Configuring file permissions for Drupal" - ensure_dir_exists "$DRUPAL_VOLUME_DIR" - # Use daemon:root ownership for compatibility when running as a non-root user - am_i_root && configure_permissions_ownership "$DRUPAL_VOLUME_DIR" -d "775" -f "664" -u "$WEB_SERVER_DAEMON_USER" -g "root" - - if ! is_boolean_yes "$DRUPAL_SKIP_BOOTSTRAP"; then - # Perform initial bootstrapping for Drupal - info "Installing Drupal site" - drupal_site_install - if ! is_empty_value "$DRUPAL_ENABLE_MODULES"; then - info "Enabling Drupal modules" - drupal_enable_modules - fi - if ! is_empty_value "$DRUPAL_SMTP_HOST"; then - info "Configuring SMTP" - drupal_configure_smtp - fi - info "Flushing Drupal cache" - drupal_flush_cache - else - info "An already initialized Drupal database was provided, configuration will be skipped" - if is_empty_value "$DRUPAL_DATABASE_TLS_CA_FILE"; then - drupal_set_database_settings - else - drupal_set_database_ssl_settings - fi - - # Drupal expects a directory for storing site configuration - # For more info see https://www.drupal.org/docs/configuration-management - drupal_create_config_directory - - # Drupal needs a hash value to build one-time login links, cancel links, form tokens, etc. - drupal_set_hash_salt - drupal_update_database - fi - - info "Persisting Drupal installation" - persist_app "$app_name" "$DRUPAL_DATA_TO_PERSIST" - else - info "Restoring persisted Drupal installation" - restore_persisted_app "$app_name" "$DRUPAL_DATA_TO_PERSIST" - info "Trying to connect to the database server" - db_host="$(drupal_database_conf_get 'host')" - db_port="$(drupal_database_conf_get 'port')" - db_name="$(drupal_database_conf_get 'database')" - db_user="$(drupal_database_conf_get 'username')" - db_pass="$(drupal_database_conf_get 'password')" - drupal_wait_for_db_connection "$db_host" "$db_port" "$db_name" "$db_user" "$db_pass" - drupal_update_database - fi - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Get a database entry from the Drupal configuration file (settings.php) -# Globals: -# DRUPAL_* -# Arguments: -# $1 - Key -# Returns: -# None -######################### -drupal_database_conf_get() { - local -r key="${1:?key missing}" - debug "Getting ${key} from Drupal database configuration" - grep -E "^\s*'${key}' =>" "$DRUPAL_CONF_FILE" | awk -F'=>' '{gsub(/[ ,'\''"]/, "", $2); print $2}' -} - -######################## -# Add or modify an entry in the Drupal configuration file (settings.php) -# Globals: -# DRUPAL_* -# Arguments: -# $1 - PHP variable name -# $2 - Value to assign to the PHP variable -# $3 - Whether the value is a literal, or if instead it should be quoted (default: no) -# Returns: -# None -######################### -drupal_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - local -r is_literal="${3:-no}" - debug "Setting ${key} to '${value}' in Drupal configuration (literal: ${is_literal})" - # Sanitize key (sed does not support fixed string substitutions) - local sanitized_pattern - sanitized_pattern="^(#\s*)?$(sed 's/[]\[^$.*/]/\\&/g' <<< "$key")\s*=.*" - local entry - is_boolean_yes "$is_literal" && entry="${key} = $value;" || entry="${key} = '$value';" - # Check if the configuration exists in the file - if grep -q -E "$sanitized_pattern" "$DRUPAL_CONF_FILE"; then - # It exists, so replace the line - replace_in_file "$DRUPAL_CONF_FILE" "$sanitized_pattern" "$entry" - else - echo "$entry" >> "$DRUPAL_CONF_FILE" - fi -} - -######################## -# Wait until the database is accessible with the currently-known credentials -# Globals: -# * -# Arguments: -# $1 - database host -# $2 - database port -# $3 - database name -# $4 - database username -# $5 - database user password (optional) -# Returns: -# true if the database connection succeeded, false otherwise -######################### -drupal_wait_for_db_connection() { - local -r db_host="${1:?missing database host}" - local -r db_port="${2:?missing database port}" - local -r db_name="${3:?missing database name}" - local -r db_user="${4:?missing database user}" - local -r db_pass="${5:-}" - check_mysql_connection() { - echo "SELECT 1" | mysql_remote_execute "$db_host" "$db_port" "$db_name" "$db_user" "$db_pass" - } - if ! retry_while "check_mysql_connection"; then - error "Could not connect to the database" - return 1 - fi -} - -######################## -# Drupal Site Install -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -drupal_site_install() { - is_empty_value "$DRUPAL_DATABASE_TLS_CA_FILE" || drupal_set_database_ssl_settings - - ( - # Unfortunately there is no way to disable mail sending via sendmail when installing Drupal - # The "hack" consists of overriding the sendmail path to an executable that does nothing (i.e. "/bin/true") - # This is also what Drush is doing in their CI - PHP_OPTIONS="-d sendmail_path=$(which true)" - export PHP_OPTIONS - - drush_execute "site:install" \ - "--db-url=mysql://${DRUPAL_DATABASE_USER}:${DRUPAL_DATABASE_PASSWORD}@${DRUPAL_DATABASE_HOST}:${DRUPAL_DATABASE_PORT_NUMBER}/${DRUPAL_DATABASE_NAME}" \ - "--account-name=${DRUPAL_USERNAME}" \ - "--account-mail=${DRUPAL_EMAIL}" \ - "--account-pass=${DRUPAL_PASSWORD}" \ - "--site-name=${DRUPAL_SITE_NAME}" \ - "--site-mail=${DRUPAL_EMAIL}" \ - "-y" "$DRUPAL_PROFILE" - ) - - # When Drupal settings are patched to allow SSL database connections, the database settings block is duplicated - # after the installation with Drush - is_empty_value "$DRUPAL_DATABASE_TLS_CA_FILE" || drupal_remove_duplicated_database_settings - # Restrict permissions of the configuration file to keep the site secure - if am_i_root; then - configure_permissions_ownership "$DRUPAL_CONF_FILE" -u "root" -g "$WEB_SERVER_DAEMON_USER" -f "644" - else - # HACK: The drupal installation is changing the ownership of the sites/default folder. When running as - # 1001:1001 this is causing an issue with the persist_app function. This sets the folder with write permissions - # so the function works. We add || true to not break docker-compose installations - chmod u+w "${DRUPAL_BASE_DIR}/sites/default" || true - fi -} - -######################## -# Create Drupal sync configuration directory (DRUPAL_SKIP_BOOTSTRAP only) -# Globals: -# DRUPAL_BASE_DIR -# Arguments: -# None -# Returns: -# None -######################### -drupal_create_config_directory() { - local config_sync_dir="${DRUPAL_CONFIG_SYNC_DIR:-}" - if is_empty_value "$config_sync_dir"; then - config_sync_dir="${DRUPAL_BASE_DIR}/sites/default/files/config_$(generate_random_string -t alphanumeric -c 16)" - fi - ensure_dir_exists "$config_sync_dir" - drupal_conf_set "\$settings['config_sync_directory']" "$config_sync_dir" -} - -######################## -# Create Drupal hash salt value (DRUPAL_SKIP_BOOTSTRAP only) -# Globals: -# DRUPAL_HASH_SALT -# Arguments: -# None -# Returns: -# None -######################### -drupal_set_hash_salt() { - local hash_salt="${DRUPAL_HASH_SALT:-}" - if is_empty_value "$hash_salt"; then - hash_salt="$(generate_random_string -t alphanumeric -c 32)" - fi - drupal_conf_set "\$settings['hash_salt']" "$hash_salt" -} - -######################## -# Execute Drush Tool -# Globals: -# * -# Arguments: -# $@ - Arguments to pass to the Drush tool -# Returns: -# None -######################### -drush_execute() { - if am_i_root; then - debug_execute run_as_user "$WEB_SERVER_DAEMON_USER" drush "--root=${DRUPAL_BASE_DIR}" "$@" - else - debug_execute drush "--root=${DRUPAL_BASE_DIR}" "$@" - fi -} - -######################## -# Execute Drush Tool to set a config option -# Globals: -# * -# Arguments: -# $1 - config group -# $2 - config key -# $3 - config value -# Returns: -# None -######################### -drush_config_set() { - local -r group="${1:?missing config group}" - local -r key="${2:?missing config key}" - local -r value="${3:-}" - - drush_execute "config-set" "--yes" "$group" "$key" "$value" -} - -######################## -# Drupal enable modules -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -drupal_enable_modules() { - local -a modules - read -r -a modules <<< "${DRUPAL_ENABLE_MODULES/,/ }" - [[ "${#modules[@]}" -gt 0 ]] || return 0 - drush_execute "pm:enable" "--yes" "${modules[@]}" -} - -######################## -# Drupal configure SMTP -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -drupal_configure_smtp() { - drush_execute "pm:enable" "--yes" "smtp" - - drush_config_set "system.mail" "interface.default" "SMTPMailSystem" - drush_config_set "smtp.settings" "smtp_on" "1" - drush_config_set "smtp.settings" "smtp_host" "$DRUPAL_SMTP_HOST" - drush_config_set "smtp.settings" "smtp_port" "$DRUPAL_SMTP_PORT_NUMBER" - drush_config_set "smtp.settings" "smtp_protocol" "$DRUPAL_SMTP_PROTOCOL" - drush_config_set "smtp.settings" "smtp_username" "$DRUPAL_SMTP_USER" - drush_config_set "smtp.settings" "smtp_password" "$DRUPAL_SMTP_PASSWORD" - drush_config_set "smtp.settings" "smtp_from" "$DRUPAL_EMAIL" - drush_config_set "smtp.settings" "smtp_fromname" "$DRUPAL_SITE_NAME" -} - -######################## -# Drupal flush cache -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -drupal_flush_cache() { - drush_execute "cache:rebuild" -} - -######################## -# Drupal update database -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -drupal_update_database() { - debug 'Upgrading Drupal database with drush...' - drush_execute "updatedb" -} - -######################## -# Drupal set database SSL settings -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -drupal_set_database_ssl_settings() { - cat >>"$DRUPAL_CONF_FILE" < '${DRUPAL_DATABASE_NAME}', - 'username' => '${DRUPAL_DATABASE_USER}', - 'password' => '${DRUPAL_DATABASE_PASSWORD}', - 'prefix' => '', - 'host' => '${DRUPAL_DATABASE_HOST}', - 'port' => '${DRUPAL_DATABASE_PORT_NUMBER}', - 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', - 'driver' => 'mysql', - 'pdo' => array ( - PDO::MYSQL_ATTR_SSL_CA => '${DRUPAL_DATABASE_TLS_CA_FILE}', - PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => 0 - ) -); -EOF -} - -######################## -# Drupal set database non-SSL settings (DRUPAL_SKIP_BOOTSTRAP only) -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -drupal_set_database_settings() { - cat >>"$DRUPAL_CONF_FILE" < '${DRUPAL_DATABASE_NAME}', - 'username' => '${DRUPAL_DATABASE_USER}', - 'password' => '${DRUPAL_DATABASE_PASSWORD}', - 'prefix' => '', - 'host' => '${DRUPAL_DATABASE_HOST}', - 'port' => '${DRUPAL_DATABASE_PORT_NUMBER}', - 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql', - 'driver' => 'mysql', -); -EOF -} - -######################## -# Drupal remove duplicated database block from settings file -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -drupal_remove_duplicated_database_settings() { - local -r first_line_block=$'\$databases\[\'default\'\]\[\'default\'\] = array \($' - local -r last_line_block='\);' - - remove_in_file "$DRUPAL_CONF_FILE" "${first_line_block}/,/${last_line_block}" -} - -######################## -# Drupal fix htaccess warning protection. -# Drupal checks for the htaccess file to prevent malicious attacks -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -drupal_fix_htaccess_warning_protection() { - local -r files_dir="${DRUPAL_BASE_DIR}/sites/default/files/" - local -r htaccess_file="${files_dir}/.htaccess" - - ensure_dir_exists "$files_dir" - cat <"$htaccess_file" -# Recommended protections: https://www.drupal.org/forum/newsletters/security-advisories-for-drupal-core/2013-11-20/sa-core-2013-003-drupal-core - -# Turn off all options we don\'t need. -Options -Indexes -ExecCGI -Includes -MultiViews - -# Set the catch-all handler to prevent scripts from being executed. -SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006 - - # Override the handler again if we\'re run later in the evaluation list. - SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003 - - -# If we know how to do it safely, disable the PHP engine entirely. - - php_flag engine off - -EOF -} diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libmysqlclient.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libmysqlclient.sh deleted file mode 100644 index c702d828bc843..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libmysqlclient.sh +++ /dev/null @@ -1,1046 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami MySQL Client library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh - -######################## -# Validate settings in MYSQL_CLIENT_* environment variables -# Globals: -# MYSQL_CLIENT_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_client_validate() { - info "Validating settings in MYSQL_CLIENT_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - backslash_password_error() { - print_validation_error "The password cannot contain backslashes ('\'). Set the environment variable $1 with no backslashes (more info at https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html)" - } - - check_yes_no_value() { - if ! is_yes_no_value "${!1}" && ! is_true_false_value "${!1}"; then - print_validation_error "The allowed values for ${1} are: yes no" - fi - } - - check_multi_value() { - if [[ " ${2} " != *" ${!1} "* ]]; then - print_validation_error "The allowed values for ${1} are: ${2}" - fi - } - - # Only validate environment variables if any action needs to be performed - check_yes_no_value "MYSQL_CLIENT_ENABLE_SSL_WRAPPER" - check_multi_value "MYSQL_CLIENT_FLAVOR" "mariadb mysql" - - if [[ -n "$MYSQL_CLIENT_CREATE_DATABASE_USER" || -n "$MYSQL_CLIENT_CREATE_DATABASE_NAME" ]]; then - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -z "$MYSQL_CLIENT_DATABASE_ROOT_PASSWORD" ]]; then - empty_password_error "MYSQL_CLIENT_DATABASE_ROOT_PASSWORD" - fi - if [[ -n "$MYSQL_CLIENT_CREATE_DATABASE_USER" ]] && [[ -z "$MYSQL_CLIENT_CREATE_DATABASE_PASSWORD" ]]; then - empty_password_error "MYSQL_CLIENT_CREATE_DATABASE_PASSWORD" - fi - fi - if [[ "${MYSQL_CLIENT_DATABASE_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "MYSQL_CLIENT_DATABASE_ROOT_PASSWORD" - fi - if [[ "${MYSQL_CLIENT_CREATE_DATABASE_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "MYSQL_CLIENT_CREATE_DATABASE_PASSWORD" - fi - fi - return "$error_code" -} - -######################## -# Perform actions to a database -# Globals: -# DB_* -# MYSQL_CLIENT_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_client_initialize() { - # Wrap binary to force the usage of SSL - if is_boolean_yes "$MYSQL_CLIENT_ENABLE_SSL_WRAPPER"; then - mysql_client_wrap_binary_for_ssl - fi - # Wait for the database to be accessible if any action needs to be performed - if [[ -n "$MYSQL_CLIENT_CREATE_DATABASE_USER" || -n "$MYSQL_CLIENT_CREATE_DATABASE_NAME" ]]; then - info "Trying to connect to the database server" - check_mysql_connection() { - echo "SELECT 1" | mysql_execute "mysql" "$MYSQL_CLIENT_DATABASE_ROOT_USER" "$MYSQL_CLIENT_DATABASE_ROOT_PASSWORD" "-h" "$MYSQL_CLIENT_DATABASE_HOST" "-P" "$MYSQL_CLIENT_DATABASE_PORT_NUMBER" - } - if ! retry_while "check_mysql_connection"; then - error "Could not connect to the database server" - return 1 - fi - fi - # Ensure a database user exists in the server - if [[ -n "$MYSQL_CLIENT_CREATE_DATABASE_USER" ]]; then - info "Creating database user ${MYSQL_CLIENT_CREATE_DATABASE_USER}" - local -a args=("$MYSQL_CLIENT_CREATE_DATABASE_USER" "--host" "$MYSQL_CLIENT_DATABASE_HOST" "--port" "$MYSQL_CLIENT_DATABASE_PORT_NUMBER") - [[ -n "$MYSQL_CLIENT_CREATE_DATABASE_PASSWORD" ]] && args+=("-p" "$MYSQL_CLIENT_CREATE_DATABASE_PASSWORD") - [[ -n "$MYSQL_CLIENT_DATABASE_AUTHENTICATION_PLUGIN" ]] && args+=("--auth-plugin" "$MYSQL_CLIENT_DATABASE_AUTHENTICATION_PLUGIN") - mysql_ensure_optional_user_exists "${args[@]}" - fi - # Ensure a database exists in the server (and that the user has write privileges, if specified) - if [[ -n "$MYSQL_CLIENT_CREATE_DATABASE_NAME" ]]; then - info "Creating database ${MYSQL_CLIENT_CREATE_DATABASE_NAME}" - local -a createdb_args=("$MYSQL_CLIENT_CREATE_DATABASE_NAME" "--host" "$MYSQL_CLIENT_DATABASE_HOST" "--port" "$MYSQL_CLIENT_DATABASE_PORT_NUMBER") - [[ -n "$MYSQL_CLIENT_CREATE_DATABASE_USER" ]] && createdb_args+=("-u" "$MYSQL_CLIENT_CREATE_DATABASE_USER") - [[ -n "$MYSQL_CLIENT_CREATE_DATABASE_CHARACTER_SET" ]] && createdb_args+=("--character-set" "$MYSQL_CLIENT_CREATE_DATABASE_CHARACTER_SET") - [[ -n "$MYSQL_CLIENT_CREATE_DATABASE_COLLATE" ]] && createdb_args+=("--collate" "$MYSQL_CLIENT_CREATE_DATABASE_COLLATE") - [[ -n "$MYSQL_CLIENT_CREATE_DATABASE_PRIVILEGES" ]] && createdb_args+=("--privileges" "$MYSQL_CLIENT_CREATE_DATABASE_PRIVILEGES") - mysql_ensure_optional_database_exists "${createdb_args[@]}" - fi -} - -######################## -# Wrap binary to force the usage of SSL -# Globals: -# DB_* -# MYSQL_CLIENT_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_client_wrap_binary_for_ssl() { - local wrapper_file="${DB_BIN_DIR}/mysql" - # In MySQL Client 10.6, mysql is a link to the mariadb binary - if [[ -f "${DB_BIN_DIR}/mariadb" ]]; then - wrapper_file="${DB_BIN_DIR}/mariadb" - fi - local -r wrapped_binary_file="${DB_BASE_DIR}/.bin/mysql" - local -a ssl_opts=() - read -r -a ssl_opts <<<"$(mysql_client_extra_opts)" - - mv "$wrapper_file" "$wrapped_binary_file" - cat >"$wrapper_file" <> "$custom_conf_file" - cat "$old_custom_conf_file" >> "$custom_conf_file" - fi - if am_i_root; then - [[ -e "$DB_VOLUME_DIR/.initialized" ]] && rm "$DB_VOLUME_DIR/.initialized" - rm -rf "$DB_VOLUME_DIR/conf" - else - warn "Old custom configuration migrated, please manually remove the 'conf' directory from the volume use to persist data" - fi -} - -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - local mysql_create_user_cmd - [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.4, the mysql.user table was replaced with a view: https://mariadb.com/kb/en/mysqluser-table/ - # Views have a definer user, in this case set to 'root', which needs to exist for the view to work - # In MySQL, to avoid issues when renaming the root user, they use the 'mysql.sys' user as a definer: https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html - # However, for MariaDB that is not the case, so when the 'root' user is renamed the 'mysql.user' table stops working and the view needs to be fixed - if [[ "$user" != "root" && ! "$(mysql_get_version)" =~ ^10.[0123]. ]]; then - alter_view_str="$(mysql_execute_print_output "mysql" "$user" "$password" "-s" <&2 - return 1 - ;; - esac - shift - done - - local -a mysql_execute_cmd=("mysql_execute") - [[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - - local -a create_database_args=() - [[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'") - [[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'") - - debug "Creating database $database" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$user") - [[ -n "$db_host" ]] && flags+=("--host" "${db_host}") - [[ -n "$db_port" ]] && flags+=("--port" "${db_port}") - if is_boolean_yes "$use_ldap"; then - flags+=("--use-ldap") - elif [[ -n "$password" ]]; then - flags+=("-p" "$password") - [[ -n "$auth_plugin" ]] && flags=("${flags[@]}" "--auth-plugin" "$auth_plugin") - fi - mysql_ensure_user_exists "${flags[@]}" -} - -######################## -# Optionally create the given database, and then optionally give a user -# full privileges on the database. -# Flags: -# -u|--user - database user -# --character-set - character set -# --collation - collation -# --host - database host -# --port - database port -# Arguments: -# $1 - database name -# Returns: -# None -######################### -mysql_ensure_optional_database_exists() { - local -r database="${1:?database is missing}" - local character_set="" - local collate="" - local user="" - local privileges="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - --character-set) - shift - character_set="${1:?missing character set}" - ;; - --collate) - shift - collate="${1:?missing collate}" - ;; - -u|--user) - shift - user="${1:?missing database user}" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - --privileges) - shift - privileges="${1:?missing privileges}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$database") - [[ -n "$character_set" ]] && flags+=("--character-set" "$character_set") - [[ -n "$collate" ]] && flags+=("--collate" "$collate") - [[ -n "$db_host" ]] && flags+=("--host" "$db_host") - [[ -n "$db_port" ]] && flags+=("--port" "$db_port") - mysql_ensure_database_exists "${flags[@]}" - - if [[ -n "$user" ]]; then - mysql_ensure_user_has_database_privileges "$user" "$database" "$privileges" "$db_host" "$db_port" - fi -} - -######################## -# Add or modify an entry in the MySQL configuration file ("$DB_CONF_FILE") -# Globals: -# DB_* -# Arguments: -# $1 - MySQL variable name -# $2 - Value to assign to the MySQL variable -# $3 - Section in the MySQL configuration file the key is located (default: mysqld) -# $4 - Configuration file (default: "$BD_CONF_FILE") -# Returns: -# None -######################### -mysql_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - read -r -a sections <<<"${3:-mysqld}" - local -r ignore_inline_comments="${4:-no}" - local -r file="${5:-"$DB_CONF_FILE"}" - info "Setting ${key} option" - debug "Setting ${key} to '${value}' in ${DB_FLAVOR} configuration file ${file}" - # Check if the configuration exists in the file - for section in "${sections[@]}"; do - if is_boolean_yes "$ignore_inline_comments"; then - ini-file set --ignore-inline-comments --section "$section" --key "$key" --value "$value" "$file" - else - ini-file set --section "$section" --key "$key" --value "$value" "$file" - fi - done -} - -######################## -# Update MySQL/MariaDB configuration file with user custom inputs -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_update_custom_config() { - # Persisted configuration files from old versions - ! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration - - # User injected custom configuration - if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then - debug "Injecting custom configuration from my_custom.conf" - cat "$DB_CONF_DIR/my_custom.cnf" > "$DB_CONF_DIR/bitnami/my_custom.cnf" - fi - - ! is_empty_value "$DB_USER" && mysql_conf_set "user" "$DB_USER" "mysqladmin" - ! is_empty_value "$DB_PORT_NUMBER" && mysql_conf_set "port" "$DB_PORT_NUMBER" "mysqld client manager" - ! is_empty_value "$DB_CHARACTER_SET" && mysql_conf_set "character_set_server" "$DB_CHARACTER_SET" - ! is_empty_value "$DB_COLLATE" && mysql_conf_set "collation_server" "$DB_COLLATE" - ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" - ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" - ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" - ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" - ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=( "/usr/lib" "/usr/lib64" ) - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} - -######################## -# Execute a reliable health check against the current mysql instance -# Globals: -# DB_ROOT_USER, DB_ROOT_PASSWORD, DB_MASTER_ROOT_PASSWORD -# Arguments: -# None -# Returns: -# mysqladmin output -######################### -mysql_healthcheck() { - local args=("-u${DB_ROOT_USER}" "-h0.0.0.0") - local root_password - - root_password="$(get_master_env_var_value ROOT_PASSWORD)" - if [[ -n "$root_password" ]]; then - args+=("-p${root_password}") - fi - - mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status -} - -######################## -# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# mysql client flavor -######################### -mysql_client_flavor() { - if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then - echo "mariadb" - else - echo "mysql" - fi -} - -######################## -# Prints extra options for MySQL client calls (i.e. SSL options) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# List of options to pass to "mysql" CLI -######################### -mysql_client_extra_opts() { - # Helper to get the proper value for the MySQL client environment variable - mysql_client_env_value() { - local env_name="MYSQL_CLIENT_${1:?missing name}" - if [[ -n "${!env_name:-}" ]]; then - echo "${!env_name:-}" - else - env_name="DB_CLIENT_${1}" - echo "${!env_name:-}" - fi - } - local -a opts=() - local key value - if is_boolean_yes "${DB_ENABLE_SSL:-no}"; then - if [[ "$(mysql_client_flavor)" = "mysql" ]]; then - opts+=("--ssl-mode=REQUIRED") - else - opts+=("--ssl=TRUE") - fi - # Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined - for key in ca key cert; do - value="$(mysql_client_env_value "SSL_${key^^}_FILE")" - [[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}") - done - else - # Skip SSL validation - if [[ "$(mysql_client_flavor)" = "mariadb" ]]; then - # SSL connections are enabled by default in MariaDB >=10.11 - local mysql_version="" - local major_version="" - local minor_version="" - mysql_version="$(mysql_get_version)" - major_version="$(get_sematic_version "${mysql_version}" 1)" - minor_version="$(get_sematic_version "${mysql_version}" 2)" - if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then - opts+=("--skip-ssl") - fi - fi - fi - echo "${opts[@]:-}" -} diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libphp.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libphp.sh deleted file mode 100644 index 838cd2b4289fa..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/libphp.sh +++ /dev/null @@ -1,265 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami PHP library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libwebserver.sh - -######################## -# Add or modify an entry in the main PHP configuration file (php.ini) -# Globals: -# PHP_CONF_FILE -# Arguments: -# $1 - Key -# $2 - Value -# $3 - File to modify (default: $PHP_CONF_FILE) -# Returns: -# None -######################### -php_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - local -r file="${3:-"$PHP_CONF_FILE"}" - local pattern="^[; ]*${key}\s*=.*$" - if [[ "$key" = "extension" || "$key" = "zend_extension" ]]; then - # The "extension" property works a bit different for PHP, as there is one per module to be included, meaning it is additive unlike other configurations - # Because of that, we first check if the extension was defined in the file to replace the proper entry - pattern="^[; ]*${key}\s*=\s*[\"]?${value}(\.so)?[\"]?\s*$" - fi - local -r entry="${key} = ${value}" - if is_file_writable "$file"; then - # Not using the ini-file tool since it does not play well with php.ini - if grep -q -E "$pattern" "$file"; then - replace_in_file "$file" "$pattern" "$entry" - else - cat >> "$file" <<< "$entry" - fi - else - warn "The PHP configuration file '${file}' is not writable. The '${key}' option will not be configured." - fi -} - -######################## -# Ensure PHP is initialized -# Globals: -# PHP_* -# Arguments: -# None -# Returns: -# None -######################### -php_initialize() { - # Configure PHP options based on the runtime environment - info "Configuring PHP options" - if ! is_dir_empty "$PHP_DEFAULT_CONF_DIR"; then - # Copy default configuration to php configuration directory - cp -nr "$PHP_DEFAULT_CONF_DIR"/. "$PHP_CONF_DIR" - fi - php_set_runtime_config "$PHP_CONF_FILE" - - - # PHP-FPM configuration - ! is_empty_value "$PHP_FPM_LISTEN_ADDRESS" && info "Setting PHP-FPM listen option" && php_conf_set "listen" "$PHP_FPM_LISTEN_ADDRESS" "${PHP_CONF_DIR}/php-fpm.d/www.conf" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Set PHP runtime options, based on user-provided environment variables -# Globals: -# PHP_* -# Arguments: -# None -# Returns: -# None -######################### -php_set_runtime_config() { - local -r conf_file="${1:?missing conf file}" - - ! is_empty_value "$PHP_DATE_TIMEZONE" && info "Setting PHP date.timezone option" && php_conf_set date.timezone "$PHP_DATE_TIMEZONE" "$conf_file" - ! is_empty_value "$PHP_ENABLE_OPCACHE" && info "Setting PHP opcache.enable option" && php_conf_set opcache.enable "$PHP_ENABLE_OPCACHE" "$conf_file" - ! is_empty_value "$PHP_EXPOSE_PHP" && info "Setting PHP expose_php option" && php_conf_set expose_php "$PHP_EXPOSE_PHP" "$conf_file" - ! is_empty_value "$PHP_MAX_EXECUTION_TIME" && info "Setting PHP max_execution_time option" && php_conf_set max_execution_time "$PHP_MAX_EXECUTION_TIME" "$conf_file" - ! is_empty_value "$PHP_MAX_INPUT_TIME" && info "Setting PHP max_input_time option" && php_conf_set max_input_time "$PHP_MAX_INPUT_TIME" "$conf_file" - ! is_empty_value "$PHP_MAX_INPUT_VARS" && info "Setting PHP max_input_vars option" && php_conf_set max_input_vars "$PHP_MAX_INPUT_VARS" "$conf_file" - ! is_empty_value "$PHP_MEMORY_LIMIT" && info "Setting PHP memory_limit option" && php_conf_set memory_limit "$PHP_MEMORY_LIMIT" "$conf_file" - ! is_empty_value "$PHP_POST_MAX_SIZE" && info "Setting PHP post_max_size option" && php_conf_set post_max_size "$PHP_POST_MAX_SIZE" "$conf_file" - ! is_empty_value "$PHP_UPLOAD_MAX_FILESIZE" && info "Setting PHP upload_max_filesize option" && php_conf_set upload_max_filesize "$PHP_UPLOAD_MAX_FILESIZE" "$conf_file" - ! is_empty_value "$PHP_OUTPUT_BUFFERING" && info "Setting PHP output_buffering option" && php_conf_set output_buffering "$PHP_OUTPUT_BUFFERING" "$conf_file" - - true -} - -######################## -# Convert a yes/no value to a PHP boolean -# Globals: -# None -# Arguments: -# $1 - yes/no value -# Returns: -# None -######################### -php_convert_to_boolean() { - local -r value="${1:?missing value}" - is_boolean_yes "$value" && echo "true" || echo "false" -} - -######################## -# Execute/run PHP code and print to stdout -# Globals: -# None -# Stdin: -# Code to execute -# Arguments: -# $1..$n - Input arguments to script -# Returns: -# None -######################### -php_execute_print_output() { - local php_cmd - # Obtain the command specified via stdin - php_cmd="$(/dev/null 2>&1 & - if ! retry_while "is_php_fpm_running"; then - error "php-fpm did not start" - error_code=1 - else - info "php-fpm started" - fi -else - info "php-fpm is already running" -fi - -exit "$error_code" diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/status.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/status.sh deleted file mode 100755 index 2ca4fb384d050..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/status.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libphp.sh -. /opt/bitnami/scripts/liblog.sh - -# Load PHP-FPM environment variables -. /opt/bitnami/scripts/php-env.sh - -if is_php_fpm_running; then - info "php-fpm is already running" -else - info "php-fpm is not running" -fi diff --git a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/stop.sh b/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/stop.sh deleted file mode 100755 index 74274a4b4ee30..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/opt/bitnami/scripts/php/stop.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libphp.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh - -# Load PHP-FPM environment variables -. /opt/bitnami/scripts/php-env.sh - -error_code=0 - -if is_php_fpm_running; then - BITNAMI_QUIET=1 php_fpm_stop - if ! retry_while "is_php_fpm_not_running"; then - error "php-fpm could not be stopped" - error_code=1 - else - info "php-fpm stopped" - fi -else - info "php-fpm is not running" -fi - -exit "$error_code" diff --git a/bitnami/drupal/10/debian-12/rootfs/post-init.d/php.sh b/bitnami/drupal/10/debian-12/rootfs/post-init.d/php.sh deleted file mode 100755 index 6be2585cbc533..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/post-init.d/php.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Executes custom PHP init scripts - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries with logging functions -if [[ -f /opt/bitnami/base/functions ]]; then - . /opt/bitnami/base/functions -else - . /opt/bitnami/scripts/liblog.sh -fi - -# Loop through all input files passed via stdin -read -r -a custom_init_scripts <<< "$@" -failure=0 -if [[ "${#custom_init_scripts[@]}" -gt 0 ]]; then - for custom_init_script in "${custom_init_scripts[@]}"; do - [[ "$custom_init_script" != *".php" ]] && continue - info "Executing ${custom_init_script} with PHP interpreter" - php "$custom_init_script" || failure=1 - [[ "$failure" -ne 0 ]] && error "Failed to execute ${custom_init_script}" - done -fi - -exit "$failure" diff --git a/bitnami/drupal/10/debian-12/rootfs/post-init.d/shell.sh b/bitnami/drupal/10/debian-12/rootfs/post-init.d/shell.sh deleted file mode 100755 index 75a202d6ecc51..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/post-init.d/shell.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Executes custom Bash init scripts - -# shellcheck disable=SC1090,SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries with logging functions -if [[ -f /opt/bitnami/base/functions ]]; then - . /opt/bitnami/base/functions -else - . /opt/bitnami/scripts/liblog.sh -fi - -# Loop through all input files passed via stdin -read -r -a custom_init_scripts <<< "$@" -failure=0 -if [[ "${#custom_init_scripts[@]}" -gt 0 ]]; then - for custom_init_script in "${custom_init_scripts[@]}"; do - [[ "$custom_init_script" != *".sh" ]] && continue - if [[ -x "$custom_init_script" ]]; then - info "Executing ${custom_init_script}" - "$custom_init_script" || failure="1" - else - info "Sourcing ${custom_init_script} as it is not executable by the current user, any error may cause initialization to fail" - . "$custom_init_script" - fi - [[ "$failure" -ne 0 ]] && error "Failed to execute ${custom_init_script}" - done -fi - -exit "$failure" diff --git a/bitnami/drupal/10/debian-12/rootfs/post-init.d/sql-mysql.sh b/bitnami/drupal/10/debian-12/rootfs/post-init.d/sql-mysql.sh deleted file mode 100755 index dc95fc879a0b9..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/post-init.d/sql-mysql.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Executes custom MySQL (.sql or .sql.gz) init scripts - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries with logging functions -if [[ -f /opt/bitnami/base/functions ]]; then - . /opt/bitnami/base/functions -else - . /opt/bitnami/scripts/liblog.sh -fi - -mysql_execute() { - local -r sql_file="${1:?missing file}" - local failure=0 - mysql_cmd=("mysql" "-h" "$MARIADB_HOST" "-P" "$MARIADB_PORT_NUMBER" "-u" "$MARIADB_ROOT_USER") - if [[ "${ALLOW_EMPTY_PASSWORD:-no}" != "yes" ]]; then - mysql_cmd+=("-p${MARIADB_ROOT_PASSWORD}") - fi - if [[ "$sql_file" == *".sql" ]]; then - "${mysql_cmd[@]}" < "$sql_file" || failure=$? - elif [[ "$sql_file" == *".sql.gz" ]]; then - gunzip -c "$sql_file" | "${mysql_cmd[@]}" || failure=$? - fi - return "$failure" -} - -# Loop through all input files passed via stdin -read -r -a custom_init_scripts <<< "$@" -failure=0 -if [[ "${#custom_init_scripts[@]}" -gt 0 ]]; then - for custom_init_script in "${custom_init_scripts[@]}"; do - [[ ! "$custom_init_script" =~ ^.*(\.sql|\.sql\.gz)$ ]] && continue - info "Executing ${custom_init_script}" - mysql_execute "$custom_init_script" || failure=1 - [[ "$failure" -ne 0 ]] && error "Failed to execute ${custom_init_script}" - done -fi - -exit "$failure" diff --git a/bitnami/drupal/10/debian-12/rootfs/post-init.sh b/bitnami/drupal/10/debian-12/rootfs/post-init.sh deleted file mode 100755 index 5293748594acb..0000000000000 --- a/bitnami/drupal/10/debian-12/rootfs/post-init.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Only execute init scripts once -if [[ ! -f "/bitnami/drupal/.user_scripts_initialized" && -d "/docker-entrypoint-init.d" ]]; then - read -r -a init_scripts <<< "$(find "/docker-entrypoint-init.d" -type f -print0 | sort -z | xargs -0)" - if [[ "${#init_scripts[@]}" -gt 0 ]] && [[ ! -f "/bitnami/drupal/.user_scripts_initialized" ]]; then - mkdir -p "/bitnami/drupal" - for init_script in "${init_scripts[@]}"; do - for init_script_type_handler in /post-init.d/*.sh; do - "$init_script_type_handler" "$init_script" - done - done - fi - - touch "/bitnami/drupal/.user_scripts_initialized" -fi diff --git a/bitnami/drupal/10/debian-12/tags-info.yaml b/bitnami/drupal/10/debian-12/tags-info.yaml deleted file mode 100644 index 599b072e96109..0000000000000 --- a/bitnami/drupal/10/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "10" -- 10-debian-12 -- 10.3.10 diff --git a/bitnami/elasticsearch/7/README.md b/bitnami/elasticsearch/7/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/elasticsearch/7/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/elasticsearch/7/debian-12/Dockerfile b/bitnami/elasticsearch/7/debian-12/Dockerfile deleted file mode 100644 index ac00d8f9672bb..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG ELASTICSEARCH_PLUGINS -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T14:58:34Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/elasticsearch/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="7.17.26-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/elasticsearch" \ - org.opencontainers.image.title="elasticsearch" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="7.17.26" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/java/bin:/opt/bitnami/elasticsearch/bin:$PATH" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libasound2-dev libc6 libfreetype6 libfreetype6-dev libgcc-s1 libgcc1 libstdc++6 procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "yq-4.44.5-0-linux-${OS_ARCH}-debian-12" \ - "java-17.0.13-12-1-linux-${OS_ARCH}-debian-12" \ - "elasticsearch-7.17.26-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/elasticsearch/postunpack.sh -RUN /opt/bitnami/scripts/java/postunpack.sh -ENV APP_VERSION="7.17.26" \ - BITNAMI_APP_NAME="elasticsearch" \ - ES_JAVA_HOME="/opt/bitnami/java" \ - JAVA_HOME="/opt/bitnami/java" \ - LD_LIBRARY_PATH="/opt/bitnami/elasticsearch/jdk/lib:/opt/bitnami/elasticsearch/jdk/lib/server:$LD_LIBRARY_PATH" - -EXPOSE 9200 9300 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/elasticsearch/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/elasticsearch/run.sh" ] diff --git a/bitnami/elasticsearch/7/debian-12/docker-compose-cluster.yml b/bitnami/elasticsearch/7/debian-12/docker-compose-cluster.yml deleted file mode 100644 index 3b03ac3773555..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/docker-compose-cluster.yml +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - elasticsearch-node1: - image: docker.io/bitnami/elasticsearch:7 - environment: - - ELASTICSEARCH_CLUSTER_NAME=elasticsearch-cluster - - ELASTICSEARCH_CLUSTER_HOSTS=elasticsearch-node1,elasticsearch-node2,elasticsearch-node3 - - ELASTICSEARCH_NODE_NAME=elasticsearch-node1 - - ELASTICSEARCH_HEAP_SIZE=1g - ports: - - '9200:9200' - - '9300:9300' - volumes: - - 'elasticsearch_node1_data:/bitnami' - - elasticsearch-node2: - image: docker.io/bitnami/elasticsearch:7 - environment: - - ELASTICSEARCH_CLUSTER_NAME=elasticsearch-cluster - - ELASTICSEARCH_CLUSTER_HOSTS=elasticsearch-node1,elasticsearch-node2,elasticsearch-node3 - - ELASTICSEARCH_NODE_NAME=elasticsearch-node2 - - ELASTICSEARCH_HEAP_SIZE=1g - volumes: - - 'elasticsearch_node2_data:/bitnami' - - elasticsearch-node3: - image: docker.io/bitnami/elasticsearch:7 - environment: - - ELASTICSEARCH_CLUSTER_NAME=elasticsearch-cluster - - ELASTICSEARCH_CLUSTER_HOSTS=elasticsearch-node1,elasticsearch-node2,elasticsearch-node3 - - ELASTICSEARCH_NODE_NAME=elasticsearch-node3 - - ELASTICSEARCH_HEAP_SIZE=1g - volumes: - - 'elasticsearch_node3_data:/bitnami' - -volumes: - elasticsearch_node1_data: - driver: local - elasticsearch_node2_data: - driver: local - elasticsearch_node3_data: - driver: local diff --git a/bitnami/elasticsearch/7/debian-12/docker-compose.yml b/bitnami/elasticsearch/7/debian-12/docker-compose.yml deleted file mode 100644 index 29b8df29238df..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/docker-compose.yml +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - elasticsearch: - image: docker.io/bitnami/elasticsearch:7 - ports: - - '9200:9200' - - '9300:9300' - volumes: - - 'elasticsearch_data:/bitnami/elasticsearch/data' -volumes: - elasticsearch_data: - driver: local diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index f9367dfbd1f26..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "elasticsearch": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "7.17.26-0" - }, - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "17.0.13-12-1" - }, - "yq": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "4.44.5-0" - } -} \ No newline at end of file diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/elasticsearch/7/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/elasticsearch/7/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/elasticsearch/7/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch-env.sh b/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch-env.sh deleted file mode 100644 index 5e8f8c7d36607..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch-env.sh +++ /dev/null @@ -1,258 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for elasticsearch - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-elasticsearch}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -elasticsearch_env_vars=( - ELASTICSEARCH_CERTS_DIR - ELASTICSEARCH_DATA_DIR_LIST - ELASTICSEARCH_BIND_ADDRESS - ELASTICSEARCH_ADVERTISED_HOSTNAME - ELASTICSEARCH_CLUSTER_HOSTS - ELASTICSEARCH_CLUSTER_MASTER_HOSTS - ELASTICSEARCH_CLUSTER_NAME - ELASTICSEARCH_HEAP_SIZE - ELASTICSEARCH_MAX_ALLOWED_MEMORY_PERCENTAGE - ELASTICSEARCH_MAX_ALLOWED_MEMORY - ELASTICSEARCH_MAX_TIMEOUT - ELASTICSEARCH_LOCK_ALL_MEMORY - ELASTICSEARCH_DISABLE_JVM_HEAP_DUMP - ELASTICSEARCH_DISABLE_GC_LOGS - ELASTICSEARCH_IS_DEDICATED_NODE - ELASTICSEARCH_MINIMUM_MASTER_NODES - ELASTICSEARCH_NODE_NAME - ELASTICSEARCH_FS_SNAPSHOT_REPO_PATH - ELASTICSEARCH_NODE_ROLES - ELASTICSEARCH_PLUGINS - ELASTICSEARCH_TRANSPORT_PORT_NUMBER - ELASTICSEARCH_HTTP_PORT_NUMBER - ELASTICSEARCH_ENABLE_SECURITY - ELASTICSEARCH_PASSWORD - ELASTICSEARCH_TLS_VERIFICATION_MODE - ELASTICSEARCH_TLS_USE_PEM - ELASTICSEARCH_KEYSTORE_PASSWORD - ELASTICSEARCH_TRUSTSTORE_PASSWORD - ELASTICSEARCH_KEY_PASSWORD - ELASTICSEARCH_KEYSTORE_LOCATION - ELASTICSEARCH_TRUSTSTORE_LOCATION - ELASTICSEARCH_NODE_CERT_LOCATION - ELASTICSEARCH_NODE_KEY_LOCATION - ELASTICSEARCH_CA_CERT_LOCATION - ELASTICSEARCH_SKIP_TRANSPORT_TLS - ELASTICSEARCH_TRANSPORT_TLS_USE_PEM - ELASTICSEARCH_TRANSPORT_TLS_KEYSTORE_PASSWORD - ELASTICSEARCH_TRANSPORT_TLS_TRUSTSTORE_PASSWORD - ELASTICSEARCH_TRANSPORT_TLS_KEY_PASSWORD - ELASTICSEARCH_TRANSPORT_TLS_KEYSTORE_LOCATION - ELASTICSEARCH_TRANSPORT_TLS_TRUSTSTORE_LOCATION - ELASTICSEARCH_TRANSPORT_TLS_NODE_CERT_LOCATION - ELASTICSEARCH_TRANSPORT_TLS_NODE_KEY_LOCATION - ELASTICSEARCH_TRANSPORT_TLS_CA_CERT_LOCATION - ELASTICSEARCH_ENABLE_REST_TLS - ELASTICSEARCH_HTTP_TLS_USE_PEM - ELASTICSEARCH_HTTP_TLS_KEYSTORE_PASSWORD - ELASTICSEARCH_HTTP_TLS_TRUSTSTORE_PASSWORD - ELASTICSEARCH_HTTP_TLS_KEY_PASSWORD - ELASTICSEARCH_HTTP_TLS_KEYSTORE_LOCATION - ELASTICSEARCH_HTTP_TLS_TRUSTSTORE_LOCATION - ELASTICSEARCH_HTTP_TLS_NODE_CERT_LOCATION - ELASTICSEARCH_HTTP_TLS_NODE_KEY_LOCATION - ELASTICSEARCH_HTTP_TLS_CA_CERT_LOCATION - ELASTICSEARCH_ENABLE_FIPS_MODE - ELASTICSEARCH_KEYS - ELASTICSEARCH_ACTION_DESTRUCTIVE_REQUIRES_NAME - DB_MINIMUM_MANAGER_NODES -) -for env_var in "${elasticsearch_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset elasticsearch_env_vars -export DB_FLAVOR="elasticsearch" - -# Paths -export ELASTICSEARCH_VOLUME_DIR="/bitnami/elasticsearch" -export DB_VOLUME_DIR="$ELASTICSEARCH_VOLUME_DIR" -export ELASTICSEARCH_BASE_DIR="/opt/bitnami/elasticsearch" -export DB_BASE_DIR="$ELASTICSEARCH_BASE_DIR" -export ELASTICSEARCH_CONF_DIR="${DB_BASE_DIR}/config" -export DB_CONF_DIR="$ELASTICSEARCH_CONF_DIR" -export ELASTICSEARCH_DEFAULT_CONF_DIR="${DB_BASE_DIR}/config.default" -export DB_DEFAULT_CONF_DIR="$ELASTICSEARCH_DEFAULT_CONF_DIR" -export ELASTICSEARCH_CERTS_DIR="${ELASTICSEARCH_CERTS_DIR:-${DB_CONF_DIR}/certs}" -export DB_CERTS_DIR="$ELASTICSEARCH_CERTS_DIR" -export ELASTICSEARCH_LOGS_DIR="${DB_BASE_DIR}/logs" -export DB_LOGS_DIR="$ELASTICSEARCH_LOGS_DIR" -export ELASTICSEARCH_PLUGINS_DIR="${DB_BASE_DIR}/plugins" -export DB_PLUGINS_DIR="$ELASTICSEARCH_PLUGINS_DIR" -export ELASTICSEARCH_DEFAULT_PLUGINS_DIR="${DB_BASE_DIR}/plugins.default" -export DB_DEFAULT_PLUGINS_DIR="$ELASTICSEARCH_DEFAULT_PLUGINS_DIR" -export ELASTICSEARCH_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_DATA_DIR="$ELASTICSEARCH_DATA_DIR" -export ELASTICSEARCH_DATA_DIR_LIST="${ELASTICSEARCH_DATA_DIR_LIST:-}" -export DB_DATA_DIR_LIST="$ELASTICSEARCH_DATA_DIR_LIST" -export ELASTICSEARCH_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_TMP_DIR="$ELASTICSEARCH_TMP_DIR" -export ELASTICSEARCH_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_BIN_DIR="$ELASTICSEARCH_BIN_DIR" -export ELASTICSEARCH_MOUNTED_PLUGINS_DIR="${DB_VOLUME_DIR}/plugins" -export DB_MOUNTED_PLUGINS_DIR="$ELASTICSEARCH_MOUNTED_PLUGINS_DIR" -export ELASTICSEARCH_CONF_FILE="${DB_CONF_DIR}/elasticsearch.yml" -export DB_CONF_FILE="$ELASTICSEARCH_CONF_FILE" -export ELASTICSEARCH_LOG_FILE="${DB_LOGS_DIR}/elasticsearch.log" -export DB_LOG_FILE="$ELASTICSEARCH_LOG_FILE" -export ELASTICSEARCH_PID_FILE="${DB_TMP_DIR}/elasticsearch.pid" -export DB_PID_FILE="$ELASTICSEARCH_PID_FILE" -export ELASTICSEARCH_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d" -export DB_INITSCRIPTS_DIR="$ELASTICSEARCH_INITSCRIPTS_DIR" -export PATH="${DB_BIN_DIR}:${BITNAMI_ROOT_DIR}/common/bin:$PATH" - -# System users (when running with a privileged user) -export ELASTICSEARCH_DAEMON_USER="elasticsearch" -export DB_DAEMON_USER="$ELASTICSEARCH_DAEMON_USER" -export ELASTICSEARCH_DAEMON_GROUP="elasticsearch" -export DB_DAEMON_GROUP="$ELASTICSEARCH_DAEMON_GROUP" - -# Elasticsearch configuration -export ELASTICSEARCH_BIND_ADDRESS="${ELASTICSEARCH_BIND_ADDRESS:-}" -export DB_BIND_ADDRESS="$ELASTICSEARCH_BIND_ADDRESS" -export ELASTICSEARCH_ADVERTISED_HOSTNAME="${ELASTICSEARCH_ADVERTISED_HOSTNAME:-}" -export DB_ADVERTISED_HOSTNAME="$ELASTICSEARCH_ADVERTISED_HOSTNAME" -export ELASTICSEARCH_CLUSTER_HOSTS="${ELASTICSEARCH_CLUSTER_HOSTS:-}" -export DB_CLUSTER_HOSTS="$ELASTICSEARCH_CLUSTER_HOSTS" -export ELASTICSEARCH_CLUSTER_MASTER_HOSTS="${ELASTICSEARCH_CLUSTER_MASTER_HOSTS:-}" -export DB_CLUSTER_MASTER_HOSTS="$ELASTICSEARCH_CLUSTER_MASTER_HOSTS" -export ELASTICSEARCH_CLUSTER_NAME="${ELASTICSEARCH_CLUSTER_NAME:-}" -export DB_CLUSTER_NAME="$ELASTICSEARCH_CLUSTER_NAME" -export ELASTICSEARCH_HEAP_SIZE="${ELASTICSEARCH_HEAP_SIZE:-1024m}" -export DB_HEAP_SIZE="$ELASTICSEARCH_HEAP_SIZE" -export ELASTICSEARCH_MAX_ALLOWED_MEMORY_PERCENTAGE="${ELASTICSEARCH_MAX_ALLOWED_MEMORY_PERCENTAGE:-100}" -export DB_MAX_ALLOWED_MEMORY_PERCENTAGE="$ELASTICSEARCH_MAX_ALLOWED_MEMORY_PERCENTAGE" -export ELASTICSEARCH_MAX_ALLOWED_MEMORY="${ELASTICSEARCH_MAX_ALLOWED_MEMORY:-}" -export DB_MAX_ALLOWED_MEMORY="$ELASTICSEARCH_MAX_ALLOWED_MEMORY" -export ELASTICSEARCH_MAX_TIMEOUT="${ELASTICSEARCH_MAX_TIMEOUT:-60}" -export DB_MAX_TIMEOUT="$ELASTICSEARCH_MAX_TIMEOUT" -export ELASTICSEARCH_LOCK_ALL_MEMORY="${ELASTICSEARCH_LOCK_ALL_MEMORY:-no}" -export DB_LOCK_ALL_MEMORY="$ELASTICSEARCH_LOCK_ALL_MEMORY" -export ELASTICSEARCH_DISABLE_JVM_HEAP_DUMP="${ELASTICSEARCH_DISABLE_JVM_HEAP_DUMP:-no}" -export DB_DISABLE_JVM_HEAP_DUMP="$ELASTICSEARCH_DISABLE_JVM_HEAP_DUMP" -export ELASTICSEARCH_DISABLE_GC_LOGS="${ELASTICSEARCH_DISABLE_GC_LOGS:-no}" -export DB_DISABLE_GC_LOGS="$ELASTICSEARCH_DISABLE_GC_LOGS" -export ELASTICSEARCH_IS_DEDICATED_NODE="${ELASTICSEARCH_IS_DEDICATED_NODE:-no}" -export DB_IS_DEDICATED_NODE="$ELASTICSEARCH_IS_DEDICATED_NODE" -ELASTICSEARCH_MINIMUM_MASTER_NODES="${ELASTICSEARCH_MINIMUM_MASTER_NODES:-"${DB_MINIMUM_MANAGER_NODES:-}"}" -export ELASTICSEARCH_MINIMUM_MASTER_NODES="${ELASTICSEARCH_MINIMUM_MASTER_NODES:-}" -export DB_MINIMUM_MASTER_NODES="$ELASTICSEARCH_MINIMUM_MASTER_NODES" -export ELASTICSEARCH_NODE_NAME="${ELASTICSEARCH_NODE_NAME:-}" -export DB_NODE_NAME="$ELASTICSEARCH_NODE_NAME" -export ELASTICSEARCH_FS_SNAPSHOT_REPO_PATH="${ELASTICSEARCH_FS_SNAPSHOT_REPO_PATH:-}" -export DB_FS_SNAPSHOT_REPO_PATH="$ELASTICSEARCH_FS_SNAPSHOT_REPO_PATH" -export ELASTICSEARCH_NODE_ROLES="${ELASTICSEARCH_NODE_ROLES:-}" -export DB_NODE_ROLES="$ELASTICSEARCH_NODE_ROLES" -export ELASTICSEARCH_PLUGINS="${ELASTICSEARCH_PLUGINS:-}" -export DB_PLUGINS="$ELASTICSEARCH_PLUGINS" -export ELASTICSEARCH_TRANSPORT_PORT_NUMBER="${ELASTICSEARCH_TRANSPORT_PORT_NUMBER:-9300}" -export DB_TRANSPORT_PORT_NUMBER="$ELASTICSEARCH_TRANSPORT_PORT_NUMBER" -export ELASTICSEARCH_HTTP_PORT_NUMBER="${ELASTICSEARCH_HTTP_PORT_NUMBER:-9200}" -export DB_HTTP_PORT_NUMBER="$ELASTICSEARCH_HTTP_PORT_NUMBER" - -# Elasticsearch Security configuration -export ELASTICSEARCH_ENABLE_SECURITY="${ELASTICSEARCH_ENABLE_SECURITY:-false}" -export DB_ENABLE_SECURITY="$ELASTICSEARCH_ENABLE_SECURITY" -export ELASTICSEARCH_PASSWORD="${ELASTICSEARCH_PASSWORD:-bitnami}" -export DB_PASSWORD="$ELASTICSEARCH_PASSWORD" -export ELASTICSEARCH_USERNAME="elastic" -export DB_USERNAME="$ELASTICSEARCH_USERNAME" -export ELASTICSEARCH_TLS_VERIFICATION_MODE="${ELASTICSEARCH_TLS_VERIFICATION_MODE:-full}" -export DB_TLS_VERIFICATION_MODE="$ELASTICSEARCH_TLS_VERIFICATION_MODE" -export ELASTICSEARCH_TLS_USE_PEM="${ELASTICSEARCH_TLS_USE_PEM:-false}" -export DB_TLS_USE_PEM="$ELASTICSEARCH_TLS_USE_PEM" -export ELASTICSEARCH_KEYSTORE_PASSWORD="${ELASTICSEARCH_KEYSTORE_PASSWORD:-}" -export DB_KEYSTORE_PASSWORD="$ELASTICSEARCH_KEYSTORE_PASSWORD" -export ELASTICSEARCH_TRUSTSTORE_PASSWORD="${ELASTICSEARCH_TRUSTSTORE_PASSWORD:-}" -export DB_TRUSTSTORE_PASSWORD="$ELASTICSEARCH_TRUSTSTORE_PASSWORD" -export ELASTICSEARCH_KEY_PASSWORD="${ELASTICSEARCH_KEY_PASSWORD:-}" -export DB_KEY_PASSWORD="$ELASTICSEARCH_KEY_PASSWORD" -export ELASTICSEARCH_KEYSTORE_LOCATION="${ELASTICSEARCH_KEYSTORE_LOCATION:-${DB_CERTS_DIR}/elasticsearch.keystore.jks}" -export DB_KEYSTORE_LOCATION="$ELASTICSEARCH_KEYSTORE_LOCATION" -export ELASTICSEARCH_TRUSTSTORE_LOCATION="${ELASTICSEARCH_TRUSTSTORE_LOCATION:-${DB_CERTS_DIR}/elasticsearch.truststore.jks}" -export DB_TRUSTSTORE_LOCATION="$ELASTICSEARCH_TRUSTSTORE_LOCATION" -export ELASTICSEARCH_NODE_CERT_LOCATION="${ELASTICSEARCH_NODE_CERT_LOCATION:-${DB_CERTS_DIR}/tls.crt}" -export DB_NODE_CERT_LOCATION="$ELASTICSEARCH_NODE_CERT_LOCATION" -export ELASTICSEARCH_NODE_KEY_LOCATION="${ELASTICSEARCH_NODE_KEY_LOCATION:-${DB_CERTS_DIR}/tls.key}" -export DB_NODE_KEY_LOCATION="$ELASTICSEARCH_NODE_KEY_LOCATION" -export ELASTICSEARCH_CA_CERT_LOCATION="${ELASTICSEARCH_CA_CERT_LOCATION:-${DB_CERTS_DIR}/ca.crt}" -export DB_CA_CERT_LOCATION="$ELASTICSEARCH_CA_CERT_LOCATION" -export ELASTICSEARCH_SKIP_TRANSPORT_TLS="${ELASTICSEARCH_SKIP_TRANSPORT_TLS:-false}" -export DB_SKIP_TRANSPORT_TLS="$ELASTICSEARCH_SKIP_TRANSPORT_TLS" -export ELASTICSEARCH_TRANSPORT_TLS_USE_PEM="${ELASTICSEARCH_TRANSPORT_TLS_USE_PEM:-$DB_TLS_USE_PEM}" -export DB_TRANSPORT_TLS_USE_PEM="$ELASTICSEARCH_TRANSPORT_TLS_USE_PEM" -export ELASTICSEARCH_TRANSPORT_TLS_KEYSTORE_PASSWORD="${ELASTICSEARCH_TRANSPORT_TLS_KEYSTORE_PASSWORD:-$DB_KEYSTORE_PASSWORD}" -export DB_TRANSPORT_TLS_KEYSTORE_PASSWORD="$ELASTICSEARCH_TRANSPORT_TLS_KEYSTORE_PASSWORD" -export ELASTICSEARCH_TRANSPORT_TLS_TRUSTSTORE_PASSWORD="${ELASTICSEARCH_TRANSPORT_TLS_TRUSTSTORE_PASSWORD:-$DB_TRUSTSTORE_PASSWORD}" -export DB_TRANSPORT_TLS_TRUSTSTORE_PASSWORD="$ELASTICSEARCH_TRANSPORT_TLS_TRUSTSTORE_PASSWORD" -export ELASTICSEARCH_TRANSPORT_TLS_KEY_PASSWORD="${ELASTICSEARCH_TRANSPORT_TLS_KEY_PASSWORD:-$DB_KEY_PASSWORD}" -export DB_TRANSPORT_TLS_KEY_PASSWORD="$ELASTICSEARCH_TRANSPORT_TLS_KEY_PASSWORD" -export ELASTICSEARCH_TRANSPORT_TLS_KEYSTORE_LOCATION="${ELASTICSEARCH_TRANSPORT_TLS_KEYSTORE_LOCATION:-$DB_KEYSTORE_LOCATION}" -export DB_TRANSPORT_TLS_KEYSTORE_LOCATION="$ELASTICSEARCH_TRANSPORT_TLS_KEYSTORE_LOCATION" -export ELASTICSEARCH_TRANSPORT_TLS_TRUSTSTORE_LOCATION="${ELASTICSEARCH_TRANSPORT_TLS_TRUSTSTORE_LOCATION:-$DB_TRUSTSTORE_LOCATION}" -export DB_TRANSPORT_TLS_TRUSTSTORE_LOCATION="$ELASTICSEARCH_TRANSPORT_TLS_TRUSTSTORE_LOCATION" -export ELASTICSEARCH_TRANSPORT_TLS_NODE_CERT_LOCATION="${ELASTICSEARCH_TRANSPORT_TLS_NODE_CERT_LOCATION:-$DB_NODE_CERT_LOCATION}" -export DB_TRANSPORT_TLS_NODE_CERT_LOCATION="$ELASTICSEARCH_TRANSPORT_TLS_NODE_CERT_LOCATION" -export ELASTICSEARCH_TRANSPORT_TLS_NODE_KEY_LOCATION="${ELASTICSEARCH_TRANSPORT_TLS_NODE_KEY_LOCATION:-$DB_NODE_KEY_LOCATION}" -export DB_TRANSPORT_TLS_NODE_KEY_LOCATION="$ELASTICSEARCH_TRANSPORT_TLS_NODE_KEY_LOCATION" -export ELASTICSEARCH_TRANSPORT_TLS_CA_CERT_LOCATION="${ELASTICSEARCH_TRANSPORT_TLS_CA_CERT_LOCATION:-$DB_CA_CERT_LOCATION}" -export DB_TRANSPORT_TLS_CA_CERT_LOCATION="$ELASTICSEARCH_TRANSPORT_TLS_CA_CERT_LOCATION" -export ELASTICSEARCH_ENABLE_REST_TLS="${ELASTICSEARCH_ENABLE_REST_TLS:-true}" -export DB_ENABLE_REST_TLS="$ELASTICSEARCH_ENABLE_REST_TLS" -export ELASTICSEARCH_HTTP_TLS_USE_PEM="${ELASTICSEARCH_HTTP_TLS_USE_PEM:-$DB_TLS_USE_PEM}" -export DB_HTTP_TLS_USE_PEM="$ELASTICSEARCH_HTTP_TLS_USE_PEM" -export ELASTICSEARCH_HTTP_TLS_KEYSTORE_PASSWORD="${ELASTICSEARCH_HTTP_TLS_KEYSTORE_PASSWORD:-$DB_KEYSTORE_PASSWORD}" -export DB_HTTP_TLS_KEYSTORE_PASSWORD="$ELASTICSEARCH_HTTP_TLS_KEYSTORE_PASSWORD" -export ELASTICSEARCH_HTTP_TLS_TRUSTSTORE_PASSWORD="${ELASTICSEARCH_HTTP_TLS_TRUSTSTORE_PASSWORD:-$DB_TRUSTSTORE_PASSWORD}" -export DB_HTTP_TLS_TRUSTSTORE_PASSWORD="$ELASTICSEARCH_HTTP_TLS_TRUSTSTORE_PASSWORD" -export ELASTICSEARCH_HTTP_TLS_KEY_PASSWORD="${ELASTICSEARCH_HTTP_TLS_KEY_PASSWORD:-$DB_KEY_PASSWORD}" -export DB_HTTP_TLS_KEY_PASSWORD="$ELASTICSEARCH_HTTP_TLS_KEY_PASSWORD" -export ELASTICSEARCH_HTTP_TLS_KEYSTORE_LOCATION="${ELASTICSEARCH_HTTP_TLS_KEYSTORE_LOCATION:-$DB_KEYSTORE_LOCATION}" -export DB_HTTP_TLS_KEYSTORE_LOCATION="$ELASTICSEARCH_HTTP_TLS_KEYSTORE_LOCATION" -export ELASTICSEARCH_HTTP_TLS_TRUSTSTORE_LOCATION="${ELASTICSEARCH_HTTP_TLS_TRUSTSTORE_LOCATION:-$DB_TRUSTSTORE_LOCATION}" -export DB_HTTP_TLS_TRUSTSTORE_LOCATION="$ELASTICSEARCH_HTTP_TLS_TRUSTSTORE_LOCATION" -export ELASTICSEARCH_HTTP_TLS_NODE_CERT_LOCATION="${ELASTICSEARCH_HTTP_TLS_NODE_CERT_LOCATION:-$DB_NODE_CERT_LOCATION}" -export DB_HTTP_TLS_NODE_CERT_LOCATION="$ELASTICSEARCH_HTTP_TLS_NODE_CERT_LOCATION" -export ELASTICSEARCH_HTTP_TLS_NODE_KEY_LOCATION="${ELASTICSEARCH_HTTP_TLS_NODE_KEY_LOCATION:-$DB_NODE_KEY_LOCATION}" -export DB_HTTP_TLS_NODE_KEY_LOCATION="$ELASTICSEARCH_HTTP_TLS_NODE_KEY_LOCATION" -export ELASTICSEARCH_HTTP_TLS_CA_CERT_LOCATION="${ELASTICSEARCH_HTTP_TLS_CA_CERT_LOCATION:-$DB_CA_CERT_LOCATION}" -export DB_HTTP_TLS_CA_CERT_LOCATION="$ELASTICSEARCH_HTTP_TLS_CA_CERT_LOCATION" -export ELASTICSEARCH_ENABLE_FIPS_MODE="${ELASTICSEARCH_ENABLE_FIPS_MODE:-false}" -export ELASTICSEARCH_KEYS="${ELASTICSEARCH_KEYS:-}" -export ELASTICSEARCH_ACTION_DESTRUCTIVE_REQUIRES_NAME="${ELASTICSEARCH_ACTION_DESTRUCTIVE_REQUIRES_NAME:-}" -export DB_ACTION_DESTRUCTIVE_REQUIRES_NAME="$ELASTICSEARCH_ACTION_DESTRUCTIVE_REQUIRES_NAME" - -# Custom environment variables may be defined below diff --git a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/entrypoint.sh b/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/entrypoint.sh deleted file mode 100755 index 0fbcebc3e8eae..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/entrypoint.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -#set -o xtrace - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libelasticsearch.sh - -# Load environment -. /opt/bitnami/scripts/elasticsearch-env.sh - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/elasticsearch/conf) -debug "Copying files from $DB_DEFAULT_CONF_DIR to $DB_CONF_DIR" -cp -nr "$DB_DEFAULT_CONF_DIR"/. "$DB_CONF_DIR" - -if ! is_dir_empty "$DB_DEFAULT_PLUGINS_DIR"; then - debug "Copying plugins from $DB_DEFAULT_PLUGINS_DIR to $DB_PLUGINS_DIR" - # Copy the plugins installed by default to the plugins directory - # If there is already a plugin with the same name in the plugins folder do nothing - for plugin_path in "${DB_DEFAULT_PLUGINS_DIR}"/*; do - plugin_name="$(basename "$plugin_path")" - plugin_moved_path="${DB_PLUGINS_DIR}/${plugin_name}" - if ! [[ -d "$plugin_moved_path" ]]; then - cp -r "$plugin_path" "$plugin_moved_path" - fi - done -fi - -if [[ "$1" = "/opt/bitnami/scripts/elasticsearch/run.sh" ]]; then - info "** Starting Elasticsearch setup **" - /opt/bitnami/scripts/elasticsearch/setup.sh - info "** Elasticsearch setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/healthcheck.sh b/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/healthcheck.sh deleted file mode 100755 index ee7f128ec87a8..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/healthcheck.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libelasticsearch.sh - -# Load Elasticsearch environment variables -. /opt/bitnami/scripts/elasticsearch-env.sh - -elasticsearch_healthcheck diff --git a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/postunpack.sh b/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/postunpack.sh deleted file mode 100755 index e8ac01ffc19ae..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/postunpack.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -# Load libraries -. /opt/bitnami/scripts/libelasticsearch.sh -. /opt/bitnami/scripts/libfs.sh - -# Load environment -. /opt/bitnami/scripts/elasticsearch-env.sh - -for dir in "$DB_TMP_DIR" "$DB_DATA_DIR" "$DB_LOGS_DIR" "${DB_BASE_DIR}/plugins" "${DB_BASE_DIR}/modules" "$DB_CONF_DIR" "$DB_VOLUME_DIR" "$DB_INITSCRIPTS_DIR" "$DB_MOUNTED_PLUGINS_DIR" "$DB_DEFAULT_CONF_DIR" "$DB_DEFAULT_PLUGINS_DIR"; do - ensure_dir_exists "$dir" - chmod -R ug+rwX "$dir" -done - -elasticsearch_configure_logging - -for dir in "$DB_TMP_DIR" "$DB_DATA_DIR" "$DB_LOGS_DIR" "${DB_BASE_DIR}/plugins" "${DB_BASE_DIR}/modules" "$DB_CONF_DIR" "$DB_VOLUME_DIR" "$DB_INITSCRIPTS_DIR" "$DB_MOUNTED_PLUGINS_DIR" "$DB_DEFAULT_CONF_DIR" "$DB_DEFAULT_PLUGINS_DIR"; do - # `elasticsearch-plugin install` command complains about being unable to create the a plugin's directory - # even when having the proper permissions. - # The reason: the code is checking trying to check the permissions by consulting the parent directory owner, - # instead of checking if the ES user actually has writing permissions. - # - # As a workaround, we will ensure the container works (at least) with the non-root user 1001. However, - # until we can avoid this hack, we can't guarantee this container to work on K8s distributions - # where containers are exectued with non-privileged users with random user IDs. - # - # Issue reported at: https://github.com/bitnami/bitnami-docker-elasticsearch/issues/50 - chown -R 1001:0 "$dir" -done - -elasticsearch_install_plugins - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${DB_CONF_DIR}/"* "$DB_DEFAULT_CONF_DIR" -chmod o+rX -R "$DB_DEFAULT_CONF_DIR" -if ! is_dir_empty "$DB_PLUGINS_DIR"; then - # Move all initially installed plugins to the default plugins directory. - for plugin_path in "${DB_PLUGINS_DIR}"/*; do - plugin_name="$(basename "$plugin_path")" - plugin_moved_path="${DB_DEFAULT_PLUGINS_DIR}/${plugin_name}" - mv "$plugin_path" "$plugin_moved_path" - done - chmod o+rX -R "$DB_DEFAULT_PLUGINS_DIR" -fi diff --git a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/run.sh b/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/run.sh deleted file mode 100755 index 596b43e4aa0db..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/run.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -#set -o xtrace - -# Load libraries -. /opt/bitnami/scripts/libelasticsearch.sh -. /opt/bitnami/scripts/libos.sh - -# Load environment -. /opt/bitnami/scripts/elasticsearch-env.sh - -# Constants -EXEC=$(command -v elasticsearch) -ARGS=("-p" "$DB_PID_FILE") -[[ -z "${DB_EXTRA_FLAGS:-}" ]] || ARGS=("${ARGS[@]}" "${DB_EXTRA_FLAGS[@]}") -# JAVA_HOME to be deprecated, see warning: -# warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME -export JAVA_HOME=/opt/bitnami/java -export ES_JAVA_HOME=/opt/bitnami/java - -ARGS+=("$@") - -info "** Starting Elasticsearch **" -if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "$EXEC" "${ARGS[@]}" -else - exec "$EXEC" "${ARGS[@]}" -fi diff --git a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/setup.sh b/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/setup.sh deleted file mode 100755 index 742276a9353cd..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/elasticsearch/setup.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -#set -o xtrace - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libelasticsearch.sh - -# Load environment -. /opt/bitnami/scripts/elasticsearch-env.sh - -# Ensure Elasticsearch environment variables settings are valid -elasticsearch_validate -# Ensure Elasticsearch is stopped when this script ends -trap "elasticsearch_stop" EXIT -# Ensure 'daemon' user exists when running as 'root' -am_i_root && ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" -# Ensure Elasticsearch is initialized -elasticsearch_initialize -# Ensure kernel settings are valid -elasticsearch_validate_kernel -# Install Elasticsearch plugins -elasticsearch_install_plugins -# Ensure custom initialization scripts are executed -elasticsearch_custom_init_scripts -# Ensure all the required keys are added after plugins are installed -elasticsearch_set_keys diff --git a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 38802fc0bfe91..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -if [[ "$OS_FLAVOUR" =~ photon && "$APP_VERSION" =~ ^1.8 ]]; then - # Option --module-path is not supported by JAVA 1.8 since modules were added in version 1.9 - unset JAVA_TOOL_OPTIONS -fi - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/libelasticsearch.sh b/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/libelasticsearch.sh deleted file mode 100644 index ad5bf51b13604..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/rootfs/opt/bitnami/scripts/libelasticsearch.sh +++ /dev/null @@ -1,932 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Elasticsearch library - -# shellcheck disable=SC1090,SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libversion.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Configure TLS settings -# Globals: -# ELASTICSEARCH_* -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_transport_tls_configuration() { - info "Configuring Elasticsearch Transport TLS settings..." - elasticsearch_conf_set xpack.security.transport.ssl.enabled "true" - elasticsearch_conf_set xpack.security.transport.ssl.verification_mode "$DB_TLS_VERIFICATION_MODE" - - if is_boolean_yes "$DB_TRANSPORT_TLS_USE_PEM"; then - debug "Configuring Transport Layer TLS settings using PEM certificates..." - ! is_empty_value "$DB_TRANSPORT_TLS_KEY_PASSWORD" && elasticsearch_set_key_value "xpack.security.transport.ssl.secure_key_passphrase" "$DB_TRANSPORT_TLS_KEY_PASSWORD" - elasticsearch_conf_set xpack.security.transport.ssl.key "$DB_TRANSPORT_TLS_NODE_KEY_LOCATION" - elasticsearch_conf_set xpack.security.transport.ssl.certificate "$DB_TRANSPORT_TLS_NODE_CERT_LOCATION" - elasticsearch_conf_set xpack.security.transport.ssl.certificate_authorities "$DB_TRANSPORT_TLS_CA_CERT_LOCATION" - else - debug "Configuring Transport Layer TLS settings using JKS/PKCS certificates..." - ! is_empty_value "$DB_TRANSPORT_TLS_KEYSTORE_PASSWORD" && elasticsearch_set_key_value "xpack.security.transport.ssl.keystore.secure_password" "$DB_TRANSPORT_TLS_KEYSTORE_PASSWORD" - ! is_empty_value "$DB_TRANSPORT_TLS_TRUSTSTORE_PASSWORD" && elasticsearch_set_key_value "xpack.security.transport.ssl.truststore.secure_password" "$DB_TRANSPORT_TLS_TRUSTSTORE_PASSWORD" - elasticsearch_conf_set xpack.security.transport.ssl.keystore.path "$DB_TRANSPORT_TLS_KEYSTORE_LOCATION" - elasticsearch_conf_set xpack.security.transport.ssl.truststore.path "$DB_TRANSPORT_TLS_TRUSTSTORE_LOCATION" - fi -} - -######################## -# Configure TLS settings -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_http_tls_configuration() { - info "Configuring Elasticsearch HTTP TLS settings..." - elasticsearch_conf_set xpack.security.http.ssl.enabled "true" - if is_boolean_yes "$DB_HTTP_TLS_USE_PEM"; then - debug "Configuring REST API TLS settings using PEM certificates..." - ! is_empty_value "$DB_HTTP_TLS_KEY_PASSWORD" && elasticsearch_set_key_value "xpack.security.http.ssl.secure_key_passphrase" "$DB_HTTP_TLS_KEY_PASSWORD" - elasticsearch_conf_set xpack.security.http.ssl.key "$DB_HTTP_TLS_NODE_KEY_LOCATION" - elasticsearch_conf_set xpack.security.http.ssl.certificate "$DB_HTTP_TLS_NODE_CERT_LOCATION" - elasticsearch_conf_set xpack.security.http.ssl.certificate_authorities "$DB_HTTP_TLS_CA_CERT_LOCATION" - else - debug "Configuring REST API TLS settings using JKS/PKCS certificates..." - ! is_empty_value "$DB_HTTP_TLS_KEYSTORE_PASSWORD" && elasticsearch_set_key_value "xpack.security.http.ssl.keystore.secure_password" "$DB_HTTP_TLS_KEYSTORE_PASSWORD" - ! is_empty_value "$DB_HTTP_TLS_TRUSTSTORE_PASSWORD" && elasticsearch_set_key_value "xpack.security.http.ssl.truststore.secure_password" "$DB_HTTP_TLS_TRUSTSTORE_PASSWORD" - elasticsearch_conf_set xpack.security.http.ssl.keystore.path "$DB_HTTP_TLS_KEYSTORE_LOCATION" - elasticsearch_conf_set xpack.security.http.ssl.truststore.path "$DB_HTTP_TLS_TRUSTSTORE_LOCATION" - fi -} - -######################## -# Migrate old Elasticsearch data -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -migrate_old_data() { - warn "Persisted data follows old structure. Migrating to new one..." - warn "Custom configuration files won't be persisted any longer!" - local old_data_dir="${DB_DATA_DIR}/elasticsearch" - local old_custom_conf_file="${old_data_dir}/conf/elasticsearch_custom.yml" - local custom_conf_file="${DB_CONF_DIR}/elasticsearch_custom.yml" - if [[ -f "$old_custom_conf_file" ]]; then - debug "Adding old custom configuration to user configuration" - echo "" >>"$custom_conf_file" - cat "$old_custom_conf_file" >>"$custom_conf_file" - fi - debug "Adapting data to new file structure" - find "${old_data_dir}/data" -maxdepth 1 -mindepth 1 -exec mv {} "$DB_DATA_DIR" \; - debug "Removing data that is not persisted anymore from persisted directory" - rm -rf "$old_data_dir" "${DB_DATA_DIR}/java" -} - -######################## -# Set Elasticsearch keystore values -# Globals: -# ELASTICSEARCH_KEYS -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_set_keys() { - read -r -a keys_list <<<"$(tr ',;' ' ' <<<"$ELASTICSEARCH_KEYS")" - if [[ "${#keys_list[@]}" -gt 0 ]]; then - for key_value in "${keys_list[@]}"; do - read -r -a key_value <<<"$(tr '=' ' ' <<<"$key_value")" - local key="${key_value[0]}" - local value="${key_value[1]}" - - elasticsearch_set_key_value "$key" "$value" - done - fi -} - -######################## -# Set Elasticsearch keystore values -# Globals: -# ELASTICSEARCH_* -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_set_key_value() { - local key="${1:?missing key}" - local value="${2:?missing value}" - - debug "Storing key: ${key}" - elasticsearch-keystore add --stdin --force "$key" <<<"$value" - - am_i_root && chown "$DB_DAEMON_USER:$DB_DAEMON_GROUP" "${DB_CONF_DIR}/elasticsearch.keystore" - # Avoid exit code of previous commands to affect the result of this function - true -} - -#!/bin/bash -# -# Bitnami Elasticsearch/Opensearch common library - -# shellcheck disable=SC1090,SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libversion.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Write a configuration setting value -# Globals: -# DB_CONF_FILE -# Arguments: -# $1 - key -# $2 - value -# $3 - YAML type (string, int or bool) -# Returns: -# None -######################### -elasticsearch_conf_write() { - local -r key="${1:?Missing key}" - local -r value="${2:-}" - local -r type="${3:-string}" - local -r tempfile=$(mktemp) - - case "$type" in - string) - yq eval "(.${key}) |= \"${value}\"" "$DB_CONF_FILE" >"$tempfile" - ;; - int) - yq eval "(.${key}) |= ${value}" "$DB_CONF_FILE" >"$tempfile" - ;; - bool) - yq eval "(.${key}) |= (\"${value}\" | test(\"true\"))" "$DB_CONF_FILE" >"$tempfile" - ;; - *) - error "Type unknown: ${type}" - return 1 - ;; - esac - cp "$tempfile" "$DB_CONF_FILE" -} - -######################## -# Set a configuration setting value -# Globals: -# DB_CONF_FILE -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -elasticsearch_conf_set() { - local key="${1:?missing key}" - shift - local values=("${@}") - - if [[ "${#values[@]}" -eq 0 ]]; then - stderr_print "$key" - stderr_print "missing values" - return 1 - elif [[ "${#values[@]}" -eq 1 ]] && [[ -n "${values[0]}" ]]; then - elasticsearch_conf_write "$key" "${values[0]}" - else - for i in "${!values[@]}"; do - if [[ -n "${values[$i]}" ]]; then - elasticsearch_conf_write "${key}[$i]" "${values[$i]}" - fi - done - fi -} - -######################## -# Check if Elasticsearch is running -# Globals: -# DB_TMP_DIR -# Arguments: -# None -# Returns: -# Boolean -######################### -is_elasticsearch_running() { - local pid - pid="$(get_pid_from_file "$DB_PID_FILE")" - - if [[ -z "$pid" ]]; then - false - else - is_service_running "$pid" - fi -} - -######################## -# Check if Elasticsearch is not running -# Globals: -# DB_TMP_DIR -# Arguments: -# None -# Returns: -# Boolean -######################### -is_elasticsearch_not_running() { - ! is_elasticsearch_running - return "$?" -} - -######################## -# Stop Elasticsearch -# Globals: -# DB_TMP_DIR -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_stop() { - ! is_elasticsearch_running && return - debug "Stopping ${DB_FLAVOR^}..." - stop_service_using_pid "$DB_PID_FILE" -} - -######################## -# Start Elasticsearch and wait until it's ready -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_start() { - is_elasticsearch_running && return - - debug "Starting ${DB_FLAVOR^}..." - local command=("${DB_BASE_DIR}/bin/${DB_FLAVOR}" "-d" "-p" "$DB_PID_FILE") - am_i_root && command=("run_as_user" "$DB_DAEMON_USER" "${command[@]}") - if [[ "$BITNAMI_DEBUG" = true ]]; then - "${command[@]}" & - else - "${command[@]}" >/dev/null 2>&1 & - fi - - local retries=50 - local seconds=2 - # Check the process is running - retry_while "is_elasticsearch_running" "$retries" "$seconds" - # Check Elasticsearch API is reachable - retry_while "elasticsearch_healthcheck" "$retries" "$seconds" -} - -######################## -# Validate kernel settings -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_validate_kernel() { - # Auxiliary functions - validate_sysctl_key() { - local key="${1:?key is missing}" - local value="${2:?value is missing}" - local current_value - current_value="$(sysctl -n "$key")" - if [[ "$current_value" -lt "$value" ]]; then - error "Invalid kernel settings. ${DB_FLAVOR^} requires at least: $key = $value" - exit 1 - fi - } - - debug "Validating Kernel settings..." - if [[ $(yq eval .index.store.type "$DB_CONF_FILE") ]]; then - debug "Custom index.store.type found in the config file. Skipping kernel validation..." - else - validate_sysctl_key "fs.file-max" 65536 - fi - if [[ $(yq eval .node.store.allow_mmap "$DB_CONF_FILE") ]]; then - debug "Custom node.store.allow_mmap found in the config file. Skipping kernel validation..." - else - validate_sysctl_key "vm.max_map_count" 262144 - fi -} - -######################## -# Validate settings in DB_* env vars -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_validate() { - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - validate_node_roles() { - if [ -n "$DB_NODE_ROLES" ]; then - read -r -a roles_list <<<"$(get_elasticsearch_roles)" - local master_role="master" - [[ "$DB_FLAVOR" = "opensearch" && "$APP_VERSION" =~ ^2\. ]] && master_role="cluster_manager" - if [[ "${#roles_list[@]}" -le 0 ]]; then - warn "Setting ${DB_FLAVOR^^}_NODE_ROLES is empty and ${DB_FLAVOR^^}_IS_DEDICATED_NODE is set to true, ${DB_FLAVOR^} will be configured as coordinating-only node." - fi - for role in "${roles_list[@]}"; do - case "$role" in - "$master_role" | data | data_content | data_hot | data_warm | data_cold | data_frozen | ingest | ml | remote_cluster_client | transform) ;; - - *) - print_validation_error "Invalid node role '$role'. Supported roles are '${master_role},data,data_content,data_hot,data_warm,data_cold,data_frozen,ingest,ml,remote_cluster_client,transform'" - ;; - esac - done - fi - } - - debug "Ensuring expected directories/files exist..." - am_i_root && ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" - for dir in "$DB_TMP_DIR" "$DB_LOGS_DIR" "$DB_PLUGINS_DIR" "$DB_BASE_DIR/modules" "$DB_CONF_DIR"; do - ensure_dir_exists "$dir" - am_i_root && chown -R "$DB_DAEMON_USER:$DB_DAEMON_GROUP" "$dir" - done - - debug "Validating settings in DB_* env vars..." - for var in "DB_HTTP_PORT_NUMBER" "DB_TRANSPORT_PORT_NUMBER"; do - if ! err=$(validate_port "${!var}"); then - print_validation_error "An invalid port was specified in the environment variable $var: $err" - fi - done - - if ! is_boolean_yes "$DB_IS_DEDICATED_NODE"; then - warn "Setting ${DB_FLAVOR^^}_IS_DEDICATED_NODE is disabled." - warn "${DB_FLAVOR^^}_NODE_ROLES will be ignored and ${DB_FLAVOR^} will asume all different roles." - else - validate_node_roles - fi - - if [[ -n "$DB_BIND_ADDRESS" ]] && ! validate_ipv4 "$DB_BIND_ADDRESS"; then - print_validation_error "The Bind Address specified in the environment variable ${DB_FLAVOR^^}_BIND_ADDRESS is not a valid IPv4" - fi - - if is_boolean_yes "$DB_ENABLE_SECURITY"; then - if [[ "$DB_FLAVOR" = "opensearch" ]]; then - if [[ ! -f "$OPENSEARCH_SECURITY_ADMIN_KEY_LOCATION" ]] || [[ ! -f "$OPENSEARCH_SECURITY_ADMIN_CERT_LOCATION" ]]; then - print_validation_error "In order to enable Opensearch Security, you must provide a valid admin PEM key and certificate." - fi - if is_empty_value "$OPENSEARCH_SECURITY_NODES_DN"; then - print_validation_error "The variable OPENSEARCH_SECURITY_NODES_DN is required." - fi - if is_empty_value "$OPENSEARCH_SECURITY_ADMIN_DN"; then - print_validation_error "The variable OPENSEARCH_SECURITY_ADMIN_DN is required." - fi - if ! is_boolean_yes "$OPENSEARCH_ENABLE_REST_TLS"; then - print_validation_error "Opensearch does not support plaintext conections (HTTP) when Security is enabled." - fi - fi - if ! is_boolean_yes "$DB_SKIP_TRANSPORT_TLS"; then - if is_boolean_yes "$DB_TRANSPORT_TLS_USE_PEM"; then - if [[ ! -f "$DB_TRANSPORT_TLS_NODE_CERT_LOCATION" ]] || [[ ! -f "$DB_TRANSPORT_TLS_NODE_KEY_LOCATION" ]] || [[ ! -f "$DB_TRANSPORT_TLS_CA_CERT_LOCATION" ]]; then - print_validation_error "In order to configure the TLS encryption for ${DB_FLAVOR^} Transport you must provide your node key, certificate and a valid certification_authority certificate." - fi - elif [[ ! -f "$DB_TRANSPORT_TLS_KEYSTORE_LOCATION" ]] || [[ ! -f "$DB_TRANSPORT_TLS_TRUSTSTORE_LOCATION" ]]; then - print_validation_error "In order to configure the TLS encryption for ${DB_FLAVOR^} Transport with JKS/PKCS12 certs you must mount a valid keystore and truststore." - fi - fi - if is_boolean_yes "$DB_HTTP_TLS_USE_PEM"; then - if is_boolean_yes "$DB_HTTP_TLS_USE_PEM"; then - if [[ ! -f "$DB_HTTP_TLS_NODE_CERT_LOCATION" ]] || [[ ! -f "$DB_HTTP_TLS_NODE_KEY_LOCATION" ]] || [[ ! -f "$DB_HTTP_TLS_CA_CERT_LOCATION" ]]; then - print_validation_error "In order to configure the TLS encryption for ${DB_FLAVOR^} you must provide your node key, certificate and a valid certification_authority certificate." - fi - elif [[ ! -f "$DB_HTTP_TLS_KEYSTORE_LOCATION" ]] || [[ ! -f "$DB_HTTP_TLS_TRUSTSTORE_LOCATION" ]]; then - print_validation_error "In order to configure the TLS encryption for ${DB_FLAVOR^} with JKS/PKCS12 certs you must mount a valid keystore and truststore." - fi - fi - fi - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Determine the hostname by which Elasticsearch can be contacted -# Returns: -# The value of $DB_ADVERTISED_HOSTNAME or the current host address -######################## -get_elasticsearch_hostname() { - if [[ -n "$DB_ADVERTISED_HOSTNAME" ]]; then - echo "$DB_ADVERTISED_HOSTNAME" - else - get_machine_ip - fi -} - -######################## -# Evaluates the env variable DB_NODE_ROLES and replaces master with -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Array of node roles -######################### -get_elasticsearch_roles() { - read -r -a roles_list_tmp <<<"$(tr ',;' ' ' <<<"$DB_NODE_ROLES")" - roles_list=("${roles_list_tmp[@]}") - for i in "${!roles_list[@]}"; do - if [[ ${roles_list[$i]} == "master" ]] && [[ "$DB_FLAVOR" = "opensearch" && "$APP_VERSION" =~ ^2\. ]]; then - roles_list[i]="cluster_manager" - fi - done - echo "${roles_list[@]}" -} - -######################## -# Configure cluster settings -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_cluster_configuration() { - # Auxiliary functions - bind_address() { - if [[ -n "$DB_BIND_ADDRESS" ]]; then - echo "$DB_BIND_ADDRESS" - else - echo "0.0.0.0" - fi - } - - is_node_master() { - if is_boolean_yes "$DB_IS_DEDICATED_NODE"; then - if [ -n "$DB_NODE_ROLES" ]; then - read -r -a roles_list <<<"$(get_elasticsearch_roles)" - if [[ " ${roles_list[*]} " = *" master "* ]]; then - true - elif [[ "$DB_FLAVOR" = "opensearch" && " ${roles_list[*]} " = *" cluster_manager "* ]]; then - true - else - false - fi - else - false - fi - else - true - fi - } - - info "Configuring ${DB_FLAVOR^} cluster settings..." - elasticsearch_conf_set network.host "$(get_elasticsearch_hostname)" - elasticsearch_conf_set network.publish_host "$(get_elasticsearch_hostname)" - elasticsearch_conf_set network.bind_host "$(bind_address)" - elasticsearch_conf_set cluster.name "$DB_CLUSTER_NAME" - elasticsearch_conf_set node.name "${DB_NODE_NAME:-$(hostname)}" - - if [[ -n "$DB_CLUSTER_HOSTS" ]]; then - read -r -a host_list <<<"$(tr ',;' ' ' <<<"$DB_CLUSTER_HOSTS")" - master_list=("${host_list[@]}") - if [[ -n "$DB_CLUSTER_MASTER_HOSTS" ]]; then - read -r -a master_list <<<"$(tr ',;' ' ' <<<"$DB_CLUSTER_MASTER_HOSTS")" - fi - elasticsearch_conf_set discovery.seed_hosts "${host_list[@]}" - if is_node_master; then - if [[ "$DB_FLAVOR" = "opensearch" && "$APP_VERSION" =~ ^2\. ]]; then - elasticsearch_conf_set cluster.initial_cluster_manager_nodes "${master_list[@]}" - else - elasticsearch_conf_set cluster.initial_master_nodes "${master_list[@]}" - fi - fi - elasticsearch_conf_set discovery.initial_state_timeout "10m" - else - elasticsearch_conf_set "discovery.type" "single-node" - fi -} - -######################## -# Extend cluster settings with custom, user-provided config -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_custom_configuration() { - local custom_conf_file="${DB_CONF_DIR}/my_${DB_FLAVOR}.yml" - local -r tempfile=$(mktemp) - [[ ! -s "$custom_conf_file" ]] && return - info "Adding custom configuration" - yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' "$DB_CONF_FILE" "$custom_conf_file" >"$tempfile" - cp "$tempfile" "$DB_CONF_FILE" -} - -######################## -# Configure node roles. -# There are 3 scenarios: -# * If DB_IS_DEDICATED_NODE is disabled, 'node.roles' is omitted and assumes all the roles (check docs). -# * Otherwise, 'node.roles' with a list of roles provided with DB_NODE_ROLES. -# * In addition, if DB_NODE_ROLES is empty, node.roles will be configured empty, meaning that the role is 'coordinating-only'. -# -# Docs ref: https://www.elastic.co/guide/en/opensearch/reference/current/modules-node.html -# -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_configure_node_roles() { - debug "Configure ${DB_FLAVOR^} Node roles..." - - local set_repo_path="no" - if is_boolean_yes "$DB_IS_DEDICATED_NODE"; then - read -r -a roles_list <<<"$(get_elasticsearch_roles)" - if [[ "${#roles_list[@]}" -eq 0 ]]; then - elasticsearch_conf_write node.roles "[]" int - else - elasticsearch_conf_set node.roles "${roles_list[@]}" - for role in "${roles_list[@]}"; do - case "$role" in - cluster_manager | master | data | data_content | data_hot | data_warm | data_cold | data_frozen) - set_repo_path="yes" - ;; - *) ;; - esac - done - fi - else - set_repo_path="yes" - fi - - if is_boolean_yes "$set_repo_path" && [[ -n "$DB_FS_SNAPSHOT_REPO_PATH" ]]; then - # Configure path.repo to restore snapshots from system repository - # It must be set on every cluster_manager and data node - # ref: https://www.elastic.co/guide/en/elasticsearch/reference/current/snapshots-filesystem-repository.html - elasticsearch_conf_set path.repo "$DB_FS_SNAPSHOT_REPO_PATH" - fi -} - -######################## -# Configure Heap Size -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_set_heap_size() { - local heap_size - - # Remove heap.options if it already exists - rm -f "${DB_CONF_DIR}/jvm.options.d/heap.options" - - if [[ -n "$DB_HEAP_SIZE" ]]; then - debug "Using specified values for Xmx and Xms heap options..." - heap_size="$DB_HEAP_SIZE" - else - debug "Calculating appropriate Xmx and Xms values..." - local machine_mem="" - machine_mem="$(get_total_memory)" - if [[ "$machine_mem" -lt 65536 ]]; then - local max_allowed_memory - local calculated_heap_size - calculated_heap_size="$((machine_mem / 2))" - max_allowed_memory="$((DB_MAX_ALLOWED_MEMORY_PERCENTAGE * machine_mem))" - max_allowed_memory="$((max_allowed_memory / 100))" - # Allow for absolute memory limit when calculating limit from percentage - if [[ -n "$DB_MAX_ALLOWED_MEMORY" && "$max_allowed_memory" -gt "$DB_MAX_ALLOWED_MEMORY" ]]; then - max_allowed_memory="$DB_MAX_ALLOWED_MEMORY" - fi - if [[ "$calculated_heap_size" -gt "$max_allowed_memory" ]]; then - info "Calculated Java heap size of ${calculated_heap_size} will be limited to ${max_allowed_memory}" - calculated_heap_size="$max_allowed_memory" - fi - heap_size="${calculated_heap_size}m" - - else - heap_size=32768m - fi - fi - debug "Setting '-Xmx${heap_size} -Xms${heap_size}' heap options..." - cat >"${DB_CONF_DIR}/jvm.options.d/heap.options" < plugin - # get_plugin_name file://plugin.zip -> plugin - # get_plugin_name http://plugin-0.1.2.zip -> plugin - get_plugin_name() { - local plugin="${1:?missing plugin}" - # Remove any paths, and strip both the .zip extension and the version - basename "$plugin" | sed -E -e 's/.zip$//' -e 's/-[0-9]+\.[0-9]+(\.[0-9]+){0,}$//' - } - - # Collect plugins that should be installed offline - read -r -a mounted_plugins <<<"$(find "$DB_MOUNTED_PLUGINS_DIR" -type f -name "*.zip" -print0 | xargs -0)" - if [[ "${#mounted_plugins[@]}" -gt 0 ]]; then - for plugin in "${mounted_plugins[@]}"; do - plugins_list+=("file://${plugin}") - done - fi - - # Skip if there isn't any plugin to install - [[ -z "${plugins_list[*]:-}" ]] && return - - # Install plugins - debug "Installing plugins: ${plugins_list[*]}" - for plugin in "${plugins_list[@]}"; do - plugin_name="$(get_plugin_name "$plugin")" - [[ -n "$mandatory_plugins" ]] && mandatory_plugins="${mandatory_plugins},${plugin_name}" || mandatory_plugins="$plugin_name" - - # Check if the plugin was already installed - if [[ -d "${DB_PLUGINS_DIR}/${plugin_name}" ]]; then - debug "Plugin already installed: ${plugin}" - continue - fi - - debug "Installing plugin: ${plugin}" - if [[ "${BITNAMI_DEBUG:-false}" = true ]]; then - "$cmd" install -b -v "$plugin" - else - "$cmd" install -b -v "$plugin" >/dev/null 2>&1 - fi - done - - # Mark plugins as mandatory - elasticsearch_conf_set plugin.mandatory "$mandatory_plugins" -} - -######################## -# Run custom initialization scripts -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_custom_init_scripts() { - read -r -a init_scripts <<<"$(find "$DB_INITSCRIPTS_DIR" -type f -name "*.sh" -print0 | xargs -0)" - if [[ "${#init_scripts[@]}" -gt 0 ]] && [[ ! -f "$DB_VOLUME_DIR"/.user_scripts_initialized ]]; then - info "Loading user's custom files from $DB_INITSCRIPTS_DIR" - for f in "${init_scripts[@]}"; do - debug "Executing $f" - case "$f" in - *.sh) - if [[ -x "$f" ]]; then - if ! "$f"; then - error "Failed executing $f" - return 1 - fi - else - warn "Sourcing $f as it is not executable by the current user, any error may cause initialization to fail" - . "$f" - fi - ;; - *) - warn "Skipping $f, supported formats are: .sh" - ;; - esac - done - touch "$DB_VOLUME_DIR"/.user_scripts_initialized - fi -} - -######################## -# Modify log4j2.properties to send events to stdout instead of a logfile -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -elasticsearch_configure_logging() { - # Back up the original file for users who'd like to use logfile logging - cp "${DB_CONF_DIR}/log4j2.properties" "${DB_CONF_DIR}/log4j2.file.properties" - - # Replace RollingFile with Console - replace_in_file "${DB_CONF_DIR}/log4j2.properties" "RollingFile" "Console" - - local -a delete_patterns=( - # Remove RollingFile specific settings - "^.*\.policies\..*$" "^.*\.filePattern.*$" "^.*\.fileName.*$" "^.*\.strategy\..*$" - # Remove headers - "^###.*$" - # Remove .log and .json because of multiline configurations (filename) - "^\s\s.*\.log" "^\s\s.*\.json" - # Remove default rolling logger and references - "^appender\.rolling" "appenderRef\.rolling" - # Remove _old loggers - "_old\." - # Remove .filePermissions config - "\.filePermissions" - ) - for pattern in "${delete_patterns[@]}"; do - remove_in_file "${DB_CONF_DIR}/log4j2.properties" "$pattern" - done -} - -######################## -# Check Elasticsearch/Opensearch health -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# 0 when healthy (or waiting for Opensearch security bootstrap) -# 1 when unhealthy -######################### -elasticsearch_healthcheck() { - info "Checking ${DB_FLAVOR^} health..." - local -r cmd="curl" - local command_args=("--silent" "--write-out" "%{http_code}") - local protocol="http" - local host - - host=$(get_elasticsearch_hostname) - if validate_ipv6 "$host"; then - host="[${host}]" - fi - - if is_boolean_yes "$DB_ENABLE_SECURITY"; then - command_args+=("-k" "--user" "${DB_USERNAME}:${DB_PASSWORD}") - is_boolean_yes "$DB_ENABLE_REST_TLS" && protocol="https" - fi - - # Combination of --silent, --output and --write-out allows us to obtain both the status code and the request body - output=$(mktemp) - command_args+=("-o" "$output" "${protocol}://${host}:${DB_HTTP_PORT_NUMBER}/_cluster/health?local=true") - HTTP_CODE=$("$cmd" "${command_args[@]}") - if [[ ${HTTP_CODE} -ge 200 && ${HTTP_CODE} -le 299 ]] || ([[ "$DB_FLAVOR" = "opensearch" ]] && [[ ${HTTP_CODE} -eq 503 ]] && grep -q "OpenSearch Security not initialized" "$output" ); then - rm "$output" - return 0 - else - rm "$output" - return 1 - fi -} diff --git a/bitnami/elasticsearch/7/debian-12/tags-info.yaml b/bitnami/elasticsearch/7/debian-12/tags-info.yaml deleted file mode 100644 index ece0cc84d23ad..0000000000000 --- a/bitnami/elasticsearch/7/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "7" -- 7-debian-12 -- 7.17.26 diff --git a/bitnami/envoy/1.29/README.md b/bitnami/envoy/1.29/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/envoy/1.29/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/envoy/1.29/debian-12/Dockerfile b/bitnami/envoy/1.29/debian-12/Dockerfile deleted file mode 100644 index 02dc7d11e3767..0000000000000 --- a/bitnami/envoy/1.29/debian-12/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-08T18:47:40Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/envoy/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="1.29.11-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/envoy" \ - org.opencontainers.image.title="envoy" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="1.29.11" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "envoy-1.29.11-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -ENV APP_VERSION="1.29.11" \ - BITNAMI_APP_NAME="envoy" \ - PATH="/opt/bitnami/envoy/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/envoy/bin/envoy" ] -CMD [ "-c", "/opt/bitnami/envoy/conf/envoy.yaml" ] diff --git a/bitnami/envoy/1.29/debian-12/docker-compose-testing.yml b/bitnami/envoy/1.29/debian-12/docker-compose-testing.yml deleted file mode 100644 index ff9bd1f17118a..0000000000000 --- a/bitnami/envoy/1.29/debian-12/docker-compose-testing.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - - envoy: - image: docker.io/bitnami/envoy:1.29 - volumes: - - ./examples/frontend.yaml:/opt/bitnami/envoy/conf/envoy.yaml - - service1: - image: bitnami/nginx - - service2: - image: bitnami/apache - diff --git a/bitnami/envoy/1.29/debian-12/docker-compose.yml b/bitnami/envoy/1.29/debian-12/docker-compose.yml deleted file mode 100644 index 2f3ccbca18ac0..0000000000000 --- a/bitnami/envoy/1.29/debian-12/docker-compose.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - envoy: - image: docker.io/bitnami/envoy:1.29 diff --git a/bitnami/envoy/1.29/debian-12/examples/frontend.yaml b/bitnami/envoy/1.29/debian-12/examples/frontend.yaml deleted file mode 100644 index 0803f3c363620..0000000000000 --- a/bitnami/envoy/1.29/debian-12/examples/frontend.yaml +++ /dev/null @@ -1,58 +0,0 @@ -admin: - access_log_path: /tmp/admin_access.log - address: - socket_address: { address: 127.0.0.1, port_value: 8081 } - -static_resources: - listeners: - - name: listener_0 - address: - socket_address: { address: 0.0.0.0, port_value: 8080 } - filter_chains: - - filters: - - name: envoy.filters.network.http_connection_manager - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager - stat_prefix: ingress_http - codec_type: AUTO - route_config: - name: local_route - virtual_hosts: - - name: local_service - domains: ["*"] - routes: - - match: { prefix: "/nginx" } - route: { cluster: service1, prefix_rewrite: "/" } - - match: { prefix: "/apache" } - route: { cluster: service2, prefix_rewrite: "/" } - http_filters: - - name: envoy.filters.http.router - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router - clusters: - - name: service1 - connect_timeout: 0.25s - type: STRICT_DNS - lb_policy: ROUND_ROBIN - load_assignment: - cluster_name: some_service - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: service1 - port_value: 8080 - - name: service2 - connect_timeout: 0.25s - type: STRICT_DNS - lb_policy: ROUND_ROBIN - load_assignment: - cluster_name: some_service - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: service2 - port_value: 8080 diff --git a/bitnami/envoy/1.29/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/envoy/1.29/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 735e003d4fec0..0000000000000 --- a/bitnami/envoy/1.29/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "envoy": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.29.11-0" - } -} \ No newline at end of file diff --git a/bitnami/envoy/1.29/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/envoy/1.29/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/envoy/1.29/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/envoy/1.29/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/envoy/1.29/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/envoy/1.29/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/envoy/1.29/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/envoy/1.29/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/envoy/1.29/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/envoy/1.29/debian-12/tags-info.yaml b/bitnami/envoy/1.29/debian-12/tags-info.yaml deleted file mode 100644 index c16ecd5d267c8..0000000000000 --- a/bitnami/envoy/1.29/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "1.29" -- 1.29-debian-12 -- 1.29.11 diff --git a/bitnami/envoy/1.30/README.md b/bitnami/envoy/1.30/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/envoy/1.30/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/envoy/1.30/debian-12/Dockerfile b/bitnami/envoy/1.30/debian-12/Dockerfile deleted file mode 100644 index 61bb9394caac5..0000000000000 --- a/bitnami/envoy/1.30/debian-12/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-08T19:58:39Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/envoy/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="1.30.8-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/envoy" \ - org.opencontainers.image.title="envoy" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="1.30.8" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "envoy-1.30.8-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -ENV APP_VERSION="1.30.8" \ - BITNAMI_APP_NAME="envoy" \ - PATH="/opt/bitnami/envoy/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/envoy/bin/envoy" ] -CMD [ "-c", "/opt/bitnami/envoy/conf/envoy.yaml" ] diff --git a/bitnami/envoy/1.30/debian-12/docker-compose-testing.yml b/bitnami/envoy/1.30/debian-12/docker-compose-testing.yml deleted file mode 100644 index 6b7465cfc7376..0000000000000 --- a/bitnami/envoy/1.30/debian-12/docker-compose-testing.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - - envoy: - image: docker.io/bitnami/envoy:1.30 - volumes: - - ./examples/frontend.yaml:/opt/bitnami/envoy/conf/envoy.yaml - - service1: - image: bitnami/nginx - - service2: - image: bitnami/apache - diff --git a/bitnami/envoy/1.30/debian-12/docker-compose.yml b/bitnami/envoy/1.30/debian-12/docker-compose.yml deleted file mode 100644 index 084c93eb7cd21..0000000000000 --- a/bitnami/envoy/1.30/debian-12/docker-compose.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - envoy: - image: docker.io/bitnami/envoy:1.30 diff --git a/bitnami/envoy/1.30/debian-12/examples/frontend.yaml b/bitnami/envoy/1.30/debian-12/examples/frontend.yaml deleted file mode 100644 index 0803f3c363620..0000000000000 --- a/bitnami/envoy/1.30/debian-12/examples/frontend.yaml +++ /dev/null @@ -1,58 +0,0 @@ -admin: - access_log_path: /tmp/admin_access.log - address: - socket_address: { address: 127.0.0.1, port_value: 8081 } - -static_resources: - listeners: - - name: listener_0 - address: - socket_address: { address: 0.0.0.0, port_value: 8080 } - filter_chains: - - filters: - - name: envoy.filters.network.http_connection_manager - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager - stat_prefix: ingress_http - codec_type: AUTO - route_config: - name: local_route - virtual_hosts: - - name: local_service - domains: ["*"] - routes: - - match: { prefix: "/nginx" } - route: { cluster: service1, prefix_rewrite: "/" } - - match: { prefix: "/apache" } - route: { cluster: service2, prefix_rewrite: "/" } - http_filters: - - name: envoy.filters.http.router - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router - clusters: - - name: service1 - connect_timeout: 0.25s - type: STRICT_DNS - lb_policy: ROUND_ROBIN - load_assignment: - cluster_name: some_service - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: service1 - port_value: 8080 - - name: service2 - connect_timeout: 0.25s - type: STRICT_DNS - lb_policy: ROUND_ROBIN - load_assignment: - cluster_name: some_service - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: service2 - port_value: 8080 diff --git a/bitnami/envoy/1.30/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/envoy/1.30/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 3b76626a6f167..0000000000000 --- a/bitnami/envoy/1.30/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "envoy": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.30.8-0" - } -} \ No newline at end of file diff --git a/bitnami/envoy/1.30/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/envoy/1.30/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/envoy/1.30/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/envoy/1.30/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/envoy/1.30/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/envoy/1.30/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/envoy/1.30/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/envoy/1.30/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/envoy/1.30/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/envoy/1.30/debian-12/tags-info.yaml b/bitnami/envoy/1.30/debian-12/tags-info.yaml deleted file mode 100644 index b151099c25b7e..0000000000000 --- a/bitnami/envoy/1.30/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "1.30" -- 1.30-debian-12 -- 1.30.8 diff --git a/bitnami/envoy/1.31/README.md b/bitnami/envoy/1.31/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/envoy/1.31/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/envoy/1.31/debian-12/Dockerfile b/bitnami/envoy/1.31/debian-12/Dockerfile deleted file mode 100644 index 3c8a90cb4ca62..0000000000000 --- a/bitnami/envoy/1.31/debian-12/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-08T21:02:33Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/envoy/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="1.31.4-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/envoy" \ - org.opencontainers.image.title="envoy" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="1.31.4" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "envoy-1.31.4-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -ENV APP_VERSION="1.31.4" \ - BITNAMI_APP_NAME="envoy" \ - PATH="/opt/bitnami/envoy/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/envoy/bin/envoy" ] -CMD [ "-c", "/opt/bitnami/envoy/conf/envoy.yaml" ] diff --git a/bitnami/envoy/1.31/debian-12/docker-compose-testing.yml b/bitnami/envoy/1.31/debian-12/docker-compose-testing.yml deleted file mode 100644 index 9b0ab7cf0412a..0000000000000 --- a/bitnami/envoy/1.31/debian-12/docker-compose-testing.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - - envoy: - image: docker.io/bitnami/envoy:1.31 - volumes: - - ./examples/frontend.yaml:/opt/bitnami/envoy/conf/envoy.yaml - - service1: - image: bitnami/nginx - - service2: - image: bitnami/apache - diff --git a/bitnami/envoy/1.31/debian-12/docker-compose.yml b/bitnami/envoy/1.31/debian-12/docker-compose.yml deleted file mode 100644 index fce2ec3ff97fd..0000000000000 --- a/bitnami/envoy/1.31/debian-12/docker-compose.yml +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - envoy: - image: docker.io/bitnami/envoy:1.31 diff --git a/bitnami/envoy/1.31/debian-12/examples/frontend.yaml b/bitnami/envoy/1.31/debian-12/examples/frontend.yaml deleted file mode 100644 index 0803f3c363620..0000000000000 --- a/bitnami/envoy/1.31/debian-12/examples/frontend.yaml +++ /dev/null @@ -1,58 +0,0 @@ -admin: - access_log_path: /tmp/admin_access.log - address: - socket_address: { address: 127.0.0.1, port_value: 8081 } - -static_resources: - listeners: - - name: listener_0 - address: - socket_address: { address: 0.0.0.0, port_value: 8080 } - filter_chains: - - filters: - - name: envoy.filters.network.http_connection_manager - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager - stat_prefix: ingress_http - codec_type: AUTO - route_config: - name: local_route - virtual_hosts: - - name: local_service - domains: ["*"] - routes: - - match: { prefix: "/nginx" } - route: { cluster: service1, prefix_rewrite: "/" } - - match: { prefix: "/apache" } - route: { cluster: service2, prefix_rewrite: "/" } - http_filters: - - name: envoy.filters.http.router - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router - clusters: - - name: service1 - connect_timeout: 0.25s - type: STRICT_DNS - lb_policy: ROUND_ROBIN - load_assignment: - cluster_name: some_service - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: service1 - port_value: 8080 - - name: service2 - connect_timeout: 0.25s - type: STRICT_DNS - lb_policy: ROUND_ROBIN - load_assignment: - cluster_name: some_service - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: service2 - port_value: 8080 diff --git a/bitnami/envoy/1.31/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/envoy/1.31/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index e6bc7cd5bfef2..0000000000000 --- a/bitnami/envoy/1.31/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "envoy": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.31.4-0" - } -} \ No newline at end of file diff --git a/bitnami/envoy/1.31/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/envoy/1.31/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/envoy/1.31/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/envoy/1.31/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/envoy/1.31/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/envoy/1.31/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/envoy/1.31/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/envoy/1.31/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/envoy/1.31/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/envoy/1.31/debian-12/tags-info.yaml b/bitnami/envoy/1.31/debian-12/tags-info.yaml deleted file mode 100644 index 116e20e1ffb7e..0000000000000 --- a/bitnami/envoy/1.31/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "1.31" -- 1.31-debian-12 -- 1.31.4 diff --git a/bitnami/etcd/3.4/README.md b/bitnami/etcd/3.4/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/etcd/3.4/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/etcd/3.4/debian-12/Dockerfile b/bitnami/etcd/3.4/debian-12/Dockerfile deleted file mode 100644 index e0b7e8b8addf8..0000000000000 --- a/bitnami/etcd/3.4/debian-12/Dockerfile +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T21:29:51Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/etcd/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="3.4.35-debian-12-r2" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/etcd" \ - org.opencontainers.image.title="etcd" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="3.4.35" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "yq-4.44.5-0-linux-${OS_ARCH}-debian-12" \ - "etcd-3.4.35-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y ca-certificates curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/etcd/postunpack.sh -ENV APP_VERSION="3.4.35" \ - BITNAMI_APP_NAME="etcd" \ - ETCDCTL_API="3" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/etcd/bin:$PATH" - -EXPOSE 2379 2380 - -WORKDIR /opt/bitnami/etcd -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/etcd/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/etcd/run.sh" ] diff --git a/bitnami/etcd/3.4/debian-12/docker-compose-cluster.yml b/bitnami/etcd/3.4/debian-12/docker-compose-cluster.yml deleted file mode 100644 index 7b80cc748a25a..0000000000000 --- a/bitnami/etcd/3.4/debian-12/docker-compose-cluster.yml +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - etcd1: - image: docker.io/bitnami/etcd:3.4 - environment: - - ALLOW_NONE_AUTHENTICATION=yes - - ETCD_NAME=etcd1 - - ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd1:2380 - - ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 - - ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 - - ETCD_ADVERTISE_CLIENT_URLS=http://etcd1:2379 - - ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster - - ETCD_INITIAL_CLUSTER=etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380 - - ETCD_INITIAL_CLUSTER_STATE=new - etcd2: - image: docker.io/bitnami/etcd:3.4 - environment: - - ALLOW_NONE_AUTHENTICATION=yes - - ETCD_NAME=etcd2 - - ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd2:2380 - - ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 - - ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 - - ETCD_ADVERTISE_CLIENT_URLS=http://etcd2:2379 - - ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster - - ETCD_INITIAL_CLUSTER=etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380 - - ETCD_INITIAL_CLUSTER_STATE=new - etcd3: - image: docker.io/bitnami/etcd:3.4 - environment: - - ALLOW_NONE_AUTHENTICATION=yes - - ETCD_NAME=etcd3 - - ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd3:2380 - - ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 - - ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 - - ETCD_ADVERTISE_CLIENT_URLS=http://etcd3:2379 - - ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster - - ETCD_INITIAL_CLUSTER=etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380 - - ETCD_INITIAL_CLUSTER_STATE=new diff --git a/bitnami/etcd/3.4/debian-12/docker-compose.yml b/bitnami/etcd/3.4/debian-12/docker-compose.yml deleted file mode 100644 index 6e618aaf1ea1e..0000000000000 --- a/bitnami/etcd/3.4/debian-12/docker-compose.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - etcd: - image: docker.io/bitnami/etcd:3.4 - environment: - - ALLOW_NONE_AUTHENTICATION=yes - volumes: - - etcd_data:/bitnami/etcd -volumes: - etcd_data: - driver: local diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index c2471ccfc0898..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "etcd": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "3.4.35-1" - }, - "yq": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "4.44.5-0" - } -} \ No newline at end of file diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/etcd/3.4/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/etcd/3.4/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/etcd/3.4/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/etcd/3.4/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd-env.sh b/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd-env.sh deleted file mode 100644 index 723c73a9f1da1..0000000000000 --- a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd-env.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for etcd - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-etcd}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -etcd_env_vars=( - ETCD_SNAPSHOTS_DIR - ETCD_SNAPSHOT_HISTORY_LIMIT - ETCD_INIT_SNAPSHOTS_DIR - ALLOW_NONE_AUTHENTICATION - ETCD_ROOT_PASSWORD - ETCD_CLUSTER_DOMAIN - ETCD_START_FROM_SNAPSHOT - ETCD_DISASTER_RECOVERY - ETCD_ON_K8S - ETCD_INIT_SNAPSHOT_FILENAME - ETCDCTL_API - ETCD_DISABLE_STORE_MEMBER_ID - ETCD_DISABLE_PRESTOP - ETCD_NAME - ETCD_LOG_LEVEL - ETCD_LISTEN_CLIENT_URLS - ETCD_ADVERTISE_CLIENT_URLS - ETCD_INITIAL_CLUSTER - ETCD_INITIAL_CLUSTER_STATE - ETCD_LISTEN_PEER_URLS - ETCD_INITIAL_ADVERTISE_PEER_URLS - ETCD_INITIAL_CLUSTER_TOKEN - ETCD_AUTO_TLS - ETCD_CERT_FILE - ETCD_KEY_FILE - ETCD_TRUSTED_CA_FILE - ETCD_CLIENT_CERT_AUTH - ETCD_PEER_AUTO_TLS -) -for env_var in "${etcd_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset etcd_env_vars - -# Paths -export ETCD_BASE_DIR="/opt/bitnami/etcd" -export ETCD_VOLUME_DIR="/bitnami/etcd" -export ETCD_BIN_DIR="${ETCD_BASE_DIR}/bin" -export ETCD_DATA_DIR="${ETCD_VOLUME_DIR}/data" -export ETCD_CONF_DIR="${ETCD_BASE_DIR}/conf" -export ETCD_DEFAULT_CONF_DIR="${ETCD_BASE_DIR}/conf.default" -export ETCD_TMP_DIR="${ETCD_BASE_DIR}/tmp" -export ETCD_CONF_FILE="${ETCD_CONF_DIR}/etcd.yaml" -export ETCD_SNAPSHOTS_DIR="${ETCD_SNAPSHOTS_DIR:-/snapshots}" -export ETCD_SNAPSHOT_HISTORY_LIMIT="${ETCD_SNAPSHOT_HISTORY_LIMIT:-1}" -export ETCD_INIT_SNAPSHOTS_DIR="${ETCD_INIT_SNAPSHOTS_DIR:-/init-snapshot}" -export ETCD_NEW_MEMBERS_ENV_FILE="${ETCD_DATA_DIR}/new_member_envs" -export PATH="${ETCD_BIN_DIR}:${BITNAMI_ROOT_DIR}/common/bin:${PATH}" - -# System users (when running with a privileged user) -export ETCD_DAEMON_USER="etcd" -export ETCD_DAEMON_GROUP="etcd" - -# etcd settings -export ALLOW_NONE_AUTHENTICATION="${ALLOW_NONE_AUTHENTICATION:-no}" -export ETCD_ROOT_PASSWORD="${ETCD_ROOT_PASSWORD:-}" -export ETCD_CLUSTER_DOMAIN="${ETCD_CLUSTER_DOMAIN:-}" -export ETCD_START_FROM_SNAPSHOT="${ETCD_START_FROM_SNAPSHOT:-no}" -export ETCD_DISASTER_RECOVERY="${ETCD_DISASTER_RECOVERY:-no}" -export ETCD_ON_K8S="${ETCD_ON_K8S:-no}" -export ETCD_INIT_SNAPSHOT_FILENAME="${ETCD_INIT_SNAPSHOT_FILENAME:-}" -export ETCDCTL_API="${ETCDCTL_API:-3}" -export ETCD_DISABLE_STORE_MEMBER_ID="${ETCD_DISABLE_STORE_MEMBER_ID:-no}" -export ETCD_DISABLE_PRESTOP="${ETCD_DISABLE_PRESTOP:-no}" - -# etcd native environment variables (see https://etcd.io/docs/current/op-guide/configuration) -export ETCD_NAME="${ETCD_NAME:-}" -export ETCD_LOG_LEVEL="${ETCD_LOG_LEVEL:-info}" -export ETCD_LISTEN_CLIENT_URLS="${ETCD_LISTEN_CLIENT_URLS:-http://0.0.0.0:2379}" -export ETCD_ADVERTISE_CLIENT_URLS="${ETCD_ADVERTISE_CLIENT_URLS:-http://127.0.0.1:2379}" -export ETCD_INITIAL_CLUSTER="${ETCD_INITIAL_CLUSTER:-}" -export ETCD_INITIAL_CLUSTER_STATE="${ETCD_INITIAL_CLUSTER_STATE:-}" -export ETCD_LISTEN_PEER_URLS="${ETCD_LISTEN_PEER_URLS:-}" -export ETCD_INITIAL_ADVERTISE_PEER_URLS="${ETCD_INITIAL_ADVERTISE_PEER_URLS:-}" -export ETCD_INITIAL_CLUSTER_TOKEN="${ETCD_INITIAL_CLUSTER_TOKEN:-}" -export ETCD_AUTO_TLS="${ETCD_AUTO_TLS:-false}" -export ETCD_CERT_FILE="${ETCD_CERT_FILE:-}" -export ETCD_KEY_FILE="${ETCD_KEY_FILE:-}" -export ETCD_TRUSTED_CA_FILE="${ETCD_TRUSTED_CA_FILE:-}" -export ETCD_CLIENT_CERT_AUTH="${ETCD_CLIENT_CERT_AUTH:-false}" -export ETCD_PEER_AUTO_TLS="${ETCD_PEER_AUTO_TLS:-false}" - -# Custom environment variables may be defined below diff --git a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/entrypoint.sh b/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/entrypoint.sh deleted file mode 100755 index 6502c15e308bb..0000000000000 --- a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/entrypoint.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh - -# Load etcd environment variables -. /opt/bitnami/scripts/etcd-env.sh - -print_welcome_page - -if ! is_dir_empty "$ETCD_DEFAULT_CONF_DIR"; then - # We add the copy from default config in the entrypoint to not break users - # bypassing the setup.sh logic. If the file already exists do not overwrite (in - # case someone mounts a configuration file in /opt/bitnami/etcd/conf) - debug "Copying files from $ETCD_DEFAULT_CONF_DIR to $ETCD_CONF_DIR" - cp -nfr "$ETCD_DEFAULT_CONF_DIR"/. "$ETCD_CONF_DIR" -fi - -if [[ "$1" = "/opt/bitnami/scripts/etcd/run.sh" ]]; then - info "** Starting etcd setup **" - /opt/bitnami/scripts/etcd/setup.sh - info "** etcd setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/healthcheck.sh b/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/healthcheck.sh deleted file mode 100755 index dbb919a2007a5..0000000000000 --- a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/healthcheck.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o pipefail -set -o nounset - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libetcd.sh - -# Load etcd environment settings -. /opt/bitnami/scripts/etcd-env.sh - -read -r -a advertised_array <<< "$(tr ',;' ' ' <<< "$ETCD_ADVERTISE_CLIENT_URLS")" -host="$(parse_uri "${advertised_array[0]}" "host")" -port="$(parse_uri "${advertised_array[0]}" "port")" -read -r -a extra_flags <<< "$(etcdctl_auth_flags)" -extra_flags+=("--endpoints=${host}:${port}") - -# if ETCD_AUTO_TLS true or CA file not exists, just skip server cert verification -if [[ $ETCD_AUTO_TLS = true ]] || [[ ! -f "$ETCD_TRUSTED_CA_FILE" ]]; then - extra_flags+=("--insecure-skip-tls-verify") -fi - -if etcdctl endpoint health "${extra_flags[@]}"; then - exit 0 -else - error "Unhealthy endpoint!" - exit 1 -fi diff --git a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/postunpack.sh b/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/postunpack.sh deleted file mode 100755 index 168a8a40331d2..0000000000000 --- a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/postunpack.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh - -# Load etcd environment variables -. /opt/bitnami/scripts/etcd-env.sh - -for dir in "$ETCD_BIN_DIR" "$ETCD_DATA_DIR" "$ETCD_CONF_DIR" "$ETCD_DEFAULT_CONF_DIR" "${ETCD_BASE_DIR}/certs"; do - ensure_dir_exists "$dir" -done -chmod -R g+rwX "$ETCD_DATA_DIR" "${ETCD_BASE_DIR}/certs" - -if ! is_dir_empty "$ETCD_CONF_DIR"; then - # Copy all initially generated configuration files to the default directory - # (this is to avoid breaking when entrypoint is being overridden) - cp -r "${ETCD_CONF_DIR}/"* "$ETCD_DEFAULT_CONF_DIR" -fi \ No newline at end of file diff --git a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/prestop.sh b/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/prestop.sh deleted file mode 100755 index 9807c6937697f..0000000000000 --- a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/prestop.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 -set -o errexit -set -o pipefail -set -o nounset -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libetcd.sh - -# Load etcd environment settings -. /opt/bitnami/scripts/etcd-env.sh - -if is_boolean_yes "$ETCD_DISABLE_PRESTOP"; then - return 0 -fi - -endpoints="$(etcdctl_get_endpoints true)" -if is_empty_value "${endpoints}"; then - exit 0 -fi -read -r -a extra_flags <<<"$(etcdctl_auth_flags)" -extra_flags+=("--endpoints=${endpoints}" "--debug=true") -# We use 'sync' to ensure memory buffers are flushed to disk -# so we reduce the chances that the "member_removal.log" file is empty. -# ref: https://man7.org/linux/man-pages/man1/sync.1.html -etcdctl member remove "$(get_member_id)" "${extra_flags[@]}" >"$(dirname "$ETCD_DATA_DIR")/member_removal.log" -sync -d "$(dirname "$ETCD_DATA_DIR")/member_removal.log" diff --git a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/run.sh b/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/run.sh deleted file mode 100755 index 07b22b9bfb200..0000000000000 --- a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/run.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1090,SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libetcd.sh - -# Load etcd environment variables -. /opt/bitnami/scripts/etcd-env.sh - -# We need to unset ETCD_ROOT_PASSWORD otherwise it will be logged by etcd process -unset ETCD_ROOT_PASSWORD -if [[ -f "$ETCD_NEW_MEMBERS_ENV_FILE" ]]; then - debug "Loading env vars of existing cluster" - . "$ETCD_NEW_MEMBERS_ENV_FILE" - # We rely on the original value of ETCD_INITIAL_CLUSTER - # when bootstrapping a new cluster since - # we need all initial members to calcualte a same cluster_id -fi - -declare -a cmd=("etcd") -# If provided, run using configuration file -# Using a configuration file will cause etcd to ignore other flags and environment variables -[[ -f "$ETCD_CONF_FILE" ]] && cmd+=("--config-file" "$ETCD_CONF_FILE") -cmd+=("$@") - -info "** Starting etcd **" -if am_i_root; then - exec_as_user "$ETCD_DAEMON_USER" "${cmd[@]}" -else - exec "${cmd[@]}" -fi diff --git a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/setup.sh b/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/setup.sh deleted file mode 100755 index ac538eeaae6d0..0000000000000 --- a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/setup.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libetcd.sh - -# Load etcd environment settings -. /opt/bitnami/scripts/etcd-env.sh - -# Ensure etcd environment settings are valid -etcd_validate -# Ensure etcd is stopped when this script ends. -trap "etcd_stop" EXIT -# Ensure 'daemon' user exists when running as 'root' -am_i_root && ensure_user_exists "$ETCD_DAEMON_USER" --group "$ETCD_DAEMON_GROUP" -# Ensure etcd is initialized -etcd_initialize diff --git a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/snapshot.sh b/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/snapshot.sh deleted file mode 100755 index 7bf2f541cd44e..0000000000000 --- a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/etcd/snapshot.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o pipefail -set -o nounset - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libetcd.sh - -# Load etcd environment settings -. /opt/bitnami/scripts/etcd-env.sh - -ensure_dir_exists "$ETCD_SNAPSHOTS_DIR" -endpoints="$(etcdctl_get_endpoints)" -read -r -a endpoints_array <<< "$(tr ',;' ' ' <<< "$endpoints")" -for e in "${endpoints_array[@]}"; do - debug "Using endpoint $e" - read -r -a extra_flags <<< "$(etcdctl_auth_flags)" - extra_flags+=("--endpoints=$e") - if etcdctl endpoint health "${extra_flags[@]}"; then - info "Snapshotting the keyspace" - current_time="$(date -u "+%Y-%m-%d_%H-%M")" - etcdctl snapshot save "${ETCD_SNAPSHOTS_DIR}/db-${current_time}" "${extra_flags[@]}" - find "${ETCD_SNAPSHOTS_DIR}/" -maxdepth 1 -type f -name 'db-*' \! -name "db-${current_time}" \ - | sort -r \ - | tail -n+$((1 + ETCD_SNAPSHOT_HISTORY_LIMIT)) \ - | xargs rm -f - exit 0 - else - warn "etcd endpoint $e not healthy. Trying a different endpoint" - fi -done -error "all etcd endpoints are unhealthy!" -exit 1 diff --git a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/libetcd.sh b/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/libetcd.sh deleted file mode 100644 index b75c4c95a5959..0000000000000 --- a/bitnami/etcd/3.4/debian-12/rootfs/opt/bitnami/scripts/libetcd.sh +++ /dev/null @@ -1,832 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami etcd library - -# shellcheck disable=SC1090,SC1091,SC2119,SC2120 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libservice.sh - -# Functions - -######################## -# Write a configuration setting value -# Globals: -# ETCD_CONF_FILE -# Arguments: -# $1 - key -# $2 - value -# $3 - YAML type (string, int or bool) -# Returns: -# None -######################### -etcd_conf_write() { - local -r key="${1:?Missing key}" - local -r value="${2:-}" - local -r type="${3:-string}" - local -r tempfile=$(mktemp) - - [[ -z "$value" ]] && return - [[ ! -f "$ETCD_CONF_FILE" ]] && touch "$ETCD_CONF_FILE" - case "$type" in - string) - yq eval "(.${key}) |= \"${value}\"" "$ETCD_CONF_FILE" >"$tempfile" - ;; - bool) - yq eval "(.${key}) |= (\"${value}\" | test(\"true\"))" "$ETCD_CONF_FILE" >"$tempfile" - ;; - raw) - yq eval "(.${key}) |= ${value}" "$ETCD_CONF_FILE" >"$tempfile" - ;; - *) - error "Type unknown: ${type}" - return 1 - ;; - esac - cp "$tempfile" "$ETCD_CONF_FILE" -} - -######################## -# Creates etcd configuration file from environment variables -# Globals: -# ETCD_CFG_* -# Arguments: -# None -# Returns: -# None -######################### -etcd_setup_from_environment_variables() { - ## Except for Client and Peer TLS configuration, - ## all etcd settings consists of ETCD_FLAG_NAME - ## transformed into flag-name and configured under the yaml config root. - local -a client_tls_values=( - "ETCD_CFG_CERT_FILE" - "ETCD_CFG_KEY_FILE" - "ETCD_CFG_CLIENT_CERT_AUTH" - "ETCD_CFG_TRUSTED_CA_FILE" - "ETCD_CFG_AUTO_TLS" - "ETCD_CFG_CA_FILE" - ) - info "Generating etcd config file using env variables" - # Map environment variables to config properties for etcd-env.sh - for var in "${!ETCD_CFG_@}"; do - value="${!var:-}" - if [[ -n "$value" ]]; then - type="string" - # Detect if value is digit or bool - if [[ "$value" =~ ^[+-]?[0-9]+([.][0-9]+)?$ || "$value" =~ ^(true|false)$ ]]; then - type="raw" - fi - if [[ ${client_tls_values[*]} =~ ${var} ]]; then - key="$(echo "$var" | sed -e 's/^ETCD_CFG_//g' -e 's/_/-/g' | tr '[:upper:]' '[:lower:]')" - etcd_conf_write "client-transport-security.${key}" "$value" "$type" - elif [[ "$var" =~ "ETCD_CFG_CLIENT_" ]]; then - key="$(echo "$var" | sed -e 's/^ETCD_CFG_CLIENT_//g' -e 's/_/-/g' | tr '[:upper:]' '[:lower:]')" - etcd_conf_write "client-transport-security.${key}" "$value" "$type" - elif [[ "$var" =~ "ETCD_CFG_PEER_" ]]; then - key="$(echo "$var" | sed -e 's/^ETCD_CFG_PEER_//g' -e 's/_/-/g' | tr '[:upper:]' '[:lower:]')" - etcd_conf_write "peer-transport-security.${key}" "$value" "$type" - else - # shellcheck disable=SC2001 - key="$(echo "$var" | sed -e 's/^ETCD_CFG_//g' -e 's/_/-/g' | tr '[:upper:]' '[:lower:]')" - etcd_conf_write "$key" "$value" "$type" - fi - fi - done - if am_i_root && [[ -f "$ETCD_CONF_FILE" ]] ; then - chown "$ETCD_DAEMON_USER" "$ETCD_CONF_FILE" - fi -} - -######################## -# Validate settings in ETCD_* environment variables -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# None -######################### -etcd_validate() { - info "Validating settings in ETCD_* env vars.." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if is_boolean_yes "$ALLOW_NONE_AUTHENTICATION"; then - warn "You set the environment variable ALLOW_NONE_AUTHENTICATION=${ALLOW_NONE_AUTHENTICATION}. For safety reasons, do not use this flag in a production environment." - else - is_empty_value "$ETCD_ROOT_PASSWORD" && print_validation_error "The ETCD_ROOT_PASSWORD environment variable is empty or not set. Set the environment variable ALLOW_NONE_AUTHENTICATION=yes to allow a blank password. This is only recommended for development environments." - fi - if is_boolean_yes "$ETCD_START_FROM_SNAPSHOT" && [[ ! -f "${ETCD_INIT_SNAPSHOTS_DIR}/${ETCD_INIT_SNAPSHOT_FILENAME}" ]]; then - print_validation_error "You are trying to initialize etcd from a snapshot, but no snapshot was found. Set the environment variable ETCD_INIT_SNAPSHOT_FILENAME with the snapshot filename and mount it at '${ETCD_INIT_SNAPSHOTS_DIR}' directory." - fi - - [[ "$error_code" -eq 0 ]] || return "$error_code" -} - -######################## -# Check if etcd is running -# Arguments: -# None -# Returns: -# Boolean -######################### -is_etcd_running() { - local pid - pid="$(pgrep -f "^etcd" || true)" - - # etcd does not create any PID file - # We regenerate the PID file for each time we query it to avoid getting outdated - if [[ -n "${ETCD_PID_FILE:-}" ]]; then - echo "$pid" >"$ETCD_PID_FILE" - fi - - if [[ -n "$pid" ]]; then - is_service_running "$pid" - else - false - fi -} - -######################## -# Check if etcd is running -# Globals: -# ETCD_PID_FILE -# Arguments: -# None -# Returns: -# Whether etcd is not running -######################## -is_etcd_not_running() { - ! is_etcd_running -} - -######################## -# Stop etcd -# Arguments: -# None -# Returns: -# None -######################### -etcd_stop() { - local pid - ! is_etcd_running && return - - info "Stopping etcd" - # Ensure process matches etcd binary with or without options - pid="$(pgrep -f "^etcd")" - local counter=10 - kill "$pid" - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start etcd in background -# Arguments: -# None -# Returns: -# None -######################### -etcd_start_bg() { - is_etcd_running && return - - info "Starting etcd in background" - local start_command=("etcd") - am_i_root && start_command=("run_as_user" "$ETCD_DAEMON_USER" "${start_command[@]}") - [[ -f "$ETCD_CONF_FILE" ]] && start_command+=("--config-file" "$ETCD_CONF_FILE") - debug_execute "${start_command[@]}" & - sleep 3 -} - -######################## -# Obtain endpoints to connect when running 'ectdctl' -# Globals: -# ETCD_* -# Arguments: -# $1 - exclude current member from the list (default: false) -# Returns: -# String -######################## -etcdctl_get_endpoints() { - local only_others=${1:-false} - local -a endpoints=() - local host domain port - - ip_has_valid_hostname() { - local ip="${1:?ip is required}" - local parent_domain="${1:?parent_domain is required}" - - # 'getent hosts $ip' can return hostnames in 2 different formats: - # POD_NAME.HEADLESS_SVC_DOMAIN.NAMESPACE.svc.cluster.local (using headless service domain) - # 10-237-136-79.SVC_DOMAIN.NAMESPACE.svc.cluster.local (using POD's IP and service domain) - # We need to discard the latter to avoid issues when TLS verification is enabled. - [[ "$(getent hosts "$ip")" = *"$parent_domain"* ]] && return 0 - return 1 - } - - hostname_has_ips() { - local hostname="${1:?hostname is required}" - [[ "$(getent ahosts "$hostname")" != "" ]] && return 0 - return 1 - } - - # This piece of code assumes this code is executed on a K8s environment - # where etcd members are part of a statefulset that uses a headless service - # to create a unique FQDN per member. Under these circumstances, the - # ETCD_ADVERTISE_CLIENT_URLS env. variable is created as follows: - # SCHEME://POD_NAME.HEADLESS_SVC_DOMAIN:CLIENT_PORT,SCHEME://SVC_DOMAIN:SVC_CLIENT_PORT - # - # Assuming this, we can extract the HEADLESS_SVC_DOMAIN and obtain - # every available endpoint - read -r -a advertised_array <<<"$(tr ',;' ' ' <<<"$ETCD_ADVERTISE_CLIENT_URLS")" - host="$(parse_uri "${advertised_array[0]}" "host")" - port="$(parse_uri "${advertised_array[0]}" "port")" - domain="${host#"${ETCD_NAME}."}" - # When ETCD_CLUSTER_DOMAIN is set, we use that value instead of extracting - # it from ETCD_ADVERTISE_CLIENT_URLS - ! is_empty_value "$ETCD_CLUSTER_DOMAIN" && domain="$ETCD_CLUSTER_DOMAIN" - # Depending on the K8s distro & the DNS plugin, it might need - # a few seconds to associate the POD(s) IP(s) to the headless svc domain - if retry_while "hostname_has_ips $domain"; then - local -r ahosts="$(getent ahosts "$domain" | awk '{print $1}' | uniq | wc -l)" - for i in $(seq 0 $((ahosts - 1))); do - # We use the StatefulSet name stored in MY_STS_NAME to get the peer names based on the number of IPs registered in the headless service - pod_name="${MY_STS_NAME}-${i}" - if ! { [[ $only_others = true ]] && [[ "$pod_name" = "$MY_POD_NAME" ]]; }; then - endpoints+=("${pod_name}.${ETCD_CLUSTER_DOMAIN}:${port:-2380}") - fi - done - fi - echo "${endpoints[*]}" | tr ' ' ',' -} - -######################## -# Obtain etcdctl authentication flags to use -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# Array with extra flags to use for authentication -######################### -etcdctl_auth_flags() { - local -a authFlags=() - - ! is_empty_value "$ETCD_ROOT_PASSWORD" && authFlags+=("--user" "root:$ETCD_ROOT_PASSWORD") - echo "${authFlags[*]} $(etcdctl_auth_norbac_flags)" -} - -######################## -# Obtain etcdctl authentication flags to use (before RBAC is enabled) -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# Array with extra flags to use for authentication -######################### -etcdctl_auth_norbac_flags() { - local -a authFlags=() - - if [[ $ETCD_AUTO_TLS = true ]]; then - authFlags+=("--cert" "${ETCD_DATA_DIR}/fixtures/client/cert.pem" "--key" "${ETCD_DATA_DIR}/fixtures/client/key.pem") - else - [[ -f "$ETCD_CERT_FILE" ]] && [[ -f "$ETCD_KEY_FILE" ]] && authFlags+=("--cert" "$ETCD_CERT_FILE" "--key" "$ETCD_KEY_FILE") - [[ -f "$ETCD_TRUSTED_CA_FILE" ]] && authFlags+=("--cacert" "$ETCD_TRUSTED_CA_FILE") - fi - echo "${authFlags[*]}" -} - -######################## -# Stores etcd member ID in the data directory -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# None -######################## -etcd_store_member_id() { - if is_boolean_yes "$ETCD_DISABLE_STORE_MEMBER_ID"; then - return 0 - fi - local -a extra_flags - local member_id="" - info "Obtaining cluster member ID" - etcd_start_bg - read -r -a extra_flags <<<"$(etcdctl_auth_flags)" - is_boolean_yes "$ETCD_ON_K8S" && extra_flags+=("--endpoints=$(etcdctl_get_endpoints)") - if retry_while "etcdctl ${extra_flags[*]:-} member list" >/dev/null 2>&1; then - while is_empty_value "$member_id"; do - read -r -a advertised_array <<<"$(tr ',;' ' ' <<<"$ETCD_ADVERTISE_CLIENT_URLS")" - member_id="$(etcdctl "${extra_flags[@]}" member list | grep -w "${advertised_array[0]}" | awk -F "," '{ print $1}' || true)" - done - # We use 'sync' to ensure memory buffers are flushed to disk - # so we reduce the chances that the "member_id" file is empty. - # ref: https://man7.org/linux/man-pages/man1/sync.1.html - echo "$member_id" >"${ETCD_DATA_DIR}/member_id" - sync -d "${ETCD_DATA_DIR}/member_id" - info "Stored member ID: $(cat "${ETCD_DATA_DIR}/member_id")" - fi - etcd_stop -} - -######################## -# Configure etcd RBAC (do not confuse with K8s RBAC) -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# None -######################## -etcd_configure_rbac() { - - ! is_etcd_running && etcd_start_bg - read -r -a extra_flags <<<"$(etcdctl_auth_norbac_flags)" - - is_boolean_yes "$ETCD_ON_K8S" && extra_flags+=("--endpoints=$(etcdctl_get_endpoints)") - if retry_while "etcdctl ${extra_flags[*]} member list" >/dev/null 2>&1; then - if retry_while "etcdctl ${extra_flags[*]} auth status" >/dev/null 2>&1; then - if etcdctl "${extra_flags[@]}" auth status | grep -q "Authentication Status: true"; then - info "Authentication already enabled" - else - info "Enabling etcd authentication" - etcdctl "${extra_flags[@]}" user add root --interactive=false <<<"$ETCD_ROOT_PASSWORD" - etcdctl "${extra_flags[@]}" user grant-role root root - etcdctl "${extra_flags[@]}" auth enable - fi - fi - fi - etcd_stop -} - -######################## -# Checks if the member was successfully removed from the cluster -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# None -######################## -was_etcd_member_removed() { - local return_value=0 - - if grep -sqE "^Member[[:space:]]+[a-z0-9]+\s+removed\s+from\s+cluster\s+[a-z0-9]+$" "${ETCD_VOLUME_DIR}/member_removal.log"; then - debug "Removal was properly recorded in member_removal.log" - rm -rf "${ETCD_DATA_DIR:?}/"* - elif [[ ! -d "${ETCD_DATA_DIR}/member/snap" ]] && is_empty_value "$(get_member_id)"; then - debug "Missing member data" - rm -rf "${ETCD_DATA_DIR:?}/"* - else - return_value=1 - fi - rm -f "${ETCD_VOLUME_DIR}/member_removal.log" - return $return_value -} - -######################## -# Checks if etcd needs to bootstrap a new cluster -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# Boolean -######################## -is_new_etcd_cluster() { - [[ "$ETCD_INITIAL_CLUSTER_STATE" = "new" ]] && [[ "$ETCD_INITIAL_CLUSTER" = *"$ETCD_INITIAL_ADVERTISE_PEER_URLS"* ]] -} - -######################## -# Setup ETCD_ACTIVE_ENDPOINTS environment variable, will return the number of active endpoints , cluster size (including not active member) and the ETCD_ACTIVE_ENDPOINTS (which is also export) -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# List of Numbers (active_endpoints, cluster_size, ETCD_ACTIVE_ENDPOINTS) -######################## -setup_etcd_active_endpoints() { - local active_endpoints=0 - local -a extra_flags active_endpoints_array - local -a endpoints_array=() - local host port - - is_boolean_yes "$ETCD_ON_K8S" && read -r -a endpoints_array <<<"$(tr ',;' ' ' <<<"$(etcdctl_get_endpoints)")" - local -r cluster_size=${#endpoints_array[@]} - read -r -a advertised_array <<<"$(tr ',;' ' ' <<<"$ETCD_ADVERTISE_CLIENT_URLS")" - host="$(parse_uri "${advertised_array[0]}" "host")" - port="$(parse_uri "${advertised_array[0]}" "port")" - if [[ $cluster_size -gt 0 ]]; then - for e in "${endpoints_array[@]}"; do - read -r -a extra_flags <<<"$(etcdctl_auth_flags)" - extra_flags+=("--endpoints=$e") - if [[ "$e" != "$host:$port" ]] && etcdctl endpoint health "${extra_flags[@]}" >/dev/null 2>&1; then - debug "$e endpoint is active" - ((active_endpoints++)) - active_endpoints_array+=("$e") - fi - done - ETCD_ACTIVE_ENDPOINTS=$(echo "${active_endpoints_array[*]}" | tr ' ' ',') - export ETCD_ACTIVE_ENDPOINTS - fi - echo "${active_endpoints} ${cluster_size} ${ETCD_ACTIVE_ENDPOINTS}" -} - -######################## -# Checks if there are enough active members, will also set ETCD_ACTIVE_ENDPOINTS -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# Boolean -######################## -is_healthy_etcd_cluster() { - local return_value=0 - local active_endpoints cluster_size - read -r active_endpoints cluster_size ETCD_ACTIVE_ENDPOINTS <<<"$(setup_etcd_active_endpoints)" - export ETCD_ACTIVE_ENDPOINTS - - if is_boolean_yes "$ETCD_DISASTER_RECOVERY"; then - if [[ -f "/snapshots/.disaster_recovery" ]]; then - # Remove current node from the ones that need to recover - remove_in_file "/snapshots/.disaster_recovery" "$host:$port" - # Remove nodes that do not exist anymore from the ones that need to recover - read -r -a recovery_array <<<"$(tr '\n' ' ' <"/snapshots/.disaster_recovery")" - for r in "${recovery_array[@]}"; do - if [[ ! "${endpoints_array[*]}" =~ $r ]]; then - remove_in_file "/snapshots/.disaster_recovery" "$r" - fi - done - if [[ $(wc -w <"/snapshots/.disaster_recovery") -eq 0 ]]; then - debug "Last member to recover from the disaster!" - rm "/snapshots/.disaster_recovery" - fi - return_value=1 - else - if [[ $active_endpoints -lt $(((cluster_size + 1) / 2)) ]]; then - debug "There are no enough active endpoints!" - for e in "${endpoints_array[@]}"; do - [[ "$e" != "$host:$port" ]] && [[ "$e" != ":$port" ]] && echo "$e" >>"/snapshots/.disaster_recovery" - done - return_value=1 - fi - fi - else - if [[ $active_endpoints -lt $(((cluster_size + 1) / 2)) ]]; then - debug "There are no enough active endpoints!" - return_value=1 - fi - fi - - return $return_value -} - -######################## -# Prints initial cluster nodes -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# String -######################## -get_initial_cluster() { - local -a endpoints_array=() - local scheme port initial_members - read -r -a endpoints_array <<<"$(tr ',;' ' ' <<<"$ETCD_INITIAL_CLUSTER")" - if [[ ${#endpoints_array[@]} -gt 0 ]] && ! grep -sqE "://" <<<"$ETCD_INITIAL_CLUSTER"; then - # This piece of code assumes this container is used on a VM environment - # where ETCD_INITIAL_CLUSTER contains a comma-separated list of hostnames, - # and recreates it as follows: - # SCHEME://NODE_NAME:PEER_PORT - scheme="$(parse_uri "$ETCD_INITIAL_ADVERTISE_PEER_URLS" "scheme")" - port="$(parse_uri "$ETCD_INITIAL_ADVERTISE_PEER_URLS" "port")" - for nodePeer in "${endpoints_array[@]}"; do - initial_members+=("${nodePeer}=${scheme}://${nodePeer}:$port") - done - echo "${initial_members[*]}" | tr ' ' ',' - else - # Nothing to do - echo "$ETCD_INITIAL_CLUSTER" - fi -} - -######################## -# Recalculate initial cluster -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# String -######################## -recalculate_initial_cluster() { - local -a endpoints_array initial_members - local domain host member_host member_port member_id port scheme - - if is_boolean_yes "$ETCD_ON_K8S"; then - read -r -a endpoints_array <<<"$(tr ',;' ' ' <<<"$(etcdctl_get_endpoints)")" - # This piece of code assumes this container is used on a K8s environment - # where etcd members are part of a statefulset that uses a headless service - # to create a unique FQDN per member. Under these circumstances, the - # ETCD_INITIAL_ADVERTISE_PEER_URLS are created as follows: - # SCHEME://POD_NAME.HEADLESS_SVC_DOMAIN:PEER_PORT - # - # Assuming this, we can extract the HEADLESS_SVC_DOMAIN - host="$(parse_uri "$ETCD_INITIAL_ADVERTISE_PEER_URLS" "host")" - scheme="$(parse_uri "$ETCD_INITIAL_ADVERTISE_PEER_URLS" "scheme")" - port="$(parse_uri "$ETCD_INITIAL_ADVERTISE_PEER_URLS" "port")" - domain="${host#"${ETCD_NAME}."}" - # When ETCD_CLUSTER_DOMAIN is set, we use that value instead of extracting - # it from ETCD_INITIAL_ADVERTISE_PEER_URLS - ! is_empty_value "$ETCD_CLUSTER_DOMAIN" && domain="$ETCD_CLUSTER_DOMAIN" - for e in "${endpoints_array[@]}"; do - member_host="$(parse_uri "$scheme://$e" "host")" - member_port="$(parse_uri "$scheme://$e" "port")" - member_id=${e%".$domain:$member_port"} - initial_members+=("${member_id}=${scheme}://${member_host}:$port") - done - echo "${initial_members[*]}" | tr ' ' ',' - else - # Nothing to do - echo "$ETCD_INITIAL_CLUSTER" - fi -} - -######################## -# Ensure etcd is initialized -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# None -######################### -etcd_initialize() { - local -a extra_flags initial_members - local domain - - info "Initializing etcd" - - # Generate user configuration if ETCD_CFG_* variables are provided - etcd_setup_from_environment_variables - - ETCD_INITIAL_CLUSTER="$(get_initial_cluster)" - export ETCD_INITIAL_CLUSTER - [[ -f "$ETCD_CONF_FILE" ]] && etcd_conf_write "initial-cluster" "$ETCD_INITIAL_CLUSTER" - - read -r -a initial_members <<<"$(tr ',;' ' ' <<<"$ETCD_INITIAL_CLUSTER")" - if is_mounted_dir_empty "$ETCD_DATA_DIR"; then - info "There is no data from previous deployments" - if [[ ${#initial_members[@]} -gt 1 ]]; then - if is_new_etcd_cluster; then - info "Bootstrapping a new cluster" - if is_boolean_yes "$ETCD_ON_K8S"; then - debug "Waiting for the headless svc domain to have an IP per initial member in the cluster" - if is_empty_value "$ETCD_CLUSTER_DOMAIN"; then - # This piece of code assumes this container is used on a K8s environment - # where etcd members are part of a statefulset that uses a headless service - # to create a unique FQDN per member. Under these circumstances, the - # ETCD_INITIAL_ADVERTISE_PEER_URLS are created as follows: - # SCHEME://POD_NAME.HEADLESS_SVC_DOMAIN:PEER_PORT - # - # Assuming this, we can extract the HEADLESS_SVC_DOMAIN - host="$(parse_uri "$ETCD_INITIAL_ADVERTISE_PEER_URLS" "host")" - domain="${host#"${ETCD_NAME}."}" - else - # When ETCD_CLUSTER_DOMAIN is set, we use that value instead of extracting - # it from ETCD_INITIAL_ADVERTISE_PEER_URLS - domain="$ETCD_CLUSTER_DOMAIN" - fi - hostname_has_N_ips() { - local -r hostname="${1:?hostname is required}" - local -r n=${2:?number of ips is required} - local -r ready_hosts=$(getent ahosts "$hostname" | awk '{print $1}' | uniq | wc -l) - [[ $((ready_hosts % n)) -eq 0 ]] && [[ $((ready_hosts / n)) -ge 1 ]] && return 0 - return 1 - } - if ! retry_while "hostname_has_N_ips $domain ${#initial_members[@]}"; then - error "Headless service domain does not have an IP per initial member in the cluster" - exit 1 - fi - fi - else - info "Adding new member to existing cluster" - ensure_dir_exists "$ETCD_DATA_DIR" - add_self_to_cluster - fi - fi - if is_boolean_yes "$ETCD_START_FROM_SNAPSHOT"; then - if [[ -f "${ETCD_INIT_SNAPSHOTS_DIR}/${ETCD_INIT_SNAPSHOT_FILENAME}" ]]; then - info "Restoring snapshot before initializing etcd cluster" - local -a restore_args=("--data-dir" "$ETCD_DATA_DIR") - if [[ ${#initial_members[@]} -gt 1 ]]; then - # - # Only recalculate the initial cluster config if it hasn't - # been provided. - # - if is_empty_value "$ETCD_INITIAL_CLUSTER"; then - ETCD_INITIAL_CLUSTER="$(recalculate_initial_cluster)" - export ETCD_INITIAL_CLUSTER - fi - - [[ -f "$ETCD_CONF_FILE" ]] && etcd_conf_write "initial-cluster" "$ETCD_INITIAL_CLUSTER" - - restore_args+=( - "--name" "$ETCD_NAME" - "--initial-cluster" "$ETCD_INITIAL_CLUSTER" - "--initial-cluster-token" "$ETCD_INITIAL_CLUSTER_TOKEN" - "--initial-advertise-peer-urls" "$ETCD_INITIAL_ADVERTISE_PEER_URLS" - ) - fi - debug_execute etcdctl snapshot restore "${ETCD_INIT_SNAPSHOTS_DIR}/${ETCD_INIT_SNAPSHOT_FILENAME}" "${restore_args[@]}" - etcd_store_member_id - else - error "There was no snapshot to restore!" - exit 1 - fi - else - etcd_store_member_id - fi - else - info "Detected data from previous deployments" - if [[ $(stat -c "%a" "$ETCD_DATA_DIR") != *700 ]]; then - debug "Setting data directory permissions to 700 in a recursive way (required in etcd >=3.4.10)" - debug_execute chmod -R 700 "$ETCD_DATA_DIR" || true - fi - if [[ ${#initial_members[@]} -gt 1 ]]; then - member_id="$(get_member_id)" - if is_boolean_yes "$ETCD_DISABLE_PRESTOP"; then - info "The member will try to join the cluster by it's own" - export ETCD_INITIAL_CLUSTER_STATE=existing - elif ! is_healthy_etcd_cluster; then - warn "Cluster not responding!" - if is_boolean_yes "$ETCD_DISASTER_RECOVERY"; then - latest_snapshot_file="$(find /snapshots/ -maxdepth 1 -type f -name 'db-*' | sort | tail -n 1)" - if [[ "${latest_snapshot_file}" != "" ]]; then - info "Restoring etcd cluster from snapshot" - rm -rf "$ETCD_DATA_DIR" - # - # Only recalculate the initial cluster config if it hasn't - # been provided. - # - if is_empty_value "$ETCD_INITIAL_CLUSTER"; then - ETCD_INITIAL_CLUSTER="$(recalculate_initial_cluster)" - export ETCD_INITIAL_CLUSTER - fi - [[ -f "$ETCD_CONF_FILE" ]] && etcd_conf_write "initial-cluster" "$ETCD_INITIAL_CLUSTER" - debug_execute etcdctl snapshot restore "${latest_snapshot_file}" \ - --name "$ETCD_NAME" \ - --data-dir "$ETCD_DATA_DIR" \ - --initial-cluster "$ETCD_INITIAL_CLUSTER" \ - --initial-cluster-token "$ETCD_INITIAL_CLUSTER_TOKEN" \ - --initial-advertise-peer-urls "$ETCD_INITIAL_ADVERTISE_PEER_URLS" - etcd_store_member_id - else - error "There was no snapshot to restore!" - exit 1 - fi - else - warn "Disaster recovery is disabled, the cluster will try to recover on it's own" - fi - elif was_etcd_member_removed; then - info "Adding new member to existing cluster" - read -r -a extra_flags <<<"$(etcdctl_auth_flags)" - is_boolean_yes "$ETCD_ON_K8S" && extra_flags+=("--endpoints=$(etcdctl_get_endpoints)") - extra_flags+=("--peer-urls=$ETCD_INITIAL_ADVERTISE_PEER_URLS") - etcdctl member add "$ETCD_NAME" "${extra_flags[@]}" | grep "^ETCD_" >"$ETCD_NEW_MEMBERS_ENV_FILE" - replace_in_file "$ETCD_NEW_MEMBERS_ENV_FILE" "^" "export " - # The value of ETCD_INITIAL_CLUSTER_STATE must be changed for it to be correctly added to the existing cluster - # https://etcd.io/docs/v3.5/op-guide/configuration/#--initial-cluster-state - export ETCD_INITIAL_CLUSTER_STATE=existing - etcd_store_member_id - elif ! is_empty_value "$member_id"; then - info "Updating member in existing cluster" - export ETCD_INITIAL_CLUSTER_STATE=existing - [[ -f "$ETCD_CONF_FILE" ]] && etcd_conf_write "initial-cluster-state" "$ETCD_INITIAL_CLUSTER_STATE" - read -r -a extra_flags <<<"$(etcdctl_auth_flags)" - extra_flags+=("--peer-urls=$ETCD_INITIAL_ADVERTISE_PEER_URLS") - if is_boolean_yes "$ETCD_ON_K8S"; then - extra_flags+=("--endpoints=$(etcdctl_get_endpoints)") - etcdctl member update "$member_id" "${extra_flags[@]}" - else - etcd_start_bg - etcdctl member update "$member_id" "${extra_flags[@]}" - etcd_stop - fi - else - info "Member ID wasn't properly stored, the member will try to join the cluster by it's own" - export ETCD_INITIAL_CLUSTER_STATE=existing - [[ -f "$ETCD_CONF_FILE" ]] && etcd_conf_write "initial-cluster-state" "$ETCD_INITIAL_CLUSTER_STATE" - fi - fi - fi - - # For both existing and new deployments, configure RBAC if set - if [[ ${#initial_members[@]} -gt 1 ]]; then - # When there's more than one etcd replica, RBAC should be only enabled in one member - if ! is_empty_value "$ETCD_ROOT_PASSWORD" && [[ "${initial_members[0]}" = *"$ETCD_INITIAL_ADVERTISE_PEER_URLS"* ]]; then - etcd_configure_rbac - else - debug "Skipping RBAC configuration in member $ETCD_NAME" - fi - else - ! is_empty_value "$ETCD_ROOT_PASSWORD" && etcd_configure_rbac - fi - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Add self to cluster if not -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# None -######################### -add_self_to_cluster() { - local -a extra_flags - read -r -a extra_flags <<<"$(etcdctl_auth_flags)" - # is_healthy_etcd_cluster will also set ETCD_ACTIVE_ENDPOINTS - while ! is_healthy_etcd_cluster; do - warn "Cluster not healthy, not adding self to cluster for now, keeping trying..." - sleep 10 - done - - # only send req to healthy nodes - - if is_empty_value "$(get_member_id)"; then - extra_flags+=("--endpoints=${ETCD_ACTIVE_ENDPOINTS}" "--peer-urls=$ETCD_INITIAL_ADVERTISE_PEER_URLS") - while ! etcdctl member add "$ETCD_NAME" "${extra_flags[@]}" | grep "^ETCD_" >"$ETCD_NEW_MEMBERS_ENV_FILE"; do - warn "Failed to add self to cluster, keeping trying..." - sleep 10 - done - replace_in_file "$ETCD_NEW_MEMBERS_ENV_FILE" "^" "export " - sync -d "$ETCD_NEW_MEMBERS_ENV_FILE" - else - info "Node already in cluster" - fi - info "Loading env vars of existing cluster" - . "$ETCD_NEW_MEMBERS_ENV_FILE" -} - -######################## -# Get this node's member_id in cluster, if not in cluster return empty string -# Globals: -# ETCD_* -# Arguments: -# None -# Returns: -# String -######################### -get_member_id() { - if ! is_boolean_yes "$ETCD_DISABLE_STORE_MEMBER_ID"; then - if [[ ! -s "${ETCD_DATA_DIR}/member_id" ]]; then - echo "" - return 0 - fi - cat "${ETCD_DATA_DIR}/member_id" - return 0 - fi - local ret - local -a extra_flags - - local etcd_active_endpoints=${ETCD_ACTIVE_ENDPOINTS:-} - if is_empty_value "${etcd_active_endpoints}"; then - setup_etcd_active_endpoints >/dev/null 2>&1 - fi - - read -r -a extra_flags <<<"$(etcdctl_auth_flags)" - extra_flags+=("--endpoints=${ETCD_ACTIVE_ENDPOINTS}") - ret=$(etcdctl "${extra_flags[@]}" member list | grep -w "$ETCD_INITIAL_ADVERTISE_PEER_URLS" | awk -F "," '{ print $1 }') - # if not return zero - if is_empty_value "$ret"; then - info "No member id found" - echo "" - else - info "member id: $ret" - echo "$ret" - fi -} diff --git a/bitnami/etcd/3.4/debian-12/tags-info.yaml b/bitnami/etcd/3.4/debian-12/tags-info.yaml deleted file mode 100644 index 9e2660275da9c..0000000000000 --- a/bitnami/etcd/3.4/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "3.4" -- 3.4-debian-12 -- 3.4.35 diff --git a/bitnami/express/4/README.md b/bitnami/express/4/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/express/4/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/express/4/debian-12/Dockerfile b/bitnami/express/4/debian-12/Dockerfile deleted file mode 100644 index b448f7c68a800..0000000000000 --- a/bitnami/express/4/debian-12/Dockerfile +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-05T23:53:38Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/express/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="4.21.2-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/express" \ - org.opencontainers.image.title="express" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="4.21.2" - -ENV OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libbz2-1.0 libffi8 libgcc-s1 liblzma5 libncursesw6 libreadline8 libsqlite3-0 libssl3 libstdc++6 libtinfo6 procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "python-3.13.1-0-linux-${OS_ARCH}-debian-12" \ - "wait-for-port-1.0.8-8-linux-${OS_ARCH}-debian-12" \ - "node-22.12.0-0-linux-${OS_ARCH}-debian-12" \ - "express-4.21.2-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN mkdir -p /dist /app /.npm /.config /.cache /.local && chmod g+rwX /dist /app /.npm /.config /.cache /.local -RUN /opt/bitnami/scripts/express/postunpack.sh -ENV APP_VERSION="4.21.2" \ - BITNAMI_APP_NAME="express" \ - PATH="/opt/bitnami/python/bin:/opt/bitnami/common/bin:/opt/bitnami/node/bin:/opt/bitnami/express/bin:$PATH" - -EXPOSE 3000 - -WORKDIR /app -ENTRYPOINT [ "/opt/bitnami/scripts/express/entrypoint.sh" ] -CMD [ "npm", "start" ] diff --git a/bitnami/express/4/debian-12/docker-compose-mariadb.yml b/bitnami/express/4/debian-12/docker-compose-mariadb.yml deleted file mode 100644 index fc2c57484a95a..0000000000000 --- a/bitnami/express/4/debian-12/docker-compose-mariadb.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb: - image: docker.io/bitnami/mariadb:latest - environment: - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_DATABASE=myapp - express: - image: docker.io/bitnami/express:4 - ports: - - '3000:3000' - environment: - - PORT=3000 - - NODE_ENV=development - - DATABASE_URL=mysql://root@mariadb/myapp - - EXPRESS_SKIP_DB_WAIT=0 - - EXPRESS_SKIP_DB_MIGRATION=0 - - EXPRESS_SKIP_NPM_INSTALL=0 - - EXPRESS_SKIP_BOWER_INSTALL=0 - volumes: - - './my-project:/app' - depends_on: - - mariadb diff --git a/bitnami/express/4/debian-12/docker-compose-postgresql.yml b/bitnami/express/4/debian-12/docker-compose-postgresql.yml deleted file mode 100644 index b535c8d0fbebc..0000000000000 --- a/bitnami/express/4/debian-12/docker-compose-postgresql.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - postgresql: - image: docker.io/bitnami/postgresql:latest - environment: - - POSTGRESQL_DATABASE=myapp - - ALLOW_EMPTY_PASSWORD=yes - express: - image: docker.io/bitnami/express:4 - ports: - - '3000:3000' - environment: - - PORT=3000 - - NODE_ENV=development - - DATABASE_URL=postgres://postgres@postgresql/myapp - - EXPRESS_SKIP_DB_WAIT=0 - - EXPRESS_SKIP_DB_MIGRATION=0 - - EXPRESS_SKIP_NPM_INSTALL=0 - - EXPRESS_SKIP_BOWER_INSTALL=0 - volumes: - - './my-project:/app' - depends_on: - - postgresql diff --git a/bitnami/express/4/debian-12/docker-compose.yml b/bitnami/express/4/debian-12/docker-compose.yml deleted file mode 100644 index 7b7ffc13d5115..0000000000000 --- a/bitnami/express/4/debian-12/docker-compose.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mongodb: - image: docker.io/bitnami/mongodb:latest - environment: - - ALLOW_EMPTY_PASSWORD=yes - express: - image: docker.io/bitnami/express:4 - ports: - - '3000:3000' - environment: - - PORT=3000 - - NODE_ENV=development - - DATABASE_URL=mongodb://mongodb:27017/myapp - - EXPRESS_SKIP_DB_WAIT=0 - - EXPRESS_SKIP_DB_MIGRATION=0 - - EXPRESS_SKIP_NPM_INSTALL=0 - - EXPRESS_SKIP_BOWER_INSTALL=0 - volumes: - - './my-project:/app' - depends_on: - - mongodb diff --git a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index c52f7b5c97e3b..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "express": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "4.21.2-0" - }, - "node": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "22.12.0-0" - }, - "python": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "3.13.1-0" - }, - "wait-for-port": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.8-8" - } -} \ No newline at end of file diff --git a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/express/4/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/express/4/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/express/4/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/express/4/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/express/4/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/express/4/debian-12/rootfs/dist/.dockerignore b/bitnami/express/4/debian-12/rootfs/dist/.dockerignore deleted file mode 100644 index 68a40097b508a..0000000000000 --- a/bitnami/express/4/debian-12/rootfs/dist/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.git/ -node_modules/ -.gitignore -docker-compose.yml diff --git a/bitnami/express/4/debian-12/rootfs/dist/.gitignore b/bitnami/express/4/debian-12/rootfs/dist/.gitignore deleted file mode 100644 index c2658d7d1b318..0000000000000 --- a/bitnami/express/4/debian-12/rootfs/dist/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ diff --git a/bitnami/express/4/debian-12/rootfs/dist/Dockerfile.tpl b/bitnami/express/4/debian-12/rootfs/dist/Dockerfile.tpl deleted file mode 100644 index faea55bcde06c..0000000000000 --- a/bitnami/express/4/debian-12/rootfs/dist/Dockerfile.tpl +++ /dev/null @@ -1,24 +0,0 @@ -## Dockerfile for building production image. -## Consider replacing below rolling tag by a digest or a immutable tag -FROM bitnami/express:{{APP_VERSION}} -LABEL maintainer "John Smith " - -ENV DISABLE_WELCOME_MESSAGE=1 - -ENV NODE_ENV=production \ - PORT=3000 - -# Skip fetching dependencies and database migrations for production image -ENV SKIP_DB_WAIT=0 \ - SKIP_DB_MIGRATION=1 \ - SKIP_NPM_INSTALL=1 \ - SKIP_BOWER_INSTALL=1 - -COPY . /app -RUN sudo chown -R bitnami: /app - -RUN npm install -RUN bower install - -EXPOSE 3000 -CMD ["npm", "start"] diff --git a/bitnami/express/4/debian-12/rootfs/dist/samples/mariadb.js b/bitnami/express/4/debian-12/rootfs/dist/samples/mariadb.js deleted file mode 100644 index f92729774cae8..0000000000000 --- a/bitnami/express/4/debian-12/rootfs/dist/samples/mariadb.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - Note: Generated by Bitnami: - Configuration file that shows how to use the built in MySQL database in your project. - Based on the examples found here: https://github.com/mysqljs/mysql -*/ - -var mysql = require('mysql') - , assert = require('assert');; - -// Connection URL configured in your docker-compose.yml file -var url = process.env.DATABASE_URL; - -var connection = mysql.createConnection(url); -connection.connect(function(err) { - assert.equal(null, err); - console.log("Connected correctly to MySQL server"); - connection.query('SHOW TABLES;'); - connection.end(); -}); diff --git a/bitnami/express/4/debian-12/rootfs/dist/samples/mongodb.js b/bitnami/express/4/debian-12/rootfs/dist/samples/mongodb.js deleted file mode 100644 index ad668e76ec86d..0000000000000 --- a/bitnami/express/4/debian-12/rootfs/dist/samples/mongodb.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - Note: Generated by Bitnami: - Configuration file that shows how to use the built in MongoDB database in your project. - Based on the examples found here: https://github.com/mongodb/node-mongodb-native - - If you want to use an ODM instead of barebone Node connections, you can install Mongoose - https://www.npmjs.com/package/mongoose -*/ - -var MongoClient = require('mongodb').MongoClient - , assert = require('assert'); - -// Connection URL configured in your docker-compose.yml file -var url = process.env.DATABASE_URL; - -MongoClient.connect(url, function(err, db) { - assert.equal(null, err); - console.log("Connected correctly to MongoDB server"); - db.close(); -}); diff --git a/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express-env.sh b/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express-env.sh deleted file mode 100644 index c94c649525223..0000000000000 --- a/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express-env.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for express - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-express}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -express_env_vars=( - EXPRESS_SKIP_DATABASE_WAIT - EXPRESS_SKIP_DATABASE_MIGRATE - EXPRESS_SKIP_SAMPLE_CODE - EXPRESS_SKIP_NPM_INSTALL - EXPRESS_SKIP_BOWER_INSTALL - EXPRESS_DATABASE_TYPE - EXPRESS_DATABASE_HOST - EXPRESS_DATABASE_PORT_NUMBER - EXPRESS_DEFAULT_MARIADB_DATABASE_PORT_NUMBER - EXPRESS_DEFAULT_MONGODB_DATABASE_PORT_NUMBER - EXPRESS_DEFAULT_MYSQL_DATABASE_PORT_NUMBER - EXPRESS_DEFAULT_POSTGRESQL_DATABASE_PORT_NUMBER - SKIP_DB_WAIT - SKIP_DB_MIGRATE - SKIP_SAMPLE_CODE - SKIP_NPM_INSTALL - SKIP_BOWER_INSTALL -) -for env_var in "${express_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset express_env_vars - -# Express configuration -EXPRESS_SKIP_DATABASE_WAIT="${EXPRESS_SKIP_DATABASE_WAIT:-"${SKIP_DB_WAIT:-}"}" -export EXPRESS_SKIP_DATABASE_WAIT="${EXPRESS_SKIP_DATABASE_WAIT:-no}" -EXPRESS_SKIP_DATABASE_MIGRATE="${EXPRESS_SKIP_DATABASE_MIGRATE:-"${SKIP_DB_MIGRATE:-}"}" -export EXPRESS_SKIP_DATABASE_MIGRATE="${EXPRESS_SKIP_DATABASE_MIGRATE:-no}" -EXPRESS_SKIP_SAMPLE_CODE="${EXPRESS_SKIP_SAMPLE_CODE:-"${SKIP_SAMPLE_CODE:-}"}" -export EXPRESS_SKIP_SAMPLE_CODE="${EXPRESS_SKIP_SAMPLE_CODE:-no}" -EXPRESS_SKIP_NPM_INSTALL="${EXPRESS_SKIP_NPM_INSTALL:-"${SKIP_NPM_INSTALL:-}"}" -export EXPRESS_SKIP_NPM_INSTALL="${EXPRESS_SKIP_NPM_INSTALL:-no}" -EXPRESS_SKIP_BOWER_INSTALL="${EXPRESS_SKIP_BOWER_INSTALL:-"${SKIP_BOWER_INSTALL:-}"}" -export EXPRESS_SKIP_BOWER_INSTALL="${EXPRESS_SKIP_BOWER_INSTALL:-no}" - -# Database configuration -export EXPRESS_DATABASE_TYPE="${EXPRESS_DATABASE_TYPE:-}" -export EXPRESS_DATABASE_HOST="${EXPRESS_DATABASE_HOST:-}" -export EXPRESS_DATABASE_PORT_NUMBER="${EXPRESS_DATABASE_PORT_NUMBER:-}" -export EXPRESS_DEFAULT_MARIADB_DATABASE_PORT_NUMBER="${EXPRESS_DEFAULT_MARIADB_DATABASE_PORT_NUMBER:-3306}" -export EXPRESS_DEFAULT_MONGODB_DATABASE_PORT_NUMBER="${EXPRESS_DEFAULT_MONGODB_DATABASE_PORT_NUMBER:-27017}" -export EXPRESS_DEFAULT_MYSQL_DATABASE_PORT_NUMBER="${EXPRESS_DEFAULT_MYSQL_DATABASE_PORT_NUMBER:-3306}" -export EXPRESS_DEFAULT_POSTGRESQL_DATABASE_PORT_NUMBER="${EXPRESS_DEFAULT_POSTGRESQL_DATABASE_PORT_NUMBER:-5432}" - -# Custom environment variables may be defined below diff --git a/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express/entrypoint.sh b/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express/entrypoint.sh deleted file mode 100755 index 3e11012362e82..0000000000000 --- a/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express/entrypoint.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Load Express environment -. /opt/bitnami/scripts/express-env.sh - -print_welcome_page - -if [[ "$1" = "npm" ]] && [[ "$2" = "run" || "$2" = "start" ]]; then - info "** Running Express setup **" - /opt/bitnami/scripts/express/setup.sh - info "** Express setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express/postunpack.sh b/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express/postunpack.sh deleted file mode 100755 index 0c7b2f6026b10..0000000000000 --- a/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express/postunpack.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libexpress.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh - -# Load Express environment -. /opt/bitnami/scripts/express-env.sh - -# Ensure required directories exist -ensure_dir_exists "/app" -configure_permissions_ownership "/app" -d "775" -f "664" diff --git a/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express/setup.sh b/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express/setup.sh deleted file mode 100755 index 0d681326c9bf4..0000000000000 --- a/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/express/setup.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libexpress.sh - -# Load Express environment -. /opt/bitnami/scripts/express-env.sh - -# Ensure Express environment variables are valid -express_validate - -# Ensure Express app is initialized -express_initialize diff --git a/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/libexpress.sh b/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/libexpress.sh deleted file mode 100644 index 2c75ed0569ff0..0000000000000 --- a/bitnami/express/4/debian-12/rootfs/opt/bitnami/scripts/libexpress.sh +++ /dev/null @@ -1,187 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Express library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh - -######################## -# Validate settings in EXPRESS_* env vars -# Globals: -# EXPRESS_* -# Arguments: -# None -# Returns: -# None -######################### -express_validate() { - info "Validating settings in EXPRESS_* environment variables..." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_empty_value() { - if is_empty_value "${!1}"; then - print_validation_error "${1} must be set" - fi - } - check_yes_no_value() { - if ! is_yes_no_value "${!1}" && ! is_true_false_value "${!1}" && ! is_1_0_value "${!1}"; then - print_validation_error "The allowed values for ${1} are: yes no" - fi - } - check_multi_value() { - if [[ " ${2} " != *" ${!1} "* ]]; then - print_validation_error "The allowed values for ${1} are: ${2}" - fi - } - check_resolved_hostname() { - if ! is_hostname_resolved "$1"; then - warn "Hostname ${1} could not be resolved, this could lead to connection issues" - fi - } - check_valid_port() { - local port_var="${1:?missing port variable}" - local err - if ! err="$(validate_port "${!port_var}")"; then - print_validation_error "An invalid port was specified in the environment variable ${port_var}: ${err}." - fi - } - - # Validate user inputs - check_yes_no_value "EXPRESS_SKIP_DATABASE_WAIT" - check_yes_no_value "EXPRESS_SKIP_DATABASE_MIGRATE" - check_yes_no_value "EXPRESS_SKIP_SAMPLE_CODE" - check_yes_no_value "EXPRESS_SKIP_NPM_INSTALL" - check_yes_no_value "EXPRESS_SKIP_BOWER_INSTALL" - - # Autodetect database type and populate environment variables if they were not defined - local -a supported_database_types=("mariadb" "mongodb" "mysql" "postgresql") - if is_empty_value "$EXPRESS_DATABASE_TYPE"; then - warn "EXPRESS_DATABASE_TYPE was not set, the database type will be detected automatically" - for database_type in "${supported_database_types[@]}"; do - if getent hosts "$database_type" >/dev/null; then - debug "Detected database type ${database_type}" - EXPRESS_DATABASE_TYPE="$database_type" - EXPRESS_DATABASE_HOST="${EXPRESS_DATABASE_HOST:-"$database_type"}" - local db_port_var="EXPRESS_DEFAULT_${database_type^^}_DATABASE_PORT_NUMBER" - EXPRESS_DATABASE_PORT_NUMBER="${EXPRESS_DATABASE_PORT_NUMBER:-"${!db_port_var}"}" - break - fi - done - else - check_multi_value "EXPRESS_DATABASE_TYPE" "${supported_database_types[*]}" - fi - - if is_empty_value "$EXPRESS_DATABASE_TYPE"; then - if is_empty_value "$EXPRESS_SKIP_DATABASE_WAIT"; then - print_validation_error "Could not detect database type" - else - warn "Could not detect database type, database support will not be configured" - fi - else - check_resolved_hostname "$EXPRESS_DATABASE_HOST" - check_valid_port "EXPRESS_DATABASE_PORT_NUMBER" - fi - - return "$error_code" -} - -######################## -# Ensure the Express app is initialized -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -express_initialize() { - # Developers use the /app mountpoint - if is_dir_empty "/app"; then - info "Creating Express application in /app" - cd /app || return 1 - debug_execute express . -f - mkdir tmp logs - chmod og+rw -R tmp logs - # Copy .gitignore sample - cp /dist/.gitignore .gitignore - - if ! is_empty_value "$EXPRESS_DATABASE_TYPE"; then - info "Adding database support" - case "$EXPRESS_DATABASE_TYPE" in - mariadb|mysql) - npm ls mysql >/dev/null || debug_execute npm install --save mysql - ;; - mongodb) - npm ls mongodb >/dev/null || debug_execute npm install --save mongodb - ;; - postgresql) - npm ls pg pg-hstore >/dev/null || debug_execute npm install --save pg pg-hstore - ;; - esac - fi - - if is_boolean_yes "$EXPRESS_SKIP_DATABASE_WAIT"; then - info "Not waiting for the database to be available" - else - info "Trying to connect to the database server" - if ! retry_while "debug_execute wait-for-port --timeout 5 --host ${EXPRESS_DATABASE_HOST} ${EXPRESS_DATABASE_PORT_NUMBER}"; then - error "Could not connect to the database" - return 1 - fi - fi - - info "Configuring nodemon support" - debug_execute npm install nodemon --save-dev - replace_in_file package.json '"start".*' '"start": "node ./bin/www", "development": "nodemon ./bin/www"' - - if ! is_boolean_yes "$EXPRESS_SKIP_SAMPLE_CODE"; then - info "Adding dist samples" - cp -r /dist/samples . - fi - - if [[ ! -f Dockerfile ]]; then - info "Adding Dockerfile" - cp /dist/Dockerfile.tpl Dockerfile - sed -i 's/{{APP_VERSION}}/'"$APP_VERSION"'/g' Dockerfile - [[ ! -f bower.json ]] && sed -i '/^RUN bower install/d' Dockerfile - - if [[ ! -f .dockerignore ]]; then - cp /dist/.dockerignore . - fi - fi - - if ! is_boolean_yes "$EXPRESS_SKIP_NPM_INSTALL"; then - info "Installing npm dependencies" - debug_execute npm install - fi - - if ! is_boolean_yes "$EXPRESS_SKIP_BOWER_INSTALL" && [[ -f bower.json ]]; then - info "Installing bower dependencies" - debug_execute bower install - fi - - if ! is_boolean_yes "$EXPRESS_SKIP_DATABASE_MIGRATE" && [[ -f .sequelizerc ]]; then - info "Applying database migrations (sequelize db:migrate)" - debug_execute sequelize db:migrate - fi - else - info "An existing project was detected, skipping project creation" - fi - - # Avoid exit code of previous commands to affect the result of this function - true -} diff --git a/bitnami/express/4/debian-12/rootfs/post-init.d/shell.sh b/bitnami/express/4/debian-12/rootfs/post-init.d/shell.sh deleted file mode 100755 index 75a202d6ecc51..0000000000000 --- a/bitnami/express/4/debian-12/rootfs/post-init.d/shell.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Executes custom Bash init scripts - -# shellcheck disable=SC1090,SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries with logging functions -if [[ -f /opt/bitnami/base/functions ]]; then - . /opt/bitnami/base/functions -else - . /opt/bitnami/scripts/liblog.sh -fi - -# Loop through all input files passed via stdin -read -r -a custom_init_scripts <<< "$@" -failure=0 -if [[ "${#custom_init_scripts[@]}" -gt 0 ]]; then - for custom_init_script in "${custom_init_scripts[@]}"; do - [[ "$custom_init_script" != *".sh" ]] && continue - if [[ -x "$custom_init_script" ]]; then - info "Executing ${custom_init_script}" - "$custom_init_script" || failure="1" - else - info "Sourcing ${custom_init_script} as it is not executable by the current user, any error may cause initialization to fail" - . "$custom_init_script" - fi - [[ "$failure" -ne 0 ]] && error "Failed to execute ${custom_init_script}" - done -fi - -exit "$failure" diff --git a/bitnami/express/4/debian-12/rootfs/post-init.sh b/bitnami/express/4/debian-12/rootfs/post-init.sh deleted file mode 100755 index 6e6ef742026d7..0000000000000 --- a/bitnami/express/4/debian-12/rootfs/post-init.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Only execute init scripts once -if [[ ! -f "/bitnami/express/.user_scripts_initialized" && -d "/docker-entrypoint-init.d" ]]; then - read -r -a init_scripts <<< "$(find "/docker-entrypoint-init.d" -type f -print0 | sort -z | xargs -0)" - if [[ "${#init_scripts[@]}" -gt 0 ]] && [[ ! -f "/bitnami/express/.user_scripts_initialized" ]]; then - mkdir -p "/bitnami/express" - for init_script in "${init_scripts[@]}"; do - for init_script_type_handler in /post-init.d/*.sh; do - "$init_script_type_handler" "$init_script" - done - done - fi - - touch "/bitnami/express/.user_scripts_initialized" -fi diff --git a/bitnami/express/4/debian-12/tags-info.yaml b/bitnami/express/4/debian-12/tags-info.yaml deleted file mode 100644 index e8f170bc4d368..0000000000000 --- a/bitnami/express/4/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "4" -- 4-debian-12 -- 4.21.2 diff --git a/bitnami/fluent-bit/2/README.md b/bitnami/fluent-bit/2/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/fluent-bit/2/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/fluent-bit/2/debian-12/Dockerfile b/bitnami/fluent-bit/2/debian-12/Dockerfile deleted file mode 100644 index 802e1accba7c8..0000000000000 --- a/bitnami/fluent-bit/2/debian-12/Dockerfile +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T20:33:28Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/fluent-bit/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="2.2.3-debian-12-r12" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/fluent-bit" \ - org.opencontainers.image.title="fluent-bit" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="2.2.3" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libcap2 libgcc-s1 libgcrypt20 libgpg-error0 liblz4-1 liblzma5 libsasl2-2 libssl3 libsystemd0 libyaml-0-2 libzstd1 procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "fluent-bit-2.2.3-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN chown -R 1001:1001 /opt/bitnami/fluent-bit - -ENV APP_VERSION="2.2.3" \ - BITNAMI_APP_NAME="fluent-bit" \ - PATH="/opt/bitnami/fluent-bit/bin:$PATH" - -EXPOSE 2020 - -WORKDIR /opt/bitnami/fluent-bit -USER 1001 -ENTRYPOINT [ "fluent-bit" ] -CMD [ "-c", "/opt/bitnami/fluent-bit/conf/fluent-bit.conf" ] diff --git a/bitnami/fluent-bit/2/debian-12/docker-compose.yml b/bitnami/fluent-bit/2/debian-12/docker-compose.yml deleted file mode 100644 index 3c85b7e20bdd5..0000000000000 --- a/bitnami/fluent-bit/2/debian-12/docker-compose.yml +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - fluent-bit: - image: docker.io/bitnami/fluent-bit:2 - ports: - - '2020:2020' diff --git a/bitnami/fluent-bit/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/fluent-bit/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 60485d5d04692..0000000000000 --- a/bitnami/fluent-bit/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "fluent-bit": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "2.2.3-1" - } -} \ No newline at end of file diff --git a/bitnami/fluent-bit/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/fluent-bit/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/fluent-bit/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/fluent-bit/2/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/fluent-bit/2/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/fluent-bit/2/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/fluent-bit/2/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/fluent-bit/2/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/fluent-bit/2/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/fluent-bit/2/debian-12/tags-info.yaml b/bitnami/fluent-bit/2/debian-12/tags-info.yaml deleted file mode 100644 index bd7a52ffe5c61..0000000000000 --- a/bitnami/fluent-bit/2/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "2" -- 2-debian-12 -- 2.2.3 diff --git a/bitnami/golang/1.22/README.md b/bitnami/golang/1.22/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/golang/1.22/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/golang/1.22/debian-12/Dockerfile b/bitnami/golang/1.22/debian-12/Dockerfile deleted file mode 100644 index 90db308d86c1f..0000000000000 --- a/bitnami/golang/1.22/debian-12/Dockerfile +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T22:14:41Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/golang/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="1.22.10-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/golang" \ - org.opencontainers.image.title="golang" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="1.22.10" - -ENV OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages build-essential ca-certificates curl git pkg-config procps unzip -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "golang-1.22.10-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir -p "/go/src" "/go/bin" && chmod -R 777 "/go" - -ENV APP_VERSION="1.22.10" \ - BITNAMI_APP_NAME="golang" \ - GOCACHE="/go/.cache" \ - GOPATH="/go" \ - PATH="/go/bin:/opt/bitnami/go/bin:$PATH" - -WORKDIR $GOPATH -CMD [ "bash" ] diff --git a/bitnami/golang/1.22/debian-12/docker-compose.yml b/bitnami/golang/1.22/debian-12/docker-compose.yml deleted file mode 100644 index 778c11d8c1487..0000000000000 --- a/bitnami/golang/1.22/debian-12/docker-compose.yml +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - golang: - tty: true # Enables debugging capabilities when attached to this container. - image: docker.io/bitnami/golang:1.22 - command: ["sleep", "infinity"] # To keep the container running diff --git a/bitnami/golang/1.22/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/golang/1.22/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 0ebd4bbf6abfe..0000000000000 --- a/bitnami/golang/1.22/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "golang": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.22.10-0" - } -} \ No newline at end of file diff --git a/bitnami/golang/1.22/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/golang/1.22/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/golang/1.22/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/golang/1.22/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/golang/1.22/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/golang/1.22/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/golang/1.22/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/golang/1.22/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/golang/1.22/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/golang/1.22/debian-12/tags-info.yaml b/bitnami/golang/1.22/debian-12/tags-info.yaml deleted file mode 100644 index d44ab043d8d88..0000000000000 --- a/bitnami/golang/1.22/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "1.22" -- 1.22-debian-12 -- 1.22.10 diff --git a/bitnami/grafana/10/README.md b/bitnami/grafana/10/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/grafana/10/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/grafana/10/debian-12/Dockerfile b/bitnami/grafana/10/debian-12/Dockerfile deleted file mode 100644 index 8eba98ba0d6a4..0000000000000 --- a/bitnami/grafana/10/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-04T16:14:41Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/grafana/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="10.4.14-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/grafana" \ - org.opencontainers.image.title="grafana" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="10.4.14" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libaudit1 libcap-ng0 libfontconfig libgcc-s1 libicu72 liblzma5 libncurses6 libpam0g libssl3 libstdc++6 libtinfo6 libxml2 procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "mysql-client-10.11.10-0-linux-${OS_ARCH}-debian-12" \ - "ini-file-1.4.7-8-linux-${OS_ARCH}-debian-12" \ - "grafana-10.4.14-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/grafana/postunpack.sh -ENV APP_VERSION="10.4.14" \ - BITNAMI_APP_NAME="grafana" \ - PATH="/opt/bitnami/mysql/bin:/opt/bitnami/common/bin:/opt/bitnami/grafana/bin:$PATH" - -EXPOSE 3000 - -WORKDIR /opt/bitnami/grafana -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/grafana/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/grafana/run.sh" ] diff --git a/bitnami/grafana/10/debian-12/docker-compose.yml b/bitnami/grafana/10/debian-12/docker-compose.yml deleted file mode 100644 index 6c417e67c1677..0000000000000 --- a/bitnami/grafana/10/debian-12/docker-compose.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - grafana: - image: docker.io/bitnami/grafana:10 - ports: - - '3000:3000' - environment: - - 'GF_SECURITY_ADMIN_PASSWORD=bitnami' - volumes: - - grafana_data:/opt/bitnami/grafana/data -volumes: - grafana_data: - driver: local diff --git a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 8141354717dcf..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "grafana": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "10.4.14-0" - }, - "ini-file": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.4.7-8" - }, - "mysql-client": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "10.11.10-0" - } -} \ No newline at end of file diff --git a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/grafana/10/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/grafana/10/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/grafana/10/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/grafana/10/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/grafana/10/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana-env.sh b/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana-env.sh deleted file mode 100644 index 6fe8b45453817..0000000000000 --- a/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana-env.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for grafana - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-grafana}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -grafana_env_vars=( - GRAFANA_TMP_DIR - GRAFANA_PID_FILE - GRAFANA_DEFAULT_CONF_DIR - GRAFANA_DEFAULT_PLUGINS_DIR - GF_PATHS_HOME - GF_PATHS_CONFIG - GF_PATHS_DATA - GF_PATHS_LOGS - GF_PATHS_PLUGINS - GF_PATHS_PROVISIONING - GF_INSTALL_PLUGINS - GF_INSTALL_PLUGINS_SKIP_TLS - GF_FEATURE_TOGGLES - GRAFANA_MIGRATION_LOCK - GRAFANA_SLEEP_TIME - GRAFANA_RETRY_ATTEMPTS - GRAFANA_PLUGINS -) -for env_var in "${grafana_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset grafana_env_vars - -# Grafana paths -export GRAFANA_BASE_DIR="${BITNAMI_ROOT_DIR}/grafana" -export GRAFANA_BIN_DIR="${GRAFANA_BASE_DIR}/bin" -export GRAFANA_TMP_DIR="${GRAFANA_TMP_DIR:-${GRAFANA_BASE_DIR}/tmp}" -export GRAFANA_CONF_DIR="${GRAFANA_BASE_DIR}/conf" -export GRAFANA_PID_FILE="${GRAFANA_PID_FILE:-${GRAFANA_TMP_DIR}/grafana.pid}" -export PATH="${GRAFANA_BIN_DIR}:${BITNAMI_ROOT_DIR}/common/bin:${PATH}" -export GRAFANA_DEFAULT_CONF_DIR="${GRAFANA_DEFAULT_CONF_DIR:-${GRAFANA_BASE_DIR}/conf.default}" -export GRAFANA_DEFAULT_PLUGINS_DIR="${GRAFANA_DEFAULT_PLUGINS_DIR:-${GRAFANA_BASE_DIR}/default-plugins}" - -# System users (when running with a privileged user) -export GRAFANA_DAEMON_USER="grafana" -export GRAFANA_DAEMON_GROUP="grafana" - -# Grafana configuration -export GF_PATHS_HOME="${GF_PATHS_HOME:-$GRAFANA_BASE_DIR}" -export GF_PATHS_CONFIG="${GF_PATHS_CONFIG:-${GRAFANA_BASE_DIR}/conf/grafana.ini}" -export GF_PATHS_DATA="${GF_PATHS_DATA:-${GRAFANA_BASE_DIR}/data}" -export GF_PATHS_LOGS="${GF_PATHS_LOGS:-${GRAFANA_BASE_DIR}/logs}" -export GF_PATHS_PLUGINS="${GF_PATHS_PLUGINS:-${GF_PATHS_DATA}/plugins}" -export GF_PATHS_PROVISIONING="${GF_PATHS_PROVISIONING:-${GRAFANA_BASE_DIR}/conf/provisioning}" -GF_INSTALL_PLUGINS="${GF_INSTALL_PLUGINS:-"${GRAFANA_PLUGINS:-}"}" -export GF_INSTALL_PLUGINS="${GF_INSTALL_PLUGINS:-}" -export GF_INSTALL_PLUGINS_SKIP_TLS="${GF_INSTALL_PLUGINS_SKIP_TLS:-yes}" -export GF_FEATURE_TOGGLES="${GF_FEATURE_TOGGLES:-}" -export GF_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/grafana" -export GRAFANA_MIGRATION_LOCK="${GRAFANA_MIGRATION_LOCK:-false}" -export GRAFANA_SLEEP_TIME="${GRAFANA_SLEEP_TIME:-10}" -export GRAFANA_RETRY_ATTEMPTS="${GRAFANA_RETRY_ATTEMPTS:-12}" - -# Grafana Operator configuration -export GF_OP_PATHS_CONFIG="/etc/grafana/grafana.ini" -export GF_OP_PATHS_DATA="/var/lib/grafana" -export GF_OP_PATHS_LOGS="/var/log/grafana" -export GF_OP_PATHS_PROVISIONING="/etc/grafana/provisioning" -export GF_OP_PLUGINS_INIT_DIR="/opt/plugins" - -# Custom environment variables may be defined below diff --git a/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/entrypoint.sh b/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/entrypoint.sh deleted file mode 100755 index c0e9e706f81be..0000000000000 --- a/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/entrypoint.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load Grafana environment -. /opt/bitnami/scripts/grafana-env.sh - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -function is_exec() { - # This checks if the first provided argument is executable or if only args was used - exec_in_path=$(builtin type -P "$1" 2> /dev/null) - if [[ -f "$1" && -x $(realpath "$1" 2> /dev/null) || -x $(realpath "$exec_in_path" 2> /dev/null) ]]; then - true; - else - false; - fi; -} - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/postgresql/conf) -debug "Copying files from $GRAFANA_DEFAULT_CONF_DIR to $GRAFANA_CONF_DIR" -cp -nr "$GRAFANA_DEFAULT_CONF_DIR"/. "$GRAFANA_CONF_DIR" - -if [[ "$1" = "/opt/bitnami/scripts/grafana/run.sh" ]] || ! is_exec "$1"; then - # This catches the error-code from libgrafana.sh for the immediate exit when the grafana-operator is used. And ensure that the exit code is kept silently. - /opt/bitnami/scripts/grafana/setup.sh || GRAFANA_OPERATOR_IMMEDIATE_EXIT=$? - if [[ "${GRAFANA_OPERATOR_IMMEDIATE_EXIT:-0}" -eq 255 ]]; then - exit 0 - elif [[ "${GRAFANA_OPERATOR_IMMEDIATE_EXIT:-0}" -ne 0 ]]; then - exit "$GRAFANA_OPERATOR_IMMEDIATE_EXIT" - fi - /post-init.sh - info "** Grafana setup finished! **" -fi - -echo "" - -if is_exec "$1"; then - exec "$@" -else - exec "/opt/bitnami/scripts/grafana/run.sh" "$@" -fi diff --git a/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/postunpack.sh b/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/postunpack.sh deleted file mode 100755 index 5f7eadfffed5d..0000000000000 --- a/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/postunpack.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load Grafana environment -. /opt/bitnami/scripts/grafana-env.sh - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libgrafana.sh - -info "Creating configuration file" -cp "${GRAFANA_BASE_DIR}/conf/sample.ini" "$(grafana_env_var_value PATHS_CONFIG)" - -info "Creating system user" -ensure_user_exists "$GRAFANA_DAEMON_USER" --group "$GRAFANA_DAEMON_GROUP" --system - -info "Configuring file permissions" -for dir in "$(grafana_env_var_value PATHS_DATA)" "$(grafana_env_var_value PATHS_LOGS)" "$(grafana_env_var_value PATHS_PLUGINS)" "$(grafana_env_var_value PATHS_PROVISIONING)" "$(grafana_env_var_value VOLUME_DIR)" "${GRAFANA_DEFAULT_CONF_DIR}"; do - ensure_dir_exists "$dir" - # Use grafana:root ownership for compatibility when running as a non-root user - configure_permissions_ownership "$dir" -d "775" -f "664" -u "$GRAFANA_DAEMON_USER" -g "root" -done - -# Use grafana:root ownership for compatibility when running as a non-root user -configure_permissions_ownership "$(grafana_env_var_value PATHS_CONFIG)" -f "664" -u "$GRAFANA_DAEMON_USER" -g "root" - -# Ensure permissions to parent directories of configs -# Used when replacing configs with symlinks for grafana-operator compatibility -for dir in "$(grafana_env_var_value PATHS_CONFIG)" "$(grafana_env_var_value PATHS_DATA)" "$(grafana_env_var_value PATHS_LOGS)" "$(grafana_env_var_value PATHS_PROVISIONING)"; do - chmod 775 "$(dirname "$dir")" -done - -# Install well-known plugins -grafana_plugin_list=( - "grafana-clock-panel" - "grafana-piechart-panel" - "michaeldmoore-annunciator-panel" - "briangann-gauge-panel" - "briangann-datatable-panel" - "jdbranham-diagram-panel" - "natel-discrete-panel" - "digiapulssi-organisations-panel" - "vonage-status-panel" - "neocat-cal-heatmap-panel" - "agenty-flowcharting-panel" - "larona-epict-panel" - "pierosavi-imageit-panel" - "michaeldmoore-multistat-panel" - "grafana-polystat-panel" - "scadavis-synoptic-panel" - "marcuscalidus-svg-panel" - "snuids-trafficlights-panel" -) -for plugin in "${grafana_plugin_list[@]}"; do - info "Installing ${plugin} plugin" - grafana cli --pluginsDir "$(grafana_env_var_value PATHS_PLUGINS)" plugins install "$plugin" -done - -# The Grafana Helm chart mounts the data directory at "/opt/bitnami/grafana/data" -# Therefore, all the plugins installed when building the image will be lost -# As a workaround, we can move them to a "default-plugins" directory and recover them -# during the 1st boot of the container -ensure_dir_exists "$GRAFANA_DEFAULT_PLUGINS_DIR" -mv "$(grafana_env_var_value PATHS_PLUGINS)"/* "$GRAFANA_DEFAULT_PLUGINS_DIR" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "$GRAFANA_CONF_DIR"/* "$GRAFANA_DEFAULT_CONF_DIR" diff --git a/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/run.sh b/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/run.sh deleted file mode 100755 index 3c5cef524ad26..0000000000000 --- a/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/run.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load Grafana environment -. /opt/bitnami/scripts/grafana-env.sh - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh - -declare cmd="grafana" -declare -a args=( - # Based on https://github.com/grafana/grafana/blob/v8.2.5/packaging/docker/run.sh - "server" - "--homepath=${GF_PATHS_HOME}" - "--config=${GF_PATHS_CONFIG}" - "--pidfile=${GRAFANA_PID_FILE}" - "--packaging=docker" - "$@" - "cfg:default.log.mode=console" - "cfg:default.paths.data=${GF_PATHS_DATA}" - "cfg:default.paths.logs=${GF_PATHS_LOGS}" - "cfg:default.paths.plugins=${GF_PATHS_PLUGINS}" - "cfg:default.paths.provisioning=${GF_PATHS_PROVISIONING}" -) - -cd "$GRAFANA_BASE_DIR" - -info "** Starting Grafana **" -if am_i_root; then - exec_as_user "$GRAFANA_DAEMON_USER" "$cmd" "${args[@]}" -else - exec "$cmd" "${args[@]}" -fi diff --git a/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/setup.sh b/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/setup.sh deleted file mode 100755 index c6efe21857ebc..0000000000000 --- a/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/grafana/setup.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load Grafana environment -. /opt/bitnami/scripts/grafana-env.sh - -# Load MySQL Client environment for 'mysql_remote_execute' (after 'grafana-env.sh' so that MODULE is not set to a wrong value) -if [[ -f /opt/bitnami/scripts/mysql-client-env.sh ]]; then - . /opt/bitnami/scripts/mysql-client-env.sh -elif [[ -f /opt/bitnami/scripts/mysql-env.sh ]]; then - . /opt/bitnami/scripts/mysql-env.sh -elif [[ -f /opt/bitnami/scripts/mariadb-env.sh ]]; then - . /opt/bitnami/scripts/mariadb-env.sh -fi - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libgrafana.sh - -# Ensure Grafana environment variables are valid -grafana_validate - -# Ensure Grafana is initialized -grafana_initialize diff --git a/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/libgrafana.sh b/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/libgrafana.sh deleted file mode 100644 index 4ca82f5988be3..0000000000000 --- a/bitnami/grafana/10/debian-12/rootfs/opt/bitnami/scripts/libgrafana.sh +++ /dev/null @@ -1,387 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Grafana library - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Load database library -if [[ -f /opt/bitnami/scripts/libmysqlclient.sh ]]; then - . /opt/bitnami/scripts/libmysqlclient.sh -elif [[ -f /opt/bitnami/scripts/libmysql.sh ]]; then - . /opt/bitnami/scripts/libmysql.sh -elif [[ -f /opt/bitnami/scripts/libmariadb.sh ]]; then - . /opt/bitnami/scripts/libmariadb.sh -fi - -######################## -# Print the value of a Grafana environment variable -# Globals: -# GF_* -# GRAFANA_CFG_* -# Arguments: -# None -# Returns: -# The value in the environment variable -######################### -grafana_env_var_value() { - local -r name="${1:?missing name}" - local gf_env_var="GF_${name}" - local grafana_cfg_env_var="GRAFANA_CFG_${name}" - if [[ -n "${!gf_env_var:-}" ]]; then - echo "${!gf_env_var:-}" - elif [[ -n "${!grafana_cfg_env_var}" ]]; then - echo "${!grafana_cfg_env_var:-}" - else - error "${gf_env_var} or ${grafana_cfg_env_var} must be set" - fi -} - -######################## -# Validate settings in GRAFANA_* env vars -# Globals: -# GRAFANA_* -# Arguments: -# None -# Returns: -# 0 if the validation succeeded, 1 otherwise -######################### -grafana_validate() { - debug "Validating settings in GRAFANA_* environment variables..." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_path_exists() { - if [[ ! -e "$1" ]]; then - print_validation_error "The directory ${1} does not exist" - fi - } - - # Validate user inputs - [[ -e "$GF_OP_PATHS_CONFIG" ]] || check_path_exists "$(grafana_env_var_value PATHS_CONFIG)" - [[ -e "$GF_OP_PATHS_DATA" ]] || check_path_exists "$(grafana_env_var_value PATHS_DATA)" - [[ -e "$GF_OP_PATHS_LOGS" ]] || check_path_exists "$(grafana_env_var_value PATHS_LOGS)" - [[ -e "$GF_OP_PATHS_PROVISIONING" ]] || check_path_exists "$(grafana_env_var_value PATHS_PROVISIONING)" - - return "$error_code" -} - -######################## -# Ensure Grafana is initialized -# Globals: -# GRAFANA_* -# Arguments: -# None -# Returns: -# None -######################### -grafana_initialize() { - # Ensure compatibility with Grafana Operator - local grafana_var grafana_operator_var - for path_suffix in "config" "data" "logs" "provisioning"; do - grafana_var="GF_PATHS_${path_suffix^^}" - grafana_operator_var="GF_OP_PATHS_${path_suffix^^}" - if [[ -e "${!grafana_operator_var}" && "${!grafana_operator_var}" != "${!grafana_var}" ]]; then - info "Ensuring ${!grafana_operator_var} points to ${!grafana_var}" - rm -rf "${!grafana_var}" - ln -sfn "${!grafana_operator_var}" "${!grafana_var}" - fi - done - - if am_i_root; then - for dir in "$GF_PATHS_DATA" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS"; do - is_mounted_dir_empty "$dir" && configure_permissions_ownership "$dir" -d "775" -f "664" -u "$GRAFANA_DAEMON_USER" - done - fi - - # Install plugins in a Grafana operator-compatible environment, useful to for starting the image as an init container - # Based on https://github.com/grafana-operator/grafana-operator/blob/master/controllers/grafana/pluginsHelper.go - if [[ -d "$GF_OP_PLUGINS_INIT_DIR" ]]; then - info "Detected mounted plugins directory at '${GF_OP_PLUGINS_INIT_DIR}'. The container will exit after installing plugins as grafana-operator." - if [[ -n "$GF_INSTALL_PLUGINS" ]]; then - GF_PATHS_PLUGINS="$GF_OP_PLUGINS_INIT_DIR" grafana_install_plugins - else - warn "There are no plugins to install" - fi - return 255 - fi - - # Recover plugins installed when building the image - if [[ ! -e "$(grafana_env_var_value PATHS_PLUGINS)" ]] || [[ -z "$(ls -A "$(grafana_env_var_value PATHS_PLUGINS)")" ]]; then - mkdir -p "$(grafana_env_var_value PATHS_PLUGINS)" - if [[ -e "$GRAFANA_DEFAULT_PLUGINS_DIR" ]] && [[ -n "$(ls -A "$GRAFANA_DEFAULT_PLUGINS_DIR")" ]]; then - cp -r "$GRAFANA_DEFAULT_PLUGINS_DIR"/* "$(grafana_env_var_value PATHS_PLUGINS)" - fi - fi - - # Configure configuration file based on environment variables - grafana_configure_from_environment_variables - - # Install plugins - grafana_install_plugins - - # Configure Grafana feature toggles - ! is_empty_value "$GF_FEATURE_TOGGLES" && grafana_conf_set "feature_toggles" "enable" "$GF_FEATURE_TOGGLES" - - # If using an external database, avoid nodes collition during migration - if is_boolean_yes "$GRAFANA_MIGRATION_LOCK"; then - grafana_migrate_db - fi - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Runs Grafana migration using a database lock to avoid collision with other Grafana nodes -# If database is locked, wait until unlocked and continue. Otherwise, run Grafana to perform migration. -# Globals: -# GRAFANA_CFG_* -# Arguments: -# None -# Returns: -# None -######################### -grafana_migrate_db() { - local -r db_host="${GRAFANA_CFG_DATABASE_HOST:-mysql}" - local -r db_port="${GRAFANA_CFG_DATABASE_PORT:-3306}" - local -r db_name="${GRAFANA_CFG_DATABASE_NAME:-}" - local -r db_user="${GRAFANA_CFG_DATABASE_USER:-}" - local -r db_pass="${GRAFANA_CFG_DATABASE_PASSWORD:-}" - - local -r grafana_host="${GRAFANA_CFG_SERVER_HTTP_ADDR:-localhost}" - local -r grafana_port="${GRAFANA_CFG_SERVER_HTTP_PORT:-3000}" - local -r grafana_protocol="${GRAFANA_CFG_SERVER_PROTOCOL:-http}" - - local -r sleep_time="${GRAFANA_SLEEP_TIME:-5}" - local -r retries="${GRAFANA_RETRY_ATTEMPTS:-12}" - - lock_db() { - debug_execute mysql_remote_execute_print_output "$db_host" "$db_port" "$db_name" "$db_user" "$db_pass" <&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/haproxy/2/debian-12/tags-info.yaml b/bitnami/haproxy/2/debian-12/tags-info.yaml deleted file mode 100644 index 3efc48c4f8b71..0000000000000 --- a/bitnami/haproxy/2/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "2" -- 2-debian-12 -- 2.9.12 diff --git a/bitnami/hyperledger-fabric-orderer/2/README.md b/bitnami/hyperledger-fabric-orderer/2/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/hyperledger-fabric-orderer/2/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/hyperledger-fabric-orderer/2/debian-12/Dockerfile b/bitnami/hyperledger-fabric-orderer/2/debian-12/Dockerfile deleted file mode 100644 index 1b58b9f822bc6..0000000000000 --- a/bitnami/hyperledger-fabric-orderer/2/debian-12/Dockerfile +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T23:21:37Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/hyperledger-fabric-orderer/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="2.5.10-debian-12-r5" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/hyperledger-fabric-orderer" \ - org.opencontainers.image.title="hyperledger-fabric-orderer" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="2.5.10" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "hyperledger-fabric-orderer-2.5.10-4-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN mkdir /opt/bitnami/hyperledger-fabric-orderer/var && chmod g+rwX /opt/bitnami/hyperledger-fabric-orderer/var && ln -s /opt/bitnami/hyperledger-fabric-orderer/var /var/hyperledger && mkdir -p /etc/hyperledger && ln -s /opt/bitnami/hyperledger-fabric-orderer/etc /etc/hyperledger/fabric && echo "hosts: files dns" > /etc/nsswitch.conf -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -ENV APP_VERSION="2.5.10" \ - BITNAMI_APP_NAME="hyperledger-fabric-orderer" \ - FABRIC_CFG_PATH="/opt/bitnami/hyperledger-fabric-orderer/etc" \ - PATH="/opt/bitnami/hyperledger-fabric-orderer/bin:$PATH" - -EXPOSE 7050 - -USER 1001 -CMD [ "orderer", "start" ] diff --git a/bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 1f8cc9af9bc19..0000000000000 --- a/bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "hyperledger-fabric-orderer": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "2.5.10-4" - } -} \ No newline at end of file diff --git a/bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/hyperledger-fabric-orderer/2/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/hyperledger-fabric-orderer/2/debian-12/tags-info.yaml b/bitnami/hyperledger-fabric-orderer/2/debian-12/tags-info.yaml deleted file mode 100644 index 9776933b95686..0000000000000 --- a/bitnami/hyperledger-fabric-orderer/2/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "2" -- 2-debian-12 -- 2.5.10 diff --git a/bitnami/hyperledger-fabric-peer/2/README.md b/bitnami/hyperledger-fabric-peer/2/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/hyperledger-fabric-peer/2/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/hyperledger-fabric-peer/2/debian-12/Dockerfile b/bitnami/hyperledger-fabric-peer/2/debian-12/Dockerfile deleted file mode 100644 index 7b86b59743985..0000000000000 --- a/bitnami/hyperledger-fabric-peer/2/debian-12/Dockerfile +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T23:28:45Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/hyperledger-fabric-peer/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="2.5.10-debian-12-r5" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/hyperledger-fabric-peer" \ - org.opencontainers.image.title="hyperledger-fabric-peer" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="2.5.10" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "hyperledger-fabric-peer-2.5.10-4-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN mkdir /opt/bitnami/hyperledger-fabric-peer/var && chmod g+rwX /opt/bitnami/hyperledger-fabric-peer/var && ln -s /opt/bitnami/hyperledger-fabric-peer/var /var/hyperledger && mkdir -p /etc/hyperledger && ln -s /opt/bitnami/hyperledger-fabric-peer/etc /etc/hyperledger/fabric && echo "hosts: files dns" > /etc/nsswitch.conf -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -ENV APP_VERSION="2.5.10" \ - BITNAMI_APP_NAME="hyperledger-fabric-peer" \ - FABRIC_CFG_PATH="/opt/bitnami/hyperledger-fabric-peer/etc" \ - PATH="/opt/bitnami/hyperledger-fabric-peer/bin:$PATH" - -EXPOSE 7051 - -USER 1001 -CMD [ "peer", "node", "start" ] diff --git a/bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 7550da0da3a5c..0000000000000 --- a/bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "hyperledger-fabric-peer": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "2.5.10-4" - } -} \ No newline at end of file diff --git a/bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/hyperledger-fabric-peer/2/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/hyperledger-fabric-peer/2/debian-12/tags-info.yaml b/bitnami/hyperledger-fabric-peer/2/debian-12/tags-info.yaml deleted file mode 100644 index 9776933b95686..0000000000000 --- a/bitnami/hyperledger-fabric-peer/2/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "2" -- 2-debian-12 -- 2.5.10 diff --git a/bitnami/hyperledger-fabric-tools/2/README.md b/bitnami/hyperledger-fabric-tools/2/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/hyperledger-fabric-tools/2/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/hyperledger-fabric-tools/2/debian-12/Dockerfile b/bitnami/hyperledger-fabric-tools/2/debian-12/Dockerfile deleted file mode 100644 index a21a64107cf1c..0000000000000 --- a/bitnami/hyperledger-fabric-tools/2/debian-12/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T23:34:41Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/hyperledger-fabric-tools/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="2.5.10-debian-12-r5" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/hyperledger-fabric-tools" \ - org.opencontainers.image.title="hyperledger-fabric-tools" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="2.5.10" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "golang-1.23.4-0-linux-${OS_ARCH}-debian-12" \ - "hyperledger-fabric-tools-2.5.10-4-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN mkdir /opt/bitnami/hyperledger-fabric-tools/var && chmod g+rw /opt/bitnami/hyperledger-fabric-tools/var && ln -s /opt/bitnami/hyperledger-fabric-tools/var /var/hyperledger && mkdir -p /etc/hyperledger && ln -s /opt/bitnami/hyperledger-fabric-tools/etc /etc/hyperledger/fabric && echo "hosts: files dns" > /etc/nsswitch.conf -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -ENV APP_VERSION="2.5.10" \ - BITNAMI_APP_NAME="hyperledger-fabric-tools" \ - PATH="/go/bin:/opt/bitnami/go/bin:/opt/bitnami/hyperledger-fabric-tools/bin:$PATH" - -USER 1001 diff --git a/bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 93518fbd505aa..0000000000000 --- a/bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "golang": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.23.4-0" - }, - "hyperledger-fabric-tools": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "2.5.10-4" - } -} \ No newline at end of file diff --git a/bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/hyperledger-fabric-tools/2/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/hyperledger-fabric-tools/2/debian-12/tags-info.yaml b/bitnami/hyperledger-fabric-tools/2/debian-12/tags-info.yaml deleted file mode 100644 index 9776933b95686..0000000000000 --- a/bitnami/hyperledger-fabric-tools/2/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "2" -- 2-debian-12 -- 2.5.10 diff --git a/bitnami/jaeger/1/README.md b/bitnami/jaeger/1/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/jaeger/1/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/jaeger/1/debian-12/Dockerfile b/bitnami/jaeger/1/debian-12/Dockerfile deleted file mode 100644 index aefc317c2a62a..0000000000000 --- a/bitnami/jaeger/1/debian-12/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-06T23:00:17Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/jaeger/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="1.64.0-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/jaeger" \ - org.opencontainers.image.title="jaeger" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="1.64.0" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "jaeger-1.64.0-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -ENV APP_VERSION="1.64.0" \ - BITNAMI_APP_NAME="jaeger" \ - PATH="/opt/bitnami/jaeger/bin:$PATH" - -WORKDIR /opt/bitnami/jaeger -USER 1001 -ENTRYPOINT [ "/opt/bitnami/jaeger/bin/jaeger-all-in-one" ] diff --git a/bitnami/jaeger/1/debian-12/docker-compose.yml b/bitnami/jaeger/1/debian-12/docker-compose.yml deleted file mode 100644 index 002956604ff0c..0000000000000 --- a/bitnami/jaeger/1/debian-12/docker-compose.yml +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - jaeger: - image: docker.io/bitnami/jaeger:1 - ports: - - 6831:6831 - - 6832:6832 - - 5778:5778 - - 16686:16686 - - 4317:4317 - - 4318:4318 - - 14250:14250 - - 14268:14268 - - 14269:14269 - - 9411:9411 - environment: - - COLLECTOR_ZIPKIN_HOST_PORT=:9411 - - COLLECTOR_OTLP_ENABLED=true diff --git a/bitnami/jaeger/1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/jaeger/1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index ba97b7ade1a62..0000000000000 --- a/bitnami/jaeger/1/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "jaeger": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.64.0-0" - } -} \ No newline at end of file diff --git a/bitnami/jaeger/1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/jaeger/1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/jaeger/1/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/jaeger/1/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/jaeger/1/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/jaeger/1/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/jaeger/1/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/jaeger/1/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/jaeger/1/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/jaeger/1/debian-12/tags-info.yaml b/bitnami/jaeger/1/debian-12/tags-info.yaml deleted file mode 100644 index 3d4bd41f5afd0..0000000000000 --- a/bitnami/jaeger/1/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "1" -- 1-debian-12 -- 1.64.0 diff --git a/bitnami/java/1.8/README.md b/bitnami/java/1.8/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/java/1.8/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/java/1.8/debian-12/Dockerfile b/bitnami/java/1.8/debian-12/Dockerfile deleted file mode 100644 index a9e7fcccfaead..0000000000000 --- a/bitnami/java/1.8/debian-12/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-25T00:14:22Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/java/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="1.8.432-7-debian-12-r3" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/java" \ - org.opencontainers.image.title="java" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="1.8.432-7" - -ENV OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libfontconfig libgcc-s1 libsqlite3-dev libssl-dev locales procps wget -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "java-1.8.432-7-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8 -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN update-locale LANG=C.UTF-8 LC_MESSAGES=POSIX && \ - DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales -RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen -RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \ - sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \ - sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password - -COPY rootfs / -RUN /opt/bitnami/scripts/locales/add-extra-locales.sh -RUN /opt/bitnami/scripts/java/postunpack.sh -ENV APP_VERSION="1.8.432-7" \ - BITNAMI_APP_NAME="java" \ - JAVA_HOME="/opt/bitnami/java" \ - LANG="en_US.UTF-8" \ - LANGUAGE="en_US:en" \ - PATH="/opt/bitnami/java/bin:$PATH" - -WORKDIR /app -ENTRYPOINT [ "/opt/bitnami/scripts/java/entrypoint.sh" ] -CMD [ "bash" ] diff --git a/bitnami/java/1.8/debian-12/docker-compose.yml b/bitnami/java/1.8/debian-12/docker-compose.yml deleted file mode 100644 index c0cf8f034d328..0000000000000 --- a/bitnami/java/1.8/debian-12/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - java: - tty: true # Enables debugging capabilities when attached to this container. - image: docker.io/bitnami/java:1.8 - command: ["tail", "-f", "/dev/null"] # To keep the container running - ports: - - 8080:8080 - volumes: - - .:/app diff --git a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 7584adad76dcf..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.8.432-7-1" - } -} \ No newline at end of file diff --git a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/java/1.8/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/java/1.8/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/java/1.8/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/java/1.8/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/java/1.8/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/java/1.8/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/java/1.8/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 8557631d25490..0000000000000 --- a/bitnami/java/1.8/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/java/1.8/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/java/1.8/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/java/1.8/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/java/1.8/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh b/bitnami/java/1.8/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh deleted file mode 100755 index 5f563bbfaa26e..0000000000000 --- a/bitnami/java/1.8/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purpose - -# Defaults -WITH_ALL_LOCALES="${WITH_ALL_LOCALES:-no}" -EXTRA_LOCALES="${EXTRA_LOCALES:-}" - -# Constants -LOCALES_FILE="/etc/locale.gen" -SUPPORTED_LOCALES_FILE="/usr/share/i18n/SUPPORTED" - -# Helper function for enabling locale only when it was not added before -enable_locale() { - local -r locale="${1:?missing locale}" - if ! grep -q -E "^${locale}$" "$SUPPORTED_LOCALES_FILE"; then - echo "Locale ${locale} is not supported in this system" - return 1 - fi - if ! grep -q -E "^${locale}" "$LOCALES_FILE"; then - echo "$locale" >> "$LOCALES_FILE" - else - echo "Locale ${locale} is already enabled" - fi -} - -if [[ "$WITH_ALL_LOCALES" =~ ^(yes|true|1)$ ]]; then - echo "Enabling all locales" - cp "$SUPPORTED_LOCALES_FILE" "$LOCALES_FILE" -else - # shellcheck disable=SC2001 - LOCALES_TO_ADD="$(sed 's/[,;]\s*/\n/g' <<< "$EXTRA_LOCALES")" - while [[ -n "$LOCALES_TO_ADD" ]] && read -r locale; do - echo "Enabling locale ${locale}" - enable_locale "$locale" - done <<< "$LOCALES_TO_ADD" -fi - -locale-gen diff --git a/bitnami/java/1.8/debian-12/tags-info.yaml b/bitnami/java/1.8/debian-12/tags-info.yaml deleted file mode 100644 index 768199f9cdc47..0000000000000 --- a/bitnami/java/1.8/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "1.8" -- 1.8-debian-12 -- 1.8.432-7 diff --git a/bitnami/java/11/README.md b/bitnami/java/11/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/java/11/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/java/11/debian-12/Dockerfile b/bitnami/java/11/debian-12/Dockerfile deleted file mode 100644 index d16dc7d7f09f5..0000000000000 --- a/bitnami/java/11/debian-12/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-25T00:18:30Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/java/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="11.0.25-11-debian-12-r4" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/java" \ - org.opencontainers.image.title="java" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="11.0.25-11" - -ENV OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libfontconfig libsqlite3-dev libssl-dev locales procps wget zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "java-11.0.25-11-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8 -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN update-locale LANG=C.UTF-8 LC_MESSAGES=POSIX && \ - DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales -RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen -RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \ - sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \ - sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password - -COPY rootfs / -RUN /opt/bitnami/scripts/locales/add-extra-locales.sh -RUN /opt/bitnami/scripts/java/postunpack.sh -ENV APP_VERSION="11.0.25-11" \ - BITNAMI_APP_NAME="java" \ - JAVA_HOME="/opt/bitnami/java" \ - LANG="en_US.UTF-8" \ - LANGUAGE="en_US:en" \ - PATH="/opt/bitnami/java/bin:$PATH" - -WORKDIR /app -ENTRYPOINT [ "/opt/bitnami/scripts/java/entrypoint.sh" ] -CMD [ "bash" ] diff --git a/bitnami/java/11/debian-12/docker-compose.yml b/bitnami/java/11/debian-12/docker-compose.yml deleted file mode 100644 index 02aa3dc82d229..0000000000000 --- a/bitnami/java/11/debian-12/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - java: - tty: true # Enables debugging capabilities when attached to this container. - image: docker.io/bitnami/java:11 - command: ["tail", "-f", "/dev/null"] # To keep the container running - ports: - - 8080:8080 - volumes: - - .:/app diff --git a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index ab56b8778a670..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "11.0.25-11-1" - } -} \ No newline at end of file diff --git a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/java/11/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/java/11/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/java/11/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/java/11/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/java/11/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/java/11/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/java/11/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 8557631d25490..0000000000000 --- a/bitnami/java/11/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/java/11/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/java/11/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/java/11/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/java/11/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh b/bitnami/java/11/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh deleted file mode 100755 index 5f563bbfaa26e..0000000000000 --- a/bitnami/java/11/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purpose - -# Defaults -WITH_ALL_LOCALES="${WITH_ALL_LOCALES:-no}" -EXTRA_LOCALES="${EXTRA_LOCALES:-}" - -# Constants -LOCALES_FILE="/etc/locale.gen" -SUPPORTED_LOCALES_FILE="/usr/share/i18n/SUPPORTED" - -# Helper function for enabling locale only when it was not added before -enable_locale() { - local -r locale="${1:?missing locale}" - if ! grep -q -E "^${locale}$" "$SUPPORTED_LOCALES_FILE"; then - echo "Locale ${locale} is not supported in this system" - return 1 - fi - if ! grep -q -E "^${locale}" "$LOCALES_FILE"; then - echo "$locale" >> "$LOCALES_FILE" - else - echo "Locale ${locale} is already enabled" - fi -} - -if [[ "$WITH_ALL_LOCALES" =~ ^(yes|true|1)$ ]]; then - echo "Enabling all locales" - cp "$SUPPORTED_LOCALES_FILE" "$LOCALES_FILE" -else - # shellcheck disable=SC2001 - LOCALES_TO_ADD="$(sed 's/[,;]\s*/\n/g' <<< "$EXTRA_LOCALES")" - while [[ -n "$LOCALES_TO_ADD" ]] && read -r locale; do - echo "Enabling locale ${locale}" - enable_locale "$locale" - done <<< "$LOCALES_TO_ADD" -fi - -locale-gen diff --git a/bitnami/java/11/debian-12/tags-info.yaml b/bitnami/java/11/debian-12/tags-info.yaml deleted file mode 100644 index eb782320aa73f..0000000000000 --- a/bitnami/java/11/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "11" -- 11-debian-12 -- 11.0.25-11 diff --git a/bitnami/java/17/README.md b/bitnami/java/17/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/java/17/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/java/17/debian-12/Dockerfile b/bitnami/java/17/debian-12/Dockerfile deleted file mode 100644 index fd9a927795e5b..0000000000000 --- a/bitnami/java/17/debian-12/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-25T00:12:15Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/java/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="17.0.13-12-debian-12-r3" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/java" \ - org.opencontainers.image.title="java" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="17.0.13-12" - -ENV OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libfontconfig libsqlite3-dev libssl-dev locales procps wget zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "java-17.0.13-12-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8 -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN update-locale LANG=C.UTF-8 LC_MESSAGES=POSIX && \ - DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales -RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen -RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \ - sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \ - sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password - -COPY rootfs / -RUN /opt/bitnami/scripts/locales/add-extra-locales.sh -RUN /opt/bitnami/scripts/java/postunpack.sh -ENV APP_VERSION="17.0.13-12" \ - BITNAMI_APP_NAME="java" \ - JAVA_HOME="/opt/bitnami/java" \ - LANG="en_US.UTF-8" \ - LANGUAGE="en_US:en" \ - PATH="/opt/bitnami/java/bin:$PATH" - -WORKDIR /app -ENTRYPOINT [ "/opt/bitnami/scripts/java/entrypoint.sh" ] -CMD [ "bash" ] diff --git a/bitnami/java/17/debian-12/docker-compose.yml b/bitnami/java/17/debian-12/docker-compose.yml deleted file mode 100644 index f41e3067bb485..0000000000000 --- a/bitnami/java/17/debian-12/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - java: - tty: true # Enables debugging capabilities when attached to this container. - image: docker.io/bitnami/java:17 - command: ["tail", "-f", "/dev/null"] # To keep the container running - ports: - - 8080:8080 - volumes: - - .:/app diff --git a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 47b00ce1d1bbf..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "17.0.13-12-1" - } -} \ No newline at end of file diff --git a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/java/17/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/java/17/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/java/17/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/java/17/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/java/17/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/java/17/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/java/17/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 8557631d25490..0000000000000 --- a/bitnami/java/17/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/java/17/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/java/17/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/java/17/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/java/17/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh b/bitnami/java/17/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh deleted file mode 100755 index 5f563bbfaa26e..0000000000000 --- a/bitnami/java/17/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purpose - -# Defaults -WITH_ALL_LOCALES="${WITH_ALL_LOCALES:-no}" -EXTRA_LOCALES="${EXTRA_LOCALES:-}" - -# Constants -LOCALES_FILE="/etc/locale.gen" -SUPPORTED_LOCALES_FILE="/usr/share/i18n/SUPPORTED" - -# Helper function for enabling locale only when it was not added before -enable_locale() { - local -r locale="${1:?missing locale}" - if ! grep -q -E "^${locale}$" "$SUPPORTED_LOCALES_FILE"; then - echo "Locale ${locale} is not supported in this system" - return 1 - fi - if ! grep -q -E "^${locale}" "$LOCALES_FILE"; then - echo "$locale" >> "$LOCALES_FILE" - else - echo "Locale ${locale} is already enabled" - fi -} - -if [[ "$WITH_ALL_LOCALES" =~ ^(yes|true|1)$ ]]; then - echo "Enabling all locales" - cp "$SUPPORTED_LOCALES_FILE" "$LOCALES_FILE" -else - # shellcheck disable=SC2001 - LOCALES_TO_ADD="$(sed 's/[,;]\s*/\n/g' <<< "$EXTRA_LOCALES")" - while [[ -n "$LOCALES_TO_ADD" ]] && read -r locale; do - echo "Enabling locale ${locale}" - enable_locale "$locale" - done <<< "$LOCALES_TO_ADD" -fi - -locale-gen diff --git a/bitnami/java/17/debian-12/tags-info.yaml b/bitnami/java/17/debian-12/tags-info.yaml deleted file mode 100644 index b8773a3cb4ecc..0000000000000 --- a/bitnami/java/17/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "17" -- 17-debian-12 -- 17.0.13-12 diff --git a/bitnami/java/22/README.md b/bitnami/java/22/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/java/22/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/java/22/debian-12/Dockerfile b/bitnami/java/22/debian-12/Dockerfile deleted file mode 100644 index 822c101d72193..0000000000000 --- a/bitnami/java/22/debian-12/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-25T00:18:09Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/java/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="22.0.2-11-debian-12-r11" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/java" \ - org.opencontainers.image.title="java" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="22.0.2-11" - -ENV OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libfontconfig libsqlite3-dev libssl-dev locales procps wget zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "java-22.0.2-11-2-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8 -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN update-locale LANG=C.UTF-8 LC_MESSAGES=POSIX && \ - DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales -RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen -RUN sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS 90/' /etc/login.defs && \ - sed -i 's/^PASS_MIN_DAYS.*/PASS_MIN_DAYS 0/' /etc/login.defs && \ - sed -i 's/sha512/sha512 minlen=8/' /etc/pam.d/common-password - -COPY rootfs / -RUN /opt/bitnami/scripts/locales/add-extra-locales.sh -RUN /opt/bitnami/scripts/java/postunpack.sh -ENV APP_VERSION="22.0.2-11" \ - BITNAMI_APP_NAME="java" \ - JAVA_HOME="/opt/bitnami/java" \ - LANG="en_US.UTF-8" \ - LANGUAGE="en_US:en" \ - PATH="/opt/bitnami/java/bin:$PATH" - -WORKDIR /app -ENTRYPOINT [ "/opt/bitnami/scripts/java/entrypoint.sh" ] -CMD [ "bash" ] diff --git a/bitnami/java/22/debian-12/docker-compose.yml b/bitnami/java/22/debian-12/docker-compose.yml deleted file mode 100644 index 633eb9a5b3572..0000000000000 --- a/bitnami/java/22/debian-12/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - java: - tty: true # Enables debugging capabilities when attached to this container. - image: docker.io/bitnami/java:22 - command: ["tail", "-f", "/dev/null"] # To keep the container running - ports: - - 8080:8080 - volumes: - - .:/app diff --git a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index e4b5ce068319b..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "22.0.2-11-2" - } -} \ No newline at end of file diff --git a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/java/22/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/java/22/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/java/22/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/java/22/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/java/22/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/java/22/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/java/22/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 8557631d25490..0000000000000 --- a/bitnami/java/22/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/java/22/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/java/22/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/java/22/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/java/22/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh b/bitnami/java/22/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh deleted file mode 100755 index 5f563bbfaa26e..0000000000000 --- a/bitnami/java/22/debian-12/rootfs/opt/bitnami/scripts/locales/add-extra-locales.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purpose - -# Defaults -WITH_ALL_LOCALES="${WITH_ALL_LOCALES:-no}" -EXTRA_LOCALES="${EXTRA_LOCALES:-}" - -# Constants -LOCALES_FILE="/etc/locale.gen" -SUPPORTED_LOCALES_FILE="/usr/share/i18n/SUPPORTED" - -# Helper function for enabling locale only when it was not added before -enable_locale() { - local -r locale="${1:?missing locale}" - if ! grep -q -E "^${locale}$" "$SUPPORTED_LOCALES_FILE"; then - echo "Locale ${locale} is not supported in this system" - return 1 - fi - if ! grep -q -E "^${locale}" "$LOCALES_FILE"; then - echo "$locale" >> "$LOCALES_FILE" - else - echo "Locale ${locale} is already enabled" - fi -} - -if [[ "$WITH_ALL_LOCALES" =~ ^(yes|true|1)$ ]]; then - echo "Enabling all locales" - cp "$SUPPORTED_LOCALES_FILE" "$LOCALES_FILE" -else - # shellcheck disable=SC2001 - LOCALES_TO_ADD="$(sed 's/[,;]\s*/\n/g' <<< "$EXTRA_LOCALES")" - while [[ -n "$LOCALES_TO_ADD" ]] && read -r locale; do - echo "Enabling locale ${locale}" - enable_locale "$locale" - done <<< "$LOCALES_TO_ADD" -fi - -locale-gen diff --git a/bitnami/java/22/debian-12/tags-info.yaml b/bitnami/java/22/debian-12/tags-info.yaml deleted file mode 100644 index 2a9c3e4fb139d..0000000000000 --- a/bitnami/java/22/debian-12/tags-info.yaml +++ /dev/null @@ -1,5 +0,0 @@ -rolling-tags: -- "22" -- 22-debian-12 -- 22.0.2-11 -- latest diff --git a/bitnami/jupyter-base-notebook/4/README.md b/bitnami/jupyter-base-notebook/4/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/jupyter-base-notebook/4/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/jupyter-base-notebook/4/debian-12/Dockerfile b/bitnami/jupyter-base-notebook/4/debian-12/Dockerfile deleted file mode 100644 index b44da968cc2c1..0000000000000 --- a/bitnami/jupyter-base-notebook/4/debian-12/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T23:50:45Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/jupyter-base-notebook/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="4.1.6-debian-12-r15" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/jupyter-base-notebook" \ - org.opencontainers.image.title="jupyter-base-notebook" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="4.1.6" - -ENV HOME="/opt/bitnami/jupyterhub-singleuser/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libgcc-s1 libstdc++6 procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "miniforge-24.9.2-0-linux-${OS_ARCH}-debian-12" \ - "jupyter-base-notebook-4.1.6-14-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir /opt/bitnami/jupyterhub-singleuser/ && chmod g+rwX /opt/bitnami/jupyterhub-singleuser/ - -ENV APP_VERSION="4.1.6" \ - BITNAMI_APP_NAME="jupyter-base-notebook" \ - PATH="/opt/bitnami/miniforge/bin:/opt/bitnami/common/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "tini", "-g", "--" ] -CMD [ "jupyterhub-singleuser" ] diff --git a/bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index c76d279e881ad..0000000000000 --- a/bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "jupyter-base-notebook": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "4.1.6-14" - }, - "miniforge": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "24.9.2-0" - } -} \ No newline at end of file diff --git a/bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/jupyter-base-notebook/4/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/jupyter-base-notebook/4/debian-12/tags-info.yaml b/bitnami/jupyter-base-notebook/4/debian-12/tags-info.yaml deleted file mode 100644 index e3a6a20b79ee2..0000000000000 --- a/bitnami/jupyter-base-notebook/4/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "4" -- 4-debian-12 -- 4.1.6 diff --git a/bitnami/jupyterhub/4/README.md b/bitnami/jupyterhub/4/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/jupyterhub/4/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/jupyterhub/4/debian-12/Dockerfile b/bitnami/jupyterhub/4/debian-12/Dockerfile deleted file mode 100644 index 4a2d8264b4eb5..0000000000000 --- a/bitnami/jupyterhub/4/debian-12/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-25T13:28:26Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/jupyterhub/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="4.1.6-debian-12-r7" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/jupyterhub" \ - org.opencontainers.image.title="jupyterhub" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="4.1.6" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libgcc-s1 libstdc++6 procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "miniforge-24.9.2-0-linux-${OS_ARCH}-debian-12" \ - "jupyterhub-4.1.6-4-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -ENV APP_VERSION="4.1.6" \ - BITNAMI_APP_NAME="jupyterhub" \ - PATH="/opt/bitnami/miniforge/bin:/opt/bitnami/miniforge/bin/:$PATH" - -USER 1001 -ENTRYPOINT [ "jupyterhub" ] diff --git a/bitnami/jupyterhub/4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/jupyterhub/4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index d906f8d3b710a..0000000000000 --- a/bitnami/jupyterhub/4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "jupyterhub": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "4.1.6-4" - }, - "miniforge": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "24.9.2-0" - } -} \ No newline at end of file diff --git a/bitnami/jupyterhub/4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/jupyterhub/4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/jupyterhub/4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/jupyterhub/4/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/jupyterhub/4/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/jupyterhub/4/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/jupyterhub/4/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/jupyterhub/4/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/jupyterhub/4/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/jupyterhub/4/debian-12/tags-info.yaml b/bitnami/jupyterhub/4/debian-12/tags-info.yaml deleted file mode 100644 index b16c66cb2f00b..0000000000000 --- a/bitnami/jupyterhub/4/debian-12/tags-info.yaml +++ /dev/null @@ -1,5 +0,0 @@ -rolling-tags: -- "4" -- 4-debian-12 -- 4.1.6 -- latest diff --git a/bitnami/kafka/3.4/README.md b/bitnami/kafka/3.4/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/kafka/3.4/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/kafka/3.4/debian-12/Dockerfile b/bitnami/kafka/3.4/debian-12/Dockerfile deleted file mode 100644 index 9af904ec12924..0000000000000 --- a/bitnami/kafka/3.4/debian-12/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T21:46:28Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/kafka/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="3.4.1-debian-12-r39" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/kafka" \ - org.opencontainers.image.title="kafka" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="3.4.1" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "wait-for-port-1.0.8-8-linux-${OS_ARCH}-debian-12" \ - "render-template-1.0.7-8-linux-${OS_ARCH}-debian-12" \ - "java-17.0.13-12-1-linux-${OS_ARCH}-debian-12" \ - "kafka-3.4.1-8-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN ln -s /opt/bitnami/scripts/kafka/entrypoint.sh /entrypoint.sh -RUN ln -s /opt/bitnami/scripts/kafka/run.sh /run.sh - -COPY rootfs / -RUN /opt/bitnami/scripts/java/postunpack.sh -RUN /opt/bitnami/scripts/kafka/postunpack.sh -ENV APP_VERSION="3.4.1" \ - BITNAMI_APP_NAME="kafka" \ - JAVA_HOME="/opt/bitnami/java" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/java/bin:/opt/bitnami/kafka/bin:$PATH" - -EXPOSE 9092 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/kafka/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/kafka/run.sh" ] diff --git a/bitnami/kafka/3.4/debian-12/docker-compose-cluster.yml b/bitnami/kafka/3.4/debian-12/docker-compose-cluster.yml deleted file mode 100644 index 30333dd83eb4c..0000000000000 --- a/bitnami/kafka/3.4/debian-12/docker-compose-cluster.yml +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - kafka-0: - image: docker.io/bitnami/kafka:3.4 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=0 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_0_data:/bitnami/kafka - kafka-1: - image: docker.io/bitnami/kafka:3.4 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=1 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_1_data:/bitnami/kafka - kafka-2: - image: docker.io/bitnami/kafka:3.4 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=2 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_2_data:/bitnami/kafka - -volumes: - kafka_0_data: - driver: local - kafka_1_data: - driver: local - kafka_2_data: - driver: local diff --git a/bitnami/kafka/3.4/debian-12/docker-compose.yml b/bitnami/kafka/3.4/debian-12/docker-compose.yml deleted file mode 100644 index 103bd6b253ec2..0000000000000 --- a/bitnami/kafka/3.4/debian-12/docker-compose.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - kafka: - image: docker.io/bitnami/kafka:3.4 - ports: - - "9092:9092" - volumes: - - "kafka_data:/bitnami" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=0 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093 - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT -volumes: - kafka_data: - driver: local diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 3f89c6a2d3463..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "17.0.13-12-1" - }, - "kafka": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "3.4.1-8" - }, - "render-template": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.7-8" - }, - "wait-for-port": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.8-8" - } -} \ No newline at end of file diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/kafka/3.4/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/kafka/3.4/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/kafka/3.4/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/kafka/3.4/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 38802fc0bfe91..0000000000000 --- a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -if [[ "$OS_FLAVOUR" =~ photon && "$APP_VERSION" =~ ^1.8 ]]; then - # Option --module-path is not supported by JAVA 1.8 since modules were added in version 1.9 - unset JAVA_TOOL_OPTIONS -fi - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh b/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh deleted file mode 100644 index e1621b93e8083..0000000000000 --- a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for kafka - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-kafka}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -kafka_env_vars=( - KAFKA_MOUNTED_CONF_DIR - KAFKA_INTER_BROKER_USER - KAFKA_INTER_BROKER_PASSWORD - KAFKA_CONTROLLER_USER - KAFKA_CONTROLLER_PASSWORD - KAFKA_CERTIFICATE_PASSWORD - KAFKA_TLS_TRUSTSTORE_FILE - KAFKA_TLS_TYPE - KAFKA_TLS_CLIENT_AUTH - KAFKA_OPTS - KAFKA_CFG_SASL_ENABLED_MECHANISMS - KAFKA_KRAFT_CLUSTER_ID - KAFKA_SKIP_KRAFT_STORAGE_INIT - KAFKA_CLIENT_LISTENER_NAME - KAFKA_ZOOKEEPER_PROTOCOL - KAFKA_ZOOKEEPER_PASSWORD - KAFKA_ZOOKEEPER_USER - KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD - KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD - KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE - KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME - KAFKA_ZOOKEEPER_TLS_TYPE - KAFKA_CLIENT_USERS - KAFKA_CLIENT_PASSWORDS - KAFKA_HEAP_OPTS - JAVA_TOOL_OPTIONS -) -for env_var in "${kafka_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset kafka_env_vars - -# Paths -export KAFKA_BASE_DIR="${BITNAMI_ROOT_DIR}/kafka" -export KAFKA_VOLUME_DIR="/bitnami/kafka" -export KAFKA_DATA_DIR="${KAFKA_VOLUME_DIR}/data" -export KAFKA_CONF_DIR="${KAFKA_BASE_DIR}/config" -export KAFKA_CONF_FILE="${KAFKA_CONF_DIR}/server.properties" -export KAFKA_MOUNTED_CONF_DIR="${KAFKA_MOUNTED_CONF_DIR:-${KAFKA_VOLUME_DIR}/config}" -export KAFKA_CERTS_DIR="${KAFKA_CONF_DIR}/certs" -export KAFKA_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d" -export KAFKA_LOG_DIR="${KAFKA_BASE_DIR}/logs" -export KAFKA_HOME="$KAFKA_BASE_DIR" -export PATH="${KAFKA_BASE_DIR}/bin:${BITNAMI_ROOT_DIR}/java/bin:${PATH}" - -# System users (when running with a privileged user) -export KAFKA_DAEMON_USER="kafka" -export KAFKA_DAEMON_GROUP="kafka" - -# Kafka runtime settings -export KAFKA_INTER_BROKER_USER="${KAFKA_INTER_BROKER_USER:-user}" -export KAFKA_INTER_BROKER_PASSWORD="${KAFKA_INTER_BROKER_PASSWORD:-bitnami}" -export KAFKA_CONTROLLER_USER="${KAFKA_CONTROLLER_USER:-controller_user}" -export KAFKA_CONTROLLER_PASSWORD="${KAFKA_CONTROLLER_PASSWORD:-bitnami}" -export KAFKA_CERTIFICATE_PASSWORD="${KAFKA_CERTIFICATE_PASSWORD:-}" -export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_TLS_TRUSTSTORE_FILE:-}" -export KAFKA_TLS_TYPE="${KAFKA_TLS_TYPE:-JKS}" -export KAFKA_TLS_CLIENT_AUTH="${KAFKA_TLS_CLIENT_AUTH:-required}" -export KAFKA_OPTS="${KAFKA_OPTS:-}" - -# Kafka configuration overrides -export KAFKA_CFG_SASL_ENABLED_MECHANISMS="${KAFKA_CFG_SASL_ENABLED_MECHANISMS:-PLAIN,SCRAM-SHA-256,SCRAM-SHA-512}" -export KAFKA_KRAFT_CLUSTER_ID="${KAFKA_KRAFT_CLUSTER_ID:-}" -export KAFKA_SKIP_KRAFT_STORAGE_INIT="${KAFKA_SKIP_KRAFT_STORAGE_INIT:-false}" -export KAFKA_CLIENT_LISTENER_NAME="${KAFKA_CLIENT_LISTENER_NAME:-}" - -# ZooKeeper connection settings -export KAFKA_ZOOKEEPER_PROTOCOL="${KAFKA_ZOOKEEPER_PROTOCOL:-PLAINTEXT}" -export KAFKA_ZOOKEEPER_PASSWORD="${KAFKA_ZOOKEEPER_PASSWORD:-}" -export KAFKA_ZOOKEEPER_USER="${KAFKA_ZOOKEEPER_USER:-}" -export KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD="${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD:-}" -export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD="${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD:-}" -export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE:-}" -export KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME="${KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME:-true}" -export KAFKA_ZOOKEEPER_TLS_TYPE="${KAFKA_ZOOKEEPER_TLS_TYPE:-JKS}" - -# Authentication -export KAFKA_CLIENT_USERS="${KAFKA_CLIENT_USERS:-user}" -export KAFKA_CLIENT_PASSWORDS="${KAFKA_CLIENT_PASSWORDS:-bitnami}" - -# Java settings -export KAFKA_HEAP_OPTS="${KAFKA_HEAP_OPTS:--Xmx1024m -Xms1024m}" - -# Java settings -export JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS:-}" - -# Custom environment variables may be defined below diff --git a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh b/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh deleted file mode 100755 index d7413bcfc4f33..0000000000000 --- a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libkafka.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -print_welcome_page - -if [[ "$*" = *"/opt/bitnami/scripts/kafka/run.sh"* || "$*" = *"/run.sh"* ]]; then - info "** Starting Kafka setup **" - /opt/bitnami/scripts/kafka/setup.sh - info "** Kafka setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh b/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh deleted file mode 100755 index 7255563236c0b..0000000000000 --- a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libkafka.sh -. /opt/bitnami/scripts/libfs.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -# Move server.properties from configtmp to config -# Temporary solution until kafka tarball places server.properties into config -if [[ -d "${KAFKA_BASE_DIR}/configtmp" ]]; then - mv "${KAFKA_BASE_DIR}/configtmp"/* "$KAFKA_CONF_DIR" - rmdir "${KAFKA_BASE_DIR}/configtmp" -fi -[[ -d "${KAFKA_BASE_DIR}/conf" ]] && rmdir "${KAFKA_BASE_DIR}/conf" - -# Ensure directories used by Kafka exist and have proper ownership and permissions -for dir in "$KAFKA_LOG_DIR" "$KAFKA_CONF_DIR" "$KAFKA_MOUNTED_CONF_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR" "$KAFKA_INITSCRIPTS_DIR"; do - ensure_dir_exists "$dir" -done -chmod -R g+rwX "$KAFKA_BASE_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR" "$KAFKA_INITSCRIPTS_DIR" - -# Move the original server.properties, so users can skip initialization logic by mounting their own server.properties directly instead of using the MOUNTED_CONF_DIR -mv "${KAFKA_CONF_DIR}/server.properties" "${KAFKA_CONF_DIR}/server.properties.original" - -# Disable logging to stdout and garbage collection -# Source: https://logging.apache.org/log4j/log4j-2.4/manual/appenders.html -replace_in_file "${KAFKA_BASE_DIR}/bin/kafka-server-start.sh" " [-]loggc" " " -replace_in_file "${KAFKA_CONF_DIR}/log4j.properties" "DailyRollingFileAppender" "ConsoleAppender" - -# Disable the default console logger in favour of KafkaAppender (which provides the exact output) -echo "log4j.appender.stdout.Threshold=OFF" >>"${KAFKA_CONF_DIR}/log4j.properties" - -# Remove invalid parameters for ConsoleAppender -remove_in_file "${KAFKA_CONF_DIR}/log4j.properties" "DatePattern" -remove_in_file "${KAFKA_CONF_DIR}/log4j.properties" "Appender.File" diff --git a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh b/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh deleted file mode 100755 index 76d4380aff57e..0000000000000 --- a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libkafka.sh -. /opt/bitnami/scripts/libos.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -if [[ -f "${KAFKA_CONF_DIR}/kafka_jaas.conf" ]]; then - export KAFKA_OPTS="${KAFKA_OPTS:-} -Djava.security.auth.login.config=${KAFKA_CONF_DIR}/kafka_jaas.conf" -fi - -cmd="$KAFKA_HOME/bin/kafka-server-start.sh" -args=("$KAFKA_CONF_FILE") -! is_empty_value "${KAFKA_EXTRA_FLAGS:-}" && args=("${args[@]}" "${KAFKA_EXTRA_FLAGS[@]}") - -info "** Starting Kafka **" -if am_i_root; then - exec_as_user "$KAFKA_DAEMON_USER" "$cmd" "${args[@]}" "$@" -else - exec "$cmd" "${args[@]}" "$@" -fi diff --git a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh b/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh deleted file mode 100755 index 5195f71910176..0000000000000 --- a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libkafka.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -# Map Kafka environment variables -kafka_create_alias_environment_variables - -# Dinamically set node.id/broker.id/controller.quorum.voters if the _COMMAND environment variable is set -kafka_dynamic_environment_variables - -# Set the default tuststore locations before validation -kafka_configure_default_truststore_locations -# Ensure Kafka user and group exist when running as 'root' -am_i_root && ensure_user_exists "$KAFKA_DAEMON_USER" --group "$KAFKA_DAEMON_GROUP" -# Ensure directories used by Kafka exist and have proper ownership and permissions -for dir in "$KAFKA_LOG_DIR" "$KAFKA_CONF_DIR" "$KAFKA_MOUNTED_CONF_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR"; do - if am_i_root; then - ensure_dir_exists "$dir" "$KAFKA_DAEMON_USER" "$KAFKA_DAEMON_GROUP" - else - ensure_dir_exists "$dir" - fi -done - -# Kafka validation, skipped if server.properties was mounted at either $KAFKA_MOUNTED_CONF_DIR or $KAFKA_CONF_DIR -[[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/server.properties" && ! -f "$KAFKA_CONF_FILE" ]] && kafka_validate -# Kafka initialization, skipped if server.properties was mounted at $KAFKA_CONF_DIR -[[ ! -f "$KAFKA_CONF_FILE" ]] && kafka_initialize - -# Initialise KRaft metadata storage if process.roles configured -if grep -q "^process.roles=" "$KAFKA_CONF_FILE" && ! is_boolean_yes "$KAFKA_SKIP_KRAFT_STORAGE_INIT" ; then - kafka_kraft_storage_initialize -fi -# Configure Zookeeper SCRAM users -if is_boolean_yes "${KAFKA_ZOOKEEPER_BOOTSTRAP_SCRAM_USERS:-}"; then - kafka_zookeeper_create_sasl_scram_users -fi -# KRaft controllers may get stuck starting when the controller quorum voters are changed. -# Workaround: Remove quorum-state file when scaling up/down controllers (Waiting proposal KIP-853) -# https://cwiki.apache.org/confluence/display/KAFKA/KIP-853%3A+KRaft+Voter+Changes -if [[ -f "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" ]] && grep -q "^controller.quorum.voters=" "$KAFKA_CONF_FILE" && kafka_kraft_quorum_voters_changed; then - warn "Detected inconsitences between controller.quorum.voters and quorum-state, removing it..." - rm -f "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" -fi -# Ensure custom initialization scripts are executed -kafka_custom_init_scripts diff --git a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh b/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh deleted file mode 100644 index df2459b035778..0000000000000 --- a/bitnami/kafka/3.4/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh +++ /dev/null @@ -1,1176 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Kafka library - -# shellcheck disable=SC1090,SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libservice.sh - -# Functions - -######################## -# Set a configuration setting value to a file -# Globals: -# None -# Arguments: -# $1 - file -# $2 - key -# $3 - values (array) -# Returns: -# None -######################### -kafka_common_conf_set() { - local file="${1:?missing file}" - local key="${2:?missing key}" - shift - shift - local values=("$@") - - if [[ "${#values[@]}" -eq 0 ]]; then - stderr_print "missing value" - return 1 - elif [[ "${#values[@]}" -ne 1 ]]; then - for i in "${!values[@]}"; do - kafka_common_conf_set "$file" "${key[$i]}" "${values[$i]}" - done - else - value="${values[0]}" - # Check if the value was set before - if grep -q "^[#\\s]*$key\s*=.*" "$file"; then - # Update the existing key - replace_in_file "$file" "^[#\\s]*${key}\s*=.*" "${key}=${value}" false - else - # Add a new key - printf '\n%s=%s' "$key" "$value" >>"$file" - fi - fi -} - -######################## -# Returns true if at least one listener is configured using SSL -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_ssl_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENERS:-}"; then - if is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - if [[ "$KAFKA_CFG_LISTENERS" =~ SSL: || "$KAFKA_CFG_LISTENERS" =~ SASL_SSL: ]]; then - return - fi - else - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "SSL" || "$protocol" = "SASL_SSL" ]]; then - if [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - fi - fi - return 1 -} - -######################## -# Returns true if at least one listener is configured using SASL -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_sasl_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENERS:-}"; then - if is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - if [[ "$KAFKA_CFG_LISTENERS" =~ SASL_PLAINTEXT: ]] || [[ "$KAFKA_CFG_LISTENERS" =~ SASL_SSL: ]]; then - return - fi - else - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "SASL_PLAINTEXT" || "$protocol" = "SASL_SSL" ]]; then - if [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - fi - fi - return 1 -} - -######################## -# Returns true if at least one listener is configured using plaintext -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_plaintext_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "PLAINTEXT" ]]; then - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - else - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ "$KAFKA_CFG_LISTENERS" =~ PLAINTEXT: ]]; then - return - fi - fi - return 1 -} - -######################## -# Backwards compatibility measure to configure the TLS truststore locations -# Globals: -# KAFKA_CONF_FILE -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_default_truststore_locations() { - # Backwards compatibility measure to allow custom truststore locations but at the same time not disrupt - # the UX that the previous version of the containers and the helm chart have. - # Context: The chart and containers by default assumed that the truststore location was KAFKA_CERTS_DIR/kafka.truststore.jks or KAFKA_MOUNTED_CONF_DIR/certs/kafka.truststore.jks. - # Because of this, we could not use custom certificates in different locations (use case: A custom base image that already has a truststore). Changing the logic to allow custom - # locations implied major changes in the current user experience (which only required to mount certificates at the assumed location). In order to maintain this compatibility we need - # use this logic that sets the KAFKA_TLS_*_FILE variables to the previously assumed locations in case it is not set - - # Kafka truststore - if kafka_has_ssl_listener && is_empty_value "${KAFKA_TLS_TRUSTSTORE_FILE:-}"; then - local kafka_truststore_filename="kafka.truststore.jks" - [[ "$KAFKA_TLS_TYPE" = "PEM" ]] && kafka_truststore_filename="kafka.truststore.pem" - if [[ -f "${KAFKA_CERTS_DIR}/${kafka_truststore_filename}" ]]; then - # Mounted in /opt/bitnami/kafka/conf/certs - export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_CERTS_DIR}/${kafka_truststore_filename}" - else - # Mounted in /bitnami/kafka/conf/certs - export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_MOUNTED_CONF_DIR}/certs/${kafka_truststore_filename}" - fi - fi - # Zookeeper truststore - if [[ "${KAFKA_ZOOKEEPER_PROTOCOL:-}" =~ SSL ]] && is_empty_value "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE:-}"; then - local zk_truststore_filename="zookeeper.truststore.jks" - [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]] && zk_truststore_filename="zookeeper.truststore.pem" - if [[ -f "${KAFKA_CERTS_DIR}/${zk_truststore_filename}" ]]; then - # Mounted in /opt/bitnami/kafka/conf/certs - export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_CERTS_DIR}/${zk_truststore_filename}" - else - # Mounted in /bitnami/kafka/conf/certs - export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_MOUNTED_CONF_DIR}/certs/${zk_truststore_filename}" - fi - fi -} - -######################## -# Set a configuration setting value to server.properties -# Globals: -# KAFKA_CONF_FILE -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -kafka_server_conf_set() { - kafka_common_conf_set "$KAFKA_CONF_FILE" "$@" -} - -######################## -# Set a configuration setting value to producer.properties and consumer.properties -# Globals: -# KAFKA_CONF_DIR -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -kafka_producer_consumer_conf_set() { - kafka_common_conf_set "$KAFKA_CONF_DIR/producer.properties" "$@" - kafka_common_conf_set "$KAFKA_CONF_DIR/consumer.properties" "$@" -} - -######################## -# Create alias for environment variable, so both can be used -# Globals: -# None -# Arguments: -# $1 - Alias environment variable name -# $2 - Original environment variable name -# Returns: -# None -######################### -kafka_declare_alias_env() { - local -r alias="${1:?missing environment variable alias}" - local -r original="${2:?missing original environment variable}" - if printenv "${original}" >/dev/null; then - export "$alias"="${!original:-}" - fi -} - -######################## -# Map Kafka legacy environment variables to the new names -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_create_alias_environment_variables() { - suffixes=( - "ADVERTISED_LISTENERS" - "BROKER_ID" - "NODE_ID" - "CONTROLLER_QUORUM_VOTERS" - "PROCESS_ROLES" - "DEFAULT_REPLICATION_FACTOR" - "DELETE_TOPIC_ENABLE" - "INTER_BROKER_LISTENER_NAME" - "LISTENERS" - "LISTENER_SECURITY_PROTOCOL_MAP" - "LOG_DIRS" - "LOG_FLUSH_INTERVAL_MESSAGES" - "LOG_FLUSH_INTERVAL_MS" - "LOG_MESSAGE_FORMAT_VERSION" - "LOG_RETENTION_BYTES" - "LOG_RETENTION_CHECK_INTERVALS_MS" - "LOG_RETENTION_HOURS" - "LOG_SEGMENT_BYTES" - "MESSAGE_MAX_BYTES" - "NUM_IO_THREADS" - "NUM_NETWORK_THREADS" - "NUM_PARTITIONS" - "NUM_RECOVERY_THREADS_PER_DATA_DIR" - "OFFSETS_TOPIC_REPLICATION_FACTOR" - "SOCKET_RECEIVE_BUFFER_BYTES" - "SOCKET_REQUEST_MAX_BYTES" - "SOCKET_SEND_BUFFER_BYTES" - "SSL_ENDPOINT_IDENTIFICATION_ALGORITHM" - "TRANSACTION_STATE_LOG_MIN_ISR" - "TRANSACTION_STATE_LOG_REPLICATION_FACTOR" - "ZOOKEEPER_CONNECT" - "ZOOKEEPER_CONNECTION_TIMEOUT_MS" - ) - kafka_declare_alias_env "KAFKA_CFG_LOG_DIRS" "KAFKA_LOGS_DIRS" - kafka_declare_alias_env "KAFKA_CFG_LOG_SEGMENT_BYTES" "KAFKA_SEGMENT_BYTES" - kafka_declare_alias_env "KAFKA_CFG_MESSAGE_MAX_BYTES" "KAFKA_MAX_MESSAGE_BYTES" - kafka_declare_alias_env "KAFKA_CFG_ZOOKEEPER_CONNECTION_TIMEOUT_MS" "KAFKA_ZOOKEEPER_CONNECT_TIMEOUT_MS" - kafka_declare_alias_env "KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE" "KAFKA_AUTO_CREATE_TOPICS_ENABLE" - kafka_declare_alias_env "KAFKA_CLIENT_USERS" "KAFKA_BROKER_USER" - kafka_declare_alias_env "KAFKA_CLIENT_PASSWORDS" "KAFKA_BROKER_PASSWORD" - kafka_declare_alias_env "KAFKA_CLIENT_LISTENER_NAME" "KAFKA_CLIENT_LISTENER" - for s in "${suffixes[@]}"; do - kafka_declare_alias_env "KAFKA_CFG_${s}" "KAFKA_${s}" - done -} - -######################## -# Validate settings in KAFKA_* env vars -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_validate() { - debug "Validating settings in KAFKA_* env vars..." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_multi_value() { - if [[ " ${2} " != *" ${!1} "* ]]; then - print_validation_error "The allowed values for ${1} are: ${2}" - fi - } - # If process.roles configured, check its values are valid and perform additional checks for each - check_kraft_process_roles() { - read -r -a roles_list <<<"$(tr ',;' ' ' <<<"$KAFKA_CFG_PROCESS_ROLES")" - for role in "${roles_list[@]}"; do - case "$role" in - broker) ;; - controller) - if is_empty_value "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-}"; then - print_validation_error "Role 'controller' enabled but environment variable KAFKA_CFG_CONTROLLER_LISTENER_NAMES was not provided." - fi - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ ! "$KAFKA_CFG_LISTENERS" =~ ${KAFKA_CFG_CONTROLLER_LISTENER_NAMES} ]]; then - print_validation_error "Role 'controller' enabled but listener ${KAFKA_CFG_CONTROLLER_LISTENER_NAMES} not found in KAFKA_CFG_LISTENERS." - fi - ;; - *) - print_validation_error "Invalid KRaft process role '$role'. Supported roles are 'broker,controller'" - ;; - esac - done - } - # Check all listeners are using a unique and valid port - check_listener_ports(){ - check_allowed_port() { - local port="${1:?missing port variable}" - local -a validate_port_args=() - ! am_i_root && validate_port_args+=("-unprivileged") - validate_port_args+=("$port") - if ! err=$(validate_port "${validate_port_args[@]}"); then - print_validation_error "An invalid port ${port} was specified in the environment variable KAFKA_CFG_LISTENERS: ${err}." - fi - } - - read -r -a listeners <<<"$(tr ',' ' ' <<<"${KAFKA_CFG_LISTENERS:-}")" - local -a ports=() - for listener in "${listeners[@]}"; do - read -r -a arr <<<"$(tr ':' ' ' <<<"$listener")" - # Obtain the port from listener string, e.g. PLAINTEXT://:9092 - port="${arr[2]}" - check_allowed_port "$port" - ports+=("$port") - done - # Check each listener is using an unique port - local -a unique_ports=() - read -r -a unique_ports <<< "$(echo "${ports[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')" - if [[ "${#ports[@]}" != "${#unique_ports[@]}" ]]; then - print_validation_error "There are listeners bound to the same port" - fi - } - check_listener_protocols(){ - local -r allowed_protocols=("PLAINTEXT" "SASL_PLAINTEXT" "SASL_SSL" "SSL") - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - # Check protocol in allowed list - if [[ ! "${allowed_protocols[*]}" =~ $protocol ]]; then - print_validation_error "Authentication protocol ${protocol} is not supported!" - fi - # If inter-broker listener configured with SASL, ensure KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL is set - if [[ "$listener" = "${KAFKA_CFG_INTER_BROKER_LISTENER_NAME:-INTERNAL}" ]]; then - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL:-}"; then - print_validation_error "When using SASL for inter broker comunication the mechanism should be provided using KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL" - fi - if is_empty_value "${KAFKA_INTER_BROKER_USER:-}" || is_empty_value "${KAFKA_INTER_BROKER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka inter-broker communications, you must provide the SASL credentials. Set the environment variables KAFKA_INTER_BROKER_USER and KAFKA_INTER_BROKER_PASSWORD to configure the credentials for SASL authentication with between brokers." - fi - fi - # If controller listener configured with SASL, ensure KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL is set - elif [[ "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-CONTROLLER}" =~ $listener ]]; then - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL:-}"; then - print_validation_error "When using SASL for controller comunication the mechanism should be provided at KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - elif [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" =~ SCRAM ]]; then - warn "KRaft controller listener may not support SCRAM-SHA-256/SCRAM-SHA-512 mechanisms. If facing any issues, we recommend switching to PLAIN mechanism. More information at: https://issues.apache.org/jira/browse/KAFKA-15513" - fi - if is_empty_value "${KAFKA_CONTROLLER_USER:-}" || is_empty_value "${KAFKA_CONTROLLER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka control plane communications, you must provide the SASL credentials. Set the environment variables KAFKA_CONTROLLER_USER and KAFKA_CONTROLLER_PASSWORD to configure the credentials for SASL authentication with between controllers." - fi - fi - else - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CLIENT_USERS:-}" || is_empty_value "${KAFKA_CLIENT_PASSWORDS:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka, you must provide the SASL credentials. Set the environment variables KAFKA_CLIENT_USERS and KAFKA_CLIENT_PASSWORDS to configure the credentials for SASL authentication with clients." - fi - fi - - fi - done - } - - if is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}" && is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - print_validation_error "Kafka haven't been configured to work in either Raft or Zookeper mode. Please make sure at least one of the modes is configured." - fi - # Check KRaft mode - if ! is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}"; then - # Only allow Zookeeper configuration if migration mode is enabled - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}" && - { is_empty_value "${KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE:-}" || ! is_boolean_yes "$KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE"; }; then - print_validation_error "Both KRaft mode and Zookeeper modes are configured, but KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE is not enabled" - fi - if is_empty_value "${KAFKA_CFG_NODE_ID:-}"; then - print_validation_error "KRaft mode requires an unique node.id, please set the environment variable KAFKA_CFG_NODE_ID" - fi - if is_empty_value "${KAFKA_CFG_CONTROLLER_QUORUM_VOTERS:-}"; then - print_validation_error "KRaft mode requires KAFKA_CFG_CONTROLLER_QUORUM_VOTERS to be set" - fi - check_kraft_process_roles - fi - # Check Zookeeper mode - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - # If SSL/SASL_SSL protocol configured, check certificates are provided - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SSL ]]; then - if [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "JKS" ]]; then - # Fail if truststore is not provided - if [[ ! -f "$KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE" ]]; then - print_validation_error "In order to configure the TLS encryption for Zookeeper with JKS certs you must mount your zookeeper.truststore.jks cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - # Warn if keystore is not provided, only required if Zookeper mTLS is enabled (ZOO_TLS_CLIENT_AUTH) - if [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" ]] && [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.jks" ]]; then - warn "In order to configure the mTLS for Zookeeper with JKS certs you must mount your zookeeper.keystore.jks cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - elif [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]]; then - # Fail if CA / validation cert is not provided - if [[ ! -f "$KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE" ]]; then - print_validation_error "In order to configure the TLS encryption for Zookeeper with PEM certs you must mount your zookeeper.truststore.pem cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - # Warn if node key or cert are not provided, only required if Zookeper mTLS is enabled (ZOO_TLS_CLIENT_AUTH) - if { [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" ]] || [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.pem" ]] || [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.key" ]]; }; then - warn "In order to configure the mTLS for Zookeeper with PEM certs you must mount your zookeeper.keystore.pem cert and zookeeper.keystore.key key to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - fi - fi - # If SASL/SASL_SSL protocol configured, check certificates are provided - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SASL ]]; then - if is_empty_value "${KAFKA_ZOOKEEPER_USER:-}" || is_empty_value "${KAFKA_ZOOKEEPER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka, you must provide the SASL credentials. Set the environment variables KAFKA_ZOOKEEPER_USER and KAFKA_ZOOKEEPER_PASSWORD, to configure the credentials for SASL authentication with Zookeeper." - fi - fi - # If using plaintext protocol, check it is explicitly allowed - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" = "PLAINTEXT" ]]; then - warn "The KAFKA_ZOOKEEPER_PROTOCOL environment variable does not configure SASL and/or SSL, this setting is not recommended for production environments." - fi - fi - # Check listener ports are unique and allowed - check_listener_ports - # Check listeners are mapped to a valid security protocol - check_listener_protocols - # Warn users if plaintext listeners are configured - if kafka_has_plaintext_listener; then - warn "Kafka has been configured with a PLAINTEXT listener, this setting is not recommended for production environments." - fi - # If SSL/SASL_SSL listeners configured, check certificates are provided - if kafka_has_ssl_listener; then - if [[ "$KAFKA_TLS_TYPE" = "JKS" ]] && - { [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.jks" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.jks" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; }; then - print_validation_error "In order to configure the TLS encryption for Kafka with JKS certs you must mount your kafka.keystore.jks and kafka.truststore.jks certs to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - elif [[ "$KAFKA_TLS_TYPE" = "PEM" ]] && - { [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.pem" ]] || [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.key" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.pem" ]] || [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.key" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; }; then - print_validation_error "In order to configure the TLS encryption for Kafka with PEM certs you must mount your kafka.keystore.pem, kafka.keystore.key and kafka.truststore.pem certs to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - fi - # If SASL/SASL_SSL listeners configured, check passwords are provided - if kafka_has_sasl_listener; then - if is_empty_value "${KAFKA_CFG_SASL_ENABLED_MECHANISMS:-}"; then - print_validation_error "Specified SASL protocol but no SASL mechanisms provided in KAFKA_CFG_SASL_ENABLED_MECHANISMS" - fi - fi - # Check users and passwords lists are the same size - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS:-}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS:-}")" - if [[ "${#users[@]}" -ne "${#passwords[@]}" ]]; then - print_validation_error "Specify the same number of passwords on KAFKA_CLIENT_PASSWORDS as the number of users on KAFKA_CLIENT_USERS!" - fi - check_multi_value "KAFKA_TLS_TYPE" "JKS PEM" - check_multi_value "KAFKA_ZOOKEEPER_TLS_TYPE" "JKS PEM" - check_multi_value "KAFKA_ZOOKEEPER_PROTOCOL" "PLAINTEXT SASL SSL SASL_SSL" - check_multi_value "KAFKA_TLS_CLIENT_AUTH" "none requested required" - [[ "$error_code" -eq 0 ]] || return "$error_code" -} - -######################## -# Get kafka version -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# version -######################### -kafka_get_version() { - local -a cmd=("kafka-topics.sh" "--version") - am_i_root && cmd=("run_as_user" "$KAFKA_DAEMON_USER" "${cmd[@]}") - - read -r -a ver_split <<< "$("${cmd[@]}")" - echo "${ver_split[0]}" -} - -######################### -# Configure JAAS for a given listener and SASL mechanisms -# Globals: -# KAFKA_* -# Arguments: -# $1 - Name of the listener JAAS will be configured for -# $2 - Comma-separated list of SASL mechanisms to configure -# $3 - Comma-separated list of usernames -# $4 - Comma-separated list of passwords -# Returns: -# None -######################### -kafka_configure_server_jaas() { - local listener="${1:?missing listener name}" - local role="${2:-}" - - if [[ "$role" = "controller" ]]; then - local jaas_content=() - if [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" = "PLAIN" ]]; then - jaas_content=( - "org.apache.kafka.common.security.plain.PlainLoginModule required" - "username=\"${KAFKA_CONTROLLER_USER}\"" - "password=\"${KAFKA_CONTROLLER_PASSWORD}\"" - "user_${KAFKA_CONTROLLER_USER}=\"${KAFKA_CONTROLLER_PASSWORD}\";" - ) - elif [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" =~ SCRAM ]]; then - jaas_content=( - "org.apache.kafka.common.security.scram.ScramLoginModule required" - "username=\"${KAFKA_CONTROLLER_USER}\"" - "password=\"${KAFKA_CONTROLLER_PASSWORD}\";" - ) - fi - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - sasl_mechanism_lower="$(echo "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" | tr '[:upper:]' '[:lower:]')" - kafka_server_conf_set "listener.name.${listener_lower}.${sasl_mechanism_lower}.sasl.jaas.config" "${jaas_content[*]}" - else - read -r -a sasl_mechanisms_arr <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_SASL_ENABLED_MECHANISMS")" - read -r -a users <<<"$(tr ',;' ' ' <<<"$KAFKA_CLIENT_USERS")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"$KAFKA_CLIENT_PASSWORDS")" - # Configure JAAS for each SASL mechanism - # ref: https://docs.confluent.io/platform/current/kafka/authentication_sasl/index.html - for sasl_mechanism in "${sasl_mechanisms_arr[@]}"; do - local jaas_content=() - # For PLAIN mechanism, only the first username will be used - if [[ "$sasl_mechanism" = "PLAIN" ]]; then - jaas_content=("org.apache.kafka.common.security.plain.PlainLoginModule required") - if [[ "$role" = "inter-broker" ]]; then - jaas_content+=( - "username=\"${KAFKA_INTER_BROKER_USER}\"" - "password=\"${KAFKA_INTER_BROKER_PASSWORD}\"" - ) - users+=("$KAFKA_INTER_BROKER_USER") - passwords+=("$KAFKA_INTER_BROKER_PASSWORD") - fi - for ((i = 0; i < ${#users[@]}; i++)); do - jaas_content+=("user_${users[i]}=\"${passwords[i]}\"") - done - # Add semi-colon to the last element of the array - jaas_content[${#jaas_content[@]} - 1]="${jaas_content[${#jaas_content[@]} - 1]};" - elif [[ "$sasl_mechanism" =~ SCRAM ]]; then - if [[ "$role" = "inter-broker" ]]; then - jaas_content=( - "org.apache.kafka.common.security.scram.ScramLoginModule required" - "username=\"${KAFKA_INTER_BROKER_USER}\"" - "password=\"${KAFKA_INTER_BROKER_PASSWORD}\";" - ) - else - jaas_content=("org.apache.kafka.common.security.scram.ScramLoginModule required;") - fi - fi - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - sasl_mechanism_lower="$(echo "$sasl_mechanism" | tr '[:upper:]' '[:lower:]')" - kafka_server_conf_set "listener.name.${listener_lower}.${sasl_mechanism_lower}.sasl.jaas.config" "${jaas_content[*]}" - done - fi -} - -######################## -# Configure Zookeeper JAAS authentication -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_zookeeper_configure_jaas(){ - local jaas_content=( - "org.apache.kafka.common.security.plain.PlainLoginModule required" - "username=\"${KAFKA_ZOOKEEPER_USER}\"" - "password=\"${KAFKA_ZOOKEEPER_PASSWORD}\";" - ) - - kafka_server_conf_set "sasl.jaas.config" "${jaas_content[*]}" -} - -######################## -# Generate JAAS authentication file for local producer/consumer to use -# Globals: -# KAFKA_* -# Arguments: -# $1 - Authentication protocol to use for the internal listener -# $2 - Authentication protocol to use for the client listener -# Returns: -# None -######################### -kafka_configure_consumer_producer_jaas(){ - local jaas_content=() - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - - if [[ "${KAFKA_CFG_SASL_ENABLED_MECHANISMS}" =~ SCRAM ]]; then - jaas_content=("org.apache.kafka.common.security.scram.ScramLoginModule required") - elif [[ "${KAFKA_CFG_SASL_ENABLED_MECHANISMS}" =~ PLAIN ]]; then - jaas_content=("org.apache.kafka.common.security.plain.PlainLoginModule required") - else - error "Couldn't configure a supported SASL mechanism for Kafka consumer/producer properties" - exit 1 - fi - - jaas_content+=( - "username=\"${users[0]}\"" - "password=\"${passwords[0]}\";" - ) - - kafka_producer_consumer_conf_set "sasl.jaas.config" "${jaas_content[*]}" -} - -######################## -# Create users in zookeper when using SASL/SCRAM mechanism -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_zookeeper_create_sasl_scram_users() { - info "Creating users in Zookeeper" - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - local zookeeper_connect - zookeeper_connect=$(grep "^zookeeper.connect=" "$KAFKA_CONF_FILE" | sed -E 's/^zookeeper\.connect=(\S+)$/\1/') - read -r -a zookeeper_hosts <<<"$(tr ',;' ' ' <<<"${zookeeper_connect}")" - - if [[ "${#zookeeper_hosts[@]}" -eq 0 ]]; then - error "Couldn't obtain zookeeper.connect from $KAFKA_CONF_FILE" - exit 1 - fi - # Wait for Zookeeper to be reachable - read -r -a aux <<<"$(tr ':' ' ' <<<"${zookeeper_hosts[0]}")" - local host="${aux[0]:?missing host}" - local port="${aux[1]:-2181}" - wait-for-port --host "$host" "$port" - - # Add interbroker credentials - if grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM" "$KAFKA_CONF_FILE"; then - users+=("${KAFKA_INTER_BROKER_USER}") - passwords+=("${KAFKA_INTER_BROKER_PASSWORD}") - fi - for ((i = 0; i < ${#users[@]}; i++)); do - debug "Creating user ${users[i]} in zookeeper" - # Ref: https://docs.confluent.io/current/kafka/authentication_sasl/authentication_sasl_scram.html#sasl-scram-overview - debug_execute kafka-configs.sh --zookeeper "$zookeeper_connect" --alter --add-config "SCRAM-SHA-256=[iterations=8192,password=${passwords[i]}],SCRAM-SHA-512=[password=${passwords[i]}]" --entity-type users --entity-name "${users[i]}" - done -} - -######################## -# Configure Kafka SSL settings -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_ssl() { - # Configures both Kafka server and producers/consumers - configure_both() { - kafka_server_conf_set "${1:?missing key}" "${2:?missing value}" - kafka_producer_consumer_conf_set "${1:?missing key}" "${2:?missing value}" - } - kafka_server_conf_set "ssl.client.auth" "${KAFKA_TLS_CLIENT_AUTH}" - configure_both ssl.keystore.type "${KAFKA_TLS_TYPE}" - configure_both ssl.truststore.type "${KAFKA_TLS_TYPE}" - local -r kafka_truststore_location="${KAFKA_CERTS_DIR}/$(basename "${KAFKA_TLS_TRUSTSTORE_FILE}")" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.key.password "$KAFKA_CERTIFICATE_PASSWORD" - if [[ "$KAFKA_TLS_TYPE" = "PEM" ]]; then - file_to_multiline_property() { - awk 'NR > 1{print line"\\n\\"}{line=$0;}END{print $0" "}' <"${1:?missing file}" - } - remove_previous_cert_value() { - local key="${1:?missing key}" - files=( - "${KAFKA_CONF_FILE}" - "${KAFKA_CONF_DIR}/producer.properties" - "${KAFKA_CONF_DIR}/consumer.properties" - ) - for file in "${files[@]}"; do - if grep -q "^[#\\s]*$key\s*=.*" "$file"; then - # Delete all lines from the certificate beginning to its end - sed -i "/^[#\\s]*$key\s*=.*-----BEGIN/,/-----END/d" "$file" - fi - done - } - # We need to remove the previous cert value - # kafka_common_conf_set uses replace_in_file, which can't match multiple lines - remove_previous_cert_value ssl.keystore.key - remove_previous_cert_value ssl.keystore.certificate.chain - remove_previous_cert_value ssl.truststore.certificates - configure_both ssl.keystore.key "$(file_to_multiline_property "${KAFKA_CERTS_DIR}/kafka.keystore.key")" - configure_both ssl.keystore.certificate.chain "$(file_to_multiline_property "${KAFKA_CERTS_DIR}/kafka.keystore.pem")" - configure_both ssl.truststore.certificates "$(file_to_multiline_property "${kafka_truststore_location}")" - elif [[ "$KAFKA_TLS_TYPE" = "JKS" ]]; then - configure_both ssl.keystore.location "$KAFKA_CERTS_DIR"/kafka.keystore.jks - configure_both ssl.truststore.location "$kafka_truststore_location" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.keystore.password "$KAFKA_CERTIFICATE_PASSWORD" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.truststore.password "$KAFKA_CERTIFICATE_PASSWORD" - fi - true # Avoid the function to fail due to the check above -} - -######################## -# Get Zookeeper TLS settings -# Globals: -# KAFKA_ZOOKEEPER_TLS_* -# Arguments: -# None -# Returns: -# String -######################### -kafka_zookeeper_configure_tls() { - # Note that ZooKeeper does not support a key password different from the keystore password, - # so be sure to set the key password in the keystore to be identical to the keystore password; - # otherwise the connection attempt to Zookeeper will fail. - local keystore_location="" - local -r kafka_zk_truststore_location="${KAFKA_CERTS_DIR}/$(basename "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE}")" - - if [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "JKS" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" ]]; then - keystore_location="${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" - elif [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" ]]; then - # Concatenating private key into public certificate file - # This is needed to load keystore from location using PEM - keystore_location="${KAFKA_CERTS_DIR}/zookeeper.keypair.pem" - cat "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" > "$keystore_location" - fi - - kafka_server_conf_set "zookeeper.clientCnxnSocket" "org.apache.zookeeper.ClientCnxnSocketNetty" - kafka_server_conf_set "zookeeper.ssl.client.enable" "true" - is_boolean_yes "${KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME:-}" && kafka_server_conf_set "zookeeper.ssl.endpoint.identification.algorithm" "HTTPS" - ! is_empty_value "${keystore_location:-}" && kafka_server_conf_set "zookeeper.ssl.keystore.location" "${keystore_location}" - ! is_empty_value "${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD:-}" && kafka_server_conf_set "zookeeper.ssl.keystore.password" "${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD}" - ! is_empty_value "${kafka_zk_truststore_location:-}" && kafka_server_conf_set "zookeeper.ssl.truststore.location" "${kafka_zk_truststore_location}" - ! is_empty_value "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD:-}" && kafka_server_conf_set "zookeeper.ssl.truststore.password" "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD}" - true # Avoid the function to fail due to the check above -} - -######################## -# Configure Kafka configuration files from environment variables -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_from_environment_variables() { - # List of special cases to apply to the variables - local -r exception_regexps=( - "s/sasl\.ssl/sasl_ssl/g" - "s/sasl\.plaintext/sasl_plaintext/g" - ) - # Map environment variables to config properties - for var in "${!KAFKA_CFG_@}"; do - key="$(echo "$var" | sed -e 's/^KAFKA_CFG_//g' -e 's/_/\./g' | tr '[:upper:]' '[:lower:]')" - - # Exception for the camel case in this environment variable - [[ "$var" == "KAFKA_CFG_ZOOKEEPER_CLIENTCNXNSOCKET" ]] && key="zookeeper.clientCnxnSocket" - - # Apply exception regexps - for regex in "${exception_regexps[@]}"; do - key="$(echo "$key" | sed "$regex")" - done - - value="${!var}" - kafka_server_conf_set "$key" "$value" - done -} - -######################## -# Initialize KRaft storage -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_kraft_storage_initialize() { - local args=("--config" "$KAFKA_CONF_FILE" "--ignore-formatted") - info "Initializing KRaft storage metadata" - - # If cluster.id found in meta.properties, use it - if [[ -f "${KAFKA_DATA_DIR}/meta.properties" ]]; then - KAFKA_KRAFT_CLUSTER_ID=$(grep "^cluster.id=" "${KAFKA_DATA_DIR}/meta.properties" | sed -E 's/^cluster\.id=(\S+)$/\1/') - fi - - if is_empty_value "${KAFKA_KRAFT_CLUSTER_ID:-}"; then - warn "KAFKA_KRAFT_CLUSTER_ID not set - If using multiple nodes then you must use the same Cluster ID for each one" - KAFKA_KRAFT_CLUSTER_ID="$("${KAFKA_HOME}/bin/kafka-storage.sh" random-uuid)" - info "Generated Kafka cluster ID '${KAFKA_KRAFT_CLUSTER_ID}'" - fi - args+=("--cluster-id=$KAFKA_KRAFT_CLUSTER_ID") - - # SCRAM users are configured during the cluster bootstrapping process and can later be manually updated using kafka-config.sh - if is_boolean_yes "${KAFKA_KRAFT_BOOTSTRAP_SCRAM_USERS:-}"; then - info "Adding KRaft SCRAM users at storage bootstrap" - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - # Configure SCRAM-SHA-256 if enabled - if grep -Eq "^sasl.enabled.mechanisms=.*SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - for ((i = 0; i < ${#users[@]}; i++)); do - args+=("--add-scram" "SCRAM-SHA-256=[name=${users[i]},password=${passwords[i]}]") - done - fi - # Configure SCRAM-SHA-512 if enabled - if grep -Eq "^sasl.enabled.mechanisms=.*SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - for ((i = 0; i < ${#users[@]}; i++)); do - args+=("--add-scram" "SCRAM-SHA-512=[name=${users[i]},password=${passwords[i]}]") - done - fi - # Add interbroker credentials - if grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-256=[name=${KAFKA_INTER_BROKER_USER},password=${KAFKA_INTER_BROKER_PASSWORD}]") - elif grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-512=[name=${KAFKA_INTER_BROKER_USER},password=${KAFKA_INTER_BROKER_PASSWORD}]") - fi - # Add controller credentials - if grep -Eq "^sasl.mechanism.controller.protocol=SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-256=[name=${KAFKA_CONTROLLER_USER},password=${KAFKA_CONTROLLER_PASSWORD}]") - elif grep -Eq "^sasl.mechanism.controller.protocol=SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-512=[name=${KAFKA_CONTROLLER_USER},password=${KAFKA_CONTROLLER_PASSWORD}]") - fi - fi - info "Formatting storage directories to add metadata..." - "${KAFKA_HOME}/bin/kafka-storage.sh" format "${args[@]}" -} - -######################## -# Detects inconsitences between the configuration at KAFKA_CONF_FILE and cluster-state file -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_kraft_quorum_voters_changed(){ - read -r -a quorum_voters_conf_ids <<<"$(grep "^controller.quorum.voters=" "$KAFKA_CONF_FILE" | sed "s/^controller.quorum.voters=//" | tr "," " " | sed -E "s/\@\S+//g")" - read -r -a quorum_voters_state_ids <<< "$(grep -Eo "\{\"voterId\":[0-9]+\}" "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" | grep -Eo "[0-9]+" | tr "\n" " ")" - - if [[ "${#quorum_voters_conf_ids[@]}" != "${#quorum_voters_state_ids[@]}" ]]; then - true - else - read -r -a sorted_state <<< "$(echo "${quorum_voters_conf_ids[@]}" | tr ' ' '\n' | sort | tr '\n' ' ')" - read -r -a sorted_conf <<< "$(echo "${quorum_voters_state_ids[@]}" | tr ' ' '\n' | sort | tr '\n' ' ')" - if [[ "${sorted_state[*]}" = "${sorted_conf[*]}" ]]; then - false - else - true - fi - fi -} - -######################## -# Initialize Kafka -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_initialize() { - info "Initializing Kafka..." - # Check for mounted configuration files - if ! is_dir_empty "$KAFKA_MOUNTED_CONF_DIR"; then - cp -Lr "$KAFKA_MOUNTED_CONF_DIR"/* "$KAFKA_CONF_DIR" - fi - # Copy truststore to cert directory - for cert_var in KAFKA_TLS_TRUSTSTORE_FILE KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE; do - # Only copy if the file exists and it is in a different location than KAFKA_CERTS_DIR (to avoid copying to the same location) - if [[ -f "${!cert_var}" ]] && ! [[ "${!cert_var}" =~ $KAFKA_CERTS_DIR ]]; then - info "Copying truststore ${!cert_var} to ${KAFKA_CERTS_DIR}" - cp -L "${!cert_var}" "$KAFKA_CERTS_DIR" - fi - done - - if [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/server.properties" ]]; then - info "No injected configuration files found, creating default config files" - # Restore original server.properties but remove Zookeeper/KRaft specific settings for compatibility with both architectures - cp "${KAFKA_CONF_DIR}/server.properties.original" "$KAFKA_CONF_FILE" - kafka_server_unify_conf - # Configure Kafka settings - kafka_server_conf_set log.dirs "$KAFKA_DATA_DIR" - kafka_configure_from_environment_variables - # Configure Kafka producer/consumer to set up message sizes - ! is_empty_value "${KAFKA_CFG_MAX_REQUEST_SIZE:-}" && kafka_common_conf_set "$KAFKA_CONF_DIR/producer.properties" max.request.size "$KAFKA_CFG_MAX_REQUEST_SIZE" - ! is_empty_value "${KAFKA_CFG_MAX_PARTITION_FETCH_BYTES:-}" && kafka_common_conf_set "$KAFKA_CONF_DIR/consumer.properties" max.partition.fetch.bytes "$KAFKA_CFG_MAX_PARTITION_FETCH_BYTES" - # Zookeeper mode additional settings - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SSL ]]; then - kafka_zookeeper_configure_tls - fi - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SASL ]]; then - kafka_zookeeper_configure_jaas - fi - fi - # If at least one listener uses SSL or SASL_SSL, ensure SSL is configured - if kafka_has_ssl_listener; then - kafka_configure_ssl - fi - # If at least one listener uses SASL_PLAINTEXT or SASL_SSL, ensure SASL is configured - if kafka_has_sasl_listener; then - if [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM ]]; then - if ! is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}"; then - if [[ "$(kafka_get_version)" =~ ^3\.2\.|^3\.3\.|^3\.4\. ]]; then - # NOTE: This will depend on Kafka version when support for SCRAM is added - warn "KRaft mode requires Kafka version 3.5 or higher for SCRAM to be supported. SCRAM SASL mechanisms will now be disabled." - KAFKA_CFG_SASL_ENABLED_MECHANISMS=PLAIN - else - export KAFKA_KRAFT_BOOTSTRAP_SCRAM_USERS="true" - fi - fi - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - export KAFKA_ZOOKEEPER_BOOTSTRAP_SCRAM_USERS="true" - fi - fi - kafka_server_conf_set sasl.enabled.mechanisms "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" - fi - # Settings for each Kafka Listener are configured individually - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - - if [[ "$protocol" = "SSL" || "$protocol" = "SASL_SSL" ]]; then - listener_upper="$(echo "$listener" | tr '[:lower:]' '[:upper:]')" - env_name="KAFKA_TLS_${listener_upper}_CLIENT_AUTH" - [[ -n "${!env_name:-}" ]] && kafka_server_conf_set "listener.name.${listener_lower}.ssl.client.auth" "${!env_name}" - fi - if [[ "$protocol" = "SASL_PLAINTEXT" || "$protocol" = "SASL_SSL" ]]; then - local role="" - if [[ "$listener" = "${KAFKA_CFG_INTER_BROKER_LISTENER_NAME:-INTERNAL}" ]]; then - kafka_server_conf_set sasl.mechanism.inter.broker.protocol "$KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL" - role="inter-broker" - elif [[ "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-CONTROLLER}" =~ $listener ]]; then - kafka_server_conf_set sasl.mechanism.controller.protocol "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - kafka_server_conf_set "listener.name.${listener_lower}.sasl.enabled.mechanisms" "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - role="controller" - fi - # If KAFKA_CLIENT_LISTENER_NAME is found in the listeners list, configure the producer/consumer accordingly - if [[ "$listener" = "${KAFKA_CLIENT_LISTENER_NAME:-CLIENT}" ]]; then - kafka_configure_consumer_producer_jaas - kafka_producer_consumer_conf_set security.protocol "$protocol" - kafka_producer_consumer_conf_set sasl.mechanism "${KAFKA_CLIENT_SASL_MECHANISM:-$(kafka_client_sasl_mechanism)}" - fi - # Configure inline listener jaas configuration, omitted if mounted JAAS conf file detected - if [[ ! -f "${KAFKA_CONF_DIR}/kafka_jaas.conf" ]]; then - kafka_configure_server_jaas "$listener_lower" "${role:-}" - fi - fi - done - # Configure Kafka using environment variables - # This is executed at the end, to allow users to override properties set by the initialization logic - kafka_configure_from_environment_variables - else - info "Detected mounted server.properties file at ${KAFKA_MOUNTED_CONF_DIR}/server.properties. Skipping configuration based on env variables" - fi - true -} - -######################## -# Returns the most secure SASL mechanism available for Kafka clients -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################## -kafka_client_sasl_mechanism() { - local sasl_mechanism="" - - if [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM-SHA-512 ]]; then - sasl_mechanism="SCRAM-SHA-512" - elif [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM-SHA-256 ]]; then - sasl_mechanism="SCRAM-SHA-256" - elif [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ PLAIN ]]; then - sasl_mechanism="PLAIN" - fi - echo "$sasl_mechanism" -} - -######################## -# Removes default settings referencing Zookeeper mode or KRaft mode -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################## -kafka_server_unify_conf() { - local -r remove_regexps=( - #Zookeeper - "s/^zookeeper\./#zookeeper./g" - "s/^group\.initial/#group.initial/g" - "s/^broker\./#broker./g" - "s/^node\./#node./g" - "s/^process\./#process./g" - "s/^listeners=/#listeners=/g" - "s/^listener\./#listener./g" - "s/^controller\./#controller./g" - "s/^inter\.broker/#inter.broker/g" - "s/^advertised\.listeners/#advertised.listeners/g" - ) - - # Map environment variables to config properties - for regex in "${remove_regexps[@]}"; do - sed -i "${regex}" "$KAFKA_CONF_FILE" - done -} - -######################## -# Dinamically set node.id/broker.id/controller.quorum.voters if their alternative environment variable _COMMAND is set -# Globals: -# KAFKA_*_COMMAND -# Arguments: -# None -# Returns: -# None -######################### -kafka_dynamic_environment_variables() { - # KRaft mode - if ! is_empty_value "${KAFKA_NODE_ID_COMMAND:-}"; then - KAFKA_CFG_NODE_ID="$(eval "${KAFKA_NODE_ID_COMMAND}")" - export KAFKA_CFG_NODE_ID - fi - if ! is_empty_value "${KAFKA_CONTROLLER_QUORUM_VOTERS_COMMAND:-}"; then - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS="$(eval "${KAFKA_CONTROLLER_QUORUM_VOTERS_COMMAND}")" - export KAFKA_CFG_CONTROLLER_QUORUM_VOTERS - fi - # Zookeeper mode - # DEPRECATED - BROKER_ID_COMMAND has been deprecated, please use KAFKA_BROKER_ID_COMMAND instead - if ! is_empty_value "${KAFKA_BROKER_ID_COMMAND:-}"; then - KAFKA_CFG_BROKER_ID="$(eval "${KAFKA_BROKER_ID_COMMAND}")" - export KAFKA_CFG_BROKER_ID - elif ! is_empty_value "${BROKER_ID_COMMAND:-}"; then - KAFKA_CFG_BROKER_ID="$(eval "${BROKER_ID_COMMAND}")" - export KAFKA_CFG_BROKER_ID - fi -} - -######################## -# Run custom initialization scripts -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_custom_init_scripts() { - if [[ -n $(find "${KAFKA_INITSCRIPTS_DIR}/" -type f -regex ".*\.\(sh\)") ]] && [[ ! -f "${KAFKA_VOLUME_DIR}/.user_scripts_initialized" ]]; then - info "Loading user's custom files from $KAFKA_INITSCRIPTS_DIR" - for f in /docker-entrypoint-initdb.d/*; do - debug "Executing $f" - case "$f" in - *.sh) - if [[ -x "$f" ]]; then - if ! "$f"; then - error "Failed executing $f" - return 1 - fi - else - warn "Sourcing $f as it is not executable by the current user, any error may cause initialization to fail" - . "$f" - fi - ;; - *) - warn "Skipping $f, supported formats are: .sh" - ;; - esac - done - touch "$KAFKA_VOLUME_DIR"/.user_scripts_initialized - fi -} - -######################## -# Check if Kafka is running -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# Whether Kafka is running -######################## -is_kafka_running() { - local pid - pid="$(get_pid_from_file "$KAFKA_PID_FILE")" - if [[ -n "$pid" ]]; then - is_service_running "$pid" - else - false - fi -} - -######################## -# Check if Kafka is running -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# Whether Kafka is not running -######################## -is_kafka_not_running() { - ! is_kafka_running -} - -######################## -# Stop Kafka -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# None -######################### -kafka_stop() { - ! is_kafka_running && return - stop_service_using_pid "$KAFKA_PID_FILE" TERM -} diff --git a/bitnami/kafka/3.4/debian-12/tags-info.yaml b/bitnami/kafka/3.4/debian-12/tags-info.yaml deleted file mode 100644 index 18cf5f73e7f88..0000000000000 --- a/bitnami/kafka/3.4/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "3.4" -- 3.4-debian-12 -- 3.4.1 diff --git a/bitnami/kafka/3.5/README.md b/bitnami/kafka/3.5/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/kafka/3.5/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/kafka/3.5/debian-12/Dockerfile b/bitnami/kafka/3.5/debian-12/Dockerfile deleted file mode 100644 index 59963aff831c2..0000000000000 --- a/bitnami/kafka/3.5/debian-12/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T21:52:27Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/kafka/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="3.5.2-debian-12-r30" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/kafka" \ - org.opencontainers.image.title="kafka" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="3.5.2" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "wait-for-port-1.0.8-8-linux-${OS_ARCH}-debian-12" \ - "render-template-1.0.7-8-linux-${OS_ARCH}-debian-12" \ - "java-17.0.13-12-1-linux-${OS_ARCH}-debian-12" \ - "kafka-3.5.2-6-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN ln -s /opt/bitnami/scripts/kafka/entrypoint.sh /entrypoint.sh -RUN ln -s /opt/bitnami/scripts/kafka/run.sh /run.sh - -COPY rootfs / -RUN /opt/bitnami/scripts/java/postunpack.sh -RUN /opt/bitnami/scripts/kafka/postunpack.sh -ENV APP_VERSION="3.5.2" \ - BITNAMI_APP_NAME="kafka" \ - JAVA_HOME="/opt/bitnami/java" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/java/bin:/opt/bitnami/kafka/bin:$PATH" - -EXPOSE 9092 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/kafka/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/kafka/run.sh" ] diff --git a/bitnami/kafka/3.5/debian-12/docker-compose-cluster.yml b/bitnami/kafka/3.5/debian-12/docker-compose-cluster.yml deleted file mode 100644 index 1770282ea31bf..0000000000000 --- a/bitnami/kafka/3.5/debian-12/docker-compose-cluster.yml +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - kafka-0: - image: docker.io/bitnami/kafka:3.5 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=0 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_0_data:/bitnami/kafka - kafka-1: - image: docker.io/bitnami/kafka:3.5 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=1 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_1_data:/bitnami/kafka - kafka-2: - image: docker.io/bitnami/kafka:3.5 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=2 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_2_data:/bitnami/kafka - -volumes: - kafka_0_data: - driver: local - kafka_1_data: - driver: local - kafka_2_data: - driver: local diff --git a/bitnami/kafka/3.5/debian-12/docker-compose.yml b/bitnami/kafka/3.5/debian-12/docker-compose.yml deleted file mode 100644 index 9218140cdadc7..0000000000000 --- a/bitnami/kafka/3.5/debian-12/docker-compose.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - kafka: - image: docker.io/bitnami/kafka:3.5 - ports: - - "9092:9092" - volumes: - - "kafka_data:/bitnami" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=0 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093 - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT -volumes: - kafka_data: - driver: local diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 6e09edd5daf66..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "17.0.13-12-1" - }, - "kafka": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "3.5.2-6" - }, - "render-template": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.7-8" - }, - "wait-for-port": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.8-8" - } -} \ No newline at end of file diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/kafka/3.5/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/kafka/3.5/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/kafka/3.5/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/kafka/3.5/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 38802fc0bfe91..0000000000000 --- a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -if [[ "$OS_FLAVOUR" =~ photon && "$APP_VERSION" =~ ^1.8 ]]; then - # Option --module-path is not supported by JAVA 1.8 since modules were added in version 1.9 - unset JAVA_TOOL_OPTIONS -fi - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh b/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh deleted file mode 100644 index e1621b93e8083..0000000000000 --- a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for kafka - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-kafka}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -kafka_env_vars=( - KAFKA_MOUNTED_CONF_DIR - KAFKA_INTER_BROKER_USER - KAFKA_INTER_BROKER_PASSWORD - KAFKA_CONTROLLER_USER - KAFKA_CONTROLLER_PASSWORD - KAFKA_CERTIFICATE_PASSWORD - KAFKA_TLS_TRUSTSTORE_FILE - KAFKA_TLS_TYPE - KAFKA_TLS_CLIENT_AUTH - KAFKA_OPTS - KAFKA_CFG_SASL_ENABLED_MECHANISMS - KAFKA_KRAFT_CLUSTER_ID - KAFKA_SKIP_KRAFT_STORAGE_INIT - KAFKA_CLIENT_LISTENER_NAME - KAFKA_ZOOKEEPER_PROTOCOL - KAFKA_ZOOKEEPER_PASSWORD - KAFKA_ZOOKEEPER_USER - KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD - KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD - KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE - KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME - KAFKA_ZOOKEEPER_TLS_TYPE - KAFKA_CLIENT_USERS - KAFKA_CLIENT_PASSWORDS - KAFKA_HEAP_OPTS - JAVA_TOOL_OPTIONS -) -for env_var in "${kafka_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset kafka_env_vars - -# Paths -export KAFKA_BASE_DIR="${BITNAMI_ROOT_DIR}/kafka" -export KAFKA_VOLUME_DIR="/bitnami/kafka" -export KAFKA_DATA_DIR="${KAFKA_VOLUME_DIR}/data" -export KAFKA_CONF_DIR="${KAFKA_BASE_DIR}/config" -export KAFKA_CONF_FILE="${KAFKA_CONF_DIR}/server.properties" -export KAFKA_MOUNTED_CONF_DIR="${KAFKA_MOUNTED_CONF_DIR:-${KAFKA_VOLUME_DIR}/config}" -export KAFKA_CERTS_DIR="${KAFKA_CONF_DIR}/certs" -export KAFKA_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d" -export KAFKA_LOG_DIR="${KAFKA_BASE_DIR}/logs" -export KAFKA_HOME="$KAFKA_BASE_DIR" -export PATH="${KAFKA_BASE_DIR}/bin:${BITNAMI_ROOT_DIR}/java/bin:${PATH}" - -# System users (when running with a privileged user) -export KAFKA_DAEMON_USER="kafka" -export KAFKA_DAEMON_GROUP="kafka" - -# Kafka runtime settings -export KAFKA_INTER_BROKER_USER="${KAFKA_INTER_BROKER_USER:-user}" -export KAFKA_INTER_BROKER_PASSWORD="${KAFKA_INTER_BROKER_PASSWORD:-bitnami}" -export KAFKA_CONTROLLER_USER="${KAFKA_CONTROLLER_USER:-controller_user}" -export KAFKA_CONTROLLER_PASSWORD="${KAFKA_CONTROLLER_PASSWORD:-bitnami}" -export KAFKA_CERTIFICATE_PASSWORD="${KAFKA_CERTIFICATE_PASSWORD:-}" -export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_TLS_TRUSTSTORE_FILE:-}" -export KAFKA_TLS_TYPE="${KAFKA_TLS_TYPE:-JKS}" -export KAFKA_TLS_CLIENT_AUTH="${KAFKA_TLS_CLIENT_AUTH:-required}" -export KAFKA_OPTS="${KAFKA_OPTS:-}" - -# Kafka configuration overrides -export KAFKA_CFG_SASL_ENABLED_MECHANISMS="${KAFKA_CFG_SASL_ENABLED_MECHANISMS:-PLAIN,SCRAM-SHA-256,SCRAM-SHA-512}" -export KAFKA_KRAFT_CLUSTER_ID="${KAFKA_KRAFT_CLUSTER_ID:-}" -export KAFKA_SKIP_KRAFT_STORAGE_INIT="${KAFKA_SKIP_KRAFT_STORAGE_INIT:-false}" -export KAFKA_CLIENT_LISTENER_NAME="${KAFKA_CLIENT_LISTENER_NAME:-}" - -# ZooKeeper connection settings -export KAFKA_ZOOKEEPER_PROTOCOL="${KAFKA_ZOOKEEPER_PROTOCOL:-PLAINTEXT}" -export KAFKA_ZOOKEEPER_PASSWORD="${KAFKA_ZOOKEEPER_PASSWORD:-}" -export KAFKA_ZOOKEEPER_USER="${KAFKA_ZOOKEEPER_USER:-}" -export KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD="${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD:-}" -export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD="${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD:-}" -export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE:-}" -export KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME="${KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME:-true}" -export KAFKA_ZOOKEEPER_TLS_TYPE="${KAFKA_ZOOKEEPER_TLS_TYPE:-JKS}" - -# Authentication -export KAFKA_CLIENT_USERS="${KAFKA_CLIENT_USERS:-user}" -export KAFKA_CLIENT_PASSWORDS="${KAFKA_CLIENT_PASSWORDS:-bitnami}" - -# Java settings -export KAFKA_HEAP_OPTS="${KAFKA_HEAP_OPTS:--Xmx1024m -Xms1024m}" - -# Java settings -export JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS:-}" - -# Custom environment variables may be defined below diff --git a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh b/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh deleted file mode 100755 index d7413bcfc4f33..0000000000000 --- a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libkafka.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -print_welcome_page - -if [[ "$*" = *"/opt/bitnami/scripts/kafka/run.sh"* || "$*" = *"/run.sh"* ]]; then - info "** Starting Kafka setup **" - /opt/bitnami/scripts/kafka/setup.sh - info "** Kafka setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh b/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh deleted file mode 100755 index 7255563236c0b..0000000000000 --- a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libkafka.sh -. /opt/bitnami/scripts/libfs.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -# Move server.properties from configtmp to config -# Temporary solution until kafka tarball places server.properties into config -if [[ -d "${KAFKA_BASE_DIR}/configtmp" ]]; then - mv "${KAFKA_BASE_DIR}/configtmp"/* "$KAFKA_CONF_DIR" - rmdir "${KAFKA_BASE_DIR}/configtmp" -fi -[[ -d "${KAFKA_BASE_DIR}/conf" ]] && rmdir "${KAFKA_BASE_DIR}/conf" - -# Ensure directories used by Kafka exist and have proper ownership and permissions -for dir in "$KAFKA_LOG_DIR" "$KAFKA_CONF_DIR" "$KAFKA_MOUNTED_CONF_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR" "$KAFKA_INITSCRIPTS_DIR"; do - ensure_dir_exists "$dir" -done -chmod -R g+rwX "$KAFKA_BASE_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR" "$KAFKA_INITSCRIPTS_DIR" - -# Move the original server.properties, so users can skip initialization logic by mounting their own server.properties directly instead of using the MOUNTED_CONF_DIR -mv "${KAFKA_CONF_DIR}/server.properties" "${KAFKA_CONF_DIR}/server.properties.original" - -# Disable logging to stdout and garbage collection -# Source: https://logging.apache.org/log4j/log4j-2.4/manual/appenders.html -replace_in_file "${KAFKA_BASE_DIR}/bin/kafka-server-start.sh" " [-]loggc" " " -replace_in_file "${KAFKA_CONF_DIR}/log4j.properties" "DailyRollingFileAppender" "ConsoleAppender" - -# Disable the default console logger in favour of KafkaAppender (which provides the exact output) -echo "log4j.appender.stdout.Threshold=OFF" >>"${KAFKA_CONF_DIR}/log4j.properties" - -# Remove invalid parameters for ConsoleAppender -remove_in_file "${KAFKA_CONF_DIR}/log4j.properties" "DatePattern" -remove_in_file "${KAFKA_CONF_DIR}/log4j.properties" "Appender.File" diff --git a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh b/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh deleted file mode 100755 index 76d4380aff57e..0000000000000 --- a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libkafka.sh -. /opt/bitnami/scripts/libos.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -if [[ -f "${KAFKA_CONF_DIR}/kafka_jaas.conf" ]]; then - export KAFKA_OPTS="${KAFKA_OPTS:-} -Djava.security.auth.login.config=${KAFKA_CONF_DIR}/kafka_jaas.conf" -fi - -cmd="$KAFKA_HOME/bin/kafka-server-start.sh" -args=("$KAFKA_CONF_FILE") -! is_empty_value "${KAFKA_EXTRA_FLAGS:-}" && args=("${args[@]}" "${KAFKA_EXTRA_FLAGS[@]}") - -info "** Starting Kafka **" -if am_i_root; then - exec_as_user "$KAFKA_DAEMON_USER" "$cmd" "${args[@]}" "$@" -else - exec "$cmd" "${args[@]}" "$@" -fi diff --git a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh b/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh deleted file mode 100755 index 5195f71910176..0000000000000 --- a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libkafka.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -# Map Kafka environment variables -kafka_create_alias_environment_variables - -# Dinamically set node.id/broker.id/controller.quorum.voters if the _COMMAND environment variable is set -kafka_dynamic_environment_variables - -# Set the default tuststore locations before validation -kafka_configure_default_truststore_locations -# Ensure Kafka user and group exist when running as 'root' -am_i_root && ensure_user_exists "$KAFKA_DAEMON_USER" --group "$KAFKA_DAEMON_GROUP" -# Ensure directories used by Kafka exist and have proper ownership and permissions -for dir in "$KAFKA_LOG_DIR" "$KAFKA_CONF_DIR" "$KAFKA_MOUNTED_CONF_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR"; do - if am_i_root; then - ensure_dir_exists "$dir" "$KAFKA_DAEMON_USER" "$KAFKA_DAEMON_GROUP" - else - ensure_dir_exists "$dir" - fi -done - -# Kafka validation, skipped if server.properties was mounted at either $KAFKA_MOUNTED_CONF_DIR or $KAFKA_CONF_DIR -[[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/server.properties" && ! -f "$KAFKA_CONF_FILE" ]] && kafka_validate -# Kafka initialization, skipped if server.properties was mounted at $KAFKA_CONF_DIR -[[ ! -f "$KAFKA_CONF_FILE" ]] && kafka_initialize - -# Initialise KRaft metadata storage if process.roles configured -if grep -q "^process.roles=" "$KAFKA_CONF_FILE" && ! is_boolean_yes "$KAFKA_SKIP_KRAFT_STORAGE_INIT" ; then - kafka_kraft_storage_initialize -fi -# Configure Zookeeper SCRAM users -if is_boolean_yes "${KAFKA_ZOOKEEPER_BOOTSTRAP_SCRAM_USERS:-}"; then - kafka_zookeeper_create_sasl_scram_users -fi -# KRaft controllers may get stuck starting when the controller quorum voters are changed. -# Workaround: Remove quorum-state file when scaling up/down controllers (Waiting proposal KIP-853) -# https://cwiki.apache.org/confluence/display/KAFKA/KIP-853%3A+KRaft+Voter+Changes -if [[ -f "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" ]] && grep -q "^controller.quorum.voters=" "$KAFKA_CONF_FILE" && kafka_kraft_quorum_voters_changed; then - warn "Detected inconsitences between controller.quorum.voters and quorum-state, removing it..." - rm -f "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" -fi -# Ensure custom initialization scripts are executed -kafka_custom_init_scripts diff --git a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh b/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh deleted file mode 100644 index df2459b035778..0000000000000 --- a/bitnami/kafka/3.5/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh +++ /dev/null @@ -1,1176 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Kafka library - -# shellcheck disable=SC1090,SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libservice.sh - -# Functions - -######################## -# Set a configuration setting value to a file -# Globals: -# None -# Arguments: -# $1 - file -# $2 - key -# $3 - values (array) -# Returns: -# None -######################### -kafka_common_conf_set() { - local file="${1:?missing file}" - local key="${2:?missing key}" - shift - shift - local values=("$@") - - if [[ "${#values[@]}" -eq 0 ]]; then - stderr_print "missing value" - return 1 - elif [[ "${#values[@]}" -ne 1 ]]; then - for i in "${!values[@]}"; do - kafka_common_conf_set "$file" "${key[$i]}" "${values[$i]}" - done - else - value="${values[0]}" - # Check if the value was set before - if grep -q "^[#\\s]*$key\s*=.*" "$file"; then - # Update the existing key - replace_in_file "$file" "^[#\\s]*${key}\s*=.*" "${key}=${value}" false - else - # Add a new key - printf '\n%s=%s' "$key" "$value" >>"$file" - fi - fi -} - -######################## -# Returns true if at least one listener is configured using SSL -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_ssl_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENERS:-}"; then - if is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - if [[ "$KAFKA_CFG_LISTENERS" =~ SSL: || "$KAFKA_CFG_LISTENERS" =~ SASL_SSL: ]]; then - return - fi - else - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "SSL" || "$protocol" = "SASL_SSL" ]]; then - if [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - fi - fi - return 1 -} - -######################## -# Returns true if at least one listener is configured using SASL -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_sasl_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENERS:-}"; then - if is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - if [[ "$KAFKA_CFG_LISTENERS" =~ SASL_PLAINTEXT: ]] || [[ "$KAFKA_CFG_LISTENERS" =~ SASL_SSL: ]]; then - return - fi - else - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "SASL_PLAINTEXT" || "$protocol" = "SASL_SSL" ]]; then - if [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - fi - fi - return 1 -} - -######################## -# Returns true if at least one listener is configured using plaintext -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_plaintext_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "PLAINTEXT" ]]; then - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - else - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ "$KAFKA_CFG_LISTENERS" =~ PLAINTEXT: ]]; then - return - fi - fi - return 1 -} - -######################## -# Backwards compatibility measure to configure the TLS truststore locations -# Globals: -# KAFKA_CONF_FILE -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_default_truststore_locations() { - # Backwards compatibility measure to allow custom truststore locations but at the same time not disrupt - # the UX that the previous version of the containers and the helm chart have. - # Context: The chart and containers by default assumed that the truststore location was KAFKA_CERTS_DIR/kafka.truststore.jks or KAFKA_MOUNTED_CONF_DIR/certs/kafka.truststore.jks. - # Because of this, we could not use custom certificates in different locations (use case: A custom base image that already has a truststore). Changing the logic to allow custom - # locations implied major changes in the current user experience (which only required to mount certificates at the assumed location). In order to maintain this compatibility we need - # use this logic that sets the KAFKA_TLS_*_FILE variables to the previously assumed locations in case it is not set - - # Kafka truststore - if kafka_has_ssl_listener && is_empty_value "${KAFKA_TLS_TRUSTSTORE_FILE:-}"; then - local kafka_truststore_filename="kafka.truststore.jks" - [[ "$KAFKA_TLS_TYPE" = "PEM" ]] && kafka_truststore_filename="kafka.truststore.pem" - if [[ -f "${KAFKA_CERTS_DIR}/${kafka_truststore_filename}" ]]; then - # Mounted in /opt/bitnami/kafka/conf/certs - export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_CERTS_DIR}/${kafka_truststore_filename}" - else - # Mounted in /bitnami/kafka/conf/certs - export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_MOUNTED_CONF_DIR}/certs/${kafka_truststore_filename}" - fi - fi - # Zookeeper truststore - if [[ "${KAFKA_ZOOKEEPER_PROTOCOL:-}" =~ SSL ]] && is_empty_value "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE:-}"; then - local zk_truststore_filename="zookeeper.truststore.jks" - [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]] && zk_truststore_filename="zookeeper.truststore.pem" - if [[ -f "${KAFKA_CERTS_DIR}/${zk_truststore_filename}" ]]; then - # Mounted in /opt/bitnami/kafka/conf/certs - export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_CERTS_DIR}/${zk_truststore_filename}" - else - # Mounted in /bitnami/kafka/conf/certs - export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_MOUNTED_CONF_DIR}/certs/${zk_truststore_filename}" - fi - fi -} - -######################## -# Set a configuration setting value to server.properties -# Globals: -# KAFKA_CONF_FILE -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -kafka_server_conf_set() { - kafka_common_conf_set "$KAFKA_CONF_FILE" "$@" -} - -######################## -# Set a configuration setting value to producer.properties and consumer.properties -# Globals: -# KAFKA_CONF_DIR -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -kafka_producer_consumer_conf_set() { - kafka_common_conf_set "$KAFKA_CONF_DIR/producer.properties" "$@" - kafka_common_conf_set "$KAFKA_CONF_DIR/consumer.properties" "$@" -} - -######################## -# Create alias for environment variable, so both can be used -# Globals: -# None -# Arguments: -# $1 - Alias environment variable name -# $2 - Original environment variable name -# Returns: -# None -######################### -kafka_declare_alias_env() { - local -r alias="${1:?missing environment variable alias}" - local -r original="${2:?missing original environment variable}" - if printenv "${original}" >/dev/null; then - export "$alias"="${!original:-}" - fi -} - -######################## -# Map Kafka legacy environment variables to the new names -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_create_alias_environment_variables() { - suffixes=( - "ADVERTISED_LISTENERS" - "BROKER_ID" - "NODE_ID" - "CONTROLLER_QUORUM_VOTERS" - "PROCESS_ROLES" - "DEFAULT_REPLICATION_FACTOR" - "DELETE_TOPIC_ENABLE" - "INTER_BROKER_LISTENER_NAME" - "LISTENERS" - "LISTENER_SECURITY_PROTOCOL_MAP" - "LOG_DIRS" - "LOG_FLUSH_INTERVAL_MESSAGES" - "LOG_FLUSH_INTERVAL_MS" - "LOG_MESSAGE_FORMAT_VERSION" - "LOG_RETENTION_BYTES" - "LOG_RETENTION_CHECK_INTERVALS_MS" - "LOG_RETENTION_HOURS" - "LOG_SEGMENT_BYTES" - "MESSAGE_MAX_BYTES" - "NUM_IO_THREADS" - "NUM_NETWORK_THREADS" - "NUM_PARTITIONS" - "NUM_RECOVERY_THREADS_PER_DATA_DIR" - "OFFSETS_TOPIC_REPLICATION_FACTOR" - "SOCKET_RECEIVE_BUFFER_BYTES" - "SOCKET_REQUEST_MAX_BYTES" - "SOCKET_SEND_BUFFER_BYTES" - "SSL_ENDPOINT_IDENTIFICATION_ALGORITHM" - "TRANSACTION_STATE_LOG_MIN_ISR" - "TRANSACTION_STATE_LOG_REPLICATION_FACTOR" - "ZOOKEEPER_CONNECT" - "ZOOKEEPER_CONNECTION_TIMEOUT_MS" - ) - kafka_declare_alias_env "KAFKA_CFG_LOG_DIRS" "KAFKA_LOGS_DIRS" - kafka_declare_alias_env "KAFKA_CFG_LOG_SEGMENT_BYTES" "KAFKA_SEGMENT_BYTES" - kafka_declare_alias_env "KAFKA_CFG_MESSAGE_MAX_BYTES" "KAFKA_MAX_MESSAGE_BYTES" - kafka_declare_alias_env "KAFKA_CFG_ZOOKEEPER_CONNECTION_TIMEOUT_MS" "KAFKA_ZOOKEEPER_CONNECT_TIMEOUT_MS" - kafka_declare_alias_env "KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE" "KAFKA_AUTO_CREATE_TOPICS_ENABLE" - kafka_declare_alias_env "KAFKA_CLIENT_USERS" "KAFKA_BROKER_USER" - kafka_declare_alias_env "KAFKA_CLIENT_PASSWORDS" "KAFKA_BROKER_PASSWORD" - kafka_declare_alias_env "KAFKA_CLIENT_LISTENER_NAME" "KAFKA_CLIENT_LISTENER" - for s in "${suffixes[@]}"; do - kafka_declare_alias_env "KAFKA_CFG_${s}" "KAFKA_${s}" - done -} - -######################## -# Validate settings in KAFKA_* env vars -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_validate() { - debug "Validating settings in KAFKA_* env vars..." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_multi_value() { - if [[ " ${2} " != *" ${!1} "* ]]; then - print_validation_error "The allowed values for ${1} are: ${2}" - fi - } - # If process.roles configured, check its values are valid and perform additional checks for each - check_kraft_process_roles() { - read -r -a roles_list <<<"$(tr ',;' ' ' <<<"$KAFKA_CFG_PROCESS_ROLES")" - for role in "${roles_list[@]}"; do - case "$role" in - broker) ;; - controller) - if is_empty_value "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-}"; then - print_validation_error "Role 'controller' enabled but environment variable KAFKA_CFG_CONTROLLER_LISTENER_NAMES was not provided." - fi - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ ! "$KAFKA_CFG_LISTENERS" =~ ${KAFKA_CFG_CONTROLLER_LISTENER_NAMES} ]]; then - print_validation_error "Role 'controller' enabled but listener ${KAFKA_CFG_CONTROLLER_LISTENER_NAMES} not found in KAFKA_CFG_LISTENERS." - fi - ;; - *) - print_validation_error "Invalid KRaft process role '$role'. Supported roles are 'broker,controller'" - ;; - esac - done - } - # Check all listeners are using a unique and valid port - check_listener_ports(){ - check_allowed_port() { - local port="${1:?missing port variable}" - local -a validate_port_args=() - ! am_i_root && validate_port_args+=("-unprivileged") - validate_port_args+=("$port") - if ! err=$(validate_port "${validate_port_args[@]}"); then - print_validation_error "An invalid port ${port} was specified in the environment variable KAFKA_CFG_LISTENERS: ${err}." - fi - } - - read -r -a listeners <<<"$(tr ',' ' ' <<<"${KAFKA_CFG_LISTENERS:-}")" - local -a ports=() - for listener in "${listeners[@]}"; do - read -r -a arr <<<"$(tr ':' ' ' <<<"$listener")" - # Obtain the port from listener string, e.g. PLAINTEXT://:9092 - port="${arr[2]}" - check_allowed_port "$port" - ports+=("$port") - done - # Check each listener is using an unique port - local -a unique_ports=() - read -r -a unique_ports <<< "$(echo "${ports[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')" - if [[ "${#ports[@]}" != "${#unique_ports[@]}" ]]; then - print_validation_error "There are listeners bound to the same port" - fi - } - check_listener_protocols(){ - local -r allowed_protocols=("PLAINTEXT" "SASL_PLAINTEXT" "SASL_SSL" "SSL") - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - # Check protocol in allowed list - if [[ ! "${allowed_protocols[*]}" =~ $protocol ]]; then - print_validation_error "Authentication protocol ${protocol} is not supported!" - fi - # If inter-broker listener configured with SASL, ensure KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL is set - if [[ "$listener" = "${KAFKA_CFG_INTER_BROKER_LISTENER_NAME:-INTERNAL}" ]]; then - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL:-}"; then - print_validation_error "When using SASL for inter broker comunication the mechanism should be provided using KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL" - fi - if is_empty_value "${KAFKA_INTER_BROKER_USER:-}" || is_empty_value "${KAFKA_INTER_BROKER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka inter-broker communications, you must provide the SASL credentials. Set the environment variables KAFKA_INTER_BROKER_USER and KAFKA_INTER_BROKER_PASSWORD to configure the credentials for SASL authentication with between brokers." - fi - fi - # If controller listener configured with SASL, ensure KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL is set - elif [[ "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-CONTROLLER}" =~ $listener ]]; then - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL:-}"; then - print_validation_error "When using SASL for controller comunication the mechanism should be provided at KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - elif [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" =~ SCRAM ]]; then - warn "KRaft controller listener may not support SCRAM-SHA-256/SCRAM-SHA-512 mechanisms. If facing any issues, we recommend switching to PLAIN mechanism. More information at: https://issues.apache.org/jira/browse/KAFKA-15513" - fi - if is_empty_value "${KAFKA_CONTROLLER_USER:-}" || is_empty_value "${KAFKA_CONTROLLER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka control plane communications, you must provide the SASL credentials. Set the environment variables KAFKA_CONTROLLER_USER and KAFKA_CONTROLLER_PASSWORD to configure the credentials for SASL authentication with between controllers." - fi - fi - else - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CLIENT_USERS:-}" || is_empty_value "${KAFKA_CLIENT_PASSWORDS:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka, you must provide the SASL credentials. Set the environment variables KAFKA_CLIENT_USERS and KAFKA_CLIENT_PASSWORDS to configure the credentials for SASL authentication with clients." - fi - fi - - fi - done - } - - if is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}" && is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - print_validation_error "Kafka haven't been configured to work in either Raft or Zookeper mode. Please make sure at least one of the modes is configured." - fi - # Check KRaft mode - if ! is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}"; then - # Only allow Zookeeper configuration if migration mode is enabled - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}" && - { is_empty_value "${KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE:-}" || ! is_boolean_yes "$KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE"; }; then - print_validation_error "Both KRaft mode and Zookeeper modes are configured, but KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE is not enabled" - fi - if is_empty_value "${KAFKA_CFG_NODE_ID:-}"; then - print_validation_error "KRaft mode requires an unique node.id, please set the environment variable KAFKA_CFG_NODE_ID" - fi - if is_empty_value "${KAFKA_CFG_CONTROLLER_QUORUM_VOTERS:-}"; then - print_validation_error "KRaft mode requires KAFKA_CFG_CONTROLLER_QUORUM_VOTERS to be set" - fi - check_kraft_process_roles - fi - # Check Zookeeper mode - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - # If SSL/SASL_SSL protocol configured, check certificates are provided - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SSL ]]; then - if [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "JKS" ]]; then - # Fail if truststore is not provided - if [[ ! -f "$KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE" ]]; then - print_validation_error "In order to configure the TLS encryption for Zookeeper with JKS certs you must mount your zookeeper.truststore.jks cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - # Warn if keystore is not provided, only required if Zookeper mTLS is enabled (ZOO_TLS_CLIENT_AUTH) - if [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" ]] && [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.jks" ]]; then - warn "In order to configure the mTLS for Zookeeper with JKS certs you must mount your zookeeper.keystore.jks cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - elif [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]]; then - # Fail if CA / validation cert is not provided - if [[ ! -f "$KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE" ]]; then - print_validation_error "In order to configure the TLS encryption for Zookeeper with PEM certs you must mount your zookeeper.truststore.pem cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - # Warn if node key or cert are not provided, only required if Zookeper mTLS is enabled (ZOO_TLS_CLIENT_AUTH) - if { [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" ]] || [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.pem" ]] || [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.key" ]]; }; then - warn "In order to configure the mTLS for Zookeeper with PEM certs you must mount your zookeeper.keystore.pem cert and zookeeper.keystore.key key to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - fi - fi - # If SASL/SASL_SSL protocol configured, check certificates are provided - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SASL ]]; then - if is_empty_value "${KAFKA_ZOOKEEPER_USER:-}" || is_empty_value "${KAFKA_ZOOKEEPER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka, you must provide the SASL credentials. Set the environment variables KAFKA_ZOOKEEPER_USER and KAFKA_ZOOKEEPER_PASSWORD, to configure the credentials for SASL authentication with Zookeeper." - fi - fi - # If using plaintext protocol, check it is explicitly allowed - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" = "PLAINTEXT" ]]; then - warn "The KAFKA_ZOOKEEPER_PROTOCOL environment variable does not configure SASL and/or SSL, this setting is not recommended for production environments." - fi - fi - # Check listener ports are unique and allowed - check_listener_ports - # Check listeners are mapped to a valid security protocol - check_listener_protocols - # Warn users if plaintext listeners are configured - if kafka_has_plaintext_listener; then - warn "Kafka has been configured with a PLAINTEXT listener, this setting is not recommended for production environments." - fi - # If SSL/SASL_SSL listeners configured, check certificates are provided - if kafka_has_ssl_listener; then - if [[ "$KAFKA_TLS_TYPE" = "JKS" ]] && - { [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.jks" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.jks" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; }; then - print_validation_error "In order to configure the TLS encryption for Kafka with JKS certs you must mount your kafka.keystore.jks and kafka.truststore.jks certs to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - elif [[ "$KAFKA_TLS_TYPE" = "PEM" ]] && - { [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.pem" ]] || [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.key" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.pem" ]] || [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.key" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; }; then - print_validation_error "In order to configure the TLS encryption for Kafka with PEM certs you must mount your kafka.keystore.pem, kafka.keystore.key and kafka.truststore.pem certs to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - fi - # If SASL/SASL_SSL listeners configured, check passwords are provided - if kafka_has_sasl_listener; then - if is_empty_value "${KAFKA_CFG_SASL_ENABLED_MECHANISMS:-}"; then - print_validation_error "Specified SASL protocol but no SASL mechanisms provided in KAFKA_CFG_SASL_ENABLED_MECHANISMS" - fi - fi - # Check users and passwords lists are the same size - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS:-}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS:-}")" - if [[ "${#users[@]}" -ne "${#passwords[@]}" ]]; then - print_validation_error "Specify the same number of passwords on KAFKA_CLIENT_PASSWORDS as the number of users on KAFKA_CLIENT_USERS!" - fi - check_multi_value "KAFKA_TLS_TYPE" "JKS PEM" - check_multi_value "KAFKA_ZOOKEEPER_TLS_TYPE" "JKS PEM" - check_multi_value "KAFKA_ZOOKEEPER_PROTOCOL" "PLAINTEXT SASL SSL SASL_SSL" - check_multi_value "KAFKA_TLS_CLIENT_AUTH" "none requested required" - [[ "$error_code" -eq 0 ]] || return "$error_code" -} - -######################## -# Get kafka version -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# version -######################### -kafka_get_version() { - local -a cmd=("kafka-topics.sh" "--version") - am_i_root && cmd=("run_as_user" "$KAFKA_DAEMON_USER" "${cmd[@]}") - - read -r -a ver_split <<< "$("${cmd[@]}")" - echo "${ver_split[0]}" -} - -######################### -# Configure JAAS for a given listener and SASL mechanisms -# Globals: -# KAFKA_* -# Arguments: -# $1 - Name of the listener JAAS will be configured for -# $2 - Comma-separated list of SASL mechanisms to configure -# $3 - Comma-separated list of usernames -# $4 - Comma-separated list of passwords -# Returns: -# None -######################### -kafka_configure_server_jaas() { - local listener="${1:?missing listener name}" - local role="${2:-}" - - if [[ "$role" = "controller" ]]; then - local jaas_content=() - if [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" = "PLAIN" ]]; then - jaas_content=( - "org.apache.kafka.common.security.plain.PlainLoginModule required" - "username=\"${KAFKA_CONTROLLER_USER}\"" - "password=\"${KAFKA_CONTROLLER_PASSWORD}\"" - "user_${KAFKA_CONTROLLER_USER}=\"${KAFKA_CONTROLLER_PASSWORD}\";" - ) - elif [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" =~ SCRAM ]]; then - jaas_content=( - "org.apache.kafka.common.security.scram.ScramLoginModule required" - "username=\"${KAFKA_CONTROLLER_USER}\"" - "password=\"${KAFKA_CONTROLLER_PASSWORD}\";" - ) - fi - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - sasl_mechanism_lower="$(echo "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" | tr '[:upper:]' '[:lower:]')" - kafka_server_conf_set "listener.name.${listener_lower}.${sasl_mechanism_lower}.sasl.jaas.config" "${jaas_content[*]}" - else - read -r -a sasl_mechanisms_arr <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_SASL_ENABLED_MECHANISMS")" - read -r -a users <<<"$(tr ',;' ' ' <<<"$KAFKA_CLIENT_USERS")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"$KAFKA_CLIENT_PASSWORDS")" - # Configure JAAS for each SASL mechanism - # ref: https://docs.confluent.io/platform/current/kafka/authentication_sasl/index.html - for sasl_mechanism in "${sasl_mechanisms_arr[@]}"; do - local jaas_content=() - # For PLAIN mechanism, only the first username will be used - if [[ "$sasl_mechanism" = "PLAIN" ]]; then - jaas_content=("org.apache.kafka.common.security.plain.PlainLoginModule required") - if [[ "$role" = "inter-broker" ]]; then - jaas_content+=( - "username=\"${KAFKA_INTER_BROKER_USER}\"" - "password=\"${KAFKA_INTER_BROKER_PASSWORD}\"" - ) - users+=("$KAFKA_INTER_BROKER_USER") - passwords+=("$KAFKA_INTER_BROKER_PASSWORD") - fi - for ((i = 0; i < ${#users[@]}; i++)); do - jaas_content+=("user_${users[i]}=\"${passwords[i]}\"") - done - # Add semi-colon to the last element of the array - jaas_content[${#jaas_content[@]} - 1]="${jaas_content[${#jaas_content[@]} - 1]};" - elif [[ "$sasl_mechanism" =~ SCRAM ]]; then - if [[ "$role" = "inter-broker" ]]; then - jaas_content=( - "org.apache.kafka.common.security.scram.ScramLoginModule required" - "username=\"${KAFKA_INTER_BROKER_USER}\"" - "password=\"${KAFKA_INTER_BROKER_PASSWORD}\";" - ) - else - jaas_content=("org.apache.kafka.common.security.scram.ScramLoginModule required;") - fi - fi - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - sasl_mechanism_lower="$(echo "$sasl_mechanism" | tr '[:upper:]' '[:lower:]')" - kafka_server_conf_set "listener.name.${listener_lower}.${sasl_mechanism_lower}.sasl.jaas.config" "${jaas_content[*]}" - done - fi -} - -######################## -# Configure Zookeeper JAAS authentication -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_zookeeper_configure_jaas(){ - local jaas_content=( - "org.apache.kafka.common.security.plain.PlainLoginModule required" - "username=\"${KAFKA_ZOOKEEPER_USER}\"" - "password=\"${KAFKA_ZOOKEEPER_PASSWORD}\";" - ) - - kafka_server_conf_set "sasl.jaas.config" "${jaas_content[*]}" -} - -######################## -# Generate JAAS authentication file for local producer/consumer to use -# Globals: -# KAFKA_* -# Arguments: -# $1 - Authentication protocol to use for the internal listener -# $2 - Authentication protocol to use for the client listener -# Returns: -# None -######################### -kafka_configure_consumer_producer_jaas(){ - local jaas_content=() - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - - if [[ "${KAFKA_CFG_SASL_ENABLED_MECHANISMS}" =~ SCRAM ]]; then - jaas_content=("org.apache.kafka.common.security.scram.ScramLoginModule required") - elif [[ "${KAFKA_CFG_SASL_ENABLED_MECHANISMS}" =~ PLAIN ]]; then - jaas_content=("org.apache.kafka.common.security.plain.PlainLoginModule required") - else - error "Couldn't configure a supported SASL mechanism for Kafka consumer/producer properties" - exit 1 - fi - - jaas_content+=( - "username=\"${users[0]}\"" - "password=\"${passwords[0]}\";" - ) - - kafka_producer_consumer_conf_set "sasl.jaas.config" "${jaas_content[*]}" -} - -######################## -# Create users in zookeper when using SASL/SCRAM mechanism -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_zookeeper_create_sasl_scram_users() { - info "Creating users in Zookeeper" - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - local zookeeper_connect - zookeeper_connect=$(grep "^zookeeper.connect=" "$KAFKA_CONF_FILE" | sed -E 's/^zookeeper\.connect=(\S+)$/\1/') - read -r -a zookeeper_hosts <<<"$(tr ',;' ' ' <<<"${zookeeper_connect}")" - - if [[ "${#zookeeper_hosts[@]}" -eq 0 ]]; then - error "Couldn't obtain zookeeper.connect from $KAFKA_CONF_FILE" - exit 1 - fi - # Wait for Zookeeper to be reachable - read -r -a aux <<<"$(tr ':' ' ' <<<"${zookeeper_hosts[0]}")" - local host="${aux[0]:?missing host}" - local port="${aux[1]:-2181}" - wait-for-port --host "$host" "$port" - - # Add interbroker credentials - if grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM" "$KAFKA_CONF_FILE"; then - users+=("${KAFKA_INTER_BROKER_USER}") - passwords+=("${KAFKA_INTER_BROKER_PASSWORD}") - fi - for ((i = 0; i < ${#users[@]}; i++)); do - debug "Creating user ${users[i]} in zookeeper" - # Ref: https://docs.confluent.io/current/kafka/authentication_sasl/authentication_sasl_scram.html#sasl-scram-overview - debug_execute kafka-configs.sh --zookeeper "$zookeeper_connect" --alter --add-config "SCRAM-SHA-256=[iterations=8192,password=${passwords[i]}],SCRAM-SHA-512=[password=${passwords[i]}]" --entity-type users --entity-name "${users[i]}" - done -} - -######################## -# Configure Kafka SSL settings -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_ssl() { - # Configures both Kafka server and producers/consumers - configure_both() { - kafka_server_conf_set "${1:?missing key}" "${2:?missing value}" - kafka_producer_consumer_conf_set "${1:?missing key}" "${2:?missing value}" - } - kafka_server_conf_set "ssl.client.auth" "${KAFKA_TLS_CLIENT_AUTH}" - configure_both ssl.keystore.type "${KAFKA_TLS_TYPE}" - configure_both ssl.truststore.type "${KAFKA_TLS_TYPE}" - local -r kafka_truststore_location="${KAFKA_CERTS_DIR}/$(basename "${KAFKA_TLS_TRUSTSTORE_FILE}")" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.key.password "$KAFKA_CERTIFICATE_PASSWORD" - if [[ "$KAFKA_TLS_TYPE" = "PEM" ]]; then - file_to_multiline_property() { - awk 'NR > 1{print line"\\n\\"}{line=$0;}END{print $0" "}' <"${1:?missing file}" - } - remove_previous_cert_value() { - local key="${1:?missing key}" - files=( - "${KAFKA_CONF_FILE}" - "${KAFKA_CONF_DIR}/producer.properties" - "${KAFKA_CONF_DIR}/consumer.properties" - ) - for file in "${files[@]}"; do - if grep -q "^[#\\s]*$key\s*=.*" "$file"; then - # Delete all lines from the certificate beginning to its end - sed -i "/^[#\\s]*$key\s*=.*-----BEGIN/,/-----END/d" "$file" - fi - done - } - # We need to remove the previous cert value - # kafka_common_conf_set uses replace_in_file, which can't match multiple lines - remove_previous_cert_value ssl.keystore.key - remove_previous_cert_value ssl.keystore.certificate.chain - remove_previous_cert_value ssl.truststore.certificates - configure_both ssl.keystore.key "$(file_to_multiline_property "${KAFKA_CERTS_DIR}/kafka.keystore.key")" - configure_both ssl.keystore.certificate.chain "$(file_to_multiline_property "${KAFKA_CERTS_DIR}/kafka.keystore.pem")" - configure_both ssl.truststore.certificates "$(file_to_multiline_property "${kafka_truststore_location}")" - elif [[ "$KAFKA_TLS_TYPE" = "JKS" ]]; then - configure_both ssl.keystore.location "$KAFKA_CERTS_DIR"/kafka.keystore.jks - configure_both ssl.truststore.location "$kafka_truststore_location" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.keystore.password "$KAFKA_CERTIFICATE_PASSWORD" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.truststore.password "$KAFKA_CERTIFICATE_PASSWORD" - fi - true # Avoid the function to fail due to the check above -} - -######################## -# Get Zookeeper TLS settings -# Globals: -# KAFKA_ZOOKEEPER_TLS_* -# Arguments: -# None -# Returns: -# String -######################### -kafka_zookeeper_configure_tls() { - # Note that ZooKeeper does not support a key password different from the keystore password, - # so be sure to set the key password in the keystore to be identical to the keystore password; - # otherwise the connection attempt to Zookeeper will fail. - local keystore_location="" - local -r kafka_zk_truststore_location="${KAFKA_CERTS_DIR}/$(basename "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE}")" - - if [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "JKS" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" ]]; then - keystore_location="${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" - elif [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" ]]; then - # Concatenating private key into public certificate file - # This is needed to load keystore from location using PEM - keystore_location="${KAFKA_CERTS_DIR}/zookeeper.keypair.pem" - cat "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" > "$keystore_location" - fi - - kafka_server_conf_set "zookeeper.clientCnxnSocket" "org.apache.zookeeper.ClientCnxnSocketNetty" - kafka_server_conf_set "zookeeper.ssl.client.enable" "true" - is_boolean_yes "${KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME:-}" && kafka_server_conf_set "zookeeper.ssl.endpoint.identification.algorithm" "HTTPS" - ! is_empty_value "${keystore_location:-}" && kafka_server_conf_set "zookeeper.ssl.keystore.location" "${keystore_location}" - ! is_empty_value "${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD:-}" && kafka_server_conf_set "zookeeper.ssl.keystore.password" "${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD}" - ! is_empty_value "${kafka_zk_truststore_location:-}" && kafka_server_conf_set "zookeeper.ssl.truststore.location" "${kafka_zk_truststore_location}" - ! is_empty_value "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD:-}" && kafka_server_conf_set "zookeeper.ssl.truststore.password" "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD}" - true # Avoid the function to fail due to the check above -} - -######################## -# Configure Kafka configuration files from environment variables -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_from_environment_variables() { - # List of special cases to apply to the variables - local -r exception_regexps=( - "s/sasl\.ssl/sasl_ssl/g" - "s/sasl\.plaintext/sasl_plaintext/g" - ) - # Map environment variables to config properties - for var in "${!KAFKA_CFG_@}"; do - key="$(echo "$var" | sed -e 's/^KAFKA_CFG_//g' -e 's/_/\./g' | tr '[:upper:]' '[:lower:]')" - - # Exception for the camel case in this environment variable - [[ "$var" == "KAFKA_CFG_ZOOKEEPER_CLIENTCNXNSOCKET" ]] && key="zookeeper.clientCnxnSocket" - - # Apply exception regexps - for regex in "${exception_regexps[@]}"; do - key="$(echo "$key" | sed "$regex")" - done - - value="${!var}" - kafka_server_conf_set "$key" "$value" - done -} - -######################## -# Initialize KRaft storage -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_kraft_storage_initialize() { - local args=("--config" "$KAFKA_CONF_FILE" "--ignore-formatted") - info "Initializing KRaft storage metadata" - - # If cluster.id found in meta.properties, use it - if [[ -f "${KAFKA_DATA_DIR}/meta.properties" ]]; then - KAFKA_KRAFT_CLUSTER_ID=$(grep "^cluster.id=" "${KAFKA_DATA_DIR}/meta.properties" | sed -E 's/^cluster\.id=(\S+)$/\1/') - fi - - if is_empty_value "${KAFKA_KRAFT_CLUSTER_ID:-}"; then - warn "KAFKA_KRAFT_CLUSTER_ID not set - If using multiple nodes then you must use the same Cluster ID for each one" - KAFKA_KRAFT_CLUSTER_ID="$("${KAFKA_HOME}/bin/kafka-storage.sh" random-uuid)" - info "Generated Kafka cluster ID '${KAFKA_KRAFT_CLUSTER_ID}'" - fi - args+=("--cluster-id=$KAFKA_KRAFT_CLUSTER_ID") - - # SCRAM users are configured during the cluster bootstrapping process and can later be manually updated using kafka-config.sh - if is_boolean_yes "${KAFKA_KRAFT_BOOTSTRAP_SCRAM_USERS:-}"; then - info "Adding KRaft SCRAM users at storage bootstrap" - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - # Configure SCRAM-SHA-256 if enabled - if grep -Eq "^sasl.enabled.mechanisms=.*SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - for ((i = 0; i < ${#users[@]}; i++)); do - args+=("--add-scram" "SCRAM-SHA-256=[name=${users[i]},password=${passwords[i]}]") - done - fi - # Configure SCRAM-SHA-512 if enabled - if grep -Eq "^sasl.enabled.mechanisms=.*SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - for ((i = 0; i < ${#users[@]}; i++)); do - args+=("--add-scram" "SCRAM-SHA-512=[name=${users[i]},password=${passwords[i]}]") - done - fi - # Add interbroker credentials - if grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-256=[name=${KAFKA_INTER_BROKER_USER},password=${KAFKA_INTER_BROKER_PASSWORD}]") - elif grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-512=[name=${KAFKA_INTER_BROKER_USER},password=${KAFKA_INTER_BROKER_PASSWORD}]") - fi - # Add controller credentials - if grep -Eq "^sasl.mechanism.controller.protocol=SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-256=[name=${KAFKA_CONTROLLER_USER},password=${KAFKA_CONTROLLER_PASSWORD}]") - elif grep -Eq "^sasl.mechanism.controller.protocol=SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-512=[name=${KAFKA_CONTROLLER_USER},password=${KAFKA_CONTROLLER_PASSWORD}]") - fi - fi - info "Formatting storage directories to add metadata..." - "${KAFKA_HOME}/bin/kafka-storage.sh" format "${args[@]}" -} - -######################## -# Detects inconsitences between the configuration at KAFKA_CONF_FILE and cluster-state file -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_kraft_quorum_voters_changed(){ - read -r -a quorum_voters_conf_ids <<<"$(grep "^controller.quorum.voters=" "$KAFKA_CONF_FILE" | sed "s/^controller.quorum.voters=//" | tr "," " " | sed -E "s/\@\S+//g")" - read -r -a quorum_voters_state_ids <<< "$(grep -Eo "\{\"voterId\":[0-9]+\}" "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" | grep -Eo "[0-9]+" | tr "\n" " ")" - - if [[ "${#quorum_voters_conf_ids[@]}" != "${#quorum_voters_state_ids[@]}" ]]; then - true - else - read -r -a sorted_state <<< "$(echo "${quorum_voters_conf_ids[@]}" | tr ' ' '\n' | sort | tr '\n' ' ')" - read -r -a sorted_conf <<< "$(echo "${quorum_voters_state_ids[@]}" | tr ' ' '\n' | sort | tr '\n' ' ')" - if [[ "${sorted_state[*]}" = "${sorted_conf[*]}" ]]; then - false - else - true - fi - fi -} - -######################## -# Initialize Kafka -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_initialize() { - info "Initializing Kafka..." - # Check for mounted configuration files - if ! is_dir_empty "$KAFKA_MOUNTED_CONF_DIR"; then - cp -Lr "$KAFKA_MOUNTED_CONF_DIR"/* "$KAFKA_CONF_DIR" - fi - # Copy truststore to cert directory - for cert_var in KAFKA_TLS_TRUSTSTORE_FILE KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE; do - # Only copy if the file exists and it is in a different location than KAFKA_CERTS_DIR (to avoid copying to the same location) - if [[ -f "${!cert_var}" ]] && ! [[ "${!cert_var}" =~ $KAFKA_CERTS_DIR ]]; then - info "Copying truststore ${!cert_var} to ${KAFKA_CERTS_DIR}" - cp -L "${!cert_var}" "$KAFKA_CERTS_DIR" - fi - done - - if [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/server.properties" ]]; then - info "No injected configuration files found, creating default config files" - # Restore original server.properties but remove Zookeeper/KRaft specific settings for compatibility with both architectures - cp "${KAFKA_CONF_DIR}/server.properties.original" "$KAFKA_CONF_FILE" - kafka_server_unify_conf - # Configure Kafka settings - kafka_server_conf_set log.dirs "$KAFKA_DATA_DIR" - kafka_configure_from_environment_variables - # Configure Kafka producer/consumer to set up message sizes - ! is_empty_value "${KAFKA_CFG_MAX_REQUEST_SIZE:-}" && kafka_common_conf_set "$KAFKA_CONF_DIR/producer.properties" max.request.size "$KAFKA_CFG_MAX_REQUEST_SIZE" - ! is_empty_value "${KAFKA_CFG_MAX_PARTITION_FETCH_BYTES:-}" && kafka_common_conf_set "$KAFKA_CONF_DIR/consumer.properties" max.partition.fetch.bytes "$KAFKA_CFG_MAX_PARTITION_FETCH_BYTES" - # Zookeeper mode additional settings - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SSL ]]; then - kafka_zookeeper_configure_tls - fi - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SASL ]]; then - kafka_zookeeper_configure_jaas - fi - fi - # If at least one listener uses SSL or SASL_SSL, ensure SSL is configured - if kafka_has_ssl_listener; then - kafka_configure_ssl - fi - # If at least one listener uses SASL_PLAINTEXT or SASL_SSL, ensure SASL is configured - if kafka_has_sasl_listener; then - if [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM ]]; then - if ! is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}"; then - if [[ "$(kafka_get_version)" =~ ^3\.2\.|^3\.3\.|^3\.4\. ]]; then - # NOTE: This will depend on Kafka version when support for SCRAM is added - warn "KRaft mode requires Kafka version 3.5 or higher for SCRAM to be supported. SCRAM SASL mechanisms will now be disabled." - KAFKA_CFG_SASL_ENABLED_MECHANISMS=PLAIN - else - export KAFKA_KRAFT_BOOTSTRAP_SCRAM_USERS="true" - fi - fi - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - export KAFKA_ZOOKEEPER_BOOTSTRAP_SCRAM_USERS="true" - fi - fi - kafka_server_conf_set sasl.enabled.mechanisms "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" - fi - # Settings for each Kafka Listener are configured individually - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - - if [[ "$protocol" = "SSL" || "$protocol" = "SASL_SSL" ]]; then - listener_upper="$(echo "$listener" | tr '[:lower:]' '[:upper:]')" - env_name="KAFKA_TLS_${listener_upper}_CLIENT_AUTH" - [[ -n "${!env_name:-}" ]] && kafka_server_conf_set "listener.name.${listener_lower}.ssl.client.auth" "${!env_name}" - fi - if [[ "$protocol" = "SASL_PLAINTEXT" || "$protocol" = "SASL_SSL" ]]; then - local role="" - if [[ "$listener" = "${KAFKA_CFG_INTER_BROKER_LISTENER_NAME:-INTERNAL}" ]]; then - kafka_server_conf_set sasl.mechanism.inter.broker.protocol "$KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL" - role="inter-broker" - elif [[ "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-CONTROLLER}" =~ $listener ]]; then - kafka_server_conf_set sasl.mechanism.controller.protocol "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - kafka_server_conf_set "listener.name.${listener_lower}.sasl.enabled.mechanisms" "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - role="controller" - fi - # If KAFKA_CLIENT_LISTENER_NAME is found in the listeners list, configure the producer/consumer accordingly - if [[ "$listener" = "${KAFKA_CLIENT_LISTENER_NAME:-CLIENT}" ]]; then - kafka_configure_consumer_producer_jaas - kafka_producer_consumer_conf_set security.protocol "$protocol" - kafka_producer_consumer_conf_set sasl.mechanism "${KAFKA_CLIENT_SASL_MECHANISM:-$(kafka_client_sasl_mechanism)}" - fi - # Configure inline listener jaas configuration, omitted if mounted JAAS conf file detected - if [[ ! -f "${KAFKA_CONF_DIR}/kafka_jaas.conf" ]]; then - kafka_configure_server_jaas "$listener_lower" "${role:-}" - fi - fi - done - # Configure Kafka using environment variables - # This is executed at the end, to allow users to override properties set by the initialization logic - kafka_configure_from_environment_variables - else - info "Detected mounted server.properties file at ${KAFKA_MOUNTED_CONF_DIR}/server.properties. Skipping configuration based on env variables" - fi - true -} - -######################## -# Returns the most secure SASL mechanism available for Kafka clients -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################## -kafka_client_sasl_mechanism() { - local sasl_mechanism="" - - if [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM-SHA-512 ]]; then - sasl_mechanism="SCRAM-SHA-512" - elif [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM-SHA-256 ]]; then - sasl_mechanism="SCRAM-SHA-256" - elif [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ PLAIN ]]; then - sasl_mechanism="PLAIN" - fi - echo "$sasl_mechanism" -} - -######################## -# Removes default settings referencing Zookeeper mode or KRaft mode -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################## -kafka_server_unify_conf() { - local -r remove_regexps=( - #Zookeeper - "s/^zookeeper\./#zookeeper./g" - "s/^group\.initial/#group.initial/g" - "s/^broker\./#broker./g" - "s/^node\./#node./g" - "s/^process\./#process./g" - "s/^listeners=/#listeners=/g" - "s/^listener\./#listener./g" - "s/^controller\./#controller./g" - "s/^inter\.broker/#inter.broker/g" - "s/^advertised\.listeners/#advertised.listeners/g" - ) - - # Map environment variables to config properties - for regex in "${remove_regexps[@]}"; do - sed -i "${regex}" "$KAFKA_CONF_FILE" - done -} - -######################## -# Dinamically set node.id/broker.id/controller.quorum.voters if their alternative environment variable _COMMAND is set -# Globals: -# KAFKA_*_COMMAND -# Arguments: -# None -# Returns: -# None -######################### -kafka_dynamic_environment_variables() { - # KRaft mode - if ! is_empty_value "${KAFKA_NODE_ID_COMMAND:-}"; then - KAFKA_CFG_NODE_ID="$(eval "${KAFKA_NODE_ID_COMMAND}")" - export KAFKA_CFG_NODE_ID - fi - if ! is_empty_value "${KAFKA_CONTROLLER_QUORUM_VOTERS_COMMAND:-}"; then - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS="$(eval "${KAFKA_CONTROLLER_QUORUM_VOTERS_COMMAND}")" - export KAFKA_CFG_CONTROLLER_QUORUM_VOTERS - fi - # Zookeeper mode - # DEPRECATED - BROKER_ID_COMMAND has been deprecated, please use KAFKA_BROKER_ID_COMMAND instead - if ! is_empty_value "${KAFKA_BROKER_ID_COMMAND:-}"; then - KAFKA_CFG_BROKER_ID="$(eval "${KAFKA_BROKER_ID_COMMAND}")" - export KAFKA_CFG_BROKER_ID - elif ! is_empty_value "${BROKER_ID_COMMAND:-}"; then - KAFKA_CFG_BROKER_ID="$(eval "${BROKER_ID_COMMAND}")" - export KAFKA_CFG_BROKER_ID - fi -} - -######################## -# Run custom initialization scripts -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_custom_init_scripts() { - if [[ -n $(find "${KAFKA_INITSCRIPTS_DIR}/" -type f -regex ".*\.\(sh\)") ]] && [[ ! -f "${KAFKA_VOLUME_DIR}/.user_scripts_initialized" ]]; then - info "Loading user's custom files from $KAFKA_INITSCRIPTS_DIR" - for f in /docker-entrypoint-initdb.d/*; do - debug "Executing $f" - case "$f" in - *.sh) - if [[ -x "$f" ]]; then - if ! "$f"; then - error "Failed executing $f" - return 1 - fi - else - warn "Sourcing $f as it is not executable by the current user, any error may cause initialization to fail" - . "$f" - fi - ;; - *) - warn "Skipping $f, supported formats are: .sh" - ;; - esac - done - touch "$KAFKA_VOLUME_DIR"/.user_scripts_initialized - fi -} - -######################## -# Check if Kafka is running -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# Whether Kafka is running -######################## -is_kafka_running() { - local pid - pid="$(get_pid_from_file "$KAFKA_PID_FILE")" - if [[ -n "$pid" ]]; then - is_service_running "$pid" - else - false - fi -} - -######################## -# Check if Kafka is running -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# Whether Kafka is not running -######################## -is_kafka_not_running() { - ! is_kafka_running -} - -######################## -# Stop Kafka -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# None -######################### -kafka_stop() { - ! is_kafka_running && return - stop_service_using_pid "$KAFKA_PID_FILE" TERM -} diff --git a/bitnami/kafka/3.5/debian-12/tags-info.yaml b/bitnami/kafka/3.5/debian-12/tags-info.yaml deleted file mode 100644 index 2ed2b4982663e..0000000000000 --- a/bitnami/kafka/3.5/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "3.5" -- 3.5-debian-12 -- 3.5.2 diff --git a/bitnami/kafka/3.6/README.md b/bitnami/kafka/3.6/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/kafka/3.6/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/kafka/3.6/debian-12/Dockerfile b/bitnami/kafka/3.6/debian-12/Dockerfile deleted file mode 100644 index 7214f6e189ba3..0000000000000 --- a/bitnami/kafka/3.6/debian-12/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T21:52:36Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/kafka/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="3.6.2-debian-12-r17" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/kafka" \ - org.opencontainers.image.title="kafka" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="3.6.2" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "wait-for-port-1.0.8-8-linux-${OS_ARCH}-debian-12" \ - "render-template-1.0.7-8-linux-${OS_ARCH}-debian-12" \ - "java-17.0.13-12-1-linux-${OS_ARCH}-debian-12" \ - "kafka-3.6.2-3-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN ln -s /opt/bitnami/scripts/kafka/entrypoint.sh /entrypoint.sh -RUN ln -s /opt/bitnami/scripts/kafka/run.sh /run.sh - -COPY rootfs / -RUN /opt/bitnami/scripts/java/postunpack.sh -RUN /opt/bitnami/scripts/kafka/postunpack.sh -ENV APP_VERSION="3.6.2" \ - BITNAMI_APP_NAME="kafka" \ - JAVA_HOME="/opt/bitnami/java" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/java/bin:/opt/bitnami/kafka/bin:$PATH" - -EXPOSE 9092 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/kafka/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/kafka/run.sh" ] diff --git a/bitnami/kafka/3.6/debian-12/docker-compose-cluster.yml b/bitnami/kafka/3.6/debian-12/docker-compose-cluster.yml deleted file mode 100644 index fb2284c658293..0000000000000 --- a/bitnami/kafka/3.6/debian-12/docker-compose-cluster.yml +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - kafka-0: - image: docker.io/bitnami/kafka:3.6 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=0 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_0_data:/bitnami/kafka - kafka-1: - image: docker.io/bitnami/kafka:3.6 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=1 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_1_data:/bitnami/kafka - kafka-2: - image: docker.io/bitnami/kafka:3.6 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=2 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_2_data:/bitnami/kafka - -volumes: - kafka_0_data: - driver: local - kafka_1_data: - driver: local - kafka_2_data: - driver: local diff --git a/bitnami/kafka/3.6/debian-12/docker-compose.yml b/bitnami/kafka/3.6/debian-12/docker-compose.yml deleted file mode 100644 index 998c6525bb6fe..0000000000000 --- a/bitnami/kafka/3.6/debian-12/docker-compose.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - kafka: - image: docker.io/bitnami/kafka:3.6 - ports: - - "9092:9092" - volumes: - - "kafka_data:/bitnami" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=0 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093 - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT -volumes: - kafka_data: - driver: local diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 530df3102ba9c..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "17.0.13-12-1" - }, - "kafka": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "3.6.2-3" - }, - "render-template": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.7-8" - }, - "wait-for-port": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.8-8" - } -} \ No newline at end of file diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/kafka/3.6/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/kafka/3.6/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/kafka/3.6/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/kafka/3.6/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 38802fc0bfe91..0000000000000 --- a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -if [[ "$OS_FLAVOUR" =~ photon && "$APP_VERSION" =~ ^1.8 ]]; then - # Option --module-path is not supported by JAVA 1.8 since modules were added in version 1.9 - unset JAVA_TOOL_OPTIONS -fi - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh b/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh deleted file mode 100644 index e1621b93e8083..0000000000000 --- a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for kafka - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-kafka}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -kafka_env_vars=( - KAFKA_MOUNTED_CONF_DIR - KAFKA_INTER_BROKER_USER - KAFKA_INTER_BROKER_PASSWORD - KAFKA_CONTROLLER_USER - KAFKA_CONTROLLER_PASSWORD - KAFKA_CERTIFICATE_PASSWORD - KAFKA_TLS_TRUSTSTORE_FILE - KAFKA_TLS_TYPE - KAFKA_TLS_CLIENT_AUTH - KAFKA_OPTS - KAFKA_CFG_SASL_ENABLED_MECHANISMS - KAFKA_KRAFT_CLUSTER_ID - KAFKA_SKIP_KRAFT_STORAGE_INIT - KAFKA_CLIENT_LISTENER_NAME - KAFKA_ZOOKEEPER_PROTOCOL - KAFKA_ZOOKEEPER_PASSWORD - KAFKA_ZOOKEEPER_USER - KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD - KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD - KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE - KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME - KAFKA_ZOOKEEPER_TLS_TYPE - KAFKA_CLIENT_USERS - KAFKA_CLIENT_PASSWORDS - KAFKA_HEAP_OPTS - JAVA_TOOL_OPTIONS -) -for env_var in "${kafka_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset kafka_env_vars - -# Paths -export KAFKA_BASE_DIR="${BITNAMI_ROOT_DIR}/kafka" -export KAFKA_VOLUME_DIR="/bitnami/kafka" -export KAFKA_DATA_DIR="${KAFKA_VOLUME_DIR}/data" -export KAFKA_CONF_DIR="${KAFKA_BASE_DIR}/config" -export KAFKA_CONF_FILE="${KAFKA_CONF_DIR}/server.properties" -export KAFKA_MOUNTED_CONF_DIR="${KAFKA_MOUNTED_CONF_DIR:-${KAFKA_VOLUME_DIR}/config}" -export KAFKA_CERTS_DIR="${KAFKA_CONF_DIR}/certs" -export KAFKA_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d" -export KAFKA_LOG_DIR="${KAFKA_BASE_DIR}/logs" -export KAFKA_HOME="$KAFKA_BASE_DIR" -export PATH="${KAFKA_BASE_DIR}/bin:${BITNAMI_ROOT_DIR}/java/bin:${PATH}" - -# System users (when running with a privileged user) -export KAFKA_DAEMON_USER="kafka" -export KAFKA_DAEMON_GROUP="kafka" - -# Kafka runtime settings -export KAFKA_INTER_BROKER_USER="${KAFKA_INTER_BROKER_USER:-user}" -export KAFKA_INTER_BROKER_PASSWORD="${KAFKA_INTER_BROKER_PASSWORD:-bitnami}" -export KAFKA_CONTROLLER_USER="${KAFKA_CONTROLLER_USER:-controller_user}" -export KAFKA_CONTROLLER_PASSWORD="${KAFKA_CONTROLLER_PASSWORD:-bitnami}" -export KAFKA_CERTIFICATE_PASSWORD="${KAFKA_CERTIFICATE_PASSWORD:-}" -export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_TLS_TRUSTSTORE_FILE:-}" -export KAFKA_TLS_TYPE="${KAFKA_TLS_TYPE:-JKS}" -export KAFKA_TLS_CLIENT_AUTH="${KAFKA_TLS_CLIENT_AUTH:-required}" -export KAFKA_OPTS="${KAFKA_OPTS:-}" - -# Kafka configuration overrides -export KAFKA_CFG_SASL_ENABLED_MECHANISMS="${KAFKA_CFG_SASL_ENABLED_MECHANISMS:-PLAIN,SCRAM-SHA-256,SCRAM-SHA-512}" -export KAFKA_KRAFT_CLUSTER_ID="${KAFKA_KRAFT_CLUSTER_ID:-}" -export KAFKA_SKIP_KRAFT_STORAGE_INIT="${KAFKA_SKIP_KRAFT_STORAGE_INIT:-false}" -export KAFKA_CLIENT_LISTENER_NAME="${KAFKA_CLIENT_LISTENER_NAME:-}" - -# ZooKeeper connection settings -export KAFKA_ZOOKEEPER_PROTOCOL="${KAFKA_ZOOKEEPER_PROTOCOL:-PLAINTEXT}" -export KAFKA_ZOOKEEPER_PASSWORD="${KAFKA_ZOOKEEPER_PASSWORD:-}" -export KAFKA_ZOOKEEPER_USER="${KAFKA_ZOOKEEPER_USER:-}" -export KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD="${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD:-}" -export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD="${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD:-}" -export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE:-}" -export KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME="${KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME:-true}" -export KAFKA_ZOOKEEPER_TLS_TYPE="${KAFKA_ZOOKEEPER_TLS_TYPE:-JKS}" - -# Authentication -export KAFKA_CLIENT_USERS="${KAFKA_CLIENT_USERS:-user}" -export KAFKA_CLIENT_PASSWORDS="${KAFKA_CLIENT_PASSWORDS:-bitnami}" - -# Java settings -export KAFKA_HEAP_OPTS="${KAFKA_HEAP_OPTS:--Xmx1024m -Xms1024m}" - -# Java settings -export JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS:-}" - -# Custom environment variables may be defined below diff --git a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh b/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh deleted file mode 100755 index d7413bcfc4f33..0000000000000 --- a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libkafka.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -print_welcome_page - -if [[ "$*" = *"/opt/bitnami/scripts/kafka/run.sh"* || "$*" = *"/run.sh"* ]]; then - info "** Starting Kafka setup **" - /opt/bitnami/scripts/kafka/setup.sh - info "** Kafka setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh b/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh deleted file mode 100755 index 7255563236c0b..0000000000000 --- a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libkafka.sh -. /opt/bitnami/scripts/libfs.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -# Move server.properties from configtmp to config -# Temporary solution until kafka tarball places server.properties into config -if [[ -d "${KAFKA_BASE_DIR}/configtmp" ]]; then - mv "${KAFKA_BASE_DIR}/configtmp"/* "$KAFKA_CONF_DIR" - rmdir "${KAFKA_BASE_DIR}/configtmp" -fi -[[ -d "${KAFKA_BASE_DIR}/conf" ]] && rmdir "${KAFKA_BASE_DIR}/conf" - -# Ensure directories used by Kafka exist and have proper ownership and permissions -for dir in "$KAFKA_LOG_DIR" "$KAFKA_CONF_DIR" "$KAFKA_MOUNTED_CONF_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR" "$KAFKA_INITSCRIPTS_DIR"; do - ensure_dir_exists "$dir" -done -chmod -R g+rwX "$KAFKA_BASE_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR" "$KAFKA_INITSCRIPTS_DIR" - -# Move the original server.properties, so users can skip initialization logic by mounting their own server.properties directly instead of using the MOUNTED_CONF_DIR -mv "${KAFKA_CONF_DIR}/server.properties" "${KAFKA_CONF_DIR}/server.properties.original" - -# Disable logging to stdout and garbage collection -# Source: https://logging.apache.org/log4j/log4j-2.4/manual/appenders.html -replace_in_file "${KAFKA_BASE_DIR}/bin/kafka-server-start.sh" " [-]loggc" " " -replace_in_file "${KAFKA_CONF_DIR}/log4j.properties" "DailyRollingFileAppender" "ConsoleAppender" - -# Disable the default console logger in favour of KafkaAppender (which provides the exact output) -echo "log4j.appender.stdout.Threshold=OFF" >>"${KAFKA_CONF_DIR}/log4j.properties" - -# Remove invalid parameters for ConsoleAppender -remove_in_file "${KAFKA_CONF_DIR}/log4j.properties" "DatePattern" -remove_in_file "${KAFKA_CONF_DIR}/log4j.properties" "Appender.File" diff --git a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh b/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh deleted file mode 100755 index 76d4380aff57e..0000000000000 --- a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libkafka.sh -. /opt/bitnami/scripts/libos.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -if [[ -f "${KAFKA_CONF_DIR}/kafka_jaas.conf" ]]; then - export KAFKA_OPTS="${KAFKA_OPTS:-} -Djava.security.auth.login.config=${KAFKA_CONF_DIR}/kafka_jaas.conf" -fi - -cmd="$KAFKA_HOME/bin/kafka-server-start.sh" -args=("$KAFKA_CONF_FILE") -! is_empty_value "${KAFKA_EXTRA_FLAGS:-}" && args=("${args[@]}" "${KAFKA_EXTRA_FLAGS[@]}") - -info "** Starting Kafka **" -if am_i_root; then - exec_as_user "$KAFKA_DAEMON_USER" "$cmd" "${args[@]}" "$@" -else - exec "$cmd" "${args[@]}" "$@" -fi diff --git a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh b/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh deleted file mode 100755 index 5195f71910176..0000000000000 --- a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libkafka.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -# Map Kafka environment variables -kafka_create_alias_environment_variables - -# Dinamically set node.id/broker.id/controller.quorum.voters if the _COMMAND environment variable is set -kafka_dynamic_environment_variables - -# Set the default tuststore locations before validation -kafka_configure_default_truststore_locations -# Ensure Kafka user and group exist when running as 'root' -am_i_root && ensure_user_exists "$KAFKA_DAEMON_USER" --group "$KAFKA_DAEMON_GROUP" -# Ensure directories used by Kafka exist and have proper ownership and permissions -for dir in "$KAFKA_LOG_DIR" "$KAFKA_CONF_DIR" "$KAFKA_MOUNTED_CONF_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR"; do - if am_i_root; then - ensure_dir_exists "$dir" "$KAFKA_DAEMON_USER" "$KAFKA_DAEMON_GROUP" - else - ensure_dir_exists "$dir" - fi -done - -# Kafka validation, skipped if server.properties was mounted at either $KAFKA_MOUNTED_CONF_DIR or $KAFKA_CONF_DIR -[[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/server.properties" && ! -f "$KAFKA_CONF_FILE" ]] && kafka_validate -# Kafka initialization, skipped if server.properties was mounted at $KAFKA_CONF_DIR -[[ ! -f "$KAFKA_CONF_FILE" ]] && kafka_initialize - -# Initialise KRaft metadata storage if process.roles configured -if grep -q "^process.roles=" "$KAFKA_CONF_FILE" && ! is_boolean_yes "$KAFKA_SKIP_KRAFT_STORAGE_INIT" ; then - kafka_kraft_storage_initialize -fi -# Configure Zookeeper SCRAM users -if is_boolean_yes "${KAFKA_ZOOKEEPER_BOOTSTRAP_SCRAM_USERS:-}"; then - kafka_zookeeper_create_sasl_scram_users -fi -# KRaft controllers may get stuck starting when the controller quorum voters are changed. -# Workaround: Remove quorum-state file when scaling up/down controllers (Waiting proposal KIP-853) -# https://cwiki.apache.org/confluence/display/KAFKA/KIP-853%3A+KRaft+Voter+Changes -if [[ -f "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" ]] && grep -q "^controller.quorum.voters=" "$KAFKA_CONF_FILE" && kafka_kraft_quorum_voters_changed; then - warn "Detected inconsitences between controller.quorum.voters and quorum-state, removing it..." - rm -f "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" -fi -# Ensure custom initialization scripts are executed -kafka_custom_init_scripts diff --git a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh b/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh deleted file mode 100644 index df2459b035778..0000000000000 --- a/bitnami/kafka/3.6/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh +++ /dev/null @@ -1,1176 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Kafka library - -# shellcheck disable=SC1090,SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libservice.sh - -# Functions - -######################## -# Set a configuration setting value to a file -# Globals: -# None -# Arguments: -# $1 - file -# $2 - key -# $3 - values (array) -# Returns: -# None -######################### -kafka_common_conf_set() { - local file="${1:?missing file}" - local key="${2:?missing key}" - shift - shift - local values=("$@") - - if [[ "${#values[@]}" -eq 0 ]]; then - stderr_print "missing value" - return 1 - elif [[ "${#values[@]}" -ne 1 ]]; then - for i in "${!values[@]}"; do - kafka_common_conf_set "$file" "${key[$i]}" "${values[$i]}" - done - else - value="${values[0]}" - # Check if the value was set before - if grep -q "^[#\\s]*$key\s*=.*" "$file"; then - # Update the existing key - replace_in_file "$file" "^[#\\s]*${key}\s*=.*" "${key}=${value}" false - else - # Add a new key - printf '\n%s=%s' "$key" "$value" >>"$file" - fi - fi -} - -######################## -# Returns true if at least one listener is configured using SSL -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_ssl_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENERS:-}"; then - if is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - if [[ "$KAFKA_CFG_LISTENERS" =~ SSL: || "$KAFKA_CFG_LISTENERS" =~ SASL_SSL: ]]; then - return - fi - else - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "SSL" || "$protocol" = "SASL_SSL" ]]; then - if [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - fi - fi - return 1 -} - -######################## -# Returns true if at least one listener is configured using SASL -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_sasl_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENERS:-}"; then - if is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - if [[ "$KAFKA_CFG_LISTENERS" =~ SASL_PLAINTEXT: ]] || [[ "$KAFKA_CFG_LISTENERS" =~ SASL_SSL: ]]; then - return - fi - else - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "SASL_PLAINTEXT" || "$protocol" = "SASL_SSL" ]]; then - if [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - fi - fi - return 1 -} - -######################## -# Returns true if at least one listener is configured using plaintext -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_plaintext_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "PLAINTEXT" ]]; then - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - else - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ "$KAFKA_CFG_LISTENERS" =~ PLAINTEXT: ]]; then - return - fi - fi - return 1 -} - -######################## -# Backwards compatibility measure to configure the TLS truststore locations -# Globals: -# KAFKA_CONF_FILE -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_default_truststore_locations() { - # Backwards compatibility measure to allow custom truststore locations but at the same time not disrupt - # the UX that the previous version of the containers and the helm chart have. - # Context: The chart and containers by default assumed that the truststore location was KAFKA_CERTS_DIR/kafka.truststore.jks or KAFKA_MOUNTED_CONF_DIR/certs/kafka.truststore.jks. - # Because of this, we could not use custom certificates in different locations (use case: A custom base image that already has a truststore). Changing the logic to allow custom - # locations implied major changes in the current user experience (which only required to mount certificates at the assumed location). In order to maintain this compatibility we need - # use this logic that sets the KAFKA_TLS_*_FILE variables to the previously assumed locations in case it is not set - - # Kafka truststore - if kafka_has_ssl_listener && is_empty_value "${KAFKA_TLS_TRUSTSTORE_FILE:-}"; then - local kafka_truststore_filename="kafka.truststore.jks" - [[ "$KAFKA_TLS_TYPE" = "PEM" ]] && kafka_truststore_filename="kafka.truststore.pem" - if [[ -f "${KAFKA_CERTS_DIR}/${kafka_truststore_filename}" ]]; then - # Mounted in /opt/bitnami/kafka/conf/certs - export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_CERTS_DIR}/${kafka_truststore_filename}" - else - # Mounted in /bitnami/kafka/conf/certs - export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_MOUNTED_CONF_DIR}/certs/${kafka_truststore_filename}" - fi - fi - # Zookeeper truststore - if [[ "${KAFKA_ZOOKEEPER_PROTOCOL:-}" =~ SSL ]] && is_empty_value "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE:-}"; then - local zk_truststore_filename="zookeeper.truststore.jks" - [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]] && zk_truststore_filename="zookeeper.truststore.pem" - if [[ -f "${KAFKA_CERTS_DIR}/${zk_truststore_filename}" ]]; then - # Mounted in /opt/bitnami/kafka/conf/certs - export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_CERTS_DIR}/${zk_truststore_filename}" - else - # Mounted in /bitnami/kafka/conf/certs - export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_MOUNTED_CONF_DIR}/certs/${zk_truststore_filename}" - fi - fi -} - -######################## -# Set a configuration setting value to server.properties -# Globals: -# KAFKA_CONF_FILE -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -kafka_server_conf_set() { - kafka_common_conf_set "$KAFKA_CONF_FILE" "$@" -} - -######################## -# Set a configuration setting value to producer.properties and consumer.properties -# Globals: -# KAFKA_CONF_DIR -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -kafka_producer_consumer_conf_set() { - kafka_common_conf_set "$KAFKA_CONF_DIR/producer.properties" "$@" - kafka_common_conf_set "$KAFKA_CONF_DIR/consumer.properties" "$@" -} - -######################## -# Create alias for environment variable, so both can be used -# Globals: -# None -# Arguments: -# $1 - Alias environment variable name -# $2 - Original environment variable name -# Returns: -# None -######################### -kafka_declare_alias_env() { - local -r alias="${1:?missing environment variable alias}" - local -r original="${2:?missing original environment variable}" - if printenv "${original}" >/dev/null; then - export "$alias"="${!original:-}" - fi -} - -######################## -# Map Kafka legacy environment variables to the new names -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_create_alias_environment_variables() { - suffixes=( - "ADVERTISED_LISTENERS" - "BROKER_ID" - "NODE_ID" - "CONTROLLER_QUORUM_VOTERS" - "PROCESS_ROLES" - "DEFAULT_REPLICATION_FACTOR" - "DELETE_TOPIC_ENABLE" - "INTER_BROKER_LISTENER_NAME" - "LISTENERS" - "LISTENER_SECURITY_PROTOCOL_MAP" - "LOG_DIRS" - "LOG_FLUSH_INTERVAL_MESSAGES" - "LOG_FLUSH_INTERVAL_MS" - "LOG_MESSAGE_FORMAT_VERSION" - "LOG_RETENTION_BYTES" - "LOG_RETENTION_CHECK_INTERVALS_MS" - "LOG_RETENTION_HOURS" - "LOG_SEGMENT_BYTES" - "MESSAGE_MAX_BYTES" - "NUM_IO_THREADS" - "NUM_NETWORK_THREADS" - "NUM_PARTITIONS" - "NUM_RECOVERY_THREADS_PER_DATA_DIR" - "OFFSETS_TOPIC_REPLICATION_FACTOR" - "SOCKET_RECEIVE_BUFFER_BYTES" - "SOCKET_REQUEST_MAX_BYTES" - "SOCKET_SEND_BUFFER_BYTES" - "SSL_ENDPOINT_IDENTIFICATION_ALGORITHM" - "TRANSACTION_STATE_LOG_MIN_ISR" - "TRANSACTION_STATE_LOG_REPLICATION_FACTOR" - "ZOOKEEPER_CONNECT" - "ZOOKEEPER_CONNECTION_TIMEOUT_MS" - ) - kafka_declare_alias_env "KAFKA_CFG_LOG_DIRS" "KAFKA_LOGS_DIRS" - kafka_declare_alias_env "KAFKA_CFG_LOG_SEGMENT_BYTES" "KAFKA_SEGMENT_BYTES" - kafka_declare_alias_env "KAFKA_CFG_MESSAGE_MAX_BYTES" "KAFKA_MAX_MESSAGE_BYTES" - kafka_declare_alias_env "KAFKA_CFG_ZOOKEEPER_CONNECTION_TIMEOUT_MS" "KAFKA_ZOOKEEPER_CONNECT_TIMEOUT_MS" - kafka_declare_alias_env "KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE" "KAFKA_AUTO_CREATE_TOPICS_ENABLE" - kafka_declare_alias_env "KAFKA_CLIENT_USERS" "KAFKA_BROKER_USER" - kafka_declare_alias_env "KAFKA_CLIENT_PASSWORDS" "KAFKA_BROKER_PASSWORD" - kafka_declare_alias_env "KAFKA_CLIENT_LISTENER_NAME" "KAFKA_CLIENT_LISTENER" - for s in "${suffixes[@]}"; do - kafka_declare_alias_env "KAFKA_CFG_${s}" "KAFKA_${s}" - done -} - -######################## -# Validate settings in KAFKA_* env vars -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_validate() { - debug "Validating settings in KAFKA_* env vars..." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_multi_value() { - if [[ " ${2} " != *" ${!1} "* ]]; then - print_validation_error "The allowed values for ${1} are: ${2}" - fi - } - # If process.roles configured, check its values are valid and perform additional checks for each - check_kraft_process_roles() { - read -r -a roles_list <<<"$(tr ',;' ' ' <<<"$KAFKA_CFG_PROCESS_ROLES")" - for role in "${roles_list[@]}"; do - case "$role" in - broker) ;; - controller) - if is_empty_value "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-}"; then - print_validation_error "Role 'controller' enabled but environment variable KAFKA_CFG_CONTROLLER_LISTENER_NAMES was not provided." - fi - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ ! "$KAFKA_CFG_LISTENERS" =~ ${KAFKA_CFG_CONTROLLER_LISTENER_NAMES} ]]; then - print_validation_error "Role 'controller' enabled but listener ${KAFKA_CFG_CONTROLLER_LISTENER_NAMES} not found in KAFKA_CFG_LISTENERS." - fi - ;; - *) - print_validation_error "Invalid KRaft process role '$role'. Supported roles are 'broker,controller'" - ;; - esac - done - } - # Check all listeners are using a unique and valid port - check_listener_ports(){ - check_allowed_port() { - local port="${1:?missing port variable}" - local -a validate_port_args=() - ! am_i_root && validate_port_args+=("-unprivileged") - validate_port_args+=("$port") - if ! err=$(validate_port "${validate_port_args[@]}"); then - print_validation_error "An invalid port ${port} was specified in the environment variable KAFKA_CFG_LISTENERS: ${err}." - fi - } - - read -r -a listeners <<<"$(tr ',' ' ' <<<"${KAFKA_CFG_LISTENERS:-}")" - local -a ports=() - for listener in "${listeners[@]}"; do - read -r -a arr <<<"$(tr ':' ' ' <<<"$listener")" - # Obtain the port from listener string, e.g. PLAINTEXT://:9092 - port="${arr[2]}" - check_allowed_port "$port" - ports+=("$port") - done - # Check each listener is using an unique port - local -a unique_ports=() - read -r -a unique_ports <<< "$(echo "${ports[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')" - if [[ "${#ports[@]}" != "${#unique_ports[@]}" ]]; then - print_validation_error "There are listeners bound to the same port" - fi - } - check_listener_protocols(){ - local -r allowed_protocols=("PLAINTEXT" "SASL_PLAINTEXT" "SASL_SSL" "SSL") - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - # Check protocol in allowed list - if [[ ! "${allowed_protocols[*]}" =~ $protocol ]]; then - print_validation_error "Authentication protocol ${protocol} is not supported!" - fi - # If inter-broker listener configured with SASL, ensure KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL is set - if [[ "$listener" = "${KAFKA_CFG_INTER_BROKER_LISTENER_NAME:-INTERNAL}" ]]; then - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL:-}"; then - print_validation_error "When using SASL for inter broker comunication the mechanism should be provided using KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL" - fi - if is_empty_value "${KAFKA_INTER_BROKER_USER:-}" || is_empty_value "${KAFKA_INTER_BROKER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka inter-broker communications, you must provide the SASL credentials. Set the environment variables KAFKA_INTER_BROKER_USER and KAFKA_INTER_BROKER_PASSWORD to configure the credentials for SASL authentication with between brokers." - fi - fi - # If controller listener configured with SASL, ensure KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL is set - elif [[ "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-CONTROLLER}" =~ $listener ]]; then - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL:-}"; then - print_validation_error "When using SASL for controller comunication the mechanism should be provided at KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - elif [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" =~ SCRAM ]]; then - warn "KRaft controller listener may not support SCRAM-SHA-256/SCRAM-SHA-512 mechanisms. If facing any issues, we recommend switching to PLAIN mechanism. More information at: https://issues.apache.org/jira/browse/KAFKA-15513" - fi - if is_empty_value "${KAFKA_CONTROLLER_USER:-}" || is_empty_value "${KAFKA_CONTROLLER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka control plane communications, you must provide the SASL credentials. Set the environment variables KAFKA_CONTROLLER_USER and KAFKA_CONTROLLER_PASSWORD to configure the credentials for SASL authentication with between controllers." - fi - fi - else - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CLIENT_USERS:-}" || is_empty_value "${KAFKA_CLIENT_PASSWORDS:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka, you must provide the SASL credentials. Set the environment variables KAFKA_CLIENT_USERS and KAFKA_CLIENT_PASSWORDS to configure the credentials for SASL authentication with clients." - fi - fi - - fi - done - } - - if is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}" && is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - print_validation_error "Kafka haven't been configured to work in either Raft or Zookeper mode. Please make sure at least one of the modes is configured." - fi - # Check KRaft mode - if ! is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}"; then - # Only allow Zookeeper configuration if migration mode is enabled - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}" && - { is_empty_value "${KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE:-}" || ! is_boolean_yes "$KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE"; }; then - print_validation_error "Both KRaft mode and Zookeeper modes are configured, but KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE is not enabled" - fi - if is_empty_value "${KAFKA_CFG_NODE_ID:-}"; then - print_validation_error "KRaft mode requires an unique node.id, please set the environment variable KAFKA_CFG_NODE_ID" - fi - if is_empty_value "${KAFKA_CFG_CONTROLLER_QUORUM_VOTERS:-}"; then - print_validation_error "KRaft mode requires KAFKA_CFG_CONTROLLER_QUORUM_VOTERS to be set" - fi - check_kraft_process_roles - fi - # Check Zookeeper mode - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - # If SSL/SASL_SSL protocol configured, check certificates are provided - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SSL ]]; then - if [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "JKS" ]]; then - # Fail if truststore is not provided - if [[ ! -f "$KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE" ]]; then - print_validation_error "In order to configure the TLS encryption for Zookeeper with JKS certs you must mount your zookeeper.truststore.jks cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - # Warn if keystore is not provided, only required if Zookeper mTLS is enabled (ZOO_TLS_CLIENT_AUTH) - if [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" ]] && [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.jks" ]]; then - warn "In order to configure the mTLS for Zookeeper with JKS certs you must mount your zookeeper.keystore.jks cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - elif [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]]; then - # Fail if CA / validation cert is not provided - if [[ ! -f "$KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE" ]]; then - print_validation_error "In order to configure the TLS encryption for Zookeeper with PEM certs you must mount your zookeeper.truststore.pem cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - # Warn if node key or cert are not provided, only required if Zookeper mTLS is enabled (ZOO_TLS_CLIENT_AUTH) - if { [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" ]] || [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.pem" ]] || [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.key" ]]; }; then - warn "In order to configure the mTLS for Zookeeper with PEM certs you must mount your zookeeper.keystore.pem cert and zookeeper.keystore.key key to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - fi - fi - # If SASL/SASL_SSL protocol configured, check certificates are provided - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SASL ]]; then - if is_empty_value "${KAFKA_ZOOKEEPER_USER:-}" || is_empty_value "${KAFKA_ZOOKEEPER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka, you must provide the SASL credentials. Set the environment variables KAFKA_ZOOKEEPER_USER and KAFKA_ZOOKEEPER_PASSWORD, to configure the credentials for SASL authentication with Zookeeper." - fi - fi - # If using plaintext protocol, check it is explicitly allowed - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" = "PLAINTEXT" ]]; then - warn "The KAFKA_ZOOKEEPER_PROTOCOL environment variable does not configure SASL and/or SSL, this setting is not recommended for production environments." - fi - fi - # Check listener ports are unique and allowed - check_listener_ports - # Check listeners are mapped to a valid security protocol - check_listener_protocols - # Warn users if plaintext listeners are configured - if kafka_has_plaintext_listener; then - warn "Kafka has been configured with a PLAINTEXT listener, this setting is not recommended for production environments." - fi - # If SSL/SASL_SSL listeners configured, check certificates are provided - if kafka_has_ssl_listener; then - if [[ "$KAFKA_TLS_TYPE" = "JKS" ]] && - { [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.jks" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.jks" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; }; then - print_validation_error "In order to configure the TLS encryption for Kafka with JKS certs you must mount your kafka.keystore.jks and kafka.truststore.jks certs to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - elif [[ "$KAFKA_TLS_TYPE" = "PEM" ]] && - { [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.pem" ]] || [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.key" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.pem" ]] || [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.key" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; }; then - print_validation_error "In order to configure the TLS encryption for Kafka with PEM certs you must mount your kafka.keystore.pem, kafka.keystore.key and kafka.truststore.pem certs to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - fi - # If SASL/SASL_SSL listeners configured, check passwords are provided - if kafka_has_sasl_listener; then - if is_empty_value "${KAFKA_CFG_SASL_ENABLED_MECHANISMS:-}"; then - print_validation_error "Specified SASL protocol but no SASL mechanisms provided in KAFKA_CFG_SASL_ENABLED_MECHANISMS" - fi - fi - # Check users and passwords lists are the same size - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS:-}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS:-}")" - if [[ "${#users[@]}" -ne "${#passwords[@]}" ]]; then - print_validation_error "Specify the same number of passwords on KAFKA_CLIENT_PASSWORDS as the number of users on KAFKA_CLIENT_USERS!" - fi - check_multi_value "KAFKA_TLS_TYPE" "JKS PEM" - check_multi_value "KAFKA_ZOOKEEPER_TLS_TYPE" "JKS PEM" - check_multi_value "KAFKA_ZOOKEEPER_PROTOCOL" "PLAINTEXT SASL SSL SASL_SSL" - check_multi_value "KAFKA_TLS_CLIENT_AUTH" "none requested required" - [[ "$error_code" -eq 0 ]] || return "$error_code" -} - -######################## -# Get kafka version -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# version -######################### -kafka_get_version() { - local -a cmd=("kafka-topics.sh" "--version") - am_i_root && cmd=("run_as_user" "$KAFKA_DAEMON_USER" "${cmd[@]}") - - read -r -a ver_split <<< "$("${cmd[@]}")" - echo "${ver_split[0]}" -} - -######################### -# Configure JAAS for a given listener and SASL mechanisms -# Globals: -# KAFKA_* -# Arguments: -# $1 - Name of the listener JAAS will be configured for -# $2 - Comma-separated list of SASL mechanisms to configure -# $3 - Comma-separated list of usernames -# $4 - Comma-separated list of passwords -# Returns: -# None -######################### -kafka_configure_server_jaas() { - local listener="${1:?missing listener name}" - local role="${2:-}" - - if [[ "$role" = "controller" ]]; then - local jaas_content=() - if [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" = "PLAIN" ]]; then - jaas_content=( - "org.apache.kafka.common.security.plain.PlainLoginModule required" - "username=\"${KAFKA_CONTROLLER_USER}\"" - "password=\"${KAFKA_CONTROLLER_PASSWORD}\"" - "user_${KAFKA_CONTROLLER_USER}=\"${KAFKA_CONTROLLER_PASSWORD}\";" - ) - elif [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" =~ SCRAM ]]; then - jaas_content=( - "org.apache.kafka.common.security.scram.ScramLoginModule required" - "username=\"${KAFKA_CONTROLLER_USER}\"" - "password=\"${KAFKA_CONTROLLER_PASSWORD}\";" - ) - fi - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - sasl_mechanism_lower="$(echo "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" | tr '[:upper:]' '[:lower:]')" - kafka_server_conf_set "listener.name.${listener_lower}.${sasl_mechanism_lower}.sasl.jaas.config" "${jaas_content[*]}" - else - read -r -a sasl_mechanisms_arr <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_SASL_ENABLED_MECHANISMS")" - read -r -a users <<<"$(tr ',;' ' ' <<<"$KAFKA_CLIENT_USERS")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"$KAFKA_CLIENT_PASSWORDS")" - # Configure JAAS for each SASL mechanism - # ref: https://docs.confluent.io/platform/current/kafka/authentication_sasl/index.html - for sasl_mechanism in "${sasl_mechanisms_arr[@]}"; do - local jaas_content=() - # For PLAIN mechanism, only the first username will be used - if [[ "$sasl_mechanism" = "PLAIN" ]]; then - jaas_content=("org.apache.kafka.common.security.plain.PlainLoginModule required") - if [[ "$role" = "inter-broker" ]]; then - jaas_content+=( - "username=\"${KAFKA_INTER_BROKER_USER}\"" - "password=\"${KAFKA_INTER_BROKER_PASSWORD}\"" - ) - users+=("$KAFKA_INTER_BROKER_USER") - passwords+=("$KAFKA_INTER_BROKER_PASSWORD") - fi - for ((i = 0; i < ${#users[@]}; i++)); do - jaas_content+=("user_${users[i]}=\"${passwords[i]}\"") - done - # Add semi-colon to the last element of the array - jaas_content[${#jaas_content[@]} - 1]="${jaas_content[${#jaas_content[@]} - 1]};" - elif [[ "$sasl_mechanism" =~ SCRAM ]]; then - if [[ "$role" = "inter-broker" ]]; then - jaas_content=( - "org.apache.kafka.common.security.scram.ScramLoginModule required" - "username=\"${KAFKA_INTER_BROKER_USER}\"" - "password=\"${KAFKA_INTER_BROKER_PASSWORD}\";" - ) - else - jaas_content=("org.apache.kafka.common.security.scram.ScramLoginModule required;") - fi - fi - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - sasl_mechanism_lower="$(echo "$sasl_mechanism" | tr '[:upper:]' '[:lower:]')" - kafka_server_conf_set "listener.name.${listener_lower}.${sasl_mechanism_lower}.sasl.jaas.config" "${jaas_content[*]}" - done - fi -} - -######################## -# Configure Zookeeper JAAS authentication -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_zookeeper_configure_jaas(){ - local jaas_content=( - "org.apache.kafka.common.security.plain.PlainLoginModule required" - "username=\"${KAFKA_ZOOKEEPER_USER}\"" - "password=\"${KAFKA_ZOOKEEPER_PASSWORD}\";" - ) - - kafka_server_conf_set "sasl.jaas.config" "${jaas_content[*]}" -} - -######################## -# Generate JAAS authentication file for local producer/consumer to use -# Globals: -# KAFKA_* -# Arguments: -# $1 - Authentication protocol to use for the internal listener -# $2 - Authentication protocol to use for the client listener -# Returns: -# None -######################### -kafka_configure_consumer_producer_jaas(){ - local jaas_content=() - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - - if [[ "${KAFKA_CFG_SASL_ENABLED_MECHANISMS}" =~ SCRAM ]]; then - jaas_content=("org.apache.kafka.common.security.scram.ScramLoginModule required") - elif [[ "${KAFKA_CFG_SASL_ENABLED_MECHANISMS}" =~ PLAIN ]]; then - jaas_content=("org.apache.kafka.common.security.plain.PlainLoginModule required") - else - error "Couldn't configure a supported SASL mechanism for Kafka consumer/producer properties" - exit 1 - fi - - jaas_content+=( - "username=\"${users[0]}\"" - "password=\"${passwords[0]}\";" - ) - - kafka_producer_consumer_conf_set "sasl.jaas.config" "${jaas_content[*]}" -} - -######################## -# Create users in zookeper when using SASL/SCRAM mechanism -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_zookeeper_create_sasl_scram_users() { - info "Creating users in Zookeeper" - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - local zookeeper_connect - zookeeper_connect=$(grep "^zookeeper.connect=" "$KAFKA_CONF_FILE" | sed -E 's/^zookeeper\.connect=(\S+)$/\1/') - read -r -a zookeeper_hosts <<<"$(tr ',;' ' ' <<<"${zookeeper_connect}")" - - if [[ "${#zookeeper_hosts[@]}" -eq 0 ]]; then - error "Couldn't obtain zookeeper.connect from $KAFKA_CONF_FILE" - exit 1 - fi - # Wait for Zookeeper to be reachable - read -r -a aux <<<"$(tr ':' ' ' <<<"${zookeeper_hosts[0]}")" - local host="${aux[0]:?missing host}" - local port="${aux[1]:-2181}" - wait-for-port --host "$host" "$port" - - # Add interbroker credentials - if grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM" "$KAFKA_CONF_FILE"; then - users+=("${KAFKA_INTER_BROKER_USER}") - passwords+=("${KAFKA_INTER_BROKER_PASSWORD}") - fi - for ((i = 0; i < ${#users[@]}; i++)); do - debug "Creating user ${users[i]} in zookeeper" - # Ref: https://docs.confluent.io/current/kafka/authentication_sasl/authentication_sasl_scram.html#sasl-scram-overview - debug_execute kafka-configs.sh --zookeeper "$zookeeper_connect" --alter --add-config "SCRAM-SHA-256=[iterations=8192,password=${passwords[i]}],SCRAM-SHA-512=[password=${passwords[i]}]" --entity-type users --entity-name "${users[i]}" - done -} - -######################## -# Configure Kafka SSL settings -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_ssl() { - # Configures both Kafka server and producers/consumers - configure_both() { - kafka_server_conf_set "${1:?missing key}" "${2:?missing value}" - kafka_producer_consumer_conf_set "${1:?missing key}" "${2:?missing value}" - } - kafka_server_conf_set "ssl.client.auth" "${KAFKA_TLS_CLIENT_AUTH}" - configure_both ssl.keystore.type "${KAFKA_TLS_TYPE}" - configure_both ssl.truststore.type "${KAFKA_TLS_TYPE}" - local -r kafka_truststore_location="${KAFKA_CERTS_DIR}/$(basename "${KAFKA_TLS_TRUSTSTORE_FILE}")" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.key.password "$KAFKA_CERTIFICATE_PASSWORD" - if [[ "$KAFKA_TLS_TYPE" = "PEM" ]]; then - file_to_multiline_property() { - awk 'NR > 1{print line"\\n\\"}{line=$0;}END{print $0" "}' <"${1:?missing file}" - } - remove_previous_cert_value() { - local key="${1:?missing key}" - files=( - "${KAFKA_CONF_FILE}" - "${KAFKA_CONF_DIR}/producer.properties" - "${KAFKA_CONF_DIR}/consumer.properties" - ) - for file in "${files[@]}"; do - if grep -q "^[#\\s]*$key\s*=.*" "$file"; then - # Delete all lines from the certificate beginning to its end - sed -i "/^[#\\s]*$key\s*=.*-----BEGIN/,/-----END/d" "$file" - fi - done - } - # We need to remove the previous cert value - # kafka_common_conf_set uses replace_in_file, which can't match multiple lines - remove_previous_cert_value ssl.keystore.key - remove_previous_cert_value ssl.keystore.certificate.chain - remove_previous_cert_value ssl.truststore.certificates - configure_both ssl.keystore.key "$(file_to_multiline_property "${KAFKA_CERTS_DIR}/kafka.keystore.key")" - configure_both ssl.keystore.certificate.chain "$(file_to_multiline_property "${KAFKA_CERTS_DIR}/kafka.keystore.pem")" - configure_both ssl.truststore.certificates "$(file_to_multiline_property "${kafka_truststore_location}")" - elif [[ "$KAFKA_TLS_TYPE" = "JKS" ]]; then - configure_both ssl.keystore.location "$KAFKA_CERTS_DIR"/kafka.keystore.jks - configure_both ssl.truststore.location "$kafka_truststore_location" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.keystore.password "$KAFKA_CERTIFICATE_PASSWORD" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.truststore.password "$KAFKA_CERTIFICATE_PASSWORD" - fi - true # Avoid the function to fail due to the check above -} - -######################## -# Get Zookeeper TLS settings -# Globals: -# KAFKA_ZOOKEEPER_TLS_* -# Arguments: -# None -# Returns: -# String -######################### -kafka_zookeeper_configure_tls() { - # Note that ZooKeeper does not support a key password different from the keystore password, - # so be sure to set the key password in the keystore to be identical to the keystore password; - # otherwise the connection attempt to Zookeeper will fail. - local keystore_location="" - local -r kafka_zk_truststore_location="${KAFKA_CERTS_DIR}/$(basename "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE}")" - - if [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "JKS" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" ]]; then - keystore_location="${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" - elif [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" ]]; then - # Concatenating private key into public certificate file - # This is needed to load keystore from location using PEM - keystore_location="${KAFKA_CERTS_DIR}/zookeeper.keypair.pem" - cat "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" > "$keystore_location" - fi - - kafka_server_conf_set "zookeeper.clientCnxnSocket" "org.apache.zookeeper.ClientCnxnSocketNetty" - kafka_server_conf_set "zookeeper.ssl.client.enable" "true" - is_boolean_yes "${KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME:-}" && kafka_server_conf_set "zookeeper.ssl.endpoint.identification.algorithm" "HTTPS" - ! is_empty_value "${keystore_location:-}" && kafka_server_conf_set "zookeeper.ssl.keystore.location" "${keystore_location}" - ! is_empty_value "${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD:-}" && kafka_server_conf_set "zookeeper.ssl.keystore.password" "${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD}" - ! is_empty_value "${kafka_zk_truststore_location:-}" && kafka_server_conf_set "zookeeper.ssl.truststore.location" "${kafka_zk_truststore_location}" - ! is_empty_value "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD:-}" && kafka_server_conf_set "zookeeper.ssl.truststore.password" "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD}" - true # Avoid the function to fail due to the check above -} - -######################## -# Configure Kafka configuration files from environment variables -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_from_environment_variables() { - # List of special cases to apply to the variables - local -r exception_regexps=( - "s/sasl\.ssl/sasl_ssl/g" - "s/sasl\.plaintext/sasl_plaintext/g" - ) - # Map environment variables to config properties - for var in "${!KAFKA_CFG_@}"; do - key="$(echo "$var" | sed -e 's/^KAFKA_CFG_//g' -e 's/_/\./g' | tr '[:upper:]' '[:lower:]')" - - # Exception for the camel case in this environment variable - [[ "$var" == "KAFKA_CFG_ZOOKEEPER_CLIENTCNXNSOCKET" ]] && key="zookeeper.clientCnxnSocket" - - # Apply exception regexps - for regex in "${exception_regexps[@]}"; do - key="$(echo "$key" | sed "$regex")" - done - - value="${!var}" - kafka_server_conf_set "$key" "$value" - done -} - -######################## -# Initialize KRaft storage -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_kraft_storage_initialize() { - local args=("--config" "$KAFKA_CONF_FILE" "--ignore-formatted") - info "Initializing KRaft storage metadata" - - # If cluster.id found in meta.properties, use it - if [[ -f "${KAFKA_DATA_DIR}/meta.properties" ]]; then - KAFKA_KRAFT_CLUSTER_ID=$(grep "^cluster.id=" "${KAFKA_DATA_DIR}/meta.properties" | sed -E 's/^cluster\.id=(\S+)$/\1/') - fi - - if is_empty_value "${KAFKA_KRAFT_CLUSTER_ID:-}"; then - warn "KAFKA_KRAFT_CLUSTER_ID not set - If using multiple nodes then you must use the same Cluster ID for each one" - KAFKA_KRAFT_CLUSTER_ID="$("${KAFKA_HOME}/bin/kafka-storage.sh" random-uuid)" - info "Generated Kafka cluster ID '${KAFKA_KRAFT_CLUSTER_ID}'" - fi - args+=("--cluster-id=$KAFKA_KRAFT_CLUSTER_ID") - - # SCRAM users are configured during the cluster bootstrapping process and can later be manually updated using kafka-config.sh - if is_boolean_yes "${KAFKA_KRAFT_BOOTSTRAP_SCRAM_USERS:-}"; then - info "Adding KRaft SCRAM users at storage bootstrap" - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - # Configure SCRAM-SHA-256 if enabled - if grep -Eq "^sasl.enabled.mechanisms=.*SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - for ((i = 0; i < ${#users[@]}; i++)); do - args+=("--add-scram" "SCRAM-SHA-256=[name=${users[i]},password=${passwords[i]}]") - done - fi - # Configure SCRAM-SHA-512 if enabled - if grep -Eq "^sasl.enabled.mechanisms=.*SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - for ((i = 0; i < ${#users[@]}; i++)); do - args+=("--add-scram" "SCRAM-SHA-512=[name=${users[i]},password=${passwords[i]}]") - done - fi - # Add interbroker credentials - if grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-256=[name=${KAFKA_INTER_BROKER_USER},password=${KAFKA_INTER_BROKER_PASSWORD}]") - elif grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-512=[name=${KAFKA_INTER_BROKER_USER},password=${KAFKA_INTER_BROKER_PASSWORD}]") - fi - # Add controller credentials - if grep -Eq "^sasl.mechanism.controller.protocol=SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-256=[name=${KAFKA_CONTROLLER_USER},password=${KAFKA_CONTROLLER_PASSWORD}]") - elif grep -Eq "^sasl.mechanism.controller.protocol=SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-512=[name=${KAFKA_CONTROLLER_USER},password=${KAFKA_CONTROLLER_PASSWORD}]") - fi - fi - info "Formatting storage directories to add metadata..." - "${KAFKA_HOME}/bin/kafka-storage.sh" format "${args[@]}" -} - -######################## -# Detects inconsitences between the configuration at KAFKA_CONF_FILE and cluster-state file -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_kraft_quorum_voters_changed(){ - read -r -a quorum_voters_conf_ids <<<"$(grep "^controller.quorum.voters=" "$KAFKA_CONF_FILE" | sed "s/^controller.quorum.voters=//" | tr "," " " | sed -E "s/\@\S+//g")" - read -r -a quorum_voters_state_ids <<< "$(grep -Eo "\{\"voterId\":[0-9]+\}" "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" | grep -Eo "[0-9]+" | tr "\n" " ")" - - if [[ "${#quorum_voters_conf_ids[@]}" != "${#quorum_voters_state_ids[@]}" ]]; then - true - else - read -r -a sorted_state <<< "$(echo "${quorum_voters_conf_ids[@]}" | tr ' ' '\n' | sort | tr '\n' ' ')" - read -r -a sorted_conf <<< "$(echo "${quorum_voters_state_ids[@]}" | tr ' ' '\n' | sort | tr '\n' ' ')" - if [[ "${sorted_state[*]}" = "${sorted_conf[*]}" ]]; then - false - else - true - fi - fi -} - -######################## -# Initialize Kafka -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_initialize() { - info "Initializing Kafka..." - # Check for mounted configuration files - if ! is_dir_empty "$KAFKA_MOUNTED_CONF_DIR"; then - cp -Lr "$KAFKA_MOUNTED_CONF_DIR"/* "$KAFKA_CONF_DIR" - fi - # Copy truststore to cert directory - for cert_var in KAFKA_TLS_TRUSTSTORE_FILE KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE; do - # Only copy if the file exists and it is in a different location than KAFKA_CERTS_DIR (to avoid copying to the same location) - if [[ -f "${!cert_var}" ]] && ! [[ "${!cert_var}" =~ $KAFKA_CERTS_DIR ]]; then - info "Copying truststore ${!cert_var} to ${KAFKA_CERTS_DIR}" - cp -L "${!cert_var}" "$KAFKA_CERTS_DIR" - fi - done - - if [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/server.properties" ]]; then - info "No injected configuration files found, creating default config files" - # Restore original server.properties but remove Zookeeper/KRaft specific settings for compatibility with both architectures - cp "${KAFKA_CONF_DIR}/server.properties.original" "$KAFKA_CONF_FILE" - kafka_server_unify_conf - # Configure Kafka settings - kafka_server_conf_set log.dirs "$KAFKA_DATA_DIR" - kafka_configure_from_environment_variables - # Configure Kafka producer/consumer to set up message sizes - ! is_empty_value "${KAFKA_CFG_MAX_REQUEST_SIZE:-}" && kafka_common_conf_set "$KAFKA_CONF_DIR/producer.properties" max.request.size "$KAFKA_CFG_MAX_REQUEST_SIZE" - ! is_empty_value "${KAFKA_CFG_MAX_PARTITION_FETCH_BYTES:-}" && kafka_common_conf_set "$KAFKA_CONF_DIR/consumer.properties" max.partition.fetch.bytes "$KAFKA_CFG_MAX_PARTITION_FETCH_BYTES" - # Zookeeper mode additional settings - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SSL ]]; then - kafka_zookeeper_configure_tls - fi - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SASL ]]; then - kafka_zookeeper_configure_jaas - fi - fi - # If at least one listener uses SSL or SASL_SSL, ensure SSL is configured - if kafka_has_ssl_listener; then - kafka_configure_ssl - fi - # If at least one listener uses SASL_PLAINTEXT or SASL_SSL, ensure SASL is configured - if kafka_has_sasl_listener; then - if [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM ]]; then - if ! is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}"; then - if [[ "$(kafka_get_version)" =~ ^3\.2\.|^3\.3\.|^3\.4\. ]]; then - # NOTE: This will depend on Kafka version when support for SCRAM is added - warn "KRaft mode requires Kafka version 3.5 or higher for SCRAM to be supported. SCRAM SASL mechanisms will now be disabled." - KAFKA_CFG_SASL_ENABLED_MECHANISMS=PLAIN - else - export KAFKA_KRAFT_BOOTSTRAP_SCRAM_USERS="true" - fi - fi - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - export KAFKA_ZOOKEEPER_BOOTSTRAP_SCRAM_USERS="true" - fi - fi - kafka_server_conf_set sasl.enabled.mechanisms "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" - fi - # Settings for each Kafka Listener are configured individually - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - - if [[ "$protocol" = "SSL" || "$protocol" = "SASL_SSL" ]]; then - listener_upper="$(echo "$listener" | tr '[:lower:]' '[:upper:]')" - env_name="KAFKA_TLS_${listener_upper}_CLIENT_AUTH" - [[ -n "${!env_name:-}" ]] && kafka_server_conf_set "listener.name.${listener_lower}.ssl.client.auth" "${!env_name}" - fi - if [[ "$protocol" = "SASL_PLAINTEXT" || "$protocol" = "SASL_SSL" ]]; then - local role="" - if [[ "$listener" = "${KAFKA_CFG_INTER_BROKER_LISTENER_NAME:-INTERNAL}" ]]; then - kafka_server_conf_set sasl.mechanism.inter.broker.protocol "$KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL" - role="inter-broker" - elif [[ "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-CONTROLLER}" =~ $listener ]]; then - kafka_server_conf_set sasl.mechanism.controller.protocol "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - kafka_server_conf_set "listener.name.${listener_lower}.sasl.enabled.mechanisms" "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - role="controller" - fi - # If KAFKA_CLIENT_LISTENER_NAME is found in the listeners list, configure the producer/consumer accordingly - if [[ "$listener" = "${KAFKA_CLIENT_LISTENER_NAME:-CLIENT}" ]]; then - kafka_configure_consumer_producer_jaas - kafka_producer_consumer_conf_set security.protocol "$protocol" - kafka_producer_consumer_conf_set sasl.mechanism "${KAFKA_CLIENT_SASL_MECHANISM:-$(kafka_client_sasl_mechanism)}" - fi - # Configure inline listener jaas configuration, omitted if mounted JAAS conf file detected - if [[ ! -f "${KAFKA_CONF_DIR}/kafka_jaas.conf" ]]; then - kafka_configure_server_jaas "$listener_lower" "${role:-}" - fi - fi - done - # Configure Kafka using environment variables - # This is executed at the end, to allow users to override properties set by the initialization logic - kafka_configure_from_environment_variables - else - info "Detected mounted server.properties file at ${KAFKA_MOUNTED_CONF_DIR}/server.properties. Skipping configuration based on env variables" - fi - true -} - -######################## -# Returns the most secure SASL mechanism available for Kafka clients -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################## -kafka_client_sasl_mechanism() { - local sasl_mechanism="" - - if [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM-SHA-512 ]]; then - sasl_mechanism="SCRAM-SHA-512" - elif [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM-SHA-256 ]]; then - sasl_mechanism="SCRAM-SHA-256" - elif [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ PLAIN ]]; then - sasl_mechanism="PLAIN" - fi - echo "$sasl_mechanism" -} - -######################## -# Removes default settings referencing Zookeeper mode or KRaft mode -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################## -kafka_server_unify_conf() { - local -r remove_regexps=( - #Zookeeper - "s/^zookeeper\./#zookeeper./g" - "s/^group\.initial/#group.initial/g" - "s/^broker\./#broker./g" - "s/^node\./#node./g" - "s/^process\./#process./g" - "s/^listeners=/#listeners=/g" - "s/^listener\./#listener./g" - "s/^controller\./#controller./g" - "s/^inter\.broker/#inter.broker/g" - "s/^advertised\.listeners/#advertised.listeners/g" - ) - - # Map environment variables to config properties - for regex in "${remove_regexps[@]}"; do - sed -i "${regex}" "$KAFKA_CONF_FILE" - done -} - -######################## -# Dinamically set node.id/broker.id/controller.quorum.voters if their alternative environment variable _COMMAND is set -# Globals: -# KAFKA_*_COMMAND -# Arguments: -# None -# Returns: -# None -######################### -kafka_dynamic_environment_variables() { - # KRaft mode - if ! is_empty_value "${KAFKA_NODE_ID_COMMAND:-}"; then - KAFKA_CFG_NODE_ID="$(eval "${KAFKA_NODE_ID_COMMAND}")" - export KAFKA_CFG_NODE_ID - fi - if ! is_empty_value "${KAFKA_CONTROLLER_QUORUM_VOTERS_COMMAND:-}"; then - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS="$(eval "${KAFKA_CONTROLLER_QUORUM_VOTERS_COMMAND}")" - export KAFKA_CFG_CONTROLLER_QUORUM_VOTERS - fi - # Zookeeper mode - # DEPRECATED - BROKER_ID_COMMAND has been deprecated, please use KAFKA_BROKER_ID_COMMAND instead - if ! is_empty_value "${KAFKA_BROKER_ID_COMMAND:-}"; then - KAFKA_CFG_BROKER_ID="$(eval "${KAFKA_BROKER_ID_COMMAND}")" - export KAFKA_CFG_BROKER_ID - elif ! is_empty_value "${BROKER_ID_COMMAND:-}"; then - KAFKA_CFG_BROKER_ID="$(eval "${BROKER_ID_COMMAND}")" - export KAFKA_CFG_BROKER_ID - fi -} - -######################## -# Run custom initialization scripts -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_custom_init_scripts() { - if [[ -n $(find "${KAFKA_INITSCRIPTS_DIR}/" -type f -regex ".*\.\(sh\)") ]] && [[ ! -f "${KAFKA_VOLUME_DIR}/.user_scripts_initialized" ]]; then - info "Loading user's custom files from $KAFKA_INITSCRIPTS_DIR" - for f in /docker-entrypoint-initdb.d/*; do - debug "Executing $f" - case "$f" in - *.sh) - if [[ -x "$f" ]]; then - if ! "$f"; then - error "Failed executing $f" - return 1 - fi - else - warn "Sourcing $f as it is not executable by the current user, any error may cause initialization to fail" - . "$f" - fi - ;; - *) - warn "Skipping $f, supported formats are: .sh" - ;; - esac - done - touch "$KAFKA_VOLUME_DIR"/.user_scripts_initialized - fi -} - -######################## -# Check if Kafka is running -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# Whether Kafka is running -######################## -is_kafka_running() { - local pid - pid="$(get_pid_from_file "$KAFKA_PID_FILE")" - if [[ -n "$pid" ]]; then - is_service_running "$pid" - else - false - fi -} - -######################## -# Check if Kafka is running -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# Whether Kafka is not running -######################## -is_kafka_not_running() { - ! is_kafka_running -} - -######################## -# Stop Kafka -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# None -######################### -kafka_stop() { - ! is_kafka_running && return - stop_service_using_pid "$KAFKA_PID_FILE" TERM -} diff --git a/bitnami/kafka/3.6/debian-12/tags-info.yaml b/bitnami/kafka/3.6/debian-12/tags-info.yaml deleted file mode 100644 index c0d0e0372375d..0000000000000 --- a/bitnami/kafka/3.6/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "3.6" -- 3.6-debian-12 -- 3.6.2 diff --git a/bitnami/kafka/3.7/README.md b/bitnami/kafka/3.7/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/kafka/3.7/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/kafka/3.7/debian-12/Dockerfile b/bitnami/kafka/3.7/debian-12/Dockerfile deleted file mode 100644 index 52e9d4bfdaf19..0000000000000 --- a/bitnami/kafka/3.7/debian-12/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T21:52:41Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/kafka/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="3.7.1-debian-12-r11" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/kafka" \ - org.opencontainers.image.title="kafka" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="3.7.1" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "wait-for-port-1.0.8-8-linux-${OS_ARCH}-debian-12" \ - "render-template-1.0.7-8-linux-${OS_ARCH}-debian-12" \ - "java-17.0.13-12-1-linux-${OS_ARCH}-debian-12" \ - "kafka-3.7.1-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN ln -s /opt/bitnami/scripts/kafka/entrypoint.sh /entrypoint.sh -RUN ln -s /opt/bitnami/scripts/kafka/run.sh /run.sh - -COPY rootfs / -RUN /opt/bitnami/scripts/java/postunpack.sh -RUN /opt/bitnami/scripts/kafka/postunpack.sh -ENV APP_VERSION="3.7.1" \ - BITNAMI_APP_NAME="kafka" \ - JAVA_HOME="/opt/bitnami/java" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/java/bin:/opt/bitnami/kafka/bin:$PATH" - -EXPOSE 9092 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/kafka/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/kafka/run.sh" ] diff --git a/bitnami/kafka/3.7/debian-12/docker-compose-cluster.yml b/bitnami/kafka/3.7/debian-12/docker-compose-cluster.yml deleted file mode 100644 index 85e1c4701d191..0000000000000 --- a/bitnami/kafka/3.7/debian-12/docker-compose-cluster.yml +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - kafka-0: - image: docker.io/bitnami/kafka:3.7 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=0 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_0_data:/bitnami/kafka - kafka-1: - image: docker.io/bitnami/kafka:3.7 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=1 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_1_data:/bitnami/kafka - kafka-2: - image: docker.io/bitnami/kafka:3.7 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=2 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_2_data:/bitnami/kafka - -volumes: - kafka_0_data: - driver: local - kafka_1_data: - driver: local - kafka_2_data: - driver: local diff --git a/bitnami/kafka/3.7/debian-12/docker-compose.yml b/bitnami/kafka/3.7/debian-12/docker-compose.yml deleted file mode 100644 index 70b01752585fe..0000000000000 --- a/bitnami/kafka/3.7/debian-12/docker-compose.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - kafka: - image: docker.io/bitnami/kafka:3.7 - ports: - - "9092:9092" - volumes: - - "kafka_data:/bitnami" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=0 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093 - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT -volumes: - kafka_data: - driver: local diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 23d34802b0d0a..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "17.0.13-12-1" - }, - "kafka": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "3.7.1-1" - }, - "render-template": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.7-8" - }, - "wait-for-port": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.8-8" - } -} \ No newline at end of file diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/kafka/3.7/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/kafka/3.7/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/kafka/3.7/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/kafka/3.7/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 38802fc0bfe91..0000000000000 --- a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -if [[ "$OS_FLAVOUR" =~ photon && "$APP_VERSION" =~ ^1.8 ]]; then - # Option --module-path is not supported by JAVA 1.8 since modules were added in version 1.9 - unset JAVA_TOOL_OPTIONS -fi - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh b/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh deleted file mode 100644 index e1621b93e8083..0000000000000 --- a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for kafka - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-kafka}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -kafka_env_vars=( - KAFKA_MOUNTED_CONF_DIR - KAFKA_INTER_BROKER_USER - KAFKA_INTER_BROKER_PASSWORD - KAFKA_CONTROLLER_USER - KAFKA_CONTROLLER_PASSWORD - KAFKA_CERTIFICATE_PASSWORD - KAFKA_TLS_TRUSTSTORE_FILE - KAFKA_TLS_TYPE - KAFKA_TLS_CLIENT_AUTH - KAFKA_OPTS - KAFKA_CFG_SASL_ENABLED_MECHANISMS - KAFKA_KRAFT_CLUSTER_ID - KAFKA_SKIP_KRAFT_STORAGE_INIT - KAFKA_CLIENT_LISTENER_NAME - KAFKA_ZOOKEEPER_PROTOCOL - KAFKA_ZOOKEEPER_PASSWORD - KAFKA_ZOOKEEPER_USER - KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD - KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD - KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE - KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME - KAFKA_ZOOKEEPER_TLS_TYPE - KAFKA_CLIENT_USERS - KAFKA_CLIENT_PASSWORDS - KAFKA_HEAP_OPTS - JAVA_TOOL_OPTIONS -) -for env_var in "${kafka_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset kafka_env_vars - -# Paths -export KAFKA_BASE_DIR="${BITNAMI_ROOT_DIR}/kafka" -export KAFKA_VOLUME_DIR="/bitnami/kafka" -export KAFKA_DATA_DIR="${KAFKA_VOLUME_DIR}/data" -export KAFKA_CONF_DIR="${KAFKA_BASE_DIR}/config" -export KAFKA_CONF_FILE="${KAFKA_CONF_DIR}/server.properties" -export KAFKA_MOUNTED_CONF_DIR="${KAFKA_MOUNTED_CONF_DIR:-${KAFKA_VOLUME_DIR}/config}" -export KAFKA_CERTS_DIR="${KAFKA_CONF_DIR}/certs" -export KAFKA_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d" -export KAFKA_LOG_DIR="${KAFKA_BASE_DIR}/logs" -export KAFKA_HOME="$KAFKA_BASE_DIR" -export PATH="${KAFKA_BASE_DIR}/bin:${BITNAMI_ROOT_DIR}/java/bin:${PATH}" - -# System users (when running with a privileged user) -export KAFKA_DAEMON_USER="kafka" -export KAFKA_DAEMON_GROUP="kafka" - -# Kafka runtime settings -export KAFKA_INTER_BROKER_USER="${KAFKA_INTER_BROKER_USER:-user}" -export KAFKA_INTER_BROKER_PASSWORD="${KAFKA_INTER_BROKER_PASSWORD:-bitnami}" -export KAFKA_CONTROLLER_USER="${KAFKA_CONTROLLER_USER:-controller_user}" -export KAFKA_CONTROLLER_PASSWORD="${KAFKA_CONTROLLER_PASSWORD:-bitnami}" -export KAFKA_CERTIFICATE_PASSWORD="${KAFKA_CERTIFICATE_PASSWORD:-}" -export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_TLS_TRUSTSTORE_FILE:-}" -export KAFKA_TLS_TYPE="${KAFKA_TLS_TYPE:-JKS}" -export KAFKA_TLS_CLIENT_AUTH="${KAFKA_TLS_CLIENT_AUTH:-required}" -export KAFKA_OPTS="${KAFKA_OPTS:-}" - -# Kafka configuration overrides -export KAFKA_CFG_SASL_ENABLED_MECHANISMS="${KAFKA_CFG_SASL_ENABLED_MECHANISMS:-PLAIN,SCRAM-SHA-256,SCRAM-SHA-512}" -export KAFKA_KRAFT_CLUSTER_ID="${KAFKA_KRAFT_CLUSTER_ID:-}" -export KAFKA_SKIP_KRAFT_STORAGE_INIT="${KAFKA_SKIP_KRAFT_STORAGE_INIT:-false}" -export KAFKA_CLIENT_LISTENER_NAME="${KAFKA_CLIENT_LISTENER_NAME:-}" - -# ZooKeeper connection settings -export KAFKA_ZOOKEEPER_PROTOCOL="${KAFKA_ZOOKEEPER_PROTOCOL:-PLAINTEXT}" -export KAFKA_ZOOKEEPER_PASSWORD="${KAFKA_ZOOKEEPER_PASSWORD:-}" -export KAFKA_ZOOKEEPER_USER="${KAFKA_ZOOKEEPER_USER:-}" -export KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD="${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD:-}" -export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD="${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD:-}" -export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE:-}" -export KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME="${KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME:-true}" -export KAFKA_ZOOKEEPER_TLS_TYPE="${KAFKA_ZOOKEEPER_TLS_TYPE:-JKS}" - -# Authentication -export KAFKA_CLIENT_USERS="${KAFKA_CLIENT_USERS:-user}" -export KAFKA_CLIENT_PASSWORDS="${KAFKA_CLIENT_PASSWORDS:-bitnami}" - -# Java settings -export KAFKA_HEAP_OPTS="${KAFKA_HEAP_OPTS:--Xmx1024m -Xms1024m}" - -# Java settings -export JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS:-}" - -# Custom environment variables may be defined below diff --git a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh b/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh deleted file mode 100755 index d7413bcfc4f33..0000000000000 --- a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libkafka.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -print_welcome_page - -if [[ "$*" = *"/opt/bitnami/scripts/kafka/run.sh"* || "$*" = *"/run.sh"* ]]; then - info "** Starting Kafka setup **" - /opt/bitnami/scripts/kafka/setup.sh - info "** Kafka setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh b/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh deleted file mode 100755 index 7255563236c0b..0000000000000 --- a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libkafka.sh -. /opt/bitnami/scripts/libfs.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -# Move server.properties from configtmp to config -# Temporary solution until kafka tarball places server.properties into config -if [[ -d "${KAFKA_BASE_DIR}/configtmp" ]]; then - mv "${KAFKA_BASE_DIR}/configtmp"/* "$KAFKA_CONF_DIR" - rmdir "${KAFKA_BASE_DIR}/configtmp" -fi -[[ -d "${KAFKA_BASE_DIR}/conf" ]] && rmdir "${KAFKA_BASE_DIR}/conf" - -# Ensure directories used by Kafka exist and have proper ownership and permissions -for dir in "$KAFKA_LOG_DIR" "$KAFKA_CONF_DIR" "$KAFKA_MOUNTED_CONF_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR" "$KAFKA_INITSCRIPTS_DIR"; do - ensure_dir_exists "$dir" -done -chmod -R g+rwX "$KAFKA_BASE_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR" "$KAFKA_INITSCRIPTS_DIR" - -# Move the original server.properties, so users can skip initialization logic by mounting their own server.properties directly instead of using the MOUNTED_CONF_DIR -mv "${KAFKA_CONF_DIR}/server.properties" "${KAFKA_CONF_DIR}/server.properties.original" - -# Disable logging to stdout and garbage collection -# Source: https://logging.apache.org/log4j/log4j-2.4/manual/appenders.html -replace_in_file "${KAFKA_BASE_DIR}/bin/kafka-server-start.sh" " [-]loggc" " " -replace_in_file "${KAFKA_CONF_DIR}/log4j.properties" "DailyRollingFileAppender" "ConsoleAppender" - -# Disable the default console logger in favour of KafkaAppender (which provides the exact output) -echo "log4j.appender.stdout.Threshold=OFF" >>"${KAFKA_CONF_DIR}/log4j.properties" - -# Remove invalid parameters for ConsoleAppender -remove_in_file "${KAFKA_CONF_DIR}/log4j.properties" "DatePattern" -remove_in_file "${KAFKA_CONF_DIR}/log4j.properties" "Appender.File" diff --git a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh b/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh deleted file mode 100755 index 76d4380aff57e..0000000000000 --- a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libkafka.sh -. /opt/bitnami/scripts/libos.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -if [[ -f "${KAFKA_CONF_DIR}/kafka_jaas.conf" ]]; then - export KAFKA_OPTS="${KAFKA_OPTS:-} -Djava.security.auth.login.config=${KAFKA_CONF_DIR}/kafka_jaas.conf" -fi - -cmd="$KAFKA_HOME/bin/kafka-server-start.sh" -args=("$KAFKA_CONF_FILE") -! is_empty_value "${KAFKA_EXTRA_FLAGS:-}" && args=("${args[@]}" "${KAFKA_EXTRA_FLAGS[@]}") - -info "** Starting Kafka **" -if am_i_root; then - exec_as_user "$KAFKA_DAEMON_USER" "$cmd" "${args[@]}" "$@" -else - exec "$cmd" "${args[@]}" "$@" -fi diff --git a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh b/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh deleted file mode 100755 index 5195f71910176..0000000000000 --- a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libkafka.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -# Map Kafka environment variables -kafka_create_alias_environment_variables - -# Dinamically set node.id/broker.id/controller.quorum.voters if the _COMMAND environment variable is set -kafka_dynamic_environment_variables - -# Set the default tuststore locations before validation -kafka_configure_default_truststore_locations -# Ensure Kafka user and group exist when running as 'root' -am_i_root && ensure_user_exists "$KAFKA_DAEMON_USER" --group "$KAFKA_DAEMON_GROUP" -# Ensure directories used by Kafka exist and have proper ownership and permissions -for dir in "$KAFKA_LOG_DIR" "$KAFKA_CONF_DIR" "$KAFKA_MOUNTED_CONF_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR"; do - if am_i_root; then - ensure_dir_exists "$dir" "$KAFKA_DAEMON_USER" "$KAFKA_DAEMON_GROUP" - else - ensure_dir_exists "$dir" - fi -done - -# Kafka validation, skipped if server.properties was mounted at either $KAFKA_MOUNTED_CONF_DIR or $KAFKA_CONF_DIR -[[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/server.properties" && ! -f "$KAFKA_CONF_FILE" ]] && kafka_validate -# Kafka initialization, skipped if server.properties was mounted at $KAFKA_CONF_DIR -[[ ! -f "$KAFKA_CONF_FILE" ]] && kafka_initialize - -# Initialise KRaft metadata storage if process.roles configured -if grep -q "^process.roles=" "$KAFKA_CONF_FILE" && ! is_boolean_yes "$KAFKA_SKIP_KRAFT_STORAGE_INIT" ; then - kafka_kraft_storage_initialize -fi -# Configure Zookeeper SCRAM users -if is_boolean_yes "${KAFKA_ZOOKEEPER_BOOTSTRAP_SCRAM_USERS:-}"; then - kafka_zookeeper_create_sasl_scram_users -fi -# KRaft controllers may get stuck starting when the controller quorum voters are changed. -# Workaround: Remove quorum-state file when scaling up/down controllers (Waiting proposal KIP-853) -# https://cwiki.apache.org/confluence/display/KAFKA/KIP-853%3A+KRaft+Voter+Changes -if [[ -f "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" ]] && grep -q "^controller.quorum.voters=" "$KAFKA_CONF_FILE" && kafka_kraft_quorum_voters_changed; then - warn "Detected inconsitences between controller.quorum.voters and quorum-state, removing it..." - rm -f "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" -fi -# Ensure custom initialization scripts are executed -kafka_custom_init_scripts diff --git a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh b/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh deleted file mode 100644 index df2459b035778..0000000000000 --- a/bitnami/kafka/3.7/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh +++ /dev/null @@ -1,1176 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Kafka library - -# shellcheck disable=SC1090,SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libservice.sh - -# Functions - -######################## -# Set a configuration setting value to a file -# Globals: -# None -# Arguments: -# $1 - file -# $2 - key -# $3 - values (array) -# Returns: -# None -######################### -kafka_common_conf_set() { - local file="${1:?missing file}" - local key="${2:?missing key}" - shift - shift - local values=("$@") - - if [[ "${#values[@]}" -eq 0 ]]; then - stderr_print "missing value" - return 1 - elif [[ "${#values[@]}" -ne 1 ]]; then - for i in "${!values[@]}"; do - kafka_common_conf_set "$file" "${key[$i]}" "${values[$i]}" - done - else - value="${values[0]}" - # Check if the value was set before - if grep -q "^[#\\s]*$key\s*=.*" "$file"; then - # Update the existing key - replace_in_file "$file" "^[#\\s]*${key}\s*=.*" "${key}=${value}" false - else - # Add a new key - printf '\n%s=%s' "$key" "$value" >>"$file" - fi - fi -} - -######################## -# Returns true if at least one listener is configured using SSL -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_ssl_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENERS:-}"; then - if is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - if [[ "$KAFKA_CFG_LISTENERS" =~ SSL: || "$KAFKA_CFG_LISTENERS" =~ SASL_SSL: ]]; then - return - fi - else - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "SSL" || "$protocol" = "SASL_SSL" ]]; then - if [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - fi - fi - return 1 -} - -######################## -# Returns true if at least one listener is configured using SASL -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_sasl_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENERS:-}"; then - if is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - if [[ "$KAFKA_CFG_LISTENERS" =~ SASL_PLAINTEXT: ]] || [[ "$KAFKA_CFG_LISTENERS" =~ SASL_SSL: ]]; then - return - fi - else - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "SASL_PLAINTEXT" || "$protocol" = "SASL_SSL" ]]; then - if [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - fi - fi - return 1 -} - -######################## -# Returns true if at least one listener is configured using plaintext -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_plaintext_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "PLAINTEXT" ]]; then - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - else - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ "$KAFKA_CFG_LISTENERS" =~ PLAINTEXT: ]]; then - return - fi - fi - return 1 -} - -######################## -# Backwards compatibility measure to configure the TLS truststore locations -# Globals: -# KAFKA_CONF_FILE -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_default_truststore_locations() { - # Backwards compatibility measure to allow custom truststore locations but at the same time not disrupt - # the UX that the previous version of the containers and the helm chart have. - # Context: The chart and containers by default assumed that the truststore location was KAFKA_CERTS_DIR/kafka.truststore.jks or KAFKA_MOUNTED_CONF_DIR/certs/kafka.truststore.jks. - # Because of this, we could not use custom certificates in different locations (use case: A custom base image that already has a truststore). Changing the logic to allow custom - # locations implied major changes in the current user experience (which only required to mount certificates at the assumed location). In order to maintain this compatibility we need - # use this logic that sets the KAFKA_TLS_*_FILE variables to the previously assumed locations in case it is not set - - # Kafka truststore - if kafka_has_ssl_listener && is_empty_value "${KAFKA_TLS_TRUSTSTORE_FILE:-}"; then - local kafka_truststore_filename="kafka.truststore.jks" - [[ "$KAFKA_TLS_TYPE" = "PEM" ]] && kafka_truststore_filename="kafka.truststore.pem" - if [[ -f "${KAFKA_CERTS_DIR}/${kafka_truststore_filename}" ]]; then - # Mounted in /opt/bitnami/kafka/conf/certs - export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_CERTS_DIR}/${kafka_truststore_filename}" - else - # Mounted in /bitnami/kafka/conf/certs - export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_MOUNTED_CONF_DIR}/certs/${kafka_truststore_filename}" - fi - fi - # Zookeeper truststore - if [[ "${KAFKA_ZOOKEEPER_PROTOCOL:-}" =~ SSL ]] && is_empty_value "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE:-}"; then - local zk_truststore_filename="zookeeper.truststore.jks" - [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]] && zk_truststore_filename="zookeeper.truststore.pem" - if [[ -f "${KAFKA_CERTS_DIR}/${zk_truststore_filename}" ]]; then - # Mounted in /opt/bitnami/kafka/conf/certs - export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_CERTS_DIR}/${zk_truststore_filename}" - else - # Mounted in /bitnami/kafka/conf/certs - export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_MOUNTED_CONF_DIR}/certs/${zk_truststore_filename}" - fi - fi -} - -######################## -# Set a configuration setting value to server.properties -# Globals: -# KAFKA_CONF_FILE -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -kafka_server_conf_set() { - kafka_common_conf_set "$KAFKA_CONF_FILE" "$@" -} - -######################## -# Set a configuration setting value to producer.properties and consumer.properties -# Globals: -# KAFKA_CONF_DIR -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -kafka_producer_consumer_conf_set() { - kafka_common_conf_set "$KAFKA_CONF_DIR/producer.properties" "$@" - kafka_common_conf_set "$KAFKA_CONF_DIR/consumer.properties" "$@" -} - -######################## -# Create alias for environment variable, so both can be used -# Globals: -# None -# Arguments: -# $1 - Alias environment variable name -# $2 - Original environment variable name -# Returns: -# None -######################### -kafka_declare_alias_env() { - local -r alias="${1:?missing environment variable alias}" - local -r original="${2:?missing original environment variable}" - if printenv "${original}" >/dev/null; then - export "$alias"="${!original:-}" - fi -} - -######################## -# Map Kafka legacy environment variables to the new names -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_create_alias_environment_variables() { - suffixes=( - "ADVERTISED_LISTENERS" - "BROKER_ID" - "NODE_ID" - "CONTROLLER_QUORUM_VOTERS" - "PROCESS_ROLES" - "DEFAULT_REPLICATION_FACTOR" - "DELETE_TOPIC_ENABLE" - "INTER_BROKER_LISTENER_NAME" - "LISTENERS" - "LISTENER_SECURITY_PROTOCOL_MAP" - "LOG_DIRS" - "LOG_FLUSH_INTERVAL_MESSAGES" - "LOG_FLUSH_INTERVAL_MS" - "LOG_MESSAGE_FORMAT_VERSION" - "LOG_RETENTION_BYTES" - "LOG_RETENTION_CHECK_INTERVALS_MS" - "LOG_RETENTION_HOURS" - "LOG_SEGMENT_BYTES" - "MESSAGE_MAX_BYTES" - "NUM_IO_THREADS" - "NUM_NETWORK_THREADS" - "NUM_PARTITIONS" - "NUM_RECOVERY_THREADS_PER_DATA_DIR" - "OFFSETS_TOPIC_REPLICATION_FACTOR" - "SOCKET_RECEIVE_BUFFER_BYTES" - "SOCKET_REQUEST_MAX_BYTES" - "SOCKET_SEND_BUFFER_BYTES" - "SSL_ENDPOINT_IDENTIFICATION_ALGORITHM" - "TRANSACTION_STATE_LOG_MIN_ISR" - "TRANSACTION_STATE_LOG_REPLICATION_FACTOR" - "ZOOKEEPER_CONNECT" - "ZOOKEEPER_CONNECTION_TIMEOUT_MS" - ) - kafka_declare_alias_env "KAFKA_CFG_LOG_DIRS" "KAFKA_LOGS_DIRS" - kafka_declare_alias_env "KAFKA_CFG_LOG_SEGMENT_BYTES" "KAFKA_SEGMENT_BYTES" - kafka_declare_alias_env "KAFKA_CFG_MESSAGE_MAX_BYTES" "KAFKA_MAX_MESSAGE_BYTES" - kafka_declare_alias_env "KAFKA_CFG_ZOOKEEPER_CONNECTION_TIMEOUT_MS" "KAFKA_ZOOKEEPER_CONNECT_TIMEOUT_MS" - kafka_declare_alias_env "KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE" "KAFKA_AUTO_CREATE_TOPICS_ENABLE" - kafka_declare_alias_env "KAFKA_CLIENT_USERS" "KAFKA_BROKER_USER" - kafka_declare_alias_env "KAFKA_CLIENT_PASSWORDS" "KAFKA_BROKER_PASSWORD" - kafka_declare_alias_env "KAFKA_CLIENT_LISTENER_NAME" "KAFKA_CLIENT_LISTENER" - for s in "${suffixes[@]}"; do - kafka_declare_alias_env "KAFKA_CFG_${s}" "KAFKA_${s}" - done -} - -######################## -# Validate settings in KAFKA_* env vars -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_validate() { - debug "Validating settings in KAFKA_* env vars..." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_multi_value() { - if [[ " ${2} " != *" ${!1} "* ]]; then - print_validation_error "The allowed values for ${1} are: ${2}" - fi - } - # If process.roles configured, check its values are valid and perform additional checks for each - check_kraft_process_roles() { - read -r -a roles_list <<<"$(tr ',;' ' ' <<<"$KAFKA_CFG_PROCESS_ROLES")" - for role in "${roles_list[@]}"; do - case "$role" in - broker) ;; - controller) - if is_empty_value "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-}"; then - print_validation_error "Role 'controller' enabled but environment variable KAFKA_CFG_CONTROLLER_LISTENER_NAMES was not provided." - fi - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ ! "$KAFKA_CFG_LISTENERS" =~ ${KAFKA_CFG_CONTROLLER_LISTENER_NAMES} ]]; then - print_validation_error "Role 'controller' enabled but listener ${KAFKA_CFG_CONTROLLER_LISTENER_NAMES} not found in KAFKA_CFG_LISTENERS." - fi - ;; - *) - print_validation_error "Invalid KRaft process role '$role'. Supported roles are 'broker,controller'" - ;; - esac - done - } - # Check all listeners are using a unique and valid port - check_listener_ports(){ - check_allowed_port() { - local port="${1:?missing port variable}" - local -a validate_port_args=() - ! am_i_root && validate_port_args+=("-unprivileged") - validate_port_args+=("$port") - if ! err=$(validate_port "${validate_port_args[@]}"); then - print_validation_error "An invalid port ${port} was specified in the environment variable KAFKA_CFG_LISTENERS: ${err}." - fi - } - - read -r -a listeners <<<"$(tr ',' ' ' <<<"${KAFKA_CFG_LISTENERS:-}")" - local -a ports=() - for listener in "${listeners[@]}"; do - read -r -a arr <<<"$(tr ':' ' ' <<<"$listener")" - # Obtain the port from listener string, e.g. PLAINTEXT://:9092 - port="${arr[2]}" - check_allowed_port "$port" - ports+=("$port") - done - # Check each listener is using an unique port - local -a unique_ports=() - read -r -a unique_ports <<< "$(echo "${ports[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')" - if [[ "${#ports[@]}" != "${#unique_ports[@]}" ]]; then - print_validation_error "There are listeners bound to the same port" - fi - } - check_listener_protocols(){ - local -r allowed_protocols=("PLAINTEXT" "SASL_PLAINTEXT" "SASL_SSL" "SSL") - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - # Check protocol in allowed list - if [[ ! "${allowed_protocols[*]}" =~ $protocol ]]; then - print_validation_error "Authentication protocol ${protocol} is not supported!" - fi - # If inter-broker listener configured with SASL, ensure KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL is set - if [[ "$listener" = "${KAFKA_CFG_INTER_BROKER_LISTENER_NAME:-INTERNAL}" ]]; then - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL:-}"; then - print_validation_error "When using SASL for inter broker comunication the mechanism should be provided using KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL" - fi - if is_empty_value "${KAFKA_INTER_BROKER_USER:-}" || is_empty_value "${KAFKA_INTER_BROKER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka inter-broker communications, you must provide the SASL credentials. Set the environment variables KAFKA_INTER_BROKER_USER and KAFKA_INTER_BROKER_PASSWORD to configure the credentials for SASL authentication with between brokers." - fi - fi - # If controller listener configured with SASL, ensure KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL is set - elif [[ "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-CONTROLLER}" =~ $listener ]]; then - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL:-}"; then - print_validation_error "When using SASL for controller comunication the mechanism should be provided at KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - elif [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" =~ SCRAM ]]; then - warn "KRaft controller listener may not support SCRAM-SHA-256/SCRAM-SHA-512 mechanisms. If facing any issues, we recommend switching to PLAIN mechanism. More information at: https://issues.apache.org/jira/browse/KAFKA-15513" - fi - if is_empty_value "${KAFKA_CONTROLLER_USER:-}" || is_empty_value "${KAFKA_CONTROLLER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka control plane communications, you must provide the SASL credentials. Set the environment variables KAFKA_CONTROLLER_USER and KAFKA_CONTROLLER_PASSWORD to configure the credentials for SASL authentication with between controllers." - fi - fi - else - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CLIENT_USERS:-}" || is_empty_value "${KAFKA_CLIENT_PASSWORDS:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka, you must provide the SASL credentials. Set the environment variables KAFKA_CLIENT_USERS and KAFKA_CLIENT_PASSWORDS to configure the credentials for SASL authentication with clients." - fi - fi - - fi - done - } - - if is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}" && is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - print_validation_error "Kafka haven't been configured to work in either Raft or Zookeper mode. Please make sure at least one of the modes is configured." - fi - # Check KRaft mode - if ! is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}"; then - # Only allow Zookeeper configuration if migration mode is enabled - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}" && - { is_empty_value "${KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE:-}" || ! is_boolean_yes "$KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE"; }; then - print_validation_error "Both KRaft mode and Zookeeper modes are configured, but KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE is not enabled" - fi - if is_empty_value "${KAFKA_CFG_NODE_ID:-}"; then - print_validation_error "KRaft mode requires an unique node.id, please set the environment variable KAFKA_CFG_NODE_ID" - fi - if is_empty_value "${KAFKA_CFG_CONTROLLER_QUORUM_VOTERS:-}"; then - print_validation_error "KRaft mode requires KAFKA_CFG_CONTROLLER_QUORUM_VOTERS to be set" - fi - check_kraft_process_roles - fi - # Check Zookeeper mode - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - # If SSL/SASL_SSL protocol configured, check certificates are provided - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SSL ]]; then - if [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "JKS" ]]; then - # Fail if truststore is not provided - if [[ ! -f "$KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE" ]]; then - print_validation_error "In order to configure the TLS encryption for Zookeeper with JKS certs you must mount your zookeeper.truststore.jks cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - # Warn if keystore is not provided, only required if Zookeper mTLS is enabled (ZOO_TLS_CLIENT_AUTH) - if [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" ]] && [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.jks" ]]; then - warn "In order to configure the mTLS for Zookeeper with JKS certs you must mount your zookeeper.keystore.jks cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - elif [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]]; then - # Fail if CA / validation cert is not provided - if [[ ! -f "$KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE" ]]; then - print_validation_error "In order to configure the TLS encryption for Zookeeper with PEM certs you must mount your zookeeper.truststore.pem cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - # Warn if node key or cert are not provided, only required if Zookeper mTLS is enabled (ZOO_TLS_CLIENT_AUTH) - if { [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" ]] || [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.pem" ]] || [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.key" ]]; }; then - warn "In order to configure the mTLS for Zookeeper with PEM certs you must mount your zookeeper.keystore.pem cert and zookeeper.keystore.key key to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - fi - fi - # If SASL/SASL_SSL protocol configured, check certificates are provided - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SASL ]]; then - if is_empty_value "${KAFKA_ZOOKEEPER_USER:-}" || is_empty_value "${KAFKA_ZOOKEEPER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka, you must provide the SASL credentials. Set the environment variables KAFKA_ZOOKEEPER_USER and KAFKA_ZOOKEEPER_PASSWORD, to configure the credentials for SASL authentication with Zookeeper." - fi - fi - # If using plaintext protocol, check it is explicitly allowed - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" = "PLAINTEXT" ]]; then - warn "The KAFKA_ZOOKEEPER_PROTOCOL environment variable does not configure SASL and/or SSL, this setting is not recommended for production environments." - fi - fi - # Check listener ports are unique and allowed - check_listener_ports - # Check listeners are mapped to a valid security protocol - check_listener_protocols - # Warn users if plaintext listeners are configured - if kafka_has_plaintext_listener; then - warn "Kafka has been configured with a PLAINTEXT listener, this setting is not recommended for production environments." - fi - # If SSL/SASL_SSL listeners configured, check certificates are provided - if kafka_has_ssl_listener; then - if [[ "$KAFKA_TLS_TYPE" = "JKS" ]] && - { [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.jks" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.jks" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; }; then - print_validation_error "In order to configure the TLS encryption for Kafka with JKS certs you must mount your kafka.keystore.jks and kafka.truststore.jks certs to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - elif [[ "$KAFKA_TLS_TYPE" = "PEM" ]] && - { [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.pem" ]] || [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.key" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.pem" ]] || [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.key" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; }; then - print_validation_error "In order to configure the TLS encryption for Kafka with PEM certs you must mount your kafka.keystore.pem, kafka.keystore.key and kafka.truststore.pem certs to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - fi - # If SASL/SASL_SSL listeners configured, check passwords are provided - if kafka_has_sasl_listener; then - if is_empty_value "${KAFKA_CFG_SASL_ENABLED_MECHANISMS:-}"; then - print_validation_error "Specified SASL protocol but no SASL mechanisms provided in KAFKA_CFG_SASL_ENABLED_MECHANISMS" - fi - fi - # Check users and passwords lists are the same size - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS:-}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS:-}")" - if [[ "${#users[@]}" -ne "${#passwords[@]}" ]]; then - print_validation_error "Specify the same number of passwords on KAFKA_CLIENT_PASSWORDS as the number of users on KAFKA_CLIENT_USERS!" - fi - check_multi_value "KAFKA_TLS_TYPE" "JKS PEM" - check_multi_value "KAFKA_ZOOKEEPER_TLS_TYPE" "JKS PEM" - check_multi_value "KAFKA_ZOOKEEPER_PROTOCOL" "PLAINTEXT SASL SSL SASL_SSL" - check_multi_value "KAFKA_TLS_CLIENT_AUTH" "none requested required" - [[ "$error_code" -eq 0 ]] || return "$error_code" -} - -######################## -# Get kafka version -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# version -######################### -kafka_get_version() { - local -a cmd=("kafka-topics.sh" "--version") - am_i_root && cmd=("run_as_user" "$KAFKA_DAEMON_USER" "${cmd[@]}") - - read -r -a ver_split <<< "$("${cmd[@]}")" - echo "${ver_split[0]}" -} - -######################### -# Configure JAAS for a given listener and SASL mechanisms -# Globals: -# KAFKA_* -# Arguments: -# $1 - Name of the listener JAAS will be configured for -# $2 - Comma-separated list of SASL mechanisms to configure -# $3 - Comma-separated list of usernames -# $4 - Comma-separated list of passwords -# Returns: -# None -######################### -kafka_configure_server_jaas() { - local listener="${1:?missing listener name}" - local role="${2:-}" - - if [[ "$role" = "controller" ]]; then - local jaas_content=() - if [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" = "PLAIN" ]]; then - jaas_content=( - "org.apache.kafka.common.security.plain.PlainLoginModule required" - "username=\"${KAFKA_CONTROLLER_USER}\"" - "password=\"${KAFKA_CONTROLLER_PASSWORD}\"" - "user_${KAFKA_CONTROLLER_USER}=\"${KAFKA_CONTROLLER_PASSWORD}\";" - ) - elif [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" =~ SCRAM ]]; then - jaas_content=( - "org.apache.kafka.common.security.scram.ScramLoginModule required" - "username=\"${KAFKA_CONTROLLER_USER}\"" - "password=\"${KAFKA_CONTROLLER_PASSWORD}\";" - ) - fi - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - sasl_mechanism_lower="$(echo "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" | tr '[:upper:]' '[:lower:]')" - kafka_server_conf_set "listener.name.${listener_lower}.${sasl_mechanism_lower}.sasl.jaas.config" "${jaas_content[*]}" - else - read -r -a sasl_mechanisms_arr <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_SASL_ENABLED_MECHANISMS")" - read -r -a users <<<"$(tr ',;' ' ' <<<"$KAFKA_CLIENT_USERS")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"$KAFKA_CLIENT_PASSWORDS")" - # Configure JAAS for each SASL mechanism - # ref: https://docs.confluent.io/platform/current/kafka/authentication_sasl/index.html - for sasl_mechanism in "${sasl_mechanisms_arr[@]}"; do - local jaas_content=() - # For PLAIN mechanism, only the first username will be used - if [[ "$sasl_mechanism" = "PLAIN" ]]; then - jaas_content=("org.apache.kafka.common.security.plain.PlainLoginModule required") - if [[ "$role" = "inter-broker" ]]; then - jaas_content+=( - "username=\"${KAFKA_INTER_BROKER_USER}\"" - "password=\"${KAFKA_INTER_BROKER_PASSWORD}\"" - ) - users+=("$KAFKA_INTER_BROKER_USER") - passwords+=("$KAFKA_INTER_BROKER_PASSWORD") - fi - for ((i = 0; i < ${#users[@]}; i++)); do - jaas_content+=("user_${users[i]}=\"${passwords[i]}\"") - done - # Add semi-colon to the last element of the array - jaas_content[${#jaas_content[@]} - 1]="${jaas_content[${#jaas_content[@]} - 1]};" - elif [[ "$sasl_mechanism" =~ SCRAM ]]; then - if [[ "$role" = "inter-broker" ]]; then - jaas_content=( - "org.apache.kafka.common.security.scram.ScramLoginModule required" - "username=\"${KAFKA_INTER_BROKER_USER}\"" - "password=\"${KAFKA_INTER_BROKER_PASSWORD}\";" - ) - else - jaas_content=("org.apache.kafka.common.security.scram.ScramLoginModule required;") - fi - fi - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - sasl_mechanism_lower="$(echo "$sasl_mechanism" | tr '[:upper:]' '[:lower:]')" - kafka_server_conf_set "listener.name.${listener_lower}.${sasl_mechanism_lower}.sasl.jaas.config" "${jaas_content[*]}" - done - fi -} - -######################## -# Configure Zookeeper JAAS authentication -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_zookeeper_configure_jaas(){ - local jaas_content=( - "org.apache.kafka.common.security.plain.PlainLoginModule required" - "username=\"${KAFKA_ZOOKEEPER_USER}\"" - "password=\"${KAFKA_ZOOKEEPER_PASSWORD}\";" - ) - - kafka_server_conf_set "sasl.jaas.config" "${jaas_content[*]}" -} - -######################## -# Generate JAAS authentication file for local producer/consumer to use -# Globals: -# KAFKA_* -# Arguments: -# $1 - Authentication protocol to use for the internal listener -# $2 - Authentication protocol to use for the client listener -# Returns: -# None -######################### -kafka_configure_consumer_producer_jaas(){ - local jaas_content=() - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - - if [[ "${KAFKA_CFG_SASL_ENABLED_MECHANISMS}" =~ SCRAM ]]; then - jaas_content=("org.apache.kafka.common.security.scram.ScramLoginModule required") - elif [[ "${KAFKA_CFG_SASL_ENABLED_MECHANISMS}" =~ PLAIN ]]; then - jaas_content=("org.apache.kafka.common.security.plain.PlainLoginModule required") - else - error "Couldn't configure a supported SASL mechanism for Kafka consumer/producer properties" - exit 1 - fi - - jaas_content+=( - "username=\"${users[0]}\"" - "password=\"${passwords[0]}\";" - ) - - kafka_producer_consumer_conf_set "sasl.jaas.config" "${jaas_content[*]}" -} - -######################## -# Create users in zookeper when using SASL/SCRAM mechanism -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_zookeeper_create_sasl_scram_users() { - info "Creating users in Zookeeper" - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - local zookeeper_connect - zookeeper_connect=$(grep "^zookeeper.connect=" "$KAFKA_CONF_FILE" | sed -E 's/^zookeeper\.connect=(\S+)$/\1/') - read -r -a zookeeper_hosts <<<"$(tr ',;' ' ' <<<"${zookeeper_connect}")" - - if [[ "${#zookeeper_hosts[@]}" -eq 0 ]]; then - error "Couldn't obtain zookeeper.connect from $KAFKA_CONF_FILE" - exit 1 - fi - # Wait for Zookeeper to be reachable - read -r -a aux <<<"$(tr ':' ' ' <<<"${zookeeper_hosts[0]}")" - local host="${aux[0]:?missing host}" - local port="${aux[1]:-2181}" - wait-for-port --host "$host" "$port" - - # Add interbroker credentials - if grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM" "$KAFKA_CONF_FILE"; then - users+=("${KAFKA_INTER_BROKER_USER}") - passwords+=("${KAFKA_INTER_BROKER_PASSWORD}") - fi - for ((i = 0; i < ${#users[@]}; i++)); do - debug "Creating user ${users[i]} in zookeeper" - # Ref: https://docs.confluent.io/current/kafka/authentication_sasl/authentication_sasl_scram.html#sasl-scram-overview - debug_execute kafka-configs.sh --zookeeper "$zookeeper_connect" --alter --add-config "SCRAM-SHA-256=[iterations=8192,password=${passwords[i]}],SCRAM-SHA-512=[password=${passwords[i]}]" --entity-type users --entity-name "${users[i]}" - done -} - -######################## -# Configure Kafka SSL settings -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_ssl() { - # Configures both Kafka server and producers/consumers - configure_both() { - kafka_server_conf_set "${1:?missing key}" "${2:?missing value}" - kafka_producer_consumer_conf_set "${1:?missing key}" "${2:?missing value}" - } - kafka_server_conf_set "ssl.client.auth" "${KAFKA_TLS_CLIENT_AUTH}" - configure_both ssl.keystore.type "${KAFKA_TLS_TYPE}" - configure_both ssl.truststore.type "${KAFKA_TLS_TYPE}" - local -r kafka_truststore_location="${KAFKA_CERTS_DIR}/$(basename "${KAFKA_TLS_TRUSTSTORE_FILE}")" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.key.password "$KAFKA_CERTIFICATE_PASSWORD" - if [[ "$KAFKA_TLS_TYPE" = "PEM" ]]; then - file_to_multiline_property() { - awk 'NR > 1{print line"\\n\\"}{line=$0;}END{print $0" "}' <"${1:?missing file}" - } - remove_previous_cert_value() { - local key="${1:?missing key}" - files=( - "${KAFKA_CONF_FILE}" - "${KAFKA_CONF_DIR}/producer.properties" - "${KAFKA_CONF_DIR}/consumer.properties" - ) - for file in "${files[@]}"; do - if grep -q "^[#\\s]*$key\s*=.*" "$file"; then - # Delete all lines from the certificate beginning to its end - sed -i "/^[#\\s]*$key\s*=.*-----BEGIN/,/-----END/d" "$file" - fi - done - } - # We need to remove the previous cert value - # kafka_common_conf_set uses replace_in_file, which can't match multiple lines - remove_previous_cert_value ssl.keystore.key - remove_previous_cert_value ssl.keystore.certificate.chain - remove_previous_cert_value ssl.truststore.certificates - configure_both ssl.keystore.key "$(file_to_multiline_property "${KAFKA_CERTS_DIR}/kafka.keystore.key")" - configure_both ssl.keystore.certificate.chain "$(file_to_multiline_property "${KAFKA_CERTS_DIR}/kafka.keystore.pem")" - configure_both ssl.truststore.certificates "$(file_to_multiline_property "${kafka_truststore_location}")" - elif [[ "$KAFKA_TLS_TYPE" = "JKS" ]]; then - configure_both ssl.keystore.location "$KAFKA_CERTS_DIR"/kafka.keystore.jks - configure_both ssl.truststore.location "$kafka_truststore_location" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.keystore.password "$KAFKA_CERTIFICATE_PASSWORD" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.truststore.password "$KAFKA_CERTIFICATE_PASSWORD" - fi - true # Avoid the function to fail due to the check above -} - -######################## -# Get Zookeeper TLS settings -# Globals: -# KAFKA_ZOOKEEPER_TLS_* -# Arguments: -# None -# Returns: -# String -######################### -kafka_zookeeper_configure_tls() { - # Note that ZooKeeper does not support a key password different from the keystore password, - # so be sure to set the key password in the keystore to be identical to the keystore password; - # otherwise the connection attempt to Zookeeper will fail. - local keystore_location="" - local -r kafka_zk_truststore_location="${KAFKA_CERTS_DIR}/$(basename "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE}")" - - if [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "JKS" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" ]]; then - keystore_location="${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" - elif [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" ]]; then - # Concatenating private key into public certificate file - # This is needed to load keystore from location using PEM - keystore_location="${KAFKA_CERTS_DIR}/zookeeper.keypair.pem" - cat "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" > "$keystore_location" - fi - - kafka_server_conf_set "zookeeper.clientCnxnSocket" "org.apache.zookeeper.ClientCnxnSocketNetty" - kafka_server_conf_set "zookeeper.ssl.client.enable" "true" - is_boolean_yes "${KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME:-}" && kafka_server_conf_set "zookeeper.ssl.endpoint.identification.algorithm" "HTTPS" - ! is_empty_value "${keystore_location:-}" && kafka_server_conf_set "zookeeper.ssl.keystore.location" "${keystore_location}" - ! is_empty_value "${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD:-}" && kafka_server_conf_set "zookeeper.ssl.keystore.password" "${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD}" - ! is_empty_value "${kafka_zk_truststore_location:-}" && kafka_server_conf_set "zookeeper.ssl.truststore.location" "${kafka_zk_truststore_location}" - ! is_empty_value "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD:-}" && kafka_server_conf_set "zookeeper.ssl.truststore.password" "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD}" - true # Avoid the function to fail due to the check above -} - -######################## -# Configure Kafka configuration files from environment variables -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_from_environment_variables() { - # List of special cases to apply to the variables - local -r exception_regexps=( - "s/sasl\.ssl/sasl_ssl/g" - "s/sasl\.plaintext/sasl_plaintext/g" - ) - # Map environment variables to config properties - for var in "${!KAFKA_CFG_@}"; do - key="$(echo "$var" | sed -e 's/^KAFKA_CFG_//g' -e 's/_/\./g' | tr '[:upper:]' '[:lower:]')" - - # Exception for the camel case in this environment variable - [[ "$var" == "KAFKA_CFG_ZOOKEEPER_CLIENTCNXNSOCKET" ]] && key="zookeeper.clientCnxnSocket" - - # Apply exception regexps - for regex in "${exception_regexps[@]}"; do - key="$(echo "$key" | sed "$regex")" - done - - value="${!var}" - kafka_server_conf_set "$key" "$value" - done -} - -######################## -# Initialize KRaft storage -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_kraft_storage_initialize() { - local args=("--config" "$KAFKA_CONF_FILE" "--ignore-formatted") - info "Initializing KRaft storage metadata" - - # If cluster.id found in meta.properties, use it - if [[ -f "${KAFKA_DATA_DIR}/meta.properties" ]]; then - KAFKA_KRAFT_CLUSTER_ID=$(grep "^cluster.id=" "${KAFKA_DATA_DIR}/meta.properties" | sed -E 's/^cluster\.id=(\S+)$/\1/') - fi - - if is_empty_value "${KAFKA_KRAFT_CLUSTER_ID:-}"; then - warn "KAFKA_KRAFT_CLUSTER_ID not set - If using multiple nodes then you must use the same Cluster ID for each one" - KAFKA_KRAFT_CLUSTER_ID="$("${KAFKA_HOME}/bin/kafka-storage.sh" random-uuid)" - info "Generated Kafka cluster ID '${KAFKA_KRAFT_CLUSTER_ID}'" - fi - args+=("--cluster-id=$KAFKA_KRAFT_CLUSTER_ID") - - # SCRAM users are configured during the cluster bootstrapping process and can later be manually updated using kafka-config.sh - if is_boolean_yes "${KAFKA_KRAFT_BOOTSTRAP_SCRAM_USERS:-}"; then - info "Adding KRaft SCRAM users at storage bootstrap" - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - # Configure SCRAM-SHA-256 if enabled - if grep -Eq "^sasl.enabled.mechanisms=.*SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - for ((i = 0; i < ${#users[@]}; i++)); do - args+=("--add-scram" "SCRAM-SHA-256=[name=${users[i]},password=${passwords[i]}]") - done - fi - # Configure SCRAM-SHA-512 if enabled - if grep -Eq "^sasl.enabled.mechanisms=.*SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - for ((i = 0; i < ${#users[@]}; i++)); do - args+=("--add-scram" "SCRAM-SHA-512=[name=${users[i]},password=${passwords[i]}]") - done - fi - # Add interbroker credentials - if grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-256=[name=${KAFKA_INTER_BROKER_USER},password=${KAFKA_INTER_BROKER_PASSWORD}]") - elif grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-512=[name=${KAFKA_INTER_BROKER_USER},password=${KAFKA_INTER_BROKER_PASSWORD}]") - fi - # Add controller credentials - if grep -Eq "^sasl.mechanism.controller.protocol=SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-256=[name=${KAFKA_CONTROLLER_USER},password=${KAFKA_CONTROLLER_PASSWORD}]") - elif grep -Eq "^sasl.mechanism.controller.protocol=SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-512=[name=${KAFKA_CONTROLLER_USER},password=${KAFKA_CONTROLLER_PASSWORD}]") - fi - fi - info "Formatting storage directories to add metadata..." - "${KAFKA_HOME}/bin/kafka-storage.sh" format "${args[@]}" -} - -######################## -# Detects inconsitences between the configuration at KAFKA_CONF_FILE and cluster-state file -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_kraft_quorum_voters_changed(){ - read -r -a quorum_voters_conf_ids <<<"$(grep "^controller.quorum.voters=" "$KAFKA_CONF_FILE" | sed "s/^controller.quorum.voters=//" | tr "," " " | sed -E "s/\@\S+//g")" - read -r -a quorum_voters_state_ids <<< "$(grep -Eo "\{\"voterId\":[0-9]+\}" "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" | grep -Eo "[0-9]+" | tr "\n" " ")" - - if [[ "${#quorum_voters_conf_ids[@]}" != "${#quorum_voters_state_ids[@]}" ]]; then - true - else - read -r -a sorted_state <<< "$(echo "${quorum_voters_conf_ids[@]}" | tr ' ' '\n' | sort | tr '\n' ' ')" - read -r -a sorted_conf <<< "$(echo "${quorum_voters_state_ids[@]}" | tr ' ' '\n' | sort | tr '\n' ' ')" - if [[ "${sorted_state[*]}" = "${sorted_conf[*]}" ]]; then - false - else - true - fi - fi -} - -######################## -# Initialize Kafka -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_initialize() { - info "Initializing Kafka..." - # Check for mounted configuration files - if ! is_dir_empty "$KAFKA_MOUNTED_CONF_DIR"; then - cp -Lr "$KAFKA_MOUNTED_CONF_DIR"/* "$KAFKA_CONF_DIR" - fi - # Copy truststore to cert directory - for cert_var in KAFKA_TLS_TRUSTSTORE_FILE KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE; do - # Only copy if the file exists and it is in a different location than KAFKA_CERTS_DIR (to avoid copying to the same location) - if [[ -f "${!cert_var}" ]] && ! [[ "${!cert_var}" =~ $KAFKA_CERTS_DIR ]]; then - info "Copying truststore ${!cert_var} to ${KAFKA_CERTS_DIR}" - cp -L "${!cert_var}" "$KAFKA_CERTS_DIR" - fi - done - - if [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/server.properties" ]]; then - info "No injected configuration files found, creating default config files" - # Restore original server.properties but remove Zookeeper/KRaft specific settings for compatibility with both architectures - cp "${KAFKA_CONF_DIR}/server.properties.original" "$KAFKA_CONF_FILE" - kafka_server_unify_conf - # Configure Kafka settings - kafka_server_conf_set log.dirs "$KAFKA_DATA_DIR" - kafka_configure_from_environment_variables - # Configure Kafka producer/consumer to set up message sizes - ! is_empty_value "${KAFKA_CFG_MAX_REQUEST_SIZE:-}" && kafka_common_conf_set "$KAFKA_CONF_DIR/producer.properties" max.request.size "$KAFKA_CFG_MAX_REQUEST_SIZE" - ! is_empty_value "${KAFKA_CFG_MAX_PARTITION_FETCH_BYTES:-}" && kafka_common_conf_set "$KAFKA_CONF_DIR/consumer.properties" max.partition.fetch.bytes "$KAFKA_CFG_MAX_PARTITION_FETCH_BYTES" - # Zookeeper mode additional settings - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SSL ]]; then - kafka_zookeeper_configure_tls - fi - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SASL ]]; then - kafka_zookeeper_configure_jaas - fi - fi - # If at least one listener uses SSL or SASL_SSL, ensure SSL is configured - if kafka_has_ssl_listener; then - kafka_configure_ssl - fi - # If at least one listener uses SASL_PLAINTEXT or SASL_SSL, ensure SASL is configured - if kafka_has_sasl_listener; then - if [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM ]]; then - if ! is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}"; then - if [[ "$(kafka_get_version)" =~ ^3\.2\.|^3\.3\.|^3\.4\. ]]; then - # NOTE: This will depend on Kafka version when support for SCRAM is added - warn "KRaft mode requires Kafka version 3.5 or higher for SCRAM to be supported. SCRAM SASL mechanisms will now be disabled." - KAFKA_CFG_SASL_ENABLED_MECHANISMS=PLAIN - else - export KAFKA_KRAFT_BOOTSTRAP_SCRAM_USERS="true" - fi - fi - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - export KAFKA_ZOOKEEPER_BOOTSTRAP_SCRAM_USERS="true" - fi - fi - kafka_server_conf_set sasl.enabled.mechanisms "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" - fi - # Settings for each Kafka Listener are configured individually - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - - if [[ "$protocol" = "SSL" || "$protocol" = "SASL_SSL" ]]; then - listener_upper="$(echo "$listener" | tr '[:lower:]' '[:upper:]')" - env_name="KAFKA_TLS_${listener_upper}_CLIENT_AUTH" - [[ -n "${!env_name:-}" ]] && kafka_server_conf_set "listener.name.${listener_lower}.ssl.client.auth" "${!env_name}" - fi - if [[ "$protocol" = "SASL_PLAINTEXT" || "$protocol" = "SASL_SSL" ]]; then - local role="" - if [[ "$listener" = "${KAFKA_CFG_INTER_BROKER_LISTENER_NAME:-INTERNAL}" ]]; then - kafka_server_conf_set sasl.mechanism.inter.broker.protocol "$KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL" - role="inter-broker" - elif [[ "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-CONTROLLER}" =~ $listener ]]; then - kafka_server_conf_set sasl.mechanism.controller.protocol "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - kafka_server_conf_set "listener.name.${listener_lower}.sasl.enabled.mechanisms" "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - role="controller" - fi - # If KAFKA_CLIENT_LISTENER_NAME is found in the listeners list, configure the producer/consumer accordingly - if [[ "$listener" = "${KAFKA_CLIENT_LISTENER_NAME:-CLIENT}" ]]; then - kafka_configure_consumer_producer_jaas - kafka_producer_consumer_conf_set security.protocol "$protocol" - kafka_producer_consumer_conf_set sasl.mechanism "${KAFKA_CLIENT_SASL_MECHANISM:-$(kafka_client_sasl_mechanism)}" - fi - # Configure inline listener jaas configuration, omitted if mounted JAAS conf file detected - if [[ ! -f "${KAFKA_CONF_DIR}/kafka_jaas.conf" ]]; then - kafka_configure_server_jaas "$listener_lower" "${role:-}" - fi - fi - done - # Configure Kafka using environment variables - # This is executed at the end, to allow users to override properties set by the initialization logic - kafka_configure_from_environment_variables - else - info "Detected mounted server.properties file at ${KAFKA_MOUNTED_CONF_DIR}/server.properties. Skipping configuration based on env variables" - fi - true -} - -######################## -# Returns the most secure SASL mechanism available for Kafka clients -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################## -kafka_client_sasl_mechanism() { - local sasl_mechanism="" - - if [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM-SHA-512 ]]; then - sasl_mechanism="SCRAM-SHA-512" - elif [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM-SHA-256 ]]; then - sasl_mechanism="SCRAM-SHA-256" - elif [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ PLAIN ]]; then - sasl_mechanism="PLAIN" - fi - echo "$sasl_mechanism" -} - -######################## -# Removes default settings referencing Zookeeper mode or KRaft mode -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################## -kafka_server_unify_conf() { - local -r remove_regexps=( - #Zookeeper - "s/^zookeeper\./#zookeeper./g" - "s/^group\.initial/#group.initial/g" - "s/^broker\./#broker./g" - "s/^node\./#node./g" - "s/^process\./#process./g" - "s/^listeners=/#listeners=/g" - "s/^listener\./#listener./g" - "s/^controller\./#controller./g" - "s/^inter\.broker/#inter.broker/g" - "s/^advertised\.listeners/#advertised.listeners/g" - ) - - # Map environment variables to config properties - for regex in "${remove_regexps[@]}"; do - sed -i "${regex}" "$KAFKA_CONF_FILE" - done -} - -######################## -# Dinamically set node.id/broker.id/controller.quorum.voters if their alternative environment variable _COMMAND is set -# Globals: -# KAFKA_*_COMMAND -# Arguments: -# None -# Returns: -# None -######################### -kafka_dynamic_environment_variables() { - # KRaft mode - if ! is_empty_value "${KAFKA_NODE_ID_COMMAND:-}"; then - KAFKA_CFG_NODE_ID="$(eval "${KAFKA_NODE_ID_COMMAND}")" - export KAFKA_CFG_NODE_ID - fi - if ! is_empty_value "${KAFKA_CONTROLLER_QUORUM_VOTERS_COMMAND:-}"; then - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS="$(eval "${KAFKA_CONTROLLER_QUORUM_VOTERS_COMMAND}")" - export KAFKA_CFG_CONTROLLER_QUORUM_VOTERS - fi - # Zookeeper mode - # DEPRECATED - BROKER_ID_COMMAND has been deprecated, please use KAFKA_BROKER_ID_COMMAND instead - if ! is_empty_value "${KAFKA_BROKER_ID_COMMAND:-}"; then - KAFKA_CFG_BROKER_ID="$(eval "${KAFKA_BROKER_ID_COMMAND}")" - export KAFKA_CFG_BROKER_ID - elif ! is_empty_value "${BROKER_ID_COMMAND:-}"; then - KAFKA_CFG_BROKER_ID="$(eval "${BROKER_ID_COMMAND}")" - export KAFKA_CFG_BROKER_ID - fi -} - -######################## -# Run custom initialization scripts -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_custom_init_scripts() { - if [[ -n $(find "${KAFKA_INITSCRIPTS_DIR}/" -type f -regex ".*\.\(sh\)") ]] && [[ ! -f "${KAFKA_VOLUME_DIR}/.user_scripts_initialized" ]]; then - info "Loading user's custom files from $KAFKA_INITSCRIPTS_DIR" - for f in /docker-entrypoint-initdb.d/*; do - debug "Executing $f" - case "$f" in - *.sh) - if [[ -x "$f" ]]; then - if ! "$f"; then - error "Failed executing $f" - return 1 - fi - else - warn "Sourcing $f as it is not executable by the current user, any error may cause initialization to fail" - . "$f" - fi - ;; - *) - warn "Skipping $f, supported formats are: .sh" - ;; - esac - done - touch "$KAFKA_VOLUME_DIR"/.user_scripts_initialized - fi -} - -######################## -# Check if Kafka is running -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# Whether Kafka is running -######################## -is_kafka_running() { - local pid - pid="$(get_pid_from_file "$KAFKA_PID_FILE")" - if [[ -n "$pid" ]]; then - is_service_running "$pid" - else - false - fi -} - -######################## -# Check if Kafka is running -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# Whether Kafka is not running -######################## -is_kafka_not_running() { - ! is_kafka_running -} - -######################## -# Stop Kafka -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# None -######################### -kafka_stop() { - ! is_kafka_running && return - stop_service_using_pid "$KAFKA_PID_FILE" TERM -} diff --git a/bitnami/kafka/3.7/debian-12/tags-info.yaml b/bitnami/kafka/3.7/debian-12/tags-info.yaml deleted file mode 100644 index 4cc006fe7c973..0000000000000 --- a/bitnami/kafka/3.7/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "3.7" -- 3.7-debian-12 -- 3.7.1 diff --git a/bitnami/kafka/3.8/README.md b/bitnami/kafka/3.8/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/kafka/3.8/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/kafka/3.8/debian-12/Dockerfile b/bitnami/kafka/3.8/debian-12/Dockerfile deleted file mode 100644 index bbac4e775e581..0000000000000 --- a/bitnami/kafka/3.8/debian-12/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T21:52:52Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/kafka/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="3.8.1-debian-12-r2" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/kafka" \ - org.opencontainers.image.title="kafka" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="3.8.1" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "wait-for-port-1.0.8-8-linux-${OS_ARCH}-debian-12" \ - "render-template-1.0.7-8-linux-${OS_ARCH}-debian-12" \ - "java-17.0.13-12-1-linux-${OS_ARCH}-debian-12" \ - "kafka-3.8.1-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN ln -s /opt/bitnami/scripts/kafka/entrypoint.sh /entrypoint.sh -RUN ln -s /opt/bitnami/scripts/kafka/run.sh /run.sh - -COPY rootfs / -RUN /opt/bitnami/scripts/java/postunpack.sh -RUN /opt/bitnami/scripts/kafka/postunpack.sh -ENV APP_VERSION="3.8.1" \ - BITNAMI_APP_NAME="kafka" \ - JAVA_HOME="/opt/bitnami/java" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/java/bin:/opt/bitnami/kafka/bin:$PATH" - -EXPOSE 9092 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/kafka/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/kafka/run.sh" ] diff --git a/bitnami/kafka/3.8/debian-12/docker-compose-cluster.yml b/bitnami/kafka/3.8/debian-12/docker-compose-cluster.yml deleted file mode 100644 index c5ae82604ee5d..0000000000000 --- a/bitnami/kafka/3.8/debian-12/docker-compose-cluster.yml +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - kafka-0: - image: docker.io/bitnami/kafka:3.8 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=0 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_0_data:/bitnami/kafka - kafka-1: - image: docker.io/bitnami/kafka:3.8 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=1 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_1_data:/bitnami/kafka - kafka-2: - image: docker.io/bitnami/kafka:3.8 - ports: - - "9092" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=2 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-0:9093,1@kafka-1:9093,2@kafka-2:9093 - - KAFKA_KRAFT_CLUSTER_ID=abcdefghijklmnopqrstuv - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT - # Clustering - - KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=3 - - KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR=2 - volumes: - - kafka_2_data:/bitnami/kafka - -volumes: - kafka_0_data: - driver: local - kafka_1_data: - driver: local - kafka_2_data: - driver: local diff --git a/bitnami/kafka/3.8/debian-12/docker-compose.yml b/bitnami/kafka/3.8/debian-12/docker-compose.yml deleted file mode 100644 index a07b4e21ab05c..0000000000000 --- a/bitnami/kafka/3.8/debian-12/docker-compose.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - kafka: - image: docker.io/bitnami/kafka:3.8 - ports: - - "9092:9092" - volumes: - - "kafka_data:/bitnami" - environment: - # KRaft settings - - KAFKA_CFG_NODE_ID=0 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093 - # Listeners - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT -volumes: - kafka_data: - driver: local diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index f382a6fc644a0..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "17.0.13-12-1" - }, - "kafka": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "3.8.1-0" - }, - "render-template": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.7-8" - }, - "wait-for-port": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.8-8" - } -} \ No newline at end of file diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/kafka/3.8/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/kafka/3.8/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/kafka/3.8/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/kafka/3.8/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 38802fc0bfe91..0000000000000 --- a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -if [[ "$OS_FLAVOUR" =~ photon && "$APP_VERSION" =~ ^1.8 ]]; then - # Option --module-path is not supported by JAVA 1.8 since modules were added in version 1.9 - unset JAVA_TOOL_OPTIONS -fi - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh b/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh deleted file mode 100644 index e1621b93e8083..0000000000000 --- a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka-env.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for kafka - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-kafka}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -kafka_env_vars=( - KAFKA_MOUNTED_CONF_DIR - KAFKA_INTER_BROKER_USER - KAFKA_INTER_BROKER_PASSWORD - KAFKA_CONTROLLER_USER - KAFKA_CONTROLLER_PASSWORD - KAFKA_CERTIFICATE_PASSWORD - KAFKA_TLS_TRUSTSTORE_FILE - KAFKA_TLS_TYPE - KAFKA_TLS_CLIENT_AUTH - KAFKA_OPTS - KAFKA_CFG_SASL_ENABLED_MECHANISMS - KAFKA_KRAFT_CLUSTER_ID - KAFKA_SKIP_KRAFT_STORAGE_INIT - KAFKA_CLIENT_LISTENER_NAME - KAFKA_ZOOKEEPER_PROTOCOL - KAFKA_ZOOKEEPER_PASSWORD - KAFKA_ZOOKEEPER_USER - KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD - KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD - KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE - KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME - KAFKA_ZOOKEEPER_TLS_TYPE - KAFKA_CLIENT_USERS - KAFKA_CLIENT_PASSWORDS - KAFKA_HEAP_OPTS - JAVA_TOOL_OPTIONS -) -for env_var in "${kafka_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset kafka_env_vars - -# Paths -export KAFKA_BASE_DIR="${BITNAMI_ROOT_DIR}/kafka" -export KAFKA_VOLUME_DIR="/bitnami/kafka" -export KAFKA_DATA_DIR="${KAFKA_VOLUME_DIR}/data" -export KAFKA_CONF_DIR="${KAFKA_BASE_DIR}/config" -export KAFKA_CONF_FILE="${KAFKA_CONF_DIR}/server.properties" -export KAFKA_MOUNTED_CONF_DIR="${KAFKA_MOUNTED_CONF_DIR:-${KAFKA_VOLUME_DIR}/config}" -export KAFKA_CERTS_DIR="${KAFKA_CONF_DIR}/certs" -export KAFKA_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d" -export KAFKA_LOG_DIR="${KAFKA_BASE_DIR}/logs" -export KAFKA_HOME="$KAFKA_BASE_DIR" -export PATH="${KAFKA_BASE_DIR}/bin:${BITNAMI_ROOT_DIR}/java/bin:${PATH}" - -# System users (when running with a privileged user) -export KAFKA_DAEMON_USER="kafka" -export KAFKA_DAEMON_GROUP="kafka" - -# Kafka runtime settings -export KAFKA_INTER_BROKER_USER="${KAFKA_INTER_BROKER_USER:-user}" -export KAFKA_INTER_BROKER_PASSWORD="${KAFKA_INTER_BROKER_PASSWORD:-bitnami}" -export KAFKA_CONTROLLER_USER="${KAFKA_CONTROLLER_USER:-controller_user}" -export KAFKA_CONTROLLER_PASSWORD="${KAFKA_CONTROLLER_PASSWORD:-bitnami}" -export KAFKA_CERTIFICATE_PASSWORD="${KAFKA_CERTIFICATE_PASSWORD:-}" -export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_TLS_TRUSTSTORE_FILE:-}" -export KAFKA_TLS_TYPE="${KAFKA_TLS_TYPE:-JKS}" -export KAFKA_TLS_CLIENT_AUTH="${KAFKA_TLS_CLIENT_AUTH:-required}" -export KAFKA_OPTS="${KAFKA_OPTS:-}" - -# Kafka configuration overrides -export KAFKA_CFG_SASL_ENABLED_MECHANISMS="${KAFKA_CFG_SASL_ENABLED_MECHANISMS:-PLAIN,SCRAM-SHA-256,SCRAM-SHA-512}" -export KAFKA_KRAFT_CLUSTER_ID="${KAFKA_KRAFT_CLUSTER_ID:-}" -export KAFKA_SKIP_KRAFT_STORAGE_INIT="${KAFKA_SKIP_KRAFT_STORAGE_INIT:-false}" -export KAFKA_CLIENT_LISTENER_NAME="${KAFKA_CLIENT_LISTENER_NAME:-}" - -# ZooKeeper connection settings -export KAFKA_ZOOKEEPER_PROTOCOL="${KAFKA_ZOOKEEPER_PROTOCOL:-PLAINTEXT}" -export KAFKA_ZOOKEEPER_PASSWORD="${KAFKA_ZOOKEEPER_PASSWORD:-}" -export KAFKA_ZOOKEEPER_USER="${KAFKA_ZOOKEEPER_USER:-}" -export KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD="${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD:-}" -export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD="${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD:-}" -export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE:-}" -export KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME="${KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME:-true}" -export KAFKA_ZOOKEEPER_TLS_TYPE="${KAFKA_ZOOKEEPER_TLS_TYPE:-JKS}" - -# Authentication -export KAFKA_CLIENT_USERS="${KAFKA_CLIENT_USERS:-user}" -export KAFKA_CLIENT_PASSWORDS="${KAFKA_CLIENT_PASSWORDS:-bitnami}" - -# Java settings -export KAFKA_HEAP_OPTS="${KAFKA_HEAP_OPTS:--Xmx1024m -Xms1024m}" - -# Java settings -export JAVA_TOOL_OPTIONS="${JAVA_TOOL_OPTIONS:-}" - -# Custom environment variables may be defined below diff --git a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh b/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh deleted file mode 100755 index d7413bcfc4f33..0000000000000 --- a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/entrypoint.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libkafka.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -print_welcome_page - -if [[ "$*" = *"/opt/bitnami/scripts/kafka/run.sh"* || "$*" = *"/run.sh"* ]]; then - info "** Starting Kafka setup **" - /opt/bitnami/scripts/kafka/setup.sh - info "** Kafka setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh b/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh deleted file mode 100755 index 7255563236c0b..0000000000000 --- a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/postunpack.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libkafka.sh -. /opt/bitnami/scripts/libfs.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -# Move server.properties from configtmp to config -# Temporary solution until kafka tarball places server.properties into config -if [[ -d "${KAFKA_BASE_DIR}/configtmp" ]]; then - mv "${KAFKA_BASE_DIR}/configtmp"/* "$KAFKA_CONF_DIR" - rmdir "${KAFKA_BASE_DIR}/configtmp" -fi -[[ -d "${KAFKA_BASE_DIR}/conf" ]] && rmdir "${KAFKA_BASE_DIR}/conf" - -# Ensure directories used by Kafka exist and have proper ownership and permissions -for dir in "$KAFKA_LOG_DIR" "$KAFKA_CONF_DIR" "$KAFKA_MOUNTED_CONF_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR" "$KAFKA_INITSCRIPTS_DIR"; do - ensure_dir_exists "$dir" -done -chmod -R g+rwX "$KAFKA_BASE_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR" "$KAFKA_INITSCRIPTS_DIR" - -# Move the original server.properties, so users can skip initialization logic by mounting their own server.properties directly instead of using the MOUNTED_CONF_DIR -mv "${KAFKA_CONF_DIR}/server.properties" "${KAFKA_CONF_DIR}/server.properties.original" - -# Disable logging to stdout and garbage collection -# Source: https://logging.apache.org/log4j/log4j-2.4/manual/appenders.html -replace_in_file "${KAFKA_BASE_DIR}/bin/kafka-server-start.sh" " [-]loggc" " " -replace_in_file "${KAFKA_CONF_DIR}/log4j.properties" "DailyRollingFileAppender" "ConsoleAppender" - -# Disable the default console logger in favour of KafkaAppender (which provides the exact output) -echo "log4j.appender.stdout.Threshold=OFF" >>"${KAFKA_CONF_DIR}/log4j.properties" - -# Remove invalid parameters for ConsoleAppender -remove_in_file "${KAFKA_CONF_DIR}/log4j.properties" "DatePattern" -remove_in_file "${KAFKA_CONF_DIR}/log4j.properties" "Appender.File" diff --git a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh b/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh deleted file mode 100755 index 76d4380aff57e..0000000000000 --- a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/run.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libkafka.sh -. /opt/bitnami/scripts/libos.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -if [[ -f "${KAFKA_CONF_DIR}/kafka_jaas.conf" ]]; then - export KAFKA_OPTS="${KAFKA_OPTS:-} -Djava.security.auth.login.config=${KAFKA_CONF_DIR}/kafka_jaas.conf" -fi - -cmd="$KAFKA_HOME/bin/kafka-server-start.sh" -args=("$KAFKA_CONF_FILE") -! is_empty_value "${KAFKA_EXTRA_FLAGS:-}" && args=("${args[@]}" "${KAFKA_EXTRA_FLAGS[@]}") - -info "** Starting Kafka **" -if am_i_root; then - exec_as_user "$KAFKA_DAEMON_USER" "$cmd" "${args[@]}" "$@" -else - exec "$cmd" "${args[@]}" "$@" -fi diff --git a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh b/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh deleted file mode 100755 index 5195f71910176..0000000000000 --- a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/kafka/setup.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libkafka.sh - -# Load Kafka environment variables -. /opt/bitnami/scripts/kafka-env.sh - -# Map Kafka environment variables -kafka_create_alias_environment_variables - -# Dinamically set node.id/broker.id/controller.quorum.voters if the _COMMAND environment variable is set -kafka_dynamic_environment_variables - -# Set the default tuststore locations before validation -kafka_configure_default_truststore_locations -# Ensure Kafka user and group exist when running as 'root' -am_i_root && ensure_user_exists "$KAFKA_DAEMON_USER" --group "$KAFKA_DAEMON_GROUP" -# Ensure directories used by Kafka exist and have proper ownership and permissions -for dir in "$KAFKA_LOG_DIR" "$KAFKA_CONF_DIR" "$KAFKA_MOUNTED_CONF_DIR" "$KAFKA_VOLUME_DIR" "$KAFKA_DATA_DIR"; do - if am_i_root; then - ensure_dir_exists "$dir" "$KAFKA_DAEMON_USER" "$KAFKA_DAEMON_GROUP" - else - ensure_dir_exists "$dir" - fi -done - -# Kafka validation, skipped if server.properties was mounted at either $KAFKA_MOUNTED_CONF_DIR or $KAFKA_CONF_DIR -[[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/server.properties" && ! -f "$KAFKA_CONF_FILE" ]] && kafka_validate -# Kafka initialization, skipped if server.properties was mounted at $KAFKA_CONF_DIR -[[ ! -f "$KAFKA_CONF_FILE" ]] && kafka_initialize - -# Initialise KRaft metadata storage if process.roles configured -if grep -q "^process.roles=" "$KAFKA_CONF_FILE" && ! is_boolean_yes "$KAFKA_SKIP_KRAFT_STORAGE_INIT" ; then - kafka_kraft_storage_initialize -fi -# Configure Zookeeper SCRAM users -if is_boolean_yes "${KAFKA_ZOOKEEPER_BOOTSTRAP_SCRAM_USERS:-}"; then - kafka_zookeeper_create_sasl_scram_users -fi -# KRaft controllers may get stuck starting when the controller quorum voters are changed. -# Workaround: Remove quorum-state file when scaling up/down controllers (Waiting proposal KIP-853) -# https://cwiki.apache.org/confluence/display/KAFKA/KIP-853%3A+KRaft+Voter+Changes -if [[ -f "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" ]] && grep -q "^controller.quorum.voters=" "$KAFKA_CONF_FILE" && kafka_kraft_quorum_voters_changed; then - warn "Detected inconsitences between controller.quorum.voters and quorum-state, removing it..." - rm -f "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" -fi -# Ensure custom initialization scripts are executed -kafka_custom_init_scripts diff --git a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh b/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh deleted file mode 100644 index df2459b035778..0000000000000 --- a/bitnami/kafka/3.8/debian-12/rootfs/opt/bitnami/scripts/libkafka.sh +++ /dev/null @@ -1,1176 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Kafka library - -# shellcheck disable=SC1090,SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libservice.sh - -# Functions - -######################## -# Set a configuration setting value to a file -# Globals: -# None -# Arguments: -# $1 - file -# $2 - key -# $3 - values (array) -# Returns: -# None -######################### -kafka_common_conf_set() { - local file="${1:?missing file}" - local key="${2:?missing key}" - shift - shift - local values=("$@") - - if [[ "${#values[@]}" -eq 0 ]]; then - stderr_print "missing value" - return 1 - elif [[ "${#values[@]}" -ne 1 ]]; then - for i in "${!values[@]}"; do - kafka_common_conf_set "$file" "${key[$i]}" "${values[$i]}" - done - else - value="${values[0]}" - # Check if the value was set before - if grep -q "^[#\\s]*$key\s*=.*" "$file"; then - # Update the existing key - replace_in_file "$file" "^[#\\s]*${key}\s*=.*" "${key}=${value}" false - else - # Add a new key - printf '\n%s=%s' "$key" "$value" >>"$file" - fi - fi -} - -######################## -# Returns true if at least one listener is configured using SSL -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_ssl_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENERS:-}"; then - if is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - if [[ "$KAFKA_CFG_LISTENERS" =~ SSL: || "$KAFKA_CFG_LISTENERS" =~ SASL_SSL: ]]; then - return - fi - else - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "SSL" || "$protocol" = "SASL_SSL" ]]; then - if [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - fi - fi - return 1 -} - -######################## -# Returns true if at least one listener is configured using SASL -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_sasl_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENERS:-}"; then - if is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - if [[ "$KAFKA_CFG_LISTENERS" =~ SASL_PLAINTEXT: ]] || [[ "$KAFKA_CFG_LISTENERS" =~ SASL_SSL: ]]; then - return - fi - else - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "SASL_PLAINTEXT" || "$protocol" = "SASL_SSL" ]]; then - if [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - fi - fi - return 1 -} - -######################## -# Returns true if at least one listener is configured using plaintext -# Globals: -# KAFKA_CFG_LISTENERS -# KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP -# Arguments: -# None -# Returns: -# true/false -######################### -kafka_has_plaintext_listener(){ - if ! is_empty_value "${KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP:-}"; then - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - if [[ "$protocol" = "PLAINTEXT" ]]; then - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ "$KAFKA_CFG_LISTENERS" =~ $listener ]]; then - return - fi - fi - done - else - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ "$KAFKA_CFG_LISTENERS" =~ PLAINTEXT: ]]; then - return - fi - fi - return 1 -} - -######################## -# Backwards compatibility measure to configure the TLS truststore locations -# Globals: -# KAFKA_CONF_FILE -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_default_truststore_locations() { - # Backwards compatibility measure to allow custom truststore locations but at the same time not disrupt - # the UX that the previous version of the containers and the helm chart have. - # Context: The chart and containers by default assumed that the truststore location was KAFKA_CERTS_DIR/kafka.truststore.jks or KAFKA_MOUNTED_CONF_DIR/certs/kafka.truststore.jks. - # Because of this, we could not use custom certificates in different locations (use case: A custom base image that already has a truststore). Changing the logic to allow custom - # locations implied major changes in the current user experience (which only required to mount certificates at the assumed location). In order to maintain this compatibility we need - # use this logic that sets the KAFKA_TLS_*_FILE variables to the previously assumed locations in case it is not set - - # Kafka truststore - if kafka_has_ssl_listener && is_empty_value "${KAFKA_TLS_TRUSTSTORE_FILE:-}"; then - local kafka_truststore_filename="kafka.truststore.jks" - [[ "$KAFKA_TLS_TYPE" = "PEM" ]] && kafka_truststore_filename="kafka.truststore.pem" - if [[ -f "${KAFKA_CERTS_DIR}/${kafka_truststore_filename}" ]]; then - # Mounted in /opt/bitnami/kafka/conf/certs - export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_CERTS_DIR}/${kafka_truststore_filename}" - else - # Mounted in /bitnami/kafka/conf/certs - export KAFKA_TLS_TRUSTSTORE_FILE="${KAFKA_MOUNTED_CONF_DIR}/certs/${kafka_truststore_filename}" - fi - fi - # Zookeeper truststore - if [[ "${KAFKA_ZOOKEEPER_PROTOCOL:-}" =~ SSL ]] && is_empty_value "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE:-}"; then - local zk_truststore_filename="zookeeper.truststore.jks" - [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]] && zk_truststore_filename="zookeeper.truststore.pem" - if [[ -f "${KAFKA_CERTS_DIR}/${zk_truststore_filename}" ]]; then - # Mounted in /opt/bitnami/kafka/conf/certs - export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_CERTS_DIR}/${zk_truststore_filename}" - else - # Mounted in /bitnami/kafka/conf/certs - export KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE="${KAFKA_MOUNTED_CONF_DIR}/certs/${zk_truststore_filename}" - fi - fi -} - -######################## -# Set a configuration setting value to server.properties -# Globals: -# KAFKA_CONF_FILE -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -kafka_server_conf_set() { - kafka_common_conf_set "$KAFKA_CONF_FILE" "$@" -} - -######################## -# Set a configuration setting value to producer.properties and consumer.properties -# Globals: -# KAFKA_CONF_DIR -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -kafka_producer_consumer_conf_set() { - kafka_common_conf_set "$KAFKA_CONF_DIR/producer.properties" "$@" - kafka_common_conf_set "$KAFKA_CONF_DIR/consumer.properties" "$@" -} - -######################## -# Create alias for environment variable, so both can be used -# Globals: -# None -# Arguments: -# $1 - Alias environment variable name -# $2 - Original environment variable name -# Returns: -# None -######################### -kafka_declare_alias_env() { - local -r alias="${1:?missing environment variable alias}" - local -r original="${2:?missing original environment variable}" - if printenv "${original}" >/dev/null; then - export "$alias"="${!original:-}" - fi -} - -######################## -# Map Kafka legacy environment variables to the new names -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_create_alias_environment_variables() { - suffixes=( - "ADVERTISED_LISTENERS" - "BROKER_ID" - "NODE_ID" - "CONTROLLER_QUORUM_VOTERS" - "PROCESS_ROLES" - "DEFAULT_REPLICATION_FACTOR" - "DELETE_TOPIC_ENABLE" - "INTER_BROKER_LISTENER_NAME" - "LISTENERS" - "LISTENER_SECURITY_PROTOCOL_MAP" - "LOG_DIRS" - "LOG_FLUSH_INTERVAL_MESSAGES" - "LOG_FLUSH_INTERVAL_MS" - "LOG_MESSAGE_FORMAT_VERSION" - "LOG_RETENTION_BYTES" - "LOG_RETENTION_CHECK_INTERVALS_MS" - "LOG_RETENTION_HOURS" - "LOG_SEGMENT_BYTES" - "MESSAGE_MAX_BYTES" - "NUM_IO_THREADS" - "NUM_NETWORK_THREADS" - "NUM_PARTITIONS" - "NUM_RECOVERY_THREADS_PER_DATA_DIR" - "OFFSETS_TOPIC_REPLICATION_FACTOR" - "SOCKET_RECEIVE_BUFFER_BYTES" - "SOCKET_REQUEST_MAX_BYTES" - "SOCKET_SEND_BUFFER_BYTES" - "SSL_ENDPOINT_IDENTIFICATION_ALGORITHM" - "TRANSACTION_STATE_LOG_MIN_ISR" - "TRANSACTION_STATE_LOG_REPLICATION_FACTOR" - "ZOOKEEPER_CONNECT" - "ZOOKEEPER_CONNECTION_TIMEOUT_MS" - ) - kafka_declare_alias_env "KAFKA_CFG_LOG_DIRS" "KAFKA_LOGS_DIRS" - kafka_declare_alias_env "KAFKA_CFG_LOG_SEGMENT_BYTES" "KAFKA_SEGMENT_BYTES" - kafka_declare_alias_env "KAFKA_CFG_MESSAGE_MAX_BYTES" "KAFKA_MAX_MESSAGE_BYTES" - kafka_declare_alias_env "KAFKA_CFG_ZOOKEEPER_CONNECTION_TIMEOUT_MS" "KAFKA_ZOOKEEPER_CONNECT_TIMEOUT_MS" - kafka_declare_alias_env "KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE" "KAFKA_AUTO_CREATE_TOPICS_ENABLE" - kafka_declare_alias_env "KAFKA_CLIENT_USERS" "KAFKA_BROKER_USER" - kafka_declare_alias_env "KAFKA_CLIENT_PASSWORDS" "KAFKA_BROKER_PASSWORD" - kafka_declare_alias_env "KAFKA_CLIENT_LISTENER_NAME" "KAFKA_CLIENT_LISTENER" - for s in "${suffixes[@]}"; do - kafka_declare_alias_env "KAFKA_CFG_${s}" "KAFKA_${s}" - done -} - -######################## -# Validate settings in KAFKA_* env vars -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_validate() { - debug "Validating settings in KAFKA_* env vars..." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_multi_value() { - if [[ " ${2} " != *" ${!1} "* ]]; then - print_validation_error "The allowed values for ${1} are: ${2}" - fi - } - # If process.roles configured, check its values are valid and perform additional checks for each - check_kraft_process_roles() { - read -r -a roles_list <<<"$(tr ',;' ' ' <<<"$KAFKA_CFG_PROCESS_ROLES")" - for role in "${roles_list[@]}"; do - case "$role" in - broker) ;; - controller) - if is_empty_value "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-}"; then - print_validation_error "Role 'controller' enabled but environment variable KAFKA_CFG_CONTROLLER_LISTENER_NAMES was not provided." - fi - if is_empty_value "${KAFKA_CFG_LISTENERS:-}" || [[ ! "$KAFKA_CFG_LISTENERS" =~ ${KAFKA_CFG_CONTROLLER_LISTENER_NAMES} ]]; then - print_validation_error "Role 'controller' enabled but listener ${KAFKA_CFG_CONTROLLER_LISTENER_NAMES} not found in KAFKA_CFG_LISTENERS." - fi - ;; - *) - print_validation_error "Invalid KRaft process role '$role'. Supported roles are 'broker,controller'" - ;; - esac - done - } - # Check all listeners are using a unique and valid port - check_listener_ports(){ - check_allowed_port() { - local port="${1:?missing port variable}" - local -a validate_port_args=() - ! am_i_root && validate_port_args+=("-unprivileged") - validate_port_args+=("$port") - if ! err=$(validate_port "${validate_port_args[@]}"); then - print_validation_error "An invalid port ${port} was specified in the environment variable KAFKA_CFG_LISTENERS: ${err}." - fi - } - - read -r -a listeners <<<"$(tr ',' ' ' <<<"${KAFKA_CFG_LISTENERS:-}")" - local -a ports=() - for listener in "${listeners[@]}"; do - read -r -a arr <<<"$(tr ':' ' ' <<<"$listener")" - # Obtain the port from listener string, e.g. PLAINTEXT://:9092 - port="${arr[2]}" - check_allowed_port "$port" - ports+=("$port") - done - # Check each listener is using an unique port - local -a unique_ports=() - read -r -a unique_ports <<< "$(echo "${ports[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')" - if [[ "${#ports[@]}" != "${#unique_ports[@]}" ]]; then - print_validation_error "There are listeners bound to the same port" - fi - } - check_listener_protocols(){ - local -r allowed_protocols=("PLAINTEXT" "SASL_PLAINTEXT" "SASL_SSL" "SSL") - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - # Check protocol in allowed list - if [[ ! "${allowed_protocols[*]}" =~ $protocol ]]; then - print_validation_error "Authentication protocol ${protocol} is not supported!" - fi - # If inter-broker listener configured with SASL, ensure KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL is set - if [[ "$listener" = "${KAFKA_CFG_INTER_BROKER_LISTENER_NAME:-INTERNAL}" ]]; then - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL:-}"; then - print_validation_error "When using SASL for inter broker comunication the mechanism should be provided using KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL" - fi - if is_empty_value "${KAFKA_INTER_BROKER_USER:-}" || is_empty_value "${KAFKA_INTER_BROKER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka inter-broker communications, you must provide the SASL credentials. Set the environment variables KAFKA_INTER_BROKER_USER and KAFKA_INTER_BROKER_PASSWORD to configure the credentials for SASL authentication with between brokers." - fi - fi - # If controller listener configured with SASL, ensure KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL is set - elif [[ "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-CONTROLLER}" =~ $listener ]]; then - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL:-}"; then - print_validation_error "When using SASL for controller comunication the mechanism should be provided at KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - elif [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" =~ SCRAM ]]; then - warn "KRaft controller listener may not support SCRAM-SHA-256/SCRAM-SHA-512 mechanisms. If facing any issues, we recommend switching to PLAIN mechanism. More information at: https://issues.apache.org/jira/browse/KAFKA-15513" - fi - if is_empty_value "${KAFKA_CONTROLLER_USER:-}" || is_empty_value "${KAFKA_CONTROLLER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka control plane communications, you must provide the SASL credentials. Set the environment variables KAFKA_CONTROLLER_USER and KAFKA_CONTROLLER_PASSWORD to configure the credentials for SASL authentication with between controllers." - fi - fi - else - if [[ "$protocol" = "SASL_PLAINTEXT" ]] || [[ "$protocol" = "SASL_SSL" ]]; then - if is_empty_value "${KAFKA_CLIENT_USERS:-}" || is_empty_value "${KAFKA_CLIENT_PASSWORDS:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka, you must provide the SASL credentials. Set the environment variables KAFKA_CLIENT_USERS and KAFKA_CLIENT_PASSWORDS to configure the credentials for SASL authentication with clients." - fi - fi - - fi - done - } - - if is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}" && is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - print_validation_error "Kafka haven't been configured to work in either Raft or Zookeper mode. Please make sure at least one of the modes is configured." - fi - # Check KRaft mode - if ! is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}"; then - # Only allow Zookeeper configuration if migration mode is enabled - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}" && - { is_empty_value "${KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE:-}" || ! is_boolean_yes "$KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE"; }; then - print_validation_error "Both KRaft mode and Zookeeper modes are configured, but KAFKA_CFG_ZOOKEEPER_METADATA_MIGRATION_ENABLE is not enabled" - fi - if is_empty_value "${KAFKA_CFG_NODE_ID:-}"; then - print_validation_error "KRaft mode requires an unique node.id, please set the environment variable KAFKA_CFG_NODE_ID" - fi - if is_empty_value "${KAFKA_CFG_CONTROLLER_QUORUM_VOTERS:-}"; then - print_validation_error "KRaft mode requires KAFKA_CFG_CONTROLLER_QUORUM_VOTERS to be set" - fi - check_kraft_process_roles - fi - # Check Zookeeper mode - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - # If SSL/SASL_SSL protocol configured, check certificates are provided - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SSL ]]; then - if [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "JKS" ]]; then - # Fail if truststore is not provided - if [[ ! -f "$KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE" ]]; then - print_validation_error "In order to configure the TLS encryption for Zookeeper with JKS certs you must mount your zookeeper.truststore.jks cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - # Warn if keystore is not provided, only required if Zookeper mTLS is enabled (ZOO_TLS_CLIENT_AUTH) - if [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" ]] && [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.jks" ]]; then - warn "In order to configure the mTLS for Zookeeper with JKS certs you must mount your zookeeper.keystore.jks cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - elif [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]]; then - # Fail if CA / validation cert is not provided - if [[ ! -f "$KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE" ]]; then - print_validation_error "In order to configure the TLS encryption for Zookeeper with PEM certs you must mount your zookeeper.truststore.pem cert to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - # Warn if node key or cert are not provided, only required if Zookeper mTLS is enabled (ZOO_TLS_CLIENT_AUTH) - if { [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" ]] || [[ ! -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.pem" ]] || [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/zookeeper.keystore.key" ]]; }; then - warn "In order to configure the mTLS for Zookeeper with PEM certs you must mount your zookeeper.keystore.pem cert and zookeeper.keystore.key key to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - fi - fi - # If SASL/SASL_SSL protocol configured, check certificates are provided - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SASL ]]; then - if is_empty_value "${KAFKA_ZOOKEEPER_USER:-}" || is_empty_value "${KAFKA_ZOOKEEPER_PASSWORD:-}"; then - print_validation_error "In order to configure SASL authentication for Kafka, you must provide the SASL credentials. Set the environment variables KAFKA_ZOOKEEPER_USER and KAFKA_ZOOKEEPER_PASSWORD, to configure the credentials for SASL authentication with Zookeeper." - fi - fi - # If using plaintext protocol, check it is explicitly allowed - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" = "PLAINTEXT" ]]; then - warn "The KAFKA_ZOOKEEPER_PROTOCOL environment variable does not configure SASL and/or SSL, this setting is not recommended for production environments." - fi - fi - # Check listener ports are unique and allowed - check_listener_ports - # Check listeners are mapped to a valid security protocol - check_listener_protocols - # Warn users if plaintext listeners are configured - if kafka_has_plaintext_listener; then - warn "Kafka has been configured with a PLAINTEXT listener, this setting is not recommended for production environments." - fi - # If SSL/SASL_SSL listeners configured, check certificates are provided - if kafka_has_ssl_listener; then - if [[ "$KAFKA_TLS_TYPE" = "JKS" ]] && - { [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.jks" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.jks" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; }; then - print_validation_error "In order to configure the TLS encryption for Kafka with JKS certs you must mount your kafka.keystore.jks and kafka.truststore.jks certs to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - elif [[ "$KAFKA_TLS_TYPE" = "PEM" ]] && - { [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.pem" ]] || [[ ! -f "${KAFKA_CERTS_DIR}/kafka.keystore.key" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; } && - { [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.pem" ]] || [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/certs/kafka.keystore.key" ]] || [[ ! -f "$KAFKA_TLS_TRUSTSTORE_FILE" ]]; }; then - print_validation_error "In order to configure the TLS encryption for Kafka with PEM certs you must mount your kafka.keystore.pem, kafka.keystore.key and kafka.truststore.pem certs to the ${KAFKA_MOUNTED_CONF_DIR}/certs directory." - fi - fi - # If SASL/SASL_SSL listeners configured, check passwords are provided - if kafka_has_sasl_listener; then - if is_empty_value "${KAFKA_CFG_SASL_ENABLED_MECHANISMS:-}"; then - print_validation_error "Specified SASL protocol but no SASL mechanisms provided in KAFKA_CFG_SASL_ENABLED_MECHANISMS" - fi - fi - # Check users and passwords lists are the same size - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS:-}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS:-}")" - if [[ "${#users[@]}" -ne "${#passwords[@]}" ]]; then - print_validation_error "Specify the same number of passwords on KAFKA_CLIENT_PASSWORDS as the number of users on KAFKA_CLIENT_USERS!" - fi - check_multi_value "KAFKA_TLS_TYPE" "JKS PEM" - check_multi_value "KAFKA_ZOOKEEPER_TLS_TYPE" "JKS PEM" - check_multi_value "KAFKA_ZOOKEEPER_PROTOCOL" "PLAINTEXT SASL SSL SASL_SSL" - check_multi_value "KAFKA_TLS_CLIENT_AUTH" "none requested required" - [[ "$error_code" -eq 0 ]] || return "$error_code" -} - -######################## -# Get kafka version -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# version -######################### -kafka_get_version() { - local -a cmd=("kafka-topics.sh" "--version") - am_i_root && cmd=("run_as_user" "$KAFKA_DAEMON_USER" "${cmd[@]}") - - read -r -a ver_split <<< "$("${cmd[@]}")" - echo "${ver_split[0]}" -} - -######################### -# Configure JAAS for a given listener and SASL mechanisms -# Globals: -# KAFKA_* -# Arguments: -# $1 - Name of the listener JAAS will be configured for -# $2 - Comma-separated list of SASL mechanisms to configure -# $3 - Comma-separated list of usernames -# $4 - Comma-separated list of passwords -# Returns: -# None -######################### -kafka_configure_server_jaas() { - local listener="${1:?missing listener name}" - local role="${2:-}" - - if [[ "$role" = "controller" ]]; then - local jaas_content=() - if [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" = "PLAIN" ]]; then - jaas_content=( - "org.apache.kafka.common.security.plain.PlainLoginModule required" - "username=\"${KAFKA_CONTROLLER_USER}\"" - "password=\"${KAFKA_CONTROLLER_PASSWORD}\"" - "user_${KAFKA_CONTROLLER_USER}=\"${KAFKA_CONTROLLER_PASSWORD}\";" - ) - elif [[ "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" =~ SCRAM ]]; then - jaas_content=( - "org.apache.kafka.common.security.scram.ScramLoginModule required" - "username=\"${KAFKA_CONTROLLER_USER}\"" - "password=\"${KAFKA_CONTROLLER_PASSWORD}\";" - ) - fi - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - sasl_mechanism_lower="$(echo "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" | tr '[:upper:]' '[:lower:]')" - kafka_server_conf_set "listener.name.${listener_lower}.${sasl_mechanism_lower}.sasl.jaas.config" "${jaas_content[*]}" - else - read -r -a sasl_mechanisms_arr <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_SASL_ENABLED_MECHANISMS")" - read -r -a users <<<"$(tr ',;' ' ' <<<"$KAFKA_CLIENT_USERS")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"$KAFKA_CLIENT_PASSWORDS")" - # Configure JAAS for each SASL mechanism - # ref: https://docs.confluent.io/platform/current/kafka/authentication_sasl/index.html - for sasl_mechanism in "${sasl_mechanisms_arr[@]}"; do - local jaas_content=() - # For PLAIN mechanism, only the first username will be used - if [[ "$sasl_mechanism" = "PLAIN" ]]; then - jaas_content=("org.apache.kafka.common.security.plain.PlainLoginModule required") - if [[ "$role" = "inter-broker" ]]; then - jaas_content+=( - "username=\"${KAFKA_INTER_BROKER_USER}\"" - "password=\"${KAFKA_INTER_BROKER_PASSWORD}\"" - ) - users+=("$KAFKA_INTER_BROKER_USER") - passwords+=("$KAFKA_INTER_BROKER_PASSWORD") - fi - for ((i = 0; i < ${#users[@]}; i++)); do - jaas_content+=("user_${users[i]}=\"${passwords[i]}\"") - done - # Add semi-colon to the last element of the array - jaas_content[${#jaas_content[@]} - 1]="${jaas_content[${#jaas_content[@]} - 1]};" - elif [[ "$sasl_mechanism" =~ SCRAM ]]; then - if [[ "$role" = "inter-broker" ]]; then - jaas_content=( - "org.apache.kafka.common.security.scram.ScramLoginModule required" - "username=\"${KAFKA_INTER_BROKER_USER}\"" - "password=\"${KAFKA_INTER_BROKER_PASSWORD}\";" - ) - else - jaas_content=("org.apache.kafka.common.security.scram.ScramLoginModule required;") - fi - fi - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - sasl_mechanism_lower="$(echo "$sasl_mechanism" | tr '[:upper:]' '[:lower:]')" - kafka_server_conf_set "listener.name.${listener_lower}.${sasl_mechanism_lower}.sasl.jaas.config" "${jaas_content[*]}" - done - fi -} - -######################## -# Configure Zookeeper JAAS authentication -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_zookeeper_configure_jaas(){ - local jaas_content=( - "org.apache.kafka.common.security.plain.PlainLoginModule required" - "username=\"${KAFKA_ZOOKEEPER_USER}\"" - "password=\"${KAFKA_ZOOKEEPER_PASSWORD}\";" - ) - - kafka_server_conf_set "sasl.jaas.config" "${jaas_content[*]}" -} - -######################## -# Generate JAAS authentication file for local producer/consumer to use -# Globals: -# KAFKA_* -# Arguments: -# $1 - Authentication protocol to use for the internal listener -# $2 - Authentication protocol to use for the client listener -# Returns: -# None -######################### -kafka_configure_consumer_producer_jaas(){ - local jaas_content=() - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - - if [[ "${KAFKA_CFG_SASL_ENABLED_MECHANISMS}" =~ SCRAM ]]; then - jaas_content=("org.apache.kafka.common.security.scram.ScramLoginModule required") - elif [[ "${KAFKA_CFG_SASL_ENABLED_MECHANISMS}" =~ PLAIN ]]; then - jaas_content=("org.apache.kafka.common.security.plain.PlainLoginModule required") - else - error "Couldn't configure a supported SASL mechanism for Kafka consumer/producer properties" - exit 1 - fi - - jaas_content+=( - "username=\"${users[0]}\"" - "password=\"${passwords[0]}\";" - ) - - kafka_producer_consumer_conf_set "sasl.jaas.config" "${jaas_content[*]}" -} - -######################## -# Create users in zookeper when using SASL/SCRAM mechanism -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_zookeeper_create_sasl_scram_users() { - info "Creating users in Zookeeper" - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - local zookeeper_connect - zookeeper_connect=$(grep "^zookeeper.connect=" "$KAFKA_CONF_FILE" | sed -E 's/^zookeeper\.connect=(\S+)$/\1/') - read -r -a zookeeper_hosts <<<"$(tr ',;' ' ' <<<"${zookeeper_connect}")" - - if [[ "${#zookeeper_hosts[@]}" -eq 0 ]]; then - error "Couldn't obtain zookeeper.connect from $KAFKA_CONF_FILE" - exit 1 - fi - # Wait for Zookeeper to be reachable - read -r -a aux <<<"$(tr ':' ' ' <<<"${zookeeper_hosts[0]}")" - local host="${aux[0]:?missing host}" - local port="${aux[1]:-2181}" - wait-for-port --host "$host" "$port" - - # Add interbroker credentials - if grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM" "$KAFKA_CONF_FILE"; then - users+=("${KAFKA_INTER_BROKER_USER}") - passwords+=("${KAFKA_INTER_BROKER_PASSWORD}") - fi - for ((i = 0; i < ${#users[@]}; i++)); do - debug "Creating user ${users[i]} in zookeeper" - # Ref: https://docs.confluent.io/current/kafka/authentication_sasl/authentication_sasl_scram.html#sasl-scram-overview - debug_execute kafka-configs.sh --zookeeper "$zookeeper_connect" --alter --add-config "SCRAM-SHA-256=[iterations=8192,password=${passwords[i]}],SCRAM-SHA-512=[password=${passwords[i]}]" --entity-type users --entity-name "${users[i]}" - done -} - -######################## -# Configure Kafka SSL settings -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_ssl() { - # Configures both Kafka server and producers/consumers - configure_both() { - kafka_server_conf_set "${1:?missing key}" "${2:?missing value}" - kafka_producer_consumer_conf_set "${1:?missing key}" "${2:?missing value}" - } - kafka_server_conf_set "ssl.client.auth" "${KAFKA_TLS_CLIENT_AUTH}" - configure_both ssl.keystore.type "${KAFKA_TLS_TYPE}" - configure_both ssl.truststore.type "${KAFKA_TLS_TYPE}" - local -r kafka_truststore_location="${KAFKA_CERTS_DIR}/$(basename "${KAFKA_TLS_TRUSTSTORE_FILE}")" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.key.password "$KAFKA_CERTIFICATE_PASSWORD" - if [[ "$KAFKA_TLS_TYPE" = "PEM" ]]; then - file_to_multiline_property() { - awk 'NR > 1{print line"\\n\\"}{line=$0;}END{print $0" "}' <"${1:?missing file}" - } - remove_previous_cert_value() { - local key="${1:?missing key}" - files=( - "${KAFKA_CONF_FILE}" - "${KAFKA_CONF_DIR}/producer.properties" - "${KAFKA_CONF_DIR}/consumer.properties" - ) - for file in "${files[@]}"; do - if grep -q "^[#\\s]*$key\s*=.*" "$file"; then - # Delete all lines from the certificate beginning to its end - sed -i "/^[#\\s]*$key\s*=.*-----BEGIN/,/-----END/d" "$file" - fi - done - } - # We need to remove the previous cert value - # kafka_common_conf_set uses replace_in_file, which can't match multiple lines - remove_previous_cert_value ssl.keystore.key - remove_previous_cert_value ssl.keystore.certificate.chain - remove_previous_cert_value ssl.truststore.certificates - configure_both ssl.keystore.key "$(file_to_multiline_property "${KAFKA_CERTS_DIR}/kafka.keystore.key")" - configure_both ssl.keystore.certificate.chain "$(file_to_multiline_property "${KAFKA_CERTS_DIR}/kafka.keystore.pem")" - configure_both ssl.truststore.certificates "$(file_to_multiline_property "${kafka_truststore_location}")" - elif [[ "$KAFKA_TLS_TYPE" = "JKS" ]]; then - configure_both ssl.keystore.location "$KAFKA_CERTS_DIR"/kafka.keystore.jks - configure_both ssl.truststore.location "$kafka_truststore_location" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.keystore.password "$KAFKA_CERTIFICATE_PASSWORD" - ! is_empty_value "${KAFKA_CERTIFICATE_PASSWORD:-}" && configure_both ssl.truststore.password "$KAFKA_CERTIFICATE_PASSWORD" - fi - true # Avoid the function to fail due to the check above -} - -######################## -# Get Zookeeper TLS settings -# Globals: -# KAFKA_ZOOKEEPER_TLS_* -# Arguments: -# None -# Returns: -# String -######################### -kafka_zookeeper_configure_tls() { - # Note that ZooKeeper does not support a key password different from the keystore password, - # so be sure to set the key password in the keystore to be identical to the keystore password; - # otherwise the connection attempt to Zookeeper will fail. - local keystore_location="" - local -r kafka_zk_truststore_location="${KAFKA_CERTS_DIR}/$(basename "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE}")" - - if [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "JKS" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" ]]; then - keystore_location="${KAFKA_CERTS_DIR}/zookeeper.keystore.jks" - elif [[ "$KAFKA_ZOOKEEPER_TLS_TYPE" = "PEM" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" ]] && [[ -f "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" ]]; then - # Concatenating private key into public certificate file - # This is needed to load keystore from location using PEM - keystore_location="${KAFKA_CERTS_DIR}/zookeeper.keypair.pem" - cat "${KAFKA_CERTS_DIR}/zookeeper.keystore.pem" "${KAFKA_CERTS_DIR}/zookeeper.keystore.key" > "$keystore_location" - fi - - kafka_server_conf_set "zookeeper.clientCnxnSocket" "org.apache.zookeeper.ClientCnxnSocketNetty" - kafka_server_conf_set "zookeeper.ssl.client.enable" "true" - is_boolean_yes "${KAFKA_ZOOKEEPER_TLS_VERIFY_HOSTNAME:-}" && kafka_server_conf_set "zookeeper.ssl.endpoint.identification.algorithm" "HTTPS" - ! is_empty_value "${keystore_location:-}" && kafka_server_conf_set "zookeeper.ssl.keystore.location" "${keystore_location}" - ! is_empty_value "${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD:-}" && kafka_server_conf_set "zookeeper.ssl.keystore.password" "${KAFKA_ZOOKEEPER_TLS_KEYSTORE_PASSWORD}" - ! is_empty_value "${kafka_zk_truststore_location:-}" && kafka_server_conf_set "zookeeper.ssl.truststore.location" "${kafka_zk_truststore_location}" - ! is_empty_value "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD:-}" && kafka_server_conf_set "zookeeper.ssl.truststore.password" "${KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_PASSWORD}" - true # Avoid the function to fail due to the check above -} - -######################## -# Configure Kafka configuration files from environment variables -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_configure_from_environment_variables() { - # List of special cases to apply to the variables - local -r exception_regexps=( - "s/sasl\.ssl/sasl_ssl/g" - "s/sasl\.plaintext/sasl_plaintext/g" - ) - # Map environment variables to config properties - for var in "${!KAFKA_CFG_@}"; do - key="$(echo "$var" | sed -e 's/^KAFKA_CFG_//g' -e 's/_/\./g' | tr '[:upper:]' '[:lower:]')" - - # Exception for the camel case in this environment variable - [[ "$var" == "KAFKA_CFG_ZOOKEEPER_CLIENTCNXNSOCKET" ]] && key="zookeeper.clientCnxnSocket" - - # Apply exception regexps - for regex in "${exception_regexps[@]}"; do - key="$(echo "$key" | sed "$regex")" - done - - value="${!var}" - kafka_server_conf_set "$key" "$value" - done -} - -######################## -# Initialize KRaft storage -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_kraft_storage_initialize() { - local args=("--config" "$KAFKA_CONF_FILE" "--ignore-formatted") - info "Initializing KRaft storage metadata" - - # If cluster.id found in meta.properties, use it - if [[ -f "${KAFKA_DATA_DIR}/meta.properties" ]]; then - KAFKA_KRAFT_CLUSTER_ID=$(grep "^cluster.id=" "${KAFKA_DATA_DIR}/meta.properties" | sed -E 's/^cluster\.id=(\S+)$/\1/') - fi - - if is_empty_value "${KAFKA_KRAFT_CLUSTER_ID:-}"; then - warn "KAFKA_KRAFT_CLUSTER_ID not set - If using multiple nodes then you must use the same Cluster ID for each one" - KAFKA_KRAFT_CLUSTER_ID="$("${KAFKA_HOME}/bin/kafka-storage.sh" random-uuid)" - info "Generated Kafka cluster ID '${KAFKA_KRAFT_CLUSTER_ID}'" - fi - args+=("--cluster-id=$KAFKA_KRAFT_CLUSTER_ID") - - # SCRAM users are configured during the cluster bootstrapping process and can later be manually updated using kafka-config.sh - if is_boolean_yes "${KAFKA_KRAFT_BOOTSTRAP_SCRAM_USERS:-}"; then - info "Adding KRaft SCRAM users at storage bootstrap" - read -r -a users <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_USERS}")" - read -r -a passwords <<<"$(tr ',;' ' ' <<<"${KAFKA_CLIENT_PASSWORDS}")" - # Configure SCRAM-SHA-256 if enabled - if grep -Eq "^sasl.enabled.mechanisms=.*SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - for ((i = 0; i < ${#users[@]}; i++)); do - args+=("--add-scram" "SCRAM-SHA-256=[name=${users[i]},password=${passwords[i]}]") - done - fi - # Configure SCRAM-SHA-512 if enabled - if grep -Eq "^sasl.enabled.mechanisms=.*SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - for ((i = 0; i < ${#users[@]}; i++)); do - args+=("--add-scram" "SCRAM-SHA-512=[name=${users[i]},password=${passwords[i]}]") - done - fi - # Add interbroker credentials - if grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-256=[name=${KAFKA_INTER_BROKER_USER},password=${KAFKA_INTER_BROKER_PASSWORD}]") - elif grep -Eq "^sasl.mechanism.inter.broker.protocol=SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-512=[name=${KAFKA_INTER_BROKER_USER},password=${KAFKA_INTER_BROKER_PASSWORD}]") - fi - # Add controller credentials - if grep -Eq "^sasl.mechanism.controller.protocol=SCRAM-SHA-256" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-256=[name=${KAFKA_CONTROLLER_USER},password=${KAFKA_CONTROLLER_PASSWORD}]") - elif grep -Eq "^sasl.mechanism.controller.protocol=SCRAM-SHA-512" "$KAFKA_CONF_FILE"; then - args+=("--add-scram" "SCRAM-SHA-512=[name=${KAFKA_CONTROLLER_USER},password=${KAFKA_CONTROLLER_PASSWORD}]") - fi - fi - info "Formatting storage directories to add metadata..." - "${KAFKA_HOME}/bin/kafka-storage.sh" format "${args[@]}" -} - -######################## -# Detects inconsitences between the configuration at KAFKA_CONF_FILE and cluster-state file -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_kraft_quorum_voters_changed(){ - read -r -a quorum_voters_conf_ids <<<"$(grep "^controller.quorum.voters=" "$KAFKA_CONF_FILE" | sed "s/^controller.quorum.voters=//" | tr "," " " | sed -E "s/\@\S+//g")" - read -r -a quorum_voters_state_ids <<< "$(grep -Eo "\{\"voterId\":[0-9]+\}" "${KAFKA_DATA_DIR}/__cluster_metadata-0/quorum-state" | grep -Eo "[0-9]+" | tr "\n" " ")" - - if [[ "${#quorum_voters_conf_ids[@]}" != "${#quorum_voters_state_ids[@]}" ]]; then - true - else - read -r -a sorted_state <<< "$(echo "${quorum_voters_conf_ids[@]}" | tr ' ' '\n' | sort | tr '\n' ' ')" - read -r -a sorted_conf <<< "$(echo "${quorum_voters_state_ids[@]}" | tr ' ' '\n' | sort | tr '\n' ' ')" - if [[ "${sorted_state[*]}" = "${sorted_conf[*]}" ]]; then - false - else - true - fi - fi -} - -######################## -# Initialize Kafka -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_initialize() { - info "Initializing Kafka..." - # Check for mounted configuration files - if ! is_dir_empty "$KAFKA_MOUNTED_CONF_DIR"; then - cp -Lr "$KAFKA_MOUNTED_CONF_DIR"/* "$KAFKA_CONF_DIR" - fi - # Copy truststore to cert directory - for cert_var in KAFKA_TLS_TRUSTSTORE_FILE KAFKA_ZOOKEEPER_TLS_TRUSTSTORE_FILE; do - # Only copy if the file exists and it is in a different location than KAFKA_CERTS_DIR (to avoid copying to the same location) - if [[ -f "${!cert_var}" ]] && ! [[ "${!cert_var}" =~ $KAFKA_CERTS_DIR ]]; then - info "Copying truststore ${!cert_var} to ${KAFKA_CERTS_DIR}" - cp -L "${!cert_var}" "$KAFKA_CERTS_DIR" - fi - done - - if [[ ! -f "${KAFKA_MOUNTED_CONF_DIR}/server.properties" ]]; then - info "No injected configuration files found, creating default config files" - # Restore original server.properties but remove Zookeeper/KRaft specific settings for compatibility with both architectures - cp "${KAFKA_CONF_DIR}/server.properties.original" "$KAFKA_CONF_FILE" - kafka_server_unify_conf - # Configure Kafka settings - kafka_server_conf_set log.dirs "$KAFKA_DATA_DIR" - kafka_configure_from_environment_variables - # Configure Kafka producer/consumer to set up message sizes - ! is_empty_value "${KAFKA_CFG_MAX_REQUEST_SIZE:-}" && kafka_common_conf_set "$KAFKA_CONF_DIR/producer.properties" max.request.size "$KAFKA_CFG_MAX_REQUEST_SIZE" - ! is_empty_value "${KAFKA_CFG_MAX_PARTITION_FETCH_BYTES:-}" && kafka_common_conf_set "$KAFKA_CONF_DIR/consumer.properties" max.partition.fetch.bytes "$KAFKA_CFG_MAX_PARTITION_FETCH_BYTES" - # Zookeeper mode additional settings - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SSL ]]; then - kafka_zookeeper_configure_tls - fi - if [[ "$KAFKA_ZOOKEEPER_PROTOCOL" =~ SASL ]]; then - kafka_zookeeper_configure_jaas - fi - fi - # If at least one listener uses SSL or SASL_SSL, ensure SSL is configured - if kafka_has_ssl_listener; then - kafka_configure_ssl - fi - # If at least one listener uses SASL_PLAINTEXT or SASL_SSL, ensure SASL is configured - if kafka_has_sasl_listener; then - if [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM ]]; then - if ! is_empty_value "${KAFKA_CFG_PROCESS_ROLES:-}"; then - if [[ "$(kafka_get_version)" =~ ^3\.2\.|^3\.3\.|^3\.4\. ]]; then - # NOTE: This will depend on Kafka version when support for SCRAM is added - warn "KRaft mode requires Kafka version 3.5 or higher for SCRAM to be supported. SCRAM SASL mechanisms will now be disabled." - KAFKA_CFG_SASL_ENABLED_MECHANISMS=PLAIN - else - export KAFKA_KRAFT_BOOTSTRAP_SCRAM_USERS="true" - fi - fi - if ! is_empty_value "${KAFKA_CFG_ZOOKEEPER_CONNECT:-}"; then - export KAFKA_ZOOKEEPER_BOOTSTRAP_SCRAM_USERS="true" - fi - fi - kafka_server_conf_set sasl.enabled.mechanisms "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" - fi - # Settings for each Kafka Listener are configured individually - read -r -a protocol_maps <<<"$(tr ',' ' ' <<<"$KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP")" - for protocol_map in "${protocol_maps[@]}"; do - read -r -a map <<<"$(tr ':' ' ' <<<"$protocol_map")" - # Obtain the listener and protocol from protocol map string, e.g. CONTROLLER:PLAINTEXT - listener="${map[0]}" - protocol="${map[1]}" - listener_lower="$(echo "$listener" | tr '[:upper:]' '[:lower:]')" - - if [[ "$protocol" = "SSL" || "$protocol" = "SASL_SSL" ]]; then - listener_upper="$(echo "$listener" | tr '[:lower:]' '[:upper:]')" - env_name="KAFKA_TLS_${listener_upper}_CLIENT_AUTH" - [[ -n "${!env_name:-}" ]] && kafka_server_conf_set "listener.name.${listener_lower}.ssl.client.auth" "${!env_name}" - fi - if [[ "$protocol" = "SASL_PLAINTEXT" || "$protocol" = "SASL_SSL" ]]; then - local role="" - if [[ "$listener" = "${KAFKA_CFG_INTER_BROKER_LISTENER_NAME:-INTERNAL}" ]]; then - kafka_server_conf_set sasl.mechanism.inter.broker.protocol "$KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL" - role="inter-broker" - elif [[ "${KAFKA_CFG_CONTROLLER_LISTENER_NAMES:-CONTROLLER}" =~ $listener ]]; then - kafka_server_conf_set sasl.mechanism.controller.protocol "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - kafka_server_conf_set "listener.name.${listener_lower}.sasl.enabled.mechanisms" "$KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL" - role="controller" - fi - # If KAFKA_CLIENT_LISTENER_NAME is found in the listeners list, configure the producer/consumer accordingly - if [[ "$listener" = "${KAFKA_CLIENT_LISTENER_NAME:-CLIENT}" ]]; then - kafka_configure_consumer_producer_jaas - kafka_producer_consumer_conf_set security.protocol "$protocol" - kafka_producer_consumer_conf_set sasl.mechanism "${KAFKA_CLIENT_SASL_MECHANISM:-$(kafka_client_sasl_mechanism)}" - fi - # Configure inline listener jaas configuration, omitted if mounted JAAS conf file detected - if [[ ! -f "${KAFKA_CONF_DIR}/kafka_jaas.conf" ]]; then - kafka_configure_server_jaas "$listener_lower" "${role:-}" - fi - fi - done - # Configure Kafka using environment variables - # This is executed at the end, to allow users to override properties set by the initialization logic - kafka_configure_from_environment_variables - else - info "Detected mounted server.properties file at ${KAFKA_MOUNTED_CONF_DIR}/server.properties. Skipping configuration based on env variables" - fi - true -} - -######################## -# Returns the most secure SASL mechanism available for Kafka clients -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################## -kafka_client_sasl_mechanism() { - local sasl_mechanism="" - - if [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM-SHA-512 ]]; then - sasl_mechanism="SCRAM-SHA-512" - elif [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ SCRAM-SHA-256 ]]; then - sasl_mechanism="SCRAM-SHA-256" - elif [[ "$KAFKA_CFG_SASL_ENABLED_MECHANISMS" =~ PLAIN ]]; then - sasl_mechanism="PLAIN" - fi - echo "$sasl_mechanism" -} - -######################## -# Removes default settings referencing Zookeeper mode or KRaft mode -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################## -kafka_server_unify_conf() { - local -r remove_regexps=( - #Zookeeper - "s/^zookeeper\./#zookeeper./g" - "s/^group\.initial/#group.initial/g" - "s/^broker\./#broker./g" - "s/^node\./#node./g" - "s/^process\./#process./g" - "s/^listeners=/#listeners=/g" - "s/^listener\./#listener./g" - "s/^controller\./#controller./g" - "s/^inter\.broker/#inter.broker/g" - "s/^advertised\.listeners/#advertised.listeners/g" - ) - - # Map environment variables to config properties - for regex in "${remove_regexps[@]}"; do - sed -i "${regex}" "$KAFKA_CONF_FILE" - done -} - -######################## -# Dinamically set node.id/broker.id/controller.quorum.voters if their alternative environment variable _COMMAND is set -# Globals: -# KAFKA_*_COMMAND -# Arguments: -# None -# Returns: -# None -######################### -kafka_dynamic_environment_variables() { - # KRaft mode - if ! is_empty_value "${KAFKA_NODE_ID_COMMAND:-}"; then - KAFKA_CFG_NODE_ID="$(eval "${KAFKA_NODE_ID_COMMAND}")" - export KAFKA_CFG_NODE_ID - fi - if ! is_empty_value "${KAFKA_CONTROLLER_QUORUM_VOTERS_COMMAND:-}"; then - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS="$(eval "${KAFKA_CONTROLLER_QUORUM_VOTERS_COMMAND}")" - export KAFKA_CFG_CONTROLLER_QUORUM_VOTERS - fi - # Zookeeper mode - # DEPRECATED - BROKER_ID_COMMAND has been deprecated, please use KAFKA_BROKER_ID_COMMAND instead - if ! is_empty_value "${KAFKA_BROKER_ID_COMMAND:-}"; then - KAFKA_CFG_BROKER_ID="$(eval "${KAFKA_BROKER_ID_COMMAND}")" - export KAFKA_CFG_BROKER_ID - elif ! is_empty_value "${BROKER_ID_COMMAND:-}"; then - KAFKA_CFG_BROKER_ID="$(eval "${BROKER_ID_COMMAND}")" - export KAFKA_CFG_BROKER_ID - fi -} - -######################## -# Run custom initialization scripts -# Globals: -# KAFKA_* -# Arguments: -# None -# Returns: -# None -######################### -kafka_custom_init_scripts() { - if [[ -n $(find "${KAFKA_INITSCRIPTS_DIR}/" -type f -regex ".*\.\(sh\)") ]] && [[ ! -f "${KAFKA_VOLUME_DIR}/.user_scripts_initialized" ]]; then - info "Loading user's custom files from $KAFKA_INITSCRIPTS_DIR" - for f in /docker-entrypoint-initdb.d/*; do - debug "Executing $f" - case "$f" in - *.sh) - if [[ -x "$f" ]]; then - if ! "$f"; then - error "Failed executing $f" - return 1 - fi - else - warn "Sourcing $f as it is not executable by the current user, any error may cause initialization to fail" - . "$f" - fi - ;; - *) - warn "Skipping $f, supported formats are: .sh" - ;; - esac - done - touch "$KAFKA_VOLUME_DIR"/.user_scripts_initialized - fi -} - -######################## -# Check if Kafka is running -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# Whether Kafka is running -######################## -is_kafka_running() { - local pid - pid="$(get_pid_from_file "$KAFKA_PID_FILE")" - if [[ -n "$pid" ]]; then - is_service_running "$pid" - else - false - fi -} - -######################## -# Check if Kafka is running -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# Whether Kafka is not running -######################## -is_kafka_not_running() { - ! is_kafka_running -} - -######################## -# Stop Kafka -# Globals: -# KAFKA_PID_FILE -# Arguments: -# None -# Returns: -# None -######################### -kafka_stop() { - ! is_kafka_running && return - stop_service_using_pid "$KAFKA_PID_FILE" TERM -} diff --git a/bitnami/kafka/3.8/debian-12/tags-info.yaml b/bitnami/kafka/3.8/debian-12/tags-info.yaml deleted file mode 100644 index 2fb11c0e3a915..0000000000000 --- a/bitnami/kafka/3.8/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "3.8" -- 3.8-debian-12 -- 3.8.1 diff --git a/bitnami/keycloak/25/README.md b/bitnami/keycloak/25/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/keycloak/25/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/keycloak/25/debian-12/Dockerfile b/bitnami/keycloak/25/debian-12/Dockerfile deleted file mode 100644 index 3fc825c5fa17f..0000000000000 --- a/bitnami/keycloak/25/debian-12/Dockerfile +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-18T21:08:35Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/keycloak/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="25.0.6-debian-12-r4" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/keycloak" \ - org.opencontainers.image.title="keycloak" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="25.0.6" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl krb5-user libaio1 procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "wait-for-port-1.0.8-7-linux-${OS_ARCH}-debian-12" \ - "java-21.0.5-11-1-linux-${OS_ARCH}-debian-12" \ - "keycloak-25.0.6-2-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/java/postunpack.sh -RUN /opt/bitnami/scripts/keycloak/postunpack.sh -ENV APP_VERSION="25.0.6" \ - BITNAMI_APP_NAME="keycloak" \ - JAVA_HOME="/opt/bitnami/java" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/java/bin:/opt/bitnami/keycloak/bin:$PATH" - -EXPOSE 8080 8443 9000 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/keycloak/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/keycloak/run.sh" ] diff --git a/bitnami/keycloak/25/debian-12/docker-compose.yml b/bitnami/keycloak/25/debian-12/docker-compose.yml deleted file mode 100644 index 644edd15336f2..0000000000000 --- a/bitnami/keycloak/25/debian-12/docker-compose.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - postgresql: - image: docker.io/bitnami/postgresql:15 - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - POSTGRESQL_USERNAME=bn_keycloak - - POSTGRESQL_DATABASE=bitnami_keycloak - volumes: - - 'postgresql_data:/bitnami/postgresql' - - keycloak: - image: docker.io/bitnami/keycloak:25 - depends_on: - - postgresql - ports: - - "80:8080" - -volumes: - postgresql_data: - driver: local diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 6cf85ee4afc65..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "21.0.5-11-1" - }, - "keycloak": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "25.0.6-2" - }, - "wait-for-port": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.8-7" - } -} \ No newline at end of file diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/keycloak/25/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/keycloak/25/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/keycloak/25/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/keycloak/25/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 8557631d25490..0000000000000 --- a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak-env.sh b/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak-env.sh deleted file mode 100644 index 36852c78ea856..0000000000000 --- a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak-env.sh +++ /dev/null @@ -1,198 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for keycloak - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-keycloak}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -keycloak_env_vars=( - KEYCLOAK_MOUNTED_CONF_DIR - KC_RUN_IN_CONTAINER - KEYCLOAK_ADMIN - KEYCLOAK_ADMIN_PASSWORD - KEYCLOAK_HTTP_RELATIVE_PATH - KEYCLOAK_HTTP_PORT - KEYCLOAK_HTTPS_PORT - KEYCLOAK_BIND_ADDRESS - KEYCLOAK_HOSTNAME - KEYCLOAK_HOSTNAME_ADMIN - KEYCLOAK_HOSTNAME_STRICT - KEYCLOAK_INIT_MAX_RETRIES - KEYCLOAK_CACHE_TYPE - KEYCLOAK_CACHE_STACK - KEYCLOAK_CACHE_CONFIG_FILE - KEYCLOAK_EXTRA_ARGS - KEYCLOAK_ENABLE_STATISTICS - KEYCLOAK_ENABLE_HEALTH_ENDPOINTS - KEYCLOAK_ENABLE_HTTPS - KEYCLOAK_HTTPS_TRUST_STORE_FILE - KEYCLOAK_HTTPS_TRUST_STORE_PASSWORD - KEYCLOAK_HTTPS_KEY_STORE_FILE - KEYCLOAK_HTTPS_KEY_STORE_PASSWORD - KEYCLOAK_HTTPS_USE_PEM - KEYCLOAK_HTTPS_CERTIFICATE_FILE - KEYCLOAK_HTTPS_CERTIFICATE_KEY_FILE - KEYCLOAK_SPI_TRUSTSTORE_FILE - KEYCLOAK_SPI_TRUSTSTORE_PASSWORD - KEYCLOAK_SPI_TRUSTSTORE_FILE_HOSTNAME_VERIFICATION_POLICY - KEYCLOAK_LOG_LEVEL - KEYCLOAK_LOG_OUTPUT - KEYCLOAK_ROOT_LOG_LEVEL - KEYCLOAK_PROXY_HEADERS - KEYCLOAK_PRODUCTION - KEYCLOAK_EXTRA_ARGS_PREPENDED - KEYCLOAK_DATABASE_VENDOR - KEYCLOAK_DATABASE_HOST - KEYCLOAK_DATABASE_PORT - KEYCLOAK_DATABASE_USER - KEYCLOAK_DATABASE_NAME - KEYCLOAK_DATABASE_PASSWORD - KEYCLOAK_DATABASE_SCHEMA - KEYCLOAK_JDBC_PARAMS - KEYCLOAK_JDBC_DRIVER - KEYCLOAK_DAEMON_USER - KEYCLOAK_DAEMON_GROUP - KEYCLOAK_ADMIN_USER - KC_HOSTNAME - KC_HOSTNAME_ADMIN - KC_HOSTNAME_STRICT - KC_HEALTH_ENABLED - KC_HTTPS_TRUST_STORE_FILE - KC_HTTPS_TRUST_STORE_PASSWORD - KC_HTTPS_KEY_STORE_FILE - KC_HTTPS_KEY_STORE_PASSWORD - KC_HTTPS_CERTIFICATE_FILE - KC_HTTPS_CERTIFICATE_KEY_FILE - KC_SPI_TRUSTSTORE_FILE_FILE - KC_SPI_TRUSTSTORE_PASSWORD - KC_SPI_TRUSTSTORE_FILE_HOSTNAME_VERIFICATION_POLICY - DB_ADDR - DB_PORT - DB_USER - DB_DATABASE - DB_PASSWORD - DB_SCHEMA - JDBC_PARAMS -) -for env_var in "${keycloak_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset keycloak_env_vars - -# Paths -export BITNAMI_VOLUME_DIR="/bitnami" -export JAVA_HOME="/opt/bitnami/java" -export KEYCLOAK_BASE_DIR="/opt/bitnami/keycloak" -export KEYCLOAK_BIN_DIR="$KEYCLOAK_BASE_DIR/bin" -export KEYCLOAK_PROVIDERS_DIR="$KEYCLOAK_BASE_DIR/providers" -export KEYCLOAK_LOG_DIR="$KEYCLOAK_PROVIDERS_DIR/log" -export KEYCLOAK_TMP_DIR="$KEYCLOAK_PROVIDERS_DIR/tmp" -export KEYCLOAK_DOMAIN_TMP_DIR="$KEYCLOAK_BASE_DIR/domain/tmp" -export WILDFLY_BASE_DIR="/opt/bitnami/wildfly" -export KEYCLOAK_VOLUME_DIR="/bitnami/keycloak" -export KEYCLOAK_CONF_DIR="$KEYCLOAK_BASE_DIR/conf" -export KEYCLOAK_DEFAULT_CONF_DIR="$KEYCLOAK_BASE_DIR/conf.default" -export KEYCLOAK_MOUNTED_CONF_DIR="${KEYCLOAK_MOUNTED_CONF_DIR:-${KEYCLOAK_VOLUME_DIR}/conf}" -export KEYCLOAK_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d" -export KEYCLOAK_CONF_FILE="keycloak.conf" -export KEYCLOAK_DEFAULT_CONF_FILE="keycloak.conf" - -# Keycloak kc.sh context -export KC_RUN_IN_CONTAINER="${KC_RUN_IN_CONTAINER:-true}" - -# Keycloak configuration -KEYCLOAK_ADMIN="${KEYCLOAK_ADMIN:-"${KEYCLOAK_ADMIN_USER:-}"}" -export KEYCLOAK_ADMIN="${KEYCLOAK_ADMIN:-user}" -export KEYCLOAK_ADMIN_PASSWORD="${KEYCLOAK_ADMIN_PASSWORD:-bitnami}" -export KEYCLOAK_HTTP_RELATIVE_PATH="${KEYCLOAK_HTTP_RELATIVE_PATH:-/}" -export KEYCLOAK_HTTP_PORT="${KEYCLOAK_HTTP_PORT:-8080}" -export KEYCLOAK_HTTPS_PORT="${KEYCLOAK_HTTPS_PORT:-8443}" -export KEYCLOAK_BIND_ADDRESS="${KEYCLOAK_BIND_ADDRESS:-$(hostname --fqdn)}" -KEYCLOAK_HOSTNAME="${KEYCLOAK_HOSTNAME:-"${KC_HOSTNAME:-}"}" -export KEYCLOAK_HOSTNAME="${KEYCLOAK_HOSTNAME:-}" -KEYCLOAK_HOSTNAME_ADMIN="${KEYCLOAK_HOSTNAME_ADMIN:-"${KC_HOSTNAME_ADMIN:-}"}" -export KEYCLOAK_HOSTNAME_ADMIN="${KEYCLOAK_HOSTNAME_ADMIN:-}" -KEYCLOAK_HOSTNAME_STRICT="${KEYCLOAK_HOSTNAME_STRICT:-"${KC_HOSTNAME_STRICT:-}"}" -export KEYCLOAK_HOSTNAME_STRICT="${KEYCLOAK_HOSTNAME_STRICT:-false}" -export KEYCLOAK_INIT_MAX_RETRIES="${KEYCLOAK_INIT_MAX_RETRIES:-10}" -export KEYCLOAK_CACHE_TYPE="${KEYCLOAK_CACHE_TYPE:-ispn}" -export KEYCLOAK_CACHE_STACK="${KEYCLOAK_CACHE_STACK:-}" -export KEYCLOAK_CACHE_CONFIG_FILE="${KEYCLOAK_CACHE_CONFIG_FILE:-}" -export KEYCLOAK_EXTRA_ARGS="${KEYCLOAK_EXTRA_ARGS:-}" -export KEYCLOAK_ENABLE_STATISTICS="${KEYCLOAK_ENABLE_STATISTICS:-false}" -KEYCLOAK_ENABLE_HEALTH_ENDPOINTS="${KEYCLOAK_ENABLE_HEALTH_ENDPOINTS:-"${KC_HEALTH_ENABLED:-}"}" -export KEYCLOAK_ENABLE_HEALTH_ENDPOINTS="${KEYCLOAK_ENABLE_HEALTH_ENDPOINTS:-false}" -export KEYCLOAK_ENABLE_HTTPS="${KEYCLOAK_ENABLE_HTTPS:-false}" -KEYCLOAK_HTTPS_TRUST_STORE_FILE="${KEYCLOAK_HTTPS_TRUST_STORE_FILE:-"${KC_HTTPS_TRUST_STORE_FILE:-}"}" -export KEYCLOAK_HTTPS_TRUST_STORE_FILE="${KEYCLOAK_HTTPS_TRUST_STORE_FILE:-}" -KEYCLOAK_HTTPS_TRUST_STORE_PASSWORD="${KEYCLOAK_HTTPS_TRUST_STORE_PASSWORD:-"${KC_HTTPS_TRUST_STORE_PASSWORD:-}"}" -export KEYCLOAK_HTTPS_TRUST_STORE_PASSWORD="${KEYCLOAK_HTTPS_TRUST_STORE_PASSWORD:-}" -KEYCLOAK_HTTPS_KEY_STORE_FILE="${KEYCLOAK_HTTPS_KEY_STORE_FILE:-"${KC_HTTPS_KEY_STORE_FILE:-}"}" -export KEYCLOAK_HTTPS_KEY_STORE_FILE="${KEYCLOAK_HTTPS_KEY_STORE_FILE:-}" -KEYCLOAK_HTTPS_KEY_STORE_PASSWORD="${KEYCLOAK_HTTPS_KEY_STORE_PASSWORD:-"${KC_HTTPS_KEY_STORE_PASSWORD:-}"}" -export KEYCLOAK_HTTPS_KEY_STORE_PASSWORD="${KEYCLOAK_HTTPS_KEY_STORE_PASSWORD:-}" -export KEYCLOAK_HTTPS_USE_PEM="${KEYCLOAK_HTTPS_USE_PEM:-false}" -KEYCLOAK_HTTPS_CERTIFICATE_FILE="${KEYCLOAK_HTTPS_CERTIFICATE_FILE:-"${KC_HTTPS_CERTIFICATE_FILE:-}"}" -export KEYCLOAK_HTTPS_CERTIFICATE_FILE="${KEYCLOAK_HTTPS_CERTIFICATE_FILE:-}" -KEYCLOAK_HTTPS_CERTIFICATE_KEY_FILE="${KEYCLOAK_HTTPS_CERTIFICATE_KEY_FILE:-"${KC_HTTPS_CERTIFICATE_KEY_FILE:-}"}" -export KEYCLOAK_HTTPS_CERTIFICATE_KEY_FILE="${KEYCLOAK_HTTPS_CERTIFICATE_KEY_FILE:-}" -KEYCLOAK_SPI_TRUSTSTORE_FILE="${KEYCLOAK_SPI_TRUSTSTORE_FILE:-"${KC_SPI_TRUSTSTORE_FILE_FILE:-}"}" -export KEYCLOAK_SPI_TRUSTSTORE_FILE="${KEYCLOAK_SPI_TRUSTSTORE_FILE:-}" -KEYCLOAK_SPI_TRUSTSTORE_PASSWORD="${KEYCLOAK_SPI_TRUSTSTORE_PASSWORD:-"${KC_SPI_TRUSTSTORE_PASSWORD:-}"}" -export KEYCLOAK_SPI_TRUSTSTORE_PASSWORD="${KEYCLOAK_SPI_TRUSTSTORE_PASSWORD:-}" -KEYCLOAK_SPI_TRUSTSTORE_FILE_HOSTNAME_VERIFICATION_POLICY="${KEYCLOAK_SPI_TRUSTSTORE_FILE_HOSTNAME_VERIFICATION_POLICY:-"${KC_SPI_TRUSTSTORE_FILE_HOSTNAME_VERIFICATION_POLICY:-}"}" -export KEYCLOAK_SPI_TRUSTSTORE_FILE_HOSTNAME_VERIFICATION_POLICY="${KEYCLOAK_SPI_TRUSTSTORE_FILE_HOSTNAME_VERIFICATION_POLICY:-}" -export KEYCLOAK_LOG_LEVEL="${KEYCLOAK_LOG_LEVEL:-info}" -export KEYCLOAK_LOG_OUTPUT="${KEYCLOAK_LOG_OUTPUT:-default}" -export KEYCLOAK_ROOT_LOG_LEVEL="${KEYCLOAK_ROOT_LOG_LEVEL:-INFO}" -export KEYCLOAK_PROXY_HEADERS="${KEYCLOAK_PROXY_HEADERS:-}" -export KEYCLOAK_PRODUCTION="${KEYCLOAK_PRODUCTION:-false}" -export KEYCLOAK_EXTRA_ARGS_PREPENDED="${KEYCLOAK_EXTRA_ARGS_PREPENDED:-}" -export KEYCLOAK_DATABASE_VENDOR="${KEYCLOAK_DATABASE_VENDOR:-postgresql}" -KEYCLOAK_DATABASE_HOST="${KEYCLOAK_DATABASE_HOST:-"${DB_ADDR:-}"}" -export KEYCLOAK_DATABASE_HOST="${KEYCLOAK_DATABASE_HOST:-postgresql}" -KEYCLOAK_DATABASE_PORT="${KEYCLOAK_DATABASE_PORT:-"${DB_PORT:-}"}" -export KEYCLOAK_DATABASE_PORT="${KEYCLOAK_DATABASE_PORT:-5432}" -KEYCLOAK_DATABASE_USER="${KEYCLOAK_DATABASE_USER:-"${DB_USER:-}"}" -export KEYCLOAK_DATABASE_USER="${KEYCLOAK_DATABASE_USER:-bn_keycloak}" -KEYCLOAK_DATABASE_NAME="${KEYCLOAK_DATABASE_NAME:-"${DB_DATABASE:-}"}" -export KEYCLOAK_DATABASE_NAME="${KEYCLOAK_DATABASE_NAME:-bitnami_keycloak}" -KEYCLOAK_DATABASE_PASSWORD="${KEYCLOAK_DATABASE_PASSWORD:-"${DB_PASSWORD:-}"}" -export KEYCLOAK_DATABASE_PASSWORD="${KEYCLOAK_DATABASE_PASSWORD:-}" -KEYCLOAK_DATABASE_SCHEMA="${KEYCLOAK_DATABASE_SCHEMA:-"${DB_SCHEMA:-}"}" -export KEYCLOAK_DATABASE_SCHEMA="${KEYCLOAK_DATABASE_SCHEMA:-public}" -KEYCLOAK_JDBC_PARAMS="${KEYCLOAK_JDBC_PARAMS:-"${JDBC_PARAMS:-}"}" -export KEYCLOAK_JDBC_PARAMS="${KEYCLOAK_JDBC_PARAMS:-}" -export KEYCLOAK_JDBC_DRIVER="${KEYCLOAK_JDBC_DRIVER:-postgresql}" - -# System users (when running with a privileged user) -export KEYCLOAK_DAEMON_USER="${KEYCLOAK_DAEMON_USER:-keycloak}" -export KEYCLOAK_DAEMON_GROUP="${KEYCLOAK_DAEMON_GROUP:-keycloak}" - -# Custom environment variables may be defined below diff --git a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/entrypoint.sh b/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/entrypoint.sh deleted file mode 100755 index 188dab62ae483..0000000000000 --- a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/entrypoint.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -#set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libkeycloak.sh - -# Load keycloak environment variables -. /opt/bitnami/scripts/keycloak-env.sh - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/postgresql/conf) -debug "Copying files from $KEYCLOAK_DEFAULT_CONF_DIR to $KEYCLOAK_CONF_DIR" -cp -nr "$KEYCLOAK_DEFAULT_CONF_DIR"/. "$KEYCLOAK_CONF_DIR" - -if [[ "$*" = *"/opt/bitnami/scripts/keycloak/run.sh"* ]]; then - info "** Starting keycloak setup **" - /opt/bitnami/scripts/keycloak/setup.sh - info "** keycloak setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/postunpack.sh b/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/postunpack.sh deleted file mode 100755 index e0ff5adfc4b7b..0000000000000 --- a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/postunpack.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libkeycloak.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh - -# Load keycloak environment variables -. /opt/bitnami/scripts/keycloak-env.sh - -ensure_user_exists "$KEYCLOAK_ADMIN" -ensure_user_exists "$KEYCLOAK_DAEMON_USER" --group "$KEYCLOAK_DAEMON_GROUP" - -for dir in "$KEYCLOAK_LOG_DIR" "$KEYCLOAK_TMP_DIR" "$KEYCLOAK_VOLUME_DIR" "$KEYCLOAK_CONF_DIR" "$KEYCLOAK_DEFAULT_CONF_DIR" "$KEYCLOAK_INITSCRIPTS_DIR" "${KEYCLOAK_BASE_DIR}/.installation" "${KEYCLOAK_BASE_DIR}/data" "${KEYCLOAK_BASE_DIR}/lib" "$KEYCLOAK_BASE_DIR" "$KEYCLOAK_PROVIDERS_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" - chown -R "$KEYCLOAK_DAEMON_USER" "$dir" -done - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "$KEYCLOAK_CONF_DIR"/* "$KEYCLOAK_DEFAULT_CONF_DIR" diff --git a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/run.sh b/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/run.sh deleted file mode 100755 index a5f49d9068dc7..0000000000000 --- a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/run.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libkeycloak.sh -. /opt/bitnami/scripts/libos.sh - -# Load keycloak environment variables -. /opt/bitnami/scripts/keycloak-env.sh - -info "** Starting keycloak **" -# Use only basename -conf_file="${KEYCLOAK_CONF_DIR}/${KEYCLOAK_CONF_FILE}" - -is_boolean_yes "$KEYCLOAK_PRODUCTION" && start_param="start" || start_param="start-dev" - -start_command=("${KEYCLOAK_BIN_DIR}/kc.sh" "-cf" "$conf_file") - -# Prepend extra args -if [[ -n "$KEYCLOAK_EXTRA_ARGS_PREPENDED" ]]; then - read -r -a extra_args_prepended <<<"$KEYCLOAK_EXTRA_ARGS_PREPENDED" - start_command+=("${extra_args_prepended[@]}") -fi - -start_command+=("$start_param") - -# Add extra args -if [[ -n "$KEYCLOAK_EXTRA_ARGS" ]]; then - read -r -a extra_args <<<"$KEYCLOAK_EXTRA_ARGS" - start_command+=("${extra_args[@]}") -fi - -if am_i_root; then - exec_as_user "$KEYCLOAK_DAEMON_USER" /bin/bash -c "${start_command[*]}" -else - exec /bin/bash -c "${start_command[*]}" -fi diff --git a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/setup.sh b/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/setup.sh deleted file mode 100755 index 805b1cbb89081..0000000000000 --- a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/keycloak/setup.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libkeycloak.sh - -# Load keycloak environment variables -. /opt/bitnami/scripts/keycloak-env.sh - -# Ensure keycloak environment variables are valid -keycloak_validate - -# Ensure 'daemon' user exists when running as 'root' -am_i_root && ensure_user_exists "$KEYCLOAK_DAEMON_USER" --group "$KEYCLOAK_DAEMON_GROUP" - -# Ensure keycloak is initialized -keycloak_initialize - -# keycloak init scripts -keycloak_custom_init_scripts diff --git a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/libkeycloak.sh b/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/libkeycloak.sh deleted file mode 100644 index 413921f3c5c63..0000000000000 --- a/bitnami/keycloak/25/debian-12/rootfs/opt/bitnami/scripts/libkeycloak.sh +++ /dev/null @@ -1,357 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Keycloak library - -# shellcheck disable=SC1090,SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libvalidations.sh - -######################## -# Validate settings in KEYCLOAK_* env. variables -# Globals: -# KEYCLOAK_* -# Arguments: -# None -# Returns: -# None -######################### -keycloak_validate() { - info "Validating settings in KEYCLOAK_* env vars..." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - check_allowed_port() { - local port_var="${1:?missing port variable}" - local -a validate_port_args=() - ! am_i_root && validate_port_args+=("-unprivileged") - validate_port_args+=("${!port_var}") - if ! err=$(validate_port "${validate_port_args[@]}"); then - print_validation_error "An invalid port was specified in the environment variable ${port_var}: ${err}." - fi - } - - if ! is_empty_value "$KEYCLOAK_PROXY_HEADERS" && ! [[ "$KEYCLOAK_PROXY_HEADERS" =~ ^(forwarded|xforwarded)$ ]]; then - print_validation_error "The value of KEYCLOAK_PROXY_HEADERS should be either empty, 'forwarded' or 'xforwarded'" - fi - - if is_boolean_yes "$KEYCLOAK_ENABLE_HTTPS"; then - if is_boolean_yes "$KEYCLOAK_HTTPS_USE_PEM"; then - if is_empty_value "$KEYCLOAK_HTTPS_CERTIFICATE_FILE"; then - print_validation_error "Path to the TLS certificate not defined. Please set the KEYCLOAK_HTTPS_CERTIFICATE_FILE variable to the mounted PEM certificate" - fi - if is_empty_value "$KEYCLOAK_HTTPS_CERTIFICATE_KEY_FILE"; then - print_validation_error "Path to the TLS key not defined. Please set the KEYCLOAK_HTTPS_CERTIFICATE_KEY_FILE variable to the mounted PEM key" - fi - else - if is_empty_value "$KEYCLOAK_HTTPS_TRUST_STORE_FILE"; then - print_validation_error "Path to the TLS truststore file not defined. Please set the KEYCLOAK_HTTPS_TRUST_STORE_FILE variable to the mounted truststore" - fi - if is_empty_value "$KEYCLOAK_HTTPS_KEY_STORE_FILE"; then - print_validation_error "Path to the TLS keystore file not defined. Please set the KEYCLOAK_HTTPS_KEY_STORE_FILE variable to the mounted keystore" - fi - fi - fi - - if ! validate_ip "${KEYCLOAK_BIND_ADDRESS}"; then - if ! is_hostname_resolved "${KEYCLOAK_BIND_ADDRESS}"; then - print_validation_error print_validation_error "The value for KEYCLOAK_BIND_ADDRESS ($KEYCLOAK_BIND_ADDRESS) should be an IPv4 or IPv6 address, or it must be a resolvable hostname" - fi - fi - - if [[ "$KEYCLOAK_HTTP_PORT" -eq "$KEYCLOAK_HTTPS_PORT" ]]; then - print_validation_error "KEYCLOAK_HTTP_PORT and KEYCLOAK_HTTPS_PORT are bound to the same port!" - fi - check_allowed_port KEYCLOAK_HTTP_PORT - check_allowed_port KEYCLOAK_HTTPS_PORT - - for var in KEYCLOAK_ENABLE_HTTPS KEYCLOAK_ENABLE_STATISTICS KEYCLOAK_ENABLE_HEALTH_ENDPOINTS; do - if ! is_true_false_value "${!var}"; then - print_validation_error "The allowed values for $var are [true, false]" - fi - done - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Add or modify an entry in the Discourse configuration file -# Globals: -# KEYCLOAK_* -# Arguments: -# $1 - Variable name -# $2 - Value to assign to the variable -# Returns: -# None -######################### -keycloak_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:-}" - # Redact sensitive values before outputting to debug log - local redacted_value="${value}" - if [[ "${key}" =~ ^(db|https-key-store|https-trust-store|spi-truststore-file)-password$ ]]; then - redacted_value="_redacted_" - fi - debug "Setting ${key} to '${redacted_value}' in Keycloak configuration" - # Sanitize key (sed does not support fixed string substitutions) - local sanitized_pattern - sanitized_pattern="^\s*(#\s*)?$(sed 's/[]\[^$.*/]/\\&/g' <<<"$key")\s*=\s*(.*)" - local entry="${key} = ${value}" - # Check if the configuration exists in the file - if grep -q -E "$sanitized_pattern" "${KEYCLOAK_CONF_DIR}/${KEYCLOAK_CONF_FILE}"; then - # It exists, so replace the line - replace_in_file "${KEYCLOAK_CONF_DIR}/${KEYCLOAK_CONF_FILE}" "$sanitized_pattern" "$entry" - else - echo "$entry" >>"${KEYCLOAK_CONF_DIR}/${KEYCLOAK_CONF_FILE}" - fi -} - -######################## -# Configure database settings -# Globals: -# KEYCLOAK_* -# Arguments: -# None -# Returns: -# None -######################### -keycloak_configure_database() { - local jdbc_params - jdbc_params="$(echo "$KEYCLOAK_JDBC_PARAMS" | sed -E '/^$|^\&.+$/!s/^/\&/;s/\&/\\&/g')" - - info "Configuring database settings" - if [[ "${KEYCLOAK_DATABASE_VENDOR}" == "postgresql" ]]; then - keycloak_conf_set "db" "postgres" - keycloak_conf_set "db-username" "$KEYCLOAK_DATABASE_USER" - keycloak_conf_set "db-password" "$KEYCLOAK_DATABASE_PASSWORD" - keycloak_conf_set "db-url" "jdbc:${KEYCLOAK_JDBC_DRIVER}://${KEYCLOAK_DATABASE_HOST}:${KEYCLOAK_DATABASE_PORT}/${KEYCLOAK_DATABASE_NAME}?currentSchema=${KEYCLOAK_DATABASE_SCHEMA}${jdbc_params}" - else - keycloak_conf_set "db" "$KEYCLOAK_DATABASE_VENDOR" - fi -} - -######################## -# Configure cluster caching -# Globals: -# KEYCLOAK_* -# Arguments: -# None -# Returns: -# None -######################### -keycloak_configure_cache() { - info "Configuring cache count" - ! is_empty_value "$KEYCLOAK_CACHE_STACK" && keycloak_conf_set "cache-stack" "${KEYCLOAK_CACHE_STACK}" - ! is_empty_value "$KEYCLOAK_CACHE_CONFIG_FILE" && keycloak_conf_set "cache-config-file" "${KEYCLOAK_CACHE_CONFIG_FILE}" - keycloak_conf_set "cache" "$KEYCLOAK_CACHE_TYPE" -} - -######################## -# Enable statistics -# Globals: -# KEYCLOAK_* -# Arguments: -# None -# Returns: -# None -######################### -keycloak_configure_metrics() { - info "Enabling statistics" - keycloak_conf_set "metrics-enabled" "$KEYCLOAK_ENABLE_STATISTICS" -} - -######################## -# Enable health endpoints -# Globals: -# KEYCLOAK_* -# Arguments: -# None -# Returns: -# None -######################### -keycloak_configure_health_endpoints() { - info "Enabling health endpoints" - keycloak_conf_set "health-enabled" "$KEYCLOAK_ENABLE_HEALTH_ENDPOINTS" -} - -######################## -# Configure hostname -# Globals: -# KEYCLOAK_* -# Arguments: -# None -# Returns: -# None -######################### -keycloak_configure_hostname() { - info "Configuring hostname settings" - ! is_empty_value "$KEYCLOAK_HOSTNAME" && keycloak_conf_set "hostname" "${KEYCLOAK_HOSTNAME}" - ! is_empty_value "$KEYCLOAK_HOSTNAME_ADMIN" && keycloak_conf_set "hostname-admin" "${KEYCLOAK_HOSTNAME_ADMIN}" - keycloak_conf_set "hostname-strict" "${KEYCLOAK_HOSTNAME_STRICT}" -} - -######################## -# Configure http -# Globals: -# KEYCLOAK_* -# Arguments: -# None -# Returns: -# None -######################### -keycloak_configure_http() { - info "Configuring http settings" - keycloak_conf_set "http-enabled" "true" - keycloak_conf_set "http-relative-path" "${KEYCLOAK_HTTP_RELATIVE_PATH}" - keycloak_conf_set "http-port" "${KEYCLOAK_HTTP_PORT}" - keycloak_conf_set "https-port" "${KEYCLOAK_HTTPS_PORT}" -} - -######################## -# Configure logging settings -# Globals: -# KEYCLOAK_* -# Arguments: -# None -# Returns: -# None -######################### -keycloak_configure_loglevel() { - info "Configuring log level" - keycloak_conf_set "log-level" "${KEYCLOAK_LOG_LEVEL}" - keycloak_conf_set "log-console-output" "${KEYCLOAK_LOG_OUTPUT}" -} - -######################## -# Configure proxy settings using JBoss CLI -# Globals: -# KEYCLOAK_* -# Arguments: -# None -# Returns: -# None -######################### -keycloak_configure_proxy() { - info "Configuring proxy" - keycloak_conf_set "proxy-headers" "${KEYCLOAK_PROXY_HEADERS}" -} - -######################## -# Configure HTTPS settings -# Globals: -# KEYCLOAK_* -# Arguments: -# Returns: -# None -######################### -keycloak_configure_https() { - info "Configuring Keycloak HTTPS settings" - if is_boolean_yes "$KEYCLOAK_HTTPS_USE_PEM"; then - keycloak_conf_set "https-certificate-file" "${KEYCLOAK_HTTPS_CERTIFICATE_FILE}" - keycloak_conf_set "https-certificate-key-file" "${KEYCLOAK_HTTPS_CERTIFICATE_KEY_FILE}" - else - ! is_empty_value "$KEYCLOAK_HTTPS_KEY_STORE_PASSWORD" && keycloak_conf_set "https-key-store-password" "${KEYCLOAK_HTTPS_KEY_STORE_PASSWORD}" - ! is_empty_value "$KEYCLOAK_HTTPS_TRUST_STORE_PASSWORD" && keycloak_conf_set "https-trust-store-password" "${KEYCLOAK_HTTPS_TRUST_STORE_PASSWORD}" - keycloak_conf_set "https-key-store-file" "${KEYCLOAK_HTTPS_KEY_STORE_FILE}" - keycloak_conf_set "https-trust-store-file" "${KEYCLOAK_HTTPS_TRUST_STORE_FILE}" - fi -} - -######################## -# Configure SPI TLS settings -# Globals: -# KEYCLOAK_* -# Arguments: -# Returns: -# None -######################### -keycloak_configure_spi_tls() { - info "Configuring Keycloak SPI TLS settings" - ! is_empty_value "$KEYCLOAK_SPI_TRUSTSTORE_PASSWORD" && keycloak_conf_set "spi-truststore-file-password" "${KEYCLOAK_SPI_TRUSTSTORE_PASSWORD}" - ! is_empty_value "$KEYCLOAK_SPI_TRUSTSTORE_FILE_HOSTNAME_VERIFICATION_POLICY" && keycloak_conf_set "spi-truststore-file-hostname-verification-policy" "${KEYCLOAK_SPI_TRUSTSTORE_FILE_HOSTNAME_VERIFICATION_POLICY}" - keycloak_conf_set "spi-truststore-file-file" "${KEYCLOAK_SPI_TRUSTSTORE_FILE}" - -} - -######################## -# Initialize keycloak installation -# Globals: -# KEYCLOAK_* -# Arguments: -# None -# Returns: -# None -######################### -keycloak_initialize() { - # Clean to avoid issues when running docker restart - if [[ "${KEYCLOAK_DATABASE_VENDOR}" == "postgresql" ]]; then - # Wait for database - info "Trying to connect to PostgreSQL server $KEYCLOAK_DATABASE_HOST..." - if ! retry_while "wait-for-port --host $KEYCLOAK_DATABASE_HOST --timeout 10 $KEYCLOAK_DATABASE_PORT" "$KEYCLOAK_INIT_MAX_RETRIES"; then - error "Unable to connect to host $KEYCLOAK_DATABASE_HOST" - exit 1 - else - info "Found PostgreSQL server listening at $KEYCLOAK_DATABASE_HOST:$KEYCLOAK_DATABASE_PORT" - fi - - if ! is_dir_empty "$KEYCLOAK_MOUNTED_CONF_DIR"; then - cp -Lr "$KEYCLOAK_MOUNTED_CONF_DIR"/* "$KEYCLOAK_CONF_DIR" - fi - fi - keycloak_configure_database - keycloak_configure_metrics - keycloak_configure_health_endpoints - keycloak_configure_http - keycloak_configure_hostname - keycloak_configure_cache - keycloak_configure_loglevel - ! is_empty_value "$KEYCLOAK_PROXY_HEADERS" && keycloak_configure_proxy - is_boolean_yes "$KEYCLOAK_ENABLE_HTTPS" && keycloak_configure_https - ! is_empty_value "$KEYCLOAK_SPI_TRUSTSTORE_FILE" && keycloak_configure_spi_tls - true -} - -######################## -# Run custom initialization scripts -# Globals: -# KEYCLOAK_* -# Arguments: -# None -# Returns: -# None -######################### -keycloak_custom_init_scripts() { - if [[ -n $(find "${KEYCLOAK_INITSCRIPTS_DIR}/" -type f -regex ".*\.sh") ]] && [[ ! -f "${KEYCLOAK_INITSCRIPTS_DIR}/.user_scripts_initialized" ]]; then - info "Loading user's custom files from ${KEYCLOAK_INITSCRIPTS_DIR} ..." - local -r tmp_file="/tmp/filelist" - find "${KEYCLOAK_INITSCRIPTS_DIR}/" -type f -regex ".*\.sh" | sort >"$tmp_file" - while read -r f; do - case "$f" in - *.sh) - if [[ -x "$f" ]]; then - debug "Executing $f" - "$f" - else - debug "Sourcing $f" - . "$f" - fi - ;; - *) debug "Ignoring $f" ;; - esac - done <$tmp_file - rm -f "$tmp_file" - touch "$KEYCLOAK_VOLUME_DIR"/.user_scripts_initialized - fi -} diff --git a/bitnami/keycloak/25/debian-12/tags-info.yaml b/bitnami/keycloak/25/debian-12/tags-info.yaml deleted file mode 100644 index 7ccae9e176ef6..0000000000000 --- a/bitnami/keycloak/25/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "25" -- 25-debian-12 -- 25.0.6 diff --git a/bitnami/kibana/7/README.md b/bitnami/kibana/7/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/kibana/7/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/kibana/7/debian-12/Dockerfile b/bitnami/kibana/7/debian-12/Dockerfile deleted file mode 100644 index f3f785c9c60e1..0000000000000 --- a/bitnami/kibana/7/debian-12/Dockerfile +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T15:23:41Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/kibana/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="7.17.26-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/kibana" \ - org.opencontainers.image.title="kibana" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="7.17.26" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/kibana/bin:$PATH" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libexpat1 libgcc-s1 libnss3 libstdc++6 procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "yq-4.44.5-0-linux-${OS_ARCH}-debian-12" \ - "kibana-7.17.26-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/kibana/postunpack.sh -ENV APP_VERSION="7.17.26" \ - BITNAMI_APP_NAME="kibana" - -EXPOSE 5601 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/kibana/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/kibana/run.sh" ] diff --git a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 97e6fb4873320..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "kibana": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "7.17.26-0" - }, - "yq": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "4.44.5-0" - } -} \ No newline at end of file diff --git a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/kibana/7/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/kibana/7/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/kibana/7/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/kibana/7/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/kibana/7/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana-env.sh b/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana-env.sh deleted file mode 100644 index 413e3cf927a36..0000000000000 --- a/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana-env.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for kibana - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-kibana}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -kibana_env_vars=( - KIBANA_ELASTICSEARCH_URL - KIBANA_ELASTICSEARCH_PORT_NUMBER - KIBANA_HOST - KIBANA_PORT_NUMBER - KIBANA_WAIT_READY_MAX_RETRIES - KIBANA_INITSCRIPTS_START_SERVER - KIBANA_FORCE_INITSCRIPTS - KIBANA_DISABLE_STRICT_CSP - KIBANA_CERTS_DIR - KIBANA_SERVER_ENABLE_TLS - KIBANA_SERVER_KEYSTORE_LOCATION - KIBANA_SERVER_KEYSTORE_PASSWORD - KIBANA_SERVER_TLS_USE_PEM - KIBANA_SERVER_CERT_LOCATION - KIBANA_SERVER_KEY_LOCATION - KIBANA_SERVER_KEY_PASSWORD - KIBANA_PASSWORD - KIBANA_ELASTICSEARCH_ENABLE_TLS - KIBANA_ELASTICSEARCH_TLS_VERIFICATION_MODE - KIBANA_ELASTICSEARCH_TRUSTSTORE_LOCATION - KIBANA_ELASTICSEARCH_TRUSTSTORE_PASSWORD - KIBANA_ELASTICSEARCH_TLS_USE_PEM - KIBANA_ELASTICSEARCH_CA_CERT_LOCATION - KIBANA_DISABLE_STRICT_CSP - KIBANA_CREATE_USER - KIBANA_ELASTICSEARCH_PASSWORD - KIBANA_SERVER_PUBLICBASEURL - KIBANA_XPACK_SECURITY_ENCRYPTIONKEY - KIBANA_XPACK_REPORTING_ENCRYPTIONKEY - KIBANA_NEWSFEED_ENABLED - KIBANA_ELASTICSEARCH_REQUESTTIMEOUT - ELASTICSEARCH_URL - KIBANA_ELASTICSEARCH_PORT_NUMBER - KIBANA_ELASTICSEARCH_PORT - KIBANA_PORT_NUMBER - KIBANA_INITSCRIPTS_MAX_RETRIES -) -for env_var in "${kibana_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset kibana_env_vars -export SERVER_FLAVOR="kibana" - -# Paths -export BITNAMI_VOLUME_DIR="/bitnami" -export KIBANA_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/kibana" -export SERVER_VOLUME_DIR="$KIBANA_VOLUME_DIR" -export KIBANA_BASE_DIR="${BITNAMI_ROOT_DIR}/kibana" -export SERVER_BASE_DIR="$KIBANA_BASE_DIR" -export KIBANA_CONF_DIR="${SERVER_BASE_DIR}/config" -export SERVER_CONF_DIR="$KIBANA_CONF_DIR" -export KIBANA_DEFAULT_CONF_DIR="${SERVER_BASE_DIR}/config.default" -export SERVER_DEFAULT_CONF_DIR="$KIBANA_DEFAULT_CONF_DIR" -export KIBANA_LOGS_DIR="${SERVER_BASE_DIR}/logs" -export SERVER_LOGS_DIR="$KIBANA_LOGS_DIR" -export KIBANA_TMP_DIR="${SERVER_BASE_DIR}/tmp" -export SERVER_TMP_DIR="$KIBANA_TMP_DIR" -export KIBANA_BIN_DIR="${SERVER_BASE_DIR}/bin" -export SERVER_BIN_DIR="$KIBANA_BIN_DIR" -export KIBANA_PLUGINS_DIR="${SERVER_BASE_DIR}/plugins" -export SERVER_PLUGINS_DIR="$KIBANA_PLUGINS_DIR" -export KIBANA_DEFAULT_PLUGINS_DIR="${SERVER_BASE_DIR}/plugins.default" -export SERVER_DEFAULT_PLUGINS_DIR="$KIBANA_DEFAULT_PLUGINS_DIR" -export KIBANA_DATA_DIR="${SERVER_VOLUME_DIR}/data" -export SERVER_DATA_DIR="$KIBANA_DATA_DIR" -export KIBANA_MOUNTED_CONF_DIR="${SERVER_VOLUME_DIR}/conf" -export SERVER_MOUNTED_CONF_DIR="$KIBANA_MOUNTED_CONF_DIR" -export KIBANA_CONF_FILE="${SERVER_CONF_DIR}/kibana.yml" -export SERVER_CONF_FILE="$KIBANA_CONF_FILE" -export KIBANA_LOG_FILE="${SERVER_LOGS_DIR}/kibana.log" -export SERVER_LOG_FILE="$KIBANA_LOG_FILE" -export KIBANA_PID_FILE="${SERVER_TMP_DIR}/kibana.pid" -export SERVER_PID_FILE="$KIBANA_PID_FILE" -export KIBANA_INITSCRIPTS_DIR="/docker-entrypoint-initdb.d" -export SERVER_INITSCRIPTS_DIR="$KIBANA_INITSCRIPTS_DIR" - -# System users (when running with a privileged user) -export KIBANA_DAEMON_USER="kibana" -export SERVER_DAEMON_USER="$KIBANA_DAEMON_USER" -export KIBANA_DAEMON_GROUP="kibana" -export SERVER_DAEMON_GROUP="$KIBANA_DAEMON_GROUP" - -# Kibana configuration -KIBANA_ELASTICSEARCH_URL="${KIBANA_ELASTICSEARCH_URL:-"${ELASTICSEARCH_URL:-}"}" -export KIBANA_ELASTICSEARCH_URL="${KIBANA_ELASTICSEARCH_URL:-elasticsearch}" -export SERVER_DB_URL="$KIBANA_ELASTICSEARCH_URL" -KIBANA_ELASTICSEARCH_PORT_NUMBER="${KIBANA_ELASTICSEARCH_PORT_NUMBER:-"${KIBANA_ELASTICSEARCH_PORT_NUMBER:-}"}" -KIBANA_ELASTICSEARCH_PORT_NUMBER="${KIBANA_ELASTICSEARCH_PORT_NUMBER:-"${KIBANA_ELASTICSEARCH_PORT:-}"}" -KIBANA_ELASTICSEARCH_PORT_NUMBER="${KIBANA_ELASTICSEARCH_PORT_NUMBER:-"${KIBANA_PORT_NUMBER:-}"}" -export KIBANA_ELASTICSEARCH_PORT_NUMBER="${KIBANA_ELASTICSEARCH_PORT_NUMBER:-9200}" -export SERVER_DB_PORT_NUMBER="$KIBANA_ELASTICSEARCH_PORT_NUMBER" -export KIBANA_HOST="${KIBANA_HOST:-0.0.0.0}" -export SERVER_HOST="$KIBANA_HOST" -export KIBANA_PORT_NUMBER="${KIBANA_PORT_NUMBER:-5601}" -export SERVER_PORT_NUMBER="$KIBANA_PORT_NUMBER" -KIBANA_WAIT_READY_MAX_RETRIES="${KIBANA_WAIT_READY_MAX_RETRIES:-"${KIBANA_INITSCRIPTS_MAX_RETRIES:-}"}" -export KIBANA_WAIT_READY_MAX_RETRIES="${KIBANA_WAIT_READY_MAX_RETRIES:-30}" -export SERVER_WAIT_READY_MAX_RETRIES="$KIBANA_WAIT_READY_MAX_RETRIES" -export KIBANA_INITSCRIPTS_START_SERVER="${KIBANA_INITSCRIPTS_START_SERVER:-yes}" -export SERVER_INITSCRIPTS_START_SERVER="$KIBANA_INITSCRIPTS_START_SERVER" -export KIBANA_FORCE_INITSCRIPTS="${KIBANA_FORCE_INITSCRIPTS:-no}" -export SERVER_FORCE_INITSCRIPTS="$KIBANA_FORCE_INITSCRIPTS" -export KIBANA_DISABLE_STRICT_CSP="${KIBANA_DISABLE_STRICT_CSP:-no}" -export SERVER_DISABLE_STRICT_CSP="$KIBANA_DISABLE_STRICT_CSP" - -# Kibana server SSL/TLS configuration -export KIBANA_CERTS_DIR="${KIBANA_CERTS_DIR:-${SERVER_CONF_DIR}/certs}" -export SERVER_CERTS_DIR="$KIBANA_CERTS_DIR" -export KIBANA_SERVER_ENABLE_TLS="${KIBANA_SERVER_ENABLE_TLS:-false}" -export SERVER_ENABLE_TLS="$KIBANA_SERVER_ENABLE_TLS" -export KIBANA_SERVER_KEYSTORE_LOCATION="${KIBANA_SERVER_KEYSTORE_LOCATION:-${SERVER_CERTS_DIR}/server/kibana.keystore.p12}" -export SERVER_KEYSTORE_LOCATION="$KIBANA_SERVER_KEYSTORE_LOCATION" -export KIBANA_SERVER_KEYSTORE_PASSWORD="${KIBANA_SERVER_KEYSTORE_PASSWORD:-}" -export SERVER_KEYSTORE_PASSWORD="$KIBANA_SERVER_KEYSTORE_PASSWORD" -export KIBANA_SERVER_TLS_USE_PEM="${KIBANA_SERVER_TLS_USE_PEM:-false}" -export SERVER_TLS_USE_PEM="$KIBANA_SERVER_TLS_USE_PEM" -export KIBANA_SERVER_CERT_LOCATION="${KIBANA_SERVER_CERT_LOCATION:-${SERVER_CERTS_DIR}/server/tls.crt}" -export SERVER_CERT_LOCATION="$KIBANA_SERVER_CERT_LOCATION" -export KIBANA_SERVER_KEY_LOCATION="${KIBANA_SERVER_KEY_LOCATION:-${SERVER_CERTS_DIR}/server/tls.key}" -export SERVER_KEY_LOCATION="$KIBANA_SERVER_KEY_LOCATION" -export KIBANA_SERVER_KEY_PASSWORD="${KIBANA_SERVER_KEY_PASSWORD:-}" -export SERVER_KEY_PASSWORD="$KIBANA_SERVER_KEY_PASSWORD" - -# Elasticsearch Security configuration -export KIBANA_PASSWORD="${KIBANA_PASSWORD:-}" -export SERVER_PASSWORD="$KIBANA_PASSWORD" -export KIBANA_ELASTICSEARCH_ENABLE_TLS="${KIBANA_ELASTICSEARCH_ENABLE_TLS:-false}" -export SERVER_DB_ENABLE_TLS="$KIBANA_ELASTICSEARCH_ENABLE_TLS" -export KIBANA_ELASTICSEARCH_TLS_VERIFICATION_MODE="${KIBANA_ELASTICSEARCH_TLS_VERIFICATION_MODE:-full}" -export SERVER_DB_TLS_VERIFICATION_MODE="$KIBANA_ELASTICSEARCH_TLS_VERIFICATION_MODE" -export KIBANA_ELASTICSEARCH_TRUSTSTORE_LOCATION="${KIBANA_ELASTICSEARCH_TRUSTSTORE_LOCATION:-${SERVER_CERTS_DIR}/elasticsearch/elasticsearch.truststore.p12}" -export SERVER_DB_TRUSTSTORE_LOCATION="$KIBANA_ELASTICSEARCH_TRUSTSTORE_LOCATION" -export KIBANA_ELASTICSEARCH_TRUSTSTORE_PASSWORD="${KIBANA_ELASTICSEARCH_TRUSTSTORE_PASSWORD:-}" -export SERVER_DB_TRUSTSTORE_PASSWORD="$KIBANA_ELASTICSEARCH_TRUSTSTORE_PASSWORD" -export KIBANA_ELASTICSEARCH_TLS_USE_PEM="${KIBANA_ELASTICSEARCH_TLS_USE_PEM:-false}" -export SERVER_DB_TLS_USE_PEM="$KIBANA_ELASTICSEARCH_TLS_USE_PEM" -export KIBANA_ELASTICSEARCH_CA_CERT_LOCATION="${KIBANA_ELASTICSEARCH_CA_CERT_LOCATION:-${SERVER_CERTS_DIR}/elasticsearch/ca.crt}" -export SERVER_DB_CA_CERT_LOCATION="$KIBANA_ELASTICSEARCH_CA_CERT_LOCATION" -export KIBANA_DISABLE_STRICT_CSP="${KIBANA_DISABLE_STRICT_CSP:-no}" -export KIBANA_CREATE_USER="${KIBANA_CREATE_USER:-false}" -export KIBANA_ELASTICSEARCH_PASSWORD="${KIBANA_ELASTICSEARCH_PASSWORD:-}" -export KIBANA_SERVER_PUBLICBASEURL="${KIBANA_SERVER_PUBLICBASEURL:-}" -export KIBANA_XPACK_SECURITY_ENCRYPTIONKEY="${KIBANA_XPACK_SECURITY_ENCRYPTIONKEY:-}" -export KIBANA_XPACK_REPORTING_ENCRYPTIONKEY="${KIBANA_XPACK_REPORTING_ENCRYPTIONKEY:-}" -export KIBANA_NEWSFEED_ENABLED="${KIBANA_NEWSFEED_ENABLED:-true}" -export KIBANA_ELASTICSEARCH_REQUESTTIMEOUT="${KIBANA_ELASTICSEARCH_REQUESTTIMEOUT:-30000}" - -# Custom environment variables may be defined below diff --git a/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/entrypoint.sh b/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/entrypoint.sh deleted file mode 100755 index 35bba0a43b0bc..0000000000000 --- a/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/entrypoint.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace - -# Load libraries -. /opt/bitnami/scripts/libkibana.sh -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -# Load environment -. /opt/bitnami/scripts/kibana-env.sh - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/elasticsearch/conf) -debug "Copying files from $SERVER_DEFAULT_CONF_DIR to $SERVER_CONF_DIR" -cp -nr "$SERVER_DEFAULT_CONF_DIR"/. "$SERVER_CONF_DIR" - -if ! is_dir_empty "$SERVER_DEFAULT_PLUGINS_DIR"; then - debug "Copying plugins from $SERVER_DEFAULT_PLUGINS_DIR to $SERVER_PLUGINS_DIR" - # Copy the plugins installed by default to the plugins directory - # If there is already a plugin with the same name in the plugins folder do nothing - for plugin_path in "${SERVER_DEFAULT_PLUGINS_DIR}"/*; do - plugin_name="$(basename "$plugin_path")" - plugin_moved_path="${SERVER_PLUGINS_DIR}/${plugin_name}" - if ! [[ -d "$plugin_moved_path" ]]; then - cp -r "$plugin_path" "$plugin_moved_path" - fi - done -fi - -if [[ "$1" = "/opt/bitnami/scripts/kibana/run.sh" ]]; then - info "** Starting Kibana setup **" - /opt/bitnami/scripts/kibana/setup.sh - info "** Kibana setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/postunpack.sh b/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/postunpack.sh deleted file mode 100755 index dd87b872df6d4..0000000000000 --- a/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/postunpack.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace - -# Load libraries -. /opt/bitnami/scripts/libkibana.sh -. /opt/bitnami/scripts/libfs.sh - -# Load environment -. /opt/bitnami/scripts/kibana-env.sh - -for dir in "$SERVER_TMP_DIR" "$SERVER_LOGS_DIR" "$SERVER_CONF_DIR" "$SERVER_DEFAULT_CONF_DIR" "$SERVER_PLUGINS_DIR" "$SERVER_DEFAULT_PLUGINS_DIR" "$SERVER_VOLUME_DIR" "$SERVER_DATA_DIR" "$SERVER_INITSCRIPTS_DIR"; do - ensure_dir_exists "$dir" - chmod -R ug+rwX "$dir" -done - -kibana_conf_set "path.data" "$SERVER_DATA_DIR" -# For backwards compatibility, create a symlink to the default path -! is_dir_empty "${SERVER_BASE_DIR}/data" || rm -rf "${SERVER_BASE_DIR}/data" && ln -s "$SERVER_DATA_DIR" "${SERVER_BASE_DIR}/data" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${SERVER_CONF_DIR}/"* "$SERVER_DEFAULT_CONF_DIR" -chmod o+rX -R "$SERVER_DEFAULT_CONF_DIR" - -if ! is_dir_empty "$SERVER_PLUGINS_DIR"; then - # Move all initially installed plugins to the default plugins directory. - for plugin_path in "${SERVER_PLUGINS_DIR}"/*; do - plugin_name="$(basename "$plugin_path")" - plugin_moved_path="${SERVER_DEFAULT_PLUGINS_DIR}/${plugin_name}" - mv "$plugin_path" "$plugin_moved_path" - done - chmod o+rX -R "$SERVER_DEFAULT_PLUGINS_DIR" -fi diff --git a/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/run.sh b/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/run.sh deleted file mode 100755 index 451f57ce508ed..0000000000000 --- a/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/run.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace - -# Load libraries -. /opt/bitnami/scripts/libkibana.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh - -# Load environment -. /opt/bitnami/scripts/kibana-env.sh - -info "** Starting Kibana **" -start_command=("${SERVER_BIN_DIR}/kibana" "serve") -if am_i_root; then - exec_as_user "$SERVER_DAEMON_USER" "${start_command[@]}" -else - exec "${start_command[@]}" -fi diff --git a/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/setup.sh b/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/setup.sh deleted file mode 100755 index b5c745930f669..0000000000000 --- a/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/kibana/setup.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace - -# Load libraries -. /opt/bitnami/scripts/libkibana.sh -. /opt/bitnami/scripts/libos.sh - -# Load environment -. /opt/bitnami/scripts/kibana-env.sh - -# Ensure kibana environment variables are valid -kibana_validate - -# Ensure 'daemon' user exists when running as 'root' -am_i_root && ensure_user_exists "$SERVER_DAEMON_USER" --group "$SERVER_DAEMON_GROUP" - -# Ensure kibana is initialized -kibana_initialize - -# Create kibana_system user, if necessary -is_boolean_yes "$KIBANA_CREATE_USER" && kibana_create_system_user - -# Ensure custom initialization scripts are executed -kibana_custom_init_scripts diff --git a/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/libkibana.sh b/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/libkibana.sh deleted file mode 100644 index d5bb0bc8970a5..0000000000000 --- a/bitnami/kibana/7/debian-12/rootfs/opt/bitnami/scripts/libkibana.sh +++ /dev/null @@ -1,540 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Kibana library - -# shellcheck disable=SC1090 -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Set Elasticsearch keystore values -# Globals: -# ELASTICSEARCH_* -# Arguments: -# None -# Returns: -# None -######################### -kibana_set_key_value() { - local key="${1:?missing key}" - local value="${2:?missing value}" - - debug "Storing key: ${key}" - kibana-keystore add --stdin --force "$key" <<<"$value" -} - -######################## -# Waits for Elasticsearch to be available and creates the user 'kibana_user', if it doesn't exists -# Globals: -# KIBANA_* -# Arguments: -# None -# Returns: -# None -######################### -kibana_create_system_user() { - local -r retries="60" - local -r sleep_time="5" - local url - url=$(kibana_sanitize_elasticsearch_hosts "${KIBANA_ELASTICSEARCH_URL}" "${KIBANA_ELASTICSEARCH_PORT_NUMBER}") - check_elasticsearch() { - local status_code="000" - status_code=$(curl -L -s -k -o /dev/null "${url}" -w "%{http_code}") - debug "Attempted to connect with Elasticserach. Status code: $status_code" - # Any status code different to 000 will be considered valid - [[ "$status_code" != "000" ]] - } - - info "Waiting for Elasticsearch to be ready." - # Wait for elasticsearch to be available - if ! retry_while "check_elasticsearch" "$retries" "$sleep_time"; then - error "Timeout waiting for the Elasticsearch to respond" - return 1 - fi - - # Check kibana_system user doesn't exists - status_code=$(curl -L -s -k -o /dev/null -u "kibana_system:${KIBANA_PASSWORD}" "${url}" -w "%{http_code}") - if [[ "$status_code" == "401" ]]; then - info "Setting password for user 'kibana_system'" - curl -L -s -k -o /dev/null -X POST -u "elastic:${KIBANA_ELASTICSEARCH_PASSWORD}" -H "Content-Type: application/json" "${url}/_security/user/kibana_system/_password" -d "{\"password\":\"${KIBANA_PASSWORD}\"}" - status_code=$(curl -L -s -k -o /dev/null -u "kibana_system:${KIBANA_PASSWORD}" "${url}" -w "%{http_code}") - if [[ "$status_code" == "200" ]]; then - info "Password for kibana_system successfully configured" - else - error "An error occurred while configuring kibana_system user" - return 1 - fi - else - info "Skipping 'kibana_system' user creation. User already exists. Status code: ${status_code}" - fi -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Kibana/Opensearch Dashboards common library - -# shellcheck disable=SC1090 -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Validate settings in SERVER_* env vars -# Globals: -# SERVER_* -# Arguments: -# None -# Returns: -# 0 if the validation succeeded, 1 otherwise -######################### -kibana_validate() { - debug "Validating settings in SERVER_* environment variables..." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_multi_value() { - if [[ " ${2} " != *" ${!1} "* ]]; then - print_validation_error "The allowed values for ${1} are: ${2}" - fi - } - check_empty_value() { - if is_empty_value "${!1}"; then - print_validation_error "${1} must be set" - fi - } - # Warn users in case the configuration file is not writable - is_file_writable "$SERVER_CONF_FILE" || warn "The ${SERVER_FLAVOR^} configuration file '${SERVER_CONF_FILE}' is not writable. Configurations based on environment variables will not be applied for this file." - - if [[ "$SERVER_FLAVOR" = "kibana" ]]; then - if is_boolean_yes "$KIBANA_CREATE_USER"; then - if is_empty_value "$KIBANA_PASSWORD"; then - print_validation_error "The variable KIBANA_CREATE_USER is set but no KIBANA_PASSWORD provided for the kibana_system user." - fi - if is_empty_value "$KIBANA_ELASTICSEARCH_PASSWORD"; then - print_validation_error "Password for the 'elastic' user is required in order to create the kibana_system user. Please provide it using the variable KIBANA_ELASTICSEARCH_PASSWORD." - fi - fi - fi - - # User inputs - check_empty_value "SERVER_DB_URL" - check_empty_value "SERVER_HOST" - for var in "SERVER_DB_PORT_NUMBER" "SERVER_PORT_NUMBER"; do - if ! err=$(validate_port "${!var}"); then - print_validation_error "An invalid port was specified in the environment variable $var: $err" - fi - done - - if is_boolean_yes "$SERVER_ENABLE_TLS"; then - if is_boolean_yes "$SERVER_TLS_USE_PEM"; then - if [[ ! -f "$SERVER_CERT_LOCATION" ]] || [[ ! -f "$SERVER_KEY_LOCATION" ]]; then - print_validation_error "In order to configure the TLS encryption for ${SERVER_FLAVOR^} server using PEM certs you must provide your a valid key and certificate." - fi - elif [[ ! -f "$SERVER_KEYSTORE_LOCATION" ]]; then - print_validation_error "In order to configure the TLS encryption for ${SERVER_FLAVOR^} server using PKCS12 certs you must mount a valid keystore." - fi - fi - - if is_boolean_yes "$SERVER_DB_ENABLE_TLS"; then - check_multi_value "SERVER_DB_TLS_VERIFICATION_MODE" "full certificate none" - if [[ "$SERVER_DB_TLS_VERIFICATION_MODE" != "none" ]];then - if is_boolean_yes "$SERVER_DB_TLS_USE_PEM"; then - if [[ ! -f "$SERVER_DB_CA_CERT_LOCATION" ]]; then - print_validation_error "In order to connect to Elasticsearch via HTTPS, a valid CA certificate is required." - fi - elif [[ ! -f "$SERVER_DB_TRUSTSTORE_LOCATION" ]]; then - print_validation_error "In order to connect to Elasticsearch via HTTPS, a valid PKCS12 truststore is required." - fi - fi - fi - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Configure/initialize Kibana/Dashboards -# Globals: -# SERVER_* -# Arguments: -# None -# Returns: -# None -######################### -kibana_initialize() { - info "Configuring/Initializing ${SERVER_FLAVOR^}..." - - debug "Ensuring expected directories/files exist..." - for dir in "$SERVER_TMP_DIR" "$SERVER_LOGS_DIR" "$SERVER_CONF_DIR" "$SERVER_DATA_DIR"; do - ensure_dir_exists "$dir" - am_i_root && chown -R "$SERVER_DAEMON_USER:$SERVER_DAEMON_GROUP" "$dir" - done - - if is_file_writable "$SERVER_CONF_FILE"; then - local dbFlavor="elasticsearch" - [[ "$SERVER_FLAVOR" = "opensearch-dashboards" ]] && dbFlavor="opensearch" - if is_mounted_dir_empty "$SERVER_MOUNTED_CONF_DIR"; then - info "Setting default configuration" - kibana_conf_set "pid.file" "$SERVER_PID_FILE" - kibana_conf_set "server.host" "$SERVER_HOST" - kibana_conf_set "server.port" "$SERVER_PORT_NUMBER" "int" - kibana_conf_set "${dbFlavor}.hosts" "$(kibana_sanitize_elasticsearch_hosts "${SERVER_DB_URL}" "${SERVER_DB_PORT_NUMBER}")" - - else - info "Found mounted configuration directory" - if ! cp -Lr "$SERVER_MOUNTED_CONF_DIR"/* "$SERVER_CONF_DIR"; then - error "Issue copying mounted configuration files from $SERVER_MOUNTED_CONF_DIR to $SERVER_CONF_DIR. Make sure you are not mounting configuration files in $SERVER_CONF_DIR and $SERVER_MOUNTED_CONF_DIR at the same time" - exit 1 - fi - fi - # Kibana override configuration - if [[ "$SERVER_FLAVOR" = "kibana" ]]; then - if is_boolean_yes "$KIBANA_DISABLE_STRICT_CSP"; then - kibana_conf_set "csp.strict" "false" "bool" - fi - if ! is_empty_value "$KIBANA_SERVER_PUBLICBASEURL"; then - kibana_conf_set "server.publicBaseUrl" "$KIBANA_SERVER_PUBLICBASEURL" - fi - if ! is_empty_value "$KIBANA_XPACK_SECURITY_ENCRYPTIONKEY"; then - kibana_conf_set "xpack.security.encryptionKey" "$KIBANA_XPACK_SECURITY_ENCRYPTIONKEY" - fi - if ! is_empty_value "$KIBANA_XPACK_REPORTING_ENCRYPTIONKEY"; then - kibana_conf_set "xpack.reporting.encryptionKey" "$KIBANA_XPACK_REPORTING_ENCRYPTIONKEY" - fi - if ! is_boolean_yes "$KIBANA_NEWSFEED_ENABLED"; then - kibana_conf_set "newsfeed.enabled" "false" "bool" - fi - if [[ "$KIBANA_ELASTICSEARCH_REQUESTTIMEOUT" != "30000" ]]; then - kibana_conf_set "elasticsearch.requestTimeout" "$KIBANA_ELASTICSEARCH_REQUESTTIMEOUT" - fi - fi - - # Configure Elasticsearch/Opensearch authentication - if ! is_empty_value "$SERVER_PASSWORD"; then - local user="kibana_system" - [[ "$SERVER_FLAVOR" = "opensearch-dashboards" ]] && user="kibanaserver" - kibana_conf_set "${dbFlavor}.username" "$user" - kibana_conf_set "${dbFlavor}.password" "$SERVER_PASSWORD" - elif [[ "$SERVER_FLAVOR" = "opensearch-dashboards" ]]; then - info "Security settings not provided, removing plugin" - opensearch-dashboards-plugin remove securityDashboards - replace_in_file "$SERVER_CONF_FILE" "^opensearch_security\." "#opensearch_security." - fi - - # Configure Webserver TLS settings (Client -> Kibana/Dashboards) - if is_boolean_yes "$SERVER_ENABLE_TLS"; then - kibana_conf_set "server.ssl.enabled" "true" "bool" - [[ "$SERVER_FLAVOR" = "opensearch-dashboards" ]] && kibana_conf_set "opensearch_security.cookie.secure" "true" "bool" - if is_boolean_yes "$SERVER_TLS_USE_PEM"; then - kibana_conf_set "server.ssl.certificate" "$SERVER_CERT_LOCATION" - kibana_conf_set "server.ssl.key" "$SERVER_KEY_LOCATION" - if ! is_empty_value "$SERVER_KEY_PASSWORD"; then - if [[ "$SERVER_FLAVOR" = "opensearch-dashboards" ]]; then - kibana_conf_set "server.ssl.keyPassphrase" "$SERVER_KEY_PASSWORD" - else - kibana_set_key_value "server.ssl.keyPassphrase" "$SERVER_KEY_PASSWORD" - fi - fi - else - kibana_conf_set "server.ssl.keystore.path" "$SERVER_KEYSTORE_LOCATION" - if ! is_empty_value "$SERVER_KEYSTORE_PASSWORD"; then - if [[ "$SERVER_FLAVOR" = "opensearch-dashboards" ]]; then - kibana_conf_set "server.ssl.keystore.password" "$SERVER_KEY_PASSWORD" - else - kibana_set_key_value "server.ssl.keystore.password" "$SERVER_KEY_PASSWORD" - fi - fi - fi - fi - - # Configure Database TLS settings (Kibana/Dashboards -> Elasticsearch/Opensearch) - if is_boolean_yes "$SERVER_DB_ENABLE_TLS"; then - kibana_conf_set "${dbFlavor}.ssl.verificationMode" "$SERVER_DB_TLS_VERIFICATION_MODE" - if [[ "$SERVER_DB_TLS_VERIFICATION_MODE" != "none" ]];then - if is_boolean_yes "$SERVER_DB_TLS_USE_PEM"; then - kibana_conf_set "${dbFlavor}.ssl.certificateAuthorities" "$SERVER_DB_CA_CERT_LOCATION" - else - kibana_conf_set "${dbFlavor}.ssl.truststore.path" "$SERVER_DB_TRUSTSTORE_LOCATION" - if ! is_empty_value "$SERVER_DB_TRUSTSTORE_PASSWORD"; then - if [[ "$SERVER_FLAVOR" = "opensearch-dashboards" ]]; then - kibana_conf_set "${dbFlavor}.ssl.truststore.password" "$SERVER_DB_TRUSTSTORE_PASSWORD" - else - kibana_set_key_value "${dbFlavor}.ssl.truststore.password" "$SERVER_DB_TRUSTSTORE_PASSWORD" - fi - fi - fi - fi - fi - fi -} - -######################## -# Write a configuration setting value -# Globals: -# SERVER_CONF_FILE -# Arguments: -# $1 - key -# $2 - value -# $3 - YAML type (string, int or bool) -# Returns: -# None -######################### -kibana_conf_set() { - local -r key="${1:?Missing key}" - local -r value="${2:-}" - local -r type="${3:-string}" - local -r tempfile=$(mktemp) - - case "$type" in - string) - yq eval "(.${key}) |= \"${value}\"" "$SERVER_CONF_FILE" >"$tempfile" - ;; - int) - yq eval "(.${key}) |= ${value}" "$SERVER_CONF_FILE" >"$tempfile" - ;; - bool) - yq eval "(.${key}) |= (\"${value}\" | test(\"true\"))" "$SERVER_CONF_FILE" >"$tempfile" - ;; - *) - error "Type unknown: ${type}" - return 1 - ;; - esac - cp "$tempfile" "$SERVER_CONF_FILE" -} - -######################## -# Read a configuration setting value -# Globals: -# SERVER_CONF_FILE -# Arguments: -# $1 - key -# Returns: -# Outputs the key to stdout (Empty response if key is not set) -######################### -kibana_conf_get() { - local key="${1:?missing key}" - - if [[ -r "$SERVER_CONF_FILE" ]]; then - local -r res="$(yq eval ".${key}" "$SERVER_CONF_FILE")" - if [[ ! "$res" = "null" ]]; then - echo "$res" - fi - fi -} - -######################## -# Configure/initialize Kibana/Dashboards -# For backwards compatibility, it is allowed to specify the host and port in -# different env-vars and this function will build the correct url. -# Globals: -# SERVER_* -# Arguments: -# $1 - hostUrl -# $2 - port -# Returns: -# None -######################### -kibana_sanitize_elasticsearch_hosts() { - local -r hostUrl="${1:?missing hostUrl}" - local -r port="${2:?missing port}" - local scheme - - if is_boolean_yes "$SERVER_DB_ENABLE_TLS"; then - scheme="https" - else - scheme="http" - fi - - if grep -q -E "^https?://[^:]+:[0-9]+$" <<<"$hostUrl"; then # i.e. http://localhost:9200 - echo "${hostUrl}" - elif grep -q -E "^https?://[^:]+$" <<<"$hostUrl"; then # i.e. http://localhost - echo "${hostUrl}:${port}" - elif grep -q -E "^[^:]+:[0-9]+$" <<<"$hostUrl"; then # i.e. localhost:9200 - echo "${scheme}://${hostUrl}" - else # i.e. localhost - echo "${scheme}://${hostUrl}:${port}" - fi -} - -######################## -# Check if Kibana/Dashboards is running -# Globals: -# SERVER_* -# Arguments: -# None -# Returns: -# Boolean -######################### -is_kibana_running() { - local pid - pid="$(get_pid_from_file "${SERVER_PID_FILE}")" - - if [[ -z "$pid" ]]; then - false - else - is_service_running "$pid" - fi -} - -######################## -# Check if Kibana/Dashboards is not running -# Globals: -# SERVER_* -# Arguments: -# None -# Returns: -# Boolean -######################### -is_kibana_not_running() { - ! is_kibana_running -} - -######################## -# Check if Kibana/Dashboards is ready -# Globals: -# SERVER_* -# Arguments: -# None -# Returns: -# Boolean -######################### -is_kibana_ready() { - local basePath - local rewriteBasePath - local scheme="http" - local opts=() - rewriteBasePath=$(kibana_conf_get "server.rewriteBasePath") - # The default value for is 'server.rewriteBasePath' is 'true' when ommited.' - # Therefore, we must check the value is not 'true' - ! is_boolean_yes "$rewriteBasePath" && basePath=$(kibana_conf_get "server.basePath") - - [[ "$SERVER_FLAVOR" = "opensearch-dashboards" ]] && ! is_empty_value "$SERVER_PASSWORD" && opts+=("-u" "kibanaserver:${SERVER_PASSWORD}") - if is_boolean_yes "$SERVER_DB_ENABLE_TLS"; then - scheme="https" - opts+=("-k") - fi - if is_kibana_running; then - # Kibana 7 and Opensearch expects .status.overall.state to be 'green', while 8 expects .status.overall.level to be 'available' - local -r status="$(yq eval '.status.overall | pick(["state", "level"]) | .[]' - <<<"$(curl -s "${opts[@]}" "${scheme}://127.0.0.1:${SERVER_PORT_NUMBER}${basePath}/api/status")")" - [[ "$status" = "green" || "$status" = "available" ]] && return - else - false - fi -} - -######################## -# Wait until Kibana/Dashboards is ready -# Globals: -# SERVER_* -# Arguments: -# None -# Returns: -# Boolean -######################### -wait_for_kibana_ready() { - info "Waiting for ${SERVER_FLAVOR^} to be started and ready" - retries="$SERVER_WAIT_READY_MAX_RETRIES" - until is_kibana_ready || [[ "$retries" -eq 0 ]]; do - debug "Waiting for ${SERVER_FLAVOR^} server: $((retries--)) remaining attempts..." - sleep 2 - done - if [[ "$retries" -eq 0 ]]; then - error "${SERVER_FLAVOR^} is not available after ${SERVER_WAIT_READY_MAX_RETRIES} retries" - if [[ -r "${SERVER_LOGS_DIR}/init_scripts_start.log" ]]; then - info "Dumping ${SERVER_LOGS_DIR}/init_scripts_start.log for additional diagnostics..." - cat "${SERVER_LOGS_DIR}/init_scripts_start.log" - fi - exit 1 - fi -} - -######################## -# Start Kibana/Dashboards in background mode -# Globals: -# SERVER_* -# Arguments: -# Extra arguments to pass to the command (optional array) -# Returns: -# None -######################### -kibana_start_bg() { - local extra_args=("${@}") - - info "Starting ${SERVER_FLAVOR^} in background" - local start_command=("${SERVER_BIN_DIR}/${SERVER_FLAVOR}" "serve" "${extra_args[@]}") - am_i_root && start_command=("run_as_user" "$SERVER_DAEMON_USER" "${start_command[@]}") - debug_execute "${start_command[@]}" & -} - -######################## -# Run custom initialization scripts -# Globals: -# SERVER_* -# Arguments: -# None -# Returns: -# None -######################### -kibana_custom_init_scripts() { - read -r -a init_scripts <<<"$(find "$SERVER_INITSCRIPTS_DIR" -type f -name "*.sh" -print0 | xargs -0)" - if [[ "${#init_scripts[@]}" -gt 0 ]] && [[ ! -f "$SERVER_VOLUME_DIR"/.user_scripts_initialized ]] || is_boolean_yes "$SERVER_FORCE_INITSCRIPTS"; then - if is_boolean_yes "$SERVER_FORCE_INITSCRIPTS"; then - info "Forcing execution of user files" - fi - - if is_boolean_yes "${SERVER_INITSCRIPTS_START_SERVER}"; then - # Binding to localhost to not give false positives for external connections - kibana_start_bg "--host" "127.0.0.1" "--log-file" "${SERVER_LOGS_DIR}/init_scripts_start.log" - wait_for_kibana_ready - fi - - info "Loading user's custom files from $SERVER_INITSCRIPTS_DIR" - for f in "${init_scripts[@]}"; do - debug "Executing $f" - case "$f" in - *.sh) - if [[ -x "$f" ]]; then - if ! "$f"; then - error "Failed executing $f" - return 1 - fi - else - warn "Sourcing $f as it is not executable by the current user, any error may cause initialization to fail" - . "$f" - fi - ;; - *) - warn "Skipping $f, supported formats are: .sh" - ;; - esac - done - touch "$SERVER_VOLUME_DIR"/.user_scripts_initialized - - is_kibana_running && stop_service_using_pid "$SERVER_PID_FILE" - retry_while "is_kibana_not_running" - fi -} diff --git a/bitnami/kibana/7/debian-12/tags-info.yaml b/bitnami/kibana/7/debian-12/tags-info.yaml deleted file mode 100644 index ece0cc84d23ad..0000000000000 --- a/bitnami/kibana/7/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "7" -- 7-debian-12 -- 7.17.26 diff --git a/bitnami/kong-ingress-controller/2/README.md b/bitnami/kong-ingress-controller/2/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/kong-ingress-controller/2/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/kong-ingress-controller/2/debian-12/Dockerfile b/bitnami/kong-ingress-controller/2/debian-12/Dockerfile deleted file mode 100644 index b55f47ed518eb..0000000000000 --- a/bitnami/kong-ingress-controller/2/debian-12/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-04T00:06:49Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/kong-ingress-controller/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="2.12.7-debian-12-r1" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/kong-ingress-controller" \ - org.opencontainers.image.title="kong-ingress-controller" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="2.12.7" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "wait-for-port-1.0.8-7-linux-${OS_ARCH}-debian-12" \ - "kong-ingress-controller-2.12.7-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -ENV APP_VERSION="2.12.7" \ - BITNAMI_APP_NAME="kong-ingress-controller" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/kong-ingress-controller/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "kong-ingress-controller" ] -CMD [ "--help" ] diff --git a/bitnami/kong-ingress-controller/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/kong-ingress-controller/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 7611e84987cf8..0000000000000 --- a/bitnami/kong-ingress-controller/2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "kong-ingress-controller": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "2.12.7-1" - }, - "wait-for-port": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.8-7" - } -} \ No newline at end of file diff --git a/bitnami/kong-ingress-controller/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/kong-ingress-controller/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/kong-ingress-controller/2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/kong-ingress-controller/2/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/kong-ingress-controller/2/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/kong-ingress-controller/2/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/kong-ingress-controller/2/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/kong-ingress-controller/2/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/kong-ingress-controller/2/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/kong-ingress-controller/2/debian-12/tags-info.yaml b/bitnami/kong-ingress-controller/2/debian-12/tags-info.yaml deleted file mode 100644 index f2af130d3e268..0000000000000 --- a/bitnami/kong-ingress-controller/2/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "2" -- 2-debian-12 -- 2.12.7 diff --git a/bitnami/ksql/7.4/README.md b/bitnami/ksql/7.4/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/ksql/7.4/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/ksql/7.4/debian-12/Dockerfile b/bitnami/ksql/7.4/debian-12/Dockerfile deleted file mode 100644 index b4d0d99ebd8c2..0000000000000 --- a/bitnami/ksql/7.4/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-27T13:02:30Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/ksql/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="7.4.8-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/ksql" \ - org.opencontainers.image.title="ksql" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="7.4.8" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl netcat-openbsd procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "java-17.0.13-12-1-linux-${OS_ARCH}-debian-12" \ - "ksql-7.4.8-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/java/postunpack.sh -RUN /opt/bitnami/scripts/ksql/postunpack.sh -ENV APP_VERSION="7.4.8" \ - BITNAMI_APP_NAME="ksql" \ - JAVA_HOME="/opt/bitnami/java" \ - PATH="/opt/bitnami/java/bin:/opt/bitnami/common/bin:/opt/bitnami/ksql/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/ksql/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/ksql/run.sh" ] diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 50b113f2b2e4c..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "17.0.13-12-1" - }, - "ksql": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "7.4.8-0" - } -} \ No newline at end of file diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/ksql/7.4/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/ksql/7.4/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/ksql/7.4/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/ksql/7.4/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 38802fc0bfe91..0000000000000 --- a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -if [[ "$OS_FLAVOUR" =~ photon && "$APP_VERSION" =~ ^1.8 ]]; then - # Option --module-path is not supported by JAVA 1.8 since modules were added in version 1.9 - unset JAVA_TOOL_OPTIONS -fi - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh b/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh deleted file mode 100644 index 735ca3114ae6e..0000000000000 --- a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for ksql - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-ksql}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -ksql_env_vars=( - KSQL_MOUNTED_CONF_DIR - KSQL_LISTENERS - KSQL_SSL_KEYSTORE_PASSWORD - KSQL_SSL_TRUSTSTORE_PASSWORD - KSQL_CLIENT_AUTHENTICATION - KSQL_BOOTSTRAP_SERVERS -) -for env_var in "${ksql_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset ksql_env_vars - -# Paths -export KSQL_BASE_DIR="${BITNAMI_ROOT_DIR}/ksql" -export KSQL_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/ksql" -export KSQL_DATA_DIR="${KSQL_VOLUME_DIR}/data" -export KSQL_BIN_DIR="${KSQL_BASE_DIR}/bin" -export KSQL_CONF_DIR="${KSQL_BASE_DIR}/etc/ksqldb" -export KSQL_LOGS_DIR="${KSQL_BASE_DIR}/logs" -export KSQL_CONF_FILE="${KSQL_CONF_DIR}/ksql-server.properties" -export KSQL_MOUNTED_CONF_DIR="${KSQL_MOUNTED_CONF_DIR:-${KSQL_VOLUME_DIR}/etc}" -export KSQL_CERTS_DIR="${KSQL_BASE_DIR}/certs" - -# System users (when running with a privileged user) -export KSQL_DAEMON_USER="ksql" -export KSQL_DAEMON_GROUP="ksql" -export KSQL_DEFAULT_LISTENERS="http://0.0.0.0:8088" # only used at build time -export KSQL_DEFAULT_BOOTSTRAP_SERVERS="localhost:9092" # only used at build time - -# KSQL settings -export KSQL_LISTENERS="${KSQL_LISTENERS:-}" -export KSQL_SSL_KEYSTORE_PASSWORD="${KSQL_SSL_KEYSTORE_PASSWORD:-}" -export KSQL_SSL_TRUSTSTORE_PASSWORD="${KSQL_SSL_TRUSTSTORE_PASSWORD:-}" -export KSQL_CLIENT_AUTHENTICATION="${KSQL_CLIENT_AUTHENTICATION:-}" -export KSQL_BOOTSTRAP_SERVERS="${KSQL_BOOTSTRAP_SERVERS:-}" - -# Custom environment variables may be defined below diff --git a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh b/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh deleted file mode 100755 index 8f3e94cfa5643..0000000000000 --- a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libksql.sh -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -print_welcome_page - -if [[ "$1" = "/opt/bitnami/scripts/ksql/run.sh" ]]; then - info "** Starting KSQL setup **" - /opt/bitnami/scripts/ksql/setup.sh - info "** KSQL setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh b/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh deleted file mode 100755 index 18531436a8901..0000000000000 --- a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -# Load libraries -. /opt/bitnami/scripts/libksql.sh -. /opt/bitnami/scripts/libfs.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -# Auxiliar functions - -######################## -# Create default config file -# Globals: -# KSQL_CONF_DIR -# Arguments: -# None -# Returns: -# None -######################### -ksql_create_default_config_file() { - cat > "${KSQL_CONF_FILE}.default" << EOF -## The address(es) the socket server listens on. -## FORMAT: listener_name://hostname:port -## -listeners = ${KSQL_DEFAULT_LISTENERS} - -## The advertised address(es) the server is advertised on. -## FORMAT: listener_name://hostname:port -## -# advertised.listener = - -## Keystore & Trustore used to expose the REST API over HTTPS -## -ssl.client.authentication = NONE -# ssl.key.password = -# ssl.keystore.location = -# ssl.keystore.password = - -## List of Kafka brokers to connect to. -## FORMAT: broker_hostname:port -## -bootstrap.servers = ${KSQL_DEFAULT_BOOTSTRAP_SERVERS} - -## Schema Registry server to connect to: -## FORMAT: schema_registry_hostname:port -## -# ksql.schema.registry.url = - -## Login configuration -## -ksql.logging.processing.topic.auto.create = true -ksql.logging.processing.stream.auto.create = true -ksql.logging.processing.rows.include = false - -## Sets the storage directory for stateful operations -## -ksql.streams.state.dir = ${KSQL_DATA_DIR} -EOF -} - -# Create default configuration file -rm "$KSQL_CONF_FILE" -ksql_create_default_config_file -# Ensure directories used by KSQL exist and have proper ownership and permissions -for dir in "$KSQL_CONF_DIR" "$KSQL_DATA_DIR" "$KSQL_LOGS_DIR" "$KSQL_CERTS_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done diff --git a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh b/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh deleted file mode 100755 index 138673a16b3b3..0000000000000 --- a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -info "** Starting KSQL **" - -__run_cmd="${KSQL_BIN_DIR}/ksql-server-start" -__run_flags=("$KSQL_CONF_FILE" "$@") - -if am_i_root; then - exec_as_user "$KSQL_DAEMON_USER" "$__run_cmd" "${__run_flags[@]}" -else - exec "$__run_cmd" "${__run_flags[@]}" -fi diff --git a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh b/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh deleted file mode 100755 index 28672ff979be9..0000000000000 --- a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libksql.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -# Ensure KSQL environment variables are valid -ksql_validate - -# Ensure 'daemon' user exists when running as 'root' -am_i_root && ensure_user_exists "$KSQL_DAEMON_USER" --group "$KSQL_DAEMON_GROUP" -for dir in "$KSQL_CONF_DIR" "$KSQL_DATA_DIR" "$KSQL_LOGS_DIR"; do - ensure_dir_exists "$dir" - am_i_root && chown -R "${KSQL_DAEMON_USER}:${KSQL_DAEMON_GROUP}" "$dir" -done - -# Ensure KSQL is initialized -ksql_initialize diff --git a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/libksql.sh b/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/libksql.sh deleted file mode 100644 index af7af40ccd216..0000000000000 --- a/bitnami/ksql/7.4/debian-12/rootfs/opt/bitnami/scripts/libksql.sh +++ /dev/null @@ -1,230 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Confluent KSQL library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Return listeners ports -# Globals: -# KSQL_LISTENERS -# Arguments: -# $1 - Bucket name -# Returns: -# Boolean -######################### -ksql_ports() { - local ports - - if [[ -n "$KSQL_LISTENERS" ]]; then - read -r -a listeners <<< "$(tr ',;' ' ' <<< "$KSQL_LISTENERS")" - for l in "${listeners[@]}"; do - if [[ "$l" =~ [a-zA-Z]*://.*:([0-9]*) ]]; then - ports+=("${BASH_REMATCH[1]}") - fi - done - echo "${ports[@]}" - else - echo "8081" - fi -} - -######################## -# Return listeners protocols -# Globals: -# KSQL_LISTENERS -# Arguments: -# $1 - Bucket name -# Returns: -# Boolean -######################### -ksql_protocols() { - local protocols - - if [[ -n "$KSQL_LISTENERS" ]]; then - read -r -a listeners <<< "$(tr ',;' ' ' <<< "$KSQL_LISTENERS")" - for l in "${listeners[@]}"; do - if [[ "$l" =~ ([a-zA-Z]*)://.*:[0-9]* ]]; then - protocols+=("${BASH_REMATCH[1]}") - fi - done - echo "${protocols[@]}" - else - echo "http" - fi -} - -######################## -# Validate settings in KSQL_* env vars -# Globals: -# KSQL_* -# Arguments: -# None -# Returns: -# None -######################### -ksql_validate() { - info "Validating settings in KSQL_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_true_false_value() { - if ! is_true_false_value "${!1}"; then - print_validation_error "The allowed values for $1 are [true, false]" - fi - } - check_conflicting_ports() { - local -r total="$#" - for i in $(seq 1 "$((total - 1))"); do - for j in $(seq "$((i + 1))" "$total"); do - if (( "${!i}" == "${!j}" )); then - print_validation_error "There are listeners bound to the same port" - fi - done - done - } - check_allowed_port() { - local validate_port_args=() - ! am_i_root && validate_port_args+=("-unprivileged") - if ! err=$(validate_port "${validate_port_args[@]}" "$1"); then - print_validation_error "An invalid port was specified in the environment variable KSQL_LISTENERS: $err" - fi - } - - if [[ -n "$KSQL_LISTENERS" ]]; then - read -r -a ports <<< "$(ksql_ports)" - for port in "${ports[@]}"; do - check_allowed_port "$port" - done - [[ "${#ports[@]}" -gt 1 ]] && check_conflicting_ports "${ports[@]}" - read -r -a protocols <<< "$(ksql_protocols)" - if [[ "${protocols[*]}" =~ https ]]; then - if [[ ! -f ${KSQL_CERTS_DIR}/ssl.keystore.jks ]]; then - print_validation_error "In order to configure HTTPS access, you must mount your ssl.keystore.jks (and optionally the ssl.truststore.jks) to the ${KSQL_CERTS_DIR} directory." - fi - fi - fi - [[ -z "$KSQL_BOOTSTRAP_SERVERS" && ! -f "$KSQL_CONF_FILE" ]] && warn "KSQL_BOOTSTRAP_SERVERS should be provided" - - [[ "$error_code" -eq 0 ]] || return "$error_code" -} - -######################## -# Set a configuration setting value to the configuration file -# Globals: -# KSQL_* -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -ksql_conf_set() { - local -r key="${1:?missing key}" - shift - local -r -a values=("$@") - - if [[ "${#values[@]}" -eq 0 ]]; then - stderr_print "missing value" - return 1 - elif [[ "${#values[@]}" -ne 1 ]]; then - for i in "${!values[@]}"; do - ksql_conf_set "${key[$i]}" "${values[$i]}" - done - else - value="${values[0]}" - # Check if the value was set before - if grep -q "^[# ]*$key\s*=.*" "$KSQL_CONF_FILE"; then - # Update the existing key - replace_in_file "$KSQL_CONF_FILE" "^[# ]*${key}\s*=.*" "${key} = ${value}" false - else - # Add a new key - printf '\n%s = %s' "$key" "$value" >>"$KSQL_CONF_FILE" - fi - fi -} - -######################## -# Wait for Kafka brokers to be up -# Globals: -# KSQL_* -# Arguments: -# None -# Returns: -# None -######################### -ksql_wait_for_kafka_brokers() { - local kafka_brokers - local host - local port - - info "Waiting for Kafka brokers to be up" - kafka_brokers="$(grep "^bootstrap.servers" "$KSQL_CONF_FILE" | cut -d '=' -f 2)" - read -r -a brokers <<< "$(tr ',;' ' ' <<< "${kafka_brokers/%,/}")" - for b in "${brokers[@]}"; do - if [[ "$b" =~ [_a-zA-Z]*://(.*):([0-9]*) ]]; then - host="${BASH_REMATCH[1]}" - port="${BASH_REMATCH[2]}" - if ! retry_while "debug_execute nc -z ${host} ${port}" 10 10; then - error "Failed to connect to the broker at $host:$port" - return 1 - fi - fi - done -} - -######################## -# Initialize Confluent KSQL -# Globals: -# KSQL_* -# Arguments: -# None -# Returns: -# None -######################### -ksql_initialize() { - info "Initializing Confluent KSQL" - - # Check for mounted configuration files - if ! is_dir_empty "$KSQL_MOUNTED_CONF_DIR"; then - cp -Lr "$KSQL_MOUNTED_CONF_DIR"/* "$KSQL_CONF_DIR" - fi - if [[ -f "$KSQL_CONF_FILE" ]]; then - info "Injected configuration file found. Skipping default configuration" - else - info "No injected configuration files found, creating default config file." - mv "${KSQL_CONF_FILE}.default" "$KSQL_CONF_FILE" - - # Kafka boostrap settings - [[ -n "$KSQL_BOOTSTRAP_SERVERS" ]] && ksql_conf_set "bootstrap.servers" "$KSQL_BOOTSTRAP_SERVERS" - # Listeners settings - if [[ -n "$KSQL_LISTENERS" ]]; then - ksql_conf_set "listeners" "$KSQL_LISTENERS" - read -r -a protocols <<< "$(ksql_protocols)" - if [[ "${protocols[*]}" =~ https ]]; then - ksql_conf_set "ssl.keystore.location" "${KSQL_CERTS_DIR}/ssl.keystore.jks" - [[ -n "$KSQL_SSL_KEYSTORE_PASSWORD" ]] && ksql_conf_set "ssl.keystore.password" "$KSQL_SSL_KEYSTORE_PASSWORD" - [[ -f "${KSQL_CERTS_DIR}/ssl.truststore.jks" ]] && ksql_conf_set "ssl.truststore.location" "${KSQL_CERTS_DIR}/ssl.truststore.jks" - [[ -n "$KSQL_SSL_TRUSTSTORE_PASSWORD" ]] && ksql_conf_set "ssl.truststore.password" "$KSQL_SSL_TRUSTSTORE_PASSWORD" - fi - [[ -n "$KSQL_CLIENT_AUTHENTICATION" ]] && ksql_conf_set "ssl.client.authentication" "$KSQL_CLIENT_AUTHENTICATION" - fi - fi - ksql_wait_for_kafka_brokers -} diff --git a/bitnami/ksql/7.4/debian-12/tags-info.yaml b/bitnami/ksql/7.4/debian-12/tags-info.yaml deleted file mode 100644 index 8f8186031ba40..0000000000000 --- a/bitnami/ksql/7.4/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "7.4" -- 7.4-debian-12 -- 7.4.8 diff --git a/bitnami/ksql/7.5/README.md b/bitnami/ksql/7.5/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/ksql/7.5/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/ksql/7.5/debian-12/Dockerfile b/bitnami/ksql/7.5/debian-12/Dockerfile deleted file mode 100644 index dedf542a49296..0000000000000 --- a/bitnami/ksql/7.5/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-27T12:56:58Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/ksql/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="7.5.7-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/ksql" \ - org.opencontainers.image.title="ksql" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="7.5.7" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl netcat-openbsd procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "java-17.0.13-12-1-linux-${OS_ARCH}-debian-12" \ - "ksql-7.5.7-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/java/postunpack.sh -RUN /opt/bitnami/scripts/ksql/postunpack.sh -ENV APP_VERSION="7.5.7" \ - BITNAMI_APP_NAME="ksql" \ - JAVA_HOME="/opt/bitnami/java" \ - PATH="/opt/bitnami/java/bin:/opt/bitnami/common/bin:/opt/bitnami/ksql/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/ksql/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/ksql/run.sh" ] diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 4dcf02bbb7296..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "17.0.13-12-1" - }, - "ksql": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "7.5.7-0" - } -} \ No newline at end of file diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/ksql/7.5/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/ksql/7.5/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/ksql/7.5/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/ksql/7.5/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 38802fc0bfe91..0000000000000 --- a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -if [[ "$OS_FLAVOUR" =~ photon && "$APP_VERSION" =~ ^1.8 ]]; then - # Option --module-path is not supported by JAVA 1.8 since modules were added in version 1.9 - unset JAVA_TOOL_OPTIONS -fi - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh b/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh deleted file mode 100644 index 735ca3114ae6e..0000000000000 --- a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for ksql - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-ksql}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -ksql_env_vars=( - KSQL_MOUNTED_CONF_DIR - KSQL_LISTENERS - KSQL_SSL_KEYSTORE_PASSWORD - KSQL_SSL_TRUSTSTORE_PASSWORD - KSQL_CLIENT_AUTHENTICATION - KSQL_BOOTSTRAP_SERVERS -) -for env_var in "${ksql_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset ksql_env_vars - -# Paths -export KSQL_BASE_DIR="${BITNAMI_ROOT_DIR}/ksql" -export KSQL_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/ksql" -export KSQL_DATA_DIR="${KSQL_VOLUME_DIR}/data" -export KSQL_BIN_DIR="${KSQL_BASE_DIR}/bin" -export KSQL_CONF_DIR="${KSQL_BASE_DIR}/etc/ksqldb" -export KSQL_LOGS_DIR="${KSQL_BASE_DIR}/logs" -export KSQL_CONF_FILE="${KSQL_CONF_DIR}/ksql-server.properties" -export KSQL_MOUNTED_CONF_DIR="${KSQL_MOUNTED_CONF_DIR:-${KSQL_VOLUME_DIR}/etc}" -export KSQL_CERTS_DIR="${KSQL_BASE_DIR}/certs" - -# System users (when running with a privileged user) -export KSQL_DAEMON_USER="ksql" -export KSQL_DAEMON_GROUP="ksql" -export KSQL_DEFAULT_LISTENERS="http://0.0.0.0:8088" # only used at build time -export KSQL_DEFAULT_BOOTSTRAP_SERVERS="localhost:9092" # only used at build time - -# KSQL settings -export KSQL_LISTENERS="${KSQL_LISTENERS:-}" -export KSQL_SSL_KEYSTORE_PASSWORD="${KSQL_SSL_KEYSTORE_PASSWORD:-}" -export KSQL_SSL_TRUSTSTORE_PASSWORD="${KSQL_SSL_TRUSTSTORE_PASSWORD:-}" -export KSQL_CLIENT_AUTHENTICATION="${KSQL_CLIENT_AUTHENTICATION:-}" -export KSQL_BOOTSTRAP_SERVERS="${KSQL_BOOTSTRAP_SERVERS:-}" - -# Custom environment variables may be defined below diff --git a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh b/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh deleted file mode 100755 index 8f3e94cfa5643..0000000000000 --- a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libksql.sh -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -print_welcome_page - -if [[ "$1" = "/opt/bitnami/scripts/ksql/run.sh" ]]; then - info "** Starting KSQL setup **" - /opt/bitnami/scripts/ksql/setup.sh - info "** KSQL setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh b/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh deleted file mode 100755 index 18531436a8901..0000000000000 --- a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -# Load libraries -. /opt/bitnami/scripts/libksql.sh -. /opt/bitnami/scripts/libfs.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -# Auxiliar functions - -######################## -# Create default config file -# Globals: -# KSQL_CONF_DIR -# Arguments: -# None -# Returns: -# None -######################### -ksql_create_default_config_file() { - cat > "${KSQL_CONF_FILE}.default" << EOF -## The address(es) the socket server listens on. -## FORMAT: listener_name://hostname:port -## -listeners = ${KSQL_DEFAULT_LISTENERS} - -## The advertised address(es) the server is advertised on. -## FORMAT: listener_name://hostname:port -## -# advertised.listener = - -## Keystore & Trustore used to expose the REST API over HTTPS -## -ssl.client.authentication = NONE -# ssl.key.password = -# ssl.keystore.location = -# ssl.keystore.password = - -## List of Kafka brokers to connect to. -## FORMAT: broker_hostname:port -## -bootstrap.servers = ${KSQL_DEFAULT_BOOTSTRAP_SERVERS} - -## Schema Registry server to connect to: -## FORMAT: schema_registry_hostname:port -## -# ksql.schema.registry.url = - -## Login configuration -## -ksql.logging.processing.topic.auto.create = true -ksql.logging.processing.stream.auto.create = true -ksql.logging.processing.rows.include = false - -## Sets the storage directory for stateful operations -## -ksql.streams.state.dir = ${KSQL_DATA_DIR} -EOF -} - -# Create default configuration file -rm "$KSQL_CONF_FILE" -ksql_create_default_config_file -# Ensure directories used by KSQL exist and have proper ownership and permissions -for dir in "$KSQL_CONF_DIR" "$KSQL_DATA_DIR" "$KSQL_LOGS_DIR" "$KSQL_CERTS_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done diff --git a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh b/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh deleted file mode 100755 index 138673a16b3b3..0000000000000 --- a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -info "** Starting KSQL **" - -__run_cmd="${KSQL_BIN_DIR}/ksql-server-start" -__run_flags=("$KSQL_CONF_FILE" "$@") - -if am_i_root; then - exec_as_user "$KSQL_DAEMON_USER" "$__run_cmd" "${__run_flags[@]}" -else - exec "$__run_cmd" "${__run_flags[@]}" -fi diff --git a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh b/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh deleted file mode 100755 index 28672ff979be9..0000000000000 --- a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libksql.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -# Ensure KSQL environment variables are valid -ksql_validate - -# Ensure 'daemon' user exists when running as 'root' -am_i_root && ensure_user_exists "$KSQL_DAEMON_USER" --group "$KSQL_DAEMON_GROUP" -for dir in "$KSQL_CONF_DIR" "$KSQL_DATA_DIR" "$KSQL_LOGS_DIR"; do - ensure_dir_exists "$dir" - am_i_root && chown -R "${KSQL_DAEMON_USER}:${KSQL_DAEMON_GROUP}" "$dir" -done - -# Ensure KSQL is initialized -ksql_initialize diff --git a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/libksql.sh b/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/libksql.sh deleted file mode 100644 index af7af40ccd216..0000000000000 --- a/bitnami/ksql/7.5/debian-12/rootfs/opt/bitnami/scripts/libksql.sh +++ /dev/null @@ -1,230 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Confluent KSQL library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Return listeners ports -# Globals: -# KSQL_LISTENERS -# Arguments: -# $1 - Bucket name -# Returns: -# Boolean -######################### -ksql_ports() { - local ports - - if [[ -n "$KSQL_LISTENERS" ]]; then - read -r -a listeners <<< "$(tr ',;' ' ' <<< "$KSQL_LISTENERS")" - for l in "${listeners[@]}"; do - if [[ "$l" =~ [a-zA-Z]*://.*:([0-9]*) ]]; then - ports+=("${BASH_REMATCH[1]}") - fi - done - echo "${ports[@]}" - else - echo "8081" - fi -} - -######################## -# Return listeners protocols -# Globals: -# KSQL_LISTENERS -# Arguments: -# $1 - Bucket name -# Returns: -# Boolean -######################### -ksql_protocols() { - local protocols - - if [[ -n "$KSQL_LISTENERS" ]]; then - read -r -a listeners <<< "$(tr ',;' ' ' <<< "$KSQL_LISTENERS")" - for l in "${listeners[@]}"; do - if [[ "$l" =~ ([a-zA-Z]*)://.*:[0-9]* ]]; then - protocols+=("${BASH_REMATCH[1]}") - fi - done - echo "${protocols[@]}" - else - echo "http" - fi -} - -######################## -# Validate settings in KSQL_* env vars -# Globals: -# KSQL_* -# Arguments: -# None -# Returns: -# None -######################### -ksql_validate() { - info "Validating settings in KSQL_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_true_false_value() { - if ! is_true_false_value "${!1}"; then - print_validation_error "The allowed values for $1 are [true, false]" - fi - } - check_conflicting_ports() { - local -r total="$#" - for i in $(seq 1 "$((total - 1))"); do - for j in $(seq "$((i + 1))" "$total"); do - if (( "${!i}" == "${!j}" )); then - print_validation_error "There are listeners bound to the same port" - fi - done - done - } - check_allowed_port() { - local validate_port_args=() - ! am_i_root && validate_port_args+=("-unprivileged") - if ! err=$(validate_port "${validate_port_args[@]}" "$1"); then - print_validation_error "An invalid port was specified in the environment variable KSQL_LISTENERS: $err" - fi - } - - if [[ -n "$KSQL_LISTENERS" ]]; then - read -r -a ports <<< "$(ksql_ports)" - for port in "${ports[@]}"; do - check_allowed_port "$port" - done - [[ "${#ports[@]}" -gt 1 ]] && check_conflicting_ports "${ports[@]}" - read -r -a protocols <<< "$(ksql_protocols)" - if [[ "${protocols[*]}" =~ https ]]; then - if [[ ! -f ${KSQL_CERTS_DIR}/ssl.keystore.jks ]]; then - print_validation_error "In order to configure HTTPS access, you must mount your ssl.keystore.jks (and optionally the ssl.truststore.jks) to the ${KSQL_CERTS_DIR} directory." - fi - fi - fi - [[ -z "$KSQL_BOOTSTRAP_SERVERS" && ! -f "$KSQL_CONF_FILE" ]] && warn "KSQL_BOOTSTRAP_SERVERS should be provided" - - [[ "$error_code" -eq 0 ]] || return "$error_code" -} - -######################## -# Set a configuration setting value to the configuration file -# Globals: -# KSQL_* -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -ksql_conf_set() { - local -r key="${1:?missing key}" - shift - local -r -a values=("$@") - - if [[ "${#values[@]}" -eq 0 ]]; then - stderr_print "missing value" - return 1 - elif [[ "${#values[@]}" -ne 1 ]]; then - for i in "${!values[@]}"; do - ksql_conf_set "${key[$i]}" "${values[$i]}" - done - else - value="${values[0]}" - # Check if the value was set before - if grep -q "^[# ]*$key\s*=.*" "$KSQL_CONF_FILE"; then - # Update the existing key - replace_in_file "$KSQL_CONF_FILE" "^[# ]*${key}\s*=.*" "${key} = ${value}" false - else - # Add a new key - printf '\n%s = %s' "$key" "$value" >>"$KSQL_CONF_FILE" - fi - fi -} - -######################## -# Wait for Kafka brokers to be up -# Globals: -# KSQL_* -# Arguments: -# None -# Returns: -# None -######################### -ksql_wait_for_kafka_brokers() { - local kafka_brokers - local host - local port - - info "Waiting for Kafka brokers to be up" - kafka_brokers="$(grep "^bootstrap.servers" "$KSQL_CONF_FILE" | cut -d '=' -f 2)" - read -r -a brokers <<< "$(tr ',;' ' ' <<< "${kafka_brokers/%,/}")" - for b in "${brokers[@]}"; do - if [[ "$b" =~ [_a-zA-Z]*://(.*):([0-9]*) ]]; then - host="${BASH_REMATCH[1]}" - port="${BASH_REMATCH[2]}" - if ! retry_while "debug_execute nc -z ${host} ${port}" 10 10; then - error "Failed to connect to the broker at $host:$port" - return 1 - fi - fi - done -} - -######################## -# Initialize Confluent KSQL -# Globals: -# KSQL_* -# Arguments: -# None -# Returns: -# None -######################### -ksql_initialize() { - info "Initializing Confluent KSQL" - - # Check for mounted configuration files - if ! is_dir_empty "$KSQL_MOUNTED_CONF_DIR"; then - cp -Lr "$KSQL_MOUNTED_CONF_DIR"/* "$KSQL_CONF_DIR" - fi - if [[ -f "$KSQL_CONF_FILE" ]]; then - info "Injected configuration file found. Skipping default configuration" - else - info "No injected configuration files found, creating default config file." - mv "${KSQL_CONF_FILE}.default" "$KSQL_CONF_FILE" - - # Kafka boostrap settings - [[ -n "$KSQL_BOOTSTRAP_SERVERS" ]] && ksql_conf_set "bootstrap.servers" "$KSQL_BOOTSTRAP_SERVERS" - # Listeners settings - if [[ -n "$KSQL_LISTENERS" ]]; then - ksql_conf_set "listeners" "$KSQL_LISTENERS" - read -r -a protocols <<< "$(ksql_protocols)" - if [[ "${protocols[*]}" =~ https ]]; then - ksql_conf_set "ssl.keystore.location" "${KSQL_CERTS_DIR}/ssl.keystore.jks" - [[ -n "$KSQL_SSL_KEYSTORE_PASSWORD" ]] && ksql_conf_set "ssl.keystore.password" "$KSQL_SSL_KEYSTORE_PASSWORD" - [[ -f "${KSQL_CERTS_DIR}/ssl.truststore.jks" ]] && ksql_conf_set "ssl.truststore.location" "${KSQL_CERTS_DIR}/ssl.truststore.jks" - [[ -n "$KSQL_SSL_TRUSTSTORE_PASSWORD" ]] && ksql_conf_set "ssl.truststore.password" "$KSQL_SSL_TRUSTSTORE_PASSWORD" - fi - [[ -n "$KSQL_CLIENT_AUTHENTICATION" ]] && ksql_conf_set "ssl.client.authentication" "$KSQL_CLIENT_AUTHENTICATION" - fi - fi - ksql_wait_for_kafka_brokers -} diff --git a/bitnami/ksql/7.5/debian-12/tags-info.yaml b/bitnami/ksql/7.5/debian-12/tags-info.yaml deleted file mode 100644 index 1a6fca0b37398..0000000000000 --- a/bitnami/ksql/7.5/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "7.5" -- 7.5-debian-12 -- 7.5.7 diff --git a/bitnami/ksql/7.6/README.md b/bitnami/ksql/7.6/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/ksql/7.6/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/ksql/7.6/debian-12/Dockerfile b/bitnami/ksql/7.6/debian-12/Dockerfile deleted file mode 100644 index 58e004f53f899..0000000000000 --- a/bitnami/ksql/7.6/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T22:23:50Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/ksql/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="7.6.2-debian-12-r9" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/ksql" \ - org.opencontainers.image.title="ksql" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="7.6.2" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl netcat-openbsd procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "java-17.0.13-12-1-linux-${OS_ARCH}-debian-12" \ - "ksql-7.6.2-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/java/postunpack.sh -RUN /opt/bitnami/scripts/ksql/postunpack.sh -ENV APP_VERSION="7.6.2" \ - BITNAMI_APP_NAME="ksql" \ - JAVA_HOME="/opt/bitnami/java" \ - PATH="/opt/bitnami/java/bin:/opt/bitnami/common/bin:/opt/bitnami/ksql/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/ksql/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/ksql/run.sh" ] diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 9442254a63711..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "17.0.13-12-1" - }, - "ksql": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "7.6.2-1" - } -} \ No newline at end of file diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/ksql/7.6/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/ksql/7.6/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/ksql/7.6/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/ksql/7.6/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 38802fc0bfe91..0000000000000 --- a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -if [[ "$OS_FLAVOUR" =~ photon && "$APP_VERSION" =~ ^1.8 ]]; then - # Option --module-path is not supported by JAVA 1.8 since modules were added in version 1.9 - unset JAVA_TOOL_OPTIONS -fi - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh b/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh deleted file mode 100644 index 735ca3114ae6e..0000000000000 --- a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for ksql - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-ksql}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -ksql_env_vars=( - KSQL_MOUNTED_CONF_DIR - KSQL_LISTENERS - KSQL_SSL_KEYSTORE_PASSWORD - KSQL_SSL_TRUSTSTORE_PASSWORD - KSQL_CLIENT_AUTHENTICATION - KSQL_BOOTSTRAP_SERVERS -) -for env_var in "${ksql_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset ksql_env_vars - -# Paths -export KSQL_BASE_DIR="${BITNAMI_ROOT_DIR}/ksql" -export KSQL_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/ksql" -export KSQL_DATA_DIR="${KSQL_VOLUME_DIR}/data" -export KSQL_BIN_DIR="${KSQL_BASE_DIR}/bin" -export KSQL_CONF_DIR="${KSQL_BASE_DIR}/etc/ksqldb" -export KSQL_LOGS_DIR="${KSQL_BASE_DIR}/logs" -export KSQL_CONF_FILE="${KSQL_CONF_DIR}/ksql-server.properties" -export KSQL_MOUNTED_CONF_DIR="${KSQL_MOUNTED_CONF_DIR:-${KSQL_VOLUME_DIR}/etc}" -export KSQL_CERTS_DIR="${KSQL_BASE_DIR}/certs" - -# System users (when running with a privileged user) -export KSQL_DAEMON_USER="ksql" -export KSQL_DAEMON_GROUP="ksql" -export KSQL_DEFAULT_LISTENERS="http://0.0.0.0:8088" # only used at build time -export KSQL_DEFAULT_BOOTSTRAP_SERVERS="localhost:9092" # only used at build time - -# KSQL settings -export KSQL_LISTENERS="${KSQL_LISTENERS:-}" -export KSQL_SSL_KEYSTORE_PASSWORD="${KSQL_SSL_KEYSTORE_PASSWORD:-}" -export KSQL_SSL_TRUSTSTORE_PASSWORD="${KSQL_SSL_TRUSTSTORE_PASSWORD:-}" -export KSQL_CLIENT_AUTHENTICATION="${KSQL_CLIENT_AUTHENTICATION:-}" -export KSQL_BOOTSTRAP_SERVERS="${KSQL_BOOTSTRAP_SERVERS:-}" - -# Custom environment variables may be defined below diff --git a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh b/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh deleted file mode 100755 index 8f3e94cfa5643..0000000000000 --- a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libksql.sh -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -print_welcome_page - -if [[ "$1" = "/opt/bitnami/scripts/ksql/run.sh" ]]; then - info "** Starting KSQL setup **" - /opt/bitnami/scripts/ksql/setup.sh - info "** KSQL setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh b/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh deleted file mode 100755 index 18531436a8901..0000000000000 --- a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -# Load libraries -. /opt/bitnami/scripts/libksql.sh -. /opt/bitnami/scripts/libfs.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -# Auxiliar functions - -######################## -# Create default config file -# Globals: -# KSQL_CONF_DIR -# Arguments: -# None -# Returns: -# None -######################### -ksql_create_default_config_file() { - cat > "${KSQL_CONF_FILE}.default" << EOF -## The address(es) the socket server listens on. -## FORMAT: listener_name://hostname:port -## -listeners = ${KSQL_DEFAULT_LISTENERS} - -## The advertised address(es) the server is advertised on. -## FORMAT: listener_name://hostname:port -## -# advertised.listener = - -## Keystore & Trustore used to expose the REST API over HTTPS -## -ssl.client.authentication = NONE -# ssl.key.password = -# ssl.keystore.location = -# ssl.keystore.password = - -## List of Kafka brokers to connect to. -## FORMAT: broker_hostname:port -## -bootstrap.servers = ${KSQL_DEFAULT_BOOTSTRAP_SERVERS} - -## Schema Registry server to connect to: -## FORMAT: schema_registry_hostname:port -## -# ksql.schema.registry.url = - -## Login configuration -## -ksql.logging.processing.topic.auto.create = true -ksql.logging.processing.stream.auto.create = true -ksql.logging.processing.rows.include = false - -## Sets the storage directory for stateful operations -## -ksql.streams.state.dir = ${KSQL_DATA_DIR} -EOF -} - -# Create default configuration file -rm "$KSQL_CONF_FILE" -ksql_create_default_config_file -# Ensure directories used by KSQL exist and have proper ownership and permissions -for dir in "$KSQL_CONF_DIR" "$KSQL_DATA_DIR" "$KSQL_LOGS_DIR" "$KSQL_CERTS_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done diff --git a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh b/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh deleted file mode 100755 index 138673a16b3b3..0000000000000 --- a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -info "** Starting KSQL **" - -__run_cmd="${KSQL_BIN_DIR}/ksql-server-start" -__run_flags=("$KSQL_CONF_FILE" "$@") - -if am_i_root; then - exec_as_user "$KSQL_DAEMON_USER" "$__run_cmd" "${__run_flags[@]}" -else - exec "$__run_cmd" "${__run_flags[@]}" -fi diff --git a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh b/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh deleted file mode 100755 index 28672ff979be9..0000000000000 --- a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libksql.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -# Ensure KSQL environment variables are valid -ksql_validate - -# Ensure 'daemon' user exists when running as 'root' -am_i_root && ensure_user_exists "$KSQL_DAEMON_USER" --group "$KSQL_DAEMON_GROUP" -for dir in "$KSQL_CONF_DIR" "$KSQL_DATA_DIR" "$KSQL_LOGS_DIR"; do - ensure_dir_exists "$dir" - am_i_root && chown -R "${KSQL_DAEMON_USER}:${KSQL_DAEMON_GROUP}" "$dir" -done - -# Ensure KSQL is initialized -ksql_initialize diff --git a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/libksql.sh b/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/libksql.sh deleted file mode 100644 index af7af40ccd216..0000000000000 --- a/bitnami/ksql/7.6/debian-12/rootfs/opt/bitnami/scripts/libksql.sh +++ /dev/null @@ -1,230 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Confluent KSQL library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Return listeners ports -# Globals: -# KSQL_LISTENERS -# Arguments: -# $1 - Bucket name -# Returns: -# Boolean -######################### -ksql_ports() { - local ports - - if [[ -n "$KSQL_LISTENERS" ]]; then - read -r -a listeners <<< "$(tr ',;' ' ' <<< "$KSQL_LISTENERS")" - for l in "${listeners[@]}"; do - if [[ "$l" =~ [a-zA-Z]*://.*:([0-9]*) ]]; then - ports+=("${BASH_REMATCH[1]}") - fi - done - echo "${ports[@]}" - else - echo "8081" - fi -} - -######################## -# Return listeners protocols -# Globals: -# KSQL_LISTENERS -# Arguments: -# $1 - Bucket name -# Returns: -# Boolean -######################### -ksql_protocols() { - local protocols - - if [[ -n "$KSQL_LISTENERS" ]]; then - read -r -a listeners <<< "$(tr ',;' ' ' <<< "$KSQL_LISTENERS")" - for l in "${listeners[@]}"; do - if [[ "$l" =~ ([a-zA-Z]*)://.*:[0-9]* ]]; then - protocols+=("${BASH_REMATCH[1]}") - fi - done - echo "${protocols[@]}" - else - echo "http" - fi -} - -######################## -# Validate settings in KSQL_* env vars -# Globals: -# KSQL_* -# Arguments: -# None -# Returns: -# None -######################### -ksql_validate() { - info "Validating settings in KSQL_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_true_false_value() { - if ! is_true_false_value "${!1}"; then - print_validation_error "The allowed values for $1 are [true, false]" - fi - } - check_conflicting_ports() { - local -r total="$#" - for i in $(seq 1 "$((total - 1))"); do - for j in $(seq "$((i + 1))" "$total"); do - if (( "${!i}" == "${!j}" )); then - print_validation_error "There are listeners bound to the same port" - fi - done - done - } - check_allowed_port() { - local validate_port_args=() - ! am_i_root && validate_port_args+=("-unprivileged") - if ! err=$(validate_port "${validate_port_args[@]}" "$1"); then - print_validation_error "An invalid port was specified in the environment variable KSQL_LISTENERS: $err" - fi - } - - if [[ -n "$KSQL_LISTENERS" ]]; then - read -r -a ports <<< "$(ksql_ports)" - for port in "${ports[@]}"; do - check_allowed_port "$port" - done - [[ "${#ports[@]}" -gt 1 ]] && check_conflicting_ports "${ports[@]}" - read -r -a protocols <<< "$(ksql_protocols)" - if [[ "${protocols[*]}" =~ https ]]; then - if [[ ! -f ${KSQL_CERTS_DIR}/ssl.keystore.jks ]]; then - print_validation_error "In order to configure HTTPS access, you must mount your ssl.keystore.jks (and optionally the ssl.truststore.jks) to the ${KSQL_CERTS_DIR} directory." - fi - fi - fi - [[ -z "$KSQL_BOOTSTRAP_SERVERS" && ! -f "$KSQL_CONF_FILE" ]] && warn "KSQL_BOOTSTRAP_SERVERS should be provided" - - [[ "$error_code" -eq 0 ]] || return "$error_code" -} - -######################## -# Set a configuration setting value to the configuration file -# Globals: -# KSQL_* -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -ksql_conf_set() { - local -r key="${1:?missing key}" - shift - local -r -a values=("$@") - - if [[ "${#values[@]}" -eq 0 ]]; then - stderr_print "missing value" - return 1 - elif [[ "${#values[@]}" -ne 1 ]]; then - for i in "${!values[@]}"; do - ksql_conf_set "${key[$i]}" "${values[$i]}" - done - else - value="${values[0]}" - # Check if the value was set before - if grep -q "^[# ]*$key\s*=.*" "$KSQL_CONF_FILE"; then - # Update the existing key - replace_in_file "$KSQL_CONF_FILE" "^[# ]*${key}\s*=.*" "${key} = ${value}" false - else - # Add a new key - printf '\n%s = %s' "$key" "$value" >>"$KSQL_CONF_FILE" - fi - fi -} - -######################## -# Wait for Kafka brokers to be up -# Globals: -# KSQL_* -# Arguments: -# None -# Returns: -# None -######################### -ksql_wait_for_kafka_brokers() { - local kafka_brokers - local host - local port - - info "Waiting for Kafka brokers to be up" - kafka_brokers="$(grep "^bootstrap.servers" "$KSQL_CONF_FILE" | cut -d '=' -f 2)" - read -r -a brokers <<< "$(tr ',;' ' ' <<< "${kafka_brokers/%,/}")" - for b in "${brokers[@]}"; do - if [[ "$b" =~ [_a-zA-Z]*://(.*):([0-9]*) ]]; then - host="${BASH_REMATCH[1]}" - port="${BASH_REMATCH[2]}" - if ! retry_while "debug_execute nc -z ${host} ${port}" 10 10; then - error "Failed to connect to the broker at $host:$port" - return 1 - fi - fi - done -} - -######################## -# Initialize Confluent KSQL -# Globals: -# KSQL_* -# Arguments: -# None -# Returns: -# None -######################### -ksql_initialize() { - info "Initializing Confluent KSQL" - - # Check for mounted configuration files - if ! is_dir_empty "$KSQL_MOUNTED_CONF_DIR"; then - cp -Lr "$KSQL_MOUNTED_CONF_DIR"/* "$KSQL_CONF_DIR" - fi - if [[ -f "$KSQL_CONF_FILE" ]]; then - info "Injected configuration file found. Skipping default configuration" - else - info "No injected configuration files found, creating default config file." - mv "${KSQL_CONF_FILE}.default" "$KSQL_CONF_FILE" - - # Kafka boostrap settings - [[ -n "$KSQL_BOOTSTRAP_SERVERS" ]] && ksql_conf_set "bootstrap.servers" "$KSQL_BOOTSTRAP_SERVERS" - # Listeners settings - if [[ -n "$KSQL_LISTENERS" ]]; then - ksql_conf_set "listeners" "$KSQL_LISTENERS" - read -r -a protocols <<< "$(ksql_protocols)" - if [[ "${protocols[*]}" =~ https ]]; then - ksql_conf_set "ssl.keystore.location" "${KSQL_CERTS_DIR}/ssl.keystore.jks" - [[ -n "$KSQL_SSL_KEYSTORE_PASSWORD" ]] && ksql_conf_set "ssl.keystore.password" "$KSQL_SSL_KEYSTORE_PASSWORD" - [[ -f "${KSQL_CERTS_DIR}/ssl.truststore.jks" ]] && ksql_conf_set "ssl.truststore.location" "${KSQL_CERTS_DIR}/ssl.truststore.jks" - [[ -n "$KSQL_SSL_TRUSTSTORE_PASSWORD" ]] && ksql_conf_set "ssl.truststore.password" "$KSQL_SSL_TRUSTSTORE_PASSWORD" - fi - [[ -n "$KSQL_CLIENT_AUTHENTICATION" ]] && ksql_conf_set "ssl.client.authentication" "$KSQL_CLIENT_AUTHENTICATION" - fi - fi - ksql_wait_for_kafka_brokers -} diff --git a/bitnami/ksql/7.6/debian-12/tags-info.yaml b/bitnami/ksql/7.6/debian-12/tags-info.yaml deleted file mode 100644 index 45b59afd187eb..0000000000000 --- a/bitnami/ksql/7.6/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "7.6" -- 7.6-debian-12 -- 7.6.2 diff --git a/bitnami/ksql/7.7/README.md b/bitnami/ksql/7.7/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/ksql/7.7/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/ksql/7.7/debian-12/Dockerfile b/bitnami/ksql/7.7/debian-12/Dockerfile deleted file mode 100644 index 2cdf8cb06e904..0000000000000 --- a/bitnami/ksql/7.7/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T22:23:59Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/ksql/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="7.7.1-debian-12-r3" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/ksql" \ - org.opencontainers.image.title="ksql" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="7.7.1" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl netcat-openbsd procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "java-17.0.13-12-1-linux-${OS_ARCH}-debian-12" \ - "ksql-7.7.1-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/java/postunpack.sh -RUN /opt/bitnami/scripts/ksql/postunpack.sh -ENV APP_VERSION="7.7.1" \ - BITNAMI_APP_NAME="ksql" \ - JAVA_HOME="/opt/bitnami/java" \ - PATH="/opt/bitnami/java/bin:/opt/bitnami/common/bin:/opt/bitnami/ksql/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/ksql/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/ksql/run.sh" ] diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 62d1c90fa5d53..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "17.0.13-12-1" - }, - "ksql": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "7.7.1-1" - } -} \ No newline at end of file diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/ksql/7.7/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/ksql/7.7/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/ksql/7.7/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/ksql/7.7/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 38802fc0bfe91..0000000000000 --- a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -if [[ "$OS_FLAVOUR" =~ photon && "$APP_VERSION" =~ ^1.8 ]]; then - # Option --module-path is not supported by JAVA 1.8 since modules were added in version 1.9 - unset JAVA_TOOL_OPTIONS -fi - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh b/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh deleted file mode 100644 index 735ca3114ae6e..0000000000000 --- a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql-env.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for ksql - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-ksql}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -ksql_env_vars=( - KSQL_MOUNTED_CONF_DIR - KSQL_LISTENERS - KSQL_SSL_KEYSTORE_PASSWORD - KSQL_SSL_TRUSTSTORE_PASSWORD - KSQL_CLIENT_AUTHENTICATION - KSQL_BOOTSTRAP_SERVERS -) -for env_var in "${ksql_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset ksql_env_vars - -# Paths -export KSQL_BASE_DIR="${BITNAMI_ROOT_DIR}/ksql" -export KSQL_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/ksql" -export KSQL_DATA_DIR="${KSQL_VOLUME_DIR}/data" -export KSQL_BIN_DIR="${KSQL_BASE_DIR}/bin" -export KSQL_CONF_DIR="${KSQL_BASE_DIR}/etc/ksqldb" -export KSQL_LOGS_DIR="${KSQL_BASE_DIR}/logs" -export KSQL_CONF_FILE="${KSQL_CONF_DIR}/ksql-server.properties" -export KSQL_MOUNTED_CONF_DIR="${KSQL_MOUNTED_CONF_DIR:-${KSQL_VOLUME_DIR}/etc}" -export KSQL_CERTS_DIR="${KSQL_BASE_DIR}/certs" - -# System users (when running with a privileged user) -export KSQL_DAEMON_USER="ksql" -export KSQL_DAEMON_GROUP="ksql" -export KSQL_DEFAULT_LISTENERS="http://0.0.0.0:8088" # only used at build time -export KSQL_DEFAULT_BOOTSTRAP_SERVERS="localhost:9092" # only used at build time - -# KSQL settings -export KSQL_LISTENERS="${KSQL_LISTENERS:-}" -export KSQL_SSL_KEYSTORE_PASSWORD="${KSQL_SSL_KEYSTORE_PASSWORD:-}" -export KSQL_SSL_TRUSTSTORE_PASSWORD="${KSQL_SSL_TRUSTSTORE_PASSWORD:-}" -export KSQL_CLIENT_AUTHENTICATION="${KSQL_CLIENT_AUTHENTICATION:-}" -export KSQL_BOOTSTRAP_SERVERS="${KSQL_BOOTSTRAP_SERVERS:-}" - -# Custom environment variables may be defined below diff --git a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh b/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh deleted file mode 100755 index 8f3e94cfa5643..0000000000000 --- a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/entrypoint.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libksql.sh -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -print_welcome_page - -if [[ "$1" = "/opt/bitnami/scripts/ksql/run.sh" ]]; then - info "** Starting KSQL setup **" - /opt/bitnami/scripts/ksql/setup.sh - info "** KSQL setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh b/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh deleted file mode 100755 index 18531436a8901..0000000000000 --- a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/postunpack.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -# Load libraries -. /opt/bitnami/scripts/libksql.sh -. /opt/bitnami/scripts/libfs.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -# Auxiliar functions - -######################## -# Create default config file -# Globals: -# KSQL_CONF_DIR -# Arguments: -# None -# Returns: -# None -######################### -ksql_create_default_config_file() { - cat > "${KSQL_CONF_FILE}.default" << EOF -## The address(es) the socket server listens on. -## FORMAT: listener_name://hostname:port -## -listeners = ${KSQL_DEFAULT_LISTENERS} - -## The advertised address(es) the server is advertised on. -## FORMAT: listener_name://hostname:port -## -# advertised.listener = - -## Keystore & Trustore used to expose the REST API over HTTPS -## -ssl.client.authentication = NONE -# ssl.key.password = -# ssl.keystore.location = -# ssl.keystore.password = - -## List of Kafka brokers to connect to. -## FORMAT: broker_hostname:port -## -bootstrap.servers = ${KSQL_DEFAULT_BOOTSTRAP_SERVERS} - -## Schema Registry server to connect to: -## FORMAT: schema_registry_hostname:port -## -# ksql.schema.registry.url = - -## Login configuration -## -ksql.logging.processing.topic.auto.create = true -ksql.logging.processing.stream.auto.create = true -ksql.logging.processing.rows.include = false - -## Sets the storage directory for stateful operations -## -ksql.streams.state.dir = ${KSQL_DATA_DIR} -EOF -} - -# Create default configuration file -rm "$KSQL_CONF_FILE" -ksql_create_default_config_file -# Ensure directories used by KSQL exist and have proper ownership and permissions -for dir in "$KSQL_CONF_DIR" "$KSQL_DATA_DIR" "$KSQL_LOGS_DIR" "$KSQL_CERTS_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done diff --git a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh b/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh deleted file mode 100755 index 138673a16b3b3..0000000000000 --- a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/run.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -info "** Starting KSQL **" - -__run_cmd="${KSQL_BIN_DIR}/ksql-server-start" -__run_flags=("$KSQL_CONF_FILE" "$@") - -if am_i_root; then - exec_as_user "$KSQL_DAEMON_USER" "$__run_cmd" "${__run_flags[@]}" -else - exec "$__run_cmd" "${__run_flags[@]}" -fi diff --git a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh b/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh deleted file mode 100755 index 28672ff979be9..0000000000000 --- a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/ksql/setup.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libksql.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh - -# Load KSQL environment variables -. /opt/bitnami/scripts/ksql-env.sh - -# Ensure KSQL environment variables are valid -ksql_validate - -# Ensure 'daemon' user exists when running as 'root' -am_i_root && ensure_user_exists "$KSQL_DAEMON_USER" --group "$KSQL_DAEMON_GROUP" -for dir in "$KSQL_CONF_DIR" "$KSQL_DATA_DIR" "$KSQL_LOGS_DIR"; do - ensure_dir_exists "$dir" - am_i_root && chown -R "${KSQL_DAEMON_USER}:${KSQL_DAEMON_GROUP}" "$dir" -done - -# Ensure KSQL is initialized -ksql_initialize diff --git a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/libksql.sh b/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/libksql.sh deleted file mode 100644 index af7af40ccd216..0000000000000 --- a/bitnami/ksql/7.7/debian-12/rootfs/opt/bitnami/scripts/libksql.sh +++ /dev/null @@ -1,230 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Confluent KSQL library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Return listeners ports -# Globals: -# KSQL_LISTENERS -# Arguments: -# $1 - Bucket name -# Returns: -# Boolean -######################### -ksql_ports() { - local ports - - if [[ -n "$KSQL_LISTENERS" ]]; then - read -r -a listeners <<< "$(tr ',;' ' ' <<< "$KSQL_LISTENERS")" - for l in "${listeners[@]}"; do - if [[ "$l" =~ [a-zA-Z]*://.*:([0-9]*) ]]; then - ports+=("${BASH_REMATCH[1]}") - fi - done - echo "${ports[@]}" - else - echo "8081" - fi -} - -######################## -# Return listeners protocols -# Globals: -# KSQL_LISTENERS -# Arguments: -# $1 - Bucket name -# Returns: -# Boolean -######################### -ksql_protocols() { - local protocols - - if [[ -n "$KSQL_LISTENERS" ]]; then - read -r -a listeners <<< "$(tr ',;' ' ' <<< "$KSQL_LISTENERS")" - for l in "${listeners[@]}"; do - if [[ "$l" =~ ([a-zA-Z]*)://.*:[0-9]* ]]; then - protocols+=("${BASH_REMATCH[1]}") - fi - done - echo "${protocols[@]}" - else - echo "http" - fi -} - -######################## -# Validate settings in KSQL_* env vars -# Globals: -# KSQL_* -# Arguments: -# None -# Returns: -# None -######################### -ksql_validate() { - info "Validating settings in KSQL_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_true_false_value() { - if ! is_true_false_value "${!1}"; then - print_validation_error "The allowed values for $1 are [true, false]" - fi - } - check_conflicting_ports() { - local -r total="$#" - for i in $(seq 1 "$((total - 1))"); do - for j in $(seq "$((i + 1))" "$total"); do - if (( "${!i}" == "${!j}" )); then - print_validation_error "There are listeners bound to the same port" - fi - done - done - } - check_allowed_port() { - local validate_port_args=() - ! am_i_root && validate_port_args+=("-unprivileged") - if ! err=$(validate_port "${validate_port_args[@]}" "$1"); then - print_validation_error "An invalid port was specified in the environment variable KSQL_LISTENERS: $err" - fi - } - - if [[ -n "$KSQL_LISTENERS" ]]; then - read -r -a ports <<< "$(ksql_ports)" - for port in "${ports[@]}"; do - check_allowed_port "$port" - done - [[ "${#ports[@]}" -gt 1 ]] && check_conflicting_ports "${ports[@]}" - read -r -a protocols <<< "$(ksql_protocols)" - if [[ "${protocols[*]}" =~ https ]]; then - if [[ ! -f ${KSQL_CERTS_DIR}/ssl.keystore.jks ]]; then - print_validation_error "In order to configure HTTPS access, you must mount your ssl.keystore.jks (and optionally the ssl.truststore.jks) to the ${KSQL_CERTS_DIR} directory." - fi - fi - fi - [[ -z "$KSQL_BOOTSTRAP_SERVERS" && ! -f "$KSQL_CONF_FILE" ]] && warn "KSQL_BOOTSTRAP_SERVERS should be provided" - - [[ "$error_code" -eq 0 ]] || return "$error_code" -} - -######################## -# Set a configuration setting value to the configuration file -# Globals: -# KSQL_* -# Arguments: -# $1 - key -# $2 - values (array) -# Returns: -# None -######################### -ksql_conf_set() { - local -r key="${1:?missing key}" - shift - local -r -a values=("$@") - - if [[ "${#values[@]}" -eq 0 ]]; then - stderr_print "missing value" - return 1 - elif [[ "${#values[@]}" -ne 1 ]]; then - for i in "${!values[@]}"; do - ksql_conf_set "${key[$i]}" "${values[$i]}" - done - else - value="${values[0]}" - # Check if the value was set before - if grep -q "^[# ]*$key\s*=.*" "$KSQL_CONF_FILE"; then - # Update the existing key - replace_in_file "$KSQL_CONF_FILE" "^[# ]*${key}\s*=.*" "${key} = ${value}" false - else - # Add a new key - printf '\n%s = %s' "$key" "$value" >>"$KSQL_CONF_FILE" - fi - fi -} - -######################## -# Wait for Kafka brokers to be up -# Globals: -# KSQL_* -# Arguments: -# None -# Returns: -# None -######################### -ksql_wait_for_kafka_brokers() { - local kafka_brokers - local host - local port - - info "Waiting for Kafka brokers to be up" - kafka_brokers="$(grep "^bootstrap.servers" "$KSQL_CONF_FILE" | cut -d '=' -f 2)" - read -r -a brokers <<< "$(tr ',;' ' ' <<< "${kafka_brokers/%,/}")" - for b in "${brokers[@]}"; do - if [[ "$b" =~ [_a-zA-Z]*://(.*):([0-9]*) ]]; then - host="${BASH_REMATCH[1]}" - port="${BASH_REMATCH[2]}" - if ! retry_while "debug_execute nc -z ${host} ${port}" 10 10; then - error "Failed to connect to the broker at $host:$port" - return 1 - fi - fi - done -} - -######################## -# Initialize Confluent KSQL -# Globals: -# KSQL_* -# Arguments: -# None -# Returns: -# None -######################### -ksql_initialize() { - info "Initializing Confluent KSQL" - - # Check for mounted configuration files - if ! is_dir_empty "$KSQL_MOUNTED_CONF_DIR"; then - cp -Lr "$KSQL_MOUNTED_CONF_DIR"/* "$KSQL_CONF_DIR" - fi - if [[ -f "$KSQL_CONF_FILE" ]]; then - info "Injected configuration file found. Skipping default configuration" - else - info "No injected configuration files found, creating default config file." - mv "${KSQL_CONF_FILE}.default" "$KSQL_CONF_FILE" - - # Kafka boostrap settings - [[ -n "$KSQL_BOOTSTRAP_SERVERS" ]] && ksql_conf_set "bootstrap.servers" "$KSQL_BOOTSTRAP_SERVERS" - # Listeners settings - if [[ -n "$KSQL_LISTENERS" ]]; then - ksql_conf_set "listeners" "$KSQL_LISTENERS" - read -r -a protocols <<< "$(ksql_protocols)" - if [[ "${protocols[*]}" =~ https ]]; then - ksql_conf_set "ssl.keystore.location" "${KSQL_CERTS_DIR}/ssl.keystore.jks" - [[ -n "$KSQL_SSL_KEYSTORE_PASSWORD" ]] && ksql_conf_set "ssl.keystore.password" "$KSQL_SSL_KEYSTORE_PASSWORD" - [[ -f "${KSQL_CERTS_DIR}/ssl.truststore.jks" ]] && ksql_conf_set "ssl.truststore.location" "${KSQL_CERTS_DIR}/ssl.truststore.jks" - [[ -n "$KSQL_SSL_TRUSTSTORE_PASSWORD" ]] && ksql_conf_set "ssl.truststore.password" "$KSQL_SSL_TRUSTSTORE_PASSWORD" - fi - [[ -n "$KSQL_CLIENT_AUTHENTICATION" ]] && ksql_conf_set "ssl.client.authentication" "$KSQL_CLIENT_AUTHENTICATION" - fi - fi - ksql_wait_for_kafka_brokers -} diff --git a/bitnami/ksql/7.7/debian-12/tags-info.yaml b/bitnami/ksql/7.7/debian-12/tags-info.yaml deleted file mode 100644 index faa678b7ad246..0000000000000 --- a/bitnami/ksql/7.7/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "7.7" -- 7.7-debian-12 -- 7.7.1 diff --git a/bitnami/kubectl/1.29/README.md b/bitnami/kubectl/1.29/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/kubectl/1.29/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/kubectl/1.29/debian-12/Dockerfile b/bitnami/kubectl/1.29/debian-12/Dockerfile deleted file mode 100644 index 14115554d1914..0000000000000 --- a/bitnami/kubectl/1.29/debian-12/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-04T00:28:48Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/kubectl/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="1.29.11-debian-12-r1" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/kubectl" \ - org.opencontainers.image.title="kubectl" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="1.29.11" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl gettext git jq procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "yq-4.44.5-0-linux-${OS_ARCH}-debian-12" \ - "kubectl-1.29.11-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN mkdir /.kube && chmod g+rwX /.kube -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -ENV APP_VERSION="1.29.11" \ - BITNAMI_APP_NAME="kubectl" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/kubectl/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "kubectl" ] -CMD [ "--help" ] diff --git a/bitnami/kubectl/1.29/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/kubectl/1.29/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 71e4658b5c9bc..0000000000000 --- a/bitnami/kubectl/1.29/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "kubectl": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.29.11-1" - }, - "yq": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "4.44.5-0" - } -} \ No newline at end of file diff --git a/bitnami/kubectl/1.29/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/kubectl/1.29/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/kubectl/1.29/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/kubectl/1.29/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/kubectl/1.29/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/kubectl/1.29/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/kubectl/1.29/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/kubectl/1.29/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/kubectl/1.29/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/kubectl/1.29/debian-12/tags-info.yaml b/bitnami/kubectl/1.29/debian-12/tags-info.yaml deleted file mode 100644 index c16ecd5d267c8..0000000000000 --- a/bitnami/kubectl/1.29/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "1.29" -- 1.29-debian-12 -- 1.29.11 diff --git a/bitnami/kubectl/1.30/README.md b/bitnami/kubectl/1.30/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/kubectl/1.30/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/kubectl/1.30/debian-12/Dockerfile b/bitnami/kubectl/1.30/debian-12/Dockerfile deleted file mode 100644 index 1f3f6009f5892..0000000000000 --- a/bitnami/kubectl/1.30/debian-12/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-04T00:34:38Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/kubectl/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="1.30.7-debian-12-r1" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/kubectl" \ - org.opencontainers.image.title="kubectl" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="1.30.7" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl gettext git jq procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "yq-4.44.5-0-linux-${OS_ARCH}-debian-12" \ - "kubectl-1.30.7-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN mkdir /.kube && chmod g+rwX /.kube -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -ENV APP_VERSION="1.30.7" \ - BITNAMI_APP_NAME="kubectl" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/kubectl/bin:$PATH" - -USER 1001 -ENTRYPOINT [ "kubectl" ] -CMD [ "--help" ] diff --git a/bitnami/kubectl/1.30/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/kubectl/1.30/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 14c16d619f0ee..0000000000000 --- a/bitnami/kubectl/1.30/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "kubectl": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.30.7-1" - }, - "yq": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "4.44.5-0" - } -} \ No newline at end of file diff --git a/bitnami/kubectl/1.30/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/kubectl/1.30/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/kubectl/1.30/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/kubectl/1.30/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/kubectl/1.30/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/kubectl/1.30/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/kubectl/1.30/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/kubectl/1.30/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/kubectl/1.30/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/kubectl/1.30/debian-12/tags-info.yaml b/bitnami/kubectl/1.30/debian-12/tags-info.yaml deleted file mode 100644 index 18493030f2729..0000000000000 --- a/bitnami/kubectl/1.30/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "1.30" -- 1.30-debian-12 -- 1.30.7 diff --git a/bitnami/kubescape/3.0.3/README.md b/bitnami/kubescape/3.0.3/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/kubescape/3.0.3/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/kubescape/3.0.3/debian-12/Dockerfile b/bitnami/kubescape/3.0.3/debian-12/Dockerfile deleted file mode 100644 index f8fad9337bef8..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-04T00:51:59Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/kubescape/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="3.0.3-debian-12-r24" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/kubescape" \ - org.opencontainers.image.title="kubescape" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="3.0.3" - -ENV HOME="/opt/bitnami/kubescape" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" \ - PATH="/opt/bitnami/kubescape/bin:$PATH" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl git jq procps -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "kubescape-3.0.3-18-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/kubescape/postunpack.sh -ENV APP_VERSION="3.0.3" \ - BITNAMI_APP_NAME="kubescape" - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/kubescape/entrypoint.sh" ] -CMD [ "--help" ] diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index fe18864e3a9d4..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "kubescape": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "3.0.3-18" - } -} \ No newline at end of file diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/kubescape/3.0.3/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/kubescape-env.sh b/bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/kubescape-env.sh deleted file mode 100644 index 0e30981a04989..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/kubescape-env.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for kubescape - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-kubescape}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# Paths -export KUBESCAPE_BASE_DIR="${BITNAMI_ROOT_DIR}/kubescape" -export KUBESCAPE_CACHE_DIR="${KUBESCAPE_BASE_DIR}/.cache" -export KUBESCAPE_ARTIFACTS_DIR="${KUBESCAPE_BASE_DIR}/.kubescape" -export TANZU_APPLICATION_CATALOG_FILE="${KUBESCAPE_BASE_DIR}/bitnami-catalog.json" - -# Custom environment variables may be defined below diff --git a/bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/kubescape/entrypoint.sh b/bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/kubescape/entrypoint.sh deleted file mode 100755 index 1cdc6730b1288..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/kubescape/entrypoint.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libkubescape.sh - -# Load Kubescape environment variables -. /opt/bitnami/scripts/kubescape-env.sh - -# Custom action that performs Bitnami OSS assessment -if [[ "$1" = "oss-assessment" ]]; then - kubescape_oss_assessment "$@" -else - exec "kubescape" "$@" -fi - diff --git a/bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/kubescape/postunpack.sh b/bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/kubescape/postunpack.sh deleted file mode 100755 index 7c2f8a25f3758..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/kubescape/postunpack.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1090,SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -. /opt/bitnami/scripts/libos.sh - -# Load Kubescape environment variables -. /opt/bitnami/scripts/kubescape-env.sh - -# Download Tanzu Application Catalog list, required for 'oss-assessment' custom action -curl --fail -sLo "${TANZU_APPLICATION_CATALOG_FILE}" "https://api.app-catalog.vmware.com/v1/applications?scope=COMMON&scope=ONLY_CUSTOMERS" - -# Configuring permissions for tmp and logs folders -for dir in "$KUBESCAPE_CACHE_DIR" "$KUBESCAPE_ARTIFACTS_DIR"; do - ensure_dir_exists "$dir" - configure_permissions_ownership "$dir" -g "root" -d "775" -f "664" -done - -# Download kubescape artifacts -# Also ensure permissions are properly configured -kubescape download artifacts -configure_permissions_ownership "$KUBESCAPE_ARTIFACTS_DIR" -g "root" -d "775" -f "664" diff --git a/bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/libkubescape.sh b/bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/libkubescape.sh deleted file mode 100644 index 8bd41cce1383c..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/rootfs/opt/bitnami/scripts/libkubescape.sh +++ /dev/null @@ -1,204 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Laravel library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Load Kubescape environment variables -. /opt/bitnami/scripts/kubescape-env.sh - -######################## -# Prints the usage instructions for the oss_assessment custom action -# Arguments: -# None -# Returns: -# None -######################### -kubescape_oss_assessment_usage() { - - echo """ -Usage: - docker run --rm -it bitnami/kubescape: oss-assessment scan [project] [flags] - -Examples: - - Scan command is for scanning an existing cluster or kubernetes manifest files based on pre-defined frameworks - - # Scan git repository - docker run --rm -it bitnami/kubescape oss-assessment - - # Scan remote Kubernetes cluster. - docker run --rm -it -v /path/to/.kubeconfig:/.kubeconfig bitnami/kubescape oss-assessment --kubeconfig /.kubeconfig - - # Scan and save the results into a file - docker run --rm -it -v /path/to/output:/output bitnami/kubescape oss-assessment --output /output/report.json - - # Disable kubescape logs - docker run --rm -it bitnami/kubescape oss-assessment 'repository_url' --log-level error - - # Enable debug logs - docker run --rm -it -e BITNAMI_DEBUG=true bitnami/kubescape oss-assessment 'repository_url' --log-level error - - # Disable all logs and export result using docker output - docker run --rm -it bitnami/kubescape oss-assessment 'repository_url' --silent > report.json - - # NOTE: When using volumes, permission changes may be required because of the container running as user 1001 - -Flags: - --kubeconfig string Paths to a kubeconfig. Required to scan Kubernetes cluster. - -h, --help Print help for oss-assessment action - -o, --output string Output file. Print output to file and not stdout - -l, --log-level string Log level for the kubescape scan and kubescape scan image commands. - -r, --retries Number of retries for each 'kubescape scan image' command. - -s, --silent Do not display any logs in stdout, only the resulting report. - - # NOTE: Additionally, other 'kubescape scan' flags can be added, run 'kubescape scan -h' for additional information. - """ -} - -######################## -# Runs a kubescape scan and enriches it with Vulnerabilities information for images available in Tanzu Application Catalog -# Arguments: -# - project_url (optional) -# - Supported kubescape flags -# Returns: -# None -######################### -kubescape_oss_assessment() { - - local cmd="kubescape" - local scan_args=("scan" "--format=json") - local scan_image_args=("scan" "image" "--format=json") - local silent="false" - local output="" - local retries="3" - - # By default, Kubescape only runs NSA and MITRE frameworks - # We want to extend that to also include SOC2 and CIS frameworks - readarray -t frameworks < <(${cmd} list frameworks --format=json | jq '.[]' | grep -Ei "nsa|mitre|soc2|cis-v" | sed 's/"//g') - if [[ "${#frameworks[@]}" -gt 0 ]]; then - info "OSS Assessment scan will use the following frameworks: ${frameworks[*]}" - scan_args+=("framework" "$(tr ' ' ',' <<< "${frameworks[*]}")") - else - warn "Could not obtain frameworks, using default ones." - fi - - # Handle input - while [[ $# -gt 0 ]]; do - key="$1" - case $key in - oss-assessment) - shift - ;; - -h|--help) - kubescape_oss_assessment_usage - exit 0 - ;; - -o|--output) - output="$2" - shift 2 - ;; - -s|--silent) - silent="true" - shift - ;; - -r|--retries) - retries="$2" - shift 2 - ;; - *) - scan_args+=("$1") - shift - ;; - esac - done - - # Check that Tanzu Application Catalog file exists - if [[ -f "${TANZU_APPLICATION_CATALOG_FILE}" ]]; then - TAC_PRODUCTS=$(jq -r '.[].product.key' "$TANZU_APPLICATION_CATALOG_FILE") - else - error "The Bitnami Catalog JSON file is missing: ${TANZU_APPLICATION_CATALOG_FILE}" - fi - - # Run Kubescape scan for the provided project and add custom field 'security' - info "Running command '${cmd} ${scan_args[*]}'" - if is_boolean_yes "$silent"; then - KUBESCAPE_OUTPUT="$(${cmd} "${scan_args[@]}" 2> /dev/null | jq '.security = []' || true)" - else - KUBESCAPE_OUTPUT="$(${cmd} "${scan_args[@]}" | jq '.security = []' || true)" - fi - if [[ -n "$KUBESCAPE_OUTPUT" ]]; then - ! is_boolean_yes "$silent" && debug "Result:\n$KUBESCAPE_OUTPUT" - else - error "Failed to execute command 'kubescape scan'." - exit 1 - fi - - # Search for images available in Tanzu Application Catalog - ! is_boolean_yes "$silent" && info "Searching images available in Tanzu Application Catalog" - local -a matching_images - readarray -t project_images < <(echo "$KUBESCAPE_OUTPUT" | jq -r '.resources[]?.object?.spec?.template?.spec?.containers[]?.image') - - for image in "${project_images[@]}"; do - ! is_boolean_yes "$silent" && info "Found image: $image" - for tac_image in $TAC_PRODUCTS; do - if [[ $image =~ $tac_image ]]; then - ! is_boolean_yes "$silent" && info "Found Tanzu Application Catalog image matching! Adding image '${image}' to the scanning list" - matching_images+=("$image") - break - fi - done - done - - # Filter out duplicated images - read -r -a unique_matching_images <<< "$(echo "${matching_images[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')" - ! is_boolean_yes "$silent" && info "Scanning images ${unique_matching_images[*]}" - images_scanned=0 - images_success_scanned=0 - - # For each image available in Tanzu Application Catalog, add a vulnerability report to the original project scan - for image in "${unique_matching_images[@]}"; do - KUBESCAPE_IMAGE_OUTPUT="" - info "Scanning image $((images_scanned + 1)) out of ${#unique_matching_images[@]}: ${image}" - for ((i = 1; i <= retries; i += 1)); do - KUBESCAPE_IMAGE_OUTPUT="$(${cmd} "${scan_image_args[@]}" "${image}" 2> /dev/null || echo '')" - if [[ -n "$KUBESCAPE_IMAGE_OUTPUT" ]]; then - debug "Result: $KUBESCAPE_IMAGE_OUTPUT" - break - else - ! is_boolean_yes "$silent" && debug "Image scan failed. Retrying... ${i}/${retries}" - fi - done - - if [[ -n "$KUBESCAPE_IMAGE_OUTPUT" ]]; then - KUBESCAPE_IMAGE_VULNS="$(jq --arg image "$image" '{imageID: $image, vulnerabilities: [.matches[].vulnerability | {id, severity, urls}]}' <(echo "$KUBESCAPE_IMAGE_OUTPUT"))" - KUBESCAPE_OUTPUT="$(jq '.security += [input]' <(echo "$KUBESCAPE_OUTPUT") <(echo "$KUBESCAPE_IMAGE_VULNS"))" - images_success_scanned="$((images_success_scanned + 1))" - else - debug "Failed to scan image '${image}' after several attempts." - fi - images_scanned="$((images_scanned + 1))" - done - - info "Total scanned: ${images_success_scanned} out of ${#unique_matching_images[@]}" - - ! is_boolean_yes "$silent" && info "OSS Assessment report successfully generated" - if [[ -n "$output" ]]; then - echo "$KUBESCAPE_OUTPUT" > "$output" - else - echo "$KUBESCAPE_OUTPUT" - fi - - if [[ "${images_success_scanned}" != "${#unique_matching_images[@]}" ]]; then - info "For getting a more complete report, visit the OSS Health Assessment FAQ to scan images from private repositories." - fi -} diff --git a/bitnami/kubescape/3.0.3/debian-12/tags-info.yaml b/bitnami/kubescape/3.0.3/debian-12/tags-info.yaml deleted file mode 100644 index a71654ba99f2e..0000000000000 --- a/bitnami/kubescape/3.0.3/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- 3.0.3 -- 3.0.3 -- 3.0.3-debian-12 diff --git a/bitnami/laravel/10/README.md b/bitnami/laravel/10/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/laravel/10/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/laravel/10/debian-12/Dockerfile b/bitnami/laravel/10/debian-12/Dockerfile deleted file mode 100644 index 02f479a7c37dd..0000000000000 --- a/bitnami/laravel/10/debian-12/Dockerfile +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-16T00:19:23Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/laravel/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="10.3.3-debian-12-r27" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/laravel" \ - org.opencontainers.image.title="laravel" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="10.3.3" - -ENV OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libbrotli1 libbsd0 libbz2-1.0 libcom-err2 libcrypt1 libcurl4 libexpat1 libffi8 libfftw3-double3 libfontconfig1 libfreetype6 libgcc-s1 libgcrypt20 libglib2.0-0 libgmp10 libgnutls30 libgomp1 libgpg-error0 libgssapi-krb5-2 libhashkit2 libhogweed6 libicu72 libidn2-0 libjpeg62-turbo libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 liblcms2-2 libldap-2.5-0 liblqr-1-0 libltdl7 liblzma5 libmagickcore-6.q16-6 libmagickwand-6.q16-6 libmd0 libmemcached11 libncursesw6 libnettle8 libnghttp2-14 libnsl2 libonig5 libp11-kit0 libpcre2-8-0 libpng16-16 libpq5 libpsl5 libreadline8 librtmp1 libsasl2-2 libsodium23 libsqlite3-0 libssh2-1 libssl3 libstdc++6 libsybdb5 libtasn1-6 libtidy5deb1 libtinfo6 libtirpc3 libunistring2 libwebp7 libx11-6 libxau6 libxcb1 libxdmcp6 libxext6 libxml2 libxslt1.1 libzip4 libzstd1 procps sqlite3 sudo zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "python-3.12.7-4-linux-${OS_ARCH}-debian-12" \ - "wait-for-port-1.0.8-7-linux-${OS_ARCH}-debian-12" \ - "php-8.3.13-4-linux-${OS_ARCH}-debian-12" \ - "node-22.11.0-1-linux-${OS_ARCH}-debian-12" \ - "laravel-10.3.3-3-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN /build/bitnami-user.sh -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/laravel/postunpack.sh -RUN /opt/bitnami/scripts/php/postunpack.sh -ENV APP_VERSION="10.3.3" \ - BITNAMI_APP_NAME="laravel" \ - NODE_PATH="/opt/bitnami/node/lib/node_modules" \ - PATH="/opt/bitnami/python/bin:/opt/bitnami/common/bin:/opt/bitnami/php/bin:/opt/bitnami/php/sbin:/opt/bitnami/node/bin:$PATH" \ - PHP_ENABLE_OPCACHE="0" - -EXPOSE 3000 8000 - -WORKDIR /app -ENTRYPOINT [ "/opt/bitnami/scripts/laravel/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/laravel/run.sh" ] diff --git a/bitnami/laravel/10/debian-12/prebuildfs/build/bitnami-user.sh b/bitnami/laravel/10/debian-12/prebuildfs/build/bitnami-user.sh deleted file mode 100755 index c652203b03df6..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/build/bitnami-user.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -useradd -ms /bin/bash bitnami -mkdir -p /opt/bitnami -sed -i -e 's/\s*Defaults\s*secure_path\s*=/# Defaults secure_path=/' /etc/sudoers -echo 'bitnami ALL=NOPASSWD: ALL' >> /etc/sudoers diff --git a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 30965003d4302..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "laravel": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "10.3.3-3" - }, - "node": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "22.11.0-1" - }, - "php": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "8.3.13-4" - }, - "python": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "3.12.7-4" - }, - "wait-for-port": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.8-7" - } -} \ No newline at end of file diff --git a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/laravel/10/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/laravel/10/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/laravel/10/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/laravel/10/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/laravel/10/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel-env.sh b/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel-env.sh deleted file mode 100644 index 9987fa9aeaeba..0000000000000 --- a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel-env.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for laravel - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-laravel}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -laravel_env_vars=( - LARAVEL_PORT_NUMBER - LARAVEL_SKIP_COMPOSER_UPDATE - LARAVEL_SKIP_DATABASE - LARAVEL_DATABASE_TYPE - LARAVEL_DATABASE_HOST - LARAVEL_DATABASE_PORT_NUMBER - LARAVEL_DATABASE_NAME - LARAVEL_DATABASE_USER - LARAVEL_DATABASE_PASSWORD - SKIP_COMPOSER_UPDATE - DB_CONNECTION - DB_HOST - DB_PORT - DB_DATABASE - DB_USERNAME - DB_PASSWORD -) -for env_var in "${laravel_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset laravel_env_vars - -# Paths -export LARAVEL_BASE_DIR="${BITNAMI_ROOT_DIR}/laravel" - -# Laravel configuration -export LARAVEL_PORT_NUMBER="${LARAVEL_PORT_NUMBER:-8000}" -LARAVEL_SKIP_COMPOSER_UPDATE="${LARAVEL_SKIP_COMPOSER_UPDATE:-"${SKIP_COMPOSER_UPDATE:-}"}" -export LARAVEL_SKIP_COMPOSER_UPDATE="${LARAVEL_SKIP_COMPOSER_UPDATE:-no}" -export LARAVEL_SKIP_DATABASE="${LARAVEL_SKIP_DATABASE:-no}" # only used during the first initialization - -# Database configuration -LARAVEL_DATABASE_TYPE="${LARAVEL_DATABASE_TYPE:-"${DB_CONNECTION:-}"}" -export LARAVEL_DATABASE_TYPE="${LARAVEL_DATABASE_TYPE:-mysql}" -export DB_CONNECTION="$LARAVEL_DATABASE_TYPE" # only used during the first initialization -LARAVEL_DATABASE_HOST="${LARAVEL_DATABASE_HOST:-"${DB_HOST:-}"}" -export LARAVEL_DATABASE_HOST="${LARAVEL_DATABASE_HOST:-mariadb}" -export DB_HOST="$LARAVEL_DATABASE_HOST" # only used during the first initialization -LARAVEL_DATABASE_PORT_NUMBER="${LARAVEL_DATABASE_PORT_NUMBER:-"${DB_PORT:-}"}" -export LARAVEL_DATABASE_PORT_NUMBER="${LARAVEL_DATABASE_PORT_NUMBER:-3306}" -export DB_PORT="$LARAVEL_DATABASE_PORT_NUMBER" # only used during the first initialization -LARAVEL_DATABASE_NAME="${LARAVEL_DATABASE_NAME:-"${DB_DATABASE:-}"}" -export LARAVEL_DATABASE_NAME="${LARAVEL_DATABASE_NAME:-bitnami_myapp}" -export DB_DATABASE="$LARAVEL_DATABASE_NAME" # only used during the first initialization -LARAVEL_DATABASE_USER="${LARAVEL_DATABASE_USER:-"${DB_USERNAME:-}"}" -export LARAVEL_DATABASE_USER="${LARAVEL_DATABASE_USER:-bn_myapp}" -export DB_USERNAME="$LARAVEL_DATABASE_USER" # only used during the first initialization -LARAVEL_DATABASE_PASSWORD="${LARAVEL_DATABASE_PASSWORD:-"${DB_PASSWORD:-}"}" -export LARAVEL_DATABASE_PASSWORD="${LARAVEL_DATABASE_PASSWORD:-}" -export DB_PASSWORD="$LARAVEL_DATABASE_PASSWORD" # only used during the first initialization - -# Custom environment variables may be defined below diff --git a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/entrypoint.sh b/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/entrypoint.sh deleted file mode 100755 index c67a64e6c626d..0000000000000 --- a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/entrypoint.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Load Laravel environment -. /opt/bitnami/scripts/laravel-env.sh - -print_welcome_page - -if [[ "$*" = *"/opt/bitnami/scripts/laravel/run.sh"* ]]; then - info "** Running Laravel setup **" - /opt/bitnami/scripts/php/setup.sh - /opt/bitnami/scripts/laravel/setup.sh - /post-init.sh - info "** Laravel setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/postunpack.sh b/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/postunpack.sh deleted file mode 100755 index 967777f3dce62..0000000000000 --- a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/postunpack.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblaravel.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh - -# Load Laravel environment -. /opt/bitnami/scripts/laravel-env.sh - -# Ensure required directories exist -ensure_dir_exists "/app" -configure_permissions_ownership "/app" -d "775" -f "664" diff --git a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/run.sh b/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/run.sh deleted file mode 100755 index 5e92d22b005e5..0000000000000 --- a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/run.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblaravel.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libservice.sh - -# Load Laravel environment -. /opt/bitnami/scripts/laravel-env.sh - -cd /app - -declare -a start_flags=("artisan" "serve" "--host=0.0.0.0" "--port=${LARAVEL_PORT_NUMBER}") -start_flags+=("$@") - -info "** Starting Laravel project **" -php "${start_flags[@]}" diff --git a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/setup.sh b/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/setup.sh deleted file mode 100755 index ada0e164ae043..0000000000000 --- a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/laravel/setup.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblaravel.sh - -# Load Laravel environment -. /opt/bitnami/scripts/laravel-env.sh - -# Ensure Laravel environment variables are valid -laravel_validate - -# Ensure Laravel app is initialized -laravel_initialize - -# Ensure all folders in /app are writable by the non-root "bitnami" user -chown -R bitnami:bitnami /app diff --git a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/liblaravel.sh b/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/liblaravel.sh deleted file mode 100644 index c52aef3bd1857..0000000000000 --- a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/liblaravel.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Laravel library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libvalidations.sh - -######################## -# Validate settings in LARAVEL_* env vars -# Globals: -# LARAVEL_* -# Arguments: -# None -# Returns: -# None -######################### -laravel_validate() { - info "Validating settings in LARAVEL_* environment variables..." - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_empty_value() { - if is_empty_value "${!1}"; then - print_validation_error "${1} must be set" - fi - } - check_yes_no_value() { - if ! is_yes_no_value "${!1}" && ! is_true_false_value "${!1}"; then - print_validation_error "The allowed values for ${1} are: yes no" - fi - } - check_resolved_hostname() { - if ! is_hostname_resolved "$1"; then - warn "Hostname ${1} could not be resolved, this could lead to connection issues" - fi - } - check_valid_port() { - local port_var="${1:?missing port variable}" - local err - if ! err="$(validate_port "${!port_var}")"; then - print_validation_error "An invalid port was specified in the environment variable ${port_var}: ${err}." - fi - } - - # Validate user inputs - check_yes_no_value "LARAVEL_SKIP_COMPOSER_UPDATE" - check_yes_no_value "LARAVEL_SKIP_DATABASE" - - # Database configuration validations - check_resolved_hostname "$LARAVEL_DATABASE_HOST" - check_valid_port "LARAVEL_DATABASE_PORT_NUMBER" - - return "$error_code" -} - -######################## -# Ensure the Laravel app is initialized -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -laravel_initialize() { - if is_dir_empty "/app"; then - info "Creating Laravel application in /app" - cp -r "${LARAVEL_BASE_DIR}/." . - - info "Regenerating APP_KEY" - debug_execute php artisan key:generate --ansi - - if ! is_boolean_yes "$LARAVEL_SKIP_COMPOSER_UPDATE"; then - log "Updating dependencies" - debug_execute composer update - fi - - info "Trying to connect to the database server" - if ! retry_while "debug_execute wait-for-port --timeout 5 --host ${LARAVEL_DATABASE_HOST} ${LARAVEL_DATABASE_PORT_NUMBER}"; then - error "Could not connect to the database" - return 1 - fi - - info "Executing database migrations" - debug_execute php artisan migrate - else - info "An existing project was detected, skipping project creation" - fi - - # Avoid exit code of previous commands to affect the result of this function - true -} diff --git a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/libphp.sh b/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/libphp.sh deleted file mode 100644 index 838cd2b4289fa..0000000000000 --- a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/libphp.sh +++ /dev/null @@ -1,265 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami PHP library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libwebserver.sh - -######################## -# Add or modify an entry in the main PHP configuration file (php.ini) -# Globals: -# PHP_CONF_FILE -# Arguments: -# $1 - Key -# $2 - Value -# $3 - File to modify (default: $PHP_CONF_FILE) -# Returns: -# None -######################### -php_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - local -r file="${3:-"$PHP_CONF_FILE"}" - local pattern="^[; ]*${key}\s*=.*$" - if [[ "$key" = "extension" || "$key" = "zend_extension" ]]; then - # The "extension" property works a bit different for PHP, as there is one per module to be included, meaning it is additive unlike other configurations - # Because of that, we first check if the extension was defined in the file to replace the proper entry - pattern="^[; ]*${key}\s*=\s*[\"]?${value}(\.so)?[\"]?\s*$" - fi - local -r entry="${key} = ${value}" - if is_file_writable "$file"; then - # Not using the ini-file tool since it does not play well with php.ini - if grep -q -E "$pattern" "$file"; then - replace_in_file "$file" "$pattern" "$entry" - else - cat >> "$file" <<< "$entry" - fi - else - warn "The PHP configuration file '${file}' is not writable. The '${key}' option will not be configured." - fi -} - -######################## -# Ensure PHP is initialized -# Globals: -# PHP_* -# Arguments: -# None -# Returns: -# None -######################### -php_initialize() { - # Configure PHP options based on the runtime environment - info "Configuring PHP options" - if ! is_dir_empty "$PHP_DEFAULT_CONF_DIR"; then - # Copy default configuration to php configuration directory - cp -nr "$PHP_DEFAULT_CONF_DIR"/. "$PHP_CONF_DIR" - fi - php_set_runtime_config "$PHP_CONF_FILE" - - - # PHP-FPM configuration - ! is_empty_value "$PHP_FPM_LISTEN_ADDRESS" && info "Setting PHP-FPM listen option" && php_conf_set "listen" "$PHP_FPM_LISTEN_ADDRESS" "${PHP_CONF_DIR}/php-fpm.d/www.conf" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Set PHP runtime options, based on user-provided environment variables -# Globals: -# PHP_* -# Arguments: -# None -# Returns: -# None -######################### -php_set_runtime_config() { - local -r conf_file="${1:?missing conf file}" - - ! is_empty_value "$PHP_DATE_TIMEZONE" && info "Setting PHP date.timezone option" && php_conf_set date.timezone "$PHP_DATE_TIMEZONE" "$conf_file" - ! is_empty_value "$PHP_ENABLE_OPCACHE" && info "Setting PHP opcache.enable option" && php_conf_set opcache.enable "$PHP_ENABLE_OPCACHE" "$conf_file" - ! is_empty_value "$PHP_EXPOSE_PHP" && info "Setting PHP expose_php option" && php_conf_set expose_php "$PHP_EXPOSE_PHP" "$conf_file" - ! is_empty_value "$PHP_MAX_EXECUTION_TIME" && info "Setting PHP max_execution_time option" && php_conf_set max_execution_time "$PHP_MAX_EXECUTION_TIME" "$conf_file" - ! is_empty_value "$PHP_MAX_INPUT_TIME" && info "Setting PHP max_input_time option" && php_conf_set max_input_time "$PHP_MAX_INPUT_TIME" "$conf_file" - ! is_empty_value "$PHP_MAX_INPUT_VARS" && info "Setting PHP max_input_vars option" && php_conf_set max_input_vars "$PHP_MAX_INPUT_VARS" "$conf_file" - ! is_empty_value "$PHP_MEMORY_LIMIT" && info "Setting PHP memory_limit option" && php_conf_set memory_limit "$PHP_MEMORY_LIMIT" "$conf_file" - ! is_empty_value "$PHP_POST_MAX_SIZE" && info "Setting PHP post_max_size option" && php_conf_set post_max_size "$PHP_POST_MAX_SIZE" "$conf_file" - ! is_empty_value "$PHP_UPLOAD_MAX_FILESIZE" && info "Setting PHP upload_max_filesize option" && php_conf_set upload_max_filesize "$PHP_UPLOAD_MAX_FILESIZE" "$conf_file" - ! is_empty_value "$PHP_OUTPUT_BUFFERING" && info "Setting PHP output_buffering option" && php_conf_set output_buffering "$PHP_OUTPUT_BUFFERING" "$conf_file" - - true -} - -######################## -# Convert a yes/no value to a PHP boolean -# Globals: -# None -# Arguments: -# $1 - yes/no value -# Returns: -# None -######################### -php_convert_to_boolean() { - local -r value="${1:?missing value}" - is_boolean_yes "$value" && echo "true" || echo "false" -} - -######################## -# Execute/run PHP code and print to stdout -# Globals: -# None -# Stdin: -# Code to execute -# Arguments: -# $1..$n - Input arguments to script -# Returns: -# None -######################### -php_execute_print_output() { - local php_cmd - # Obtain the command specified via stdin - php_cmd="$(/dev/null 2>&1 & - if ! retry_while "is_php_fpm_running"; then - error "php-fpm did not start" - error_code=1 - else - info "php-fpm started" - fi -else - info "php-fpm is already running" -fi - -exit "$error_code" diff --git a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/status.sh b/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/status.sh deleted file mode 100755 index 2ca4fb384d050..0000000000000 --- a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/status.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libphp.sh -. /opt/bitnami/scripts/liblog.sh - -# Load PHP-FPM environment variables -. /opt/bitnami/scripts/php-env.sh - -if is_php_fpm_running; then - info "php-fpm is already running" -else - info "php-fpm is not running" -fi diff --git a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/stop.sh b/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/stop.sh deleted file mode 100755 index 74274a4b4ee30..0000000000000 --- a/bitnami/laravel/10/debian-12/rootfs/opt/bitnami/scripts/php/stop.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libphp.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh - -# Load PHP-FPM environment variables -. /opt/bitnami/scripts/php-env.sh - -error_code=0 - -if is_php_fpm_running; then - BITNAMI_QUIET=1 php_fpm_stop - if ! retry_while "is_php_fpm_not_running"; then - error "php-fpm could not be stopped" - error_code=1 - else - info "php-fpm stopped" - fi -else - info "php-fpm is not running" -fi - -exit "$error_code" diff --git a/bitnami/laravel/10/debian-12/rootfs/post-init.d/php.sh b/bitnami/laravel/10/debian-12/rootfs/post-init.d/php.sh deleted file mode 100755 index 6be2585cbc533..0000000000000 --- a/bitnami/laravel/10/debian-12/rootfs/post-init.d/php.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Executes custom PHP init scripts - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries with logging functions -if [[ -f /opt/bitnami/base/functions ]]; then - . /opt/bitnami/base/functions -else - . /opt/bitnami/scripts/liblog.sh -fi - -# Loop through all input files passed via stdin -read -r -a custom_init_scripts <<< "$@" -failure=0 -if [[ "${#custom_init_scripts[@]}" -gt 0 ]]; then - for custom_init_script in "${custom_init_scripts[@]}"; do - [[ "$custom_init_script" != *".php" ]] && continue - info "Executing ${custom_init_script} with PHP interpreter" - php "$custom_init_script" || failure=1 - [[ "$failure" -ne 0 ]] && error "Failed to execute ${custom_init_script}" - done -fi - -exit "$failure" diff --git a/bitnami/laravel/10/debian-12/rootfs/post-init.d/shell.sh b/bitnami/laravel/10/debian-12/rootfs/post-init.d/shell.sh deleted file mode 100755 index 75a202d6ecc51..0000000000000 --- a/bitnami/laravel/10/debian-12/rootfs/post-init.d/shell.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Executes custom Bash init scripts - -# shellcheck disable=SC1090,SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries with logging functions -if [[ -f /opt/bitnami/base/functions ]]; then - . /opt/bitnami/base/functions -else - . /opt/bitnami/scripts/liblog.sh -fi - -# Loop through all input files passed via stdin -read -r -a custom_init_scripts <<< "$@" -failure=0 -if [[ "${#custom_init_scripts[@]}" -gt 0 ]]; then - for custom_init_script in "${custom_init_scripts[@]}"; do - [[ "$custom_init_script" != *".sh" ]] && continue - if [[ -x "$custom_init_script" ]]; then - info "Executing ${custom_init_script}" - "$custom_init_script" || failure="1" - else - info "Sourcing ${custom_init_script} as it is not executable by the current user, any error may cause initialization to fail" - . "$custom_init_script" - fi - [[ "$failure" -ne 0 ]] && error "Failed to execute ${custom_init_script}" - done -fi - -exit "$failure" diff --git a/bitnami/laravel/10/debian-12/rootfs/post-init.sh b/bitnami/laravel/10/debian-12/rootfs/post-init.sh deleted file mode 100755 index 3c175be84663e..0000000000000 --- a/bitnami/laravel/10/debian-12/rootfs/post-init.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Only execute init scripts once -if [[ ! -f "/bitnami/laravel/.user_scripts_initialized" && -d "/docker-entrypoint-init.d" ]]; then - read -r -a init_scripts <<< "$(find "/docker-entrypoint-init.d" -type f -print0 | sort -z | xargs -0)" - if [[ "${#init_scripts[@]}" -gt 0 ]] && [[ ! -f "/bitnami/laravel/.user_scripts_initialized" ]]; then - mkdir -p "/bitnami/laravel" - for init_script in "${init_scripts[@]}"; do - for init_script_type_handler in /post-init.d/*.sh; do - "$init_script_type_handler" "$init_script" - done - done - fi - - touch "/bitnami/laravel/.user_scripts_initialized" -fi diff --git a/bitnami/laravel/10/debian-12/tags-info.yaml b/bitnami/laravel/10/debian-12/tags-info.yaml deleted file mode 100644 index 5afeffad1d917..0000000000000 --- a/bitnami/laravel/10/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "10" -- 10-debian-12 -- 10.3.3 diff --git a/bitnami/logstash/7/README.md b/bitnami/logstash/7/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/logstash/7/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/logstash/7/debian-12/Dockerfile b/bitnami/logstash/7/debian-12/Dockerfile deleted file mode 100644 index fbf6c9e34cc49..0000000000000 --- a/bitnami/logstash/7/debian-12/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG JAVA_EXTRA_SECURITY_DIR="/bitnami/java/extra-security" -ARG LOGSTASH_PLUGINS -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T14:57:56Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/logstash/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="7.17.26-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/logstash" \ - org.opencontainers.image.title="logstash" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="7.17.26" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "yq-4.44.5-0-linux-${OS_ARCH}-debian-12" \ - "java-17.0.13-12-1-linux-${OS_ARCH}-debian-12" \ - "logstash-7.17.26-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true - -COPY rootfs / -RUN /opt/bitnami/scripts/java/postunpack.sh -RUN /opt/bitnami/scripts/logstash/postunpack.sh -ENV APP_VERSION="7.17.26" \ - BITNAMI_APP_NAME="logstash" \ - JAVA_HOME="/opt/bitnami/java" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/java/bin:/opt/bitnami/logstash/bin:$PATH" - -EXPOSE 8080 - -WORKDIR /opt/bitnami/logstash -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/logstash/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/logstash/run.sh" ] diff --git a/bitnami/logstash/7/debian-12/docker-compose-testing.yml b/bitnami/logstash/7/debian-12/docker-compose-testing.yml deleted file mode 100644 index 18ac1fd419a7d..0000000000000 --- a/bitnami/logstash/7/debian-12/docker-compose-testing.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - logstash: - image: docker.io/bitnami/logstash:7 - ports: - - 8080:8080 - environment: - - LOGSTASH_CONF_STRING=input {http { port => 8080 }} output {file {path => "/tmp/logstash_output"}} - volumes: - - logstash_data:/bitnami/logstash -volumes: - logstash_data: - driver: local diff --git a/bitnami/logstash/7/debian-12/docker-compose.yml b/bitnami/logstash/7/debian-12/docker-compose.yml deleted file mode 100644 index 468e19cf037e4..0000000000000 --- a/bitnami/logstash/7/debian-12/docker-compose.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - logstash: - image: docker.io/bitnami/logstash:7 - ports: - - 8080:8080 - volumes: - - logstash_data:/bitnami -volumes: - logstash_data: - driver: local diff --git a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index ac9a8ac2f50d8..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "java": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "17.0.13-12-1" - }, - "logstash": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "7.17.26-0" - }, - "yq": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "4.44.5-0" - } -} \ No newline at end of file diff --git a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/logstash/7/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/logstash/7/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/logstash/7/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/logstash/7/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/logstash/7/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh b/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh deleted file mode 100755 index 38802fc0bfe91..0000000000000 --- a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/java/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh - -if [[ "$OS_FLAVOUR" =~ photon && "$APP_VERSION" =~ ^1.8 ]]; then - # Option --module-path is not supported by JAVA 1.8 since modules were added in version 1.9 - unset JAVA_TOOL_OPTIONS -fi - -print_welcome_page - -echo "" -exec "$@" diff --git a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh b/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh deleted file mode 100755 index c15af32e2f773..0000000000000 --- a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/java/postunpack.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh - -# -# Java post-unpack operations -# - -# Override default files in the Java security directory. This is used for -# custom base images (with custom CA certificates or block lists is used) - -if [[ -n "${JAVA_EXTRA_SECURITY_DIR:-}" ]] && ! is_dir_empty "$JAVA_EXTRA_SECURITY_DIR"; then - info "Adding custom CAs to the Java security folder" - cp -Lr "${JAVA_EXTRA_SECURITY_DIR}/." /opt/bitnami/java/lib/security -fi diff --git a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/liblogstash.sh b/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/liblogstash.sh deleted file mode 100644 index 3de8af7114a4e..0000000000000 --- a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/liblogstash.sh +++ /dev/null @@ -1,379 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami Logstash library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libservice.sh - -######################## -# Validate settings in Logstash environment variables -# Globals: -# LOGSTASH_* -# Arguments: -# None -# Returns: -# None -######################### -logstash_validate() { - debug "Validating settings in LOGSTASH_* environment variables" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - check_yes_no_value() { - if ! is_yes_no_value "${!1}" && ! is_true_false_value "${!1}"; then - print_validation_error "The allowed values for ${1} are: yes no" - fi - } - check_resolved_hostname() { - if ! is_hostname_resolved "$1"; then - warn "Hostname ${1} could not be resolved, this could lead to connection issues" - fi - } - check_valid_port() { - local port_var="${1:?missing port variable}" - local err - if ! err="$(validate_port "${!port_var}")"; then - print_validation_error "An invalid port was specified in the environment variable ${port_var}: ${err}." - fi - } - - check_resolved_hostname "$LOGSTASH_BIND_ADDRESS" - check_yes_no_value "LOGSTASH_EXPOSE_API" - check_valid_port "LOGSTASH_API_PORT_NUMBER" - check_yes_no_value "LOGSTASH_ENABLE_MULTIPLE_PIPELINES" - - # Pipeline configuration parameters - # Inputs - check_yes_no_value "LOGSTASH_ENABLE_BEATS_INPUT" - is_boolean_yes "$LOGSTASH_ENABLE_BEATS_INPUT" && check_valid_port "LOGSTASH_BEATS_PORT_NUMBER" - check_yes_no_value "LOGSTASH_ENABLE_GELF_INPUT" - is_boolean_yes "$LOGSTASH_ENABLE_GELF_INPUT" && check_valid_port "LOGSTASH_GELF_PORT_NUMBER" - check_yes_no_value "LOGSTASH_ENABLE_HTTP_INPUT" - is_boolean_yes "$LOGSTASH_ENABLE_HTTP_INPUT" && check_valid_port "LOGSTASH_HTTP_PORT_NUMBER" - check_yes_no_value "LOGSTASH_ENABLE_TCP_INPUT" - is_boolean_yes "$LOGSTASH_ENABLE_TCP_INPUT" && check_valid_port "LOGSTASH_TCP_PORT_NUMBER" - check_yes_no_value "LOGSTASH_ENABLE_UDP_INPUT" - is_boolean_yes "$LOGSTASH_ENABLE_UDP_INPUT" && check_valid_port "LOGSTASH_UDP_PORT_NUMBER" - # Outputs - check_yes_no_value "LOGSTASH_ENABLE_STDOUT_OUTPUT" - check_yes_no_value "LOGSTASH_ENABLE_ELASTICSEARCH_OUTPUT" - if is_boolean_yes "$LOGSTASH_ENABLE_ELASTICSEARCH_OUTPUT"; then - check_resolved_hostname "$LOGSTASH_ELASTICSEARCH_HOST" - check_valid_port "LOGSTASH_ELASTICSEARCH_PORT_NUMBER" - fi - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Create sample config file -# Globals: -# LOGSTASH_* -# Arguments: -# None -# Returns: -# None -######################### -logstash_create_sample_pipeline_config_file() { - # Default supported inputs/outputs come from historic Bitnami defaults - # Configuration reference: https://www.elastic.co/guide/en/logstash/current/config-examples.html - info "Creating sample config file" - local inputs="" - local outputs="" - # Parse inputs - if is_boolean_yes "$LOGSTASH_ENABLE_BEATS_INPUT"; then - inputs+=$'\n'"beats { - ssl => false - host => \"${LOGSTASH_BIND_ADDRESS}\" - port => ${LOGSTASH_BEATS_PORT_NUMBER} -}" - fi - if is_boolean_yes "$LOGSTASH_ENABLE_GELF_INPUT"; then - inputs+=$'\n'"gelf { - host => \"${LOGSTASH_BIND_ADDRESS}\" - port => ${LOGSTASH_GELF_PORT_NUMBER} -}" - fi - if is_boolean_yes "$LOGSTASH_ENABLE_HTTP_INPUT"; then - inputs+=$'\n'"http { - ssl => false - host => \"${LOGSTASH_BIND_ADDRESS}\" - port => ${LOGSTASH_HTTP_PORT_NUMBER} -}" - fi - if is_boolean_yes "$LOGSTASH_ENABLE_TCP_INPUT"; then - inputs+=$'\n'"tcp { - mode => \"server\" - host => \"${LOGSTASH_BIND_ADDRESS}\" - port => ${LOGSTASH_TCP_PORT_NUMBER} -}" - fi - if is_boolean_yes "$LOGSTASH_ENABLE_UDP_INPUT"; then - inputs+=$'\n'"udp { - host => \"${LOGSTASH_BIND_ADDRESS}\" - port => ${LOGSTASH_UDP_PORT_NUMBER} -}" - fi - # Parse outputs - is_boolean_yes "$LOGSTASH_ENABLE_STDOUT_OUTPUT" && outputs+=$'\n'"stdout { }" - if is_boolean_yes "$LOGSTASH_ENABLE_ELASTICSEARCH_OUTPUT"; then - outputs+=$'\n'"elasticsearch { - hosts => [\"${LOGSTASH_ELASTICSEARCH_HOST}:${LOGSTASH_ELASTICSEARCH_PORT_NUMBER}\"] - document_id => \"%{logstash_checksum}\" - index => \"logstash-%{+YYYY.MM.dd}\" -}" - fi - # Indent and add newline so it looks good - [[ -n "$inputs" ]] && inputs="$(indent "$inputs" 2)"$'\n' - [[ -n "$outputs" ]] && outputs="$(indent "$outputs" 2)"$'\n' - # Create the configuration file - cat >"$LOGSTASH_PIPELINE_CONF_FILE" <"$tempfile" - ;; - int) - yq eval "(.${key}) |= ${value}" "$conf_file" >"$tempfile" - ;; - bool) - yq eval "(.${key}) |= (\"${value}\" | test(\"true\"))" "$conf_file" >"$tempfile" - ;; - *) - error "Type unknown: ${type}" - return 1 - ;; - esac - cp "$tempfile" "$conf_file" -} - -######################## -# Ensure Logstash is initialized -# Globals: -# LOGSTASH_* -# Arguments: -# None -# Returns: -# None -######################### -logstash_initialize() { - info "Initializing Logstash" - - logstash_set_heap_size - - # Based on naming from https://www.elastic.co/guide/en/logstash/current/config-setting-files.html - if ! is_mounted_dir_empty "$LOGSTASH_MOUNTED_CONF_DIR"; then - info "Mounted setting files detected" - cp -Lr "$LOGSTASH_MOUNTED_CONF_DIR"/. "$LOGSTASH_CONF_DIR" - fi - - if is_boolean_yes "$LOGSTASH_EXPOSE_API"; then - if is_file_writable "$LOGSTASH_CONF_FILE"; then - info "Enabling Logstash API endpoint" - logstash_yml_set "$LOGSTASH_CONF_FILE" '"api.http.host"' "$LOGSTASH_BIND_ADDRESS" - logstash_yml_set "$LOGSTASH_CONF_FILE" '"api.http.port"' "$LOGSTASH_API_PORT_NUMBER" - else - warn "The Logstash configuration file '${LOGSTASH_CONF_FILE}' is not writable. Configurations based on environment variables will be passed as command-line arguments instead." - fi - fi - - if is_boolean_yes "$LOGSTASH_ENABLE_MULTIPLE_PIPELINES"; then - if [[ -e "${LOGSTASH_MOUNTED_CONF_DIR}/pipelines.yml" ]]; then - info "Detected mounted 'pipelines.yml' configuration file for multiple pipelines" - else - logstash_create_sample_pipelines_yml_file - fi - fi - - # Skip further configuration if Logstash pipeline configuration was passed as a string - [[ -n "$LOGSTASH_PIPELINE_CONF_STRING" ]] && return - - if ! is_mounted_dir_empty "$LOGSTASH_MOUNTED_PIPELINE_CONF_DIR"; then - info "Detected mounted pipeline configuration files" - cp -Lr "$LOGSTASH_MOUNTED_PIPELINE_CONF_DIR"/* "$LOGSTASH_PIPELINE_CONF_DIR" - elif [[ -e "${LOGSTASH_MOUNTED_CONF_DIR}/${LOGSTASH_PIPELINE_CONF_FILENAME}" ]]; then - # Support for legacy configuration before configurations were separated into 'config' and 'pipeline' - warn "Detected mounted '${LOGSTASH_MOUNTED_CONF_DIR}/${LOGSTASH_PIPELINE_CONF_FILENAME}' pipeline configuration file in legacy directory." - warn "Support for this configuration may be deprecated in a future version of this image. Please mount the pipeline files to '${LOGSTASH_MOUNTED_PIPELINE_CONF_DIR}' instead." - cp -Lr "${LOGSTASH_MOUNTED_CONF_DIR}/${LOGSTASH_PIPELINE_CONF_FILENAME}" "$LOGSTASH_PIPELINE_CONF_DIR" - elif is_dir_empty "$LOGSTASH_PIPELINE_CONF_DIR"; then - logstash_create_sample_pipeline_config_file - else - info "Detected existing files in '${LOGSTASH_PIPELINE_CONF_DIR}', skipping sample pipeline generation" - fi -} - -######################## -# Check if Logstash is running -# Globals: -# LOGSTASH_PID_FILE -# Arguments: -# None -# Returns: -# Boolean -######################### -is_logstash_running() { - # Logstash does not create any PID file - # We regenerate the PID file for each time we query it to avoid getting outdated - pgrep -f "org.logstash.Logstash" >"$LOGSTASH_PID_FILE" - - local pid - pid="$(get_pid_from_file "$LOGSTASH_PID_FILE")" - if [[ -n "$pid" ]]; then - is_service_running "$pid" - else - false - fi -} - -######################## -# Check if Logstash is not running -# Globals: -# LOGSTASH_PID_FILE -# Arguments: -# None -# Returns: -# Boolean -######################### -is_logstash_not_running() { - ! is_logstash_running - return "$?" -} - -######################## -# Stop Logstash -# Globals: -# LOGSTASH_PID_FILE -# Arguments: -# None -# Returns: -# None -######################### -logstash_stop() { - ! is_logstash_running && return - debug "Stopping Logstash" - stop_service_using_pid "$LOGSTASH_PID_FILE" -} - -######################## -# Install Logstash plugins -# Globals: -# LOGSTASH_* -# Arguments: -# None -# Returns: -# None -######################### -logstash_install_plugins() { - read -r -a plugins_list <<<"$(tr ',;' ' ' <<<"$LOGSTASH_PLUGINS")" - - # Skip if there isn't any plugin to install - [[ -z "${plugins_list[*]:-}" ]] && return - - # Install plugins - info "Installing plugins: ${plugins_list[*]}" - for plugin in "${plugins_list[@]}"; do - debug "Installing plugin: ${plugin}" - if [[ "${BITNAMI_DEBUG:-false}" = true ]]; then - logstash-plugin install "$plugin" - else - logstash-plugin install "$plugin" >/dev/null 2>&1 - fi - done -} diff --git a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash-env.sh b/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash-env.sh deleted file mode 100644 index e058c33e5ff6c..0000000000000 --- a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash-env.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for logstash - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-logstash}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -logstash_env_vars=( - LOGSTASH_PIPELINE_CONF_FILENAME - LOGSTASH_BIND_ADDRESS - LOGSTASH_EXPOSE_API - LOGSTASH_API_PORT_NUMBER - LOGSTASH_PIPELINE_CONF_STRING - LOGSTASH_PLUGINS - LOGSTASH_EXTRA_FLAGS - LOGSTASH_HEAP_SIZE - LOGSTASH_MAX_ALLOWED_MEMORY_PERCENTAGE - LOGSTASH_MAX_ALLOWED_MEMORY - LOGSTASH_ENABLE_MULTIPLE_PIPELINES - LOGSTASH_ENABLE_BEATS_INPUT - LOGSTASH_BEATS_PORT_NUMBER - LOGSTASH_ENABLE_GELF_INPUT - LOGSTASH_GELF_PORT_NUMBER - LOGSTASH_ENABLE_HTTP_INPUT - LOGSTASH_HTTP_PORT_NUMBER - LOGSTASH_ENABLE_TCP_INPUT - LOGSTASH_TCP_PORT_NUMBER - LOGSTASH_ENABLE_UDP_INPUT - LOGSTASH_UDP_PORT_NUMBER - LOGSTASH_ENABLE_STDOUT_OUTPUT - LOGSTASH_ENABLE_ELASTICSEARCH_OUTPUT - LOGSTASH_ELASTICSEARCH_HOST - LOGSTASH_ELASTICSEARCH_PORT_NUMBER - LOGSTASH_CONF_FILENAME - LOGSTASH_CONF_STRING - LOGSTASH_EXTRA_ARGS -) -for env_var in "${logstash_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset logstash_env_vars - -# Paths -export LOGSTASH_BASE_DIR="/opt/bitnami/logstash" -export LOGSTASH_CONF_DIR="${LOGSTASH_BASE_DIR}/config" -export LOGSTASH_DEFAULT_CONF_DIR="${LOGSTASH_BASE_DIR}/config.default" -export LOGSTASH_PIPELINE_CONF_DIR="${LOGSTASH_BASE_DIR}/pipeline" -export LOGSTASH_DEFAULT_PIPELINE_CONF_DIR="${LOGSTASH_BASE_DIR}/pipeline.default" -export LOGSTASH_BIN_DIR="${LOGSTASH_BASE_DIR}/bin" -export LOGSTASH_CONF_FILE="${LOGSTASH_CONF_DIR}/logstash.yml" -LOGSTASH_PIPELINE_CONF_FILENAME="${LOGSTASH_PIPELINE_CONF_FILENAME:-"${LOGSTASH_CONF_FILENAME:-}"}" -export LOGSTASH_PIPELINE_CONF_FILENAME="${LOGSTASH_PIPELINE_CONF_FILENAME:-logstash.conf}" -export LOGSTASH_PIPELINE_CONF_FILE="${LOGSTASH_PIPELINE_CONF_DIR}/${LOGSTASH_PIPELINE_CONF_FILENAME}" -export LOGSTASH_VOLUME_DIR="/bitnami/logstash" -export LOGSTASH_DATA_DIR="${LOGSTASH_VOLUME_DIR}/data" -export LOGSTASH_MOUNTED_CONF_DIR="${LOGSTASH_VOLUME_DIR}/config" -export LOGSTASH_MOUNTED_PIPELINE_CONF_DIR="${LOGSTASH_VOLUME_DIR}/pipeline" - -# System users (when running with a privileged user) -export LOGSTASH_DAEMON_USER="logstash" -export LOGSTASH_DAEMON_GROUP="logstash" - -# Logstash configuration -export LOGSTASH_BIND_ADDRESS="${LOGSTASH_BIND_ADDRESS:-0.0.0.0}" -export LOGSTASH_EXPOSE_API="${LOGSTASH_EXPOSE_API:-no}" -export LOGSTASH_API_PORT_NUMBER="${LOGSTASH_API_PORT_NUMBER:-9600}" -LOGSTASH_PIPELINE_CONF_STRING="${LOGSTASH_PIPELINE_CONF_STRING:-"${LOGSTASH_CONF_STRING:-}"}" -export LOGSTASH_PIPELINE_CONF_STRING="${LOGSTASH_PIPELINE_CONF_STRING:-}" -export LOGSTASH_PLUGINS="${LOGSTASH_PLUGINS:-}" -LOGSTASH_EXTRA_FLAGS="${LOGSTASH_EXTRA_FLAGS:-"${LOGSTASH_EXTRA_ARGS:-}"}" -export LOGSTASH_EXTRA_FLAGS="${LOGSTASH_EXTRA_FLAGS:-}" -export LOGSTASH_HEAP_SIZE="${LOGSTASH_HEAP_SIZE:-1024m}" -export LOGSTASH_MAX_ALLOWED_MEMORY_PERCENTAGE="${LOGSTASH_MAX_ALLOWED_MEMORY_PERCENTAGE:-100}" -export LOGSTASH_MAX_ALLOWED_MEMORY="${LOGSTASH_MAX_ALLOWED_MEMORY:-}" - -# Logstash pipeline configuration -export LOGSTASH_ENABLE_MULTIPLE_PIPELINES="${LOGSTASH_ENABLE_MULTIPLE_PIPELINES:-no}" -export LOGSTASH_ENABLE_BEATS_INPUT="${LOGSTASH_ENABLE_BEATS_INPUT:-no}" -export LOGSTASH_BEATS_PORT_NUMBER="${LOGSTASH_BEATS_PORT_NUMBER:-5044}" -export LOGSTASH_ENABLE_GELF_INPUT="${LOGSTASH_ENABLE_GELF_INPUT:-no}" -export LOGSTASH_GELF_PORT_NUMBER="${LOGSTASH_GELF_PORT_NUMBER:-12201}" -export LOGSTASH_ENABLE_HTTP_INPUT="${LOGSTASH_ENABLE_HTTP_INPUT:-yes}" -export LOGSTASH_HTTP_PORT_NUMBER="${LOGSTASH_HTTP_PORT_NUMBER:-8080}" -export LOGSTASH_ENABLE_TCP_INPUT="${LOGSTASH_ENABLE_TCP_INPUT:-no}" -export LOGSTASH_TCP_PORT_NUMBER="${LOGSTASH_TCP_PORT_NUMBER:-5010}" -export LOGSTASH_ENABLE_UDP_INPUT="${LOGSTASH_ENABLE_UDP_INPUT:-no}" -export LOGSTASH_UDP_PORT_NUMBER="${LOGSTASH_UDP_PORT_NUMBER:-5000}" -export LOGSTASH_ENABLE_STDOUT_OUTPUT="${LOGSTASH_ENABLE_STDOUT_OUTPUT:-yes}" -export LOGSTASH_ENABLE_ELASTICSEARCH_OUTPUT="${LOGSTASH_ENABLE_ELASTICSEARCH_OUTPUT:-no}" -export LOGSTASH_ELASTICSEARCH_HOST="${LOGSTASH_ELASTICSEARCH_HOST:-elasticsearch}" -export LOGSTASH_ELASTICSEARCH_PORT_NUMBER="${LOGSTASH_ELASTICSEARCH_PORT_NUMBER:-9200}" - -# Default JVM configuration -export JAVA_HOME="${BITNAMI_ROOT_DIR}/java" - -# Other parameters -export PATH="${LOGSTASH_BIN_DIR}:${JAVA_HOME}/bin:${BITNAMI_ROOT_DIR}/common/bin:${PATH}" - -# Custom environment variables may be defined below diff --git a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/entrypoint.sh b/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/entrypoint.sh deleted file mode 100755 index ac255ac06fffd..0000000000000 --- a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/entrypoint.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -#set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/liblogstash.sh - -# Load Logstash environment variables -. /opt/bitnami/scripts/logstash-env.sh - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/logstash/config -# /opt/bitnami/logstash/pipeline) -if ! is_dir_empty "$LOGSTASH_DEFAULT_CONF_DIR"; then - debug "Copying files from $LOGSTASH_DEFAULT_CONF_DIR to $LOGSTASH_CONF_DIR" - cp -nr "$LOGSTASH_DEFAULT_CONF_DIR"/. "$LOGSTASH_CONF_DIR" -fi -if ! is_dir_empty "$LOGSTASH_DEFAULT_PIPELINE_CONF_DIR"; then - debug "Copying files from $LOGSTASH_DEFAULT_PIPELINE_CONF_DIR to $LOGSTASH_PIPELINE_CONF_DIR" - cp -nr "$LOGSTASH_DEFAULT_PIPELINE_CONF_DIR"/. "$LOGSTASH_PIPELINE_CONF_DIR" -fi - -if [[ "$*" = *"/opt/bitnami/scripts/logstash/run.sh"* ]]; then - info "** Starting Logstash setup **" - /opt/bitnami/scripts/logstash/setup.sh - info "** Logstash setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/postunpack.sh b/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/postunpack.sh deleted file mode 100755 index 7dc38e98b2a37..0000000000000 --- a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/postunpack.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblogstash.sh - -# Load Logstash environment variables -. /opt/bitnami/scripts/logstash-env.sh - -info "Creating Logstash daemon user" -ensure_user_exists "$LOGSTASH_DAEMON_USER" --group "$LOGSTASH_DAEMON_GROUP" - -for dir in "$LOGSTASH_BASE_DIR/vendor/bundle/jruby" "$LOGSTASH_CONF_DIR" "$LOGSTASH_PIPELINE_CONF_DIR" "$LOGSTASH_DEFAULT_CONF_DIR" "$LOGSTASH_DEFAULT_PIPELINE_CONF_DIR" "$LOGSTASH_MOUNTED_CONF_DIR" "$LOGSTASH_MOUNTED_PIPELINE_CONF_DIR" "$LOGSTASH_VOLUME_DIR" "$LOGSTASH_DATA_DIR"; do - ensure_dir_exists "$dir" - configure_permissions_ownership "$dir" -d "775" -f "664" -u "$LOGSTASH_DAEMON_USER" -g "root" -done - -for file in "$LOGSTASH_BASE_DIR/Gemfile" "$LOGSTASH_BASE_DIR/Gemfile.lock"; do - configure_permissions_ownership "$file" -f "664" -u "$LOGSTASH_DAEMON_USER" -g "root" -done - -info "Configuring paths" -logstash_yml_set "$LOGSTASH_CONF_FILE" '"path.data"' "$LOGSTASH_DATA_DIR" - -info "Configuring logging to standard output" -# Back up the original file for users who'd like to use logfile logging -cp -L "${LOGSTASH_CONF_DIR}/log4j2.properties" "${LOGSTASH_CONF_DIR}/log4j2.orig.properties" -cat > "${LOGSTASH_CONF_DIR}/log4j2.properties" << EOF -status = error -name = LogstashPropertiesConfig - -appender.console.type = Console -appender.console.name = plain_console -appender.console.layout.type = PatternLayout -appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c]%notEmpty{[%X{pipeline.id}]}%notEmpty{[%X{plugin.id}]} %m%n - -appender.json_console.type = Console -appender.json_console.name = json_console -appender.json_console.layout.type = JSONLayout -appender.json_console.layout.compact = true -appender.json_console.layout.eventEol = true - -rootLogger.level = \${sys:ls.log.level} -rootLogger.appenderRef.console.ref = \${sys:ls.log.format}_console -EOF - -logstash_install_plugins - -# As the gems directory depends on the jruby version, we need to create a symlink /opt/bitnami/logstash/gems -# so we can mount an emptydir in readOnlyRootFilesystem -ln -s /opt/bitnami/logstash/vendor/bundle/jruby/*/gems /opt/bitnami/logstash/gems - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -if ! is_dir_empty "$LOGSTASH_CONF_DIR"; then - cp -r "$LOGSTASH_CONF_DIR"/* "$LOGSTASH_DEFAULT_CONF_DIR" - chmod o+r -R "$LOGSTASH_DEFAULT_CONF_DIR" -fi -if ! is_dir_empty "$LOGSTASH_PIPELINE_CONF_DIR"; then - cp -r "$LOGSTASH_PIPELINE_CONF_DIR"/* "$LOGSTASH_DEFAULT_PIPELINE_CONF_DIR" - chmod o+r -R "$LOGSTASH_DEFAULT_PIPELINE_CONF_DIR" -fi \ No newline at end of file diff --git a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/run.sh b/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/run.sh deleted file mode 100755 index 01ab241e6e99b..0000000000000 --- a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/run.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/liblogstash.sh - -# Load Logstash environment variables -. /opt/bitnami/scripts/logstash-env.sh - -declare -a cmd=("logstash") - -if is_boolean_yes "$LOGSTASH_EXPOSE_API"; then - cmd+=("--api.http.host" "$LOGSTASH_BIND_ADDRESS" "--api.http.port" "$LOGSTASH_API_PORT_NUMBER") -fi - -if [[ -n "$LOGSTASH_PIPELINE_CONF_STRING" ]]; then - cmd+=("-e" "$LOGSTASH_PIPELINE_CONF_STRING") -elif ! is_boolean_yes "$LOGSTASH_ENABLE_MULTIPLE_PIPELINES"; then - cmd+=("-f" "$LOGSTASH_PIPELINE_CONF_DIR") -fi - -declare -a extra_args=() -read -r -a extra_args <<< "$LOGSTASH_EXTRA_FLAGS" -[[ "${#extra_args[@]}" -gt 0 ]] && cmd+=("${extra_args[@]}") - -# JAVA_HOME to be deprecated, see warning: -# warning: usage of JAVA_HOME is deprecated, use LS_JAVA_HOME -export LS_JAVA_HOME=/opt/bitnami/java - -info "** Starting Logstash **" -if am_i_root; then - exec_as_user "$LOGSTASH_DAEMON_USER" "${cmd[@]}" -else - exec "${cmd[@]}" -fi diff --git a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/setup.sh b/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/setup.sh deleted file mode 100755 index 0c86c3299aae9..0000000000000 --- a/bitnami/logstash/7/debian-12/rootfs/opt/bitnami/scripts/logstash/setup.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/liblogstash.sh - -# Load Logstash environment variables -. /opt/bitnami/scripts/logstash-env.sh - -# Ensure Logstash environment variables are valid -logstash_validate - -# Ensure 'daemon' user exists when running as 'root' -am_i_root && ensure_user_exists "$LOGSTASH_DAEMON_USER" --group "$LOGSTASH_DAEMON_GROUP" - -# Ensure Logstash is initialized -logstash_initialize -# Install Logstash plugins -logstash_install_plugins diff --git a/bitnami/logstash/7/debian-12/tags-info.yaml b/bitnami/logstash/7/debian-12/tags-info.yaml deleted file mode 100644 index ece0cc84d23ad..0000000000000 --- a/bitnami/logstash/7/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "7" -- 7-debian-12 -- 7.17.26 diff --git a/bitnami/mariadb-galera/10.11/README.md b/bitnami/mariadb-galera/10.11/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/mariadb-galera/10.11/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/mariadb-galera/10.11/debian-12/Dockerfile b/bitnami/mariadb-galera/10.11/debian-12/Dockerfile deleted file mode 100644 index 8c13c72b30e27..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T15:52:10Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="10.11.10-debian-12-r3" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera" \ - org.opencontainers.image.title="mariadb-galera" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="10.11.10" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl iproute2 ldap-utils libaio1 libaudit1 libcap-ng0 libcrypt1 libgcc-s1 libicu72 libldap-common liblzma5 libncurses6 libpam-ldapd libpam0g libssl3 libstdc++6 libtinfo6 libxml2 nslcd procps psmisc rsync socat zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "ini-file-1.4.7-7-linux-${OS_ARCH}-debian-12" \ - "mariadb-galera-10.11.10-2-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir /docker-entrypoint-initdb.d - -COPY rootfs / -RUN /opt/bitnami/scripts/mariadb-galera/postunpack.sh -ENV APP_VERSION="10.11.10" \ - BITNAMI_APP_NAME="mariadb-galera" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/common/sbin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:$PATH" - -EXPOSE 3306 4444 4567 4568 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/mariadb-galera/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/mariadb-galera/run.sh" ] diff --git a/bitnami/mariadb-galera/10.11/debian-12/docker-compose-ldap.yml b/bitnami/mariadb-galera/10.11/debian-12/docker-compose-ldap.yml deleted file mode 100644 index 4623510bee8bc..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/docker-compose-ldap.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-galera: - image: docker.io/bitnami/mariadb-galera:10.11 - ports: - - '3306:3306' - - '4444:4444' - - '4567:4567' - - '4568:4568' - volumes: - - 'mariadb_galera_data:/bitnami/mariadb' - environment: - - MARIADB_ROOT_PASSWORD=root-password - - MARIADB_GALERA_MARIABACKUP_PASSWORD=backup-password - - MARIADB_USER=user01 - - MARIADB_DATABASE=my_database - - MARIADB_GALERA_CLUSTER_ADDRESS=gcomm:// - - MARIADB_ENABLE_LDAP=yes - - LDAP_URI=ldap://openldap:1389 - - LDAP_BASE=dc=example,dc=org - - LDAP_BIND_DN=cn=admin,dc=example,dc=org - - LDAP_BIND_PASSWORD=adminpassword - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb-galera/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - - openldap: - image: 'docker.io/bitnami/openldap:latest' - ports: - - '1389:1389' - environment: - - LDAP_ADMIN_USERNAME=admin - - LDAP_ADMIN_PASSWORD=adminpassword - - LDAP_USERS=user01 - - LDAP_PASSWORDS=password1 - volumes: - - 'openldap_data:/bitnami/openldap' - -volumes: - mariadb_galera_data: - driver: local - openldap_data: - driver: local diff --git a/bitnami/mariadb-galera/10.11/debian-12/docker-compose.yml b/bitnami/mariadb-galera/10.11/debian-12/docker-compose.yml deleted file mode 100644 index 0b13578dfae74..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/docker-compose.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-galera: - image: docker.io/bitnami/mariadb-galera:10.11 - ports: - - '3306:3306' - - '4444:4444' - - '4567:4567' - - '4568:4568' - volumes: - - 'mariadb_galera_data:/bitnami/mariadb' - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_GALERA_CLUSTER_ADDRESS=gcomm:// - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb-galera/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_galera_data: - driver: local diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 10d3f9fbc85fe..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ini-file": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.4.7-7" - }, - "mariadb-galera": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "10.11.10-2" - } -} \ No newline at end of file diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh b/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh deleted file mode 100644 index fa50716cf1ff9..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh +++ /dev/null @@ -1,222 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami LDAP library - -# shellcheck disable=SC1090,SC1091 - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -######################## -# Loads global variables used on LDAP configuration. -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# Series of exports to be used as 'eval' arguments -######################### -ldap_env() { - cat <<"EOF" -export LDAP_NSLCD_USER="nslcd" -export LDAP_URI="${LDAP_URI:-}" -export LDAP_BASE="${LDAP_BASE:-}" -export LDAP_BIND_DN="${LDAP_BIND_DN:-}" -export LDAP_BIND_PASSWORD="${LDAP_BIND_PASSWORD:-}" -export LDAP_BASE_LOOKUP="${LDAP_BASE_LOOKUP:-}" -export LDAP_NSS_INITGROUPS_IGNOREUSERS="${LDAP_NSS_INITGROUPS_IGNOREUSERS:-root,nslcd}" -export LDAP_SCOPE="${LDAP_SCOPE:-}" -export LDAP_TLS_REQCERT="${LDAP_TLS_REQCERT:-}" -export LDAP_SEARCH_FILTER="${LDAP_SEARCH_FILTER:-}" -export LDAP_SEARCH_MAP="${LDAP_SEARCH_MAP:-}" - -EOF - if [[ "$OS_FLAVOUR" =~ ^debian-.*$ ]]; then - cat <<"EOF" -export LDAP_NSLCD_GROUP="nslcd" -EOF - elif [[ "$OS_FLAVOUR" =~ ^(photon)-.*$ ]]; then - cat <<"EOF" -export LDAP_NSLCD_GROUP="ldap" -EOF - fi -} - -######################## -# Return LDAP config file path depending on distro -# Globals: -# OS_FLAVOUR -# Arguments: -# None -# Returns: -# (String) LDAP config file path -######################### -ldap_openldap_config_path() { - local openldap_config - case "$OS_FLAVOUR" in - debian-* | ubuntu-*) openldap_config=/etc/ldap/ldap.conf ;; - photon-* | redhatubi-*) openldap_config=/etc/openldap/ldap.conf ;; - *) error "Unsupported OS flavor ${OS_FLAVOUR}" && exit 1 ;; - esac - echo "$openldap_config" -} - -######################## -# Configure LDAP permissions (to be used at postunpack leve). -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# None -######################### -ldap_configure_permissions() { - ensure_dir_exists "/var/run/nslcd" && configure_permissions_ownership "/var/run/nslcd" -u "root" -g "root" -d "775" - # The nslcd.conf file may not exist in distros like UBI, so we need to create it first - touch "/etc/nslcd.conf" - configure_permissions_ownership "/etc/nslcd.conf" -u "root" -g "root" -f "660" - configure_permissions_ownership "$(ldap_openldap_config_path)" -u "root" -g "root" -f "660" -} - -######################## -# Create nslcd.conf file -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# None -######################### -ldap_create_nslcd_config() { - if am_i_root; then - chown "root:${LDAP_NSLCD_GROUP}" "/etc/nslcd.conf" - chown -R "${LDAP_NSLCD_USER}:${LDAP_NSLCD_GROUP}" "/var/run/nslcd" - cat >"/etc/nslcd.conf" <"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"$(ldap_openldap_config_path)" <"/etc/pam.d/${filename}" < 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - elif [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - if [[ -z "$DB_MASTER_HOST" ]]; then - print_validation_error "Slave replication mode chosen without setting the environment variable $(get_env_var MASTER_HOST). Use it to indicate where the Master node is running" - fi - else - print_validation_error "Invalid replication mode. Available options are 'master/slave'" - fi - else - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ "$DB_USER" = "root" ]]; then - print_validation_error "root user is already created in the database and you can't use it as username for user creation." - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - if [[ "${DB_REPLICATION_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "$dump_file" - debug "Finish dump databases" - - debug "Unlock master databases for write operations" - echo "UNLOCK TABLES;" | mysql_remote_execute "$DB_MASTER_HOST" "$DB_MASTER_PORT_NUMBER" "mysql" "$DB_MASTER_ROOT_USER" "$DB_MASTER_ROOT_PASSWORD" - - debug "Start import dump databases" - mysql_execute < "$dump_file" - mysql_execute "mysql" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - if ! grep --silent "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" "${DB_CONF_FILE}"; then - echo "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" >> "${DB_CONF_FILE}" - fi - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Using persisted data" - # mysql_upgrade requires the server to be running - [[ -n "$(get_master_env_var_value ROOT_PASSWORD)" ]] && export ROOT_AUTH_ENABLED="yes" - # https://dev.mysql.com/doc/refman/8.0/en/replication-upgrade.html - mariadb_upgrade - else - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - info "Installing database" - mariadb_install_db - mysql_start_bg - wait_for_mysql_access - # we delete existing users and create new ones with stricter access - # commands can still be executed until we restart or run 'flush privileges' - info "Configuring authentication" - mysql_execute "mysql" <=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Initialize database data -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_install_db() { - local command="${DB_BIN_DIR}/mysql_install_db" - local -a args=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && args+=("${db_extra_flags[@]}") - - am_i_root && args=("${args[@]}" "--user=$DB_DAEMON_USER") - args+=("--auth-root-authentication-method=normal") - # Feature available only in MariaDB 10.5+ - # ref: https://mariadb.com/kb/en/mysql_install_db/#not-creating-the-test-database-and-anonymous-user - if [[ ! "$(mysql_get_version)" =~ ^10\.[01234]\. ]]; then - is_boolean_yes "$DB_SKIP_TEST_DB" && args+=("--skip-test-db") - fi - - debug_execute "$command" "${args[@]}" -} - -######################## -# Upgrade Database Schema -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_upgrade() { - local -a args=("--defaults-file=${DB_CONF_FILE}" "-u" "$DB_ROOT_USER") - info "Running mysql_upgrade" - mysql_start_bg - is_boolean_yes "${ROOT_AUTH_ENABLED:-false}" && args+=("-p$(get_master_env_var_value ROOT_PASSWORD)") - [[ "${DB_UPGRADE}" == "FORCE" ]] && args+=("--force") - debug_execute "${DB_BIN_DIR}/mysql_upgrade" "${args[@]}" || echo "This installation is already upgraded" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami MySQL Galera library - -# shellcheck disable=SC1090,SC1091,SC2119,SC2120 - -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh -. /opt/bitnami/scripts/libfile.sh - -######################## -# Check if a previous boot exists -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Yes or no -######################### -get_previous_boot() { - [[ -e "$DB_GALERA_BOOTSTRAP_FILE" ]] && echo "yes" || echo "no" -} - -######################## -# Create a flag file to indicate previous boot -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -set_previous_boot() { - info "Setting previous boot" - touch "$DB_GALERA_BOOTSTRAP_FILE" -} - -######################## -# Configure database extra start flags -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Array with extra flags to use -######################### -mysql_extra_flags() { - local -a dbExtraFlags=() - read -r -a userExtraFlags <<< "${DB_EXTRA_FLAGS?}" - - # This avoids a non-writable configuration file break a Galera Cluster, due to lack of proper Galera clustering configuration - # This is especially important for the MariaDB Galera chart, in which the 'my.cnf' configuration file is mounted by default - if ! is_file_writable "$DB_CONF_FILE"; then - dbExtraFlags+=( - "--wsrep-node-name=$(get_node_name)" - "--wsrep-node-address=$(get_node_address)" - "--wsrep-cluster-name=${DB_GALERA_CLUSTER_NAME}" - "--wsrep-cluster-address=$(get_galera_cluster_address_value)" - "--wsrep-sst-method=${DB_GALERA_SST_METHOD}" - "--wsrep-sst-auth=${DB_GALERA_MARIABACKUP_USER}:${DB_GALERA_MARIABACKUP_PASSWORD}" - ) - fi - - [[ ${#userExtraFlags[@]} -eq 0 ]] || dbExtraFlags+=("${userExtraFlags[@]}") - - echo "${dbExtraFlags[@]}" -} - -######################## -# Whether the Galera node will perform bootstrapping of a new cluster, or join an existing one -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Yes or no -######################### -get_galera_cluster_bootstrap_value() { - local cluster_bootstrap - - # This block evaluate if the cluster needs to be boostraped or not. - # When the node is marked to bootstrap: - # - When it is force by setting DB_GALERA_CLUSTER_BOOTSTRAP - # - When there is not previous boot and not other nodes has been found - # When the node is not marked to bootstrap, the node will join an existing cluster. - cluster_bootstrap="no" # initial value - if is_boolean_yes "$DB_GALERA_CLUSTER_BOOTSTRAP"; then - cluster_bootstrap="yes" - elif ! is_boolean_yes "$(get_previous_boot)" && ! is_boolean_yes "$(has_galera_cluster_other_nodes)"; then - cluster_bootstrap="yes" - fi - echo "$cluster_bootstrap" -} - -######################## -# Whether the Galera cluster has other running nodes -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -has_galera_cluster_other_nodes() { - local node_ip cluster_address address has_nodes - - hostname_has_ips() { - local hostname="${1:?hostname is required}" - [[ "$(getent ahosts "$hostname")" != "" ]] && return 0 - return 1 - } - - has_nodes="yes" - cluster_address="$DB_GALERA_CLUSTER_ADDRESS" - if [[ -z "$cluster_address" ]]; then - has_nodes="no" - elif [[ -n "$cluster_address" ]]; then - has_nodes="no" - read -r -a local_ips <<< "$(hostname -i)" - read -r -a addresses <<< "$(tr ',' ' ' <<< "${cluster_address#*://}")" - if [[ "${#addresses[@]}" -eq "1" ]]; then - if validate_ipv4 "$(echo "${addresses[0]}" | cut -d':' -f1)"; then - has_nodes="yes" - else - address="$(echo "${addresses[0]}" | cut -d':' -f1)" - if retry_while "hostname_has_ips $address" 2 2; then - for ip in $(getent ahosts "$address" | awk '{print $1}' | uniq); do - for local_ip in "${local_ips[@]}"; do - if [[ "$ip" != "$local_ip" ]]; then - has_nodes="yes" - break - fi - done - done - fi - fi - else - for a in "${addresses[@]}"; do - address="$(echo "$a" | cut -d':' -f1)" - node_ip="" - if validate_ipv4 "$address"; then - node_ip="$address" - else - if retry_while "hostname_has_ips $address" 2 2; then - node_ip="$(dns_lookup "$address")" - fi - fi - if [[ -n "$node_ip" ]]; then - has_nodes="yes" - # we now check if *any* of our IPs matches the node IP. In that case, we have to revert has_nodes to no, because it's not in fact a foreign node and check the next. - for local_ip in "${local_ips[@]}"; do - if [[ "$node_ip" == "$local_ip" ]]; then - has_nodes="no" - break - fi - done - # The foreign IP did not match our local IP, so we know that another node exists. - if [[ "$has_nodes" == 'yes' ]]; then - break - fi - fi - done - fi - fi - echo "$has_nodes" -} - -######################## -# Build Galera cluster address string from the bootstrap string -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -get_galera_cluster_address_value() { - local cluster_address - - if ! is_boolean_yes "$(get_galera_cluster_bootstrap_value)" && is_boolean_yes "$(has_galera_cluster_other_nodes)"; then - cluster_address="$DB_GALERA_CLUSTER_ADDRESS" - else - cluster_address="gcomm://" - fi - - debug "Set Galera cluster address to ${cluster_address}" - echo "$cluster_address" -} - -######################## -# Validate settings in MYSQL_*/MARIADB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_validate() { - info "Validating settings in MYSQL_*/MARIADB_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - backslash_password_error() { - print_validation_error "The password cannot contain backslashes ('\'). Set the environment variable $1 with no backslashes (more info at https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html)" - } - - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -n "$DB_GALERA_MARIABACKUP_USER" ]] && [[ -z "$DB_GALERA_MARIABACKUP_PASSWORD" ]]; then - empty_password_error "$(get_env_var GALERA_MARIABACKUP_PASSWORD)" - fi - - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if (( ${#DB_ROOT_PASSWORD} > 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]]; then - if is_boolean_yes "$DB_ENABLE_LDAP" && [[ -n "$DB_PASSWORD" ]]; then - warn "You enabled LDAP authentication. '$DB_USER' user will be authentication using LDAP, the password set at the environment variable $(get_env_var PASSWORD) will be ignored" - elif ! is_boolean_yes "$DB_ENABLE_LDAP" && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - fi - - if [[ -n "$DB_GALERA_FORCE_SAFETOBOOTSTRAP" ]] && ! is_yes_no_value "$DB_GALERA_FORCE_SAFETOBOOTSTRAP"; then - print_validation_error "The allowed values for $(get_env_var GALERA_FORCE_SAFETOBOOTSTRAP) are yes or no." - fi - - if [[ -z "$DB_GALERA_CLUSTER_NAME" ]]; then - print_validation_error "Galera cluster cannot be created without setting the environment variable $(get_env_var GALERA_CLUSTER_NAME)." - fi - - if [[ -z "$(get_galera_cluster_address_value)" ]]; then - print_validation_error "Galera cluster cannot be created without setting the environment variable $(get_env_var GALERA_CLUSTER_ADDRESS). If you are bootstrapping a new Galera cluster, set the environment variable $(get_env_var GALERA_CLUSTER_ADDRESS)=yes." - fi - - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - - if is_boolean_yes "$DB_ENABLE_LDAP" && { [[ -z "${LDAP_URI}" ]] || [[ -z "${LDAP_BASE}" ]] || [[ -z "${LDAP_BIND_DN}" ]] || [[ -z "${LDAP_BIND_PASSWORD}" ]]; }; then - print_validation_error "The LDAP configuration is required when LDAP authentication is enabled. Set the environment variables LDAP_URI, LDAP_BASE, LDAP_BIND_DN and LDAP_BIND_PASSWORD with the LDAP configuration." - fi - - if is_boolean_yes "$DB_ENABLE_TLS"; then - if [[ -z "${DB_TLS_CERT_FILE}" ]] || [[ -z "${DB_TLS_KEY_FILE}" ]] || [[ -z "${DB_TLS_CA_FILE}" ]]; then - print_validation_error "The TLS cert file, key and CA are required when TLS is enabled. Set the environment variables TLS_CERT_FILE, TLS_KEY_FILE and TLS_CA_FILE with the path to each file." - fi - if [[ ! -f "${DB_TLS_CERT_FILE}" ]]; then - print_validation_error "The TLS_CERT file ${DB_TLS_CERT_FILE} must exist." - fi - if [[ ! -f "${DB_TLS_KEY_FILE}" ]]; then - print_validation_error "The TLS_KEY file ${DB_TLS_KEY_FILE} must exist." - fi - if [[ ! -f "${DB_TLS_CA_FILE}" ]]; then - print_validation_error "The TLS_CA file ${DB_TLS_CA_FILE} must exist." - fi - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Persisted data detected. Restoring" - - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - if is_boolean_yes "$DB_GALERA_FORCE_SAFETOBOOTSTRAP"; then - set_safe_to_bootstrap - fi - if ! is_safe_to_bootstrap; then - error "It is not safe to bootstrap form this node ('safe_to_bootstrap=0' is set in 'grastate.dat'). If you want to force bootstrap, set the environment variable MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP=yes" - exit 1 - fi - fi - - return - else - # initialization should not be performed on non-primary nodes of a galera cluster - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - mariadb_install_db - mysql_start_bg - debug "Deleting all users to avoid issues with galera configuration" - mysql_execute "mysql" </dev/null - hostname - fi -} - -######################## -# Check for user override of wsrep_node_address -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# String with node address -######################### -get_node_address() { - if [[ -n "$DB_GALERA_NODE_ADDRESS" ]]; then - echo "$DB_GALERA_NODE_ADDRESS" - else - # In some environments, the network may not be fully set up when starting the initialization - # So, to avoid issues, we retry the 'hostname' command until it succeeds (for a few minutes) - local -r retries="60" - local -r seconds="5" - retry_while "hostname -i" "$retries" "$seconds" >/dev/null - # prefer IPv6 over IPv4 if available - # This works by pulling any IPv4 addresses encountered into hold space and emitting it only when the EOF line is encountered - printf '%s\nEOF' "$(hostname -i | tr ' ' '\n')" | sed '/:/{;q;};/^EOF$/{;g;q;};h;d' - fi -} - -######################## -# Starts MySQL/MariaDB in the background and waits until it's ready -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_start_bg() { - local -a flags=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") - - # Only allow local connections until MySQL is fully initialized, to avoid apps trying to connect to MySQL before it is fully initialized - flags+=("--bind-address=127.0.0.1") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - - # Do not start as root, to avoid permission issues - am_i_root && flags+=("--user=${DB_DAEMON_USER}") - - # The slave should only start in 'run.sh', elseways user credentials would be needed for any connection - flags+=("--skip-slave-start") - flags+=("$@") - - is_mysql_running && return - - info "Starting $DB_FLAVOR in background" - debug_execute "${DB_SBIN_DIR}/mysqld" "${flags[@]}" & - - # we cannot use wait_for_mysql_access here as mysql_upgrade for MySQL >=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Wait for WSREP to be ready. If WSREP is not ready, we cannot do any transactions, thus cannot - # create any users, and WSREP instantly kills MariaDB if doing so - wait_for_wsrep - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Wait for WSREP to be ready to do transactions -# Arguments: -# None -# Returns: -# None -######################## -wait_for_wsrep() { - local -r retries=300 - local -r sleep_time=2 - if ! retry_while is_wsrep_ready "$retries" "$sleep_time"; then - error "WSREP did not become ready" - return 1 - fi -} - -######################## -# Checks for WSREP to be ready to do transactions -# Arguments: -# None -# Returns: -# Boolean -######################## -is_wsrep_ready() { - debug "Checking if WSREP is ready" - is_ready="$(mysql_execute_print_output "mysql" "root" <> "$custom_conf_file" - cat "$old_custom_conf_file" >> "$custom_conf_file" - fi - if am_i_root; then - [[ -e "$DB_VOLUME_DIR/.initialized" ]] && rm "$DB_VOLUME_DIR/.initialized" - rm -rf "$DB_VOLUME_DIR/conf" - else - warn "Old custom configuration migrated, please manually remove the 'conf' directory from the volume use to persist data" - fi -} - -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - local mysql_create_user_cmd - [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.4, the mysql.user table was replaced with a view: https://mariadb.com/kb/en/mysqluser-table/ - # Views have a definer user, in this case set to 'root', which needs to exist for the view to work - # In MySQL, to avoid issues when renaming the root user, they use the 'mysql.sys' user as a definer: https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html - # However, for MariaDB that is not the case, so when the 'root' user is renamed the 'mysql.user' table stops working and the view needs to be fixed - if [[ "$user" != "root" && ! "$(mysql_get_version)" =~ ^10.[0123]. ]]; then - alter_view_str="$(mysql_execute_print_output "mysql" "$user" "$password" "-s" <&2 - return 1 - ;; - esac - shift - done - - local -a mysql_execute_cmd=("mysql_execute") - [[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - - local -a create_database_args=() - [[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'") - [[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'") - - debug "Creating database $database" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$user") - [[ -n "$db_host" ]] && flags+=("--host" "${db_host}") - [[ -n "$db_port" ]] && flags+=("--port" "${db_port}") - if is_boolean_yes "$use_ldap"; then - flags+=("--use-ldap") - elif [[ -n "$password" ]]; then - flags+=("-p" "$password") - [[ -n "$auth_plugin" ]] && flags=("${flags[@]}" "--auth-plugin" "$auth_plugin") - fi - mysql_ensure_user_exists "${flags[@]}" -} - -######################## -# Optionally create the given database, and then optionally give a user -# full privileges on the database. -# Flags: -# -u|--user - database user -# --character-set - character set -# --collation - collation -# --host - database host -# --port - database port -# Arguments: -# $1 - database name -# Returns: -# None -######################### -mysql_ensure_optional_database_exists() { - local -r database="${1:?database is missing}" - local character_set="" - local collate="" - local user="" - local privileges="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - --character-set) - shift - character_set="${1:?missing character set}" - ;; - --collate) - shift - collate="${1:?missing collate}" - ;; - -u|--user) - shift - user="${1:?missing database user}" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - --privileges) - shift - privileges="${1:?missing privileges}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$database") - [[ -n "$character_set" ]] && flags+=("--character-set" "$character_set") - [[ -n "$collate" ]] && flags+=("--collate" "$collate") - [[ -n "$db_host" ]] && flags+=("--host" "$db_host") - [[ -n "$db_port" ]] && flags+=("--port" "$db_port") - mysql_ensure_database_exists "${flags[@]}" - - if [[ -n "$user" ]]; then - mysql_ensure_user_has_database_privileges "$user" "$database" "$privileges" "$db_host" "$db_port" - fi -} - -######################## -# Add or modify an entry in the MySQL configuration file ("$DB_CONF_FILE") -# Globals: -# DB_* -# Arguments: -# $1 - MySQL variable name -# $2 - Value to assign to the MySQL variable -# $3 - Section in the MySQL configuration file the key is located (default: mysqld) -# $4 - Configuration file (default: "$BD_CONF_FILE") -# Returns: -# None -######################### -mysql_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - read -r -a sections <<<"${3:-mysqld}" - local -r ignore_inline_comments="${4:-no}" - local -r file="${5:-"$DB_CONF_FILE"}" - info "Setting ${key} option" - debug "Setting ${key} to '${value}' in ${DB_FLAVOR} configuration file ${file}" - # Check if the configuration exists in the file - for section in "${sections[@]}"; do - if is_boolean_yes "$ignore_inline_comments"; then - ini-file set --ignore-inline-comments --section "$section" --key "$key" --value "$value" "$file" - else - ini-file set --section "$section" --key "$key" --value "$value" "$file" - fi - done -} - -######################## -# Update MySQL/MariaDB configuration file with user custom inputs -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_update_custom_config() { - # Persisted configuration files from old versions - ! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration - - # User injected custom configuration - if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then - debug "Injecting custom configuration from my_custom.conf" - cat "$DB_CONF_DIR/my_custom.cnf" > "$DB_CONF_DIR/bitnami/my_custom.cnf" - fi - - ! is_empty_value "$DB_USER" && mysql_conf_set "user" "$DB_USER" "mysqladmin" - ! is_empty_value "$DB_PORT_NUMBER" && mysql_conf_set "port" "$DB_PORT_NUMBER" "mysqld client manager" - ! is_empty_value "$DB_CHARACTER_SET" && mysql_conf_set "character_set_server" "$DB_CHARACTER_SET" - ! is_empty_value "$DB_COLLATE" && mysql_conf_set "collation_server" "$DB_COLLATE" - ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" - ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" - ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" - ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" - ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=( "/usr/lib" "/usr/lib64" ) - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} - -######################## -# Execute a reliable health check against the current mysql instance -# Globals: -# DB_ROOT_USER, DB_ROOT_PASSWORD, DB_MASTER_ROOT_PASSWORD -# Arguments: -# None -# Returns: -# mysqladmin output -######################### -mysql_healthcheck() { - local args=("-u${DB_ROOT_USER}" "-h0.0.0.0") - local root_password - - root_password="$(get_master_env_var_value ROOT_PASSWORD)" - if [[ -n "$root_password" ]]; then - args+=("-p${root_password}") - fi - - mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status -} - -######################## -# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# mysql client flavor -######################### -mysql_client_flavor() { - if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then - echo "mariadb" - else - echo "mysql" - fi -} - -######################## -# Prints extra options for MySQL client calls (i.e. SSL options) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# List of options to pass to "mysql" CLI -######################### -mysql_client_extra_opts() { - # Helper to get the proper value for the MySQL client environment variable - mysql_client_env_value() { - local env_name="MYSQL_CLIENT_${1:?missing name}" - if [[ -n "${!env_name:-}" ]]; then - echo "${!env_name:-}" - else - env_name="DB_CLIENT_${1}" - echo "${!env_name:-}" - fi - } - local -a opts=() - local key value - if is_boolean_yes "${DB_ENABLE_SSL:-no}"; then - if [[ "$(mysql_client_flavor)" = "mysql" ]]; then - opts+=("--ssl-mode=REQUIRED") - else - opts+=("--ssl=TRUE") - fi - # Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined - for key in ca key cert; do - value="$(mysql_client_env_value "SSL_${key^^}_FILE")" - [[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}") - done - else - # Skip SSL validation - if [[ "$(mysql_client_flavor)" = "mariadb" ]]; then - # SSL connections are enabled by default in MariaDB >=10.11 - local mysql_version="" - local major_version="" - local minor_version="" - mysql_version="$(mysql_get_version)" - major_version="$(get_sematic_version "${mysql_version}" 1)" - minor_version="$(get_sematic_version "${mysql_version}" 2)" - if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then - opts+=("--skip-ssl") - fi - fi - fi - echo "${opts[@]:-}" -} diff --git a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh b/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh deleted file mode 100644 index 54c504fe8d2c8..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh +++ /dev/null @@ -1,264 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for mariadb - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-mariadb}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -mariadb_env_vars=( - ALLOW_EMPTY_PASSWORD - MARIADB_AUTHENTICATION_PLUGIN - MARIADB_ROOT_USER - MARIADB_ROOT_PASSWORD - MARIADB_USER - MARIADB_PASSWORD - MARIADB_DATABASE - MARIADB_MASTER_HOST - MARIADB_MASTER_PORT_NUMBER - MARIADB_MASTER_ROOT_USER - MARIADB_MASTER_ROOT_PASSWORD - MARIADB_MASTER_DELAY - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - MARIADB_PORT_NUMBER - MARIADB_REPLICATION_MODE - MARIADB_REPLICATION_SLAVE_DUMP - MARIADB_EXTRA_FLAGS - MARIADB_INIT_SLEEP_TIME - MARIADB_CHARACTER_SET - MARIADB_COLLATE - MARIADB_BIND_ADDRESS - MARIADB_SQL_MODE - MARIADB_UPGRADE - MARIADB_SKIP_TEST_DB - MARIADB_CLIENT_ENABLE_SSL - MARIADB_CLIENT_SSL_CA_FILE - MARIADB_CLIENT_SSL_CERT_FILE - MARIADB_CLIENT_SSL_KEY_FILE - MARIADB_CLIENT_EXTRA_FLAGS - MARIADB_STARTUP_WAIT_RETRIES - MARIADB_STARTUP_WAIT_SLEEP_TIME - MARIADB_ENABLE_SLOW_QUERY - MARIADB_LONG_QUERY_TIME - MARIADB_GALERA_CONF_DIR - MARIADB_GALERA_MOUNTED_CONF_DIR - MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP - MARIADB_GALERA_CLUSTER_BOOTSTRAP - MARIADB_GALERA_CLUSTER_ADDRESS - MARIADB_GALERA_CLUSTER_NAME - MARIADB_GALERA_NODE_NAME - MARIADB_GALERA_NODE_ADDRESS - MARIADB_GALERA_SST_METHOD - MARIADB_GALERA_MARIABACKUP_USER - MARIADB_GALERA_MARIABACKUP_PASSWORD - MARIADB_ENABLE_LDAP - MARIADB_ENABLE_TLS - MARIADB_TLS_CERT_FILE - MARIADB_TLS_KEY_FILE - MARIADB_TLS_CA_FILE - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - DB_ENABLE_SLOW_QUERY - DB_LONG_QUERY_TIME -) -for env_var in "${mariadb_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset mariadb_env_vars -export DB_FLAVOR="mariadb" - -# Paths -export DB_BASE_DIR="${BITNAMI_ROOT_DIR}/mariadb" -export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" -export DB_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_SBIN_DIR="${DB_BASE_DIR}/sbin" -export DB_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_LOGS_DIR="${DB_BASE_DIR}/logs" -export DB_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_CONF_FILE="${DB_CONF_DIR}/my.cnf" -export DB_PID_FILE="${DB_TMP_DIR}/mysqld.pid" -export DB_SOCKET_FILE="${DB_TMP_DIR}/mysql.sock" -export PATH="${DB_SBIN_DIR}:${DB_BIN_DIR}:/opt/bitnami/common/bin:${PATH}" - -# System users (when running with a privileged user) -export DB_DAEMON_USER="mysql" -export DB_DAEMON_GROUP="mysql" - -# Default configuration (build-time) -export MARIADB_DEFAULT_PORT_NUMBER="3306" -export DB_DEFAULT_PORT_NUMBER="$MARIADB_DEFAULT_PORT_NUMBER" # only used at build time -export MARIADB_DEFAULT_CHARACTER_SET="utf8mb4" -export DB_DEFAULT_CHARACTER_SET="$MARIADB_DEFAULT_CHARACTER_SET" # only used at build time -export MARIADB_DEFAULT_BIND_ADDRESS="0.0.0.0" -export DB_DEFAULT_BIND_ADDRESS="$MARIADB_DEFAULT_BIND_ADDRESS" # only used at build time - -# MariaDB Galera authentication. -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export MARIADB_AUTHENTICATION_PLUGIN="${MARIADB_AUTHENTICATION_PLUGIN:-}" -export DB_AUTHENTICATION_PLUGIN="$MARIADB_AUTHENTICATION_PLUGIN" -export MARIADB_ROOT_USER="${MARIADB_ROOT_USER:-root}" -export DB_ROOT_USER="$MARIADB_ROOT_USER" # only used during the first initialization -export MARIADB_ROOT_PASSWORD="${MARIADB_ROOT_PASSWORD:-}" -export DB_ROOT_PASSWORD="$MARIADB_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_USER="${MARIADB_USER:-}" -export DB_USER="$MARIADB_USER" # only used during the first initialization -export MARIADB_PASSWORD="${MARIADB_PASSWORD:-}" -export DB_PASSWORD="$MARIADB_PASSWORD" # only used during the first initialization -export MARIADB_DATABASE="${MARIADB_DATABASE:-}" -export DB_DATABASE="$MARIADB_DATABASE" # only used during the first initialization -export MARIADB_MASTER_HOST="${MARIADB_MASTER_HOST:-}" -export DB_MASTER_HOST="$MARIADB_MASTER_HOST" # only used during the first initialization -export MARIADB_MASTER_PORT_NUMBER="${MARIADB_MASTER_PORT_NUMBER:-3306}" -export DB_MASTER_PORT_NUMBER="$MARIADB_MASTER_PORT_NUMBER" # only used during the first initialization -export MARIADB_MASTER_ROOT_USER="${MARIADB_MASTER_ROOT_USER:-root}" -export DB_MASTER_ROOT_USER="$MARIADB_MASTER_ROOT_USER" # only used during the first initialization -export MARIADB_MASTER_ROOT_PASSWORD="${MARIADB_MASTER_ROOT_PASSWORD:-}" -export DB_MASTER_ROOT_PASSWORD="$MARIADB_MASTER_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_MASTER_DELAY="${MARIADB_MASTER_DELAY:-0}" -export DB_MASTER_DELAY="$MARIADB_MASTER_DELAY" # only used during the first initialization -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Settings -export MARIADB_PORT_NUMBER="${MARIADB_PORT_NUMBER:-}" -export DB_PORT_NUMBER="$MARIADB_PORT_NUMBER" -export MARIADB_REPLICATION_MODE="${MARIADB_REPLICATION_MODE:-}" -export DB_REPLICATION_MODE="$MARIADB_REPLICATION_MODE" -export MARIADB_REPLICATION_SLAVE_DUMP="${MARIADB_REPLICATION_SLAVE_DUMP:-false}" -export DB_REPLICATION_SLAVE_DUMP="$MARIADB_REPLICATION_SLAVE_DUMP" -export MARIADB_EXTRA_FLAGS="${MARIADB_EXTRA_FLAGS:-}" -export DB_EXTRA_FLAGS="$MARIADB_EXTRA_FLAGS" -export MARIADB_INIT_SLEEP_TIME="${MARIADB_INIT_SLEEP_TIME:-}" -export DB_INIT_SLEEP_TIME="$MARIADB_INIT_SLEEP_TIME" -export MARIADB_CHARACTER_SET="${MARIADB_CHARACTER_SET:-}" -export DB_CHARACTER_SET="$MARIADB_CHARACTER_SET" -# MARIADB_COLLATION is deprecated in favor of MARIADB_COLLATE -MARIADB_COLLATE="${MARIADB_COLLATE:-"${MARIADB_COLLATION:-}"}" -export MARIADB_COLLATE="${MARIADB_COLLATE:-}" -export DB_COLLATE="$MARIADB_COLLATE" -export MARIADB_BIND_ADDRESS="${MARIADB_BIND_ADDRESS:-}" -export DB_BIND_ADDRESS="$MARIADB_BIND_ADDRESS" -export MARIADB_SQL_MODE="${MARIADB_SQL_MODE:-}" -export DB_SQL_MODE="$MARIADB_SQL_MODE" -export MARIADB_UPGRADE="${MARIADB_UPGRADE:-AUTO}" -export DB_UPGRADE="$MARIADB_UPGRADE" -export MARIADB_SKIP_TEST_DB="${MARIADB_SKIP_TEST_DB:-no}" -export DB_SKIP_TEST_DB="$MARIADB_SKIP_TEST_DB" -export MARIADB_CLIENT_ENABLE_SSL="${MARIADB_CLIENT_ENABLE_SSL:-no}" -export DB_CLIENT_ENABLE_SSL="$MARIADB_CLIENT_ENABLE_SSL" -export MARIADB_CLIENT_SSL_CA_FILE="${MARIADB_CLIENT_SSL_CA_FILE:-}" -export DB_CLIENT_SSL_CA_FILE="$MARIADB_CLIENT_SSL_CA_FILE" -export MARIADB_CLIENT_SSL_CERT_FILE="${MARIADB_CLIENT_SSL_CERT_FILE:-}" -export DB_CLIENT_SSL_CERT_FILE="$MARIADB_CLIENT_SSL_CERT_FILE" -export MARIADB_CLIENT_SSL_KEY_FILE="${MARIADB_CLIENT_SSL_KEY_FILE:-}" -export DB_CLIENT_SSL_KEY_FILE="$MARIADB_CLIENT_SSL_KEY_FILE" -export MARIADB_CLIENT_EXTRA_FLAGS="${MARIADB_CLIENT_EXTRA_FLAGS:-no}" -export DB_CLIENT_EXTRA_FLAGS="$MARIADB_CLIENT_EXTRA_FLAGS" -export MARIADB_STARTUP_WAIT_RETRIES="${MARIADB_STARTUP_WAIT_RETRIES:-300}" -export DB_STARTUP_WAIT_RETRIES="$MARIADB_STARTUP_WAIT_RETRIES" -export MARIADB_STARTUP_WAIT_SLEEP_TIME="${MARIADB_STARTUP_WAIT_SLEEP_TIME:-2}" -export DB_STARTUP_WAIT_SLEEP_TIME="$MARIADB_STARTUP_WAIT_SLEEP_TIME" -MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-"${DB_ENABLE_SLOW_QUERY:-}"}" -export MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-0}" -export DB_ENABLE_SLOW_QUERY="$MARIADB_ENABLE_SLOW_QUERY" -MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-"${DB_LONG_QUERY_TIME:-}"}" -export MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-10.0}" -export DB_LONG_QUERY_TIME="$MARIADB_LONG_QUERY_TIME" - -# Galera paths -export MARIADB_GALERA_GRASTATE_FILE="${DB_DATA_DIR}/grastate.dat" -export DB_GALERA_GRASTATE_FILE="$MARIADB_GALERA_GRASTATE_FILE" -export MARIADB_GALERA_BOOTSTRAP_DIR="${DB_VOLUME_DIR}/.bootstrap" -export DB_GALERA_BOOTSTRAP_DIR="$MARIADB_GALERA_BOOTSTRAP_DIR" -export MARIADB_GALERA_BOOTSTRAP_FILE="${DB_GALERA_BOOTSTRAP_DIR}/done" -export DB_GALERA_BOOTSTRAP_FILE="$MARIADB_GALERA_BOOTSTRAP_FILE" - -# Galera build-time defaults for cluster configuration -export MARIADB_GALERA_DEFAULT_CLUSTER_ADDRESS="gcomm://" -export DB_GALERA_DEFAULT_CLUSTER_ADDRESS="$MARIADB_GALERA_DEFAULT_CLUSTER_ADDRESS" -export MARIADB_GALERA_DEFAULT_CLUSTER_NAME="galera" -export DB_GALERA_DEFAULT_CLUSTER_NAME="$MARIADB_GALERA_DEFAULT_CLUSTER_NAME" -export MARIADB_GALERA_DEFAULT_NODE_NAME="" -export DB_GALERA_DEFAULT_NODE_NAME="$MARIADB_GALERA_DEFAULT_NODE_NAME" -export MARIADB_GALERA_DEFAULT_NODE_ADDRESS="" -export DB_GALERA_DEFAULT_NODE_ADDRESS="$MARIADB_GALERA_DEFAULT_NODE_ADDRESS" -export MARIADB_GALERA_DEFAULT_SST_METHOD="mariabackup" -export DB_GALERA_DEFAULT_SST_METHOD="$MARIADB_GALERA_DEFAULT_SST_METHOD" -export MARIADB_GALERA_DEFAULT_MARIABACKUP_USER="mariabackup" -export DB_GALERA_DEFAULT_MARIABACKUP_USER="$MARIADB_GALERA_DEFAULT_MARIABACKUP_USER" -export MARIADB_GALERA_DEFAULT_MARIABACKUP_PASSWORD="" -export DB_GALERA_DEFAULT_MARIABACKUP_PASSWORD="$MARIADB_GALERA_DEFAULT_MARIABACKUP_PASSWORD" - -# Galera cluster configuration. -export MARIADB_GALERA_CONF_DIR="${MARIADB_GALERA_CONF_DIR:-/opt/bitnami/mariadb/conf}" -export DB_GALERA_CONF_DIR="$MARIADB_GALERA_CONF_DIR" -export MARIADB_GALERA_MOUNTED_CONF_DIR="${MARIADB_GALERA_MOUNTED_CONF_DIR:-/bitnami/conf}" -export DB_GALERA_MOUNTED_CONF_DIR="$MARIADB_GALERA_MOUNTED_CONF_DIR" -export MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP="${MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP:-}" -export DB_GALERA_FORCE_SAFETOBOOTSTRAP="$MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP" -export MARIADB_GALERA_CLUSTER_BOOTSTRAP="${MARIADB_GALERA_CLUSTER_BOOTSTRAP:-}" -export DB_GALERA_CLUSTER_BOOTSTRAP="$MARIADB_GALERA_CLUSTER_BOOTSTRAP" -export MARIADB_GALERA_CLUSTER_ADDRESS="${MARIADB_GALERA_CLUSTER_ADDRESS:-}" -export DB_GALERA_CLUSTER_ADDRESS="$MARIADB_GALERA_CLUSTER_ADDRESS" -export MARIADB_GALERA_CLUSTER_NAME="${MARIADB_GALERA_CLUSTER_NAME:-$DB_GALERA_DEFAULT_CLUSTER_NAME}" -export DB_GALERA_CLUSTER_NAME="$MARIADB_GALERA_CLUSTER_NAME" -export MARIADB_GALERA_NODE_NAME="${MARIADB_GALERA_NODE_NAME:-}" -export DB_GALERA_NODE_NAME="$MARIADB_GALERA_NODE_NAME" -export MARIADB_GALERA_NODE_ADDRESS="${MARIADB_GALERA_NODE_ADDRESS:-}" -export DB_GALERA_NODE_ADDRESS="$MARIADB_GALERA_NODE_ADDRESS" -export MARIADB_GALERA_SST_METHOD="${MARIADB_GALERA_SST_METHOD:-$DB_GALERA_DEFAULT_SST_METHOD}" -export DB_GALERA_SST_METHOD="$MARIADB_GALERA_SST_METHOD" -export MARIADB_GALERA_MARIABACKUP_USER="${MARIADB_GALERA_MARIABACKUP_USER:-$DB_GALERA_DEFAULT_MARIABACKUP_USER}" -export DB_GALERA_MARIABACKUP_USER="$MARIADB_GALERA_MARIABACKUP_USER" -export MARIADB_GALERA_MARIABACKUP_PASSWORD="${MARIADB_GALERA_MARIABACKUP_PASSWORD:-$DB_GALERA_DEFAULT_MARIABACKUP_PASSWORD}" -export DB_GALERA_MARIABACKUP_PASSWORD="$MARIADB_GALERA_MARIABACKUP_PASSWORD" - -# LDAP -export MARIADB_ENABLE_LDAP="${MARIADB_ENABLE_LDAP:-no}" -export DB_ENABLE_LDAP="$MARIADB_ENABLE_LDAP" - -# SSL/TLS configuration -export MARIADB_ENABLE_TLS="${MARIADB_ENABLE_TLS:-no}" -export DB_ENABLE_TLS="$MARIADB_ENABLE_TLS" -export MARIADB_TLS_CERT_FILE="${MARIADB_TLS_CERT_FILE:-}" -export DB_TLS_CERT_FILE="$MARIADB_TLS_CERT_FILE" -export MARIADB_TLS_KEY_FILE="${MARIADB_TLS_KEY_FILE:-}" -export DB_TLS_KEY_FILE="$MARIADB_TLS_KEY_FILE" -export MARIADB_TLS_CA_FILE="${MARIADB_TLS_CA_FILE:-}" -export DB_TLS_CA_FILE="$MARIADB_TLS_CA_FILE" -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-monitor}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-monitor}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Custom environment variables may be defined below diff --git a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh b/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh deleted file mode 100755 index ec7e80256766f..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/mariadb/conf) -debug "Copying files from $DB_DEFAULT_CONF_DIR to $DB_CONF_DIR" -cp -nr "$DB_DEFAULT_CONF_DIR"/. "$DB_CONF_DIR" - -print_welcome_page - -if [[ "$1" = "/opt/bitnami/scripts/mariadb-galera/run.sh" ]]; then - info "** Starting MariaDB setup **" - /opt/bitnami/scripts/mariadb-galera/setup.sh - info "** MariaDB setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh b/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh deleted file mode 100755 index 8bd30f5f8ae49..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -mysql_healthcheck diff --git a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh b/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh deleted file mode 100755 index 503f456f66f0d..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libldapclient.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# Configure MariaDB options based on build-time defaults -info "Configuring default MariaDB options" -ensure_dir_exists "$DB_CONF_DIR" -mysql_create_default_config - -for dir in "$DB_TMP_DIR" "$DB_LOGS_DIR" "$DB_CONF_DIR" "$DB_DEFAULT_CONF_DIR" "${DB_CONF_DIR}/bitnami" "$DB_VOLUME_DIR" "$DB_DATA_DIR" "$DB_GALERA_BOOTSTRAP_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# LDAP permissions -ldap_configure_permissions -ldap_create_pam_config "mariadb" - -# Fix to avoid issues detecting plugins in mysql_install_db -ln -sf "$DB_BASE_DIR/plugin" "$DB_BASE_DIR/lib/plugin" - -# Redirect all logging to stdout -ln -sf /dev/stdout "$DB_LOGS_DIR/mysqld.log" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${DB_CONF_DIR}/"* "$DB_DEFAULT_CONF_DIR" diff --git a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh b/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh deleted file mode 100755 index 69b8d4496908b..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libldapclient.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# mysqld_safe does not allow logging to stdout/stderr, so we stick with mysqld -EXEC="${DB_SBIN_DIR}/mysqld" - -flags=("--defaults-file=${DB_CONF_DIR}/my.cnf" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") -[[ -z "${DB_PID_FILE:-}" ]] || flags+=("--pid-file=${DB_PID_FILE}") - -# Add flags specified via the 'DB_EXTRA_FLAGS' environment variable -read -r -a db_extra_flags <<< "$(mysql_extra_flags)" -[[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - -# Add flags passed to this script -flags+=("$@") - -# Fix for MDEV-16183 - mysqld_safe already does this, but we are using mysqld -LD_PRELOAD="$(find_jemalloc_lib)${LD_PRELOAD:+ "$LD_PRELOAD"}" -export LD_PRELOAD - -is_boolean_yes "$DB_ENABLE_LDAP" && ldap_start_nslcd_bg - -info "** Starting MariaDB **" - -set_previous_boot - -if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "$EXEC" "${flags[@]}" -else - exec "$EXEC" "${flags[@]}" -fi diff --git a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh b/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh deleted file mode 100755 index 77c9f7d5d1a97..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadbgalera.sh -. /opt/bitnami/scripts/libldapclient.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# Ensure mysql unix socket file does not exist -rm -rf "${DB_SOCKET_FILE}.lock" -# Ensure MariaDB environment variables settings are valid -mysql_validate -# Ensure MariaDB is stopped when this script ends. -trap "mysql_stop" EXIT -if am_i_root; then - # Ensure 'daemon' user exists when running as 'root' - ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" - # Ensure 'nslcd' user exists when running as 'root' - ensure_user_exists "$LDAP_NSLCD_USER" --group "$LDAP_NSLCD_GROUP" - # Fix logging issue when running as root - chmod o+w "$(readlink /dev/stdout)" -fi -# Ensure MariaDB is initialized -mysql_initialize -# Ensure LDAP is initialized -is_boolean_yes "$DB_ENABLE_LDAP" && ldap_initialize -# Allow running custom initialization scripts -mysql_custom_scripts 'init' -# Allow running custom start scripts -mysql_custom_scripts 'start' -# Stop MariaDB before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -mysql_stop diff --git a/bitnami/mariadb-galera/10.11/debian-12/tags-info.yaml b/bitnami/mariadb-galera/10.11/debian-12/tags-info.yaml deleted file mode 100644 index 3e280dc001ad4..0000000000000 --- a/bitnami/mariadb-galera/10.11/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "10.11" -- 10.11-debian-12 -- 10.11.10 diff --git a/bitnami/mariadb-galera/10.5/README.md b/bitnami/mariadb-galera/10.5/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/mariadb-galera/10.5/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/mariadb-galera/10.5/debian-12/Dockerfile b/bitnami/mariadb-galera/10.5/debian-12/Dockerfile deleted file mode 100644 index defd44506145e..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T15:52:08Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="10.5.27-debian-12-r3" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera" \ - org.opencontainers.image.title="mariadb-galera" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="10.5.27" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl iproute2 ldap-utils libaio1 libaudit1 libcap-ng0 libcrypt1 libgcc-s1 libicu72 libldap-common liblzma5 libncurses6 libpam-ldapd libpam0g libssl3 libstdc++6 libtinfo6 libxml2 nslcd procps psmisc rsync socat zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "ini-file-1.4.7-7-linux-${OS_ARCH}-debian-12" \ - "mariadb-galera-10.5.27-2-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir /docker-entrypoint-initdb.d - -COPY rootfs / -RUN /opt/bitnami/scripts/mariadb-galera/postunpack.sh -ENV APP_VERSION="10.5.27" \ - BITNAMI_APP_NAME="mariadb-galera" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/common/sbin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:$PATH" - -EXPOSE 3306 4444 4567 4568 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/mariadb-galera/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/mariadb-galera/run.sh" ] diff --git a/bitnami/mariadb-galera/10.5/debian-12/docker-compose-ldap.yml b/bitnami/mariadb-galera/10.5/debian-12/docker-compose-ldap.yml deleted file mode 100644 index 4e6370dcbc0ce..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/docker-compose-ldap.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-galera: - image: docker.io/bitnami/mariadb-galera:10.5 - ports: - - '3306:3306' - - '4444:4444' - - '4567:4567' - - '4568:4568' - volumes: - - 'mariadb_galera_data:/bitnami/mariadb' - environment: - - MARIADB_ROOT_PASSWORD=root-password - - MARIADB_GALERA_MARIABACKUP_PASSWORD=backup-password - - MARIADB_USER=user01 - - MARIADB_DATABASE=my_database - - MARIADB_GALERA_CLUSTER_ADDRESS=gcomm:// - - MARIADB_ENABLE_LDAP=yes - - LDAP_URI=ldap://openldap:1389 - - LDAP_BASE=dc=example,dc=org - - LDAP_BIND_DN=cn=admin,dc=example,dc=org - - LDAP_BIND_PASSWORD=adminpassword - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb-galera/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - - openldap: - image: 'docker.io/bitnami/openldap:latest' - ports: - - '1389:1389' - environment: - - LDAP_ADMIN_USERNAME=admin - - LDAP_ADMIN_PASSWORD=adminpassword - - LDAP_USERS=user01 - - LDAP_PASSWORDS=password1 - volumes: - - 'openldap_data:/bitnami/openldap' - -volumes: - mariadb_galera_data: - driver: local - openldap_data: - driver: local diff --git a/bitnami/mariadb-galera/10.5/debian-12/docker-compose.yml b/bitnami/mariadb-galera/10.5/debian-12/docker-compose.yml deleted file mode 100644 index a7a2550505fe3..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/docker-compose.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-galera: - image: docker.io/bitnami/mariadb-galera:10.5 - ports: - - '3306:3306' - - '4444:4444' - - '4567:4567' - - '4568:4568' - volumes: - - 'mariadb_galera_data:/bitnami/mariadb' - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_GALERA_CLUSTER_ADDRESS=gcomm:// - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb-galera/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_galera_data: - driver: local diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 5a03e30e1818a..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ini-file": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.4.7-7" - }, - "mariadb-galera": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "10.5.27-2" - } -} \ No newline at end of file diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh b/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh deleted file mode 100644 index fa50716cf1ff9..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh +++ /dev/null @@ -1,222 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami LDAP library - -# shellcheck disable=SC1090,SC1091 - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -######################## -# Loads global variables used on LDAP configuration. -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# Series of exports to be used as 'eval' arguments -######################### -ldap_env() { - cat <<"EOF" -export LDAP_NSLCD_USER="nslcd" -export LDAP_URI="${LDAP_URI:-}" -export LDAP_BASE="${LDAP_BASE:-}" -export LDAP_BIND_DN="${LDAP_BIND_DN:-}" -export LDAP_BIND_PASSWORD="${LDAP_BIND_PASSWORD:-}" -export LDAP_BASE_LOOKUP="${LDAP_BASE_LOOKUP:-}" -export LDAP_NSS_INITGROUPS_IGNOREUSERS="${LDAP_NSS_INITGROUPS_IGNOREUSERS:-root,nslcd}" -export LDAP_SCOPE="${LDAP_SCOPE:-}" -export LDAP_TLS_REQCERT="${LDAP_TLS_REQCERT:-}" -export LDAP_SEARCH_FILTER="${LDAP_SEARCH_FILTER:-}" -export LDAP_SEARCH_MAP="${LDAP_SEARCH_MAP:-}" - -EOF - if [[ "$OS_FLAVOUR" =~ ^debian-.*$ ]]; then - cat <<"EOF" -export LDAP_NSLCD_GROUP="nslcd" -EOF - elif [[ "$OS_FLAVOUR" =~ ^(photon)-.*$ ]]; then - cat <<"EOF" -export LDAP_NSLCD_GROUP="ldap" -EOF - fi -} - -######################## -# Return LDAP config file path depending on distro -# Globals: -# OS_FLAVOUR -# Arguments: -# None -# Returns: -# (String) LDAP config file path -######################### -ldap_openldap_config_path() { - local openldap_config - case "$OS_FLAVOUR" in - debian-* | ubuntu-*) openldap_config=/etc/ldap/ldap.conf ;; - photon-* | redhatubi-*) openldap_config=/etc/openldap/ldap.conf ;; - *) error "Unsupported OS flavor ${OS_FLAVOUR}" && exit 1 ;; - esac - echo "$openldap_config" -} - -######################## -# Configure LDAP permissions (to be used at postunpack leve). -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# None -######################### -ldap_configure_permissions() { - ensure_dir_exists "/var/run/nslcd" && configure_permissions_ownership "/var/run/nslcd" -u "root" -g "root" -d "775" - # The nslcd.conf file may not exist in distros like UBI, so we need to create it first - touch "/etc/nslcd.conf" - configure_permissions_ownership "/etc/nslcd.conf" -u "root" -g "root" -f "660" - configure_permissions_ownership "$(ldap_openldap_config_path)" -u "root" -g "root" -f "660" -} - -######################## -# Create nslcd.conf file -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# None -######################### -ldap_create_nslcd_config() { - if am_i_root; then - chown "root:${LDAP_NSLCD_GROUP}" "/etc/nslcd.conf" - chown -R "${LDAP_NSLCD_USER}:${LDAP_NSLCD_GROUP}" "/var/run/nslcd" - cat >"/etc/nslcd.conf" <"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"$(ldap_openldap_config_path)" <"/etc/pam.d/${filename}" < 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - elif [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - if [[ -z "$DB_MASTER_HOST" ]]; then - print_validation_error "Slave replication mode chosen without setting the environment variable $(get_env_var MASTER_HOST). Use it to indicate where the Master node is running" - fi - else - print_validation_error "Invalid replication mode. Available options are 'master/slave'" - fi - else - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ "$DB_USER" = "root" ]]; then - print_validation_error "root user is already created in the database and you can't use it as username for user creation." - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - if [[ "${DB_REPLICATION_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "$dump_file" - debug "Finish dump databases" - - debug "Unlock master databases for write operations" - echo "UNLOCK TABLES;" | mysql_remote_execute "$DB_MASTER_HOST" "$DB_MASTER_PORT_NUMBER" "mysql" "$DB_MASTER_ROOT_USER" "$DB_MASTER_ROOT_PASSWORD" - - debug "Start import dump databases" - mysql_execute < "$dump_file" - mysql_execute "mysql" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - if ! grep --silent "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" "${DB_CONF_FILE}"; then - echo "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" >> "${DB_CONF_FILE}" - fi - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Using persisted data" - # mysql_upgrade requires the server to be running - [[ -n "$(get_master_env_var_value ROOT_PASSWORD)" ]] && export ROOT_AUTH_ENABLED="yes" - # https://dev.mysql.com/doc/refman/8.0/en/replication-upgrade.html - mariadb_upgrade - else - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - info "Installing database" - mariadb_install_db - mysql_start_bg - wait_for_mysql_access - # we delete existing users and create new ones with stricter access - # commands can still be executed until we restart or run 'flush privileges' - info "Configuring authentication" - mysql_execute "mysql" <=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Initialize database data -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_install_db() { - local command="${DB_BIN_DIR}/mysql_install_db" - local -a args=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && args+=("${db_extra_flags[@]}") - - am_i_root && args=("${args[@]}" "--user=$DB_DAEMON_USER") - args+=("--auth-root-authentication-method=normal") - # Feature available only in MariaDB 10.5+ - # ref: https://mariadb.com/kb/en/mysql_install_db/#not-creating-the-test-database-and-anonymous-user - if [[ ! "$(mysql_get_version)" =~ ^10\.[01234]\. ]]; then - is_boolean_yes "$DB_SKIP_TEST_DB" && args+=("--skip-test-db") - fi - - debug_execute "$command" "${args[@]}" -} - -######################## -# Upgrade Database Schema -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_upgrade() { - local -a args=("--defaults-file=${DB_CONF_FILE}" "-u" "$DB_ROOT_USER") - info "Running mysql_upgrade" - mysql_start_bg - is_boolean_yes "${ROOT_AUTH_ENABLED:-false}" && args+=("-p$(get_master_env_var_value ROOT_PASSWORD)") - [[ "${DB_UPGRADE}" == "FORCE" ]] && args+=("--force") - debug_execute "${DB_BIN_DIR}/mysql_upgrade" "${args[@]}" || echo "This installation is already upgraded" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami MySQL Galera library - -# shellcheck disable=SC1090,SC1091,SC2119,SC2120 - -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh -. /opt/bitnami/scripts/libfile.sh - -######################## -# Check if a previous boot exists -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Yes or no -######################### -get_previous_boot() { - [[ -e "$DB_GALERA_BOOTSTRAP_FILE" ]] && echo "yes" || echo "no" -} - -######################## -# Create a flag file to indicate previous boot -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -set_previous_boot() { - info "Setting previous boot" - touch "$DB_GALERA_BOOTSTRAP_FILE" -} - -######################## -# Configure database extra start flags -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Array with extra flags to use -######################### -mysql_extra_flags() { - local -a dbExtraFlags=() - read -r -a userExtraFlags <<< "${DB_EXTRA_FLAGS?}" - - # This avoids a non-writable configuration file break a Galera Cluster, due to lack of proper Galera clustering configuration - # This is especially important for the MariaDB Galera chart, in which the 'my.cnf' configuration file is mounted by default - if ! is_file_writable "$DB_CONF_FILE"; then - dbExtraFlags+=( - "--wsrep-node-name=$(get_node_name)" - "--wsrep-node-address=$(get_node_address)" - "--wsrep-cluster-name=${DB_GALERA_CLUSTER_NAME}" - "--wsrep-cluster-address=$(get_galera_cluster_address_value)" - "--wsrep-sst-method=${DB_GALERA_SST_METHOD}" - "--wsrep-sst-auth=${DB_GALERA_MARIABACKUP_USER}:${DB_GALERA_MARIABACKUP_PASSWORD}" - ) - fi - - [[ ${#userExtraFlags[@]} -eq 0 ]] || dbExtraFlags+=("${userExtraFlags[@]}") - - echo "${dbExtraFlags[@]}" -} - -######################## -# Whether the Galera node will perform bootstrapping of a new cluster, or join an existing one -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Yes or no -######################### -get_galera_cluster_bootstrap_value() { - local cluster_bootstrap - - # This block evaluate if the cluster needs to be boostraped or not. - # When the node is marked to bootstrap: - # - When it is force by setting DB_GALERA_CLUSTER_BOOTSTRAP - # - When there is not previous boot and not other nodes has been found - # When the node is not marked to bootstrap, the node will join an existing cluster. - cluster_bootstrap="no" # initial value - if is_boolean_yes "$DB_GALERA_CLUSTER_BOOTSTRAP"; then - cluster_bootstrap="yes" - elif ! is_boolean_yes "$(get_previous_boot)" && ! is_boolean_yes "$(has_galera_cluster_other_nodes)"; then - cluster_bootstrap="yes" - fi - echo "$cluster_bootstrap" -} - -######################## -# Whether the Galera cluster has other running nodes -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -has_galera_cluster_other_nodes() { - local node_ip cluster_address address has_nodes - - hostname_has_ips() { - local hostname="${1:?hostname is required}" - [[ "$(getent ahosts "$hostname")" != "" ]] && return 0 - return 1 - } - - has_nodes="yes" - cluster_address="$DB_GALERA_CLUSTER_ADDRESS" - if [[ -z "$cluster_address" ]]; then - has_nodes="no" - elif [[ -n "$cluster_address" ]]; then - has_nodes="no" - read -r -a local_ips <<< "$(hostname -i)" - read -r -a addresses <<< "$(tr ',' ' ' <<< "${cluster_address#*://}")" - if [[ "${#addresses[@]}" -eq "1" ]]; then - if validate_ipv4 "$(echo "${addresses[0]}" | cut -d':' -f1)"; then - has_nodes="yes" - else - address="$(echo "${addresses[0]}" | cut -d':' -f1)" - if retry_while "hostname_has_ips $address" 2 2; then - for ip in $(getent ahosts "$address" | awk '{print $1}' | uniq); do - for local_ip in "${local_ips[@]}"; do - if [[ "$ip" != "$local_ip" ]]; then - has_nodes="yes" - break - fi - done - done - fi - fi - else - for a in "${addresses[@]}"; do - address="$(echo "$a" | cut -d':' -f1)" - node_ip="" - if validate_ipv4 "$address"; then - node_ip="$address" - else - if retry_while "hostname_has_ips $address" 2 2; then - node_ip="$(dns_lookup "$address")" - fi - fi - if [[ -n "$node_ip" ]]; then - has_nodes="yes" - # we now check if *any* of our IPs matches the node IP. In that case, we have to revert has_nodes to no, because it's not in fact a foreign node and check the next. - for local_ip in "${local_ips[@]}"; do - if [[ "$node_ip" == "$local_ip" ]]; then - has_nodes="no" - break - fi - done - # The foreign IP did not match our local IP, so we know that another node exists. - if [[ "$has_nodes" == 'yes' ]]; then - break - fi - fi - done - fi - fi - echo "$has_nodes" -} - -######################## -# Build Galera cluster address string from the bootstrap string -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -get_galera_cluster_address_value() { - local cluster_address - - if ! is_boolean_yes "$(get_galera_cluster_bootstrap_value)" && is_boolean_yes "$(has_galera_cluster_other_nodes)"; then - cluster_address="$DB_GALERA_CLUSTER_ADDRESS" - else - cluster_address="gcomm://" - fi - - debug "Set Galera cluster address to ${cluster_address}" - echo "$cluster_address" -} - -######################## -# Validate settings in MYSQL_*/MARIADB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_validate() { - info "Validating settings in MYSQL_*/MARIADB_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - backslash_password_error() { - print_validation_error "The password cannot contain backslashes ('\'). Set the environment variable $1 with no backslashes (more info at https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html)" - } - - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -n "$DB_GALERA_MARIABACKUP_USER" ]] && [[ -z "$DB_GALERA_MARIABACKUP_PASSWORD" ]]; then - empty_password_error "$(get_env_var GALERA_MARIABACKUP_PASSWORD)" - fi - - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if (( ${#DB_ROOT_PASSWORD} > 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]]; then - if is_boolean_yes "$DB_ENABLE_LDAP" && [[ -n "$DB_PASSWORD" ]]; then - warn "You enabled LDAP authentication. '$DB_USER' user will be authentication using LDAP, the password set at the environment variable $(get_env_var PASSWORD) will be ignored" - elif ! is_boolean_yes "$DB_ENABLE_LDAP" && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - fi - - if [[ -n "$DB_GALERA_FORCE_SAFETOBOOTSTRAP" ]] && ! is_yes_no_value "$DB_GALERA_FORCE_SAFETOBOOTSTRAP"; then - print_validation_error "The allowed values for $(get_env_var GALERA_FORCE_SAFETOBOOTSTRAP) are yes or no." - fi - - if [[ -z "$DB_GALERA_CLUSTER_NAME" ]]; then - print_validation_error "Galera cluster cannot be created without setting the environment variable $(get_env_var GALERA_CLUSTER_NAME)." - fi - - if [[ -z "$(get_galera_cluster_address_value)" ]]; then - print_validation_error "Galera cluster cannot be created without setting the environment variable $(get_env_var GALERA_CLUSTER_ADDRESS). If you are bootstrapping a new Galera cluster, set the environment variable $(get_env_var GALERA_CLUSTER_ADDRESS)=yes." - fi - - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - - if is_boolean_yes "$DB_ENABLE_LDAP" && { [[ -z "${LDAP_URI}" ]] || [[ -z "${LDAP_BASE}" ]] || [[ -z "${LDAP_BIND_DN}" ]] || [[ -z "${LDAP_BIND_PASSWORD}" ]]; }; then - print_validation_error "The LDAP configuration is required when LDAP authentication is enabled. Set the environment variables LDAP_URI, LDAP_BASE, LDAP_BIND_DN and LDAP_BIND_PASSWORD with the LDAP configuration." - fi - - if is_boolean_yes "$DB_ENABLE_TLS"; then - if [[ -z "${DB_TLS_CERT_FILE}" ]] || [[ -z "${DB_TLS_KEY_FILE}" ]] || [[ -z "${DB_TLS_CA_FILE}" ]]; then - print_validation_error "The TLS cert file, key and CA are required when TLS is enabled. Set the environment variables TLS_CERT_FILE, TLS_KEY_FILE and TLS_CA_FILE with the path to each file." - fi - if [[ ! -f "${DB_TLS_CERT_FILE}" ]]; then - print_validation_error "The TLS_CERT file ${DB_TLS_CERT_FILE} must exist." - fi - if [[ ! -f "${DB_TLS_KEY_FILE}" ]]; then - print_validation_error "The TLS_KEY file ${DB_TLS_KEY_FILE} must exist." - fi - if [[ ! -f "${DB_TLS_CA_FILE}" ]]; then - print_validation_error "The TLS_CA file ${DB_TLS_CA_FILE} must exist." - fi - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Persisted data detected. Restoring" - - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - if is_boolean_yes "$DB_GALERA_FORCE_SAFETOBOOTSTRAP"; then - set_safe_to_bootstrap - fi - if ! is_safe_to_bootstrap; then - error "It is not safe to bootstrap form this node ('safe_to_bootstrap=0' is set in 'grastate.dat'). If you want to force bootstrap, set the environment variable MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP=yes" - exit 1 - fi - fi - - return - else - # initialization should not be performed on non-primary nodes of a galera cluster - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - mariadb_install_db - mysql_start_bg - debug "Deleting all users to avoid issues with galera configuration" - mysql_execute "mysql" </dev/null - hostname - fi -} - -######################## -# Check for user override of wsrep_node_address -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# String with node address -######################### -get_node_address() { - if [[ -n "$DB_GALERA_NODE_ADDRESS" ]]; then - echo "$DB_GALERA_NODE_ADDRESS" - else - # In some environments, the network may not be fully set up when starting the initialization - # So, to avoid issues, we retry the 'hostname' command until it succeeds (for a few minutes) - local -r retries="60" - local -r seconds="5" - retry_while "hostname -i" "$retries" "$seconds" >/dev/null - # prefer IPv6 over IPv4 if available - # This works by pulling any IPv4 addresses encountered into hold space and emitting it only when the EOF line is encountered - printf '%s\nEOF' "$(hostname -i | tr ' ' '\n')" | sed '/:/{;q;};/^EOF$/{;g;q;};h;d' - fi -} - -######################## -# Starts MySQL/MariaDB in the background and waits until it's ready -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_start_bg() { - local -a flags=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") - - # Only allow local connections until MySQL is fully initialized, to avoid apps trying to connect to MySQL before it is fully initialized - flags+=("--bind-address=127.0.0.1") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - - # Do not start as root, to avoid permission issues - am_i_root && flags+=("--user=${DB_DAEMON_USER}") - - # The slave should only start in 'run.sh', elseways user credentials would be needed for any connection - flags+=("--skip-slave-start") - flags+=("$@") - - is_mysql_running && return - - info "Starting $DB_FLAVOR in background" - debug_execute "${DB_SBIN_DIR}/mysqld" "${flags[@]}" & - - # we cannot use wait_for_mysql_access here as mysql_upgrade for MySQL >=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Wait for WSREP to be ready. If WSREP is not ready, we cannot do any transactions, thus cannot - # create any users, and WSREP instantly kills MariaDB if doing so - wait_for_wsrep - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Wait for WSREP to be ready to do transactions -# Arguments: -# None -# Returns: -# None -######################## -wait_for_wsrep() { - local -r retries=300 - local -r sleep_time=2 - if ! retry_while is_wsrep_ready "$retries" "$sleep_time"; then - error "WSREP did not become ready" - return 1 - fi -} - -######################## -# Checks for WSREP to be ready to do transactions -# Arguments: -# None -# Returns: -# Boolean -######################## -is_wsrep_ready() { - debug "Checking if WSREP is ready" - is_ready="$(mysql_execute_print_output "mysql" "root" <> "$custom_conf_file" - cat "$old_custom_conf_file" >> "$custom_conf_file" - fi - if am_i_root; then - [[ -e "$DB_VOLUME_DIR/.initialized" ]] && rm "$DB_VOLUME_DIR/.initialized" - rm -rf "$DB_VOLUME_DIR/conf" - else - warn "Old custom configuration migrated, please manually remove the 'conf' directory from the volume use to persist data" - fi -} - -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - local mysql_create_user_cmd - [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.4, the mysql.user table was replaced with a view: https://mariadb.com/kb/en/mysqluser-table/ - # Views have a definer user, in this case set to 'root', which needs to exist for the view to work - # In MySQL, to avoid issues when renaming the root user, they use the 'mysql.sys' user as a definer: https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html - # However, for MariaDB that is not the case, so when the 'root' user is renamed the 'mysql.user' table stops working and the view needs to be fixed - if [[ "$user" != "root" && ! "$(mysql_get_version)" =~ ^10.[0123]. ]]; then - alter_view_str="$(mysql_execute_print_output "mysql" "$user" "$password" "-s" <&2 - return 1 - ;; - esac - shift - done - - local -a mysql_execute_cmd=("mysql_execute") - [[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - - local -a create_database_args=() - [[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'") - [[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'") - - debug "Creating database $database" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$user") - [[ -n "$db_host" ]] && flags+=("--host" "${db_host}") - [[ -n "$db_port" ]] && flags+=("--port" "${db_port}") - if is_boolean_yes "$use_ldap"; then - flags+=("--use-ldap") - elif [[ -n "$password" ]]; then - flags+=("-p" "$password") - [[ -n "$auth_plugin" ]] && flags=("${flags[@]}" "--auth-plugin" "$auth_plugin") - fi - mysql_ensure_user_exists "${flags[@]}" -} - -######################## -# Optionally create the given database, and then optionally give a user -# full privileges on the database. -# Flags: -# -u|--user - database user -# --character-set - character set -# --collation - collation -# --host - database host -# --port - database port -# Arguments: -# $1 - database name -# Returns: -# None -######################### -mysql_ensure_optional_database_exists() { - local -r database="${1:?database is missing}" - local character_set="" - local collate="" - local user="" - local privileges="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - --character-set) - shift - character_set="${1:?missing character set}" - ;; - --collate) - shift - collate="${1:?missing collate}" - ;; - -u|--user) - shift - user="${1:?missing database user}" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - --privileges) - shift - privileges="${1:?missing privileges}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$database") - [[ -n "$character_set" ]] && flags+=("--character-set" "$character_set") - [[ -n "$collate" ]] && flags+=("--collate" "$collate") - [[ -n "$db_host" ]] && flags+=("--host" "$db_host") - [[ -n "$db_port" ]] && flags+=("--port" "$db_port") - mysql_ensure_database_exists "${flags[@]}" - - if [[ -n "$user" ]]; then - mysql_ensure_user_has_database_privileges "$user" "$database" "$privileges" "$db_host" "$db_port" - fi -} - -######################## -# Add or modify an entry in the MySQL configuration file ("$DB_CONF_FILE") -# Globals: -# DB_* -# Arguments: -# $1 - MySQL variable name -# $2 - Value to assign to the MySQL variable -# $3 - Section in the MySQL configuration file the key is located (default: mysqld) -# $4 - Configuration file (default: "$BD_CONF_FILE") -# Returns: -# None -######################### -mysql_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - read -r -a sections <<<"${3:-mysqld}" - local -r ignore_inline_comments="${4:-no}" - local -r file="${5:-"$DB_CONF_FILE"}" - info "Setting ${key} option" - debug "Setting ${key} to '${value}' in ${DB_FLAVOR} configuration file ${file}" - # Check if the configuration exists in the file - for section in "${sections[@]}"; do - if is_boolean_yes "$ignore_inline_comments"; then - ini-file set --ignore-inline-comments --section "$section" --key "$key" --value "$value" "$file" - else - ini-file set --section "$section" --key "$key" --value "$value" "$file" - fi - done -} - -######################## -# Update MySQL/MariaDB configuration file with user custom inputs -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_update_custom_config() { - # Persisted configuration files from old versions - ! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration - - # User injected custom configuration - if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then - debug "Injecting custom configuration from my_custom.conf" - cat "$DB_CONF_DIR/my_custom.cnf" > "$DB_CONF_DIR/bitnami/my_custom.cnf" - fi - - ! is_empty_value "$DB_USER" && mysql_conf_set "user" "$DB_USER" "mysqladmin" - ! is_empty_value "$DB_PORT_NUMBER" && mysql_conf_set "port" "$DB_PORT_NUMBER" "mysqld client manager" - ! is_empty_value "$DB_CHARACTER_SET" && mysql_conf_set "character_set_server" "$DB_CHARACTER_SET" - ! is_empty_value "$DB_COLLATE" && mysql_conf_set "collation_server" "$DB_COLLATE" - ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" - ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" - ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" - ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" - ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=( "/usr/lib" "/usr/lib64" ) - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} - -######################## -# Execute a reliable health check against the current mysql instance -# Globals: -# DB_ROOT_USER, DB_ROOT_PASSWORD, DB_MASTER_ROOT_PASSWORD -# Arguments: -# None -# Returns: -# mysqladmin output -######################### -mysql_healthcheck() { - local args=("-u${DB_ROOT_USER}" "-h0.0.0.0") - local root_password - - root_password="$(get_master_env_var_value ROOT_PASSWORD)" - if [[ -n "$root_password" ]]; then - args+=("-p${root_password}") - fi - - mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status -} - -######################## -# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# mysql client flavor -######################### -mysql_client_flavor() { - if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then - echo "mariadb" - else - echo "mysql" - fi -} - -######################## -# Prints extra options for MySQL client calls (i.e. SSL options) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# List of options to pass to "mysql" CLI -######################### -mysql_client_extra_opts() { - # Helper to get the proper value for the MySQL client environment variable - mysql_client_env_value() { - local env_name="MYSQL_CLIENT_${1:?missing name}" - if [[ -n "${!env_name:-}" ]]; then - echo "${!env_name:-}" - else - env_name="DB_CLIENT_${1}" - echo "${!env_name:-}" - fi - } - local -a opts=() - local key value - if is_boolean_yes "${DB_ENABLE_SSL:-no}"; then - if [[ "$(mysql_client_flavor)" = "mysql" ]]; then - opts+=("--ssl-mode=REQUIRED") - else - opts+=("--ssl=TRUE") - fi - # Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined - for key in ca key cert; do - value="$(mysql_client_env_value "SSL_${key^^}_FILE")" - [[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}") - done - else - # Skip SSL validation - if [[ "$(mysql_client_flavor)" = "mariadb" ]]; then - # SSL connections are enabled by default in MariaDB >=10.11 - local mysql_version="" - local major_version="" - local minor_version="" - mysql_version="$(mysql_get_version)" - major_version="$(get_sematic_version "${mysql_version}" 1)" - minor_version="$(get_sematic_version "${mysql_version}" 2)" - if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then - opts+=("--skip-ssl") - fi - fi - fi - echo "${opts[@]:-}" -} diff --git a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh b/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh deleted file mode 100644 index 54c504fe8d2c8..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh +++ /dev/null @@ -1,264 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for mariadb - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-mariadb}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -mariadb_env_vars=( - ALLOW_EMPTY_PASSWORD - MARIADB_AUTHENTICATION_PLUGIN - MARIADB_ROOT_USER - MARIADB_ROOT_PASSWORD - MARIADB_USER - MARIADB_PASSWORD - MARIADB_DATABASE - MARIADB_MASTER_HOST - MARIADB_MASTER_PORT_NUMBER - MARIADB_MASTER_ROOT_USER - MARIADB_MASTER_ROOT_PASSWORD - MARIADB_MASTER_DELAY - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - MARIADB_PORT_NUMBER - MARIADB_REPLICATION_MODE - MARIADB_REPLICATION_SLAVE_DUMP - MARIADB_EXTRA_FLAGS - MARIADB_INIT_SLEEP_TIME - MARIADB_CHARACTER_SET - MARIADB_COLLATE - MARIADB_BIND_ADDRESS - MARIADB_SQL_MODE - MARIADB_UPGRADE - MARIADB_SKIP_TEST_DB - MARIADB_CLIENT_ENABLE_SSL - MARIADB_CLIENT_SSL_CA_FILE - MARIADB_CLIENT_SSL_CERT_FILE - MARIADB_CLIENT_SSL_KEY_FILE - MARIADB_CLIENT_EXTRA_FLAGS - MARIADB_STARTUP_WAIT_RETRIES - MARIADB_STARTUP_WAIT_SLEEP_TIME - MARIADB_ENABLE_SLOW_QUERY - MARIADB_LONG_QUERY_TIME - MARIADB_GALERA_CONF_DIR - MARIADB_GALERA_MOUNTED_CONF_DIR - MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP - MARIADB_GALERA_CLUSTER_BOOTSTRAP - MARIADB_GALERA_CLUSTER_ADDRESS - MARIADB_GALERA_CLUSTER_NAME - MARIADB_GALERA_NODE_NAME - MARIADB_GALERA_NODE_ADDRESS - MARIADB_GALERA_SST_METHOD - MARIADB_GALERA_MARIABACKUP_USER - MARIADB_GALERA_MARIABACKUP_PASSWORD - MARIADB_ENABLE_LDAP - MARIADB_ENABLE_TLS - MARIADB_TLS_CERT_FILE - MARIADB_TLS_KEY_FILE - MARIADB_TLS_CA_FILE - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - DB_ENABLE_SLOW_QUERY - DB_LONG_QUERY_TIME -) -for env_var in "${mariadb_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset mariadb_env_vars -export DB_FLAVOR="mariadb" - -# Paths -export DB_BASE_DIR="${BITNAMI_ROOT_DIR}/mariadb" -export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" -export DB_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_SBIN_DIR="${DB_BASE_DIR}/sbin" -export DB_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_LOGS_DIR="${DB_BASE_DIR}/logs" -export DB_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_CONF_FILE="${DB_CONF_DIR}/my.cnf" -export DB_PID_FILE="${DB_TMP_DIR}/mysqld.pid" -export DB_SOCKET_FILE="${DB_TMP_DIR}/mysql.sock" -export PATH="${DB_SBIN_DIR}:${DB_BIN_DIR}:/opt/bitnami/common/bin:${PATH}" - -# System users (when running with a privileged user) -export DB_DAEMON_USER="mysql" -export DB_DAEMON_GROUP="mysql" - -# Default configuration (build-time) -export MARIADB_DEFAULT_PORT_NUMBER="3306" -export DB_DEFAULT_PORT_NUMBER="$MARIADB_DEFAULT_PORT_NUMBER" # only used at build time -export MARIADB_DEFAULT_CHARACTER_SET="utf8mb4" -export DB_DEFAULT_CHARACTER_SET="$MARIADB_DEFAULT_CHARACTER_SET" # only used at build time -export MARIADB_DEFAULT_BIND_ADDRESS="0.0.0.0" -export DB_DEFAULT_BIND_ADDRESS="$MARIADB_DEFAULT_BIND_ADDRESS" # only used at build time - -# MariaDB Galera authentication. -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export MARIADB_AUTHENTICATION_PLUGIN="${MARIADB_AUTHENTICATION_PLUGIN:-}" -export DB_AUTHENTICATION_PLUGIN="$MARIADB_AUTHENTICATION_PLUGIN" -export MARIADB_ROOT_USER="${MARIADB_ROOT_USER:-root}" -export DB_ROOT_USER="$MARIADB_ROOT_USER" # only used during the first initialization -export MARIADB_ROOT_PASSWORD="${MARIADB_ROOT_PASSWORD:-}" -export DB_ROOT_PASSWORD="$MARIADB_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_USER="${MARIADB_USER:-}" -export DB_USER="$MARIADB_USER" # only used during the first initialization -export MARIADB_PASSWORD="${MARIADB_PASSWORD:-}" -export DB_PASSWORD="$MARIADB_PASSWORD" # only used during the first initialization -export MARIADB_DATABASE="${MARIADB_DATABASE:-}" -export DB_DATABASE="$MARIADB_DATABASE" # only used during the first initialization -export MARIADB_MASTER_HOST="${MARIADB_MASTER_HOST:-}" -export DB_MASTER_HOST="$MARIADB_MASTER_HOST" # only used during the first initialization -export MARIADB_MASTER_PORT_NUMBER="${MARIADB_MASTER_PORT_NUMBER:-3306}" -export DB_MASTER_PORT_NUMBER="$MARIADB_MASTER_PORT_NUMBER" # only used during the first initialization -export MARIADB_MASTER_ROOT_USER="${MARIADB_MASTER_ROOT_USER:-root}" -export DB_MASTER_ROOT_USER="$MARIADB_MASTER_ROOT_USER" # only used during the first initialization -export MARIADB_MASTER_ROOT_PASSWORD="${MARIADB_MASTER_ROOT_PASSWORD:-}" -export DB_MASTER_ROOT_PASSWORD="$MARIADB_MASTER_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_MASTER_DELAY="${MARIADB_MASTER_DELAY:-0}" -export DB_MASTER_DELAY="$MARIADB_MASTER_DELAY" # only used during the first initialization -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Settings -export MARIADB_PORT_NUMBER="${MARIADB_PORT_NUMBER:-}" -export DB_PORT_NUMBER="$MARIADB_PORT_NUMBER" -export MARIADB_REPLICATION_MODE="${MARIADB_REPLICATION_MODE:-}" -export DB_REPLICATION_MODE="$MARIADB_REPLICATION_MODE" -export MARIADB_REPLICATION_SLAVE_DUMP="${MARIADB_REPLICATION_SLAVE_DUMP:-false}" -export DB_REPLICATION_SLAVE_DUMP="$MARIADB_REPLICATION_SLAVE_DUMP" -export MARIADB_EXTRA_FLAGS="${MARIADB_EXTRA_FLAGS:-}" -export DB_EXTRA_FLAGS="$MARIADB_EXTRA_FLAGS" -export MARIADB_INIT_SLEEP_TIME="${MARIADB_INIT_SLEEP_TIME:-}" -export DB_INIT_SLEEP_TIME="$MARIADB_INIT_SLEEP_TIME" -export MARIADB_CHARACTER_SET="${MARIADB_CHARACTER_SET:-}" -export DB_CHARACTER_SET="$MARIADB_CHARACTER_SET" -# MARIADB_COLLATION is deprecated in favor of MARIADB_COLLATE -MARIADB_COLLATE="${MARIADB_COLLATE:-"${MARIADB_COLLATION:-}"}" -export MARIADB_COLLATE="${MARIADB_COLLATE:-}" -export DB_COLLATE="$MARIADB_COLLATE" -export MARIADB_BIND_ADDRESS="${MARIADB_BIND_ADDRESS:-}" -export DB_BIND_ADDRESS="$MARIADB_BIND_ADDRESS" -export MARIADB_SQL_MODE="${MARIADB_SQL_MODE:-}" -export DB_SQL_MODE="$MARIADB_SQL_MODE" -export MARIADB_UPGRADE="${MARIADB_UPGRADE:-AUTO}" -export DB_UPGRADE="$MARIADB_UPGRADE" -export MARIADB_SKIP_TEST_DB="${MARIADB_SKIP_TEST_DB:-no}" -export DB_SKIP_TEST_DB="$MARIADB_SKIP_TEST_DB" -export MARIADB_CLIENT_ENABLE_SSL="${MARIADB_CLIENT_ENABLE_SSL:-no}" -export DB_CLIENT_ENABLE_SSL="$MARIADB_CLIENT_ENABLE_SSL" -export MARIADB_CLIENT_SSL_CA_FILE="${MARIADB_CLIENT_SSL_CA_FILE:-}" -export DB_CLIENT_SSL_CA_FILE="$MARIADB_CLIENT_SSL_CA_FILE" -export MARIADB_CLIENT_SSL_CERT_FILE="${MARIADB_CLIENT_SSL_CERT_FILE:-}" -export DB_CLIENT_SSL_CERT_FILE="$MARIADB_CLIENT_SSL_CERT_FILE" -export MARIADB_CLIENT_SSL_KEY_FILE="${MARIADB_CLIENT_SSL_KEY_FILE:-}" -export DB_CLIENT_SSL_KEY_FILE="$MARIADB_CLIENT_SSL_KEY_FILE" -export MARIADB_CLIENT_EXTRA_FLAGS="${MARIADB_CLIENT_EXTRA_FLAGS:-no}" -export DB_CLIENT_EXTRA_FLAGS="$MARIADB_CLIENT_EXTRA_FLAGS" -export MARIADB_STARTUP_WAIT_RETRIES="${MARIADB_STARTUP_WAIT_RETRIES:-300}" -export DB_STARTUP_WAIT_RETRIES="$MARIADB_STARTUP_WAIT_RETRIES" -export MARIADB_STARTUP_WAIT_SLEEP_TIME="${MARIADB_STARTUP_WAIT_SLEEP_TIME:-2}" -export DB_STARTUP_WAIT_SLEEP_TIME="$MARIADB_STARTUP_WAIT_SLEEP_TIME" -MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-"${DB_ENABLE_SLOW_QUERY:-}"}" -export MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-0}" -export DB_ENABLE_SLOW_QUERY="$MARIADB_ENABLE_SLOW_QUERY" -MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-"${DB_LONG_QUERY_TIME:-}"}" -export MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-10.0}" -export DB_LONG_QUERY_TIME="$MARIADB_LONG_QUERY_TIME" - -# Galera paths -export MARIADB_GALERA_GRASTATE_FILE="${DB_DATA_DIR}/grastate.dat" -export DB_GALERA_GRASTATE_FILE="$MARIADB_GALERA_GRASTATE_FILE" -export MARIADB_GALERA_BOOTSTRAP_DIR="${DB_VOLUME_DIR}/.bootstrap" -export DB_GALERA_BOOTSTRAP_DIR="$MARIADB_GALERA_BOOTSTRAP_DIR" -export MARIADB_GALERA_BOOTSTRAP_FILE="${DB_GALERA_BOOTSTRAP_DIR}/done" -export DB_GALERA_BOOTSTRAP_FILE="$MARIADB_GALERA_BOOTSTRAP_FILE" - -# Galera build-time defaults for cluster configuration -export MARIADB_GALERA_DEFAULT_CLUSTER_ADDRESS="gcomm://" -export DB_GALERA_DEFAULT_CLUSTER_ADDRESS="$MARIADB_GALERA_DEFAULT_CLUSTER_ADDRESS" -export MARIADB_GALERA_DEFAULT_CLUSTER_NAME="galera" -export DB_GALERA_DEFAULT_CLUSTER_NAME="$MARIADB_GALERA_DEFAULT_CLUSTER_NAME" -export MARIADB_GALERA_DEFAULT_NODE_NAME="" -export DB_GALERA_DEFAULT_NODE_NAME="$MARIADB_GALERA_DEFAULT_NODE_NAME" -export MARIADB_GALERA_DEFAULT_NODE_ADDRESS="" -export DB_GALERA_DEFAULT_NODE_ADDRESS="$MARIADB_GALERA_DEFAULT_NODE_ADDRESS" -export MARIADB_GALERA_DEFAULT_SST_METHOD="mariabackup" -export DB_GALERA_DEFAULT_SST_METHOD="$MARIADB_GALERA_DEFAULT_SST_METHOD" -export MARIADB_GALERA_DEFAULT_MARIABACKUP_USER="mariabackup" -export DB_GALERA_DEFAULT_MARIABACKUP_USER="$MARIADB_GALERA_DEFAULT_MARIABACKUP_USER" -export MARIADB_GALERA_DEFAULT_MARIABACKUP_PASSWORD="" -export DB_GALERA_DEFAULT_MARIABACKUP_PASSWORD="$MARIADB_GALERA_DEFAULT_MARIABACKUP_PASSWORD" - -# Galera cluster configuration. -export MARIADB_GALERA_CONF_DIR="${MARIADB_GALERA_CONF_DIR:-/opt/bitnami/mariadb/conf}" -export DB_GALERA_CONF_DIR="$MARIADB_GALERA_CONF_DIR" -export MARIADB_GALERA_MOUNTED_CONF_DIR="${MARIADB_GALERA_MOUNTED_CONF_DIR:-/bitnami/conf}" -export DB_GALERA_MOUNTED_CONF_DIR="$MARIADB_GALERA_MOUNTED_CONF_DIR" -export MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP="${MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP:-}" -export DB_GALERA_FORCE_SAFETOBOOTSTRAP="$MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP" -export MARIADB_GALERA_CLUSTER_BOOTSTRAP="${MARIADB_GALERA_CLUSTER_BOOTSTRAP:-}" -export DB_GALERA_CLUSTER_BOOTSTRAP="$MARIADB_GALERA_CLUSTER_BOOTSTRAP" -export MARIADB_GALERA_CLUSTER_ADDRESS="${MARIADB_GALERA_CLUSTER_ADDRESS:-}" -export DB_GALERA_CLUSTER_ADDRESS="$MARIADB_GALERA_CLUSTER_ADDRESS" -export MARIADB_GALERA_CLUSTER_NAME="${MARIADB_GALERA_CLUSTER_NAME:-$DB_GALERA_DEFAULT_CLUSTER_NAME}" -export DB_GALERA_CLUSTER_NAME="$MARIADB_GALERA_CLUSTER_NAME" -export MARIADB_GALERA_NODE_NAME="${MARIADB_GALERA_NODE_NAME:-}" -export DB_GALERA_NODE_NAME="$MARIADB_GALERA_NODE_NAME" -export MARIADB_GALERA_NODE_ADDRESS="${MARIADB_GALERA_NODE_ADDRESS:-}" -export DB_GALERA_NODE_ADDRESS="$MARIADB_GALERA_NODE_ADDRESS" -export MARIADB_GALERA_SST_METHOD="${MARIADB_GALERA_SST_METHOD:-$DB_GALERA_DEFAULT_SST_METHOD}" -export DB_GALERA_SST_METHOD="$MARIADB_GALERA_SST_METHOD" -export MARIADB_GALERA_MARIABACKUP_USER="${MARIADB_GALERA_MARIABACKUP_USER:-$DB_GALERA_DEFAULT_MARIABACKUP_USER}" -export DB_GALERA_MARIABACKUP_USER="$MARIADB_GALERA_MARIABACKUP_USER" -export MARIADB_GALERA_MARIABACKUP_PASSWORD="${MARIADB_GALERA_MARIABACKUP_PASSWORD:-$DB_GALERA_DEFAULT_MARIABACKUP_PASSWORD}" -export DB_GALERA_MARIABACKUP_PASSWORD="$MARIADB_GALERA_MARIABACKUP_PASSWORD" - -# LDAP -export MARIADB_ENABLE_LDAP="${MARIADB_ENABLE_LDAP:-no}" -export DB_ENABLE_LDAP="$MARIADB_ENABLE_LDAP" - -# SSL/TLS configuration -export MARIADB_ENABLE_TLS="${MARIADB_ENABLE_TLS:-no}" -export DB_ENABLE_TLS="$MARIADB_ENABLE_TLS" -export MARIADB_TLS_CERT_FILE="${MARIADB_TLS_CERT_FILE:-}" -export DB_TLS_CERT_FILE="$MARIADB_TLS_CERT_FILE" -export MARIADB_TLS_KEY_FILE="${MARIADB_TLS_KEY_FILE:-}" -export DB_TLS_KEY_FILE="$MARIADB_TLS_KEY_FILE" -export MARIADB_TLS_CA_FILE="${MARIADB_TLS_CA_FILE:-}" -export DB_TLS_CA_FILE="$MARIADB_TLS_CA_FILE" -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-monitor}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-monitor}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Custom environment variables may be defined below diff --git a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh b/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh deleted file mode 100755 index ec7e80256766f..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/mariadb/conf) -debug "Copying files from $DB_DEFAULT_CONF_DIR to $DB_CONF_DIR" -cp -nr "$DB_DEFAULT_CONF_DIR"/. "$DB_CONF_DIR" - -print_welcome_page - -if [[ "$1" = "/opt/bitnami/scripts/mariadb-galera/run.sh" ]]; then - info "** Starting MariaDB setup **" - /opt/bitnami/scripts/mariadb-galera/setup.sh - info "** MariaDB setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh b/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh deleted file mode 100755 index 8bd30f5f8ae49..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -mysql_healthcheck diff --git a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh b/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh deleted file mode 100755 index 503f456f66f0d..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libldapclient.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# Configure MariaDB options based on build-time defaults -info "Configuring default MariaDB options" -ensure_dir_exists "$DB_CONF_DIR" -mysql_create_default_config - -for dir in "$DB_TMP_DIR" "$DB_LOGS_DIR" "$DB_CONF_DIR" "$DB_DEFAULT_CONF_DIR" "${DB_CONF_DIR}/bitnami" "$DB_VOLUME_DIR" "$DB_DATA_DIR" "$DB_GALERA_BOOTSTRAP_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# LDAP permissions -ldap_configure_permissions -ldap_create_pam_config "mariadb" - -# Fix to avoid issues detecting plugins in mysql_install_db -ln -sf "$DB_BASE_DIR/plugin" "$DB_BASE_DIR/lib/plugin" - -# Redirect all logging to stdout -ln -sf /dev/stdout "$DB_LOGS_DIR/mysqld.log" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${DB_CONF_DIR}/"* "$DB_DEFAULT_CONF_DIR" diff --git a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh b/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh deleted file mode 100755 index 69b8d4496908b..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libldapclient.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# mysqld_safe does not allow logging to stdout/stderr, so we stick with mysqld -EXEC="${DB_SBIN_DIR}/mysqld" - -flags=("--defaults-file=${DB_CONF_DIR}/my.cnf" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") -[[ -z "${DB_PID_FILE:-}" ]] || flags+=("--pid-file=${DB_PID_FILE}") - -# Add flags specified via the 'DB_EXTRA_FLAGS' environment variable -read -r -a db_extra_flags <<< "$(mysql_extra_flags)" -[[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - -# Add flags passed to this script -flags+=("$@") - -# Fix for MDEV-16183 - mysqld_safe already does this, but we are using mysqld -LD_PRELOAD="$(find_jemalloc_lib)${LD_PRELOAD:+ "$LD_PRELOAD"}" -export LD_PRELOAD - -is_boolean_yes "$DB_ENABLE_LDAP" && ldap_start_nslcd_bg - -info "** Starting MariaDB **" - -set_previous_boot - -if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "$EXEC" "${flags[@]}" -else - exec "$EXEC" "${flags[@]}" -fi diff --git a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh b/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh deleted file mode 100755 index 77c9f7d5d1a97..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadbgalera.sh -. /opt/bitnami/scripts/libldapclient.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# Ensure mysql unix socket file does not exist -rm -rf "${DB_SOCKET_FILE}.lock" -# Ensure MariaDB environment variables settings are valid -mysql_validate -# Ensure MariaDB is stopped when this script ends. -trap "mysql_stop" EXIT -if am_i_root; then - # Ensure 'daemon' user exists when running as 'root' - ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" - # Ensure 'nslcd' user exists when running as 'root' - ensure_user_exists "$LDAP_NSLCD_USER" --group "$LDAP_NSLCD_GROUP" - # Fix logging issue when running as root - chmod o+w "$(readlink /dev/stdout)" -fi -# Ensure MariaDB is initialized -mysql_initialize -# Ensure LDAP is initialized -is_boolean_yes "$DB_ENABLE_LDAP" && ldap_initialize -# Allow running custom initialization scripts -mysql_custom_scripts 'init' -# Allow running custom start scripts -mysql_custom_scripts 'start' -# Stop MariaDB before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -mysql_stop diff --git a/bitnami/mariadb-galera/10.5/debian-12/tags-info.yaml b/bitnami/mariadb-galera/10.5/debian-12/tags-info.yaml deleted file mode 100644 index 49a4df04ab42b..0000000000000 --- a/bitnami/mariadb-galera/10.5/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "10.5" -- 10.5-debian-12 -- 10.5.27 diff --git a/bitnami/mariadb-galera/10.6/README.md b/bitnami/mariadb-galera/10.6/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/mariadb-galera/10.6/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/mariadb-galera/10.6/debian-12/Dockerfile b/bitnami/mariadb-galera/10.6/debian-12/Dockerfile deleted file mode 100644 index b661242cd417b..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T15:52:56Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="10.6.20-debian-12-r3" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera" \ - org.opencontainers.image.title="mariadb-galera" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="10.6.20" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl iproute2 ldap-utils libaio1 libaudit1 libcap-ng0 libcrypt1 libgcc-s1 libicu72 libldap-common liblzma5 libncurses6 libpam-ldapd libpam0g libssl3 libstdc++6 libtinfo6 libxml2 nslcd procps psmisc rsync socat zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "ini-file-1.4.7-7-linux-${OS_ARCH}-debian-12" \ - "mariadb-galera-10.6.20-2-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir /docker-entrypoint-initdb.d - -COPY rootfs / -RUN /opt/bitnami/scripts/mariadb-galera/postunpack.sh -ENV APP_VERSION="10.6.20" \ - BITNAMI_APP_NAME="mariadb-galera" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/common/sbin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:$PATH" - -EXPOSE 3306 4444 4567 4568 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/mariadb-galera/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/mariadb-galera/run.sh" ] diff --git a/bitnami/mariadb-galera/10.6/debian-12/docker-compose-ldap.yml b/bitnami/mariadb-galera/10.6/debian-12/docker-compose-ldap.yml deleted file mode 100644 index bff23148c30b4..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/docker-compose-ldap.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-galera: - image: docker.io/bitnami/mariadb-galera:10.6 - ports: - - '3306:3306' - - '4444:4444' - - '4567:4567' - - '4568:4568' - volumes: - - 'mariadb_galera_data:/bitnami/mariadb' - environment: - - MARIADB_ROOT_PASSWORD=root-password - - MARIADB_GALERA_MARIABACKUP_PASSWORD=backup-password - - MARIADB_USER=user01 - - MARIADB_DATABASE=my_database - - MARIADB_GALERA_CLUSTER_ADDRESS=gcomm:// - - MARIADB_ENABLE_LDAP=yes - - LDAP_URI=ldap://openldap:1389 - - LDAP_BASE=dc=example,dc=org - - LDAP_BIND_DN=cn=admin,dc=example,dc=org - - LDAP_BIND_PASSWORD=adminpassword - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb-galera/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - - openldap: - image: 'docker.io/bitnami/openldap:latest' - ports: - - '1389:1389' - environment: - - LDAP_ADMIN_USERNAME=admin - - LDAP_ADMIN_PASSWORD=adminpassword - - LDAP_USERS=user01 - - LDAP_PASSWORDS=password1 - volumes: - - 'openldap_data:/bitnami/openldap' - -volumes: - mariadb_galera_data: - driver: local - openldap_data: - driver: local diff --git a/bitnami/mariadb-galera/10.6/debian-12/docker-compose.yml b/bitnami/mariadb-galera/10.6/debian-12/docker-compose.yml deleted file mode 100644 index e7a956a056a74..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/docker-compose.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-galera: - image: docker.io/bitnami/mariadb-galera:10.6 - ports: - - '3306:3306' - - '4444:4444' - - '4567:4567' - - '4568:4568' - volumes: - - 'mariadb_galera_data:/bitnami/mariadb' - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_GALERA_CLUSTER_ADDRESS=gcomm:// - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb-galera/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_galera_data: - driver: local diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 29be26e4c6d2b..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ini-file": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.4.7-7" - }, - "mariadb-galera": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "10.6.20-2" - } -} \ No newline at end of file diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh b/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh deleted file mode 100644 index fa50716cf1ff9..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh +++ /dev/null @@ -1,222 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami LDAP library - -# shellcheck disable=SC1090,SC1091 - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -######################## -# Loads global variables used on LDAP configuration. -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# Series of exports to be used as 'eval' arguments -######################### -ldap_env() { - cat <<"EOF" -export LDAP_NSLCD_USER="nslcd" -export LDAP_URI="${LDAP_URI:-}" -export LDAP_BASE="${LDAP_BASE:-}" -export LDAP_BIND_DN="${LDAP_BIND_DN:-}" -export LDAP_BIND_PASSWORD="${LDAP_BIND_PASSWORD:-}" -export LDAP_BASE_LOOKUP="${LDAP_BASE_LOOKUP:-}" -export LDAP_NSS_INITGROUPS_IGNOREUSERS="${LDAP_NSS_INITGROUPS_IGNOREUSERS:-root,nslcd}" -export LDAP_SCOPE="${LDAP_SCOPE:-}" -export LDAP_TLS_REQCERT="${LDAP_TLS_REQCERT:-}" -export LDAP_SEARCH_FILTER="${LDAP_SEARCH_FILTER:-}" -export LDAP_SEARCH_MAP="${LDAP_SEARCH_MAP:-}" - -EOF - if [[ "$OS_FLAVOUR" =~ ^debian-.*$ ]]; then - cat <<"EOF" -export LDAP_NSLCD_GROUP="nslcd" -EOF - elif [[ "$OS_FLAVOUR" =~ ^(photon)-.*$ ]]; then - cat <<"EOF" -export LDAP_NSLCD_GROUP="ldap" -EOF - fi -} - -######################## -# Return LDAP config file path depending on distro -# Globals: -# OS_FLAVOUR -# Arguments: -# None -# Returns: -# (String) LDAP config file path -######################### -ldap_openldap_config_path() { - local openldap_config - case "$OS_FLAVOUR" in - debian-* | ubuntu-*) openldap_config=/etc/ldap/ldap.conf ;; - photon-* | redhatubi-*) openldap_config=/etc/openldap/ldap.conf ;; - *) error "Unsupported OS flavor ${OS_FLAVOUR}" && exit 1 ;; - esac - echo "$openldap_config" -} - -######################## -# Configure LDAP permissions (to be used at postunpack leve). -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# None -######################### -ldap_configure_permissions() { - ensure_dir_exists "/var/run/nslcd" && configure_permissions_ownership "/var/run/nslcd" -u "root" -g "root" -d "775" - # The nslcd.conf file may not exist in distros like UBI, so we need to create it first - touch "/etc/nslcd.conf" - configure_permissions_ownership "/etc/nslcd.conf" -u "root" -g "root" -f "660" - configure_permissions_ownership "$(ldap_openldap_config_path)" -u "root" -g "root" -f "660" -} - -######################## -# Create nslcd.conf file -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# None -######################### -ldap_create_nslcd_config() { - if am_i_root; then - chown "root:${LDAP_NSLCD_GROUP}" "/etc/nslcd.conf" - chown -R "${LDAP_NSLCD_USER}:${LDAP_NSLCD_GROUP}" "/var/run/nslcd" - cat >"/etc/nslcd.conf" <"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"$(ldap_openldap_config_path)" <"/etc/pam.d/${filename}" < 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - elif [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - if [[ -z "$DB_MASTER_HOST" ]]; then - print_validation_error "Slave replication mode chosen without setting the environment variable $(get_env_var MASTER_HOST). Use it to indicate where the Master node is running" - fi - else - print_validation_error "Invalid replication mode. Available options are 'master/slave'" - fi - else - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ "$DB_USER" = "root" ]]; then - print_validation_error "root user is already created in the database and you can't use it as username for user creation." - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - if [[ "${DB_REPLICATION_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "$dump_file" - debug "Finish dump databases" - - debug "Unlock master databases for write operations" - echo "UNLOCK TABLES;" | mysql_remote_execute "$DB_MASTER_HOST" "$DB_MASTER_PORT_NUMBER" "mysql" "$DB_MASTER_ROOT_USER" "$DB_MASTER_ROOT_PASSWORD" - - debug "Start import dump databases" - mysql_execute < "$dump_file" - mysql_execute "mysql" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - if ! grep --silent "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" "${DB_CONF_FILE}"; then - echo "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" >> "${DB_CONF_FILE}" - fi - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Using persisted data" - # mysql_upgrade requires the server to be running - [[ -n "$(get_master_env_var_value ROOT_PASSWORD)" ]] && export ROOT_AUTH_ENABLED="yes" - # https://dev.mysql.com/doc/refman/8.0/en/replication-upgrade.html - mariadb_upgrade - else - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - info "Installing database" - mariadb_install_db - mysql_start_bg - wait_for_mysql_access - # we delete existing users and create new ones with stricter access - # commands can still be executed until we restart or run 'flush privileges' - info "Configuring authentication" - mysql_execute "mysql" <=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Initialize database data -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_install_db() { - local command="${DB_BIN_DIR}/mysql_install_db" - local -a args=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && args+=("${db_extra_flags[@]}") - - am_i_root && args=("${args[@]}" "--user=$DB_DAEMON_USER") - args+=("--auth-root-authentication-method=normal") - # Feature available only in MariaDB 10.5+ - # ref: https://mariadb.com/kb/en/mysql_install_db/#not-creating-the-test-database-and-anonymous-user - if [[ ! "$(mysql_get_version)" =~ ^10\.[01234]\. ]]; then - is_boolean_yes "$DB_SKIP_TEST_DB" && args+=("--skip-test-db") - fi - - debug_execute "$command" "${args[@]}" -} - -######################## -# Upgrade Database Schema -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_upgrade() { - local -a args=("--defaults-file=${DB_CONF_FILE}" "-u" "$DB_ROOT_USER") - info "Running mysql_upgrade" - mysql_start_bg - is_boolean_yes "${ROOT_AUTH_ENABLED:-false}" && args+=("-p$(get_master_env_var_value ROOT_PASSWORD)") - [[ "${DB_UPGRADE}" == "FORCE" ]] && args+=("--force") - debug_execute "${DB_BIN_DIR}/mysql_upgrade" "${args[@]}" || echo "This installation is already upgraded" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami MySQL Galera library - -# shellcheck disable=SC1090,SC1091,SC2119,SC2120 - -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh -. /opt/bitnami/scripts/libfile.sh - -######################## -# Check if a previous boot exists -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Yes or no -######################### -get_previous_boot() { - [[ -e "$DB_GALERA_BOOTSTRAP_FILE" ]] && echo "yes" || echo "no" -} - -######################## -# Create a flag file to indicate previous boot -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -set_previous_boot() { - info "Setting previous boot" - touch "$DB_GALERA_BOOTSTRAP_FILE" -} - -######################## -# Configure database extra start flags -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Array with extra flags to use -######################### -mysql_extra_flags() { - local -a dbExtraFlags=() - read -r -a userExtraFlags <<< "${DB_EXTRA_FLAGS?}" - - # This avoids a non-writable configuration file break a Galera Cluster, due to lack of proper Galera clustering configuration - # This is especially important for the MariaDB Galera chart, in which the 'my.cnf' configuration file is mounted by default - if ! is_file_writable "$DB_CONF_FILE"; then - dbExtraFlags+=( - "--wsrep-node-name=$(get_node_name)" - "--wsrep-node-address=$(get_node_address)" - "--wsrep-cluster-name=${DB_GALERA_CLUSTER_NAME}" - "--wsrep-cluster-address=$(get_galera_cluster_address_value)" - "--wsrep-sst-method=${DB_GALERA_SST_METHOD}" - "--wsrep-sst-auth=${DB_GALERA_MARIABACKUP_USER}:${DB_GALERA_MARIABACKUP_PASSWORD}" - ) - fi - - [[ ${#userExtraFlags[@]} -eq 0 ]] || dbExtraFlags+=("${userExtraFlags[@]}") - - echo "${dbExtraFlags[@]}" -} - -######################## -# Whether the Galera node will perform bootstrapping of a new cluster, or join an existing one -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Yes or no -######################### -get_galera_cluster_bootstrap_value() { - local cluster_bootstrap - - # This block evaluate if the cluster needs to be boostraped or not. - # When the node is marked to bootstrap: - # - When it is force by setting DB_GALERA_CLUSTER_BOOTSTRAP - # - When there is not previous boot and not other nodes has been found - # When the node is not marked to bootstrap, the node will join an existing cluster. - cluster_bootstrap="no" # initial value - if is_boolean_yes "$DB_GALERA_CLUSTER_BOOTSTRAP"; then - cluster_bootstrap="yes" - elif ! is_boolean_yes "$(get_previous_boot)" && ! is_boolean_yes "$(has_galera_cluster_other_nodes)"; then - cluster_bootstrap="yes" - fi - echo "$cluster_bootstrap" -} - -######################## -# Whether the Galera cluster has other running nodes -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -has_galera_cluster_other_nodes() { - local node_ip cluster_address address has_nodes - - hostname_has_ips() { - local hostname="${1:?hostname is required}" - [[ "$(getent ahosts "$hostname")" != "" ]] && return 0 - return 1 - } - - has_nodes="yes" - cluster_address="$DB_GALERA_CLUSTER_ADDRESS" - if [[ -z "$cluster_address" ]]; then - has_nodes="no" - elif [[ -n "$cluster_address" ]]; then - has_nodes="no" - read -r -a local_ips <<< "$(hostname -i)" - read -r -a addresses <<< "$(tr ',' ' ' <<< "${cluster_address#*://}")" - if [[ "${#addresses[@]}" -eq "1" ]]; then - if validate_ipv4 "$(echo "${addresses[0]}" | cut -d':' -f1)"; then - has_nodes="yes" - else - address="$(echo "${addresses[0]}" | cut -d':' -f1)" - if retry_while "hostname_has_ips $address" 2 2; then - for ip in $(getent ahosts "$address" | awk '{print $1}' | uniq); do - for local_ip in "${local_ips[@]}"; do - if [[ "$ip" != "$local_ip" ]]; then - has_nodes="yes" - break - fi - done - done - fi - fi - else - for a in "${addresses[@]}"; do - address="$(echo "$a" | cut -d':' -f1)" - node_ip="" - if validate_ipv4 "$address"; then - node_ip="$address" - else - if retry_while "hostname_has_ips $address" 2 2; then - node_ip="$(dns_lookup "$address")" - fi - fi - if [[ -n "$node_ip" ]]; then - has_nodes="yes" - # we now check if *any* of our IPs matches the node IP. In that case, we have to revert has_nodes to no, because it's not in fact a foreign node and check the next. - for local_ip in "${local_ips[@]}"; do - if [[ "$node_ip" == "$local_ip" ]]; then - has_nodes="no" - break - fi - done - # The foreign IP did not match our local IP, so we know that another node exists. - if [[ "$has_nodes" == 'yes' ]]; then - break - fi - fi - done - fi - fi - echo "$has_nodes" -} - -######################## -# Build Galera cluster address string from the bootstrap string -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -get_galera_cluster_address_value() { - local cluster_address - - if ! is_boolean_yes "$(get_galera_cluster_bootstrap_value)" && is_boolean_yes "$(has_galera_cluster_other_nodes)"; then - cluster_address="$DB_GALERA_CLUSTER_ADDRESS" - else - cluster_address="gcomm://" - fi - - debug "Set Galera cluster address to ${cluster_address}" - echo "$cluster_address" -} - -######################## -# Validate settings in MYSQL_*/MARIADB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_validate() { - info "Validating settings in MYSQL_*/MARIADB_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - backslash_password_error() { - print_validation_error "The password cannot contain backslashes ('\'). Set the environment variable $1 with no backslashes (more info at https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html)" - } - - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -n "$DB_GALERA_MARIABACKUP_USER" ]] && [[ -z "$DB_GALERA_MARIABACKUP_PASSWORD" ]]; then - empty_password_error "$(get_env_var GALERA_MARIABACKUP_PASSWORD)" - fi - - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if (( ${#DB_ROOT_PASSWORD} > 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]]; then - if is_boolean_yes "$DB_ENABLE_LDAP" && [[ -n "$DB_PASSWORD" ]]; then - warn "You enabled LDAP authentication. '$DB_USER' user will be authentication using LDAP, the password set at the environment variable $(get_env_var PASSWORD) will be ignored" - elif ! is_boolean_yes "$DB_ENABLE_LDAP" && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - fi - - if [[ -n "$DB_GALERA_FORCE_SAFETOBOOTSTRAP" ]] && ! is_yes_no_value "$DB_GALERA_FORCE_SAFETOBOOTSTRAP"; then - print_validation_error "The allowed values for $(get_env_var GALERA_FORCE_SAFETOBOOTSTRAP) are yes or no." - fi - - if [[ -z "$DB_GALERA_CLUSTER_NAME" ]]; then - print_validation_error "Galera cluster cannot be created without setting the environment variable $(get_env_var GALERA_CLUSTER_NAME)." - fi - - if [[ -z "$(get_galera_cluster_address_value)" ]]; then - print_validation_error "Galera cluster cannot be created without setting the environment variable $(get_env_var GALERA_CLUSTER_ADDRESS). If you are bootstrapping a new Galera cluster, set the environment variable $(get_env_var GALERA_CLUSTER_ADDRESS)=yes." - fi - - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - - if is_boolean_yes "$DB_ENABLE_LDAP" && { [[ -z "${LDAP_URI}" ]] || [[ -z "${LDAP_BASE}" ]] || [[ -z "${LDAP_BIND_DN}" ]] || [[ -z "${LDAP_BIND_PASSWORD}" ]]; }; then - print_validation_error "The LDAP configuration is required when LDAP authentication is enabled. Set the environment variables LDAP_URI, LDAP_BASE, LDAP_BIND_DN and LDAP_BIND_PASSWORD with the LDAP configuration." - fi - - if is_boolean_yes "$DB_ENABLE_TLS"; then - if [[ -z "${DB_TLS_CERT_FILE}" ]] || [[ -z "${DB_TLS_KEY_FILE}" ]] || [[ -z "${DB_TLS_CA_FILE}" ]]; then - print_validation_error "The TLS cert file, key and CA are required when TLS is enabled. Set the environment variables TLS_CERT_FILE, TLS_KEY_FILE and TLS_CA_FILE with the path to each file." - fi - if [[ ! -f "${DB_TLS_CERT_FILE}" ]]; then - print_validation_error "The TLS_CERT file ${DB_TLS_CERT_FILE} must exist." - fi - if [[ ! -f "${DB_TLS_KEY_FILE}" ]]; then - print_validation_error "The TLS_KEY file ${DB_TLS_KEY_FILE} must exist." - fi - if [[ ! -f "${DB_TLS_CA_FILE}" ]]; then - print_validation_error "The TLS_CA file ${DB_TLS_CA_FILE} must exist." - fi - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Persisted data detected. Restoring" - - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - if is_boolean_yes "$DB_GALERA_FORCE_SAFETOBOOTSTRAP"; then - set_safe_to_bootstrap - fi - if ! is_safe_to_bootstrap; then - error "It is not safe to bootstrap form this node ('safe_to_bootstrap=0' is set in 'grastate.dat'). If you want to force bootstrap, set the environment variable MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP=yes" - exit 1 - fi - fi - - return - else - # initialization should not be performed on non-primary nodes of a galera cluster - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - mariadb_install_db - mysql_start_bg - debug "Deleting all users to avoid issues with galera configuration" - mysql_execute "mysql" </dev/null - hostname - fi -} - -######################## -# Check for user override of wsrep_node_address -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# String with node address -######################### -get_node_address() { - if [[ -n "$DB_GALERA_NODE_ADDRESS" ]]; then - echo "$DB_GALERA_NODE_ADDRESS" - else - # In some environments, the network may not be fully set up when starting the initialization - # So, to avoid issues, we retry the 'hostname' command until it succeeds (for a few minutes) - local -r retries="60" - local -r seconds="5" - retry_while "hostname -i" "$retries" "$seconds" >/dev/null - # prefer IPv6 over IPv4 if available - # This works by pulling any IPv4 addresses encountered into hold space and emitting it only when the EOF line is encountered - printf '%s\nEOF' "$(hostname -i | tr ' ' '\n')" | sed '/:/{;q;};/^EOF$/{;g;q;};h;d' - fi -} - -######################## -# Starts MySQL/MariaDB in the background and waits until it's ready -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_start_bg() { - local -a flags=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") - - # Only allow local connections until MySQL is fully initialized, to avoid apps trying to connect to MySQL before it is fully initialized - flags+=("--bind-address=127.0.0.1") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - - # Do not start as root, to avoid permission issues - am_i_root && flags+=("--user=${DB_DAEMON_USER}") - - # The slave should only start in 'run.sh', elseways user credentials would be needed for any connection - flags+=("--skip-slave-start") - flags+=("$@") - - is_mysql_running && return - - info "Starting $DB_FLAVOR in background" - debug_execute "${DB_SBIN_DIR}/mysqld" "${flags[@]}" & - - # we cannot use wait_for_mysql_access here as mysql_upgrade for MySQL >=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Wait for WSREP to be ready. If WSREP is not ready, we cannot do any transactions, thus cannot - # create any users, and WSREP instantly kills MariaDB if doing so - wait_for_wsrep - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Wait for WSREP to be ready to do transactions -# Arguments: -# None -# Returns: -# None -######################## -wait_for_wsrep() { - local -r retries=300 - local -r sleep_time=2 - if ! retry_while is_wsrep_ready "$retries" "$sleep_time"; then - error "WSREP did not become ready" - return 1 - fi -} - -######################## -# Checks for WSREP to be ready to do transactions -# Arguments: -# None -# Returns: -# Boolean -######################## -is_wsrep_ready() { - debug "Checking if WSREP is ready" - is_ready="$(mysql_execute_print_output "mysql" "root" <> "$custom_conf_file" - cat "$old_custom_conf_file" >> "$custom_conf_file" - fi - if am_i_root; then - [[ -e "$DB_VOLUME_DIR/.initialized" ]] && rm "$DB_VOLUME_DIR/.initialized" - rm -rf "$DB_VOLUME_DIR/conf" - else - warn "Old custom configuration migrated, please manually remove the 'conf' directory from the volume use to persist data" - fi -} - -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - local mysql_create_user_cmd - [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.4, the mysql.user table was replaced with a view: https://mariadb.com/kb/en/mysqluser-table/ - # Views have a definer user, in this case set to 'root', which needs to exist for the view to work - # In MySQL, to avoid issues when renaming the root user, they use the 'mysql.sys' user as a definer: https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html - # However, for MariaDB that is not the case, so when the 'root' user is renamed the 'mysql.user' table stops working and the view needs to be fixed - if [[ "$user" != "root" && ! "$(mysql_get_version)" =~ ^10.[0123]. ]]; then - alter_view_str="$(mysql_execute_print_output "mysql" "$user" "$password" "-s" <&2 - return 1 - ;; - esac - shift - done - - local -a mysql_execute_cmd=("mysql_execute") - [[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - - local -a create_database_args=() - [[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'") - [[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'") - - debug "Creating database $database" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$user") - [[ -n "$db_host" ]] && flags+=("--host" "${db_host}") - [[ -n "$db_port" ]] && flags+=("--port" "${db_port}") - if is_boolean_yes "$use_ldap"; then - flags+=("--use-ldap") - elif [[ -n "$password" ]]; then - flags+=("-p" "$password") - [[ -n "$auth_plugin" ]] && flags=("${flags[@]}" "--auth-plugin" "$auth_plugin") - fi - mysql_ensure_user_exists "${flags[@]}" -} - -######################## -# Optionally create the given database, and then optionally give a user -# full privileges on the database. -# Flags: -# -u|--user - database user -# --character-set - character set -# --collation - collation -# --host - database host -# --port - database port -# Arguments: -# $1 - database name -# Returns: -# None -######################### -mysql_ensure_optional_database_exists() { - local -r database="${1:?database is missing}" - local character_set="" - local collate="" - local user="" - local privileges="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - --character-set) - shift - character_set="${1:?missing character set}" - ;; - --collate) - shift - collate="${1:?missing collate}" - ;; - -u|--user) - shift - user="${1:?missing database user}" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - --privileges) - shift - privileges="${1:?missing privileges}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$database") - [[ -n "$character_set" ]] && flags+=("--character-set" "$character_set") - [[ -n "$collate" ]] && flags+=("--collate" "$collate") - [[ -n "$db_host" ]] && flags+=("--host" "$db_host") - [[ -n "$db_port" ]] && flags+=("--port" "$db_port") - mysql_ensure_database_exists "${flags[@]}" - - if [[ -n "$user" ]]; then - mysql_ensure_user_has_database_privileges "$user" "$database" "$privileges" "$db_host" "$db_port" - fi -} - -######################## -# Add or modify an entry in the MySQL configuration file ("$DB_CONF_FILE") -# Globals: -# DB_* -# Arguments: -# $1 - MySQL variable name -# $2 - Value to assign to the MySQL variable -# $3 - Section in the MySQL configuration file the key is located (default: mysqld) -# $4 - Configuration file (default: "$BD_CONF_FILE") -# Returns: -# None -######################### -mysql_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - read -r -a sections <<<"${3:-mysqld}" - local -r ignore_inline_comments="${4:-no}" - local -r file="${5:-"$DB_CONF_FILE"}" - info "Setting ${key} option" - debug "Setting ${key} to '${value}' in ${DB_FLAVOR} configuration file ${file}" - # Check if the configuration exists in the file - for section in "${sections[@]}"; do - if is_boolean_yes "$ignore_inline_comments"; then - ini-file set --ignore-inline-comments --section "$section" --key "$key" --value "$value" "$file" - else - ini-file set --section "$section" --key "$key" --value "$value" "$file" - fi - done -} - -######################## -# Update MySQL/MariaDB configuration file with user custom inputs -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_update_custom_config() { - # Persisted configuration files from old versions - ! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration - - # User injected custom configuration - if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then - debug "Injecting custom configuration from my_custom.conf" - cat "$DB_CONF_DIR/my_custom.cnf" > "$DB_CONF_DIR/bitnami/my_custom.cnf" - fi - - ! is_empty_value "$DB_USER" && mysql_conf_set "user" "$DB_USER" "mysqladmin" - ! is_empty_value "$DB_PORT_NUMBER" && mysql_conf_set "port" "$DB_PORT_NUMBER" "mysqld client manager" - ! is_empty_value "$DB_CHARACTER_SET" && mysql_conf_set "character_set_server" "$DB_CHARACTER_SET" - ! is_empty_value "$DB_COLLATE" && mysql_conf_set "collation_server" "$DB_COLLATE" - ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" - ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" - ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" - ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" - ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=( "/usr/lib" "/usr/lib64" ) - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} - -######################## -# Execute a reliable health check against the current mysql instance -# Globals: -# DB_ROOT_USER, DB_ROOT_PASSWORD, DB_MASTER_ROOT_PASSWORD -# Arguments: -# None -# Returns: -# mysqladmin output -######################### -mysql_healthcheck() { - local args=("-u${DB_ROOT_USER}" "-h0.0.0.0") - local root_password - - root_password="$(get_master_env_var_value ROOT_PASSWORD)" - if [[ -n "$root_password" ]]; then - args+=("-p${root_password}") - fi - - mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status -} - -######################## -# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# mysql client flavor -######################### -mysql_client_flavor() { - if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then - echo "mariadb" - else - echo "mysql" - fi -} - -######################## -# Prints extra options for MySQL client calls (i.e. SSL options) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# List of options to pass to "mysql" CLI -######################### -mysql_client_extra_opts() { - # Helper to get the proper value for the MySQL client environment variable - mysql_client_env_value() { - local env_name="MYSQL_CLIENT_${1:?missing name}" - if [[ -n "${!env_name:-}" ]]; then - echo "${!env_name:-}" - else - env_name="DB_CLIENT_${1}" - echo "${!env_name:-}" - fi - } - local -a opts=() - local key value - if is_boolean_yes "${DB_ENABLE_SSL:-no}"; then - if [[ "$(mysql_client_flavor)" = "mysql" ]]; then - opts+=("--ssl-mode=REQUIRED") - else - opts+=("--ssl=TRUE") - fi - # Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined - for key in ca key cert; do - value="$(mysql_client_env_value "SSL_${key^^}_FILE")" - [[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}") - done - else - # Skip SSL validation - if [[ "$(mysql_client_flavor)" = "mariadb" ]]; then - # SSL connections are enabled by default in MariaDB >=10.11 - local mysql_version="" - local major_version="" - local minor_version="" - mysql_version="$(mysql_get_version)" - major_version="$(get_sematic_version "${mysql_version}" 1)" - minor_version="$(get_sematic_version "${mysql_version}" 2)" - if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then - opts+=("--skip-ssl") - fi - fi - fi - echo "${opts[@]:-}" -} diff --git a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh b/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh deleted file mode 100644 index 54c504fe8d2c8..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh +++ /dev/null @@ -1,264 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for mariadb - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-mariadb}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -mariadb_env_vars=( - ALLOW_EMPTY_PASSWORD - MARIADB_AUTHENTICATION_PLUGIN - MARIADB_ROOT_USER - MARIADB_ROOT_PASSWORD - MARIADB_USER - MARIADB_PASSWORD - MARIADB_DATABASE - MARIADB_MASTER_HOST - MARIADB_MASTER_PORT_NUMBER - MARIADB_MASTER_ROOT_USER - MARIADB_MASTER_ROOT_PASSWORD - MARIADB_MASTER_DELAY - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - MARIADB_PORT_NUMBER - MARIADB_REPLICATION_MODE - MARIADB_REPLICATION_SLAVE_DUMP - MARIADB_EXTRA_FLAGS - MARIADB_INIT_SLEEP_TIME - MARIADB_CHARACTER_SET - MARIADB_COLLATE - MARIADB_BIND_ADDRESS - MARIADB_SQL_MODE - MARIADB_UPGRADE - MARIADB_SKIP_TEST_DB - MARIADB_CLIENT_ENABLE_SSL - MARIADB_CLIENT_SSL_CA_FILE - MARIADB_CLIENT_SSL_CERT_FILE - MARIADB_CLIENT_SSL_KEY_FILE - MARIADB_CLIENT_EXTRA_FLAGS - MARIADB_STARTUP_WAIT_RETRIES - MARIADB_STARTUP_WAIT_SLEEP_TIME - MARIADB_ENABLE_SLOW_QUERY - MARIADB_LONG_QUERY_TIME - MARIADB_GALERA_CONF_DIR - MARIADB_GALERA_MOUNTED_CONF_DIR - MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP - MARIADB_GALERA_CLUSTER_BOOTSTRAP - MARIADB_GALERA_CLUSTER_ADDRESS - MARIADB_GALERA_CLUSTER_NAME - MARIADB_GALERA_NODE_NAME - MARIADB_GALERA_NODE_ADDRESS - MARIADB_GALERA_SST_METHOD - MARIADB_GALERA_MARIABACKUP_USER - MARIADB_GALERA_MARIABACKUP_PASSWORD - MARIADB_ENABLE_LDAP - MARIADB_ENABLE_TLS - MARIADB_TLS_CERT_FILE - MARIADB_TLS_KEY_FILE - MARIADB_TLS_CA_FILE - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - DB_ENABLE_SLOW_QUERY - DB_LONG_QUERY_TIME -) -for env_var in "${mariadb_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset mariadb_env_vars -export DB_FLAVOR="mariadb" - -# Paths -export DB_BASE_DIR="${BITNAMI_ROOT_DIR}/mariadb" -export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" -export DB_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_SBIN_DIR="${DB_BASE_DIR}/sbin" -export DB_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_LOGS_DIR="${DB_BASE_DIR}/logs" -export DB_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_CONF_FILE="${DB_CONF_DIR}/my.cnf" -export DB_PID_FILE="${DB_TMP_DIR}/mysqld.pid" -export DB_SOCKET_FILE="${DB_TMP_DIR}/mysql.sock" -export PATH="${DB_SBIN_DIR}:${DB_BIN_DIR}:/opt/bitnami/common/bin:${PATH}" - -# System users (when running with a privileged user) -export DB_DAEMON_USER="mysql" -export DB_DAEMON_GROUP="mysql" - -# Default configuration (build-time) -export MARIADB_DEFAULT_PORT_NUMBER="3306" -export DB_DEFAULT_PORT_NUMBER="$MARIADB_DEFAULT_PORT_NUMBER" # only used at build time -export MARIADB_DEFAULT_CHARACTER_SET="utf8mb4" -export DB_DEFAULT_CHARACTER_SET="$MARIADB_DEFAULT_CHARACTER_SET" # only used at build time -export MARIADB_DEFAULT_BIND_ADDRESS="0.0.0.0" -export DB_DEFAULT_BIND_ADDRESS="$MARIADB_DEFAULT_BIND_ADDRESS" # only used at build time - -# MariaDB Galera authentication. -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export MARIADB_AUTHENTICATION_PLUGIN="${MARIADB_AUTHENTICATION_PLUGIN:-}" -export DB_AUTHENTICATION_PLUGIN="$MARIADB_AUTHENTICATION_PLUGIN" -export MARIADB_ROOT_USER="${MARIADB_ROOT_USER:-root}" -export DB_ROOT_USER="$MARIADB_ROOT_USER" # only used during the first initialization -export MARIADB_ROOT_PASSWORD="${MARIADB_ROOT_PASSWORD:-}" -export DB_ROOT_PASSWORD="$MARIADB_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_USER="${MARIADB_USER:-}" -export DB_USER="$MARIADB_USER" # only used during the first initialization -export MARIADB_PASSWORD="${MARIADB_PASSWORD:-}" -export DB_PASSWORD="$MARIADB_PASSWORD" # only used during the first initialization -export MARIADB_DATABASE="${MARIADB_DATABASE:-}" -export DB_DATABASE="$MARIADB_DATABASE" # only used during the first initialization -export MARIADB_MASTER_HOST="${MARIADB_MASTER_HOST:-}" -export DB_MASTER_HOST="$MARIADB_MASTER_HOST" # only used during the first initialization -export MARIADB_MASTER_PORT_NUMBER="${MARIADB_MASTER_PORT_NUMBER:-3306}" -export DB_MASTER_PORT_NUMBER="$MARIADB_MASTER_PORT_NUMBER" # only used during the first initialization -export MARIADB_MASTER_ROOT_USER="${MARIADB_MASTER_ROOT_USER:-root}" -export DB_MASTER_ROOT_USER="$MARIADB_MASTER_ROOT_USER" # only used during the first initialization -export MARIADB_MASTER_ROOT_PASSWORD="${MARIADB_MASTER_ROOT_PASSWORD:-}" -export DB_MASTER_ROOT_PASSWORD="$MARIADB_MASTER_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_MASTER_DELAY="${MARIADB_MASTER_DELAY:-0}" -export DB_MASTER_DELAY="$MARIADB_MASTER_DELAY" # only used during the first initialization -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Settings -export MARIADB_PORT_NUMBER="${MARIADB_PORT_NUMBER:-}" -export DB_PORT_NUMBER="$MARIADB_PORT_NUMBER" -export MARIADB_REPLICATION_MODE="${MARIADB_REPLICATION_MODE:-}" -export DB_REPLICATION_MODE="$MARIADB_REPLICATION_MODE" -export MARIADB_REPLICATION_SLAVE_DUMP="${MARIADB_REPLICATION_SLAVE_DUMP:-false}" -export DB_REPLICATION_SLAVE_DUMP="$MARIADB_REPLICATION_SLAVE_DUMP" -export MARIADB_EXTRA_FLAGS="${MARIADB_EXTRA_FLAGS:-}" -export DB_EXTRA_FLAGS="$MARIADB_EXTRA_FLAGS" -export MARIADB_INIT_SLEEP_TIME="${MARIADB_INIT_SLEEP_TIME:-}" -export DB_INIT_SLEEP_TIME="$MARIADB_INIT_SLEEP_TIME" -export MARIADB_CHARACTER_SET="${MARIADB_CHARACTER_SET:-}" -export DB_CHARACTER_SET="$MARIADB_CHARACTER_SET" -# MARIADB_COLLATION is deprecated in favor of MARIADB_COLLATE -MARIADB_COLLATE="${MARIADB_COLLATE:-"${MARIADB_COLLATION:-}"}" -export MARIADB_COLLATE="${MARIADB_COLLATE:-}" -export DB_COLLATE="$MARIADB_COLLATE" -export MARIADB_BIND_ADDRESS="${MARIADB_BIND_ADDRESS:-}" -export DB_BIND_ADDRESS="$MARIADB_BIND_ADDRESS" -export MARIADB_SQL_MODE="${MARIADB_SQL_MODE:-}" -export DB_SQL_MODE="$MARIADB_SQL_MODE" -export MARIADB_UPGRADE="${MARIADB_UPGRADE:-AUTO}" -export DB_UPGRADE="$MARIADB_UPGRADE" -export MARIADB_SKIP_TEST_DB="${MARIADB_SKIP_TEST_DB:-no}" -export DB_SKIP_TEST_DB="$MARIADB_SKIP_TEST_DB" -export MARIADB_CLIENT_ENABLE_SSL="${MARIADB_CLIENT_ENABLE_SSL:-no}" -export DB_CLIENT_ENABLE_SSL="$MARIADB_CLIENT_ENABLE_SSL" -export MARIADB_CLIENT_SSL_CA_FILE="${MARIADB_CLIENT_SSL_CA_FILE:-}" -export DB_CLIENT_SSL_CA_FILE="$MARIADB_CLIENT_SSL_CA_FILE" -export MARIADB_CLIENT_SSL_CERT_FILE="${MARIADB_CLIENT_SSL_CERT_FILE:-}" -export DB_CLIENT_SSL_CERT_FILE="$MARIADB_CLIENT_SSL_CERT_FILE" -export MARIADB_CLIENT_SSL_KEY_FILE="${MARIADB_CLIENT_SSL_KEY_FILE:-}" -export DB_CLIENT_SSL_KEY_FILE="$MARIADB_CLIENT_SSL_KEY_FILE" -export MARIADB_CLIENT_EXTRA_FLAGS="${MARIADB_CLIENT_EXTRA_FLAGS:-no}" -export DB_CLIENT_EXTRA_FLAGS="$MARIADB_CLIENT_EXTRA_FLAGS" -export MARIADB_STARTUP_WAIT_RETRIES="${MARIADB_STARTUP_WAIT_RETRIES:-300}" -export DB_STARTUP_WAIT_RETRIES="$MARIADB_STARTUP_WAIT_RETRIES" -export MARIADB_STARTUP_WAIT_SLEEP_TIME="${MARIADB_STARTUP_WAIT_SLEEP_TIME:-2}" -export DB_STARTUP_WAIT_SLEEP_TIME="$MARIADB_STARTUP_WAIT_SLEEP_TIME" -MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-"${DB_ENABLE_SLOW_QUERY:-}"}" -export MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-0}" -export DB_ENABLE_SLOW_QUERY="$MARIADB_ENABLE_SLOW_QUERY" -MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-"${DB_LONG_QUERY_TIME:-}"}" -export MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-10.0}" -export DB_LONG_QUERY_TIME="$MARIADB_LONG_QUERY_TIME" - -# Galera paths -export MARIADB_GALERA_GRASTATE_FILE="${DB_DATA_DIR}/grastate.dat" -export DB_GALERA_GRASTATE_FILE="$MARIADB_GALERA_GRASTATE_FILE" -export MARIADB_GALERA_BOOTSTRAP_DIR="${DB_VOLUME_DIR}/.bootstrap" -export DB_GALERA_BOOTSTRAP_DIR="$MARIADB_GALERA_BOOTSTRAP_DIR" -export MARIADB_GALERA_BOOTSTRAP_FILE="${DB_GALERA_BOOTSTRAP_DIR}/done" -export DB_GALERA_BOOTSTRAP_FILE="$MARIADB_GALERA_BOOTSTRAP_FILE" - -# Galera build-time defaults for cluster configuration -export MARIADB_GALERA_DEFAULT_CLUSTER_ADDRESS="gcomm://" -export DB_GALERA_DEFAULT_CLUSTER_ADDRESS="$MARIADB_GALERA_DEFAULT_CLUSTER_ADDRESS" -export MARIADB_GALERA_DEFAULT_CLUSTER_NAME="galera" -export DB_GALERA_DEFAULT_CLUSTER_NAME="$MARIADB_GALERA_DEFAULT_CLUSTER_NAME" -export MARIADB_GALERA_DEFAULT_NODE_NAME="" -export DB_GALERA_DEFAULT_NODE_NAME="$MARIADB_GALERA_DEFAULT_NODE_NAME" -export MARIADB_GALERA_DEFAULT_NODE_ADDRESS="" -export DB_GALERA_DEFAULT_NODE_ADDRESS="$MARIADB_GALERA_DEFAULT_NODE_ADDRESS" -export MARIADB_GALERA_DEFAULT_SST_METHOD="mariabackup" -export DB_GALERA_DEFAULT_SST_METHOD="$MARIADB_GALERA_DEFAULT_SST_METHOD" -export MARIADB_GALERA_DEFAULT_MARIABACKUP_USER="mariabackup" -export DB_GALERA_DEFAULT_MARIABACKUP_USER="$MARIADB_GALERA_DEFAULT_MARIABACKUP_USER" -export MARIADB_GALERA_DEFAULT_MARIABACKUP_PASSWORD="" -export DB_GALERA_DEFAULT_MARIABACKUP_PASSWORD="$MARIADB_GALERA_DEFAULT_MARIABACKUP_PASSWORD" - -# Galera cluster configuration. -export MARIADB_GALERA_CONF_DIR="${MARIADB_GALERA_CONF_DIR:-/opt/bitnami/mariadb/conf}" -export DB_GALERA_CONF_DIR="$MARIADB_GALERA_CONF_DIR" -export MARIADB_GALERA_MOUNTED_CONF_DIR="${MARIADB_GALERA_MOUNTED_CONF_DIR:-/bitnami/conf}" -export DB_GALERA_MOUNTED_CONF_DIR="$MARIADB_GALERA_MOUNTED_CONF_DIR" -export MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP="${MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP:-}" -export DB_GALERA_FORCE_SAFETOBOOTSTRAP="$MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP" -export MARIADB_GALERA_CLUSTER_BOOTSTRAP="${MARIADB_GALERA_CLUSTER_BOOTSTRAP:-}" -export DB_GALERA_CLUSTER_BOOTSTRAP="$MARIADB_GALERA_CLUSTER_BOOTSTRAP" -export MARIADB_GALERA_CLUSTER_ADDRESS="${MARIADB_GALERA_CLUSTER_ADDRESS:-}" -export DB_GALERA_CLUSTER_ADDRESS="$MARIADB_GALERA_CLUSTER_ADDRESS" -export MARIADB_GALERA_CLUSTER_NAME="${MARIADB_GALERA_CLUSTER_NAME:-$DB_GALERA_DEFAULT_CLUSTER_NAME}" -export DB_GALERA_CLUSTER_NAME="$MARIADB_GALERA_CLUSTER_NAME" -export MARIADB_GALERA_NODE_NAME="${MARIADB_GALERA_NODE_NAME:-}" -export DB_GALERA_NODE_NAME="$MARIADB_GALERA_NODE_NAME" -export MARIADB_GALERA_NODE_ADDRESS="${MARIADB_GALERA_NODE_ADDRESS:-}" -export DB_GALERA_NODE_ADDRESS="$MARIADB_GALERA_NODE_ADDRESS" -export MARIADB_GALERA_SST_METHOD="${MARIADB_GALERA_SST_METHOD:-$DB_GALERA_DEFAULT_SST_METHOD}" -export DB_GALERA_SST_METHOD="$MARIADB_GALERA_SST_METHOD" -export MARIADB_GALERA_MARIABACKUP_USER="${MARIADB_GALERA_MARIABACKUP_USER:-$DB_GALERA_DEFAULT_MARIABACKUP_USER}" -export DB_GALERA_MARIABACKUP_USER="$MARIADB_GALERA_MARIABACKUP_USER" -export MARIADB_GALERA_MARIABACKUP_PASSWORD="${MARIADB_GALERA_MARIABACKUP_PASSWORD:-$DB_GALERA_DEFAULT_MARIABACKUP_PASSWORD}" -export DB_GALERA_MARIABACKUP_PASSWORD="$MARIADB_GALERA_MARIABACKUP_PASSWORD" - -# LDAP -export MARIADB_ENABLE_LDAP="${MARIADB_ENABLE_LDAP:-no}" -export DB_ENABLE_LDAP="$MARIADB_ENABLE_LDAP" - -# SSL/TLS configuration -export MARIADB_ENABLE_TLS="${MARIADB_ENABLE_TLS:-no}" -export DB_ENABLE_TLS="$MARIADB_ENABLE_TLS" -export MARIADB_TLS_CERT_FILE="${MARIADB_TLS_CERT_FILE:-}" -export DB_TLS_CERT_FILE="$MARIADB_TLS_CERT_FILE" -export MARIADB_TLS_KEY_FILE="${MARIADB_TLS_KEY_FILE:-}" -export DB_TLS_KEY_FILE="$MARIADB_TLS_KEY_FILE" -export MARIADB_TLS_CA_FILE="${MARIADB_TLS_CA_FILE:-}" -export DB_TLS_CA_FILE="$MARIADB_TLS_CA_FILE" -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-monitor}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-monitor}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Custom environment variables may be defined below diff --git a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh b/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh deleted file mode 100755 index ec7e80256766f..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/mariadb/conf) -debug "Copying files from $DB_DEFAULT_CONF_DIR to $DB_CONF_DIR" -cp -nr "$DB_DEFAULT_CONF_DIR"/. "$DB_CONF_DIR" - -print_welcome_page - -if [[ "$1" = "/opt/bitnami/scripts/mariadb-galera/run.sh" ]]; then - info "** Starting MariaDB setup **" - /opt/bitnami/scripts/mariadb-galera/setup.sh - info "** MariaDB setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh b/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh deleted file mode 100755 index 8bd30f5f8ae49..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -mysql_healthcheck diff --git a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh b/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh deleted file mode 100755 index 503f456f66f0d..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libldapclient.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# Configure MariaDB options based on build-time defaults -info "Configuring default MariaDB options" -ensure_dir_exists "$DB_CONF_DIR" -mysql_create_default_config - -for dir in "$DB_TMP_DIR" "$DB_LOGS_DIR" "$DB_CONF_DIR" "$DB_DEFAULT_CONF_DIR" "${DB_CONF_DIR}/bitnami" "$DB_VOLUME_DIR" "$DB_DATA_DIR" "$DB_GALERA_BOOTSTRAP_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# LDAP permissions -ldap_configure_permissions -ldap_create_pam_config "mariadb" - -# Fix to avoid issues detecting plugins in mysql_install_db -ln -sf "$DB_BASE_DIR/plugin" "$DB_BASE_DIR/lib/plugin" - -# Redirect all logging to stdout -ln -sf /dev/stdout "$DB_LOGS_DIR/mysqld.log" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${DB_CONF_DIR}/"* "$DB_DEFAULT_CONF_DIR" diff --git a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh b/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh deleted file mode 100755 index 69b8d4496908b..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libldapclient.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# mysqld_safe does not allow logging to stdout/stderr, so we stick with mysqld -EXEC="${DB_SBIN_DIR}/mysqld" - -flags=("--defaults-file=${DB_CONF_DIR}/my.cnf" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") -[[ -z "${DB_PID_FILE:-}" ]] || flags+=("--pid-file=${DB_PID_FILE}") - -# Add flags specified via the 'DB_EXTRA_FLAGS' environment variable -read -r -a db_extra_flags <<< "$(mysql_extra_flags)" -[[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - -# Add flags passed to this script -flags+=("$@") - -# Fix for MDEV-16183 - mysqld_safe already does this, but we are using mysqld -LD_PRELOAD="$(find_jemalloc_lib)${LD_PRELOAD:+ "$LD_PRELOAD"}" -export LD_PRELOAD - -is_boolean_yes "$DB_ENABLE_LDAP" && ldap_start_nslcd_bg - -info "** Starting MariaDB **" - -set_previous_boot - -if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "$EXEC" "${flags[@]}" -else - exec "$EXEC" "${flags[@]}" -fi diff --git a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh b/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh deleted file mode 100755 index 77c9f7d5d1a97..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadbgalera.sh -. /opt/bitnami/scripts/libldapclient.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# Ensure mysql unix socket file does not exist -rm -rf "${DB_SOCKET_FILE}.lock" -# Ensure MariaDB environment variables settings are valid -mysql_validate -# Ensure MariaDB is stopped when this script ends. -trap "mysql_stop" EXIT -if am_i_root; then - # Ensure 'daemon' user exists when running as 'root' - ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" - # Ensure 'nslcd' user exists when running as 'root' - ensure_user_exists "$LDAP_NSLCD_USER" --group "$LDAP_NSLCD_GROUP" - # Fix logging issue when running as root - chmod o+w "$(readlink /dev/stdout)" -fi -# Ensure MariaDB is initialized -mysql_initialize -# Ensure LDAP is initialized -is_boolean_yes "$DB_ENABLE_LDAP" && ldap_initialize -# Allow running custom initialization scripts -mysql_custom_scripts 'init' -# Allow running custom start scripts -mysql_custom_scripts 'start' -# Stop MariaDB before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -mysql_stop diff --git a/bitnami/mariadb-galera/10.6/debian-12/tags-info.yaml b/bitnami/mariadb-galera/10.6/debian-12/tags-info.yaml deleted file mode 100644 index ace62bc460efb..0000000000000 --- a/bitnami/mariadb-galera/10.6/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "10.6" -- 10.6-debian-12 -- 10.6.20 diff --git a/bitnami/mariadb-galera/11.2/README.md b/bitnami/mariadb-galera/11.2/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/mariadb-galera/11.2/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/mariadb-galera/11.2/debian-12/Dockerfile b/bitnami/mariadb-galera/11.2/debian-12/Dockerfile deleted file mode 100644 index b011a53c7d95e..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T15:53:53Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="11.2.6-debian-12-r3" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera" \ - org.opencontainers.image.title="mariadb-galera" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="11.2.6" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl iproute2 ldap-utils libaio1 libaudit1 libcap-ng0 libcrypt1 libgcc-s1 libicu72 libldap-common liblzma5 libncurses6 libpam-ldapd libpam0g libssl3 libstdc++6 libtinfo6 libxml2 nslcd procps psmisc rsync socat zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "ini-file-1.4.7-7-linux-${OS_ARCH}-debian-12" \ - "mariadb-galera-11.2.6-2-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir /docker-entrypoint-initdb.d - -COPY rootfs / -RUN /opt/bitnami/scripts/mariadb-galera/postunpack.sh -ENV APP_VERSION="11.2.6" \ - BITNAMI_APP_NAME="mariadb-galera" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/common/sbin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:$PATH" - -EXPOSE 3306 4444 4567 4568 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/mariadb-galera/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/mariadb-galera/run.sh" ] diff --git a/bitnami/mariadb-galera/11.2/debian-12/docker-compose-ldap.yml b/bitnami/mariadb-galera/11.2/debian-12/docker-compose-ldap.yml deleted file mode 100644 index dc0de1c2a4cbf..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/docker-compose-ldap.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-galera: - image: docker.io/bitnami/mariadb-galera:11.2 - ports: - - '3306:3306' - - '4444:4444' - - '4567:4567' - - '4568:4568' - volumes: - - 'mariadb_galera_data:/bitnami/mariadb' - environment: - - MARIADB_ROOT_PASSWORD=root-password - - MARIADB_GALERA_MARIABACKUP_PASSWORD=backup-password - - MARIADB_USER=user01 - - MARIADB_DATABASE=my_database - - MARIADB_GALERA_CLUSTER_ADDRESS=gcomm:// - - MARIADB_ENABLE_LDAP=yes - - LDAP_URI=ldap://openldap:1389 - - LDAP_BASE=dc=example,dc=org - - LDAP_BIND_DN=cn=admin,dc=example,dc=org - - LDAP_BIND_PASSWORD=adminpassword - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb-galera/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - - openldap: - image: 'docker.io/bitnami/openldap:latest' - ports: - - '1389:1389' - environment: - - LDAP_ADMIN_USERNAME=admin - - LDAP_ADMIN_PASSWORD=adminpassword - - LDAP_USERS=user01 - - LDAP_PASSWORDS=password1 - volumes: - - 'openldap_data:/bitnami/openldap' - -volumes: - mariadb_galera_data: - driver: local - openldap_data: - driver: local diff --git a/bitnami/mariadb-galera/11.2/debian-12/docker-compose.yml b/bitnami/mariadb-galera/11.2/debian-12/docker-compose.yml deleted file mode 100644 index 15dc2a90018cd..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/docker-compose.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-galera: - image: docker.io/bitnami/mariadb-galera:11.2 - ports: - - '3306:3306' - - '4444:4444' - - '4567:4567' - - '4568:4568' - volumes: - - 'mariadb_galera_data:/bitnami/mariadb' - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_GALERA_CLUSTER_ADDRESS=gcomm:// - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb-galera/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_galera_data: - driver: local diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 8964af24f87a9..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ini-file": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.4.7-7" - }, - "mariadb-galera": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "11.2.6-2" - } -} \ No newline at end of file diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh b/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh deleted file mode 100644 index fa50716cf1ff9..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh +++ /dev/null @@ -1,222 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami LDAP library - -# shellcheck disable=SC1090,SC1091 - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -######################## -# Loads global variables used on LDAP configuration. -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# Series of exports to be used as 'eval' arguments -######################### -ldap_env() { - cat <<"EOF" -export LDAP_NSLCD_USER="nslcd" -export LDAP_URI="${LDAP_URI:-}" -export LDAP_BASE="${LDAP_BASE:-}" -export LDAP_BIND_DN="${LDAP_BIND_DN:-}" -export LDAP_BIND_PASSWORD="${LDAP_BIND_PASSWORD:-}" -export LDAP_BASE_LOOKUP="${LDAP_BASE_LOOKUP:-}" -export LDAP_NSS_INITGROUPS_IGNOREUSERS="${LDAP_NSS_INITGROUPS_IGNOREUSERS:-root,nslcd}" -export LDAP_SCOPE="${LDAP_SCOPE:-}" -export LDAP_TLS_REQCERT="${LDAP_TLS_REQCERT:-}" -export LDAP_SEARCH_FILTER="${LDAP_SEARCH_FILTER:-}" -export LDAP_SEARCH_MAP="${LDAP_SEARCH_MAP:-}" - -EOF - if [[ "$OS_FLAVOUR" =~ ^debian-.*$ ]]; then - cat <<"EOF" -export LDAP_NSLCD_GROUP="nslcd" -EOF - elif [[ "$OS_FLAVOUR" =~ ^(photon)-.*$ ]]; then - cat <<"EOF" -export LDAP_NSLCD_GROUP="ldap" -EOF - fi -} - -######################## -# Return LDAP config file path depending on distro -# Globals: -# OS_FLAVOUR -# Arguments: -# None -# Returns: -# (String) LDAP config file path -######################### -ldap_openldap_config_path() { - local openldap_config - case "$OS_FLAVOUR" in - debian-* | ubuntu-*) openldap_config=/etc/ldap/ldap.conf ;; - photon-* | redhatubi-*) openldap_config=/etc/openldap/ldap.conf ;; - *) error "Unsupported OS flavor ${OS_FLAVOUR}" && exit 1 ;; - esac - echo "$openldap_config" -} - -######################## -# Configure LDAP permissions (to be used at postunpack leve). -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# None -######################### -ldap_configure_permissions() { - ensure_dir_exists "/var/run/nslcd" && configure_permissions_ownership "/var/run/nslcd" -u "root" -g "root" -d "775" - # The nslcd.conf file may not exist in distros like UBI, so we need to create it first - touch "/etc/nslcd.conf" - configure_permissions_ownership "/etc/nslcd.conf" -u "root" -g "root" -f "660" - configure_permissions_ownership "$(ldap_openldap_config_path)" -u "root" -g "root" -f "660" -} - -######################## -# Create nslcd.conf file -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# None -######################### -ldap_create_nslcd_config() { - if am_i_root; then - chown "root:${LDAP_NSLCD_GROUP}" "/etc/nslcd.conf" - chown -R "${LDAP_NSLCD_USER}:${LDAP_NSLCD_GROUP}" "/var/run/nslcd" - cat >"/etc/nslcd.conf" <"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"$(ldap_openldap_config_path)" <"/etc/pam.d/${filename}" < 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - elif [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - if [[ -z "$DB_MASTER_HOST" ]]; then - print_validation_error "Slave replication mode chosen without setting the environment variable $(get_env_var MASTER_HOST). Use it to indicate where the Master node is running" - fi - else - print_validation_error "Invalid replication mode. Available options are 'master/slave'" - fi - else - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ "$DB_USER" = "root" ]]; then - print_validation_error "root user is already created in the database and you can't use it as username for user creation." - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - if [[ "${DB_REPLICATION_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "$dump_file" - debug "Finish dump databases" - - debug "Unlock master databases for write operations" - echo "UNLOCK TABLES;" | mysql_remote_execute "$DB_MASTER_HOST" "$DB_MASTER_PORT_NUMBER" "mysql" "$DB_MASTER_ROOT_USER" "$DB_MASTER_ROOT_PASSWORD" - - debug "Start import dump databases" - mysql_execute < "$dump_file" - mysql_execute "mysql" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - if ! grep --silent "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" "${DB_CONF_FILE}"; then - echo "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" >> "${DB_CONF_FILE}" - fi - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Using persisted data" - # mysql_upgrade requires the server to be running - [[ -n "$(get_master_env_var_value ROOT_PASSWORD)" ]] && export ROOT_AUTH_ENABLED="yes" - # https://dev.mysql.com/doc/refman/8.0/en/replication-upgrade.html - mariadb_upgrade - else - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - info "Installing database" - mariadb_install_db - mysql_start_bg - wait_for_mysql_access - # we delete existing users and create new ones with stricter access - # commands can still be executed until we restart or run 'flush privileges' - info "Configuring authentication" - mysql_execute "mysql" <=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Initialize database data -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_install_db() { - local command="${DB_BIN_DIR}/mysql_install_db" - local -a args=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && args+=("${db_extra_flags[@]}") - - am_i_root && args=("${args[@]}" "--user=$DB_DAEMON_USER") - args+=("--auth-root-authentication-method=normal") - # Feature available only in MariaDB 10.5+ - # ref: https://mariadb.com/kb/en/mysql_install_db/#not-creating-the-test-database-and-anonymous-user - if [[ ! "$(mysql_get_version)" =~ ^10\.[01234]\. ]]; then - is_boolean_yes "$DB_SKIP_TEST_DB" && args+=("--skip-test-db") - fi - - debug_execute "$command" "${args[@]}" -} - -######################## -# Upgrade Database Schema -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_upgrade() { - local -a args=("--defaults-file=${DB_CONF_FILE}" "-u" "$DB_ROOT_USER") - info "Running mysql_upgrade" - mysql_start_bg - is_boolean_yes "${ROOT_AUTH_ENABLED:-false}" && args+=("-p$(get_master_env_var_value ROOT_PASSWORD)") - [[ "${DB_UPGRADE}" == "FORCE" ]] && args+=("--force") - debug_execute "${DB_BIN_DIR}/mysql_upgrade" "${args[@]}" || echo "This installation is already upgraded" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami MySQL Galera library - -# shellcheck disable=SC1090,SC1091,SC2119,SC2120 - -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh -. /opt/bitnami/scripts/libfile.sh - -######################## -# Check if a previous boot exists -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Yes or no -######################### -get_previous_boot() { - [[ -e "$DB_GALERA_BOOTSTRAP_FILE" ]] && echo "yes" || echo "no" -} - -######################## -# Create a flag file to indicate previous boot -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -set_previous_boot() { - info "Setting previous boot" - touch "$DB_GALERA_BOOTSTRAP_FILE" -} - -######################## -# Configure database extra start flags -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Array with extra flags to use -######################### -mysql_extra_flags() { - local -a dbExtraFlags=() - read -r -a userExtraFlags <<< "${DB_EXTRA_FLAGS?}" - - # This avoids a non-writable configuration file break a Galera Cluster, due to lack of proper Galera clustering configuration - # This is especially important for the MariaDB Galera chart, in which the 'my.cnf' configuration file is mounted by default - if ! is_file_writable "$DB_CONF_FILE"; then - dbExtraFlags+=( - "--wsrep-node-name=$(get_node_name)" - "--wsrep-node-address=$(get_node_address)" - "--wsrep-cluster-name=${DB_GALERA_CLUSTER_NAME}" - "--wsrep-cluster-address=$(get_galera_cluster_address_value)" - "--wsrep-sst-method=${DB_GALERA_SST_METHOD}" - "--wsrep-sst-auth=${DB_GALERA_MARIABACKUP_USER}:${DB_GALERA_MARIABACKUP_PASSWORD}" - ) - fi - - [[ ${#userExtraFlags[@]} -eq 0 ]] || dbExtraFlags+=("${userExtraFlags[@]}") - - echo "${dbExtraFlags[@]}" -} - -######################## -# Whether the Galera node will perform bootstrapping of a new cluster, or join an existing one -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Yes or no -######################### -get_galera_cluster_bootstrap_value() { - local cluster_bootstrap - - # This block evaluate if the cluster needs to be boostraped or not. - # When the node is marked to bootstrap: - # - When it is force by setting DB_GALERA_CLUSTER_BOOTSTRAP - # - When there is not previous boot and not other nodes has been found - # When the node is not marked to bootstrap, the node will join an existing cluster. - cluster_bootstrap="no" # initial value - if is_boolean_yes "$DB_GALERA_CLUSTER_BOOTSTRAP"; then - cluster_bootstrap="yes" - elif ! is_boolean_yes "$(get_previous_boot)" && ! is_boolean_yes "$(has_galera_cluster_other_nodes)"; then - cluster_bootstrap="yes" - fi - echo "$cluster_bootstrap" -} - -######################## -# Whether the Galera cluster has other running nodes -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -has_galera_cluster_other_nodes() { - local node_ip cluster_address address has_nodes - - hostname_has_ips() { - local hostname="${1:?hostname is required}" - [[ "$(getent ahosts "$hostname")" != "" ]] && return 0 - return 1 - } - - has_nodes="yes" - cluster_address="$DB_GALERA_CLUSTER_ADDRESS" - if [[ -z "$cluster_address" ]]; then - has_nodes="no" - elif [[ -n "$cluster_address" ]]; then - has_nodes="no" - read -r -a local_ips <<< "$(hostname -i)" - read -r -a addresses <<< "$(tr ',' ' ' <<< "${cluster_address#*://}")" - if [[ "${#addresses[@]}" -eq "1" ]]; then - if validate_ipv4 "$(echo "${addresses[0]}" | cut -d':' -f1)"; then - has_nodes="yes" - else - address="$(echo "${addresses[0]}" | cut -d':' -f1)" - if retry_while "hostname_has_ips $address" 2 2; then - for ip in $(getent ahosts "$address" | awk '{print $1}' | uniq); do - for local_ip in "${local_ips[@]}"; do - if [[ "$ip" != "$local_ip" ]]; then - has_nodes="yes" - break - fi - done - done - fi - fi - else - for a in "${addresses[@]}"; do - address="$(echo "$a" | cut -d':' -f1)" - node_ip="" - if validate_ipv4 "$address"; then - node_ip="$address" - else - if retry_while "hostname_has_ips $address" 2 2; then - node_ip="$(dns_lookup "$address")" - fi - fi - if [[ -n "$node_ip" ]]; then - has_nodes="yes" - # we now check if *any* of our IPs matches the node IP. In that case, we have to revert has_nodes to no, because it's not in fact a foreign node and check the next. - for local_ip in "${local_ips[@]}"; do - if [[ "$node_ip" == "$local_ip" ]]; then - has_nodes="no" - break - fi - done - # The foreign IP did not match our local IP, so we know that another node exists. - if [[ "$has_nodes" == 'yes' ]]; then - break - fi - fi - done - fi - fi - echo "$has_nodes" -} - -######################## -# Build Galera cluster address string from the bootstrap string -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -get_galera_cluster_address_value() { - local cluster_address - - if ! is_boolean_yes "$(get_galera_cluster_bootstrap_value)" && is_boolean_yes "$(has_galera_cluster_other_nodes)"; then - cluster_address="$DB_GALERA_CLUSTER_ADDRESS" - else - cluster_address="gcomm://" - fi - - debug "Set Galera cluster address to ${cluster_address}" - echo "$cluster_address" -} - -######################## -# Validate settings in MYSQL_*/MARIADB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_validate() { - info "Validating settings in MYSQL_*/MARIADB_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - backslash_password_error() { - print_validation_error "The password cannot contain backslashes ('\'). Set the environment variable $1 with no backslashes (more info at https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html)" - } - - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -n "$DB_GALERA_MARIABACKUP_USER" ]] && [[ -z "$DB_GALERA_MARIABACKUP_PASSWORD" ]]; then - empty_password_error "$(get_env_var GALERA_MARIABACKUP_PASSWORD)" - fi - - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if (( ${#DB_ROOT_PASSWORD} > 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]]; then - if is_boolean_yes "$DB_ENABLE_LDAP" && [[ -n "$DB_PASSWORD" ]]; then - warn "You enabled LDAP authentication. '$DB_USER' user will be authentication using LDAP, the password set at the environment variable $(get_env_var PASSWORD) will be ignored" - elif ! is_boolean_yes "$DB_ENABLE_LDAP" && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - fi - - if [[ -n "$DB_GALERA_FORCE_SAFETOBOOTSTRAP" ]] && ! is_yes_no_value "$DB_GALERA_FORCE_SAFETOBOOTSTRAP"; then - print_validation_error "The allowed values for $(get_env_var GALERA_FORCE_SAFETOBOOTSTRAP) are yes or no." - fi - - if [[ -z "$DB_GALERA_CLUSTER_NAME" ]]; then - print_validation_error "Galera cluster cannot be created without setting the environment variable $(get_env_var GALERA_CLUSTER_NAME)." - fi - - if [[ -z "$(get_galera_cluster_address_value)" ]]; then - print_validation_error "Galera cluster cannot be created without setting the environment variable $(get_env_var GALERA_CLUSTER_ADDRESS). If you are bootstrapping a new Galera cluster, set the environment variable $(get_env_var GALERA_CLUSTER_ADDRESS)=yes." - fi - - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - - if is_boolean_yes "$DB_ENABLE_LDAP" && { [[ -z "${LDAP_URI}" ]] || [[ -z "${LDAP_BASE}" ]] || [[ -z "${LDAP_BIND_DN}" ]] || [[ -z "${LDAP_BIND_PASSWORD}" ]]; }; then - print_validation_error "The LDAP configuration is required when LDAP authentication is enabled. Set the environment variables LDAP_URI, LDAP_BASE, LDAP_BIND_DN and LDAP_BIND_PASSWORD with the LDAP configuration." - fi - - if is_boolean_yes "$DB_ENABLE_TLS"; then - if [[ -z "${DB_TLS_CERT_FILE}" ]] || [[ -z "${DB_TLS_KEY_FILE}" ]] || [[ -z "${DB_TLS_CA_FILE}" ]]; then - print_validation_error "The TLS cert file, key and CA are required when TLS is enabled. Set the environment variables TLS_CERT_FILE, TLS_KEY_FILE and TLS_CA_FILE with the path to each file." - fi - if [[ ! -f "${DB_TLS_CERT_FILE}" ]]; then - print_validation_error "The TLS_CERT file ${DB_TLS_CERT_FILE} must exist." - fi - if [[ ! -f "${DB_TLS_KEY_FILE}" ]]; then - print_validation_error "The TLS_KEY file ${DB_TLS_KEY_FILE} must exist." - fi - if [[ ! -f "${DB_TLS_CA_FILE}" ]]; then - print_validation_error "The TLS_CA file ${DB_TLS_CA_FILE} must exist." - fi - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Persisted data detected. Restoring" - - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - if is_boolean_yes "$DB_GALERA_FORCE_SAFETOBOOTSTRAP"; then - set_safe_to_bootstrap - fi - if ! is_safe_to_bootstrap; then - error "It is not safe to bootstrap form this node ('safe_to_bootstrap=0' is set in 'grastate.dat'). If you want to force bootstrap, set the environment variable MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP=yes" - exit 1 - fi - fi - - return - else - # initialization should not be performed on non-primary nodes of a galera cluster - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - mariadb_install_db - mysql_start_bg - debug "Deleting all users to avoid issues with galera configuration" - mysql_execute "mysql" </dev/null - hostname - fi -} - -######################## -# Check for user override of wsrep_node_address -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# String with node address -######################### -get_node_address() { - if [[ -n "$DB_GALERA_NODE_ADDRESS" ]]; then - echo "$DB_GALERA_NODE_ADDRESS" - else - # In some environments, the network may not be fully set up when starting the initialization - # So, to avoid issues, we retry the 'hostname' command until it succeeds (for a few minutes) - local -r retries="60" - local -r seconds="5" - retry_while "hostname -i" "$retries" "$seconds" >/dev/null - # prefer IPv6 over IPv4 if available - # This works by pulling any IPv4 addresses encountered into hold space and emitting it only when the EOF line is encountered - printf '%s\nEOF' "$(hostname -i | tr ' ' '\n')" | sed '/:/{;q;};/^EOF$/{;g;q;};h;d' - fi -} - -######################## -# Starts MySQL/MariaDB in the background and waits until it's ready -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_start_bg() { - local -a flags=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") - - # Only allow local connections until MySQL is fully initialized, to avoid apps trying to connect to MySQL before it is fully initialized - flags+=("--bind-address=127.0.0.1") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - - # Do not start as root, to avoid permission issues - am_i_root && flags+=("--user=${DB_DAEMON_USER}") - - # The slave should only start in 'run.sh', elseways user credentials would be needed for any connection - flags+=("--skip-slave-start") - flags+=("$@") - - is_mysql_running && return - - info "Starting $DB_FLAVOR in background" - debug_execute "${DB_SBIN_DIR}/mysqld" "${flags[@]}" & - - # we cannot use wait_for_mysql_access here as mysql_upgrade for MySQL >=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Wait for WSREP to be ready. If WSREP is not ready, we cannot do any transactions, thus cannot - # create any users, and WSREP instantly kills MariaDB if doing so - wait_for_wsrep - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Wait for WSREP to be ready to do transactions -# Arguments: -# None -# Returns: -# None -######################## -wait_for_wsrep() { - local -r retries=300 - local -r sleep_time=2 - if ! retry_while is_wsrep_ready "$retries" "$sleep_time"; then - error "WSREP did not become ready" - return 1 - fi -} - -######################## -# Checks for WSREP to be ready to do transactions -# Arguments: -# None -# Returns: -# Boolean -######################## -is_wsrep_ready() { - debug "Checking if WSREP is ready" - is_ready="$(mysql_execute_print_output "mysql" "root" <> "$custom_conf_file" - cat "$old_custom_conf_file" >> "$custom_conf_file" - fi - if am_i_root; then - [[ -e "$DB_VOLUME_DIR/.initialized" ]] && rm "$DB_VOLUME_DIR/.initialized" - rm -rf "$DB_VOLUME_DIR/conf" - else - warn "Old custom configuration migrated, please manually remove the 'conf' directory from the volume use to persist data" - fi -} - -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - local mysql_create_user_cmd - [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.4, the mysql.user table was replaced with a view: https://mariadb.com/kb/en/mysqluser-table/ - # Views have a definer user, in this case set to 'root', which needs to exist for the view to work - # In MySQL, to avoid issues when renaming the root user, they use the 'mysql.sys' user as a definer: https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html - # However, for MariaDB that is not the case, so when the 'root' user is renamed the 'mysql.user' table stops working and the view needs to be fixed - if [[ "$user" != "root" && ! "$(mysql_get_version)" =~ ^10.[0123]. ]]; then - alter_view_str="$(mysql_execute_print_output "mysql" "$user" "$password" "-s" <&2 - return 1 - ;; - esac - shift - done - - local -a mysql_execute_cmd=("mysql_execute") - [[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - - local -a create_database_args=() - [[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'") - [[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'") - - debug "Creating database $database" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$user") - [[ -n "$db_host" ]] && flags+=("--host" "${db_host}") - [[ -n "$db_port" ]] && flags+=("--port" "${db_port}") - if is_boolean_yes "$use_ldap"; then - flags+=("--use-ldap") - elif [[ -n "$password" ]]; then - flags+=("-p" "$password") - [[ -n "$auth_plugin" ]] && flags=("${flags[@]}" "--auth-plugin" "$auth_plugin") - fi - mysql_ensure_user_exists "${flags[@]}" -} - -######################## -# Optionally create the given database, and then optionally give a user -# full privileges on the database. -# Flags: -# -u|--user - database user -# --character-set - character set -# --collation - collation -# --host - database host -# --port - database port -# Arguments: -# $1 - database name -# Returns: -# None -######################### -mysql_ensure_optional_database_exists() { - local -r database="${1:?database is missing}" - local character_set="" - local collate="" - local user="" - local privileges="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - --character-set) - shift - character_set="${1:?missing character set}" - ;; - --collate) - shift - collate="${1:?missing collate}" - ;; - -u|--user) - shift - user="${1:?missing database user}" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - --privileges) - shift - privileges="${1:?missing privileges}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$database") - [[ -n "$character_set" ]] && flags+=("--character-set" "$character_set") - [[ -n "$collate" ]] && flags+=("--collate" "$collate") - [[ -n "$db_host" ]] && flags+=("--host" "$db_host") - [[ -n "$db_port" ]] && flags+=("--port" "$db_port") - mysql_ensure_database_exists "${flags[@]}" - - if [[ -n "$user" ]]; then - mysql_ensure_user_has_database_privileges "$user" "$database" "$privileges" "$db_host" "$db_port" - fi -} - -######################## -# Add or modify an entry in the MySQL configuration file ("$DB_CONF_FILE") -# Globals: -# DB_* -# Arguments: -# $1 - MySQL variable name -# $2 - Value to assign to the MySQL variable -# $3 - Section in the MySQL configuration file the key is located (default: mysqld) -# $4 - Configuration file (default: "$BD_CONF_FILE") -# Returns: -# None -######################### -mysql_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - read -r -a sections <<<"${3:-mysqld}" - local -r ignore_inline_comments="${4:-no}" - local -r file="${5:-"$DB_CONF_FILE"}" - info "Setting ${key} option" - debug "Setting ${key} to '${value}' in ${DB_FLAVOR} configuration file ${file}" - # Check if the configuration exists in the file - for section in "${sections[@]}"; do - if is_boolean_yes "$ignore_inline_comments"; then - ini-file set --ignore-inline-comments --section "$section" --key "$key" --value "$value" "$file" - else - ini-file set --section "$section" --key "$key" --value "$value" "$file" - fi - done -} - -######################## -# Update MySQL/MariaDB configuration file with user custom inputs -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_update_custom_config() { - # Persisted configuration files from old versions - ! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration - - # User injected custom configuration - if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then - debug "Injecting custom configuration from my_custom.conf" - cat "$DB_CONF_DIR/my_custom.cnf" > "$DB_CONF_DIR/bitnami/my_custom.cnf" - fi - - ! is_empty_value "$DB_USER" && mysql_conf_set "user" "$DB_USER" "mysqladmin" - ! is_empty_value "$DB_PORT_NUMBER" && mysql_conf_set "port" "$DB_PORT_NUMBER" "mysqld client manager" - ! is_empty_value "$DB_CHARACTER_SET" && mysql_conf_set "character_set_server" "$DB_CHARACTER_SET" - ! is_empty_value "$DB_COLLATE" && mysql_conf_set "collation_server" "$DB_COLLATE" - ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" - ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" - ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" - ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" - ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=( "/usr/lib" "/usr/lib64" ) - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} - -######################## -# Execute a reliable health check against the current mysql instance -# Globals: -# DB_ROOT_USER, DB_ROOT_PASSWORD, DB_MASTER_ROOT_PASSWORD -# Arguments: -# None -# Returns: -# mysqladmin output -######################### -mysql_healthcheck() { - local args=("-u${DB_ROOT_USER}" "-h0.0.0.0") - local root_password - - root_password="$(get_master_env_var_value ROOT_PASSWORD)" - if [[ -n "$root_password" ]]; then - args+=("-p${root_password}") - fi - - mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status -} - -######################## -# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# mysql client flavor -######################### -mysql_client_flavor() { - if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then - echo "mariadb" - else - echo "mysql" - fi -} - -######################## -# Prints extra options for MySQL client calls (i.e. SSL options) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# List of options to pass to "mysql" CLI -######################### -mysql_client_extra_opts() { - # Helper to get the proper value for the MySQL client environment variable - mysql_client_env_value() { - local env_name="MYSQL_CLIENT_${1:?missing name}" - if [[ -n "${!env_name:-}" ]]; then - echo "${!env_name:-}" - else - env_name="DB_CLIENT_${1}" - echo "${!env_name:-}" - fi - } - local -a opts=() - local key value - if is_boolean_yes "${DB_ENABLE_SSL:-no}"; then - if [[ "$(mysql_client_flavor)" = "mysql" ]]; then - opts+=("--ssl-mode=REQUIRED") - else - opts+=("--ssl=TRUE") - fi - # Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined - for key in ca key cert; do - value="$(mysql_client_env_value "SSL_${key^^}_FILE")" - [[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}") - done - else - # Skip SSL validation - if [[ "$(mysql_client_flavor)" = "mariadb" ]]; then - # SSL connections are enabled by default in MariaDB >=10.11 - local mysql_version="" - local major_version="" - local minor_version="" - mysql_version="$(mysql_get_version)" - major_version="$(get_sematic_version "${mysql_version}" 1)" - minor_version="$(get_sematic_version "${mysql_version}" 2)" - if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then - opts+=("--skip-ssl") - fi - fi - fi - echo "${opts[@]:-}" -} diff --git a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh b/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh deleted file mode 100644 index 54c504fe8d2c8..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh +++ /dev/null @@ -1,264 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for mariadb - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-mariadb}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -mariadb_env_vars=( - ALLOW_EMPTY_PASSWORD - MARIADB_AUTHENTICATION_PLUGIN - MARIADB_ROOT_USER - MARIADB_ROOT_PASSWORD - MARIADB_USER - MARIADB_PASSWORD - MARIADB_DATABASE - MARIADB_MASTER_HOST - MARIADB_MASTER_PORT_NUMBER - MARIADB_MASTER_ROOT_USER - MARIADB_MASTER_ROOT_PASSWORD - MARIADB_MASTER_DELAY - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - MARIADB_PORT_NUMBER - MARIADB_REPLICATION_MODE - MARIADB_REPLICATION_SLAVE_DUMP - MARIADB_EXTRA_FLAGS - MARIADB_INIT_SLEEP_TIME - MARIADB_CHARACTER_SET - MARIADB_COLLATE - MARIADB_BIND_ADDRESS - MARIADB_SQL_MODE - MARIADB_UPGRADE - MARIADB_SKIP_TEST_DB - MARIADB_CLIENT_ENABLE_SSL - MARIADB_CLIENT_SSL_CA_FILE - MARIADB_CLIENT_SSL_CERT_FILE - MARIADB_CLIENT_SSL_KEY_FILE - MARIADB_CLIENT_EXTRA_FLAGS - MARIADB_STARTUP_WAIT_RETRIES - MARIADB_STARTUP_WAIT_SLEEP_TIME - MARIADB_ENABLE_SLOW_QUERY - MARIADB_LONG_QUERY_TIME - MARIADB_GALERA_CONF_DIR - MARIADB_GALERA_MOUNTED_CONF_DIR - MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP - MARIADB_GALERA_CLUSTER_BOOTSTRAP - MARIADB_GALERA_CLUSTER_ADDRESS - MARIADB_GALERA_CLUSTER_NAME - MARIADB_GALERA_NODE_NAME - MARIADB_GALERA_NODE_ADDRESS - MARIADB_GALERA_SST_METHOD - MARIADB_GALERA_MARIABACKUP_USER - MARIADB_GALERA_MARIABACKUP_PASSWORD - MARIADB_ENABLE_LDAP - MARIADB_ENABLE_TLS - MARIADB_TLS_CERT_FILE - MARIADB_TLS_KEY_FILE - MARIADB_TLS_CA_FILE - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - DB_ENABLE_SLOW_QUERY - DB_LONG_QUERY_TIME -) -for env_var in "${mariadb_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset mariadb_env_vars -export DB_FLAVOR="mariadb" - -# Paths -export DB_BASE_DIR="${BITNAMI_ROOT_DIR}/mariadb" -export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" -export DB_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_SBIN_DIR="${DB_BASE_DIR}/sbin" -export DB_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_LOGS_DIR="${DB_BASE_DIR}/logs" -export DB_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_CONF_FILE="${DB_CONF_DIR}/my.cnf" -export DB_PID_FILE="${DB_TMP_DIR}/mysqld.pid" -export DB_SOCKET_FILE="${DB_TMP_DIR}/mysql.sock" -export PATH="${DB_SBIN_DIR}:${DB_BIN_DIR}:/opt/bitnami/common/bin:${PATH}" - -# System users (when running with a privileged user) -export DB_DAEMON_USER="mysql" -export DB_DAEMON_GROUP="mysql" - -# Default configuration (build-time) -export MARIADB_DEFAULT_PORT_NUMBER="3306" -export DB_DEFAULT_PORT_NUMBER="$MARIADB_DEFAULT_PORT_NUMBER" # only used at build time -export MARIADB_DEFAULT_CHARACTER_SET="utf8mb4" -export DB_DEFAULT_CHARACTER_SET="$MARIADB_DEFAULT_CHARACTER_SET" # only used at build time -export MARIADB_DEFAULT_BIND_ADDRESS="0.0.0.0" -export DB_DEFAULT_BIND_ADDRESS="$MARIADB_DEFAULT_BIND_ADDRESS" # only used at build time - -# MariaDB Galera authentication. -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export MARIADB_AUTHENTICATION_PLUGIN="${MARIADB_AUTHENTICATION_PLUGIN:-}" -export DB_AUTHENTICATION_PLUGIN="$MARIADB_AUTHENTICATION_PLUGIN" -export MARIADB_ROOT_USER="${MARIADB_ROOT_USER:-root}" -export DB_ROOT_USER="$MARIADB_ROOT_USER" # only used during the first initialization -export MARIADB_ROOT_PASSWORD="${MARIADB_ROOT_PASSWORD:-}" -export DB_ROOT_PASSWORD="$MARIADB_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_USER="${MARIADB_USER:-}" -export DB_USER="$MARIADB_USER" # only used during the first initialization -export MARIADB_PASSWORD="${MARIADB_PASSWORD:-}" -export DB_PASSWORD="$MARIADB_PASSWORD" # only used during the first initialization -export MARIADB_DATABASE="${MARIADB_DATABASE:-}" -export DB_DATABASE="$MARIADB_DATABASE" # only used during the first initialization -export MARIADB_MASTER_HOST="${MARIADB_MASTER_HOST:-}" -export DB_MASTER_HOST="$MARIADB_MASTER_HOST" # only used during the first initialization -export MARIADB_MASTER_PORT_NUMBER="${MARIADB_MASTER_PORT_NUMBER:-3306}" -export DB_MASTER_PORT_NUMBER="$MARIADB_MASTER_PORT_NUMBER" # only used during the first initialization -export MARIADB_MASTER_ROOT_USER="${MARIADB_MASTER_ROOT_USER:-root}" -export DB_MASTER_ROOT_USER="$MARIADB_MASTER_ROOT_USER" # only used during the first initialization -export MARIADB_MASTER_ROOT_PASSWORD="${MARIADB_MASTER_ROOT_PASSWORD:-}" -export DB_MASTER_ROOT_PASSWORD="$MARIADB_MASTER_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_MASTER_DELAY="${MARIADB_MASTER_DELAY:-0}" -export DB_MASTER_DELAY="$MARIADB_MASTER_DELAY" # only used during the first initialization -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Settings -export MARIADB_PORT_NUMBER="${MARIADB_PORT_NUMBER:-}" -export DB_PORT_NUMBER="$MARIADB_PORT_NUMBER" -export MARIADB_REPLICATION_MODE="${MARIADB_REPLICATION_MODE:-}" -export DB_REPLICATION_MODE="$MARIADB_REPLICATION_MODE" -export MARIADB_REPLICATION_SLAVE_DUMP="${MARIADB_REPLICATION_SLAVE_DUMP:-false}" -export DB_REPLICATION_SLAVE_DUMP="$MARIADB_REPLICATION_SLAVE_DUMP" -export MARIADB_EXTRA_FLAGS="${MARIADB_EXTRA_FLAGS:-}" -export DB_EXTRA_FLAGS="$MARIADB_EXTRA_FLAGS" -export MARIADB_INIT_SLEEP_TIME="${MARIADB_INIT_SLEEP_TIME:-}" -export DB_INIT_SLEEP_TIME="$MARIADB_INIT_SLEEP_TIME" -export MARIADB_CHARACTER_SET="${MARIADB_CHARACTER_SET:-}" -export DB_CHARACTER_SET="$MARIADB_CHARACTER_SET" -# MARIADB_COLLATION is deprecated in favor of MARIADB_COLLATE -MARIADB_COLLATE="${MARIADB_COLLATE:-"${MARIADB_COLLATION:-}"}" -export MARIADB_COLLATE="${MARIADB_COLLATE:-}" -export DB_COLLATE="$MARIADB_COLLATE" -export MARIADB_BIND_ADDRESS="${MARIADB_BIND_ADDRESS:-}" -export DB_BIND_ADDRESS="$MARIADB_BIND_ADDRESS" -export MARIADB_SQL_MODE="${MARIADB_SQL_MODE:-}" -export DB_SQL_MODE="$MARIADB_SQL_MODE" -export MARIADB_UPGRADE="${MARIADB_UPGRADE:-AUTO}" -export DB_UPGRADE="$MARIADB_UPGRADE" -export MARIADB_SKIP_TEST_DB="${MARIADB_SKIP_TEST_DB:-no}" -export DB_SKIP_TEST_DB="$MARIADB_SKIP_TEST_DB" -export MARIADB_CLIENT_ENABLE_SSL="${MARIADB_CLIENT_ENABLE_SSL:-no}" -export DB_CLIENT_ENABLE_SSL="$MARIADB_CLIENT_ENABLE_SSL" -export MARIADB_CLIENT_SSL_CA_FILE="${MARIADB_CLIENT_SSL_CA_FILE:-}" -export DB_CLIENT_SSL_CA_FILE="$MARIADB_CLIENT_SSL_CA_FILE" -export MARIADB_CLIENT_SSL_CERT_FILE="${MARIADB_CLIENT_SSL_CERT_FILE:-}" -export DB_CLIENT_SSL_CERT_FILE="$MARIADB_CLIENT_SSL_CERT_FILE" -export MARIADB_CLIENT_SSL_KEY_FILE="${MARIADB_CLIENT_SSL_KEY_FILE:-}" -export DB_CLIENT_SSL_KEY_FILE="$MARIADB_CLIENT_SSL_KEY_FILE" -export MARIADB_CLIENT_EXTRA_FLAGS="${MARIADB_CLIENT_EXTRA_FLAGS:-no}" -export DB_CLIENT_EXTRA_FLAGS="$MARIADB_CLIENT_EXTRA_FLAGS" -export MARIADB_STARTUP_WAIT_RETRIES="${MARIADB_STARTUP_WAIT_RETRIES:-300}" -export DB_STARTUP_WAIT_RETRIES="$MARIADB_STARTUP_WAIT_RETRIES" -export MARIADB_STARTUP_WAIT_SLEEP_TIME="${MARIADB_STARTUP_WAIT_SLEEP_TIME:-2}" -export DB_STARTUP_WAIT_SLEEP_TIME="$MARIADB_STARTUP_WAIT_SLEEP_TIME" -MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-"${DB_ENABLE_SLOW_QUERY:-}"}" -export MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-0}" -export DB_ENABLE_SLOW_QUERY="$MARIADB_ENABLE_SLOW_QUERY" -MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-"${DB_LONG_QUERY_TIME:-}"}" -export MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-10.0}" -export DB_LONG_QUERY_TIME="$MARIADB_LONG_QUERY_TIME" - -# Galera paths -export MARIADB_GALERA_GRASTATE_FILE="${DB_DATA_DIR}/grastate.dat" -export DB_GALERA_GRASTATE_FILE="$MARIADB_GALERA_GRASTATE_FILE" -export MARIADB_GALERA_BOOTSTRAP_DIR="${DB_VOLUME_DIR}/.bootstrap" -export DB_GALERA_BOOTSTRAP_DIR="$MARIADB_GALERA_BOOTSTRAP_DIR" -export MARIADB_GALERA_BOOTSTRAP_FILE="${DB_GALERA_BOOTSTRAP_DIR}/done" -export DB_GALERA_BOOTSTRAP_FILE="$MARIADB_GALERA_BOOTSTRAP_FILE" - -# Galera build-time defaults for cluster configuration -export MARIADB_GALERA_DEFAULT_CLUSTER_ADDRESS="gcomm://" -export DB_GALERA_DEFAULT_CLUSTER_ADDRESS="$MARIADB_GALERA_DEFAULT_CLUSTER_ADDRESS" -export MARIADB_GALERA_DEFAULT_CLUSTER_NAME="galera" -export DB_GALERA_DEFAULT_CLUSTER_NAME="$MARIADB_GALERA_DEFAULT_CLUSTER_NAME" -export MARIADB_GALERA_DEFAULT_NODE_NAME="" -export DB_GALERA_DEFAULT_NODE_NAME="$MARIADB_GALERA_DEFAULT_NODE_NAME" -export MARIADB_GALERA_DEFAULT_NODE_ADDRESS="" -export DB_GALERA_DEFAULT_NODE_ADDRESS="$MARIADB_GALERA_DEFAULT_NODE_ADDRESS" -export MARIADB_GALERA_DEFAULT_SST_METHOD="mariabackup" -export DB_GALERA_DEFAULT_SST_METHOD="$MARIADB_GALERA_DEFAULT_SST_METHOD" -export MARIADB_GALERA_DEFAULT_MARIABACKUP_USER="mariabackup" -export DB_GALERA_DEFAULT_MARIABACKUP_USER="$MARIADB_GALERA_DEFAULT_MARIABACKUP_USER" -export MARIADB_GALERA_DEFAULT_MARIABACKUP_PASSWORD="" -export DB_GALERA_DEFAULT_MARIABACKUP_PASSWORD="$MARIADB_GALERA_DEFAULT_MARIABACKUP_PASSWORD" - -# Galera cluster configuration. -export MARIADB_GALERA_CONF_DIR="${MARIADB_GALERA_CONF_DIR:-/opt/bitnami/mariadb/conf}" -export DB_GALERA_CONF_DIR="$MARIADB_GALERA_CONF_DIR" -export MARIADB_GALERA_MOUNTED_CONF_DIR="${MARIADB_GALERA_MOUNTED_CONF_DIR:-/bitnami/conf}" -export DB_GALERA_MOUNTED_CONF_DIR="$MARIADB_GALERA_MOUNTED_CONF_DIR" -export MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP="${MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP:-}" -export DB_GALERA_FORCE_SAFETOBOOTSTRAP="$MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP" -export MARIADB_GALERA_CLUSTER_BOOTSTRAP="${MARIADB_GALERA_CLUSTER_BOOTSTRAP:-}" -export DB_GALERA_CLUSTER_BOOTSTRAP="$MARIADB_GALERA_CLUSTER_BOOTSTRAP" -export MARIADB_GALERA_CLUSTER_ADDRESS="${MARIADB_GALERA_CLUSTER_ADDRESS:-}" -export DB_GALERA_CLUSTER_ADDRESS="$MARIADB_GALERA_CLUSTER_ADDRESS" -export MARIADB_GALERA_CLUSTER_NAME="${MARIADB_GALERA_CLUSTER_NAME:-$DB_GALERA_DEFAULT_CLUSTER_NAME}" -export DB_GALERA_CLUSTER_NAME="$MARIADB_GALERA_CLUSTER_NAME" -export MARIADB_GALERA_NODE_NAME="${MARIADB_GALERA_NODE_NAME:-}" -export DB_GALERA_NODE_NAME="$MARIADB_GALERA_NODE_NAME" -export MARIADB_GALERA_NODE_ADDRESS="${MARIADB_GALERA_NODE_ADDRESS:-}" -export DB_GALERA_NODE_ADDRESS="$MARIADB_GALERA_NODE_ADDRESS" -export MARIADB_GALERA_SST_METHOD="${MARIADB_GALERA_SST_METHOD:-$DB_GALERA_DEFAULT_SST_METHOD}" -export DB_GALERA_SST_METHOD="$MARIADB_GALERA_SST_METHOD" -export MARIADB_GALERA_MARIABACKUP_USER="${MARIADB_GALERA_MARIABACKUP_USER:-$DB_GALERA_DEFAULT_MARIABACKUP_USER}" -export DB_GALERA_MARIABACKUP_USER="$MARIADB_GALERA_MARIABACKUP_USER" -export MARIADB_GALERA_MARIABACKUP_PASSWORD="${MARIADB_GALERA_MARIABACKUP_PASSWORD:-$DB_GALERA_DEFAULT_MARIABACKUP_PASSWORD}" -export DB_GALERA_MARIABACKUP_PASSWORD="$MARIADB_GALERA_MARIABACKUP_PASSWORD" - -# LDAP -export MARIADB_ENABLE_LDAP="${MARIADB_ENABLE_LDAP:-no}" -export DB_ENABLE_LDAP="$MARIADB_ENABLE_LDAP" - -# SSL/TLS configuration -export MARIADB_ENABLE_TLS="${MARIADB_ENABLE_TLS:-no}" -export DB_ENABLE_TLS="$MARIADB_ENABLE_TLS" -export MARIADB_TLS_CERT_FILE="${MARIADB_TLS_CERT_FILE:-}" -export DB_TLS_CERT_FILE="$MARIADB_TLS_CERT_FILE" -export MARIADB_TLS_KEY_FILE="${MARIADB_TLS_KEY_FILE:-}" -export DB_TLS_KEY_FILE="$MARIADB_TLS_KEY_FILE" -export MARIADB_TLS_CA_FILE="${MARIADB_TLS_CA_FILE:-}" -export DB_TLS_CA_FILE="$MARIADB_TLS_CA_FILE" -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-monitor}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-monitor}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Custom environment variables may be defined below diff --git a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh b/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh deleted file mode 100755 index ec7e80256766f..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/mariadb/conf) -debug "Copying files from $DB_DEFAULT_CONF_DIR to $DB_CONF_DIR" -cp -nr "$DB_DEFAULT_CONF_DIR"/. "$DB_CONF_DIR" - -print_welcome_page - -if [[ "$1" = "/opt/bitnami/scripts/mariadb-galera/run.sh" ]]; then - info "** Starting MariaDB setup **" - /opt/bitnami/scripts/mariadb-galera/setup.sh - info "** MariaDB setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh b/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh deleted file mode 100755 index 8bd30f5f8ae49..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -mysql_healthcheck diff --git a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh b/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh deleted file mode 100755 index 503f456f66f0d..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libldapclient.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# Configure MariaDB options based on build-time defaults -info "Configuring default MariaDB options" -ensure_dir_exists "$DB_CONF_DIR" -mysql_create_default_config - -for dir in "$DB_TMP_DIR" "$DB_LOGS_DIR" "$DB_CONF_DIR" "$DB_DEFAULT_CONF_DIR" "${DB_CONF_DIR}/bitnami" "$DB_VOLUME_DIR" "$DB_DATA_DIR" "$DB_GALERA_BOOTSTRAP_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# LDAP permissions -ldap_configure_permissions -ldap_create_pam_config "mariadb" - -# Fix to avoid issues detecting plugins in mysql_install_db -ln -sf "$DB_BASE_DIR/plugin" "$DB_BASE_DIR/lib/plugin" - -# Redirect all logging to stdout -ln -sf /dev/stdout "$DB_LOGS_DIR/mysqld.log" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${DB_CONF_DIR}/"* "$DB_DEFAULT_CONF_DIR" diff --git a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh b/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh deleted file mode 100755 index 69b8d4496908b..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libldapclient.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# mysqld_safe does not allow logging to stdout/stderr, so we stick with mysqld -EXEC="${DB_SBIN_DIR}/mysqld" - -flags=("--defaults-file=${DB_CONF_DIR}/my.cnf" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") -[[ -z "${DB_PID_FILE:-}" ]] || flags+=("--pid-file=${DB_PID_FILE}") - -# Add flags specified via the 'DB_EXTRA_FLAGS' environment variable -read -r -a db_extra_flags <<< "$(mysql_extra_flags)" -[[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - -# Add flags passed to this script -flags+=("$@") - -# Fix for MDEV-16183 - mysqld_safe already does this, but we are using mysqld -LD_PRELOAD="$(find_jemalloc_lib)${LD_PRELOAD:+ "$LD_PRELOAD"}" -export LD_PRELOAD - -is_boolean_yes "$DB_ENABLE_LDAP" && ldap_start_nslcd_bg - -info "** Starting MariaDB **" - -set_previous_boot - -if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "$EXEC" "${flags[@]}" -else - exec "$EXEC" "${flags[@]}" -fi diff --git a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh b/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh deleted file mode 100755 index 77c9f7d5d1a97..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadbgalera.sh -. /opt/bitnami/scripts/libldapclient.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# Ensure mysql unix socket file does not exist -rm -rf "${DB_SOCKET_FILE}.lock" -# Ensure MariaDB environment variables settings are valid -mysql_validate -# Ensure MariaDB is stopped when this script ends. -trap "mysql_stop" EXIT -if am_i_root; then - # Ensure 'daemon' user exists when running as 'root' - ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" - # Ensure 'nslcd' user exists when running as 'root' - ensure_user_exists "$LDAP_NSLCD_USER" --group "$LDAP_NSLCD_GROUP" - # Fix logging issue when running as root - chmod o+w "$(readlink /dev/stdout)" -fi -# Ensure MariaDB is initialized -mysql_initialize -# Ensure LDAP is initialized -is_boolean_yes "$DB_ENABLE_LDAP" && ldap_initialize -# Allow running custom initialization scripts -mysql_custom_scripts 'init' -# Allow running custom start scripts -mysql_custom_scripts 'start' -# Stop MariaDB before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -mysql_stop diff --git a/bitnami/mariadb-galera/11.2/debian-12/tags-info.yaml b/bitnami/mariadb-galera/11.2/debian-12/tags-info.yaml deleted file mode 100644 index 63f6327230512..0000000000000 --- a/bitnami/mariadb-galera/11.2/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "11.2" -- 11.2-debian-12 -- 11.2.6 diff --git a/bitnami/mariadb-galera/11.5/README.md b/bitnami/mariadb-galera/11.5/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/mariadb-galera/11.5/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/mariadb-galera/11.5/debian-12/Dockerfile b/bitnami/mariadb-galera/11.5/debian-12/Dockerfile deleted file mode 100644 index 877c2f203b2d2..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T15:54:11Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="11.5.2-debian-12-r9" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera" \ - org.opencontainers.image.title="mariadb-galera" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="11.5.2" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl iproute2 ldap-utils libaio1 libaudit1 libcap-ng0 libcrypt1 libgcc-s1 libicu72 libldap-common liblzma5 libncurses6 libpam-ldapd libpam0g libssl3 libstdc++6 libtinfo6 libxml2 nslcd procps psmisc rsync socat zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "ini-file-1.4.7-7-linux-${OS_ARCH}-debian-12" \ - "mariadb-galera-11.5.2-5-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir /docker-entrypoint-initdb.d - -COPY rootfs / -RUN /opt/bitnami/scripts/mariadb-galera/postunpack.sh -ENV APP_VERSION="11.5.2" \ - BITNAMI_APP_NAME="mariadb-galera" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/common/sbin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:$PATH" - -EXPOSE 3306 4444 4567 4568 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/mariadb-galera/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/mariadb-galera/run.sh" ] diff --git a/bitnami/mariadb-galera/11.5/debian-12/docker-compose-ldap.yml b/bitnami/mariadb-galera/11.5/debian-12/docker-compose-ldap.yml deleted file mode 100644 index 3d5e730b338af..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/docker-compose-ldap.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-galera: - image: docker.io/bitnami/mariadb-galera:11.5 - ports: - - '3306:3306' - - '4444:4444' - - '4567:4567' - - '4568:4568' - volumes: - - 'mariadb_galera_data:/bitnami/mariadb' - environment: - - MARIADB_ROOT_PASSWORD=root-password - - MARIADB_GALERA_MARIABACKUP_PASSWORD=backup-password - - MARIADB_USER=user01 - - MARIADB_DATABASE=my_database - - MARIADB_GALERA_CLUSTER_ADDRESS=gcomm:// - - MARIADB_ENABLE_LDAP=yes - - LDAP_URI=ldap://openldap:1389 - - LDAP_BASE=dc=example,dc=org - - LDAP_BIND_DN=cn=admin,dc=example,dc=org - - LDAP_BIND_PASSWORD=adminpassword - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb-galera/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - - openldap: - image: 'docker.io/bitnami/openldap:latest' - ports: - - '1389:1389' - environment: - - LDAP_ADMIN_USERNAME=admin - - LDAP_ADMIN_PASSWORD=adminpassword - - LDAP_USERS=user01 - - LDAP_PASSWORDS=password1 - volumes: - - 'openldap_data:/bitnami/openldap' - -volumes: - mariadb_galera_data: - driver: local - openldap_data: - driver: local diff --git a/bitnami/mariadb-galera/11.5/debian-12/docker-compose.yml b/bitnami/mariadb-galera/11.5/debian-12/docker-compose.yml deleted file mode 100644 index a332649a003aa..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/docker-compose.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-galera: - image: docker.io/bitnami/mariadb-galera:11.5 - ports: - - '3306:3306' - - '4444:4444' - - '4567:4567' - - '4568:4568' - volumes: - - 'mariadb_galera_data:/bitnami/mariadb' - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_GALERA_CLUSTER_ADDRESS=gcomm:// - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb-galera/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_galera_data: - driver: local diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index b51c48e9af1e2..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ini-file": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.4.7-7" - }, - "mariadb-galera": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "11.5.2-5" - } -} \ No newline at end of file diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh b/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh deleted file mode 100644 index fa50716cf1ff9..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh +++ /dev/null @@ -1,222 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami LDAP library - -# shellcheck disable=SC1090,SC1091 - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -######################## -# Loads global variables used on LDAP configuration. -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# Series of exports to be used as 'eval' arguments -######################### -ldap_env() { - cat <<"EOF" -export LDAP_NSLCD_USER="nslcd" -export LDAP_URI="${LDAP_URI:-}" -export LDAP_BASE="${LDAP_BASE:-}" -export LDAP_BIND_DN="${LDAP_BIND_DN:-}" -export LDAP_BIND_PASSWORD="${LDAP_BIND_PASSWORD:-}" -export LDAP_BASE_LOOKUP="${LDAP_BASE_LOOKUP:-}" -export LDAP_NSS_INITGROUPS_IGNOREUSERS="${LDAP_NSS_INITGROUPS_IGNOREUSERS:-root,nslcd}" -export LDAP_SCOPE="${LDAP_SCOPE:-}" -export LDAP_TLS_REQCERT="${LDAP_TLS_REQCERT:-}" -export LDAP_SEARCH_FILTER="${LDAP_SEARCH_FILTER:-}" -export LDAP_SEARCH_MAP="${LDAP_SEARCH_MAP:-}" - -EOF - if [[ "$OS_FLAVOUR" =~ ^debian-.*$ ]]; then - cat <<"EOF" -export LDAP_NSLCD_GROUP="nslcd" -EOF - elif [[ "$OS_FLAVOUR" =~ ^(photon)-.*$ ]]; then - cat <<"EOF" -export LDAP_NSLCD_GROUP="ldap" -EOF - fi -} - -######################## -# Return LDAP config file path depending on distro -# Globals: -# OS_FLAVOUR -# Arguments: -# None -# Returns: -# (String) LDAP config file path -######################### -ldap_openldap_config_path() { - local openldap_config - case "$OS_FLAVOUR" in - debian-* | ubuntu-*) openldap_config=/etc/ldap/ldap.conf ;; - photon-* | redhatubi-*) openldap_config=/etc/openldap/ldap.conf ;; - *) error "Unsupported OS flavor ${OS_FLAVOUR}" && exit 1 ;; - esac - echo "$openldap_config" -} - -######################## -# Configure LDAP permissions (to be used at postunpack leve). -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# None -######################### -ldap_configure_permissions() { - ensure_dir_exists "/var/run/nslcd" && configure_permissions_ownership "/var/run/nslcd" -u "root" -g "root" -d "775" - # The nslcd.conf file may not exist in distros like UBI, so we need to create it first - touch "/etc/nslcd.conf" - configure_permissions_ownership "/etc/nslcd.conf" -u "root" -g "root" -f "660" - configure_permissions_ownership "$(ldap_openldap_config_path)" -u "root" -g "root" -f "660" -} - -######################## -# Create nslcd.conf file -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# None -######################### -ldap_create_nslcd_config() { - if am_i_root; then - chown "root:${LDAP_NSLCD_GROUP}" "/etc/nslcd.conf" - chown -R "${LDAP_NSLCD_USER}:${LDAP_NSLCD_GROUP}" "/var/run/nslcd" - cat >"/etc/nslcd.conf" <"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"$(ldap_openldap_config_path)" <"/etc/pam.d/${filename}" < 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - elif [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - if [[ -z "$DB_MASTER_HOST" ]]; then - print_validation_error "Slave replication mode chosen without setting the environment variable $(get_env_var MASTER_HOST). Use it to indicate where the Master node is running" - fi - else - print_validation_error "Invalid replication mode. Available options are 'master/slave'" - fi - else - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ "$DB_USER" = "root" ]]; then - print_validation_error "root user is already created in the database and you can't use it as username for user creation." - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - if [[ "${DB_REPLICATION_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "$dump_file" - debug "Finish dump databases" - - debug "Unlock master databases for write operations" - echo "UNLOCK TABLES;" | mysql_remote_execute "$DB_MASTER_HOST" "$DB_MASTER_PORT_NUMBER" "mysql" "$DB_MASTER_ROOT_USER" "$DB_MASTER_ROOT_PASSWORD" - - debug "Start import dump databases" - mysql_execute < "$dump_file" - mysql_execute "mysql" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - if ! grep --silent "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" "${DB_CONF_FILE}"; then - echo "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" >> "${DB_CONF_FILE}" - fi - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Using persisted data" - # mysql_upgrade requires the server to be running - [[ -n "$(get_master_env_var_value ROOT_PASSWORD)" ]] && export ROOT_AUTH_ENABLED="yes" - # https://dev.mysql.com/doc/refman/8.0/en/replication-upgrade.html - mariadb_upgrade - else - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - info "Installing database" - mariadb_install_db - mysql_start_bg - wait_for_mysql_access - # we delete existing users and create new ones with stricter access - # commands can still be executed until we restart or run 'flush privileges' - info "Configuring authentication" - mysql_execute "mysql" <=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Initialize database data -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_install_db() { - local command="${DB_BIN_DIR}/mysql_install_db" - local -a args=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && args+=("${db_extra_flags[@]}") - - am_i_root && args=("${args[@]}" "--user=$DB_DAEMON_USER") - args+=("--auth-root-authentication-method=normal") - # Feature available only in MariaDB 10.5+ - # ref: https://mariadb.com/kb/en/mysql_install_db/#not-creating-the-test-database-and-anonymous-user - if [[ ! "$(mysql_get_version)" =~ ^10\.[01234]\. ]]; then - is_boolean_yes "$DB_SKIP_TEST_DB" && args+=("--skip-test-db") - fi - - debug_execute "$command" "${args[@]}" -} - -######################## -# Upgrade Database Schema -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_upgrade() { - local -a args=("--defaults-file=${DB_CONF_FILE}" "-u" "$DB_ROOT_USER") - info "Running mysql_upgrade" - mysql_start_bg - is_boolean_yes "${ROOT_AUTH_ENABLED:-false}" && args+=("-p$(get_master_env_var_value ROOT_PASSWORD)") - [[ "${DB_UPGRADE}" == "FORCE" ]] && args+=("--force") - debug_execute "${DB_BIN_DIR}/mysql_upgrade" "${args[@]}" || echo "This installation is already upgraded" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami MySQL Galera library - -# shellcheck disable=SC1090,SC1091,SC2119,SC2120 - -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh -. /opt/bitnami/scripts/libfile.sh - -######################## -# Check if a previous boot exists -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Yes or no -######################### -get_previous_boot() { - [[ -e "$DB_GALERA_BOOTSTRAP_FILE" ]] && echo "yes" || echo "no" -} - -######################## -# Create a flag file to indicate previous boot -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -set_previous_boot() { - info "Setting previous boot" - touch "$DB_GALERA_BOOTSTRAP_FILE" -} - -######################## -# Configure database extra start flags -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Array with extra flags to use -######################### -mysql_extra_flags() { - local -a dbExtraFlags=() - read -r -a userExtraFlags <<< "${DB_EXTRA_FLAGS?}" - - # This avoids a non-writable configuration file break a Galera Cluster, due to lack of proper Galera clustering configuration - # This is especially important for the MariaDB Galera chart, in which the 'my.cnf' configuration file is mounted by default - if ! is_file_writable "$DB_CONF_FILE"; then - dbExtraFlags+=( - "--wsrep-node-name=$(get_node_name)" - "--wsrep-node-address=$(get_node_address)" - "--wsrep-cluster-name=${DB_GALERA_CLUSTER_NAME}" - "--wsrep-cluster-address=$(get_galera_cluster_address_value)" - "--wsrep-sst-method=${DB_GALERA_SST_METHOD}" - "--wsrep-sst-auth=${DB_GALERA_MARIABACKUP_USER}:${DB_GALERA_MARIABACKUP_PASSWORD}" - ) - fi - - [[ ${#userExtraFlags[@]} -eq 0 ]] || dbExtraFlags+=("${userExtraFlags[@]}") - - echo "${dbExtraFlags[@]}" -} - -######################## -# Whether the Galera node will perform bootstrapping of a new cluster, or join an existing one -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Yes or no -######################### -get_galera_cluster_bootstrap_value() { - local cluster_bootstrap - - # This block evaluate if the cluster needs to be boostraped or not. - # When the node is marked to bootstrap: - # - When it is force by setting DB_GALERA_CLUSTER_BOOTSTRAP - # - When there is not previous boot and not other nodes has been found - # When the node is not marked to bootstrap, the node will join an existing cluster. - cluster_bootstrap="no" # initial value - if is_boolean_yes "$DB_GALERA_CLUSTER_BOOTSTRAP"; then - cluster_bootstrap="yes" - elif ! is_boolean_yes "$(get_previous_boot)" && ! is_boolean_yes "$(has_galera_cluster_other_nodes)"; then - cluster_bootstrap="yes" - fi - echo "$cluster_bootstrap" -} - -######################## -# Whether the Galera cluster has other running nodes -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -has_galera_cluster_other_nodes() { - local node_ip cluster_address address has_nodes - - hostname_has_ips() { - local hostname="${1:?hostname is required}" - [[ "$(getent ahosts "$hostname")" != "" ]] && return 0 - return 1 - } - - has_nodes="yes" - cluster_address="$DB_GALERA_CLUSTER_ADDRESS" - if [[ -z "$cluster_address" ]]; then - has_nodes="no" - elif [[ -n "$cluster_address" ]]; then - has_nodes="no" - read -r -a local_ips <<< "$(hostname -i)" - read -r -a addresses <<< "$(tr ',' ' ' <<< "${cluster_address#*://}")" - if [[ "${#addresses[@]}" -eq "1" ]]; then - if validate_ipv4 "$(echo "${addresses[0]}" | cut -d':' -f1)"; then - has_nodes="yes" - else - address="$(echo "${addresses[0]}" | cut -d':' -f1)" - if retry_while "hostname_has_ips $address" 2 2; then - for ip in $(getent ahosts "$address" | awk '{print $1}' | uniq); do - for local_ip in "${local_ips[@]}"; do - if [[ "$ip" != "$local_ip" ]]; then - has_nodes="yes" - break - fi - done - done - fi - fi - else - for a in "${addresses[@]}"; do - address="$(echo "$a" | cut -d':' -f1)" - node_ip="" - if validate_ipv4 "$address"; then - node_ip="$address" - else - if retry_while "hostname_has_ips $address" 2 2; then - node_ip="$(dns_lookup "$address")" - fi - fi - if [[ -n "$node_ip" ]]; then - has_nodes="yes" - # we now check if *any* of our IPs matches the node IP. In that case, we have to revert has_nodes to no, because it's not in fact a foreign node and check the next. - for local_ip in "${local_ips[@]}"; do - if [[ "$node_ip" == "$local_ip" ]]; then - has_nodes="no" - break - fi - done - # The foreign IP did not match our local IP, so we know that another node exists. - if [[ "$has_nodes" == 'yes' ]]; then - break - fi - fi - done - fi - fi - echo "$has_nodes" -} - -######################## -# Build Galera cluster address string from the bootstrap string -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -get_galera_cluster_address_value() { - local cluster_address - - if ! is_boolean_yes "$(get_galera_cluster_bootstrap_value)" && is_boolean_yes "$(has_galera_cluster_other_nodes)"; then - cluster_address="$DB_GALERA_CLUSTER_ADDRESS" - else - cluster_address="gcomm://" - fi - - debug "Set Galera cluster address to ${cluster_address}" - echo "$cluster_address" -} - -######################## -# Validate settings in MYSQL_*/MARIADB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_validate() { - info "Validating settings in MYSQL_*/MARIADB_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - backslash_password_error() { - print_validation_error "The password cannot contain backslashes ('\'). Set the environment variable $1 with no backslashes (more info at https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html)" - } - - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -n "$DB_GALERA_MARIABACKUP_USER" ]] && [[ -z "$DB_GALERA_MARIABACKUP_PASSWORD" ]]; then - empty_password_error "$(get_env_var GALERA_MARIABACKUP_PASSWORD)" - fi - - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if (( ${#DB_ROOT_PASSWORD} > 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]]; then - if is_boolean_yes "$DB_ENABLE_LDAP" && [[ -n "$DB_PASSWORD" ]]; then - warn "You enabled LDAP authentication. '$DB_USER' user will be authentication using LDAP, the password set at the environment variable $(get_env_var PASSWORD) will be ignored" - elif ! is_boolean_yes "$DB_ENABLE_LDAP" && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - fi - - if [[ -n "$DB_GALERA_FORCE_SAFETOBOOTSTRAP" ]] && ! is_yes_no_value "$DB_GALERA_FORCE_SAFETOBOOTSTRAP"; then - print_validation_error "The allowed values for $(get_env_var GALERA_FORCE_SAFETOBOOTSTRAP) are yes or no." - fi - - if [[ -z "$DB_GALERA_CLUSTER_NAME" ]]; then - print_validation_error "Galera cluster cannot be created without setting the environment variable $(get_env_var GALERA_CLUSTER_NAME)." - fi - - if [[ -z "$(get_galera_cluster_address_value)" ]]; then - print_validation_error "Galera cluster cannot be created without setting the environment variable $(get_env_var GALERA_CLUSTER_ADDRESS). If you are bootstrapping a new Galera cluster, set the environment variable $(get_env_var GALERA_CLUSTER_ADDRESS)=yes." - fi - - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - - if is_boolean_yes "$DB_ENABLE_LDAP" && { [[ -z "${LDAP_URI}" ]] || [[ -z "${LDAP_BASE}" ]] || [[ -z "${LDAP_BIND_DN}" ]] || [[ -z "${LDAP_BIND_PASSWORD}" ]]; }; then - print_validation_error "The LDAP configuration is required when LDAP authentication is enabled. Set the environment variables LDAP_URI, LDAP_BASE, LDAP_BIND_DN and LDAP_BIND_PASSWORD with the LDAP configuration." - fi - - if is_boolean_yes "$DB_ENABLE_TLS"; then - if [[ -z "${DB_TLS_CERT_FILE}" ]] || [[ -z "${DB_TLS_KEY_FILE}" ]] || [[ -z "${DB_TLS_CA_FILE}" ]]; then - print_validation_error "The TLS cert file, key and CA are required when TLS is enabled. Set the environment variables TLS_CERT_FILE, TLS_KEY_FILE and TLS_CA_FILE with the path to each file." - fi - if [[ ! -f "${DB_TLS_CERT_FILE}" ]]; then - print_validation_error "The TLS_CERT file ${DB_TLS_CERT_FILE} must exist." - fi - if [[ ! -f "${DB_TLS_KEY_FILE}" ]]; then - print_validation_error "The TLS_KEY file ${DB_TLS_KEY_FILE} must exist." - fi - if [[ ! -f "${DB_TLS_CA_FILE}" ]]; then - print_validation_error "The TLS_CA file ${DB_TLS_CA_FILE} must exist." - fi - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Persisted data detected. Restoring" - - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - if is_boolean_yes "$DB_GALERA_FORCE_SAFETOBOOTSTRAP"; then - set_safe_to_bootstrap - fi - if ! is_safe_to_bootstrap; then - error "It is not safe to bootstrap form this node ('safe_to_bootstrap=0' is set in 'grastate.dat'). If you want to force bootstrap, set the environment variable MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP=yes" - exit 1 - fi - fi - - return - else - # initialization should not be performed on non-primary nodes of a galera cluster - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - mariadb_install_db - mysql_start_bg - debug "Deleting all users to avoid issues with galera configuration" - mysql_execute "mysql" </dev/null - hostname - fi -} - -######################## -# Check for user override of wsrep_node_address -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# String with node address -######################### -get_node_address() { - if [[ -n "$DB_GALERA_NODE_ADDRESS" ]]; then - echo "$DB_GALERA_NODE_ADDRESS" - else - # In some environments, the network may not be fully set up when starting the initialization - # So, to avoid issues, we retry the 'hostname' command until it succeeds (for a few minutes) - local -r retries="60" - local -r seconds="5" - retry_while "hostname -i" "$retries" "$seconds" >/dev/null - # prefer IPv6 over IPv4 if available - # This works by pulling any IPv4 addresses encountered into hold space and emitting it only when the EOF line is encountered - printf '%s\nEOF' "$(hostname -i | tr ' ' '\n')" | sed '/:/{;q;};/^EOF$/{;g;q;};h;d' - fi -} - -######################## -# Starts MySQL/MariaDB in the background and waits until it's ready -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_start_bg() { - local -a flags=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") - - # Only allow local connections until MySQL is fully initialized, to avoid apps trying to connect to MySQL before it is fully initialized - flags+=("--bind-address=127.0.0.1") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - - # Do not start as root, to avoid permission issues - am_i_root && flags+=("--user=${DB_DAEMON_USER}") - - # The slave should only start in 'run.sh', elseways user credentials would be needed for any connection - flags+=("--skip-slave-start") - flags+=("$@") - - is_mysql_running && return - - info "Starting $DB_FLAVOR in background" - debug_execute "${DB_SBIN_DIR}/mysqld" "${flags[@]}" & - - # we cannot use wait_for_mysql_access here as mysql_upgrade for MySQL >=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Wait for WSREP to be ready. If WSREP is not ready, we cannot do any transactions, thus cannot - # create any users, and WSREP instantly kills MariaDB if doing so - wait_for_wsrep - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Wait for WSREP to be ready to do transactions -# Arguments: -# None -# Returns: -# None -######################## -wait_for_wsrep() { - local -r retries=300 - local -r sleep_time=2 - if ! retry_while is_wsrep_ready "$retries" "$sleep_time"; then - error "WSREP did not become ready" - return 1 - fi -} - -######################## -# Checks for WSREP to be ready to do transactions -# Arguments: -# None -# Returns: -# Boolean -######################## -is_wsrep_ready() { - debug "Checking if WSREP is ready" - is_ready="$(mysql_execute_print_output "mysql" "root" <> "$custom_conf_file" - cat "$old_custom_conf_file" >> "$custom_conf_file" - fi - if am_i_root; then - [[ -e "$DB_VOLUME_DIR/.initialized" ]] && rm "$DB_VOLUME_DIR/.initialized" - rm -rf "$DB_VOLUME_DIR/conf" - else - warn "Old custom configuration migrated, please manually remove the 'conf' directory from the volume use to persist data" - fi -} - -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - local mysql_create_user_cmd - [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.4, the mysql.user table was replaced with a view: https://mariadb.com/kb/en/mysqluser-table/ - # Views have a definer user, in this case set to 'root', which needs to exist for the view to work - # In MySQL, to avoid issues when renaming the root user, they use the 'mysql.sys' user as a definer: https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html - # However, for MariaDB that is not the case, so when the 'root' user is renamed the 'mysql.user' table stops working and the view needs to be fixed - if [[ "$user" != "root" && ! "$(mysql_get_version)" =~ ^10.[0123]. ]]; then - alter_view_str="$(mysql_execute_print_output "mysql" "$user" "$password" "-s" <&2 - return 1 - ;; - esac - shift - done - - local -a mysql_execute_cmd=("mysql_execute") - [[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - - local -a create_database_args=() - [[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'") - [[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'") - - debug "Creating database $database" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$user") - [[ -n "$db_host" ]] && flags+=("--host" "${db_host}") - [[ -n "$db_port" ]] && flags+=("--port" "${db_port}") - if is_boolean_yes "$use_ldap"; then - flags+=("--use-ldap") - elif [[ -n "$password" ]]; then - flags+=("-p" "$password") - [[ -n "$auth_plugin" ]] && flags=("${flags[@]}" "--auth-plugin" "$auth_plugin") - fi - mysql_ensure_user_exists "${flags[@]}" -} - -######################## -# Optionally create the given database, and then optionally give a user -# full privileges on the database. -# Flags: -# -u|--user - database user -# --character-set - character set -# --collation - collation -# --host - database host -# --port - database port -# Arguments: -# $1 - database name -# Returns: -# None -######################### -mysql_ensure_optional_database_exists() { - local -r database="${1:?database is missing}" - local character_set="" - local collate="" - local user="" - local privileges="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - --character-set) - shift - character_set="${1:?missing character set}" - ;; - --collate) - shift - collate="${1:?missing collate}" - ;; - -u|--user) - shift - user="${1:?missing database user}" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - --privileges) - shift - privileges="${1:?missing privileges}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$database") - [[ -n "$character_set" ]] && flags+=("--character-set" "$character_set") - [[ -n "$collate" ]] && flags+=("--collate" "$collate") - [[ -n "$db_host" ]] && flags+=("--host" "$db_host") - [[ -n "$db_port" ]] && flags+=("--port" "$db_port") - mysql_ensure_database_exists "${flags[@]}" - - if [[ -n "$user" ]]; then - mysql_ensure_user_has_database_privileges "$user" "$database" "$privileges" "$db_host" "$db_port" - fi -} - -######################## -# Add or modify an entry in the MySQL configuration file ("$DB_CONF_FILE") -# Globals: -# DB_* -# Arguments: -# $1 - MySQL variable name -# $2 - Value to assign to the MySQL variable -# $3 - Section in the MySQL configuration file the key is located (default: mysqld) -# $4 - Configuration file (default: "$BD_CONF_FILE") -# Returns: -# None -######################### -mysql_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - read -r -a sections <<<"${3:-mysqld}" - local -r ignore_inline_comments="${4:-no}" - local -r file="${5:-"$DB_CONF_FILE"}" - info "Setting ${key} option" - debug "Setting ${key} to '${value}' in ${DB_FLAVOR} configuration file ${file}" - # Check if the configuration exists in the file - for section in "${sections[@]}"; do - if is_boolean_yes "$ignore_inline_comments"; then - ini-file set --ignore-inline-comments --section "$section" --key "$key" --value "$value" "$file" - else - ini-file set --section "$section" --key "$key" --value "$value" "$file" - fi - done -} - -######################## -# Update MySQL/MariaDB configuration file with user custom inputs -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_update_custom_config() { - # Persisted configuration files from old versions - ! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration - - # User injected custom configuration - if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then - debug "Injecting custom configuration from my_custom.conf" - cat "$DB_CONF_DIR/my_custom.cnf" > "$DB_CONF_DIR/bitnami/my_custom.cnf" - fi - - ! is_empty_value "$DB_USER" && mysql_conf_set "user" "$DB_USER" "mysqladmin" - ! is_empty_value "$DB_PORT_NUMBER" && mysql_conf_set "port" "$DB_PORT_NUMBER" "mysqld client manager" - ! is_empty_value "$DB_CHARACTER_SET" && mysql_conf_set "character_set_server" "$DB_CHARACTER_SET" - ! is_empty_value "$DB_COLLATE" && mysql_conf_set "collation_server" "$DB_COLLATE" - ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" - ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" - ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" - ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" - ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=( "/usr/lib" "/usr/lib64" ) - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} - -######################## -# Execute a reliable health check against the current mysql instance -# Globals: -# DB_ROOT_USER, DB_ROOT_PASSWORD, DB_MASTER_ROOT_PASSWORD -# Arguments: -# None -# Returns: -# mysqladmin output -######################### -mysql_healthcheck() { - local args=("-u${DB_ROOT_USER}" "-h0.0.0.0") - local root_password - - root_password="$(get_master_env_var_value ROOT_PASSWORD)" - if [[ -n "$root_password" ]]; then - args+=("-p${root_password}") - fi - - mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status -} - -######################## -# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# mysql client flavor -######################### -mysql_client_flavor() { - if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then - echo "mariadb" - else - echo "mysql" - fi -} - -######################## -# Prints extra options for MySQL client calls (i.e. SSL options) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# List of options to pass to "mysql" CLI -######################### -mysql_client_extra_opts() { - # Helper to get the proper value for the MySQL client environment variable - mysql_client_env_value() { - local env_name="MYSQL_CLIENT_${1:?missing name}" - if [[ -n "${!env_name:-}" ]]; then - echo "${!env_name:-}" - else - env_name="DB_CLIENT_${1}" - echo "${!env_name:-}" - fi - } - local -a opts=() - local key value - if is_boolean_yes "${DB_ENABLE_SSL:-no}"; then - if [[ "$(mysql_client_flavor)" = "mysql" ]]; then - opts+=("--ssl-mode=REQUIRED") - else - opts+=("--ssl=TRUE") - fi - # Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined - for key in ca key cert; do - value="$(mysql_client_env_value "SSL_${key^^}_FILE")" - [[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}") - done - else - # Skip SSL validation - if [[ "$(mysql_client_flavor)" = "mariadb" ]]; then - # SSL connections are enabled by default in MariaDB >=10.11 - local mysql_version="" - local major_version="" - local minor_version="" - mysql_version="$(mysql_get_version)" - major_version="$(get_sematic_version "${mysql_version}" 1)" - minor_version="$(get_sematic_version "${mysql_version}" 2)" - if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then - opts+=("--skip-ssl") - fi - fi - fi - echo "${opts[@]:-}" -} diff --git a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh b/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh deleted file mode 100644 index 54c504fe8d2c8..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh +++ /dev/null @@ -1,264 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for mariadb - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-mariadb}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -mariadb_env_vars=( - ALLOW_EMPTY_PASSWORD - MARIADB_AUTHENTICATION_PLUGIN - MARIADB_ROOT_USER - MARIADB_ROOT_PASSWORD - MARIADB_USER - MARIADB_PASSWORD - MARIADB_DATABASE - MARIADB_MASTER_HOST - MARIADB_MASTER_PORT_NUMBER - MARIADB_MASTER_ROOT_USER - MARIADB_MASTER_ROOT_PASSWORD - MARIADB_MASTER_DELAY - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - MARIADB_PORT_NUMBER - MARIADB_REPLICATION_MODE - MARIADB_REPLICATION_SLAVE_DUMP - MARIADB_EXTRA_FLAGS - MARIADB_INIT_SLEEP_TIME - MARIADB_CHARACTER_SET - MARIADB_COLLATE - MARIADB_BIND_ADDRESS - MARIADB_SQL_MODE - MARIADB_UPGRADE - MARIADB_SKIP_TEST_DB - MARIADB_CLIENT_ENABLE_SSL - MARIADB_CLIENT_SSL_CA_FILE - MARIADB_CLIENT_SSL_CERT_FILE - MARIADB_CLIENT_SSL_KEY_FILE - MARIADB_CLIENT_EXTRA_FLAGS - MARIADB_STARTUP_WAIT_RETRIES - MARIADB_STARTUP_WAIT_SLEEP_TIME - MARIADB_ENABLE_SLOW_QUERY - MARIADB_LONG_QUERY_TIME - MARIADB_GALERA_CONF_DIR - MARIADB_GALERA_MOUNTED_CONF_DIR - MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP - MARIADB_GALERA_CLUSTER_BOOTSTRAP - MARIADB_GALERA_CLUSTER_ADDRESS - MARIADB_GALERA_CLUSTER_NAME - MARIADB_GALERA_NODE_NAME - MARIADB_GALERA_NODE_ADDRESS - MARIADB_GALERA_SST_METHOD - MARIADB_GALERA_MARIABACKUP_USER - MARIADB_GALERA_MARIABACKUP_PASSWORD - MARIADB_ENABLE_LDAP - MARIADB_ENABLE_TLS - MARIADB_TLS_CERT_FILE - MARIADB_TLS_KEY_FILE - MARIADB_TLS_CA_FILE - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - DB_ENABLE_SLOW_QUERY - DB_LONG_QUERY_TIME -) -for env_var in "${mariadb_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset mariadb_env_vars -export DB_FLAVOR="mariadb" - -# Paths -export DB_BASE_DIR="${BITNAMI_ROOT_DIR}/mariadb" -export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" -export DB_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_SBIN_DIR="${DB_BASE_DIR}/sbin" -export DB_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_LOGS_DIR="${DB_BASE_DIR}/logs" -export DB_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_CONF_FILE="${DB_CONF_DIR}/my.cnf" -export DB_PID_FILE="${DB_TMP_DIR}/mysqld.pid" -export DB_SOCKET_FILE="${DB_TMP_DIR}/mysql.sock" -export PATH="${DB_SBIN_DIR}:${DB_BIN_DIR}:/opt/bitnami/common/bin:${PATH}" - -# System users (when running with a privileged user) -export DB_DAEMON_USER="mysql" -export DB_DAEMON_GROUP="mysql" - -# Default configuration (build-time) -export MARIADB_DEFAULT_PORT_NUMBER="3306" -export DB_DEFAULT_PORT_NUMBER="$MARIADB_DEFAULT_PORT_NUMBER" # only used at build time -export MARIADB_DEFAULT_CHARACTER_SET="utf8mb4" -export DB_DEFAULT_CHARACTER_SET="$MARIADB_DEFAULT_CHARACTER_SET" # only used at build time -export MARIADB_DEFAULT_BIND_ADDRESS="0.0.0.0" -export DB_DEFAULT_BIND_ADDRESS="$MARIADB_DEFAULT_BIND_ADDRESS" # only used at build time - -# MariaDB Galera authentication. -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export MARIADB_AUTHENTICATION_PLUGIN="${MARIADB_AUTHENTICATION_PLUGIN:-}" -export DB_AUTHENTICATION_PLUGIN="$MARIADB_AUTHENTICATION_PLUGIN" -export MARIADB_ROOT_USER="${MARIADB_ROOT_USER:-root}" -export DB_ROOT_USER="$MARIADB_ROOT_USER" # only used during the first initialization -export MARIADB_ROOT_PASSWORD="${MARIADB_ROOT_PASSWORD:-}" -export DB_ROOT_PASSWORD="$MARIADB_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_USER="${MARIADB_USER:-}" -export DB_USER="$MARIADB_USER" # only used during the first initialization -export MARIADB_PASSWORD="${MARIADB_PASSWORD:-}" -export DB_PASSWORD="$MARIADB_PASSWORD" # only used during the first initialization -export MARIADB_DATABASE="${MARIADB_DATABASE:-}" -export DB_DATABASE="$MARIADB_DATABASE" # only used during the first initialization -export MARIADB_MASTER_HOST="${MARIADB_MASTER_HOST:-}" -export DB_MASTER_HOST="$MARIADB_MASTER_HOST" # only used during the first initialization -export MARIADB_MASTER_PORT_NUMBER="${MARIADB_MASTER_PORT_NUMBER:-3306}" -export DB_MASTER_PORT_NUMBER="$MARIADB_MASTER_PORT_NUMBER" # only used during the first initialization -export MARIADB_MASTER_ROOT_USER="${MARIADB_MASTER_ROOT_USER:-root}" -export DB_MASTER_ROOT_USER="$MARIADB_MASTER_ROOT_USER" # only used during the first initialization -export MARIADB_MASTER_ROOT_PASSWORD="${MARIADB_MASTER_ROOT_PASSWORD:-}" -export DB_MASTER_ROOT_PASSWORD="$MARIADB_MASTER_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_MASTER_DELAY="${MARIADB_MASTER_DELAY:-0}" -export DB_MASTER_DELAY="$MARIADB_MASTER_DELAY" # only used during the first initialization -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Settings -export MARIADB_PORT_NUMBER="${MARIADB_PORT_NUMBER:-}" -export DB_PORT_NUMBER="$MARIADB_PORT_NUMBER" -export MARIADB_REPLICATION_MODE="${MARIADB_REPLICATION_MODE:-}" -export DB_REPLICATION_MODE="$MARIADB_REPLICATION_MODE" -export MARIADB_REPLICATION_SLAVE_DUMP="${MARIADB_REPLICATION_SLAVE_DUMP:-false}" -export DB_REPLICATION_SLAVE_DUMP="$MARIADB_REPLICATION_SLAVE_DUMP" -export MARIADB_EXTRA_FLAGS="${MARIADB_EXTRA_FLAGS:-}" -export DB_EXTRA_FLAGS="$MARIADB_EXTRA_FLAGS" -export MARIADB_INIT_SLEEP_TIME="${MARIADB_INIT_SLEEP_TIME:-}" -export DB_INIT_SLEEP_TIME="$MARIADB_INIT_SLEEP_TIME" -export MARIADB_CHARACTER_SET="${MARIADB_CHARACTER_SET:-}" -export DB_CHARACTER_SET="$MARIADB_CHARACTER_SET" -# MARIADB_COLLATION is deprecated in favor of MARIADB_COLLATE -MARIADB_COLLATE="${MARIADB_COLLATE:-"${MARIADB_COLLATION:-}"}" -export MARIADB_COLLATE="${MARIADB_COLLATE:-}" -export DB_COLLATE="$MARIADB_COLLATE" -export MARIADB_BIND_ADDRESS="${MARIADB_BIND_ADDRESS:-}" -export DB_BIND_ADDRESS="$MARIADB_BIND_ADDRESS" -export MARIADB_SQL_MODE="${MARIADB_SQL_MODE:-}" -export DB_SQL_MODE="$MARIADB_SQL_MODE" -export MARIADB_UPGRADE="${MARIADB_UPGRADE:-AUTO}" -export DB_UPGRADE="$MARIADB_UPGRADE" -export MARIADB_SKIP_TEST_DB="${MARIADB_SKIP_TEST_DB:-no}" -export DB_SKIP_TEST_DB="$MARIADB_SKIP_TEST_DB" -export MARIADB_CLIENT_ENABLE_SSL="${MARIADB_CLIENT_ENABLE_SSL:-no}" -export DB_CLIENT_ENABLE_SSL="$MARIADB_CLIENT_ENABLE_SSL" -export MARIADB_CLIENT_SSL_CA_FILE="${MARIADB_CLIENT_SSL_CA_FILE:-}" -export DB_CLIENT_SSL_CA_FILE="$MARIADB_CLIENT_SSL_CA_FILE" -export MARIADB_CLIENT_SSL_CERT_FILE="${MARIADB_CLIENT_SSL_CERT_FILE:-}" -export DB_CLIENT_SSL_CERT_FILE="$MARIADB_CLIENT_SSL_CERT_FILE" -export MARIADB_CLIENT_SSL_KEY_FILE="${MARIADB_CLIENT_SSL_KEY_FILE:-}" -export DB_CLIENT_SSL_KEY_FILE="$MARIADB_CLIENT_SSL_KEY_FILE" -export MARIADB_CLIENT_EXTRA_FLAGS="${MARIADB_CLIENT_EXTRA_FLAGS:-no}" -export DB_CLIENT_EXTRA_FLAGS="$MARIADB_CLIENT_EXTRA_FLAGS" -export MARIADB_STARTUP_WAIT_RETRIES="${MARIADB_STARTUP_WAIT_RETRIES:-300}" -export DB_STARTUP_WAIT_RETRIES="$MARIADB_STARTUP_WAIT_RETRIES" -export MARIADB_STARTUP_WAIT_SLEEP_TIME="${MARIADB_STARTUP_WAIT_SLEEP_TIME:-2}" -export DB_STARTUP_WAIT_SLEEP_TIME="$MARIADB_STARTUP_WAIT_SLEEP_TIME" -MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-"${DB_ENABLE_SLOW_QUERY:-}"}" -export MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-0}" -export DB_ENABLE_SLOW_QUERY="$MARIADB_ENABLE_SLOW_QUERY" -MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-"${DB_LONG_QUERY_TIME:-}"}" -export MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-10.0}" -export DB_LONG_QUERY_TIME="$MARIADB_LONG_QUERY_TIME" - -# Galera paths -export MARIADB_GALERA_GRASTATE_FILE="${DB_DATA_DIR}/grastate.dat" -export DB_GALERA_GRASTATE_FILE="$MARIADB_GALERA_GRASTATE_FILE" -export MARIADB_GALERA_BOOTSTRAP_DIR="${DB_VOLUME_DIR}/.bootstrap" -export DB_GALERA_BOOTSTRAP_DIR="$MARIADB_GALERA_BOOTSTRAP_DIR" -export MARIADB_GALERA_BOOTSTRAP_FILE="${DB_GALERA_BOOTSTRAP_DIR}/done" -export DB_GALERA_BOOTSTRAP_FILE="$MARIADB_GALERA_BOOTSTRAP_FILE" - -# Galera build-time defaults for cluster configuration -export MARIADB_GALERA_DEFAULT_CLUSTER_ADDRESS="gcomm://" -export DB_GALERA_DEFAULT_CLUSTER_ADDRESS="$MARIADB_GALERA_DEFAULT_CLUSTER_ADDRESS" -export MARIADB_GALERA_DEFAULT_CLUSTER_NAME="galera" -export DB_GALERA_DEFAULT_CLUSTER_NAME="$MARIADB_GALERA_DEFAULT_CLUSTER_NAME" -export MARIADB_GALERA_DEFAULT_NODE_NAME="" -export DB_GALERA_DEFAULT_NODE_NAME="$MARIADB_GALERA_DEFAULT_NODE_NAME" -export MARIADB_GALERA_DEFAULT_NODE_ADDRESS="" -export DB_GALERA_DEFAULT_NODE_ADDRESS="$MARIADB_GALERA_DEFAULT_NODE_ADDRESS" -export MARIADB_GALERA_DEFAULT_SST_METHOD="mariabackup" -export DB_GALERA_DEFAULT_SST_METHOD="$MARIADB_GALERA_DEFAULT_SST_METHOD" -export MARIADB_GALERA_DEFAULT_MARIABACKUP_USER="mariabackup" -export DB_GALERA_DEFAULT_MARIABACKUP_USER="$MARIADB_GALERA_DEFAULT_MARIABACKUP_USER" -export MARIADB_GALERA_DEFAULT_MARIABACKUP_PASSWORD="" -export DB_GALERA_DEFAULT_MARIABACKUP_PASSWORD="$MARIADB_GALERA_DEFAULT_MARIABACKUP_PASSWORD" - -# Galera cluster configuration. -export MARIADB_GALERA_CONF_DIR="${MARIADB_GALERA_CONF_DIR:-/opt/bitnami/mariadb/conf}" -export DB_GALERA_CONF_DIR="$MARIADB_GALERA_CONF_DIR" -export MARIADB_GALERA_MOUNTED_CONF_DIR="${MARIADB_GALERA_MOUNTED_CONF_DIR:-/bitnami/conf}" -export DB_GALERA_MOUNTED_CONF_DIR="$MARIADB_GALERA_MOUNTED_CONF_DIR" -export MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP="${MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP:-}" -export DB_GALERA_FORCE_SAFETOBOOTSTRAP="$MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP" -export MARIADB_GALERA_CLUSTER_BOOTSTRAP="${MARIADB_GALERA_CLUSTER_BOOTSTRAP:-}" -export DB_GALERA_CLUSTER_BOOTSTRAP="$MARIADB_GALERA_CLUSTER_BOOTSTRAP" -export MARIADB_GALERA_CLUSTER_ADDRESS="${MARIADB_GALERA_CLUSTER_ADDRESS:-}" -export DB_GALERA_CLUSTER_ADDRESS="$MARIADB_GALERA_CLUSTER_ADDRESS" -export MARIADB_GALERA_CLUSTER_NAME="${MARIADB_GALERA_CLUSTER_NAME:-$DB_GALERA_DEFAULT_CLUSTER_NAME}" -export DB_GALERA_CLUSTER_NAME="$MARIADB_GALERA_CLUSTER_NAME" -export MARIADB_GALERA_NODE_NAME="${MARIADB_GALERA_NODE_NAME:-}" -export DB_GALERA_NODE_NAME="$MARIADB_GALERA_NODE_NAME" -export MARIADB_GALERA_NODE_ADDRESS="${MARIADB_GALERA_NODE_ADDRESS:-}" -export DB_GALERA_NODE_ADDRESS="$MARIADB_GALERA_NODE_ADDRESS" -export MARIADB_GALERA_SST_METHOD="${MARIADB_GALERA_SST_METHOD:-$DB_GALERA_DEFAULT_SST_METHOD}" -export DB_GALERA_SST_METHOD="$MARIADB_GALERA_SST_METHOD" -export MARIADB_GALERA_MARIABACKUP_USER="${MARIADB_GALERA_MARIABACKUP_USER:-$DB_GALERA_DEFAULT_MARIABACKUP_USER}" -export DB_GALERA_MARIABACKUP_USER="$MARIADB_GALERA_MARIABACKUP_USER" -export MARIADB_GALERA_MARIABACKUP_PASSWORD="${MARIADB_GALERA_MARIABACKUP_PASSWORD:-$DB_GALERA_DEFAULT_MARIABACKUP_PASSWORD}" -export DB_GALERA_MARIABACKUP_PASSWORD="$MARIADB_GALERA_MARIABACKUP_PASSWORD" - -# LDAP -export MARIADB_ENABLE_LDAP="${MARIADB_ENABLE_LDAP:-no}" -export DB_ENABLE_LDAP="$MARIADB_ENABLE_LDAP" - -# SSL/TLS configuration -export MARIADB_ENABLE_TLS="${MARIADB_ENABLE_TLS:-no}" -export DB_ENABLE_TLS="$MARIADB_ENABLE_TLS" -export MARIADB_TLS_CERT_FILE="${MARIADB_TLS_CERT_FILE:-}" -export DB_TLS_CERT_FILE="$MARIADB_TLS_CERT_FILE" -export MARIADB_TLS_KEY_FILE="${MARIADB_TLS_KEY_FILE:-}" -export DB_TLS_KEY_FILE="$MARIADB_TLS_KEY_FILE" -export MARIADB_TLS_CA_FILE="${MARIADB_TLS_CA_FILE:-}" -export DB_TLS_CA_FILE="$MARIADB_TLS_CA_FILE" -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-monitor}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-monitor}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Custom environment variables may be defined below diff --git a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh b/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh deleted file mode 100755 index ec7e80256766f..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/mariadb/conf) -debug "Copying files from $DB_DEFAULT_CONF_DIR to $DB_CONF_DIR" -cp -nr "$DB_DEFAULT_CONF_DIR"/. "$DB_CONF_DIR" - -print_welcome_page - -if [[ "$1" = "/opt/bitnami/scripts/mariadb-galera/run.sh" ]]; then - info "** Starting MariaDB setup **" - /opt/bitnami/scripts/mariadb-galera/setup.sh - info "** MariaDB setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh b/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh deleted file mode 100755 index 8bd30f5f8ae49..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -mysql_healthcheck diff --git a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh b/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh deleted file mode 100755 index 503f456f66f0d..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libldapclient.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# Configure MariaDB options based on build-time defaults -info "Configuring default MariaDB options" -ensure_dir_exists "$DB_CONF_DIR" -mysql_create_default_config - -for dir in "$DB_TMP_DIR" "$DB_LOGS_DIR" "$DB_CONF_DIR" "$DB_DEFAULT_CONF_DIR" "${DB_CONF_DIR}/bitnami" "$DB_VOLUME_DIR" "$DB_DATA_DIR" "$DB_GALERA_BOOTSTRAP_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# LDAP permissions -ldap_configure_permissions -ldap_create_pam_config "mariadb" - -# Fix to avoid issues detecting plugins in mysql_install_db -ln -sf "$DB_BASE_DIR/plugin" "$DB_BASE_DIR/lib/plugin" - -# Redirect all logging to stdout -ln -sf /dev/stdout "$DB_LOGS_DIR/mysqld.log" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${DB_CONF_DIR}/"* "$DB_DEFAULT_CONF_DIR" diff --git a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh b/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh deleted file mode 100755 index 69b8d4496908b..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libldapclient.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# mysqld_safe does not allow logging to stdout/stderr, so we stick with mysqld -EXEC="${DB_SBIN_DIR}/mysqld" - -flags=("--defaults-file=${DB_CONF_DIR}/my.cnf" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") -[[ -z "${DB_PID_FILE:-}" ]] || flags+=("--pid-file=${DB_PID_FILE}") - -# Add flags specified via the 'DB_EXTRA_FLAGS' environment variable -read -r -a db_extra_flags <<< "$(mysql_extra_flags)" -[[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - -# Add flags passed to this script -flags+=("$@") - -# Fix for MDEV-16183 - mysqld_safe already does this, but we are using mysqld -LD_PRELOAD="$(find_jemalloc_lib)${LD_PRELOAD:+ "$LD_PRELOAD"}" -export LD_PRELOAD - -is_boolean_yes "$DB_ENABLE_LDAP" && ldap_start_nslcd_bg - -info "** Starting MariaDB **" - -set_previous_boot - -if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "$EXEC" "${flags[@]}" -else - exec "$EXEC" "${flags[@]}" -fi diff --git a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh b/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh deleted file mode 100755 index 77c9f7d5d1a97..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadbgalera.sh -. /opt/bitnami/scripts/libldapclient.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# Ensure mysql unix socket file does not exist -rm -rf "${DB_SOCKET_FILE}.lock" -# Ensure MariaDB environment variables settings are valid -mysql_validate -# Ensure MariaDB is stopped when this script ends. -trap "mysql_stop" EXIT -if am_i_root; then - # Ensure 'daemon' user exists when running as 'root' - ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" - # Ensure 'nslcd' user exists when running as 'root' - ensure_user_exists "$LDAP_NSLCD_USER" --group "$LDAP_NSLCD_GROUP" - # Fix logging issue when running as root - chmod o+w "$(readlink /dev/stdout)" -fi -# Ensure MariaDB is initialized -mysql_initialize -# Ensure LDAP is initialized -is_boolean_yes "$DB_ENABLE_LDAP" && ldap_initialize -# Allow running custom initialization scripts -mysql_custom_scripts 'init' -# Allow running custom start scripts -mysql_custom_scripts 'start' -# Stop MariaDB before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -mysql_stop diff --git a/bitnami/mariadb-galera/11.5/debian-12/tags-info.yaml b/bitnami/mariadb-galera/11.5/debian-12/tags-info.yaml deleted file mode 100644 index be7a5e90b6082..0000000000000 --- a/bitnami/mariadb-galera/11.5/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "11.5" -- 11.5-debian-12 -- 11.5.2 diff --git a/bitnami/mariadb-galera/11.6/README.md b/bitnami/mariadb-galera/11.6/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/mariadb-galera/11.6/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/mariadb-galera/11.6/debian-12/Dockerfile b/bitnami/mariadb-galera/11.6/debian-12/Dockerfile deleted file mode 100644 index fc1134b7ef363..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-03T15:26:53Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="11.6.2-debian-12-r1" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mariadb-galera" \ - org.opencontainers.image.title="mariadb-galera" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="11.6.2" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl iproute2 ldap-utils libaio1 libaudit1 libcap-ng0 libcrypt1 libgcc-s1 libicu72 libldap-common liblzma5 libncurses6 libpam-ldapd libpam0g libssl3 libstdc++6 libtinfo6 libxml2 nslcd procps psmisc rsync socat zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "ini-file-1.4.7-7-linux-${OS_ARCH}-debian-12" \ - "mariadb-galera-11.6.2-1-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir /docker-entrypoint-initdb.d - -COPY rootfs / -RUN /opt/bitnami/scripts/mariadb-galera/postunpack.sh -ENV APP_VERSION="11.6.2" \ - BITNAMI_APP_NAME="mariadb-galera" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/common/sbin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:$PATH" - -EXPOSE 3306 4444 4567 4568 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/mariadb-galera/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/mariadb-galera/run.sh" ] diff --git a/bitnami/mariadb-galera/11.6/debian-12/docker-compose-ldap.yml b/bitnami/mariadb-galera/11.6/debian-12/docker-compose-ldap.yml deleted file mode 100644 index b51180e58e260..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/docker-compose-ldap.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-galera: - image: docker.io/bitnami/mariadb-galera:11.6 - ports: - - '3306:3306' - - '4444:4444' - - '4567:4567' - - '4568:4568' - volumes: - - 'mariadb_galera_data:/bitnami/mariadb' - environment: - - MARIADB_ROOT_PASSWORD=root-password - - MARIADB_GALERA_MARIABACKUP_PASSWORD=backup-password - - MARIADB_USER=user01 - - MARIADB_DATABASE=my_database - - MARIADB_GALERA_CLUSTER_ADDRESS=gcomm:// - - MARIADB_ENABLE_LDAP=yes - - LDAP_URI=ldap://openldap:1389 - - LDAP_BASE=dc=example,dc=org - - LDAP_BIND_DN=cn=admin,dc=example,dc=org - - LDAP_BIND_PASSWORD=adminpassword - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb-galera/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - - openldap: - image: 'docker.io/bitnami/openldap:latest' - ports: - - '1389:1389' - environment: - - LDAP_ADMIN_USERNAME=admin - - LDAP_ADMIN_PASSWORD=adminpassword - - LDAP_USERS=user01 - - LDAP_PASSWORDS=password1 - volumes: - - 'openldap_data:/bitnami/openldap' - -volumes: - mariadb_galera_data: - driver: local - openldap_data: - driver: local diff --git a/bitnami/mariadb-galera/11.6/debian-12/docker-compose.yml b/bitnami/mariadb-galera/11.6/debian-12/docker-compose.yml deleted file mode 100644 index 4179c9af90613..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/docker-compose.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-galera: - image: docker.io/bitnami/mariadb-galera:11.6 - ports: - - '3306:3306' - - '4444:4444' - - '4567:4567' - - '4568:4568' - volumes: - - 'mariadb_galera_data:/bitnami/mariadb' - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_GALERA_CLUSTER_ADDRESS=gcomm:// - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb-galera/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_galera_data: - driver: local diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 9346480d3c476..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ini-file": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.4.7-7" - }, - "mariadb-galera": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "11.6.2-1" - } -} \ No newline at end of file diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh b/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh deleted file mode 100644 index fa50716cf1ff9..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/libldapclient.sh +++ /dev/null @@ -1,222 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami LDAP library - -# shellcheck disable=SC1090,SC1091 - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -######################## -# Loads global variables used on LDAP configuration. -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# Series of exports to be used as 'eval' arguments -######################### -ldap_env() { - cat <<"EOF" -export LDAP_NSLCD_USER="nslcd" -export LDAP_URI="${LDAP_URI:-}" -export LDAP_BASE="${LDAP_BASE:-}" -export LDAP_BIND_DN="${LDAP_BIND_DN:-}" -export LDAP_BIND_PASSWORD="${LDAP_BIND_PASSWORD:-}" -export LDAP_BASE_LOOKUP="${LDAP_BASE_LOOKUP:-}" -export LDAP_NSS_INITGROUPS_IGNOREUSERS="${LDAP_NSS_INITGROUPS_IGNOREUSERS:-root,nslcd}" -export LDAP_SCOPE="${LDAP_SCOPE:-}" -export LDAP_TLS_REQCERT="${LDAP_TLS_REQCERT:-}" -export LDAP_SEARCH_FILTER="${LDAP_SEARCH_FILTER:-}" -export LDAP_SEARCH_MAP="${LDAP_SEARCH_MAP:-}" - -EOF - if [[ "$OS_FLAVOUR" =~ ^debian-.*$ ]]; then - cat <<"EOF" -export LDAP_NSLCD_GROUP="nslcd" -EOF - elif [[ "$OS_FLAVOUR" =~ ^(photon)-.*$ ]]; then - cat <<"EOF" -export LDAP_NSLCD_GROUP="ldap" -EOF - fi -} - -######################## -# Return LDAP config file path depending on distro -# Globals: -# OS_FLAVOUR -# Arguments: -# None -# Returns: -# (String) LDAP config file path -######################### -ldap_openldap_config_path() { - local openldap_config - case "$OS_FLAVOUR" in - debian-* | ubuntu-*) openldap_config=/etc/ldap/ldap.conf ;; - photon-* | redhatubi-*) openldap_config=/etc/openldap/ldap.conf ;; - *) error "Unsupported OS flavor ${OS_FLAVOUR}" && exit 1 ;; - esac - echo "$openldap_config" -} - -######################## -# Configure LDAP permissions (to be used at postunpack leve). -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# None -######################### -ldap_configure_permissions() { - ensure_dir_exists "/var/run/nslcd" && configure_permissions_ownership "/var/run/nslcd" -u "root" -g "root" -d "775" - # The nslcd.conf file may not exist in distros like UBI, so we need to create it first - touch "/etc/nslcd.conf" - configure_permissions_ownership "/etc/nslcd.conf" -u "root" -g "root" -f "660" - configure_permissions_ownership "$(ldap_openldap_config_path)" -u "root" -g "root" -f "660" -} - -######################## -# Create nslcd.conf file -# Globals: -# LDAP_* -# Arguments: -# None -# Returns: -# None -######################### -ldap_create_nslcd_config() { - if am_i_root; then - chown "root:${LDAP_NSLCD_GROUP}" "/etc/nslcd.conf" - chown -R "${LDAP_NSLCD_USER}:${LDAP_NSLCD_GROUP}" "/var/run/nslcd" - cat >"/etc/nslcd.conf" <"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"/etc/nslcd.conf" <>"$(ldap_openldap_config_path)" <"/etc/pam.d/${filename}" < 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - elif [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - if [[ -z "$DB_MASTER_HOST" ]]; then - print_validation_error "Slave replication mode chosen without setting the environment variable $(get_env_var MASTER_HOST). Use it to indicate where the Master node is running" - fi - else - print_validation_error "Invalid replication mode. Available options are 'master/slave'" - fi - else - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ "$DB_USER" = "root" ]]; then - print_validation_error "root user is already created in the database and you can't use it as username for user creation." - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - if [[ "${DB_REPLICATION_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "$dump_file" - debug "Finish dump databases" - - debug "Unlock master databases for write operations" - echo "UNLOCK TABLES;" | mysql_remote_execute "$DB_MASTER_HOST" "$DB_MASTER_PORT_NUMBER" "mysql" "$DB_MASTER_ROOT_USER" "$DB_MASTER_ROOT_PASSWORD" - - debug "Start import dump databases" - mysql_execute < "$dump_file" - mysql_execute "mysql" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - if ! grep --silent "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" "${DB_CONF_FILE}"; then - echo "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" >> "${DB_CONF_FILE}" - fi - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Using persisted data" - # mysql_upgrade requires the server to be running - [[ -n "$(get_master_env_var_value ROOT_PASSWORD)" ]] && export ROOT_AUTH_ENABLED="yes" - # https://dev.mysql.com/doc/refman/8.0/en/replication-upgrade.html - mariadb_upgrade - else - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - info "Installing database" - mariadb_install_db - mysql_start_bg - wait_for_mysql_access - # we delete existing users and create new ones with stricter access - # commands can still be executed until we restart or run 'flush privileges' - info "Configuring authentication" - mysql_execute "mysql" <=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Initialize database data -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_install_db() { - local command="${DB_BIN_DIR}/mysql_install_db" - local -a args=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && args+=("${db_extra_flags[@]}") - - am_i_root && args=("${args[@]}" "--user=$DB_DAEMON_USER") - args+=("--auth-root-authentication-method=normal") - # Feature available only in MariaDB 10.5+ - # ref: https://mariadb.com/kb/en/mysql_install_db/#not-creating-the-test-database-and-anonymous-user - if [[ ! "$(mysql_get_version)" =~ ^10\.[01234]\. ]]; then - is_boolean_yes "$DB_SKIP_TEST_DB" && args+=("--skip-test-db") - fi - - debug_execute "$command" "${args[@]}" -} - -######################## -# Upgrade Database Schema -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_upgrade() { - local -a args=("--defaults-file=${DB_CONF_FILE}" "-u" "$DB_ROOT_USER") - info "Running mysql_upgrade" - mysql_start_bg - is_boolean_yes "${ROOT_AUTH_ENABLED:-false}" && args+=("-p$(get_master_env_var_value ROOT_PASSWORD)") - [[ "${DB_UPGRADE}" == "FORCE" ]] && args+=("--force") - debug_execute "${DB_BIN_DIR}/mysql_upgrade" "${args[@]}" || echo "This installation is already upgraded" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami MySQL Galera library - -# shellcheck disable=SC1090,SC1091,SC2119,SC2120 - -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libnet.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh -. /opt/bitnami/scripts/libfile.sh - -######################## -# Check if a previous boot exists -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Yes or no -######################### -get_previous_boot() { - [[ -e "$DB_GALERA_BOOTSTRAP_FILE" ]] && echo "yes" || echo "no" -} - -######################## -# Create a flag file to indicate previous boot -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -set_previous_boot() { - info "Setting previous boot" - touch "$DB_GALERA_BOOTSTRAP_FILE" -} - -######################## -# Configure database extra start flags -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Array with extra flags to use -######################### -mysql_extra_flags() { - local -a dbExtraFlags=() - read -r -a userExtraFlags <<< "${DB_EXTRA_FLAGS?}" - - # This avoids a non-writable configuration file break a Galera Cluster, due to lack of proper Galera clustering configuration - # This is especially important for the MariaDB Galera chart, in which the 'my.cnf' configuration file is mounted by default - if ! is_file_writable "$DB_CONF_FILE"; then - dbExtraFlags+=( - "--wsrep-node-name=$(get_node_name)" - "--wsrep-node-address=$(get_node_address)" - "--wsrep-cluster-name=${DB_GALERA_CLUSTER_NAME}" - "--wsrep-cluster-address=$(get_galera_cluster_address_value)" - "--wsrep-sst-method=${DB_GALERA_SST_METHOD}" - "--wsrep-sst-auth=${DB_GALERA_MARIABACKUP_USER}:${DB_GALERA_MARIABACKUP_PASSWORD}" - ) - fi - - [[ ${#userExtraFlags[@]} -eq 0 ]] || dbExtraFlags+=("${userExtraFlags[@]}") - - echo "${dbExtraFlags[@]}" -} - -######################## -# Whether the Galera node will perform bootstrapping of a new cluster, or join an existing one -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Yes or no -######################### -get_galera_cluster_bootstrap_value() { - local cluster_bootstrap - - # This block evaluate if the cluster needs to be boostraped or not. - # When the node is marked to bootstrap: - # - When it is force by setting DB_GALERA_CLUSTER_BOOTSTRAP - # - When there is not previous boot and not other nodes has been found - # When the node is not marked to bootstrap, the node will join an existing cluster. - cluster_bootstrap="no" # initial value - if is_boolean_yes "$DB_GALERA_CLUSTER_BOOTSTRAP"; then - cluster_bootstrap="yes" - elif ! is_boolean_yes "$(get_previous_boot)" && ! is_boolean_yes "$(has_galera_cluster_other_nodes)"; then - cluster_bootstrap="yes" - fi - echo "$cluster_bootstrap" -} - -######################## -# Whether the Galera cluster has other running nodes -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -has_galera_cluster_other_nodes() { - local node_ip cluster_address address has_nodes - - hostname_has_ips() { - local hostname="${1:?hostname is required}" - [[ "$(getent ahosts "$hostname")" != "" ]] && return 0 - return 1 - } - - has_nodes="yes" - cluster_address="$DB_GALERA_CLUSTER_ADDRESS" - if [[ -z "$cluster_address" ]]; then - has_nodes="no" - elif [[ -n "$cluster_address" ]]; then - has_nodes="no" - read -r -a local_ips <<< "$(hostname -i)" - read -r -a addresses <<< "$(tr ',' ' ' <<< "${cluster_address#*://}")" - if [[ "${#addresses[@]}" -eq "1" ]]; then - if validate_ipv4 "$(echo "${addresses[0]}" | cut -d':' -f1)"; then - has_nodes="yes" - else - address="$(echo "${addresses[0]}" | cut -d':' -f1)" - if retry_while "hostname_has_ips $address" 2 2; then - for ip in $(getent ahosts "$address" | awk '{print $1}' | uniq); do - for local_ip in "${local_ips[@]}"; do - if [[ "$ip" != "$local_ip" ]]; then - has_nodes="yes" - break - fi - done - done - fi - fi - else - for a in "${addresses[@]}"; do - address="$(echo "$a" | cut -d':' -f1)" - node_ip="" - if validate_ipv4 "$address"; then - node_ip="$address" - else - if retry_while "hostname_has_ips $address" 2 2; then - node_ip="$(dns_lookup "$address")" - fi - fi - if [[ -n "$node_ip" ]]; then - has_nodes="yes" - # we now check if *any* of our IPs matches the node IP. In that case, we have to revert has_nodes to no, because it's not in fact a foreign node and check the next. - for local_ip in "${local_ips[@]}"; do - if [[ "$node_ip" == "$local_ip" ]]; then - has_nodes="no" - break - fi - done - # The foreign IP did not match our local IP, so we know that another node exists. - if [[ "$has_nodes" == 'yes' ]]; then - break - fi - fi - done - fi - fi - echo "$has_nodes" -} - -######################## -# Build Galera cluster address string from the bootstrap string -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -get_galera_cluster_address_value() { - local cluster_address - - if ! is_boolean_yes "$(get_galera_cluster_bootstrap_value)" && is_boolean_yes "$(has_galera_cluster_other_nodes)"; then - cluster_address="$DB_GALERA_CLUSTER_ADDRESS" - else - cluster_address="gcomm://" - fi - - debug "Set Galera cluster address to ${cluster_address}" - echo "$cluster_address" -} - -######################## -# Validate settings in MYSQL_*/MARIADB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_validate() { - info "Validating settings in MYSQL_*/MARIADB_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - backslash_password_error() { - print_validation_error "The password cannot contain backslashes ('\'). Set the environment variable $1 with no backslashes (more info at https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html)" - } - - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -n "$DB_GALERA_MARIABACKUP_USER" ]] && [[ -z "$DB_GALERA_MARIABACKUP_PASSWORD" ]]; then - empty_password_error "$(get_env_var GALERA_MARIABACKUP_PASSWORD)" - fi - - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if (( ${#DB_ROOT_PASSWORD} > 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]]; then - if is_boolean_yes "$DB_ENABLE_LDAP" && [[ -n "$DB_PASSWORD" ]]; then - warn "You enabled LDAP authentication. '$DB_USER' user will be authentication using LDAP, the password set at the environment variable $(get_env_var PASSWORD) will be ignored" - elif ! is_boolean_yes "$DB_ENABLE_LDAP" && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - fi - - if [[ -n "$DB_GALERA_FORCE_SAFETOBOOTSTRAP" ]] && ! is_yes_no_value "$DB_GALERA_FORCE_SAFETOBOOTSTRAP"; then - print_validation_error "The allowed values for $(get_env_var GALERA_FORCE_SAFETOBOOTSTRAP) are yes or no." - fi - - if [[ -z "$DB_GALERA_CLUSTER_NAME" ]]; then - print_validation_error "Galera cluster cannot be created without setting the environment variable $(get_env_var GALERA_CLUSTER_NAME)." - fi - - if [[ -z "$(get_galera_cluster_address_value)" ]]; then - print_validation_error "Galera cluster cannot be created without setting the environment variable $(get_env_var GALERA_CLUSTER_ADDRESS). If you are bootstrapping a new Galera cluster, set the environment variable $(get_env_var GALERA_CLUSTER_ADDRESS)=yes." - fi - - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - - if is_boolean_yes "$DB_ENABLE_LDAP" && { [[ -z "${LDAP_URI}" ]] || [[ -z "${LDAP_BASE}" ]] || [[ -z "${LDAP_BIND_DN}" ]] || [[ -z "${LDAP_BIND_PASSWORD}" ]]; }; then - print_validation_error "The LDAP configuration is required when LDAP authentication is enabled. Set the environment variables LDAP_URI, LDAP_BASE, LDAP_BIND_DN and LDAP_BIND_PASSWORD with the LDAP configuration." - fi - - if is_boolean_yes "$DB_ENABLE_TLS"; then - if [[ -z "${DB_TLS_CERT_FILE}" ]] || [[ -z "${DB_TLS_KEY_FILE}" ]] || [[ -z "${DB_TLS_CA_FILE}" ]]; then - print_validation_error "The TLS cert file, key and CA are required when TLS is enabled. Set the environment variables TLS_CERT_FILE, TLS_KEY_FILE and TLS_CA_FILE with the path to each file." - fi - if [[ ! -f "${DB_TLS_CERT_FILE}" ]]; then - print_validation_error "The TLS_CERT file ${DB_TLS_CERT_FILE} must exist." - fi - if [[ ! -f "${DB_TLS_KEY_FILE}" ]]; then - print_validation_error "The TLS_KEY file ${DB_TLS_KEY_FILE} must exist." - fi - if [[ ! -f "${DB_TLS_CA_FILE}" ]]; then - print_validation_error "The TLS_CA file ${DB_TLS_CA_FILE} must exist." - fi - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Persisted data detected. Restoring" - - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - if is_boolean_yes "$DB_GALERA_FORCE_SAFETOBOOTSTRAP"; then - set_safe_to_bootstrap - fi - if ! is_safe_to_bootstrap; then - error "It is not safe to bootstrap form this node ('safe_to_bootstrap=0' is set in 'grastate.dat'). If you want to force bootstrap, set the environment variable MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP=yes" - exit 1 - fi - fi - - return - else - # initialization should not be performed on non-primary nodes of a galera cluster - if is_boolean_yes "$(get_galera_cluster_bootstrap_value)"; then - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - mariadb_install_db - mysql_start_bg - debug "Deleting all users to avoid issues with galera configuration" - mysql_execute "mysql" </dev/null - hostname - fi -} - -######################## -# Check for user override of wsrep_node_address -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# String with node address -######################### -get_node_address() { - if [[ -n "$DB_GALERA_NODE_ADDRESS" ]]; then - echo "$DB_GALERA_NODE_ADDRESS" - else - # In some environments, the network may not be fully set up when starting the initialization - # So, to avoid issues, we retry the 'hostname' command until it succeeds (for a few minutes) - local -r retries="60" - local -r seconds="5" - retry_while "hostname -i" "$retries" "$seconds" >/dev/null - # prefer IPv6 over IPv4 if available - # This works by pulling any IPv4 addresses encountered into hold space and emitting it only when the EOF line is encountered - printf '%s\nEOF' "$(hostname -i | tr ' ' '\n')" | sed '/:/{;q;};/^EOF$/{;g;q;};h;d' - fi -} - -######################## -# Starts MySQL/MariaDB in the background and waits until it's ready -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_start_bg() { - local -a flags=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") - - # Only allow local connections until MySQL is fully initialized, to avoid apps trying to connect to MySQL before it is fully initialized - flags+=("--bind-address=127.0.0.1") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - - # Do not start as root, to avoid permission issues - am_i_root && flags+=("--user=${DB_DAEMON_USER}") - - # The slave should only start in 'run.sh', elseways user credentials would be needed for any connection - flags+=("--skip-slave-start") - flags+=("$@") - - is_mysql_running && return - - info "Starting $DB_FLAVOR in background" - debug_execute "${DB_SBIN_DIR}/mysqld" "${flags[@]}" & - - # we cannot use wait_for_mysql_access here as mysql_upgrade for MySQL >=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Wait for WSREP to be ready. If WSREP is not ready, we cannot do any transactions, thus cannot - # create any users, and WSREP instantly kills MariaDB if doing so - wait_for_wsrep - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Wait for WSREP to be ready to do transactions -# Arguments: -# None -# Returns: -# None -######################## -wait_for_wsrep() { - local -r retries=300 - local -r sleep_time=2 - if ! retry_while is_wsrep_ready "$retries" "$sleep_time"; then - error "WSREP did not become ready" - return 1 - fi -} - -######################## -# Checks for WSREP to be ready to do transactions -# Arguments: -# None -# Returns: -# Boolean -######################## -is_wsrep_ready() { - debug "Checking if WSREP is ready" - is_ready="$(mysql_execute_print_output "mysql" "root" <> "$custom_conf_file" - cat "$old_custom_conf_file" >> "$custom_conf_file" - fi - if am_i_root; then - [[ -e "$DB_VOLUME_DIR/.initialized" ]] && rm "$DB_VOLUME_DIR/.initialized" - rm -rf "$DB_VOLUME_DIR/conf" - else - warn "Old custom configuration migrated, please manually remove the 'conf' directory from the volume use to persist data" - fi -} - -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - local mysql_create_user_cmd - [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.4, the mysql.user table was replaced with a view: https://mariadb.com/kb/en/mysqluser-table/ - # Views have a definer user, in this case set to 'root', which needs to exist for the view to work - # In MySQL, to avoid issues when renaming the root user, they use the 'mysql.sys' user as a definer: https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html - # However, for MariaDB that is not the case, so when the 'root' user is renamed the 'mysql.user' table stops working and the view needs to be fixed - if [[ "$user" != "root" && ! "$(mysql_get_version)" =~ ^10.[0123]. ]]; then - alter_view_str="$(mysql_execute_print_output "mysql" "$user" "$password" "-s" <&2 - return 1 - ;; - esac - shift - done - - local -a mysql_execute_cmd=("mysql_execute") - [[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - - local -a create_database_args=() - [[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'") - [[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'") - - debug "Creating database $database" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$user") - [[ -n "$db_host" ]] && flags+=("--host" "${db_host}") - [[ -n "$db_port" ]] && flags+=("--port" "${db_port}") - if is_boolean_yes "$use_ldap"; then - flags+=("--use-ldap") - elif [[ -n "$password" ]]; then - flags+=("-p" "$password") - [[ -n "$auth_plugin" ]] && flags=("${flags[@]}" "--auth-plugin" "$auth_plugin") - fi - mysql_ensure_user_exists "${flags[@]}" -} - -######################## -# Optionally create the given database, and then optionally give a user -# full privileges on the database. -# Flags: -# -u|--user - database user -# --character-set - character set -# --collation - collation -# --host - database host -# --port - database port -# Arguments: -# $1 - database name -# Returns: -# None -######################### -mysql_ensure_optional_database_exists() { - local -r database="${1:?database is missing}" - local character_set="" - local collate="" - local user="" - local privileges="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - --character-set) - shift - character_set="${1:?missing character set}" - ;; - --collate) - shift - collate="${1:?missing collate}" - ;; - -u|--user) - shift - user="${1:?missing database user}" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - --privileges) - shift - privileges="${1:?missing privileges}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$database") - [[ -n "$character_set" ]] && flags+=("--character-set" "$character_set") - [[ -n "$collate" ]] && flags+=("--collate" "$collate") - [[ -n "$db_host" ]] && flags+=("--host" "$db_host") - [[ -n "$db_port" ]] && flags+=("--port" "$db_port") - mysql_ensure_database_exists "${flags[@]}" - - if [[ -n "$user" ]]; then - mysql_ensure_user_has_database_privileges "$user" "$database" "$privileges" "$db_host" "$db_port" - fi -} - -######################## -# Add or modify an entry in the MySQL configuration file ("$DB_CONF_FILE") -# Globals: -# DB_* -# Arguments: -# $1 - MySQL variable name -# $2 - Value to assign to the MySQL variable -# $3 - Section in the MySQL configuration file the key is located (default: mysqld) -# $4 - Configuration file (default: "$BD_CONF_FILE") -# Returns: -# None -######################### -mysql_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - read -r -a sections <<<"${3:-mysqld}" - local -r ignore_inline_comments="${4:-no}" - local -r file="${5:-"$DB_CONF_FILE"}" - info "Setting ${key} option" - debug "Setting ${key} to '${value}' in ${DB_FLAVOR} configuration file ${file}" - # Check if the configuration exists in the file - for section in "${sections[@]}"; do - if is_boolean_yes "$ignore_inline_comments"; then - ini-file set --ignore-inline-comments --section "$section" --key "$key" --value "$value" "$file" - else - ini-file set --section "$section" --key "$key" --value "$value" "$file" - fi - done -} - -######################## -# Update MySQL/MariaDB configuration file with user custom inputs -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_update_custom_config() { - # Persisted configuration files from old versions - ! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration - - # User injected custom configuration - if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then - debug "Injecting custom configuration from my_custom.conf" - cat "$DB_CONF_DIR/my_custom.cnf" > "$DB_CONF_DIR/bitnami/my_custom.cnf" - fi - - ! is_empty_value "$DB_USER" && mysql_conf_set "user" "$DB_USER" "mysqladmin" - ! is_empty_value "$DB_PORT_NUMBER" && mysql_conf_set "port" "$DB_PORT_NUMBER" "mysqld client manager" - ! is_empty_value "$DB_CHARACTER_SET" && mysql_conf_set "character_set_server" "$DB_CHARACTER_SET" - ! is_empty_value "$DB_COLLATE" && mysql_conf_set "collation_server" "$DB_COLLATE" - ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" - ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" - ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" - ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" - ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=( "/usr/lib" "/usr/lib64" ) - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} - -######################## -# Execute a reliable health check against the current mysql instance -# Globals: -# DB_ROOT_USER, DB_ROOT_PASSWORD, DB_MASTER_ROOT_PASSWORD -# Arguments: -# None -# Returns: -# mysqladmin output -######################### -mysql_healthcheck() { - local args=("-u${DB_ROOT_USER}" "-h0.0.0.0") - local root_password - - root_password="$(get_master_env_var_value ROOT_PASSWORD)" - if [[ -n "$root_password" ]]; then - args+=("-p${root_password}") - fi - - mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status -} - -######################## -# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# mysql client flavor -######################### -mysql_client_flavor() { - if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then - echo "mariadb" - else - echo "mysql" - fi -} - -######################## -# Prints extra options for MySQL client calls (i.e. SSL options) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# List of options to pass to "mysql" CLI -######################### -mysql_client_extra_opts() { - # Helper to get the proper value for the MySQL client environment variable - mysql_client_env_value() { - local env_name="MYSQL_CLIENT_${1:?missing name}" - if [[ -n "${!env_name:-}" ]]; then - echo "${!env_name:-}" - else - env_name="DB_CLIENT_${1}" - echo "${!env_name:-}" - fi - } - local -a opts=() - local key value - if is_boolean_yes "${DB_ENABLE_SSL:-no}"; then - if [[ "$(mysql_client_flavor)" = "mysql" ]]; then - opts+=("--ssl-mode=REQUIRED") - else - opts+=("--ssl=TRUE") - fi - # Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined - for key in ca key cert; do - value="$(mysql_client_env_value "SSL_${key^^}_FILE")" - [[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}") - done - else - # Skip SSL validation - if [[ "$(mysql_client_flavor)" = "mariadb" ]]; then - # SSL connections are enabled by default in MariaDB >=10.11 - local mysql_version="" - local major_version="" - local minor_version="" - mysql_version="$(mysql_get_version)" - major_version="$(get_sematic_version "${mysql_version}" 1)" - minor_version="$(get_sematic_version "${mysql_version}" 2)" - if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then - opts+=("--skip-ssl") - fi - fi - fi - echo "${opts[@]:-}" -} diff --git a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh b/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh deleted file mode 100644 index 54c504fe8d2c8..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh +++ /dev/null @@ -1,264 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for mariadb - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-mariadb}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -mariadb_env_vars=( - ALLOW_EMPTY_PASSWORD - MARIADB_AUTHENTICATION_PLUGIN - MARIADB_ROOT_USER - MARIADB_ROOT_PASSWORD - MARIADB_USER - MARIADB_PASSWORD - MARIADB_DATABASE - MARIADB_MASTER_HOST - MARIADB_MASTER_PORT_NUMBER - MARIADB_MASTER_ROOT_USER - MARIADB_MASTER_ROOT_PASSWORD - MARIADB_MASTER_DELAY - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - MARIADB_PORT_NUMBER - MARIADB_REPLICATION_MODE - MARIADB_REPLICATION_SLAVE_DUMP - MARIADB_EXTRA_FLAGS - MARIADB_INIT_SLEEP_TIME - MARIADB_CHARACTER_SET - MARIADB_COLLATE - MARIADB_BIND_ADDRESS - MARIADB_SQL_MODE - MARIADB_UPGRADE - MARIADB_SKIP_TEST_DB - MARIADB_CLIENT_ENABLE_SSL - MARIADB_CLIENT_SSL_CA_FILE - MARIADB_CLIENT_SSL_CERT_FILE - MARIADB_CLIENT_SSL_KEY_FILE - MARIADB_CLIENT_EXTRA_FLAGS - MARIADB_STARTUP_WAIT_RETRIES - MARIADB_STARTUP_WAIT_SLEEP_TIME - MARIADB_ENABLE_SLOW_QUERY - MARIADB_LONG_QUERY_TIME - MARIADB_GALERA_CONF_DIR - MARIADB_GALERA_MOUNTED_CONF_DIR - MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP - MARIADB_GALERA_CLUSTER_BOOTSTRAP - MARIADB_GALERA_CLUSTER_ADDRESS - MARIADB_GALERA_CLUSTER_NAME - MARIADB_GALERA_NODE_NAME - MARIADB_GALERA_NODE_ADDRESS - MARIADB_GALERA_SST_METHOD - MARIADB_GALERA_MARIABACKUP_USER - MARIADB_GALERA_MARIABACKUP_PASSWORD - MARIADB_ENABLE_LDAP - MARIADB_ENABLE_TLS - MARIADB_TLS_CERT_FILE - MARIADB_TLS_KEY_FILE - MARIADB_TLS_CA_FILE - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - DB_ENABLE_SLOW_QUERY - DB_LONG_QUERY_TIME -) -for env_var in "${mariadb_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset mariadb_env_vars -export DB_FLAVOR="mariadb" - -# Paths -export DB_BASE_DIR="${BITNAMI_ROOT_DIR}/mariadb" -export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" -export DB_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_SBIN_DIR="${DB_BASE_DIR}/sbin" -export DB_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_LOGS_DIR="${DB_BASE_DIR}/logs" -export DB_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_CONF_FILE="${DB_CONF_DIR}/my.cnf" -export DB_PID_FILE="${DB_TMP_DIR}/mysqld.pid" -export DB_SOCKET_FILE="${DB_TMP_DIR}/mysql.sock" -export PATH="${DB_SBIN_DIR}:${DB_BIN_DIR}:/opt/bitnami/common/bin:${PATH}" - -# System users (when running with a privileged user) -export DB_DAEMON_USER="mysql" -export DB_DAEMON_GROUP="mysql" - -# Default configuration (build-time) -export MARIADB_DEFAULT_PORT_NUMBER="3306" -export DB_DEFAULT_PORT_NUMBER="$MARIADB_DEFAULT_PORT_NUMBER" # only used at build time -export MARIADB_DEFAULT_CHARACTER_SET="utf8mb4" -export DB_DEFAULT_CHARACTER_SET="$MARIADB_DEFAULT_CHARACTER_SET" # only used at build time -export MARIADB_DEFAULT_BIND_ADDRESS="0.0.0.0" -export DB_DEFAULT_BIND_ADDRESS="$MARIADB_DEFAULT_BIND_ADDRESS" # only used at build time - -# MariaDB Galera authentication. -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export MARIADB_AUTHENTICATION_PLUGIN="${MARIADB_AUTHENTICATION_PLUGIN:-}" -export DB_AUTHENTICATION_PLUGIN="$MARIADB_AUTHENTICATION_PLUGIN" -export MARIADB_ROOT_USER="${MARIADB_ROOT_USER:-root}" -export DB_ROOT_USER="$MARIADB_ROOT_USER" # only used during the first initialization -export MARIADB_ROOT_PASSWORD="${MARIADB_ROOT_PASSWORD:-}" -export DB_ROOT_PASSWORD="$MARIADB_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_USER="${MARIADB_USER:-}" -export DB_USER="$MARIADB_USER" # only used during the first initialization -export MARIADB_PASSWORD="${MARIADB_PASSWORD:-}" -export DB_PASSWORD="$MARIADB_PASSWORD" # only used during the first initialization -export MARIADB_DATABASE="${MARIADB_DATABASE:-}" -export DB_DATABASE="$MARIADB_DATABASE" # only used during the first initialization -export MARIADB_MASTER_HOST="${MARIADB_MASTER_HOST:-}" -export DB_MASTER_HOST="$MARIADB_MASTER_HOST" # only used during the first initialization -export MARIADB_MASTER_PORT_NUMBER="${MARIADB_MASTER_PORT_NUMBER:-3306}" -export DB_MASTER_PORT_NUMBER="$MARIADB_MASTER_PORT_NUMBER" # only used during the first initialization -export MARIADB_MASTER_ROOT_USER="${MARIADB_MASTER_ROOT_USER:-root}" -export DB_MASTER_ROOT_USER="$MARIADB_MASTER_ROOT_USER" # only used during the first initialization -export MARIADB_MASTER_ROOT_PASSWORD="${MARIADB_MASTER_ROOT_PASSWORD:-}" -export DB_MASTER_ROOT_PASSWORD="$MARIADB_MASTER_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_MASTER_DELAY="${MARIADB_MASTER_DELAY:-0}" -export DB_MASTER_DELAY="$MARIADB_MASTER_DELAY" # only used during the first initialization -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Settings -export MARIADB_PORT_NUMBER="${MARIADB_PORT_NUMBER:-}" -export DB_PORT_NUMBER="$MARIADB_PORT_NUMBER" -export MARIADB_REPLICATION_MODE="${MARIADB_REPLICATION_MODE:-}" -export DB_REPLICATION_MODE="$MARIADB_REPLICATION_MODE" -export MARIADB_REPLICATION_SLAVE_DUMP="${MARIADB_REPLICATION_SLAVE_DUMP:-false}" -export DB_REPLICATION_SLAVE_DUMP="$MARIADB_REPLICATION_SLAVE_DUMP" -export MARIADB_EXTRA_FLAGS="${MARIADB_EXTRA_FLAGS:-}" -export DB_EXTRA_FLAGS="$MARIADB_EXTRA_FLAGS" -export MARIADB_INIT_SLEEP_TIME="${MARIADB_INIT_SLEEP_TIME:-}" -export DB_INIT_SLEEP_TIME="$MARIADB_INIT_SLEEP_TIME" -export MARIADB_CHARACTER_SET="${MARIADB_CHARACTER_SET:-}" -export DB_CHARACTER_SET="$MARIADB_CHARACTER_SET" -# MARIADB_COLLATION is deprecated in favor of MARIADB_COLLATE -MARIADB_COLLATE="${MARIADB_COLLATE:-"${MARIADB_COLLATION:-}"}" -export MARIADB_COLLATE="${MARIADB_COLLATE:-}" -export DB_COLLATE="$MARIADB_COLLATE" -export MARIADB_BIND_ADDRESS="${MARIADB_BIND_ADDRESS:-}" -export DB_BIND_ADDRESS="$MARIADB_BIND_ADDRESS" -export MARIADB_SQL_MODE="${MARIADB_SQL_MODE:-}" -export DB_SQL_MODE="$MARIADB_SQL_MODE" -export MARIADB_UPGRADE="${MARIADB_UPGRADE:-AUTO}" -export DB_UPGRADE="$MARIADB_UPGRADE" -export MARIADB_SKIP_TEST_DB="${MARIADB_SKIP_TEST_DB:-no}" -export DB_SKIP_TEST_DB="$MARIADB_SKIP_TEST_DB" -export MARIADB_CLIENT_ENABLE_SSL="${MARIADB_CLIENT_ENABLE_SSL:-no}" -export DB_CLIENT_ENABLE_SSL="$MARIADB_CLIENT_ENABLE_SSL" -export MARIADB_CLIENT_SSL_CA_FILE="${MARIADB_CLIENT_SSL_CA_FILE:-}" -export DB_CLIENT_SSL_CA_FILE="$MARIADB_CLIENT_SSL_CA_FILE" -export MARIADB_CLIENT_SSL_CERT_FILE="${MARIADB_CLIENT_SSL_CERT_FILE:-}" -export DB_CLIENT_SSL_CERT_FILE="$MARIADB_CLIENT_SSL_CERT_FILE" -export MARIADB_CLIENT_SSL_KEY_FILE="${MARIADB_CLIENT_SSL_KEY_FILE:-}" -export DB_CLIENT_SSL_KEY_FILE="$MARIADB_CLIENT_SSL_KEY_FILE" -export MARIADB_CLIENT_EXTRA_FLAGS="${MARIADB_CLIENT_EXTRA_FLAGS:-no}" -export DB_CLIENT_EXTRA_FLAGS="$MARIADB_CLIENT_EXTRA_FLAGS" -export MARIADB_STARTUP_WAIT_RETRIES="${MARIADB_STARTUP_WAIT_RETRIES:-300}" -export DB_STARTUP_WAIT_RETRIES="$MARIADB_STARTUP_WAIT_RETRIES" -export MARIADB_STARTUP_WAIT_SLEEP_TIME="${MARIADB_STARTUP_WAIT_SLEEP_TIME:-2}" -export DB_STARTUP_WAIT_SLEEP_TIME="$MARIADB_STARTUP_WAIT_SLEEP_TIME" -MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-"${DB_ENABLE_SLOW_QUERY:-}"}" -export MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-0}" -export DB_ENABLE_SLOW_QUERY="$MARIADB_ENABLE_SLOW_QUERY" -MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-"${DB_LONG_QUERY_TIME:-}"}" -export MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-10.0}" -export DB_LONG_QUERY_TIME="$MARIADB_LONG_QUERY_TIME" - -# Galera paths -export MARIADB_GALERA_GRASTATE_FILE="${DB_DATA_DIR}/grastate.dat" -export DB_GALERA_GRASTATE_FILE="$MARIADB_GALERA_GRASTATE_FILE" -export MARIADB_GALERA_BOOTSTRAP_DIR="${DB_VOLUME_DIR}/.bootstrap" -export DB_GALERA_BOOTSTRAP_DIR="$MARIADB_GALERA_BOOTSTRAP_DIR" -export MARIADB_GALERA_BOOTSTRAP_FILE="${DB_GALERA_BOOTSTRAP_DIR}/done" -export DB_GALERA_BOOTSTRAP_FILE="$MARIADB_GALERA_BOOTSTRAP_FILE" - -# Galera build-time defaults for cluster configuration -export MARIADB_GALERA_DEFAULT_CLUSTER_ADDRESS="gcomm://" -export DB_GALERA_DEFAULT_CLUSTER_ADDRESS="$MARIADB_GALERA_DEFAULT_CLUSTER_ADDRESS" -export MARIADB_GALERA_DEFAULT_CLUSTER_NAME="galera" -export DB_GALERA_DEFAULT_CLUSTER_NAME="$MARIADB_GALERA_DEFAULT_CLUSTER_NAME" -export MARIADB_GALERA_DEFAULT_NODE_NAME="" -export DB_GALERA_DEFAULT_NODE_NAME="$MARIADB_GALERA_DEFAULT_NODE_NAME" -export MARIADB_GALERA_DEFAULT_NODE_ADDRESS="" -export DB_GALERA_DEFAULT_NODE_ADDRESS="$MARIADB_GALERA_DEFAULT_NODE_ADDRESS" -export MARIADB_GALERA_DEFAULT_SST_METHOD="mariabackup" -export DB_GALERA_DEFAULT_SST_METHOD="$MARIADB_GALERA_DEFAULT_SST_METHOD" -export MARIADB_GALERA_DEFAULT_MARIABACKUP_USER="mariabackup" -export DB_GALERA_DEFAULT_MARIABACKUP_USER="$MARIADB_GALERA_DEFAULT_MARIABACKUP_USER" -export MARIADB_GALERA_DEFAULT_MARIABACKUP_PASSWORD="" -export DB_GALERA_DEFAULT_MARIABACKUP_PASSWORD="$MARIADB_GALERA_DEFAULT_MARIABACKUP_PASSWORD" - -# Galera cluster configuration. -export MARIADB_GALERA_CONF_DIR="${MARIADB_GALERA_CONF_DIR:-/opt/bitnami/mariadb/conf}" -export DB_GALERA_CONF_DIR="$MARIADB_GALERA_CONF_DIR" -export MARIADB_GALERA_MOUNTED_CONF_DIR="${MARIADB_GALERA_MOUNTED_CONF_DIR:-/bitnami/conf}" -export DB_GALERA_MOUNTED_CONF_DIR="$MARIADB_GALERA_MOUNTED_CONF_DIR" -export MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP="${MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP:-}" -export DB_GALERA_FORCE_SAFETOBOOTSTRAP="$MARIADB_GALERA_FORCE_SAFETOBOOTSTRAP" -export MARIADB_GALERA_CLUSTER_BOOTSTRAP="${MARIADB_GALERA_CLUSTER_BOOTSTRAP:-}" -export DB_GALERA_CLUSTER_BOOTSTRAP="$MARIADB_GALERA_CLUSTER_BOOTSTRAP" -export MARIADB_GALERA_CLUSTER_ADDRESS="${MARIADB_GALERA_CLUSTER_ADDRESS:-}" -export DB_GALERA_CLUSTER_ADDRESS="$MARIADB_GALERA_CLUSTER_ADDRESS" -export MARIADB_GALERA_CLUSTER_NAME="${MARIADB_GALERA_CLUSTER_NAME:-$DB_GALERA_DEFAULT_CLUSTER_NAME}" -export DB_GALERA_CLUSTER_NAME="$MARIADB_GALERA_CLUSTER_NAME" -export MARIADB_GALERA_NODE_NAME="${MARIADB_GALERA_NODE_NAME:-}" -export DB_GALERA_NODE_NAME="$MARIADB_GALERA_NODE_NAME" -export MARIADB_GALERA_NODE_ADDRESS="${MARIADB_GALERA_NODE_ADDRESS:-}" -export DB_GALERA_NODE_ADDRESS="$MARIADB_GALERA_NODE_ADDRESS" -export MARIADB_GALERA_SST_METHOD="${MARIADB_GALERA_SST_METHOD:-$DB_GALERA_DEFAULT_SST_METHOD}" -export DB_GALERA_SST_METHOD="$MARIADB_GALERA_SST_METHOD" -export MARIADB_GALERA_MARIABACKUP_USER="${MARIADB_GALERA_MARIABACKUP_USER:-$DB_GALERA_DEFAULT_MARIABACKUP_USER}" -export DB_GALERA_MARIABACKUP_USER="$MARIADB_GALERA_MARIABACKUP_USER" -export MARIADB_GALERA_MARIABACKUP_PASSWORD="${MARIADB_GALERA_MARIABACKUP_PASSWORD:-$DB_GALERA_DEFAULT_MARIABACKUP_PASSWORD}" -export DB_GALERA_MARIABACKUP_PASSWORD="$MARIADB_GALERA_MARIABACKUP_PASSWORD" - -# LDAP -export MARIADB_ENABLE_LDAP="${MARIADB_ENABLE_LDAP:-no}" -export DB_ENABLE_LDAP="$MARIADB_ENABLE_LDAP" - -# SSL/TLS configuration -export MARIADB_ENABLE_TLS="${MARIADB_ENABLE_TLS:-no}" -export DB_ENABLE_TLS="$MARIADB_ENABLE_TLS" -export MARIADB_TLS_CERT_FILE="${MARIADB_TLS_CERT_FILE:-}" -export DB_TLS_CERT_FILE="$MARIADB_TLS_CERT_FILE" -export MARIADB_TLS_KEY_FILE="${MARIADB_TLS_KEY_FILE:-}" -export DB_TLS_KEY_FILE="$MARIADB_TLS_KEY_FILE" -export MARIADB_TLS_CA_FILE="${MARIADB_TLS_CA_FILE:-}" -export DB_TLS_CA_FILE="$MARIADB_TLS_CA_FILE" -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-monitor}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-monitor}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Custom environment variables may be defined below diff --git a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh b/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh deleted file mode 100755 index ec7e80256766f..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/mariadb/conf) -debug "Copying files from $DB_DEFAULT_CONF_DIR to $DB_CONF_DIR" -cp -nr "$DB_DEFAULT_CONF_DIR"/. "$DB_CONF_DIR" - -print_welcome_page - -if [[ "$1" = "/opt/bitnami/scripts/mariadb-galera/run.sh" ]]; then - info "** Starting MariaDB setup **" - /opt/bitnami/scripts/mariadb-galera/setup.sh - info "** MariaDB setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh b/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh deleted file mode 100755 index 8bd30f5f8ae49..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/healthcheck.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -mysql_healthcheck diff --git a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh b/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh deleted file mode 100755 index 503f456f66f0d..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/postunpack.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libldapclient.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# Configure MariaDB options based on build-time defaults -info "Configuring default MariaDB options" -ensure_dir_exists "$DB_CONF_DIR" -mysql_create_default_config - -for dir in "$DB_TMP_DIR" "$DB_LOGS_DIR" "$DB_CONF_DIR" "$DB_DEFAULT_CONF_DIR" "${DB_CONF_DIR}/bitnami" "$DB_VOLUME_DIR" "$DB_DATA_DIR" "$DB_GALERA_BOOTSTRAP_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# LDAP permissions -ldap_configure_permissions -ldap_create_pam_config "mariadb" - -# Fix to avoid issues detecting plugins in mysql_install_db -ln -sf "$DB_BASE_DIR/plugin" "$DB_BASE_DIR/lib/plugin" - -# Redirect all logging to stdout -ln -sf /dev/stdout "$DB_LOGS_DIR/mysqld.log" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${DB_CONF_DIR}/"* "$DB_DEFAULT_CONF_DIR" diff --git a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh b/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh deleted file mode 100755 index 69b8d4496908b..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/run.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libldapclient.sh -. /opt/bitnami/scripts/libmariadbgalera.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# mysqld_safe does not allow logging to stdout/stderr, so we stick with mysqld -EXEC="${DB_SBIN_DIR}/mysqld" - -flags=("--defaults-file=${DB_CONF_DIR}/my.cnf" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") -[[ -z "${DB_PID_FILE:-}" ]] || flags+=("--pid-file=${DB_PID_FILE}") - -# Add flags specified via the 'DB_EXTRA_FLAGS' environment variable -read -r -a db_extra_flags <<< "$(mysql_extra_flags)" -[[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - -# Add flags passed to this script -flags+=("$@") - -# Fix for MDEV-16183 - mysqld_safe already does this, but we are using mysqld -LD_PRELOAD="$(find_jemalloc_lib)${LD_PRELOAD:+ "$LD_PRELOAD"}" -export LD_PRELOAD - -is_boolean_yes "$DB_ENABLE_LDAP" && ldap_start_nslcd_bg - -info "** Starting MariaDB **" - -set_previous_boot - -if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "$EXEC" "${flags[@]}" -else - exec "$EXEC" "${flags[@]}" -fi diff --git a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh b/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh deleted file mode 100755 index 77c9f7d5d1a97..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-galera/setup.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadbgalera.sh -. /opt/bitnami/scripts/libldapclient.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Load LDAP environment variables -eval "$(ldap_env)" - -# Ensure mysql unix socket file does not exist -rm -rf "${DB_SOCKET_FILE}.lock" -# Ensure MariaDB environment variables settings are valid -mysql_validate -# Ensure MariaDB is stopped when this script ends. -trap "mysql_stop" EXIT -if am_i_root; then - # Ensure 'daemon' user exists when running as 'root' - ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" - # Ensure 'nslcd' user exists when running as 'root' - ensure_user_exists "$LDAP_NSLCD_USER" --group "$LDAP_NSLCD_GROUP" - # Fix logging issue when running as root - chmod o+w "$(readlink /dev/stdout)" -fi -# Ensure MariaDB is initialized -mysql_initialize -# Ensure LDAP is initialized -is_boolean_yes "$DB_ENABLE_LDAP" && ldap_initialize -# Allow running custom initialization scripts -mysql_custom_scripts 'init' -# Allow running custom start scripts -mysql_custom_scripts 'start' -# Stop MariaDB before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -mysql_stop diff --git a/bitnami/mariadb-galera/11.6/debian-12/tags-info.yaml b/bitnami/mariadb-galera/11.6/debian-12/tags-info.yaml deleted file mode 100644 index d133693c80ab4..0000000000000 --- a/bitnami/mariadb-galera/11.6/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "11.6" -- 11.6-debian-12 -- 11.6.2 diff --git a/bitnami/mariadb/10.11/README.md b/bitnami/mariadb/10.11/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/mariadb/10.11/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/mariadb/10.11/debian-12/Dockerfile b/bitnami/mariadb/10.11/debian-12/Dockerfile deleted file mode 100644 index 10dc67add7694..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T22:23:35Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mariadb/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="10.11.10-debian-12-r2" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mariadb" \ - org.opencontainers.image.title="mariadb" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="10.11.10" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libaio1 libaudit1 libcap-ng0 libcrypt1 libgcc-s1 libicu72 liblzma5 libncurses6 libpam0g libssl3 libstdc++6 libtinfo6 libxml2 procps psmisc zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "ini-file-1.4.7-8-linux-${OS_ARCH}-debian-12" \ - "mariadb-10.11.10-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir /docker-entrypoint-initdb.d - -COPY rootfs / -RUN /opt/bitnami/scripts/mariadb/postunpack.sh -ENV APP_VERSION="10.11.10" \ - BITNAMI_APP_NAME="mariadb" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/common/sbin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:$PATH" - -EXPOSE 3306 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/mariadb/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/mariadb/run.sh" ] diff --git a/bitnami/mariadb/10.11/debian-12/docker-compose-replication.yml b/bitnami/mariadb/10.11/debian-12/docker-compose-replication.yml deleted file mode 100644 index 03e523f97b952..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/docker-compose-replication.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-master: - image: docker.io/bitnami/mariadb:10.11 - ports: - - '3306' - volumes: - - 'mariadb_master_data:/bitnami/mariadb' - environment: - - MARIADB_REPLICATION_MODE=master - - MARIADB_REPLICATION_USER=repl_user - - MARIADB_USER=my_user - - MARIADB_DATABASE=my_database - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_ROOT_PASSWORD=my_root_password - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - - mariadb-slave: - image: docker.io/bitnami/mariadb:10.11 - ports: - - '3306' - depends_on: - - mariadb-master - environment: - - MARIADB_REPLICATION_MODE=slave - - MARIADB_REPLICATION_USER=repl_user - - MARIADB_USER=my_user - - MARIADB_DATABASE=my_database - - MARIADB_MASTER_HOST=mariadb-master - - MARIADB_MASTER_PORT_NUMBER=3306 - - MARIADB_MASTER_ROOT_PASSWORD=my_root_password - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_master_data: - driver: local diff --git a/bitnami/mariadb/10.11/debian-12/docker-compose.yml b/bitnami/mariadb/10.11/debian-12/docker-compose.yml deleted file mode 100644 index cbd9cb79f8be3..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb: - image: docker.io/bitnami/mariadb:10.11 - ports: - - '3306:3306' - volumes: - - 'mariadb_data:/bitnami/mariadb' - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_data: - driver: local diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index b1441396c42b0..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ini-file": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.4.7-8" - }, - "mariadb": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "10.11.10-0" - } -} \ No newline at end of file diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/mariadb/10.11/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/mariadb/10.11/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/mariadb/10.11/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh b/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh deleted file mode 100644 index 9d6bd864f4513..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh +++ /dev/null @@ -1,1417 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami MySQL library - -# shellcheck disable=SC1090,SC1091,SC2119,SC2120 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh - -######################## -# Configure database extra start flags -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Array with extra flags to use -######################### -mysql_extra_flags() { - local randNumber - local -a dbExtraFlags=() - # shellcheck disable=SC2153 - read -r -a userExtraFlags <<< "$DB_EXTRA_FLAGS" - - if [[ -n "$DB_REPLICATION_MODE" ]]; then - randNumber="$(head /dev/urandom | tr -dc 0-9 | head -c 3 ; echo '')" - dbExtraFlags+=("--server-id=$randNumber" "--binlog-format=ROW" "--log-bin=mysql-bin" "--sync-binlog=1") - if [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - dbExtraFlags+=("--relay-log=mysql-relay-bin" "--log-slave-updates=1" "--read-only=1") - elif [[ "$DB_REPLICATION_MODE" = "master" ]]; then - dbExtraFlags+=("--innodb_flush_log_at_trx_commit=1") - fi - fi - - [[ "${#userExtraFlags[@]}" -eq 0 ]] || dbExtraFlags+=("${userExtraFlags[@]}") - - echo "${dbExtraFlags[@]:-}" -} - -######################## -# Validate settings in MYSQL_*/MARIADB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_validate() { - info "Validating settings in MYSQL_*/MARIADB_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - backslash_password_error() { - print_validation_error "The password cannot contain backslashes ('\'). Set the environment variable $1 with no backslashes (more info at https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html)" - } - - if [[ -n "$DB_REPLICATION_MODE" ]]; then - if [[ "$DB_REPLICATION_MODE" = "master" ]]; then - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -n "$DB_REPLICATION_USER" ]] && [[ -z "$DB_REPLICATION_PASSWORD" ]]; then - empty_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if (( ${#DB_ROOT_PASSWORD} > 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - elif [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - if [[ -z "$DB_MASTER_HOST" ]]; then - print_validation_error "Slave replication mode chosen without setting the environment variable $(get_env_var MASTER_HOST). Use it to indicate where the Master node is running" - fi - else - print_validation_error "Invalid replication mode. Available options are 'master/slave'" - fi - else - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ "$DB_USER" = "root" ]]; then - print_validation_error "root user is already created in the database and you can't use it as username for user creation." - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - if [[ "${DB_REPLICATION_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "$dump_file" - debug "Finish dump databases" - - debug "Unlock master databases for write operations" - echo "UNLOCK TABLES;" | mysql_remote_execute "$DB_MASTER_HOST" "$DB_MASTER_PORT_NUMBER" "mysql" "$DB_MASTER_ROOT_USER" "$DB_MASTER_ROOT_PASSWORD" - - debug "Start import dump databases" - mysql_execute < "$dump_file" - mysql_execute "mysql" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - if ! grep --silent "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" "${DB_CONF_FILE}"; then - echo "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" >> "${DB_CONF_FILE}" - fi - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Using persisted data" - # mysql_upgrade requires the server to be running - [[ -n "$(get_master_env_var_value ROOT_PASSWORD)" ]] && export ROOT_AUTH_ENABLED="yes" - # https://dev.mysql.com/doc/refman/8.0/en/replication-upgrade.html - mariadb_upgrade - else - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - info "Installing database" - mariadb_install_db - mysql_start_bg - wait_for_mysql_access - # we delete existing users and create new ones with stricter access - # commands can still be executed until we restart or run 'flush privileges' - info "Configuring authentication" - mysql_execute "mysql" <=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Initialize database data -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_install_db() { - local command="${DB_BIN_DIR}/mysql_install_db" - local -a args=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && args+=("${db_extra_flags[@]}") - - am_i_root && args=("${args[@]}" "--user=$DB_DAEMON_USER") - args+=("--auth-root-authentication-method=normal") - # Feature available only in MariaDB 10.5+ - # ref: https://mariadb.com/kb/en/mysql_install_db/#not-creating-the-test-database-and-anonymous-user - if [[ ! "$(mysql_get_version)" =~ ^10\.[01234]\. ]]; then - is_boolean_yes "$DB_SKIP_TEST_DB" && args+=("--skip-test-db") - fi - - debug_execute "$command" "${args[@]}" -} - -######################## -# Upgrade Database Schema -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_upgrade() { - local -a args=("--defaults-file=${DB_CONF_FILE}" "-u" "$DB_ROOT_USER") - info "Running mysql_upgrade" - mysql_start_bg - is_boolean_yes "${ROOT_AUTH_ENABLED:-false}" && args+=("-p$(get_master_env_var_value ROOT_PASSWORD)") - [[ "${DB_UPGRADE}" == "FORCE" ]] && args+=("--force") - debug_execute "${DB_BIN_DIR}/mysql_upgrade" "${args[@]}" || echo "This installation is already upgraded" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for mysql common - -######################## -# Extract mysql version from version string -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Version string -######################### -mysql_get_version() { - local ver_string - local -a ver_split - - ver_string=$("${DB_BIN_DIR}/mysql" "--version") - read -r -a ver_split <<< "$ver_string" - - if [[ "$ver_string" = *" Distrib "* ]]; then - echo "${ver_split[4]::-1}" - else - echo "${ver_split[2]}" - fi -} - -######################## -# Gets an environment variable name based on the suffix -# Globals: -# DB_FLAVOR -# Arguments: -# $1 - environment variable suffix -# Returns: -# environment variable name -######################### -get_env_var() { - local -r id="${1:?id is required}" - local -r prefix="${DB_FLAVOR//-/_}" - echo "${prefix^^}_${id}" -} - -######################## -# Gets an environment variable value for the master node and based on the suffix -# Arguments: -# $1 - environment variable suffix -# Returns: -# environment variable value -######################### -get_master_env_var_value() { - local envVar - - PREFIX="" - [[ "${DB_REPLICATION_MODE:-}" = "slave" ]] && PREFIX="MASTER_" - envVar="$(get_env_var "${PREFIX}${1}_FILE")" - if [[ -f "${!envVar:-}" ]]; then - echo "$(< "${!envVar}")" - else - envVar="$(get_env_var "${PREFIX}${1}")" - echo "${!envVar:-}" - fi -} - -######################## -# Execute an arbitrary query/queries against the running MySQL/MariaDB service and print to stdout -# Stdin: -# Query/queries to execute -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - Database where to run the queries -# $2 - User to run queries -# $3 - Password -# $4 - Extra MySQL CLI options -# Returns: -# None -mysql_execute_print_output() { - local -r db="${1:-}" - local -r user="${2:-root}" - local -r pass="${3:-}" - local -a opts extra_opts - read -r -a opts <<< "${@:4}" - read -r -a extra_opts <<< "$(mysql_client_extra_opts)" - - # Process mysql CLI arguments - local -a args=() - if [[ -f "$DB_CONF_FILE" ]]; then - args+=("--defaults-file=${DB_CONF_FILE}") - fi - args+=("-N" "-u" "$user") - [[ -n "$db" ]] && args+=("$db") - [[ -n "$pass" ]] && args+=("-p$pass") - [[ "${#opts[@]}" -gt 0 ]] && args+=("${opts[@]}") - [[ "${#extra_opts[@]}" -gt 0 ]] && args+=("${extra_opts[@]}") - - # Obtain the command specified via stdin - if [[ "${BITNAMI_DEBUG:-false}" = true ]]; then - local mysql_cmd - mysql_cmd="$(> "$custom_conf_file" - cat "$old_custom_conf_file" >> "$custom_conf_file" - fi - if am_i_root; then - [[ -e "$DB_VOLUME_DIR/.initialized" ]] && rm "$DB_VOLUME_DIR/.initialized" - rm -rf "$DB_VOLUME_DIR/conf" - else - warn "Old custom configuration migrated, please manually remove the 'conf' directory from the volume use to persist data" - fi -} - -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - local mysql_create_user_cmd - [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.4, the mysql.user table was replaced with a view: https://mariadb.com/kb/en/mysqluser-table/ - # Views have a definer user, in this case set to 'root', which needs to exist for the view to work - # In MySQL, to avoid issues when renaming the root user, they use the 'mysql.sys' user as a definer: https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html - # However, for MariaDB that is not the case, so when the 'root' user is renamed the 'mysql.user' table stops working and the view needs to be fixed - if [[ "$user" != "root" && ! "$(mysql_get_version)" =~ ^10.[0123]. ]]; then - alter_view_str="$(mysql_execute_print_output "mysql" "$user" "$password" "-s" <&2 - return 1 - ;; - esac - shift - done - - local -a mysql_execute_cmd=("mysql_execute") - [[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - - local -a create_database_args=() - [[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'") - [[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'") - - debug "Creating database $database" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$user") - [[ -n "$db_host" ]] && flags+=("--host" "${db_host}") - [[ -n "$db_port" ]] && flags+=("--port" "${db_port}") - if is_boolean_yes "$use_ldap"; then - flags+=("--use-ldap") - elif [[ -n "$password" ]]; then - flags+=("-p" "$password") - [[ -n "$auth_plugin" ]] && flags=("${flags[@]}" "--auth-plugin" "$auth_plugin") - fi - mysql_ensure_user_exists "${flags[@]}" -} - -######################## -# Optionally create the given database, and then optionally give a user -# full privileges on the database. -# Flags: -# -u|--user - database user -# --character-set - character set -# --collation - collation -# --host - database host -# --port - database port -# Arguments: -# $1 - database name -# Returns: -# None -######################### -mysql_ensure_optional_database_exists() { - local -r database="${1:?database is missing}" - local character_set="" - local collate="" - local user="" - local privileges="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - --character-set) - shift - character_set="${1:?missing character set}" - ;; - --collate) - shift - collate="${1:?missing collate}" - ;; - -u|--user) - shift - user="${1:?missing database user}" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - --privileges) - shift - privileges="${1:?missing privileges}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$database") - [[ -n "$character_set" ]] && flags+=("--character-set" "$character_set") - [[ -n "$collate" ]] && flags+=("--collate" "$collate") - [[ -n "$db_host" ]] && flags+=("--host" "$db_host") - [[ -n "$db_port" ]] && flags+=("--port" "$db_port") - mysql_ensure_database_exists "${flags[@]}" - - if [[ -n "$user" ]]; then - mysql_ensure_user_has_database_privileges "$user" "$database" "$privileges" "$db_host" "$db_port" - fi -} - -######################## -# Add or modify an entry in the MySQL configuration file ("$DB_CONF_FILE") -# Globals: -# DB_* -# Arguments: -# $1 - MySQL variable name -# $2 - Value to assign to the MySQL variable -# $3 - Section in the MySQL configuration file the key is located (default: mysqld) -# $4 - Configuration file (default: "$BD_CONF_FILE") -# Returns: -# None -######################### -mysql_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - read -r -a sections <<<"${3:-mysqld}" - local -r ignore_inline_comments="${4:-no}" - local -r file="${5:-"$DB_CONF_FILE"}" - info "Setting ${key} option" - debug "Setting ${key} to '${value}' in ${DB_FLAVOR} configuration file ${file}" - # Check if the configuration exists in the file - for section in "${sections[@]}"; do - if is_boolean_yes "$ignore_inline_comments"; then - ini-file set --ignore-inline-comments --section "$section" --key "$key" --value "$value" "$file" - else - ini-file set --section "$section" --key "$key" --value "$value" "$file" - fi - done -} - -######################## -# Update MySQL/MariaDB configuration file with user custom inputs -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_update_custom_config() { - # Persisted configuration files from old versions - ! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration - - # User injected custom configuration - if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then - debug "Injecting custom configuration from my_custom.conf" - cat "$DB_CONF_DIR/my_custom.cnf" > "$DB_CONF_DIR/bitnami/my_custom.cnf" - fi - - ! is_empty_value "$DB_USER" && mysql_conf_set "user" "$DB_USER" "mysqladmin" - ! is_empty_value "$DB_PORT_NUMBER" && mysql_conf_set "port" "$DB_PORT_NUMBER" "mysqld client manager" - ! is_empty_value "$DB_CHARACTER_SET" && mysql_conf_set "character_set_server" "$DB_CHARACTER_SET" - ! is_empty_value "$DB_COLLATE" && mysql_conf_set "collation_server" "$DB_COLLATE" - ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" - ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" - ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" - ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" - ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=( "/usr/lib" "/usr/lib64" ) - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} - -######################## -# Execute a reliable health check against the current mysql instance -# Globals: -# DB_ROOT_USER, DB_ROOT_PASSWORD, DB_MASTER_ROOT_PASSWORD -# Arguments: -# None -# Returns: -# mysqladmin output -######################### -mysql_healthcheck() { - local args=("-u${DB_ROOT_USER}" "-h0.0.0.0") - local root_password - - root_password="$(get_master_env_var_value ROOT_PASSWORD)" - if [[ -n "$root_password" ]]; then - args+=("-p${root_password}") - fi - - mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status -} - -######################## -# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# mysql client flavor -######################### -mysql_client_flavor() { - if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then - echo "mariadb" - else - echo "mysql" - fi -} - -######################## -# Prints extra options for MySQL client calls (i.e. SSL options) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# List of options to pass to "mysql" CLI -######################### -mysql_client_extra_opts() { - # Helper to get the proper value for the MySQL client environment variable - mysql_client_env_value() { - local env_name="MYSQL_CLIENT_${1:?missing name}" - if [[ -n "${!env_name:-}" ]]; then - echo "${!env_name:-}" - else - env_name="DB_CLIENT_${1}" - echo "${!env_name:-}" - fi - } - local -a opts=() - local key value - if is_boolean_yes "${DB_ENABLE_SSL:-no}"; then - if [[ "$(mysql_client_flavor)" = "mysql" ]]; then - opts+=("--ssl-mode=REQUIRED") - else - opts+=("--ssl=TRUE") - fi - # Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined - for key in ca key cert; do - value="$(mysql_client_env_value "SSL_${key^^}_FILE")" - [[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}") - done - else - # Skip SSL validation - if [[ "$(mysql_client_flavor)" = "mariadb" ]]; then - # SSL connections are enabled by default in MariaDB >=10.11 - local mysql_version="" - local major_version="" - local minor_version="" - mysql_version="$(mysql_get_version)" - major_version="$(get_sematic_version "${mysql_version}" 1)" - minor_version="$(get_sematic_version "${mysql_version}" 2)" - if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then - opts+=("--skip-ssl") - fi - fi - fi - echo "${opts[@]:-}" -} diff --git a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh b/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh deleted file mode 100644 index 3fe87ab875092..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for mariadb - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-mariadb}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -mariadb_env_vars=( - ALLOW_EMPTY_PASSWORD - MARIADB_AUTHENTICATION_PLUGIN - MARIADB_ROOT_USER - MARIADB_ROOT_PASSWORD - MARIADB_USER - MARIADB_PASSWORD - MARIADB_DATABASE - MARIADB_MASTER_HOST - MARIADB_MASTER_PORT_NUMBER - MARIADB_MASTER_ROOT_USER - MARIADB_MASTER_ROOT_PASSWORD - MARIADB_MASTER_DELAY - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - MARIADB_PORT_NUMBER - MARIADB_REPLICATION_MODE - MARIADB_REPLICATION_SLAVE_DUMP - MARIADB_EXTRA_FLAGS - MARIADB_INIT_SLEEP_TIME - MARIADB_CHARACTER_SET - MARIADB_COLLATE - MARIADB_BIND_ADDRESS - MARIADB_SQL_MODE - MARIADB_UPGRADE - MARIADB_SKIP_TEST_DB - MARIADB_CLIENT_ENABLE_SSL - MARIADB_CLIENT_SSL_CA_FILE - MARIADB_CLIENT_SSL_CERT_FILE - MARIADB_CLIENT_SSL_KEY_FILE - MARIADB_CLIENT_EXTRA_FLAGS - MARIADB_STARTUP_WAIT_RETRIES - MARIADB_STARTUP_WAIT_SLEEP_TIME - MARIADB_ENABLE_SLOW_QUERY - MARIADB_LONG_QUERY_TIME - DB_ENABLE_SLOW_QUERY - DB_LONG_QUERY_TIME -) -for env_var in "${mariadb_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset mariadb_env_vars -export DB_FLAVOR="mariadb" - -# Paths -export DB_BASE_DIR="${BITNAMI_ROOT_DIR}/mariadb" -export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" -export DB_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_SBIN_DIR="${DB_BASE_DIR}/sbin" -export DB_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_LOGS_DIR="${DB_BASE_DIR}/logs" -export DB_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_CONF_FILE="${DB_CONF_DIR}/my.cnf" -export DB_PID_FILE="${DB_TMP_DIR}/mysqld.pid" -export DB_SOCKET_FILE="${DB_TMP_DIR}/mysql.sock" -export PATH="${DB_SBIN_DIR}:${DB_BIN_DIR}:/opt/bitnami/common/bin:${PATH}" - -# System users (when running with a privileged user) -export DB_DAEMON_USER="mysql" -export DB_DAEMON_GROUP="mysql" - -# Default configuration (build-time) -export MARIADB_DEFAULT_PORT_NUMBER="3306" -export DB_DEFAULT_PORT_NUMBER="$MARIADB_DEFAULT_PORT_NUMBER" # only used at build time -export MARIADB_DEFAULT_CHARACTER_SET="utf8mb4" -export DB_DEFAULT_CHARACTER_SET="$MARIADB_DEFAULT_CHARACTER_SET" # only used at build time -export MARIADB_DEFAULT_BIND_ADDRESS="0.0.0.0" -export DB_DEFAULT_BIND_ADDRESS="$MARIADB_DEFAULT_BIND_ADDRESS" # only used at build time - -# MariaDB authentication. -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export MARIADB_AUTHENTICATION_PLUGIN="${MARIADB_AUTHENTICATION_PLUGIN:-}" -export DB_AUTHENTICATION_PLUGIN="$MARIADB_AUTHENTICATION_PLUGIN" -export MARIADB_ROOT_USER="${MARIADB_ROOT_USER:-root}" -export DB_ROOT_USER="$MARIADB_ROOT_USER" # only used during the first initialization -export MARIADB_ROOT_PASSWORD="${MARIADB_ROOT_PASSWORD:-}" -export DB_ROOT_PASSWORD="$MARIADB_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_USER="${MARIADB_USER:-}" -export DB_USER="$MARIADB_USER" # only used during the first initialization -export MARIADB_PASSWORD="${MARIADB_PASSWORD:-}" -export DB_PASSWORD="$MARIADB_PASSWORD" # only used during the first initialization -export MARIADB_DATABASE="${MARIADB_DATABASE:-}" -export DB_DATABASE="$MARIADB_DATABASE" # only used during the first initialization -export MARIADB_MASTER_HOST="${MARIADB_MASTER_HOST:-}" -export DB_MASTER_HOST="$MARIADB_MASTER_HOST" # only used during the first initialization -export MARIADB_MASTER_PORT_NUMBER="${MARIADB_MASTER_PORT_NUMBER:-3306}" -export DB_MASTER_PORT_NUMBER="$MARIADB_MASTER_PORT_NUMBER" # only used during the first initialization -export MARIADB_MASTER_ROOT_USER="${MARIADB_MASTER_ROOT_USER:-root}" -export DB_MASTER_ROOT_USER="$MARIADB_MASTER_ROOT_USER" # only used during the first initialization -export MARIADB_MASTER_ROOT_PASSWORD="${MARIADB_MASTER_ROOT_PASSWORD:-}" -export DB_MASTER_ROOT_PASSWORD="$MARIADB_MASTER_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_MASTER_DELAY="${MARIADB_MASTER_DELAY:-0}" -export DB_MASTER_DELAY="$MARIADB_MASTER_DELAY" # only used during the first initialization -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Settings -export MARIADB_PORT_NUMBER="${MARIADB_PORT_NUMBER:-}" -export DB_PORT_NUMBER="$MARIADB_PORT_NUMBER" -export MARIADB_REPLICATION_MODE="${MARIADB_REPLICATION_MODE:-}" -export DB_REPLICATION_MODE="$MARIADB_REPLICATION_MODE" -export MARIADB_REPLICATION_SLAVE_DUMP="${MARIADB_REPLICATION_SLAVE_DUMP:-false}" -export DB_REPLICATION_SLAVE_DUMP="$MARIADB_REPLICATION_SLAVE_DUMP" -export MARIADB_EXTRA_FLAGS="${MARIADB_EXTRA_FLAGS:-}" -export DB_EXTRA_FLAGS="$MARIADB_EXTRA_FLAGS" -export MARIADB_INIT_SLEEP_TIME="${MARIADB_INIT_SLEEP_TIME:-}" -export DB_INIT_SLEEP_TIME="$MARIADB_INIT_SLEEP_TIME" -export MARIADB_CHARACTER_SET="${MARIADB_CHARACTER_SET:-}" -export DB_CHARACTER_SET="$MARIADB_CHARACTER_SET" -# MARIADB_COLLATION is deprecated in favor of MARIADB_COLLATE -MARIADB_COLLATE="${MARIADB_COLLATE:-"${MARIADB_COLLATION:-}"}" -export MARIADB_COLLATE="${MARIADB_COLLATE:-}" -export DB_COLLATE="$MARIADB_COLLATE" -export MARIADB_BIND_ADDRESS="${MARIADB_BIND_ADDRESS:-}" -export DB_BIND_ADDRESS="$MARIADB_BIND_ADDRESS" -export MARIADB_SQL_MODE="${MARIADB_SQL_MODE:-}" -export DB_SQL_MODE="$MARIADB_SQL_MODE" -export MARIADB_UPGRADE="${MARIADB_UPGRADE:-AUTO}" -export DB_UPGRADE="$MARIADB_UPGRADE" -export MARIADB_SKIP_TEST_DB="${MARIADB_SKIP_TEST_DB:-no}" -export DB_SKIP_TEST_DB="$MARIADB_SKIP_TEST_DB" -export MARIADB_CLIENT_ENABLE_SSL="${MARIADB_CLIENT_ENABLE_SSL:-no}" -export DB_CLIENT_ENABLE_SSL="$MARIADB_CLIENT_ENABLE_SSL" -export MARIADB_CLIENT_SSL_CA_FILE="${MARIADB_CLIENT_SSL_CA_FILE:-}" -export DB_CLIENT_SSL_CA_FILE="$MARIADB_CLIENT_SSL_CA_FILE" -export MARIADB_CLIENT_SSL_CERT_FILE="${MARIADB_CLIENT_SSL_CERT_FILE:-}" -export DB_CLIENT_SSL_CERT_FILE="$MARIADB_CLIENT_SSL_CERT_FILE" -export MARIADB_CLIENT_SSL_KEY_FILE="${MARIADB_CLIENT_SSL_KEY_FILE:-}" -export DB_CLIENT_SSL_KEY_FILE="$MARIADB_CLIENT_SSL_KEY_FILE" -export MARIADB_CLIENT_EXTRA_FLAGS="${MARIADB_CLIENT_EXTRA_FLAGS:-no}" -export DB_CLIENT_EXTRA_FLAGS="$MARIADB_CLIENT_EXTRA_FLAGS" -export MARIADB_STARTUP_WAIT_RETRIES="${MARIADB_STARTUP_WAIT_RETRIES:-300}" -export DB_STARTUP_WAIT_RETRIES="$MARIADB_STARTUP_WAIT_RETRIES" -export MARIADB_STARTUP_WAIT_SLEEP_TIME="${MARIADB_STARTUP_WAIT_SLEEP_TIME:-2}" -export DB_STARTUP_WAIT_SLEEP_TIME="$MARIADB_STARTUP_WAIT_SLEEP_TIME" -MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-"${DB_ENABLE_SLOW_QUERY:-}"}" -export MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-0}" -export DB_ENABLE_SLOW_QUERY="$MARIADB_ENABLE_SLOW_QUERY" -MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-"${DB_LONG_QUERY_TIME:-}"}" -export MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-10.0}" -export DB_LONG_QUERY_TIME="$MARIADB_LONG_QUERY_TIME" - -# Custom environment variables may be defined below diff --git a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh b/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh deleted file mode 100755 index 5daeb16c64943..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/mariadb/conf) -debug "Copying files from $DB_DEFAULT_CONF_DIR to $DB_CONF_DIR" -cp -nr "$DB_DEFAULT_CONF_DIR"/. "$DB_CONF_DIR" - -if [[ "$1" = "/opt/bitnami/scripts/mariadb/run.sh" ]]; then - info "** Starting MariaDB setup **" - /opt/bitnami/scripts/mariadb/setup.sh - info "** MariaDB setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh b/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh deleted file mode 100755 index 60211b1057f6e..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libmariadb.sh - -# Load MySQL environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -mysql_healthcheck diff --git a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh b/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh deleted file mode 100755 index ee8217ffb401c..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Configure MariaDB options based on build-time defaults -info "Configuring default MariaDB options" -ensure_dir_exists "$DB_CONF_DIR" -mysql_create_default_config - -for dir in "$DB_TMP_DIR" "$DB_LOGS_DIR" "$DB_CONF_DIR" "$DB_DEFAULT_CONF_DIR" "${DB_CONF_DIR}/bitnami" "$DB_VOLUME_DIR" "$DB_DATA_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# Fix to avoid issues detecting plugins in mysql_install_db -ln -sf "$DB_BASE_DIR/plugin" "$DB_BASE_DIR/lib/plugin" - -# Redirect all logging to stdout -ln -sf "/proc/1/fd/1" "$DB_LOGS_DIR/mysqld.log" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${DB_CONF_DIR}/"* "$DB_DEFAULT_CONF_DIR" diff --git a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh b/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh deleted file mode 100755 index 97f5d80c226f0..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# mysqld_safe does not allow logging to stdout/stderr, so we stick with mysqld -EXEC="${DB_SBIN_DIR}/mysqld" - -flags=("--defaults-file=${DB_CONF_DIR}/my.cnf" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") -[[ -z "${DB_PID_FILE:-}" ]] || flags+=("--pid-file=${DB_PID_FILE}") - -# Add flags specified via the 'DB_EXTRA_FLAGS' environment variable -read -r -a db_extra_flags <<< "$(mysql_extra_flags)" -[[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - -# Add flags passed to this script -flags+=("$@") - -# Fix for MDEV-16183 - mysqld_safe already does this, but we are using mysqld -LD_PRELOAD="$(find_jemalloc_lib)${LD_PRELOAD:+ "$LD_PRELOAD"}" -export LD_PRELOAD - -info "** Starting MariaDB **" -if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "$EXEC" "${flags[@]}" -else - exec "$EXEC" "${flags[@]}" -fi diff --git a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh b/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh deleted file mode 100755 index 9dcc55c047ade..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Ensure mysql unix socket file does not exist -rm -rf "${DB_SOCKET_FILE}.lock" -# Ensure MariaDB environment variables settings are valid -mysql_validate -# Ensure MariaDB is stopped when this script ends. -trap "mysql_stop" EXIT -if am_i_root; then - # Ensure 'daemon' user exists when running as 'root' - ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" - # Fix logging issue when running as root - chmod o+w "$(readlink /dev/stdout)" -fi -# Ensure MariaDB is initialized -mysql_initialize -# Allow running custom initialization scripts -mysql_custom_scripts 'init' -# Allow running custom start scripts -mysql_custom_scripts 'start' -# Stop MariaDB before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -mysql_stop diff --git a/bitnami/mariadb/10.11/debian-12/tags-info.yaml b/bitnami/mariadb/10.11/debian-12/tags-info.yaml deleted file mode 100644 index 3e280dc001ad4..0000000000000 --- a/bitnami/mariadb/10.11/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "10.11" -- 10.11-debian-12 -- 10.11.10 diff --git a/bitnami/mariadb/10.5/README.md b/bitnami/mariadb/10.5/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/mariadb/10.5/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/mariadb/10.5/debian-12/Dockerfile b/bitnami/mariadb/10.5/debian-12/Dockerfile deleted file mode 100644 index 13723073210fc..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T22:23:53Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mariadb/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="10.5.27-debian-12-r2" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mariadb" \ - org.opencontainers.image.title="mariadb" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="10.5.27" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libaio1 libaudit1 libcap-ng0 libcrypt1 libgcc-s1 libicu72 liblzma5 libncurses6 libpam0g libssl3 libstdc++6 libtinfo6 libxml2 procps psmisc zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "ini-file-1.4.7-8-linux-${OS_ARCH}-debian-12" \ - "mariadb-10.5.27-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir /docker-entrypoint-initdb.d - -COPY rootfs / -RUN /opt/bitnami/scripts/mariadb/postunpack.sh -ENV APP_VERSION="10.5.27" \ - BITNAMI_APP_NAME="mariadb" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/common/sbin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:$PATH" - -EXPOSE 3306 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/mariadb/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/mariadb/run.sh" ] diff --git a/bitnami/mariadb/10.5/debian-12/docker-compose-replication.yml b/bitnami/mariadb/10.5/debian-12/docker-compose-replication.yml deleted file mode 100644 index 0755f15d407ab..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/docker-compose-replication.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-master: - image: docker.io/bitnami/mariadb:10.5 - ports: - - '3306' - volumes: - - 'mariadb_master_data:/bitnami/mariadb' - environment: - - MARIADB_REPLICATION_MODE=master - - MARIADB_REPLICATION_USER=repl_user - - MARIADB_USER=my_user - - MARIADB_DATABASE=my_database - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_ROOT_PASSWORD=my_root_password - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - - mariadb-slave: - image: docker.io/bitnami/mariadb:10.5 - ports: - - '3306' - depends_on: - - mariadb-master - environment: - - MARIADB_REPLICATION_MODE=slave - - MARIADB_REPLICATION_USER=repl_user - - MARIADB_USER=my_user - - MARIADB_DATABASE=my_database - - MARIADB_MASTER_HOST=mariadb-master - - MARIADB_MASTER_PORT_NUMBER=3306 - - MARIADB_MASTER_ROOT_PASSWORD=my_root_password - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_master_data: - driver: local diff --git a/bitnami/mariadb/10.5/debian-12/docker-compose.yml b/bitnami/mariadb/10.5/debian-12/docker-compose.yml deleted file mode 100644 index 46f9256d79bfb..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb: - image: docker.io/bitnami/mariadb:10.5 - ports: - - '3306:3306' - volumes: - - 'mariadb_data:/bitnami/mariadb' - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_data: - driver: local diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 081c74e680b41..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ini-file": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.4.7-8" - }, - "mariadb": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "10.5.27-0" - } -} \ No newline at end of file diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/mariadb/10.5/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/mariadb/10.5/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/mariadb/10.5/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh b/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh deleted file mode 100644 index 9d6bd864f4513..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh +++ /dev/null @@ -1,1417 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami MySQL library - -# shellcheck disable=SC1090,SC1091,SC2119,SC2120 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh - -######################## -# Configure database extra start flags -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Array with extra flags to use -######################### -mysql_extra_flags() { - local randNumber - local -a dbExtraFlags=() - # shellcheck disable=SC2153 - read -r -a userExtraFlags <<< "$DB_EXTRA_FLAGS" - - if [[ -n "$DB_REPLICATION_MODE" ]]; then - randNumber="$(head /dev/urandom | tr -dc 0-9 | head -c 3 ; echo '')" - dbExtraFlags+=("--server-id=$randNumber" "--binlog-format=ROW" "--log-bin=mysql-bin" "--sync-binlog=1") - if [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - dbExtraFlags+=("--relay-log=mysql-relay-bin" "--log-slave-updates=1" "--read-only=1") - elif [[ "$DB_REPLICATION_MODE" = "master" ]]; then - dbExtraFlags+=("--innodb_flush_log_at_trx_commit=1") - fi - fi - - [[ "${#userExtraFlags[@]}" -eq 0 ]] || dbExtraFlags+=("${userExtraFlags[@]}") - - echo "${dbExtraFlags[@]:-}" -} - -######################## -# Validate settings in MYSQL_*/MARIADB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_validate() { - info "Validating settings in MYSQL_*/MARIADB_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - backslash_password_error() { - print_validation_error "The password cannot contain backslashes ('\'). Set the environment variable $1 with no backslashes (more info at https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html)" - } - - if [[ -n "$DB_REPLICATION_MODE" ]]; then - if [[ "$DB_REPLICATION_MODE" = "master" ]]; then - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -n "$DB_REPLICATION_USER" ]] && [[ -z "$DB_REPLICATION_PASSWORD" ]]; then - empty_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if (( ${#DB_ROOT_PASSWORD} > 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - elif [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - if [[ -z "$DB_MASTER_HOST" ]]; then - print_validation_error "Slave replication mode chosen without setting the environment variable $(get_env_var MASTER_HOST). Use it to indicate where the Master node is running" - fi - else - print_validation_error "Invalid replication mode. Available options are 'master/slave'" - fi - else - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ "$DB_USER" = "root" ]]; then - print_validation_error "root user is already created in the database and you can't use it as username for user creation." - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - if [[ "${DB_REPLICATION_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "$dump_file" - debug "Finish dump databases" - - debug "Unlock master databases for write operations" - echo "UNLOCK TABLES;" | mysql_remote_execute "$DB_MASTER_HOST" "$DB_MASTER_PORT_NUMBER" "mysql" "$DB_MASTER_ROOT_USER" "$DB_MASTER_ROOT_PASSWORD" - - debug "Start import dump databases" - mysql_execute < "$dump_file" - mysql_execute "mysql" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - if ! grep --silent "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" "${DB_CONF_FILE}"; then - echo "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" >> "${DB_CONF_FILE}" - fi - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Using persisted data" - # mysql_upgrade requires the server to be running - [[ -n "$(get_master_env_var_value ROOT_PASSWORD)" ]] && export ROOT_AUTH_ENABLED="yes" - # https://dev.mysql.com/doc/refman/8.0/en/replication-upgrade.html - mariadb_upgrade - else - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - info "Installing database" - mariadb_install_db - mysql_start_bg - wait_for_mysql_access - # we delete existing users and create new ones with stricter access - # commands can still be executed until we restart or run 'flush privileges' - info "Configuring authentication" - mysql_execute "mysql" <=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Initialize database data -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_install_db() { - local command="${DB_BIN_DIR}/mysql_install_db" - local -a args=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && args+=("${db_extra_flags[@]}") - - am_i_root && args=("${args[@]}" "--user=$DB_DAEMON_USER") - args+=("--auth-root-authentication-method=normal") - # Feature available only in MariaDB 10.5+ - # ref: https://mariadb.com/kb/en/mysql_install_db/#not-creating-the-test-database-and-anonymous-user - if [[ ! "$(mysql_get_version)" =~ ^10\.[01234]\. ]]; then - is_boolean_yes "$DB_SKIP_TEST_DB" && args+=("--skip-test-db") - fi - - debug_execute "$command" "${args[@]}" -} - -######################## -# Upgrade Database Schema -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_upgrade() { - local -a args=("--defaults-file=${DB_CONF_FILE}" "-u" "$DB_ROOT_USER") - info "Running mysql_upgrade" - mysql_start_bg - is_boolean_yes "${ROOT_AUTH_ENABLED:-false}" && args+=("-p$(get_master_env_var_value ROOT_PASSWORD)") - [[ "${DB_UPGRADE}" == "FORCE" ]] && args+=("--force") - debug_execute "${DB_BIN_DIR}/mysql_upgrade" "${args[@]}" || echo "This installation is already upgraded" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for mysql common - -######################## -# Extract mysql version from version string -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Version string -######################### -mysql_get_version() { - local ver_string - local -a ver_split - - ver_string=$("${DB_BIN_DIR}/mysql" "--version") - read -r -a ver_split <<< "$ver_string" - - if [[ "$ver_string" = *" Distrib "* ]]; then - echo "${ver_split[4]::-1}" - else - echo "${ver_split[2]}" - fi -} - -######################## -# Gets an environment variable name based on the suffix -# Globals: -# DB_FLAVOR -# Arguments: -# $1 - environment variable suffix -# Returns: -# environment variable name -######################### -get_env_var() { - local -r id="${1:?id is required}" - local -r prefix="${DB_FLAVOR//-/_}" - echo "${prefix^^}_${id}" -} - -######################## -# Gets an environment variable value for the master node and based on the suffix -# Arguments: -# $1 - environment variable suffix -# Returns: -# environment variable value -######################### -get_master_env_var_value() { - local envVar - - PREFIX="" - [[ "${DB_REPLICATION_MODE:-}" = "slave" ]] && PREFIX="MASTER_" - envVar="$(get_env_var "${PREFIX}${1}_FILE")" - if [[ -f "${!envVar:-}" ]]; then - echo "$(< "${!envVar}")" - else - envVar="$(get_env_var "${PREFIX}${1}")" - echo "${!envVar:-}" - fi -} - -######################## -# Execute an arbitrary query/queries against the running MySQL/MariaDB service and print to stdout -# Stdin: -# Query/queries to execute -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - Database where to run the queries -# $2 - User to run queries -# $3 - Password -# $4 - Extra MySQL CLI options -# Returns: -# None -mysql_execute_print_output() { - local -r db="${1:-}" - local -r user="${2:-root}" - local -r pass="${3:-}" - local -a opts extra_opts - read -r -a opts <<< "${@:4}" - read -r -a extra_opts <<< "$(mysql_client_extra_opts)" - - # Process mysql CLI arguments - local -a args=() - if [[ -f "$DB_CONF_FILE" ]]; then - args+=("--defaults-file=${DB_CONF_FILE}") - fi - args+=("-N" "-u" "$user") - [[ -n "$db" ]] && args+=("$db") - [[ -n "$pass" ]] && args+=("-p$pass") - [[ "${#opts[@]}" -gt 0 ]] && args+=("${opts[@]}") - [[ "${#extra_opts[@]}" -gt 0 ]] && args+=("${extra_opts[@]}") - - # Obtain the command specified via stdin - if [[ "${BITNAMI_DEBUG:-false}" = true ]]; then - local mysql_cmd - mysql_cmd="$(> "$custom_conf_file" - cat "$old_custom_conf_file" >> "$custom_conf_file" - fi - if am_i_root; then - [[ -e "$DB_VOLUME_DIR/.initialized" ]] && rm "$DB_VOLUME_DIR/.initialized" - rm -rf "$DB_VOLUME_DIR/conf" - else - warn "Old custom configuration migrated, please manually remove the 'conf' directory from the volume use to persist data" - fi -} - -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - local mysql_create_user_cmd - [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.4, the mysql.user table was replaced with a view: https://mariadb.com/kb/en/mysqluser-table/ - # Views have a definer user, in this case set to 'root', which needs to exist for the view to work - # In MySQL, to avoid issues when renaming the root user, they use the 'mysql.sys' user as a definer: https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html - # However, for MariaDB that is not the case, so when the 'root' user is renamed the 'mysql.user' table stops working and the view needs to be fixed - if [[ "$user" != "root" && ! "$(mysql_get_version)" =~ ^10.[0123]. ]]; then - alter_view_str="$(mysql_execute_print_output "mysql" "$user" "$password" "-s" <&2 - return 1 - ;; - esac - shift - done - - local -a mysql_execute_cmd=("mysql_execute") - [[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - - local -a create_database_args=() - [[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'") - [[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'") - - debug "Creating database $database" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$user") - [[ -n "$db_host" ]] && flags+=("--host" "${db_host}") - [[ -n "$db_port" ]] && flags+=("--port" "${db_port}") - if is_boolean_yes "$use_ldap"; then - flags+=("--use-ldap") - elif [[ -n "$password" ]]; then - flags+=("-p" "$password") - [[ -n "$auth_plugin" ]] && flags=("${flags[@]}" "--auth-plugin" "$auth_plugin") - fi - mysql_ensure_user_exists "${flags[@]}" -} - -######################## -# Optionally create the given database, and then optionally give a user -# full privileges on the database. -# Flags: -# -u|--user - database user -# --character-set - character set -# --collation - collation -# --host - database host -# --port - database port -# Arguments: -# $1 - database name -# Returns: -# None -######################### -mysql_ensure_optional_database_exists() { - local -r database="${1:?database is missing}" - local character_set="" - local collate="" - local user="" - local privileges="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - --character-set) - shift - character_set="${1:?missing character set}" - ;; - --collate) - shift - collate="${1:?missing collate}" - ;; - -u|--user) - shift - user="${1:?missing database user}" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - --privileges) - shift - privileges="${1:?missing privileges}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$database") - [[ -n "$character_set" ]] && flags+=("--character-set" "$character_set") - [[ -n "$collate" ]] && flags+=("--collate" "$collate") - [[ -n "$db_host" ]] && flags+=("--host" "$db_host") - [[ -n "$db_port" ]] && flags+=("--port" "$db_port") - mysql_ensure_database_exists "${flags[@]}" - - if [[ -n "$user" ]]; then - mysql_ensure_user_has_database_privileges "$user" "$database" "$privileges" "$db_host" "$db_port" - fi -} - -######################## -# Add or modify an entry in the MySQL configuration file ("$DB_CONF_FILE") -# Globals: -# DB_* -# Arguments: -# $1 - MySQL variable name -# $2 - Value to assign to the MySQL variable -# $3 - Section in the MySQL configuration file the key is located (default: mysqld) -# $4 - Configuration file (default: "$BD_CONF_FILE") -# Returns: -# None -######################### -mysql_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - read -r -a sections <<<"${3:-mysqld}" - local -r ignore_inline_comments="${4:-no}" - local -r file="${5:-"$DB_CONF_FILE"}" - info "Setting ${key} option" - debug "Setting ${key} to '${value}' in ${DB_FLAVOR} configuration file ${file}" - # Check if the configuration exists in the file - for section in "${sections[@]}"; do - if is_boolean_yes "$ignore_inline_comments"; then - ini-file set --ignore-inline-comments --section "$section" --key "$key" --value "$value" "$file" - else - ini-file set --section "$section" --key "$key" --value "$value" "$file" - fi - done -} - -######################## -# Update MySQL/MariaDB configuration file with user custom inputs -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_update_custom_config() { - # Persisted configuration files from old versions - ! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration - - # User injected custom configuration - if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then - debug "Injecting custom configuration from my_custom.conf" - cat "$DB_CONF_DIR/my_custom.cnf" > "$DB_CONF_DIR/bitnami/my_custom.cnf" - fi - - ! is_empty_value "$DB_USER" && mysql_conf_set "user" "$DB_USER" "mysqladmin" - ! is_empty_value "$DB_PORT_NUMBER" && mysql_conf_set "port" "$DB_PORT_NUMBER" "mysqld client manager" - ! is_empty_value "$DB_CHARACTER_SET" && mysql_conf_set "character_set_server" "$DB_CHARACTER_SET" - ! is_empty_value "$DB_COLLATE" && mysql_conf_set "collation_server" "$DB_COLLATE" - ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" - ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" - ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" - ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" - ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=( "/usr/lib" "/usr/lib64" ) - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} - -######################## -# Execute a reliable health check against the current mysql instance -# Globals: -# DB_ROOT_USER, DB_ROOT_PASSWORD, DB_MASTER_ROOT_PASSWORD -# Arguments: -# None -# Returns: -# mysqladmin output -######################### -mysql_healthcheck() { - local args=("-u${DB_ROOT_USER}" "-h0.0.0.0") - local root_password - - root_password="$(get_master_env_var_value ROOT_PASSWORD)" - if [[ -n "$root_password" ]]; then - args+=("-p${root_password}") - fi - - mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status -} - -######################## -# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# mysql client flavor -######################### -mysql_client_flavor() { - if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then - echo "mariadb" - else - echo "mysql" - fi -} - -######################## -# Prints extra options for MySQL client calls (i.e. SSL options) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# List of options to pass to "mysql" CLI -######################### -mysql_client_extra_opts() { - # Helper to get the proper value for the MySQL client environment variable - mysql_client_env_value() { - local env_name="MYSQL_CLIENT_${1:?missing name}" - if [[ -n "${!env_name:-}" ]]; then - echo "${!env_name:-}" - else - env_name="DB_CLIENT_${1}" - echo "${!env_name:-}" - fi - } - local -a opts=() - local key value - if is_boolean_yes "${DB_ENABLE_SSL:-no}"; then - if [[ "$(mysql_client_flavor)" = "mysql" ]]; then - opts+=("--ssl-mode=REQUIRED") - else - opts+=("--ssl=TRUE") - fi - # Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined - for key in ca key cert; do - value="$(mysql_client_env_value "SSL_${key^^}_FILE")" - [[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}") - done - else - # Skip SSL validation - if [[ "$(mysql_client_flavor)" = "mariadb" ]]; then - # SSL connections are enabled by default in MariaDB >=10.11 - local mysql_version="" - local major_version="" - local minor_version="" - mysql_version="$(mysql_get_version)" - major_version="$(get_sematic_version "${mysql_version}" 1)" - minor_version="$(get_sematic_version "${mysql_version}" 2)" - if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then - opts+=("--skip-ssl") - fi - fi - fi - echo "${opts[@]:-}" -} diff --git a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh b/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh deleted file mode 100644 index 3fe87ab875092..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for mariadb - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-mariadb}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -mariadb_env_vars=( - ALLOW_EMPTY_PASSWORD - MARIADB_AUTHENTICATION_PLUGIN - MARIADB_ROOT_USER - MARIADB_ROOT_PASSWORD - MARIADB_USER - MARIADB_PASSWORD - MARIADB_DATABASE - MARIADB_MASTER_HOST - MARIADB_MASTER_PORT_NUMBER - MARIADB_MASTER_ROOT_USER - MARIADB_MASTER_ROOT_PASSWORD - MARIADB_MASTER_DELAY - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - MARIADB_PORT_NUMBER - MARIADB_REPLICATION_MODE - MARIADB_REPLICATION_SLAVE_DUMP - MARIADB_EXTRA_FLAGS - MARIADB_INIT_SLEEP_TIME - MARIADB_CHARACTER_SET - MARIADB_COLLATE - MARIADB_BIND_ADDRESS - MARIADB_SQL_MODE - MARIADB_UPGRADE - MARIADB_SKIP_TEST_DB - MARIADB_CLIENT_ENABLE_SSL - MARIADB_CLIENT_SSL_CA_FILE - MARIADB_CLIENT_SSL_CERT_FILE - MARIADB_CLIENT_SSL_KEY_FILE - MARIADB_CLIENT_EXTRA_FLAGS - MARIADB_STARTUP_WAIT_RETRIES - MARIADB_STARTUP_WAIT_SLEEP_TIME - MARIADB_ENABLE_SLOW_QUERY - MARIADB_LONG_QUERY_TIME - DB_ENABLE_SLOW_QUERY - DB_LONG_QUERY_TIME -) -for env_var in "${mariadb_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset mariadb_env_vars -export DB_FLAVOR="mariadb" - -# Paths -export DB_BASE_DIR="${BITNAMI_ROOT_DIR}/mariadb" -export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" -export DB_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_SBIN_DIR="${DB_BASE_DIR}/sbin" -export DB_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_LOGS_DIR="${DB_BASE_DIR}/logs" -export DB_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_CONF_FILE="${DB_CONF_DIR}/my.cnf" -export DB_PID_FILE="${DB_TMP_DIR}/mysqld.pid" -export DB_SOCKET_FILE="${DB_TMP_DIR}/mysql.sock" -export PATH="${DB_SBIN_DIR}:${DB_BIN_DIR}:/opt/bitnami/common/bin:${PATH}" - -# System users (when running with a privileged user) -export DB_DAEMON_USER="mysql" -export DB_DAEMON_GROUP="mysql" - -# Default configuration (build-time) -export MARIADB_DEFAULT_PORT_NUMBER="3306" -export DB_DEFAULT_PORT_NUMBER="$MARIADB_DEFAULT_PORT_NUMBER" # only used at build time -export MARIADB_DEFAULT_CHARACTER_SET="utf8mb4" -export DB_DEFAULT_CHARACTER_SET="$MARIADB_DEFAULT_CHARACTER_SET" # only used at build time -export MARIADB_DEFAULT_BIND_ADDRESS="0.0.0.0" -export DB_DEFAULT_BIND_ADDRESS="$MARIADB_DEFAULT_BIND_ADDRESS" # only used at build time - -# MariaDB authentication. -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export MARIADB_AUTHENTICATION_PLUGIN="${MARIADB_AUTHENTICATION_PLUGIN:-}" -export DB_AUTHENTICATION_PLUGIN="$MARIADB_AUTHENTICATION_PLUGIN" -export MARIADB_ROOT_USER="${MARIADB_ROOT_USER:-root}" -export DB_ROOT_USER="$MARIADB_ROOT_USER" # only used during the first initialization -export MARIADB_ROOT_PASSWORD="${MARIADB_ROOT_PASSWORD:-}" -export DB_ROOT_PASSWORD="$MARIADB_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_USER="${MARIADB_USER:-}" -export DB_USER="$MARIADB_USER" # only used during the first initialization -export MARIADB_PASSWORD="${MARIADB_PASSWORD:-}" -export DB_PASSWORD="$MARIADB_PASSWORD" # only used during the first initialization -export MARIADB_DATABASE="${MARIADB_DATABASE:-}" -export DB_DATABASE="$MARIADB_DATABASE" # only used during the first initialization -export MARIADB_MASTER_HOST="${MARIADB_MASTER_HOST:-}" -export DB_MASTER_HOST="$MARIADB_MASTER_HOST" # only used during the first initialization -export MARIADB_MASTER_PORT_NUMBER="${MARIADB_MASTER_PORT_NUMBER:-3306}" -export DB_MASTER_PORT_NUMBER="$MARIADB_MASTER_PORT_NUMBER" # only used during the first initialization -export MARIADB_MASTER_ROOT_USER="${MARIADB_MASTER_ROOT_USER:-root}" -export DB_MASTER_ROOT_USER="$MARIADB_MASTER_ROOT_USER" # only used during the first initialization -export MARIADB_MASTER_ROOT_PASSWORD="${MARIADB_MASTER_ROOT_PASSWORD:-}" -export DB_MASTER_ROOT_PASSWORD="$MARIADB_MASTER_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_MASTER_DELAY="${MARIADB_MASTER_DELAY:-0}" -export DB_MASTER_DELAY="$MARIADB_MASTER_DELAY" # only used during the first initialization -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Settings -export MARIADB_PORT_NUMBER="${MARIADB_PORT_NUMBER:-}" -export DB_PORT_NUMBER="$MARIADB_PORT_NUMBER" -export MARIADB_REPLICATION_MODE="${MARIADB_REPLICATION_MODE:-}" -export DB_REPLICATION_MODE="$MARIADB_REPLICATION_MODE" -export MARIADB_REPLICATION_SLAVE_DUMP="${MARIADB_REPLICATION_SLAVE_DUMP:-false}" -export DB_REPLICATION_SLAVE_DUMP="$MARIADB_REPLICATION_SLAVE_DUMP" -export MARIADB_EXTRA_FLAGS="${MARIADB_EXTRA_FLAGS:-}" -export DB_EXTRA_FLAGS="$MARIADB_EXTRA_FLAGS" -export MARIADB_INIT_SLEEP_TIME="${MARIADB_INIT_SLEEP_TIME:-}" -export DB_INIT_SLEEP_TIME="$MARIADB_INIT_SLEEP_TIME" -export MARIADB_CHARACTER_SET="${MARIADB_CHARACTER_SET:-}" -export DB_CHARACTER_SET="$MARIADB_CHARACTER_SET" -# MARIADB_COLLATION is deprecated in favor of MARIADB_COLLATE -MARIADB_COLLATE="${MARIADB_COLLATE:-"${MARIADB_COLLATION:-}"}" -export MARIADB_COLLATE="${MARIADB_COLLATE:-}" -export DB_COLLATE="$MARIADB_COLLATE" -export MARIADB_BIND_ADDRESS="${MARIADB_BIND_ADDRESS:-}" -export DB_BIND_ADDRESS="$MARIADB_BIND_ADDRESS" -export MARIADB_SQL_MODE="${MARIADB_SQL_MODE:-}" -export DB_SQL_MODE="$MARIADB_SQL_MODE" -export MARIADB_UPGRADE="${MARIADB_UPGRADE:-AUTO}" -export DB_UPGRADE="$MARIADB_UPGRADE" -export MARIADB_SKIP_TEST_DB="${MARIADB_SKIP_TEST_DB:-no}" -export DB_SKIP_TEST_DB="$MARIADB_SKIP_TEST_DB" -export MARIADB_CLIENT_ENABLE_SSL="${MARIADB_CLIENT_ENABLE_SSL:-no}" -export DB_CLIENT_ENABLE_SSL="$MARIADB_CLIENT_ENABLE_SSL" -export MARIADB_CLIENT_SSL_CA_FILE="${MARIADB_CLIENT_SSL_CA_FILE:-}" -export DB_CLIENT_SSL_CA_FILE="$MARIADB_CLIENT_SSL_CA_FILE" -export MARIADB_CLIENT_SSL_CERT_FILE="${MARIADB_CLIENT_SSL_CERT_FILE:-}" -export DB_CLIENT_SSL_CERT_FILE="$MARIADB_CLIENT_SSL_CERT_FILE" -export MARIADB_CLIENT_SSL_KEY_FILE="${MARIADB_CLIENT_SSL_KEY_FILE:-}" -export DB_CLIENT_SSL_KEY_FILE="$MARIADB_CLIENT_SSL_KEY_FILE" -export MARIADB_CLIENT_EXTRA_FLAGS="${MARIADB_CLIENT_EXTRA_FLAGS:-no}" -export DB_CLIENT_EXTRA_FLAGS="$MARIADB_CLIENT_EXTRA_FLAGS" -export MARIADB_STARTUP_WAIT_RETRIES="${MARIADB_STARTUP_WAIT_RETRIES:-300}" -export DB_STARTUP_WAIT_RETRIES="$MARIADB_STARTUP_WAIT_RETRIES" -export MARIADB_STARTUP_WAIT_SLEEP_TIME="${MARIADB_STARTUP_WAIT_SLEEP_TIME:-2}" -export DB_STARTUP_WAIT_SLEEP_TIME="$MARIADB_STARTUP_WAIT_SLEEP_TIME" -MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-"${DB_ENABLE_SLOW_QUERY:-}"}" -export MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-0}" -export DB_ENABLE_SLOW_QUERY="$MARIADB_ENABLE_SLOW_QUERY" -MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-"${DB_LONG_QUERY_TIME:-}"}" -export MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-10.0}" -export DB_LONG_QUERY_TIME="$MARIADB_LONG_QUERY_TIME" - -# Custom environment variables may be defined below diff --git a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh b/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh deleted file mode 100755 index 5daeb16c64943..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/mariadb/conf) -debug "Copying files from $DB_DEFAULT_CONF_DIR to $DB_CONF_DIR" -cp -nr "$DB_DEFAULT_CONF_DIR"/. "$DB_CONF_DIR" - -if [[ "$1" = "/opt/bitnami/scripts/mariadb/run.sh" ]]; then - info "** Starting MariaDB setup **" - /opt/bitnami/scripts/mariadb/setup.sh - info "** MariaDB setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh b/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh deleted file mode 100755 index 60211b1057f6e..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libmariadb.sh - -# Load MySQL environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -mysql_healthcheck diff --git a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh b/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh deleted file mode 100755 index ee8217ffb401c..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Configure MariaDB options based on build-time defaults -info "Configuring default MariaDB options" -ensure_dir_exists "$DB_CONF_DIR" -mysql_create_default_config - -for dir in "$DB_TMP_DIR" "$DB_LOGS_DIR" "$DB_CONF_DIR" "$DB_DEFAULT_CONF_DIR" "${DB_CONF_DIR}/bitnami" "$DB_VOLUME_DIR" "$DB_DATA_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# Fix to avoid issues detecting plugins in mysql_install_db -ln -sf "$DB_BASE_DIR/plugin" "$DB_BASE_DIR/lib/plugin" - -# Redirect all logging to stdout -ln -sf "/proc/1/fd/1" "$DB_LOGS_DIR/mysqld.log" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${DB_CONF_DIR}/"* "$DB_DEFAULT_CONF_DIR" diff --git a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh b/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh deleted file mode 100755 index 97f5d80c226f0..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# mysqld_safe does not allow logging to stdout/stderr, so we stick with mysqld -EXEC="${DB_SBIN_DIR}/mysqld" - -flags=("--defaults-file=${DB_CONF_DIR}/my.cnf" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") -[[ -z "${DB_PID_FILE:-}" ]] || flags+=("--pid-file=${DB_PID_FILE}") - -# Add flags specified via the 'DB_EXTRA_FLAGS' environment variable -read -r -a db_extra_flags <<< "$(mysql_extra_flags)" -[[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - -# Add flags passed to this script -flags+=("$@") - -# Fix for MDEV-16183 - mysqld_safe already does this, but we are using mysqld -LD_PRELOAD="$(find_jemalloc_lib)${LD_PRELOAD:+ "$LD_PRELOAD"}" -export LD_PRELOAD - -info "** Starting MariaDB **" -if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "$EXEC" "${flags[@]}" -else - exec "$EXEC" "${flags[@]}" -fi diff --git a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh b/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh deleted file mode 100755 index 9dcc55c047ade..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Ensure mysql unix socket file does not exist -rm -rf "${DB_SOCKET_FILE}.lock" -# Ensure MariaDB environment variables settings are valid -mysql_validate -# Ensure MariaDB is stopped when this script ends. -trap "mysql_stop" EXIT -if am_i_root; then - # Ensure 'daemon' user exists when running as 'root' - ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" - # Fix logging issue when running as root - chmod o+w "$(readlink /dev/stdout)" -fi -# Ensure MariaDB is initialized -mysql_initialize -# Allow running custom initialization scripts -mysql_custom_scripts 'init' -# Allow running custom start scripts -mysql_custom_scripts 'start' -# Stop MariaDB before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -mysql_stop diff --git a/bitnami/mariadb/10.5/debian-12/tags-info.yaml b/bitnami/mariadb/10.5/debian-12/tags-info.yaml deleted file mode 100644 index 49a4df04ab42b..0000000000000 --- a/bitnami/mariadb/10.5/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "10.5" -- 10.5-debian-12 -- 10.5.27 diff --git a/bitnami/mariadb/10.6/README.md b/bitnami/mariadb/10.6/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/mariadb/10.6/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/mariadb/10.6/debian-12/Dockerfile b/bitnami/mariadb/10.6/debian-12/Dockerfile deleted file mode 100644 index ec51a65d1d8da..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T18:46:33Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mariadb/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="10.6.20-debian-12-r2" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mariadb" \ - org.opencontainers.image.title="mariadb" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="10.6.20" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libaio1 libaudit1 libcap-ng0 libcrypt1 libgcc-s1 libicu72 liblzma5 libncurses6 libpam0g libssl3 libstdc++6 libtinfo6 libxml2 procps psmisc zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "ini-file-1.4.7-8-linux-${OS_ARCH}-debian-12" \ - "mariadb-10.6.20-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir /docker-entrypoint-initdb.d - -COPY rootfs / -RUN /opt/bitnami/scripts/mariadb/postunpack.sh -ENV APP_VERSION="10.6.20" \ - BITNAMI_APP_NAME="mariadb" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/common/sbin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:$PATH" - -EXPOSE 3306 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/mariadb/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/mariadb/run.sh" ] diff --git a/bitnami/mariadb/10.6/debian-12/docker-compose-replication.yml b/bitnami/mariadb/10.6/debian-12/docker-compose-replication.yml deleted file mode 100644 index a06c89e75db6c..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/docker-compose-replication.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-master: - image: docker.io/bitnami/mariadb:10.6 - ports: - - '3306' - volumes: - - 'mariadb_master_data:/bitnami/mariadb' - environment: - - MARIADB_REPLICATION_MODE=master - - MARIADB_REPLICATION_USER=repl_user - - MARIADB_USER=my_user - - MARIADB_DATABASE=my_database - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_ROOT_PASSWORD=my_root_password - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - - mariadb-slave: - image: docker.io/bitnami/mariadb:10.6 - ports: - - '3306' - depends_on: - - mariadb-master - environment: - - MARIADB_REPLICATION_MODE=slave - - MARIADB_REPLICATION_USER=repl_user - - MARIADB_USER=my_user - - MARIADB_DATABASE=my_database - - MARIADB_MASTER_HOST=mariadb-master - - MARIADB_MASTER_PORT_NUMBER=3306 - - MARIADB_MASTER_ROOT_PASSWORD=my_root_password - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_master_data: - driver: local diff --git a/bitnami/mariadb/10.6/debian-12/docker-compose.yml b/bitnami/mariadb/10.6/debian-12/docker-compose.yml deleted file mode 100644 index c141ab8cce8e9..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb: - image: docker.io/bitnami/mariadb:10.6 - ports: - - '3306:3306' - volumes: - - 'mariadb_data:/bitnami/mariadb' - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_data: - driver: local diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 5ccdf24a92163..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ini-file": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.4.7-8" - }, - "mariadb": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "10.6.20-0" - } -} \ No newline at end of file diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/mariadb/10.6/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/mariadb/10.6/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/mariadb/10.6/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh b/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh deleted file mode 100644 index 9d6bd864f4513..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh +++ /dev/null @@ -1,1417 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami MySQL library - -# shellcheck disable=SC1090,SC1091,SC2119,SC2120 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh - -######################## -# Configure database extra start flags -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Array with extra flags to use -######################### -mysql_extra_flags() { - local randNumber - local -a dbExtraFlags=() - # shellcheck disable=SC2153 - read -r -a userExtraFlags <<< "$DB_EXTRA_FLAGS" - - if [[ -n "$DB_REPLICATION_MODE" ]]; then - randNumber="$(head /dev/urandom | tr -dc 0-9 | head -c 3 ; echo '')" - dbExtraFlags+=("--server-id=$randNumber" "--binlog-format=ROW" "--log-bin=mysql-bin" "--sync-binlog=1") - if [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - dbExtraFlags+=("--relay-log=mysql-relay-bin" "--log-slave-updates=1" "--read-only=1") - elif [[ "$DB_REPLICATION_MODE" = "master" ]]; then - dbExtraFlags+=("--innodb_flush_log_at_trx_commit=1") - fi - fi - - [[ "${#userExtraFlags[@]}" -eq 0 ]] || dbExtraFlags+=("${userExtraFlags[@]}") - - echo "${dbExtraFlags[@]:-}" -} - -######################## -# Validate settings in MYSQL_*/MARIADB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_validate() { - info "Validating settings in MYSQL_*/MARIADB_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - backslash_password_error() { - print_validation_error "The password cannot contain backslashes ('\'). Set the environment variable $1 with no backslashes (more info at https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html)" - } - - if [[ -n "$DB_REPLICATION_MODE" ]]; then - if [[ "$DB_REPLICATION_MODE" = "master" ]]; then - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -n "$DB_REPLICATION_USER" ]] && [[ -z "$DB_REPLICATION_PASSWORD" ]]; then - empty_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if (( ${#DB_ROOT_PASSWORD} > 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - elif [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - if [[ -z "$DB_MASTER_HOST" ]]; then - print_validation_error "Slave replication mode chosen without setting the environment variable $(get_env_var MASTER_HOST). Use it to indicate where the Master node is running" - fi - else - print_validation_error "Invalid replication mode. Available options are 'master/slave'" - fi - else - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ "$DB_USER" = "root" ]]; then - print_validation_error "root user is already created in the database and you can't use it as username for user creation." - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - if [[ "${DB_REPLICATION_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "$dump_file" - debug "Finish dump databases" - - debug "Unlock master databases for write operations" - echo "UNLOCK TABLES;" | mysql_remote_execute "$DB_MASTER_HOST" "$DB_MASTER_PORT_NUMBER" "mysql" "$DB_MASTER_ROOT_USER" "$DB_MASTER_ROOT_PASSWORD" - - debug "Start import dump databases" - mysql_execute < "$dump_file" - mysql_execute "mysql" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - if ! grep --silent "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" "${DB_CONF_FILE}"; then - echo "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" >> "${DB_CONF_FILE}" - fi - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Using persisted data" - # mysql_upgrade requires the server to be running - [[ -n "$(get_master_env_var_value ROOT_PASSWORD)" ]] && export ROOT_AUTH_ENABLED="yes" - # https://dev.mysql.com/doc/refman/8.0/en/replication-upgrade.html - mariadb_upgrade - else - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - info "Installing database" - mariadb_install_db - mysql_start_bg - wait_for_mysql_access - # we delete existing users and create new ones with stricter access - # commands can still be executed until we restart or run 'flush privileges' - info "Configuring authentication" - mysql_execute "mysql" <=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Initialize database data -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_install_db() { - local command="${DB_BIN_DIR}/mysql_install_db" - local -a args=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && args+=("${db_extra_flags[@]}") - - am_i_root && args=("${args[@]}" "--user=$DB_DAEMON_USER") - args+=("--auth-root-authentication-method=normal") - # Feature available only in MariaDB 10.5+ - # ref: https://mariadb.com/kb/en/mysql_install_db/#not-creating-the-test-database-and-anonymous-user - if [[ ! "$(mysql_get_version)" =~ ^10\.[01234]\. ]]; then - is_boolean_yes "$DB_SKIP_TEST_DB" && args+=("--skip-test-db") - fi - - debug_execute "$command" "${args[@]}" -} - -######################## -# Upgrade Database Schema -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_upgrade() { - local -a args=("--defaults-file=${DB_CONF_FILE}" "-u" "$DB_ROOT_USER") - info "Running mysql_upgrade" - mysql_start_bg - is_boolean_yes "${ROOT_AUTH_ENABLED:-false}" && args+=("-p$(get_master_env_var_value ROOT_PASSWORD)") - [[ "${DB_UPGRADE}" == "FORCE" ]] && args+=("--force") - debug_execute "${DB_BIN_DIR}/mysql_upgrade" "${args[@]}" || echo "This installation is already upgraded" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for mysql common - -######################## -# Extract mysql version from version string -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Version string -######################### -mysql_get_version() { - local ver_string - local -a ver_split - - ver_string=$("${DB_BIN_DIR}/mysql" "--version") - read -r -a ver_split <<< "$ver_string" - - if [[ "$ver_string" = *" Distrib "* ]]; then - echo "${ver_split[4]::-1}" - else - echo "${ver_split[2]}" - fi -} - -######################## -# Gets an environment variable name based on the suffix -# Globals: -# DB_FLAVOR -# Arguments: -# $1 - environment variable suffix -# Returns: -# environment variable name -######################### -get_env_var() { - local -r id="${1:?id is required}" - local -r prefix="${DB_FLAVOR//-/_}" - echo "${prefix^^}_${id}" -} - -######################## -# Gets an environment variable value for the master node and based on the suffix -# Arguments: -# $1 - environment variable suffix -# Returns: -# environment variable value -######################### -get_master_env_var_value() { - local envVar - - PREFIX="" - [[ "${DB_REPLICATION_MODE:-}" = "slave" ]] && PREFIX="MASTER_" - envVar="$(get_env_var "${PREFIX}${1}_FILE")" - if [[ -f "${!envVar:-}" ]]; then - echo "$(< "${!envVar}")" - else - envVar="$(get_env_var "${PREFIX}${1}")" - echo "${!envVar:-}" - fi -} - -######################## -# Execute an arbitrary query/queries against the running MySQL/MariaDB service and print to stdout -# Stdin: -# Query/queries to execute -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - Database where to run the queries -# $2 - User to run queries -# $3 - Password -# $4 - Extra MySQL CLI options -# Returns: -# None -mysql_execute_print_output() { - local -r db="${1:-}" - local -r user="${2:-root}" - local -r pass="${3:-}" - local -a opts extra_opts - read -r -a opts <<< "${@:4}" - read -r -a extra_opts <<< "$(mysql_client_extra_opts)" - - # Process mysql CLI arguments - local -a args=() - if [[ -f "$DB_CONF_FILE" ]]; then - args+=("--defaults-file=${DB_CONF_FILE}") - fi - args+=("-N" "-u" "$user") - [[ -n "$db" ]] && args+=("$db") - [[ -n "$pass" ]] && args+=("-p$pass") - [[ "${#opts[@]}" -gt 0 ]] && args+=("${opts[@]}") - [[ "${#extra_opts[@]}" -gt 0 ]] && args+=("${extra_opts[@]}") - - # Obtain the command specified via stdin - if [[ "${BITNAMI_DEBUG:-false}" = true ]]; then - local mysql_cmd - mysql_cmd="$(> "$custom_conf_file" - cat "$old_custom_conf_file" >> "$custom_conf_file" - fi - if am_i_root; then - [[ -e "$DB_VOLUME_DIR/.initialized" ]] && rm "$DB_VOLUME_DIR/.initialized" - rm -rf "$DB_VOLUME_DIR/conf" - else - warn "Old custom configuration migrated, please manually remove the 'conf' directory from the volume use to persist data" - fi -} - -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - local mysql_create_user_cmd - [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.4, the mysql.user table was replaced with a view: https://mariadb.com/kb/en/mysqluser-table/ - # Views have a definer user, in this case set to 'root', which needs to exist for the view to work - # In MySQL, to avoid issues when renaming the root user, they use the 'mysql.sys' user as a definer: https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html - # However, for MariaDB that is not the case, so when the 'root' user is renamed the 'mysql.user' table stops working and the view needs to be fixed - if [[ "$user" != "root" && ! "$(mysql_get_version)" =~ ^10.[0123]. ]]; then - alter_view_str="$(mysql_execute_print_output "mysql" "$user" "$password" "-s" <&2 - return 1 - ;; - esac - shift - done - - local -a mysql_execute_cmd=("mysql_execute") - [[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - - local -a create_database_args=() - [[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'") - [[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'") - - debug "Creating database $database" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$user") - [[ -n "$db_host" ]] && flags+=("--host" "${db_host}") - [[ -n "$db_port" ]] && flags+=("--port" "${db_port}") - if is_boolean_yes "$use_ldap"; then - flags+=("--use-ldap") - elif [[ -n "$password" ]]; then - flags+=("-p" "$password") - [[ -n "$auth_plugin" ]] && flags=("${flags[@]}" "--auth-plugin" "$auth_plugin") - fi - mysql_ensure_user_exists "${flags[@]}" -} - -######################## -# Optionally create the given database, and then optionally give a user -# full privileges on the database. -# Flags: -# -u|--user - database user -# --character-set - character set -# --collation - collation -# --host - database host -# --port - database port -# Arguments: -# $1 - database name -# Returns: -# None -######################### -mysql_ensure_optional_database_exists() { - local -r database="${1:?database is missing}" - local character_set="" - local collate="" - local user="" - local privileges="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - --character-set) - shift - character_set="${1:?missing character set}" - ;; - --collate) - shift - collate="${1:?missing collate}" - ;; - -u|--user) - shift - user="${1:?missing database user}" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - --privileges) - shift - privileges="${1:?missing privileges}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$database") - [[ -n "$character_set" ]] && flags+=("--character-set" "$character_set") - [[ -n "$collate" ]] && flags+=("--collate" "$collate") - [[ -n "$db_host" ]] && flags+=("--host" "$db_host") - [[ -n "$db_port" ]] && flags+=("--port" "$db_port") - mysql_ensure_database_exists "${flags[@]}" - - if [[ -n "$user" ]]; then - mysql_ensure_user_has_database_privileges "$user" "$database" "$privileges" "$db_host" "$db_port" - fi -} - -######################## -# Add or modify an entry in the MySQL configuration file ("$DB_CONF_FILE") -# Globals: -# DB_* -# Arguments: -# $1 - MySQL variable name -# $2 - Value to assign to the MySQL variable -# $3 - Section in the MySQL configuration file the key is located (default: mysqld) -# $4 - Configuration file (default: "$BD_CONF_FILE") -# Returns: -# None -######################### -mysql_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - read -r -a sections <<<"${3:-mysqld}" - local -r ignore_inline_comments="${4:-no}" - local -r file="${5:-"$DB_CONF_FILE"}" - info "Setting ${key} option" - debug "Setting ${key} to '${value}' in ${DB_FLAVOR} configuration file ${file}" - # Check if the configuration exists in the file - for section in "${sections[@]}"; do - if is_boolean_yes "$ignore_inline_comments"; then - ini-file set --ignore-inline-comments --section "$section" --key "$key" --value "$value" "$file" - else - ini-file set --section "$section" --key "$key" --value "$value" "$file" - fi - done -} - -######################## -# Update MySQL/MariaDB configuration file with user custom inputs -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_update_custom_config() { - # Persisted configuration files from old versions - ! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration - - # User injected custom configuration - if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then - debug "Injecting custom configuration from my_custom.conf" - cat "$DB_CONF_DIR/my_custom.cnf" > "$DB_CONF_DIR/bitnami/my_custom.cnf" - fi - - ! is_empty_value "$DB_USER" && mysql_conf_set "user" "$DB_USER" "mysqladmin" - ! is_empty_value "$DB_PORT_NUMBER" && mysql_conf_set "port" "$DB_PORT_NUMBER" "mysqld client manager" - ! is_empty_value "$DB_CHARACTER_SET" && mysql_conf_set "character_set_server" "$DB_CHARACTER_SET" - ! is_empty_value "$DB_COLLATE" && mysql_conf_set "collation_server" "$DB_COLLATE" - ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" - ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" - ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" - ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" - ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=( "/usr/lib" "/usr/lib64" ) - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} - -######################## -# Execute a reliable health check against the current mysql instance -# Globals: -# DB_ROOT_USER, DB_ROOT_PASSWORD, DB_MASTER_ROOT_PASSWORD -# Arguments: -# None -# Returns: -# mysqladmin output -######################### -mysql_healthcheck() { - local args=("-u${DB_ROOT_USER}" "-h0.0.0.0") - local root_password - - root_password="$(get_master_env_var_value ROOT_PASSWORD)" - if [[ -n "$root_password" ]]; then - args+=("-p${root_password}") - fi - - mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status -} - -######################## -# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# mysql client flavor -######################### -mysql_client_flavor() { - if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then - echo "mariadb" - else - echo "mysql" - fi -} - -######################## -# Prints extra options for MySQL client calls (i.e. SSL options) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# List of options to pass to "mysql" CLI -######################### -mysql_client_extra_opts() { - # Helper to get the proper value for the MySQL client environment variable - mysql_client_env_value() { - local env_name="MYSQL_CLIENT_${1:?missing name}" - if [[ -n "${!env_name:-}" ]]; then - echo "${!env_name:-}" - else - env_name="DB_CLIENT_${1}" - echo "${!env_name:-}" - fi - } - local -a opts=() - local key value - if is_boolean_yes "${DB_ENABLE_SSL:-no}"; then - if [[ "$(mysql_client_flavor)" = "mysql" ]]; then - opts+=("--ssl-mode=REQUIRED") - else - opts+=("--ssl=TRUE") - fi - # Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined - for key in ca key cert; do - value="$(mysql_client_env_value "SSL_${key^^}_FILE")" - [[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}") - done - else - # Skip SSL validation - if [[ "$(mysql_client_flavor)" = "mariadb" ]]; then - # SSL connections are enabled by default in MariaDB >=10.11 - local mysql_version="" - local major_version="" - local minor_version="" - mysql_version="$(mysql_get_version)" - major_version="$(get_sematic_version "${mysql_version}" 1)" - minor_version="$(get_sematic_version "${mysql_version}" 2)" - if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then - opts+=("--skip-ssl") - fi - fi - fi - echo "${opts[@]:-}" -} diff --git a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh b/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh deleted file mode 100644 index 3fe87ab875092..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for mariadb - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-mariadb}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -mariadb_env_vars=( - ALLOW_EMPTY_PASSWORD - MARIADB_AUTHENTICATION_PLUGIN - MARIADB_ROOT_USER - MARIADB_ROOT_PASSWORD - MARIADB_USER - MARIADB_PASSWORD - MARIADB_DATABASE - MARIADB_MASTER_HOST - MARIADB_MASTER_PORT_NUMBER - MARIADB_MASTER_ROOT_USER - MARIADB_MASTER_ROOT_PASSWORD - MARIADB_MASTER_DELAY - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - MARIADB_PORT_NUMBER - MARIADB_REPLICATION_MODE - MARIADB_REPLICATION_SLAVE_DUMP - MARIADB_EXTRA_FLAGS - MARIADB_INIT_SLEEP_TIME - MARIADB_CHARACTER_SET - MARIADB_COLLATE - MARIADB_BIND_ADDRESS - MARIADB_SQL_MODE - MARIADB_UPGRADE - MARIADB_SKIP_TEST_DB - MARIADB_CLIENT_ENABLE_SSL - MARIADB_CLIENT_SSL_CA_FILE - MARIADB_CLIENT_SSL_CERT_FILE - MARIADB_CLIENT_SSL_KEY_FILE - MARIADB_CLIENT_EXTRA_FLAGS - MARIADB_STARTUP_WAIT_RETRIES - MARIADB_STARTUP_WAIT_SLEEP_TIME - MARIADB_ENABLE_SLOW_QUERY - MARIADB_LONG_QUERY_TIME - DB_ENABLE_SLOW_QUERY - DB_LONG_QUERY_TIME -) -for env_var in "${mariadb_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset mariadb_env_vars -export DB_FLAVOR="mariadb" - -# Paths -export DB_BASE_DIR="${BITNAMI_ROOT_DIR}/mariadb" -export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" -export DB_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_SBIN_DIR="${DB_BASE_DIR}/sbin" -export DB_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_LOGS_DIR="${DB_BASE_DIR}/logs" -export DB_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_CONF_FILE="${DB_CONF_DIR}/my.cnf" -export DB_PID_FILE="${DB_TMP_DIR}/mysqld.pid" -export DB_SOCKET_FILE="${DB_TMP_DIR}/mysql.sock" -export PATH="${DB_SBIN_DIR}:${DB_BIN_DIR}:/opt/bitnami/common/bin:${PATH}" - -# System users (when running with a privileged user) -export DB_DAEMON_USER="mysql" -export DB_DAEMON_GROUP="mysql" - -# Default configuration (build-time) -export MARIADB_DEFAULT_PORT_NUMBER="3306" -export DB_DEFAULT_PORT_NUMBER="$MARIADB_DEFAULT_PORT_NUMBER" # only used at build time -export MARIADB_DEFAULT_CHARACTER_SET="utf8mb4" -export DB_DEFAULT_CHARACTER_SET="$MARIADB_DEFAULT_CHARACTER_SET" # only used at build time -export MARIADB_DEFAULT_BIND_ADDRESS="0.0.0.0" -export DB_DEFAULT_BIND_ADDRESS="$MARIADB_DEFAULT_BIND_ADDRESS" # only used at build time - -# MariaDB authentication. -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export MARIADB_AUTHENTICATION_PLUGIN="${MARIADB_AUTHENTICATION_PLUGIN:-}" -export DB_AUTHENTICATION_PLUGIN="$MARIADB_AUTHENTICATION_PLUGIN" -export MARIADB_ROOT_USER="${MARIADB_ROOT_USER:-root}" -export DB_ROOT_USER="$MARIADB_ROOT_USER" # only used during the first initialization -export MARIADB_ROOT_PASSWORD="${MARIADB_ROOT_PASSWORD:-}" -export DB_ROOT_PASSWORD="$MARIADB_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_USER="${MARIADB_USER:-}" -export DB_USER="$MARIADB_USER" # only used during the first initialization -export MARIADB_PASSWORD="${MARIADB_PASSWORD:-}" -export DB_PASSWORD="$MARIADB_PASSWORD" # only used during the first initialization -export MARIADB_DATABASE="${MARIADB_DATABASE:-}" -export DB_DATABASE="$MARIADB_DATABASE" # only used during the first initialization -export MARIADB_MASTER_HOST="${MARIADB_MASTER_HOST:-}" -export DB_MASTER_HOST="$MARIADB_MASTER_HOST" # only used during the first initialization -export MARIADB_MASTER_PORT_NUMBER="${MARIADB_MASTER_PORT_NUMBER:-3306}" -export DB_MASTER_PORT_NUMBER="$MARIADB_MASTER_PORT_NUMBER" # only used during the first initialization -export MARIADB_MASTER_ROOT_USER="${MARIADB_MASTER_ROOT_USER:-root}" -export DB_MASTER_ROOT_USER="$MARIADB_MASTER_ROOT_USER" # only used during the first initialization -export MARIADB_MASTER_ROOT_PASSWORD="${MARIADB_MASTER_ROOT_PASSWORD:-}" -export DB_MASTER_ROOT_PASSWORD="$MARIADB_MASTER_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_MASTER_DELAY="${MARIADB_MASTER_DELAY:-0}" -export DB_MASTER_DELAY="$MARIADB_MASTER_DELAY" # only used during the first initialization -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Settings -export MARIADB_PORT_NUMBER="${MARIADB_PORT_NUMBER:-}" -export DB_PORT_NUMBER="$MARIADB_PORT_NUMBER" -export MARIADB_REPLICATION_MODE="${MARIADB_REPLICATION_MODE:-}" -export DB_REPLICATION_MODE="$MARIADB_REPLICATION_MODE" -export MARIADB_REPLICATION_SLAVE_DUMP="${MARIADB_REPLICATION_SLAVE_DUMP:-false}" -export DB_REPLICATION_SLAVE_DUMP="$MARIADB_REPLICATION_SLAVE_DUMP" -export MARIADB_EXTRA_FLAGS="${MARIADB_EXTRA_FLAGS:-}" -export DB_EXTRA_FLAGS="$MARIADB_EXTRA_FLAGS" -export MARIADB_INIT_SLEEP_TIME="${MARIADB_INIT_SLEEP_TIME:-}" -export DB_INIT_SLEEP_TIME="$MARIADB_INIT_SLEEP_TIME" -export MARIADB_CHARACTER_SET="${MARIADB_CHARACTER_SET:-}" -export DB_CHARACTER_SET="$MARIADB_CHARACTER_SET" -# MARIADB_COLLATION is deprecated in favor of MARIADB_COLLATE -MARIADB_COLLATE="${MARIADB_COLLATE:-"${MARIADB_COLLATION:-}"}" -export MARIADB_COLLATE="${MARIADB_COLLATE:-}" -export DB_COLLATE="$MARIADB_COLLATE" -export MARIADB_BIND_ADDRESS="${MARIADB_BIND_ADDRESS:-}" -export DB_BIND_ADDRESS="$MARIADB_BIND_ADDRESS" -export MARIADB_SQL_MODE="${MARIADB_SQL_MODE:-}" -export DB_SQL_MODE="$MARIADB_SQL_MODE" -export MARIADB_UPGRADE="${MARIADB_UPGRADE:-AUTO}" -export DB_UPGRADE="$MARIADB_UPGRADE" -export MARIADB_SKIP_TEST_DB="${MARIADB_SKIP_TEST_DB:-no}" -export DB_SKIP_TEST_DB="$MARIADB_SKIP_TEST_DB" -export MARIADB_CLIENT_ENABLE_SSL="${MARIADB_CLIENT_ENABLE_SSL:-no}" -export DB_CLIENT_ENABLE_SSL="$MARIADB_CLIENT_ENABLE_SSL" -export MARIADB_CLIENT_SSL_CA_FILE="${MARIADB_CLIENT_SSL_CA_FILE:-}" -export DB_CLIENT_SSL_CA_FILE="$MARIADB_CLIENT_SSL_CA_FILE" -export MARIADB_CLIENT_SSL_CERT_FILE="${MARIADB_CLIENT_SSL_CERT_FILE:-}" -export DB_CLIENT_SSL_CERT_FILE="$MARIADB_CLIENT_SSL_CERT_FILE" -export MARIADB_CLIENT_SSL_KEY_FILE="${MARIADB_CLIENT_SSL_KEY_FILE:-}" -export DB_CLIENT_SSL_KEY_FILE="$MARIADB_CLIENT_SSL_KEY_FILE" -export MARIADB_CLIENT_EXTRA_FLAGS="${MARIADB_CLIENT_EXTRA_FLAGS:-no}" -export DB_CLIENT_EXTRA_FLAGS="$MARIADB_CLIENT_EXTRA_FLAGS" -export MARIADB_STARTUP_WAIT_RETRIES="${MARIADB_STARTUP_WAIT_RETRIES:-300}" -export DB_STARTUP_WAIT_RETRIES="$MARIADB_STARTUP_WAIT_RETRIES" -export MARIADB_STARTUP_WAIT_SLEEP_TIME="${MARIADB_STARTUP_WAIT_SLEEP_TIME:-2}" -export DB_STARTUP_WAIT_SLEEP_TIME="$MARIADB_STARTUP_WAIT_SLEEP_TIME" -MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-"${DB_ENABLE_SLOW_QUERY:-}"}" -export MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-0}" -export DB_ENABLE_SLOW_QUERY="$MARIADB_ENABLE_SLOW_QUERY" -MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-"${DB_LONG_QUERY_TIME:-}"}" -export MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-10.0}" -export DB_LONG_QUERY_TIME="$MARIADB_LONG_QUERY_TIME" - -# Custom environment variables may be defined below diff --git a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh b/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh deleted file mode 100755 index 5daeb16c64943..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/mariadb/conf) -debug "Copying files from $DB_DEFAULT_CONF_DIR to $DB_CONF_DIR" -cp -nr "$DB_DEFAULT_CONF_DIR"/. "$DB_CONF_DIR" - -if [[ "$1" = "/opt/bitnami/scripts/mariadb/run.sh" ]]; then - info "** Starting MariaDB setup **" - /opt/bitnami/scripts/mariadb/setup.sh - info "** MariaDB setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh b/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh deleted file mode 100755 index 60211b1057f6e..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libmariadb.sh - -# Load MySQL environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -mysql_healthcheck diff --git a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh b/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh deleted file mode 100755 index ee8217ffb401c..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Configure MariaDB options based on build-time defaults -info "Configuring default MariaDB options" -ensure_dir_exists "$DB_CONF_DIR" -mysql_create_default_config - -for dir in "$DB_TMP_DIR" "$DB_LOGS_DIR" "$DB_CONF_DIR" "$DB_DEFAULT_CONF_DIR" "${DB_CONF_DIR}/bitnami" "$DB_VOLUME_DIR" "$DB_DATA_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# Fix to avoid issues detecting plugins in mysql_install_db -ln -sf "$DB_BASE_DIR/plugin" "$DB_BASE_DIR/lib/plugin" - -# Redirect all logging to stdout -ln -sf "/proc/1/fd/1" "$DB_LOGS_DIR/mysqld.log" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${DB_CONF_DIR}/"* "$DB_DEFAULT_CONF_DIR" diff --git a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh b/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh deleted file mode 100755 index 97f5d80c226f0..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# mysqld_safe does not allow logging to stdout/stderr, so we stick with mysqld -EXEC="${DB_SBIN_DIR}/mysqld" - -flags=("--defaults-file=${DB_CONF_DIR}/my.cnf" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") -[[ -z "${DB_PID_FILE:-}" ]] || flags+=("--pid-file=${DB_PID_FILE}") - -# Add flags specified via the 'DB_EXTRA_FLAGS' environment variable -read -r -a db_extra_flags <<< "$(mysql_extra_flags)" -[[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - -# Add flags passed to this script -flags+=("$@") - -# Fix for MDEV-16183 - mysqld_safe already does this, but we are using mysqld -LD_PRELOAD="$(find_jemalloc_lib)${LD_PRELOAD:+ "$LD_PRELOAD"}" -export LD_PRELOAD - -info "** Starting MariaDB **" -if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "$EXEC" "${flags[@]}" -else - exec "$EXEC" "${flags[@]}" -fi diff --git a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh b/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh deleted file mode 100755 index 9dcc55c047ade..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Ensure mysql unix socket file does not exist -rm -rf "${DB_SOCKET_FILE}.lock" -# Ensure MariaDB environment variables settings are valid -mysql_validate -# Ensure MariaDB is stopped when this script ends. -trap "mysql_stop" EXIT -if am_i_root; then - # Ensure 'daemon' user exists when running as 'root' - ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" - # Fix logging issue when running as root - chmod o+w "$(readlink /dev/stdout)" -fi -# Ensure MariaDB is initialized -mysql_initialize -# Allow running custom initialization scripts -mysql_custom_scripts 'init' -# Allow running custom start scripts -mysql_custom_scripts 'start' -# Stop MariaDB before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -mysql_stop diff --git a/bitnami/mariadb/10.6/debian-12/tags-info.yaml b/bitnami/mariadb/10.6/debian-12/tags-info.yaml deleted file mode 100644 index ace62bc460efb..0000000000000 --- a/bitnami/mariadb/10.6/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "10.6" -- 10.6-debian-12 -- 10.6.20 diff --git a/bitnami/mariadb/11.2/README.md b/bitnami/mariadb/11.2/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/mariadb/11.2/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/mariadb/11.2/debian-12/Dockerfile b/bitnami/mariadb/11.2/debian-12/Dockerfile deleted file mode 100644 index 06c7d57d70579..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T22:23:58Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mariadb/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="11.2.6-debian-12-r2" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mariadb" \ - org.opencontainers.image.title="mariadb" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="11.2.6" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libaio1 libaudit1 libcap-ng0 libcrypt1 libgcc-s1 libicu72 liblzma5 libncurses6 libpam0g libssl3 libstdc++6 libtinfo6 libxml2 procps psmisc zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "ini-file-1.4.7-8-linux-${OS_ARCH}-debian-12" \ - "mariadb-11.2.6-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir /docker-entrypoint-initdb.d - -COPY rootfs / -RUN /opt/bitnami/scripts/mariadb/postunpack.sh -ENV APP_VERSION="11.2.6" \ - BITNAMI_APP_NAME="mariadb" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/common/sbin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:$PATH" - -EXPOSE 3306 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/mariadb/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/mariadb/run.sh" ] diff --git a/bitnami/mariadb/11.2/debian-12/docker-compose-replication.yml b/bitnami/mariadb/11.2/debian-12/docker-compose-replication.yml deleted file mode 100644 index 1dfeff4810f1d..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/docker-compose-replication.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-master: - image: docker.io/bitnami/mariadb:11.2 - ports: - - '3306' - volumes: - - 'mariadb_master_data:/bitnami/mariadb' - environment: - - MARIADB_REPLICATION_MODE=master - - MARIADB_REPLICATION_USER=repl_user - - MARIADB_USER=my_user - - MARIADB_DATABASE=my_database - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_ROOT_PASSWORD=my_root_password - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - - mariadb-slave: - image: docker.io/bitnami/mariadb:11.2 - ports: - - '3306' - depends_on: - - mariadb-master - environment: - - MARIADB_REPLICATION_MODE=slave - - MARIADB_REPLICATION_USER=repl_user - - MARIADB_USER=my_user - - MARIADB_DATABASE=my_database - - MARIADB_MASTER_HOST=mariadb-master - - MARIADB_MASTER_PORT_NUMBER=3306 - - MARIADB_MASTER_ROOT_PASSWORD=my_root_password - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_master_data: - driver: local diff --git a/bitnami/mariadb/11.2/debian-12/docker-compose.yml b/bitnami/mariadb/11.2/debian-12/docker-compose.yml deleted file mode 100644 index 6292915830c44..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb: - image: docker.io/bitnami/mariadb:11.2 - ports: - - '3306:3306' - volumes: - - 'mariadb_data:/bitnami/mariadb' - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_data: - driver: local diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 34f27c9838257..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ini-file": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.4.7-8" - }, - "mariadb": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "11.2.6-0" - } -} \ No newline at end of file diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/mariadb/11.2/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/mariadb/11.2/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/mariadb/11.2/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh b/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh deleted file mode 100644 index 9d6bd864f4513..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh +++ /dev/null @@ -1,1417 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami MySQL library - -# shellcheck disable=SC1090,SC1091,SC2119,SC2120 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh - -######################## -# Configure database extra start flags -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Array with extra flags to use -######################### -mysql_extra_flags() { - local randNumber - local -a dbExtraFlags=() - # shellcheck disable=SC2153 - read -r -a userExtraFlags <<< "$DB_EXTRA_FLAGS" - - if [[ -n "$DB_REPLICATION_MODE" ]]; then - randNumber="$(head /dev/urandom | tr -dc 0-9 | head -c 3 ; echo '')" - dbExtraFlags+=("--server-id=$randNumber" "--binlog-format=ROW" "--log-bin=mysql-bin" "--sync-binlog=1") - if [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - dbExtraFlags+=("--relay-log=mysql-relay-bin" "--log-slave-updates=1" "--read-only=1") - elif [[ "$DB_REPLICATION_MODE" = "master" ]]; then - dbExtraFlags+=("--innodb_flush_log_at_trx_commit=1") - fi - fi - - [[ "${#userExtraFlags[@]}" -eq 0 ]] || dbExtraFlags+=("${userExtraFlags[@]}") - - echo "${dbExtraFlags[@]:-}" -} - -######################## -# Validate settings in MYSQL_*/MARIADB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_validate() { - info "Validating settings in MYSQL_*/MARIADB_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - backslash_password_error() { - print_validation_error "The password cannot contain backslashes ('\'). Set the environment variable $1 with no backslashes (more info at https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html)" - } - - if [[ -n "$DB_REPLICATION_MODE" ]]; then - if [[ "$DB_REPLICATION_MODE" = "master" ]]; then - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -n "$DB_REPLICATION_USER" ]] && [[ -z "$DB_REPLICATION_PASSWORD" ]]; then - empty_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if (( ${#DB_ROOT_PASSWORD} > 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - elif [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - if [[ -z "$DB_MASTER_HOST" ]]; then - print_validation_error "Slave replication mode chosen without setting the environment variable $(get_env_var MASTER_HOST). Use it to indicate where the Master node is running" - fi - else - print_validation_error "Invalid replication mode. Available options are 'master/slave'" - fi - else - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ "$DB_USER" = "root" ]]; then - print_validation_error "root user is already created in the database and you can't use it as username for user creation." - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - if [[ "${DB_REPLICATION_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "$dump_file" - debug "Finish dump databases" - - debug "Unlock master databases for write operations" - echo "UNLOCK TABLES;" | mysql_remote_execute "$DB_MASTER_HOST" "$DB_MASTER_PORT_NUMBER" "mysql" "$DB_MASTER_ROOT_USER" "$DB_MASTER_ROOT_PASSWORD" - - debug "Start import dump databases" - mysql_execute < "$dump_file" - mysql_execute "mysql" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - if ! grep --silent "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" "${DB_CONF_FILE}"; then - echo "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" >> "${DB_CONF_FILE}" - fi - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Using persisted data" - # mysql_upgrade requires the server to be running - [[ -n "$(get_master_env_var_value ROOT_PASSWORD)" ]] && export ROOT_AUTH_ENABLED="yes" - # https://dev.mysql.com/doc/refman/8.0/en/replication-upgrade.html - mariadb_upgrade - else - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - info "Installing database" - mariadb_install_db - mysql_start_bg - wait_for_mysql_access - # we delete existing users and create new ones with stricter access - # commands can still be executed until we restart or run 'flush privileges' - info "Configuring authentication" - mysql_execute "mysql" <=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Initialize database data -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_install_db() { - local command="${DB_BIN_DIR}/mysql_install_db" - local -a args=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && args+=("${db_extra_flags[@]}") - - am_i_root && args=("${args[@]}" "--user=$DB_DAEMON_USER") - args+=("--auth-root-authentication-method=normal") - # Feature available only in MariaDB 10.5+ - # ref: https://mariadb.com/kb/en/mysql_install_db/#not-creating-the-test-database-and-anonymous-user - if [[ ! "$(mysql_get_version)" =~ ^10\.[01234]\. ]]; then - is_boolean_yes "$DB_SKIP_TEST_DB" && args+=("--skip-test-db") - fi - - debug_execute "$command" "${args[@]}" -} - -######################## -# Upgrade Database Schema -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_upgrade() { - local -a args=("--defaults-file=${DB_CONF_FILE}" "-u" "$DB_ROOT_USER") - info "Running mysql_upgrade" - mysql_start_bg - is_boolean_yes "${ROOT_AUTH_ENABLED:-false}" && args+=("-p$(get_master_env_var_value ROOT_PASSWORD)") - [[ "${DB_UPGRADE}" == "FORCE" ]] && args+=("--force") - debug_execute "${DB_BIN_DIR}/mysql_upgrade" "${args[@]}" || echo "This installation is already upgraded" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for mysql common - -######################## -# Extract mysql version from version string -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Version string -######################### -mysql_get_version() { - local ver_string - local -a ver_split - - ver_string=$("${DB_BIN_DIR}/mysql" "--version") - read -r -a ver_split <<< "$ver_string" - - if [[ "$ver_string" = *" Distrib "* ]]; then - echo "${ver_split[4]::-1}" - else - echo "${ver_split[2]}" - fi -} - -######################## -# Gets an environment variable name based on the suffix -# Globals: -# DB_FLAVOR -# Arguments: -# $1 - environment variable suffix -# Returns: -# environment variable name -######################### -get_env_var() { - local -r id="${1:?id is required}" - local -r prefix="${DB_FLAVOR//-/_}" - echo "${prefix^^}_${id}" -} - -######################## -# Gets an environment variable value for the master node and based on the suffix -# Arguments: -# $1 - environment variable suffix -# Returns: -# environment variable value -######################### -get_master_env_var_value() { - local envVar - - PREFIX="" - [[ "${DB_REPLICATION_MODE:-}" = "slave" ]] && PREFIX="MASTER_" - envVar="$(get_env_var "${PREFIX}${1}_FILE")" - if [[ -f "${!envVar:-}" ]]; then - echo "$(< "${!envVar}")" - else - envVar="$(get_env_var "${PREFIX}${1}")" - echo "${!envVar:-}" - fi -} - -######################## -# Execute an arbitrary query/queries against the running MySQL/MariaDB service and print to stdout -# Stdin: -# Query/queries to execute -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - Database where to run the queries -# $2 - User to run queries -# $3 - Password -# $4 - Extra MySQL CLI options -# Returns: -# None -mysql_execute_print_output() { - local -r db="${1:-}" - local -r user="${2:-root}" - local -r pass="${3:-}" - local -a opts extra_opts - read -r -a opts <<< "${@:4}" - read -r -a extra_opts <<< "$(mysql_client_extra_opts)" - - # Process mysql CLI arguments - local -a args=() - if [[ -f "$DB_CONF_FILE" ]]; then - args+=("--defaults-file=${DB_CONF_FILE}") - fi - args+=("-N" "-u" "$user") - [[ -n "$db" ]] && args+=("$db") - [[ -n "$pass" ]] && args+=("-p$pass") - [[ "${#opts[@]}" -gt 0 ]] && args+=("${opts[@]}") - [[ "${#extra_opts[@]}" -gt 0 ]] && args+=("${extra_opts[@]}") - - # Obtain the command specified via stdin - if [[ "${BITNAMI_DEBUG:-false}" = true ]]; then - local mysql_cmd - mysql_cmd="$(> "$custom_conf_file" - cat "$old_custom_conf_file" >> "$custom_conf_file" - fi - if am_i_root; then - [[ -e "$DB_VOLUME_DIR/.initialized" ]] && rm "$DB_VOLUME_DIR/.initialized" - rm -rf "$DB_VOLUME_DIR/conf" - else - warn "Old custom configuration migrated, please manually remove the 'conf' directory from the volume use to persist data" - fi -} - -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - local mysql_create_user_cmd - [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.4, the mysql.user table was replaced with a view: https://mariadb.com/kb/en/mysqluser-table/ - # Views have a definer user, in this case set to 'root', which needs to exist for the view to work - # In MySQL, to avoid issues when renaming the root user, they use the 'mysql.sys' user as a definer: https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html - # However, for MariaDB that is not the case, so when the 'root' user is renamed the 'mysql.user' table stops working and the view needs to be fixed - if [[ "$user" != "root" && ! "$(mysql_get_version)" =~ ^10.[0123]. ]]; then - alter_view_str="$(mysql_execute_print_output "mysql" "$user" "$password" "-s" <&2 - return 1 - ;; - esac - shift - done - - local -a mysql_execute_cmd=("mysql_execute") - [[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - - local -a create_database_args=() - [[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'") - [[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'") - - debug "Creating database $database" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$user") - [[ -n "$db_host" ]] && flags+=("--host" "${db_host}") - [[ -n "$db_port" ]] && flags+=("--port" "${db_port}") - if is_boolean_yes "$use_ldap"; then - flags+=("--use-ldap") - elif [[ -n "$password" ]]; then - flags+=("-p" "$password") - [[ -n "$auth_plugin" ]] && flags=("${flags[@]}" "--auth-plugin" "$auth_plugin") - fi - mysql_ensure_user_exists "${flags[@]}" -} - -######################## -# Optionally create the given database, and then optionally give a user -# full privileges on the database. -# Flags: -# -u|--user - database user -# --character-set - character set -# --collation - collation -# --host - database host -# --port - database port -# Arguments: -# $1 - database name -# Returns: -# None -######################### -mysql_ensure_optional_database_exists() { - local -r database="${1:?database is missing}" - local character_set="" - local collate="" - local user="" - local privileges="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - --character-set) - shift - character_set="${1:?missing character set}" - ;; - --collate) - shift - collate="${1:?missing collate}" - ;; - -u|--user) - shift - user="${1:?missing database user}" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - --privileges) - shift - privileges="${1:?missing privileges}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$database") - [[ -n "$character_set" ]] && flags+=("--character-set" "$character_set") - [[ -n "$collate" ]] && flags+=("--collate" "$collate") - [[ -n "$db_host" ]] && flags+=("--host" "$db_host") - [[ -n "$db_port" ]] && flags+=("--port" "$db_port") - mysql_ensure_database_exists "${flags[@]}" - - if [[ -n "$user" ]]; then - mysql_ensure_user_has_database_privileges "$user" "$database" "$privileges" "$db_host" "$db_port" - fi -} - -######################## -# Add or modify an entry in the MySQL configuration file ("$DB_CONF_FILE") -# Globals: -# DB_* -# Arguments: -# $1 - MySQL variable name -# $2 - Value to assign to the MySQL variable -# $3 - Section in the MySQL configuration file the key is located (default: mysqld) -# $4 - Configuration file (default: "$BD_CONF_FILE") -# Returns: -# None -######################### -mysql_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - read -r -a sections <<<"${3:-mysqld}" - local -r ignore_inline_comments="${4:-no}" - local -r file="${5:-"$DB_CONF_FILE"}" - info "Setting ${key} option" - debug "Setting ${key} to '${value}' in ${DB_FLAVOR} configuration file ${file}" - # Check if the configuration exists in the file - for section in "${sections[@]}"; do - if is_boolean_yes "$ignore_inline_comments"; then - ini-file set --ignore-inline-comments --section "$section" --key "$key" --value "$value" "$file" - else - ini-file set --section "$section" --key "$key" --value "$value" "$file" - fi - done -} - -######################## -# Update MySQL/MariaDB configuration file with user custom inputs -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_update_custom_config() { - # Persisted configuration files from old versions - ! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration - - # User injected custom configuration - if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then - debug "Injecting custom configuration from my_custom.conf" - cat "$DB_CONF_DIR/my_custom.cnf" > "$DB_CONF_DIR/bitnami/my_custom.cnf" - fi - - ! is_empty_value "$DB_USER" && mysql_conf_set "user" "$DB_USER" "mysqladmin" - ! is_empty_value "$DB_PORT_NUMBER" && mysql_conf_set "port" "$DB_PORT_NUMBER" "mysqld client manager" - ! is_empty_value "$DB_CHARACTER_SET" && mysql_conf_set "character_set_server" "$DB_CHARACTER_SET" - ! is_empty_value "$DB_COLLATE" && mysql_conf_set "collation_server" "$DB_COLLATE" - ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" - ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" - ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" - ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" - ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=( "/usr/lib" "/usr/lib64" ) - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} - -######################## -# Execute a reliable health check against the current mysql instance -# Globals: -# DB_ROOT_USER, DB_ROOT_PASSWORD, DB_MASTER_ROOT_PASSWORD -# Arguments: -# None -# Returns: -# mysqladmin output -######################### -mysql_healthcheck() { - local args=("-u${DB_ROOT_USER}" "-h0.0.0.0") - local root_password - - root_password="$(get_master_env_var_value ROOT_PASSWORD)" - if [[ -n "$root_password" ]]; then - args+=("-p${root_password}") - fi - - mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status -} - -######################## -# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# mysql client flavor -######################### -mysql_client_flavor() { - if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then - echo "mariadb" - else - echo "mysql" - fi -} - -######################## -# Prints extra options for MySQL client calls (i.e. SSL options) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# List of options to pass to "mysql" CLI -######################### -mysql_client_extra_opts() { - # Helper to get the proper value for the MySQL client environment variable - mysql_client_env_value() { - local env_name="MYSQL_CLIENT_${1:?missing name}" - if [[ -n "${!env_name:-}" ]]; then - echo "${!env_name:-}" - else - env_name="DB_CLIENT_${1}" - echo "${!env_name:-}" - fi - } - local -a opts=() - local key value - if is_boolean_yes "${DB_ENABLE_SSL:-no}"; then - if [[ "$(mysql_client_flavor)" = "mysql" ]]; then - opts+=("--ssl-mode=REQUIRED") - else - opts+=("--ssl=TRUE") - fi - # Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined - for key in ca key cert; do - value="$(mysql_client_env_value "SSL_${key^^}_FILE")" - [[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}") - done - else - # Skip SSL validation - if [[ "$(mysql_client_flavor)" = "mariadb" ]]; then - # SSL connections are enabled by default in MariaDB >=10.11 - local mysql_version="" - local major_version="" - local minor_version="" - mysql_version="$(mysql_get_version)" - major_version="$(get_sematic_version "${mysql_version}" 1)" - minor_version="$(get_sematic_version "${mysql_version}" 2)" - if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then - opts+=("--skip-ssl") - fi - fi - fi - echo "${opts[@]:-}" -} diff --git a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh b/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh deleted file mode 100644 index 3fe87ab875092..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for mariadb - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-mariadb}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -mariadb_env_vars=( - ALLOW_EMPTY_PASSWORD - MARIADB_AUTHENTICATION_PLUGIN - MARIADB_ROOT_USER - MARIADB_ROOT_PASSWORD - MARIADB_USER - MARIADB_PASSWORD - MARIADB_DATABASE - MARIADB_MASTER_HOST - MARIADB_MASTER_PORT_NUMBER - MARIADB_MASTER_ROOT_USER - MARIADB_MASTER_ROOT_PASSWORD - MARIADB_MASTER_DELAY - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - MARIADB_PORT_NUMBER - MARIADB_REPLICATION_MODE - MARIADB_REPLICATION_SLAVE_DUMP - MARIADB_EXTRA_FLAGS - MARIADB_INIT_SLEEP_TIME - MARIADB_CHARACTER_SET - MARIADB_COLLATE - MARIADB_BIND_ADDRESS - MARIADB_SQL_MODE - MARIADB_UPGRADE - MARIADB_SKIP_TEST_DB - MARIADB_CLIENT_ENABLE_SSL - MARIADB_CLIENT_SSL_CA_FILE - MARIADB_CLIENT_SSL_CERT_FILE - MARIADB_CLIENT_SSL_KEY_FILE - MARIADB_CLIENT_EXTRA_FLAGS - MARIADB_STARTUP_WAIT_RETRIES - MARIADB_STARTUP_WAIT_SLEEP_TIME - MARIADB_ENABLE_SLOW_QUERY - MARIADB_LONG_QUERY_TIME - DB_ENABLE_SLOW_QUERY - DB_LONG_QUERY_TIME -) -for env_var in "${mariadb_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset mariadb_env_vars -export DB_FLAVOR="mariadb" - -# Paths -export DB_BASE_DIR="${BITNAMI_ROOT_DIR}/mariadb" -export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" -export DB_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_SBIN_DIR="${DB_BASE_DIR}/sbin" -export DB_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_LOGS_DIR="${DB_BASE_DIR}/logs" -export DB_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_CONF_FILE="${DB_CONF_DIR}/my.cnf" -export DB_PID_FILE="${DB_TMP_DIR}/mysqld.pid" -export DB_SOCKET_FILE="${DB_TMP_DIR}/mysql.sock" -export PATH="${DB_SBIN_DIR}:${DB_BIN_DIR}:/opt/bitnami/common/bin:${PATH}" - -# System users (when running with a privileged user) -export DB_DAEMON_USER="mysql" -export DB_DAEMON_GROUP="mysql" - -# Default configuration (build-time) -export MARIADB_DEFAULT_PORT_NUMBER="3306" -export DB_DEFAULT_PORT_NUMBER="$MARIADB_DEFAULT_PORT_NUMBER" # only used at build time -export MARIADB_DEFAULT_CHARACTER_SET="utf8mb4" -export DB_DEFAULT_CHARACTER_SET="$MARIADB_DEFAULT_CHARACTER_SET" # only used at build time -export MARIADB_DEFAULT_BIND_ADDRESS="0.0.0.0" -export DB_DEFAULT_BIND_ADDRESS="$MARIADB_DEFAULT_BIND_ADDRESS" # only used at build time - -# MariaDB authentication. -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export MARIADB_AUTHENTICATION_PLUGIN="${MARIADB_AUTHENTICATION_PLUGIN:-}" -export DB_AUTHENTICATION_PLUGIN="$MARIADB_AUTHENTICATION_PLUGIN" -export MARIADB_ROOT_USER="${MARIADB_ROOT_USER:-root}" -export DB_ROOT_USER="$MARIADB_ROOT_USER" # only used during the first initialization -export MARIADB_ROOT_PASSWORD="${MARIADB_ROOT_PASSWORD:-}" -export DB_ROOT_PASSWORD="$MARIADB_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_USER="${MARIADB_USER:-}" -export DB_USER="$MARIADB_USER" # only used during the first initialization -export MARIADB_PASSWORD="${MARIADB_PASSWORD:-}" -export DB_PASSWORD="$MARIADB_PASSWORD" # only used during the first initialization -export MARIADB_DATABASE="${MARIADB_DATABASE:-}" -export DB_DATABASE="$MARIADB_DATABASE" # only used during the first initialization -export MARIADB_MASTER_HOST="${MARIADB_MASTER_HOST:-}" -export DB_MASTER_HOST="$MARIADB_MASTER_HOST" # only used during the first initialization -export MARIADB_MASTER_PORT_NUMBER="${MARIADB_MASTER_PORT_NUMBER:-3306}" -export DB_MASTER_PORT_NUMBER="$MARIADB_MASTER_PORT_NUMBER" # only used during the first initialization -export MARIADB_MASTER_ROOT_USER="${MARIADB_MASTER_ROOT_USER:-root}" -export DB_MASTER_ROOT_USER="$MARIADB_MASTER_ROOT_USER" # only used during the first initialization -export MARIADB_MASTER_ROOT_PASSWORD="${MARIADB_MASTER_ROOT_PASSWORD:-}" -export DB_MASTER_ROOT_PASSWORD="$MARIADB_MASTER_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_MASTER_DELAY="${MARIADB_MASTER_DELAY:-0}" -export DB_MASTER_DELAY="$MARIADB_MASTER_DELAY" # only used during the first initialization -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Settings -export MARIADB_PORT_NUMBER="${MARIADB_PORT_NUMBER:-}" -export DB_PORT_NUMBER="$MARIADB_PORT_NUMBER" -export MARIADB_REPLICATION_MODE="${MARIADB_REPLICATION_MODE:-}" -export DB_REPLICATION_MODE="$MARIADB_REPLICATION_MODE" -export MARIADB_REPLICATION_SLAVE_DUMP="${MARIADB_REPLICATION_SLAVE_DUMP:-false}" -export DB_REPLICATION_SLAVE_DUMP="$MARIADB_REPLICATION_SLAVE_DUMP" -export MARIADB_EXTRA_FLAGS="${MARIADB_EXTRA_FLAGS:-}" -export DB_EXTRA_FLAGS="$MARIADB_EXTRA_FLAGS" -export MARIADB_INIT_SLEEP_TIME="${MARIADB_INIT_SLEEP_TIME:-}" -export DB_INIT_SLEEP_TIME="$MARIADB_INIT_SLEEP_TIME" -export MARIADB_CHARACTER_SET="${MARIADB_CHARACTER_SET:-}" -export DB_CHARACTER_SET="$MARIADB_CHARACTER_SET" -# MARIADB_COLLATION is deprecated in favor of MARIADB_COLLATE -MARIADB_COLLATE="${MARIADB_COLLATE:-"${MARIADB_COLLATION:-}"}" -export MARIADB_COLLATE="${MARIADB_COLLATE:-}" -export DB_COLLATE="$MARIADB_COLLATE" -export MARIADB_BIND_ADDRESS="${MARIADB_BIND_ADDRESS:-}" -export DB_BIND_ADDRESS="$MARIADB_BIND_ADDRESS" -export MARIADB_SQL_MODE="${MARIADB_SQL_MODE:-}" -export DB_SQL_MODE="$MARIADB_SQL_MODE" -export MARIADB_UPGRADE="${MARIADB_UPGRADE:-AUTO}" -export DB_UPGRADE="$MARIADB_UPGRADE" -export MARIADB_SKIP_TEST_DB="${MARIADB_SKIP_TEST_DB:-no}" -export DB_SKIP_TEST_DB="$MARIADB_SKIP_TEST_DB" -export MARIADB_CLIENT_ENABLE_SSL="${MARIADB_CLIENT_ENABLE_SSL:-no}" -export DB_CLIENT_ENABLE_SSL="$MARIADB_CLIENT_ENABLE_SSL" -export MARIADB_CLIENT_SSL_CA_FILE="${MARIADB_CLIENT_SSL_CA_FILE:-}" -export DB_CLIENT_SSL_CA_FILE="$MARIADB_CLIENT_SSL_CA_FILE" -export MARIADB_CLIENT_SSL_CERT_FILE="${MARIADB_CLIENT_SSL_CERT_FILE:-}" -export DB_CLIENT_SSL_CERT_FILE="$MARIADB_CLIENT_SSL_CERT_FILE" -export MARIADB_CLIENT_SSL_KEY_FILE="${MARIADB_CLIENT_SSL_KEY_FILE:-}" -export DB_CLIENT_SSL_KEY_FILE="$MARIADB_CLIENT_SSL_KEY_FILE" -export MARIADB_CLIENT_EXTRA_FLAGS="${MARIADB_CLIENT_EXTRA_FLAGS:-no}" -export DB_CLIENT_EXTRA_FLAGS="$MARIADB_CLIENT_EXTRA_FLAGS" -export MARIADB_STARTUP_WAIT_RETRIES="${MARIADB_STARTUP_WAIT_RETRIES:-300}" -export DB_STARTUP_WAIT_RETRIES="$MARIADB_STARTUP_WAIT_RETRIES" -export MARIADB_STARTUP_WAIT_SLEEP_TIME="${MARIADB_STARTUP_WAIT_SLEEP_TIME:-2}" -export DB_STARTUP_WAIT_SLEEP_TIME="$MARIADB_STARTUP_WAIT_SLEEP_TIME" -MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-"${DB_ENABLE_SLOW_QUERY:-}"}" -export MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-0}" -export DB_ENABLE_SLOW_QUERY="$MARIADB_ENABLE_SLOW_QUERY" -MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-"${DB_LONG_QUERY_TIME:-}"}" -export MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-10.0}" -export DB_LONG_QUERY_TIME="$MARIADB_LONG_QUERY_TIME" - -# Custom environment variables may be defined below diff --git a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh b/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh deleted file mode 100755 index 5daeb16c64943..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/mariadb/conf) -debug "Copying files from $DB_DEFAULT_CONF_DIR to $DB_CONF_DIR" -cp -nr "$DB_DEFAULT_CONF_DIR"/. "$DB_CONF_DIR" - -if [[ "$1" = "/opt/bitnami/scripts/mariadb/run.sh" ]]; then - info "** Starting MariaDB setup **" - /opt/bitnami/scripts/mariadb/setup.sh - info "** MariaDB setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh b/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh deleted file mode 100755 index 60211b1057f6e..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libmariadb.sh - -# Load MySQL environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -mysql_healthcheck diff --git a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh b/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh deleted file mode 100755 index ee8217ffb401c..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Configure MariaDB options based on build-time defaults -info "Configuring default MariaDB options" -ensure_dir_exists "$DB_CONF_DIR" -mysql_create_default_config - -for dir in "$DB_TMP_DIR" "$DB_LOGS_DIR" "$DB_CONF_DIR" "$DB_DEFAULT_CONF_DIR" "${DB_CONF_DIR}/bitnami" "$DB_VOLUME_DIR" "$DB_DATA_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# Fix to avoid issues detecting plugins in mysql_install_db -ln -sf "$DB_BASE_DIR/plugin" "$DB_BASE_DIR/lib/plugin" - -# Redirect all logging to stdout -ln -sf "/proc/1/fd/1" "$DB_LOGS_DIR/mysqld.log" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${DB_CONF_DIR}/"* "$DB_DEFAULT_CONF_DIR" diff --git a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh b/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh deleted file mode 100755 index 97f5d80c226f0..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# mysqld_safe does not allow logging to stdout/stderr, so we stick with mysqld -EXEC="${DB_SBIN_DIR}/mysqld" - -flags=("--defaults-file=${DB_CONF_DIR}/my.cnf" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") -[[ -z "${DB_PID_FILE:-}" ]] || flags+=("--pid-file=${DB_PID_FILE}") - -# Add flags specified via the 'DB_EXTRA_FLAGS' environment variable -read -r -a db_extra_flags <<< "$(mysql_extra_flags)" -[[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - -# Add flags passed to this script -flags+=("$@") - -# Fix for MDEV-16183 - mysqld_safe already does this, but we are using mysqld -LD_PRELOAD="$(find_jemalloc_lib)${LD_PRELOAD:+ "$LD_PRELOAD"}" -export LD_PRELOAD - -info "** Starting MariaDB **" -if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "$EXEC" "${flags[@]}" -else - exec "$EXEC" "${flags[@]}" -fi diff --git a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh b/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh deleted file mode 100755 index 9dcc55c047ade..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Ensure mysql unix socket file does not exist -rm -rf "${DB_SOCKET_FILE}.lock" -# Ensure MariaDB environment variables settings are valid -mysql_validate -# Ensure MariaDB is stopped when this script ends. -trap "mysql_stop" EXIT -if am_i_root; then - # Ensure 'daemon' user exists when running as 'root' - ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" - # Fix logging issue when running as root - chmod o+w "$(readlink /dev/stdout)" -fi -# Ensure MariaDB is initialized -mysql_initialize -# Allow running custom initialization scripts -mysql_custom_scripts 'init' -# Allow running custom start scripts -mysql_custom_scripts 'start' -# Stop MariaDB before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -mysql_stop diff --git a/bitnami/mariadb/11.2/debian-12/tags-info.yaml b/bitnami/mariadb/11.2/debian-12/tags-info.yaml deleted file mode 100644 index 63f6327230512..0000000000000 --- a/bitnami/mariadb/11.2/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "11.2" -- 11.2-debian-12 -- 11.2.6 diff --git a/bitnami/mariadb/11.5/README.md b/bitnami/mariadb/11.5/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/mariadb/11.5/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/mariadb/11.5/debian-12/Dockerfile b/bitnami/mariadb/11.5/debian-12/Dockerfile deleted file mode 100644 index 07af4e61fe545..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T22:29:20Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mariadb/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="11.5.2-debian-12-r7" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mariadb" \ - org.opencontainers.image.title="mariadb" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="11.5.2" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libaio1 libaudit1 libcap-ng0 libcrypt1 libgcc-s1 libicu72 liblzma5 libncurses6 libpam0g libssl3 libstdc++6 libtinfo6 libxml2 procps psmisc zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "ini-file-1.4.7-8-linux-${OS_ARCH}-debian-12" \ - "mariadb-11.5.2-2-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir /docker-entrypoint-initdb.d - -COPY rootfs / -RUN /opt/bitnami/scripts/mariadb/postunpack.sh -ENV APP_VERSION="11.5.2" \ - BITNAMI_APP_NAME="mariadb" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/common/sbin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:$PATH" - -EXPOSE 3306 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/mariadb/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/mariadb/run.sh" ] diff --git a/bitnami/mariadb/11.5/debian-12/docker-compose-replication.yml b/bitnami/mariadb/11.5/debian-12/docker-compose-replication.yml deleted file mode 100644 index bf432d5fad934..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/docker-compose-replication.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-master: - image: docker.io/bitnami/mariadb:11.5 - ports: - - '3306' - volumes: - - 'mariadb_master_data:/bitnami/mariadb' - environment: - - MARIADB_REPLICATION_MODE=master - - MARIADB_REPLICATION_USER=repl_user - - MARIADB_USER=my_user - - MARIADB_DATABASE=my_database - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_ROOT_PASSWORD=my_root_password - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - - mariadb-slave: - image: docker.io/bitnami/mariadb:11.5 - ports: - - '3306' - depends_on: - - mariadb-master - environment: - - MARIADB_REPLICATION_MODE=slave - - MARIADB_REPLICATION_USER=repl_user - - MARIADB_USER=my_user - - MARIADB_DATABASE=my_database - - MARIADB_MASTER_HOST=mariadb-master - - MARIADB_MASTER_PORT_NUMBER=3306 - - MARIADB_MASTER_ROOT_PASSWORD=my_root_password - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_master_data: - driver: local diff --git a/bitnami/mariadb/11.5/debian-12/docker-compose.yml b/bitnami/mariadb/11.5/debian-12/docker-compose.yml deleted file mode 100644 index be39533de2499..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb: - image: docker.io/bitnami/mariadb:11.5 - ports: - - '3306:3306' - volumes: - - 'mariadb_data:/bitnami/mariadb' - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_data: - driver: local diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index 86d772b71678c..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ini-file": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.4.7-8" - }, - "mariadb": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "11.5.2-2" - } -} \ No newline at end of file diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/mariadb/11.5/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/mariadb/11.5/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/mariadb/11.5/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh b/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh deleted file mode 100644 index 9d6bd864f4513..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh +++ /dev/null @@ -1,1417 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami MySQL library - -# shellcheck disable=SC1090,SC1091,SC2119,SC2120 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh - -######################## -# Configure database extra start flags -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Array with extra flags to use -######################### -mysql_extra_flags() { - local randNumber - local -a dbExtraFlags=() - # shellcheck disable=SC2153 - read -r -a userExtraFlags <<< "$DB_EXTRA_FLAGS" - - if [[ -n "$DB_REPLICATION_MODE" ]]; then - randNumber="$(head /dev/urandom | tr -dc 0-9 | head -c 3 ; echo '')" - dbExtraFlags+=("--server-id=$randNumber" "--binlog-format=ROW" "--log-bin=mysql-bin" "--sync-binlog=1") - if [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - dbExtraFlags+=("--relay-log=mysql-relay-bin" "--log-slave-updates=1" "--read-only=1") - elif [[ "$DB_REPLICATION_MODE" = "master" ]]; then - dbExtraFlags+=("--innodb_flush_log_at_trx_commit=1") - fi - fi - - [[ "${#userExtraFlags[@]}" -eq 0 ]] || dbExtraFlags+=("${userExtraFlags[@]}") - - echo "${dbExtraFlags[@]:-}" -} - -######################## -# Validate settings in MYSQL_*/MARIADB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_validate() { - info "Validating settings in MYSQL_*/MARIADB_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - backslash_password_error() { - print_validation_error "The password cannot contain backslashes ('\'). Set the environment variable $1 with no backslashes (more info at https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html)" - } - - if [[ -n "$DB_REPLICATION_MODE" ]]; then - if [[ "$DB_REPLICATION_MODE" = "master" ]]; then - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -n "$DB_REPLICATION_USER" ]] && [[ -z "$DB_REPLICATION_PASSWORD" ]]; then - empty_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if (( ${#DB_ROOT_PASSWORD} > 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - elif [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - if [[ -z "$DB_MASTER_HOST" ]]; then - print_validation_error "Slave replication mode chosen without setting the environment variable $(get_env_var MASTER_HOST). Use it to indicate where the Master node is running" - fi - else - print_validation_error "Invalid replication mode. Available options are 'master/slave'" - fi - else - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ "$DB_USER" = "root" ]]; then - print_validation_error "root user is already created in the database and you can't use it as username for user creation." - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - if [[ "${DB_REPLICATION_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "$dump_file" - debug "Finish dump databases" - - debug "Unlock master databases for write operations" - echo "UNLOCK TABLES;" | mysql_remote_execute "$DB_MASTER_HOST" "$DB_MASTER_PORT_NUMBER" "mysql" "$DB_MASTER_ROOT_USER" "$DB_MASTER_ROOT_PASSWORD" - - debug "Start import dump databases" - mysql_execute < "$dump_file" - mysql_execute "mysql" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - if ! grep --silent "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" "${DB_CONF_FILE}"; then - echo "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" >> "${DB_CONF_FILE}" - fi - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Using persisted data" - # mysql_upgrade requires the server to be running - [[ -n "$(get_master_env_var_value ROOT_PASSWORD)" ]] && export ROOT_AUTH_ENABLED="yes" - # https://dev.mysql.com/doc/refman/8.0/en/replication-upgrade.html - mariadb_upgrade - else - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - info "Installing database" - mariadb_install_db - mysql_start_bg - wait_for_mysql_access - # we delete existing users and create new ones with stricter access - # commands can still be executed until we restart or run 'flush privileges' - info "Configuring authentication" - mysql_execute "mysql" <=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Initialize database data -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_install_db() { - local command="${DB_BIN_DIR}/mysql_install_db" - local -a args=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && args+=("${db_extra_flags[@]}") - - am_i_root && args=("${args[@]}" "--user=$DB_DAEMON_USER") - args+=("--auth-root-authentication-method=normal") - # Feature available only in MariaDB 10.5+ - # ref: https://mariadb.com/kb/en/mysql_install_db/#not-creating-the-test-database-and-anonymous-user - if [[ ! "$(mysql_get_version)" =~ ^10\.[01234]\. ]]; then - is_boolean_yes "$DB_SKIP_TEST_DB" && args+=("--skip-test-db") - fi - - debug_execute "$command" "${args[@]}" -} - -######################## -# Upgrade Database Schema -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_upgrade() { - local -a args=("--defaults-file=${DB_CONF_FILE}" "-u" "$DB_ROOT_USER") - info "Running mysql_upgrade" - mysql_start_bg - is_boolean_yes "${ROOT_AUTH_ENABLED:-false}" && args+=("-p$(get_master_env_var_value ROOT_PASSWORD)") - [[ "${DB_UPGRADE}" == "FORCE" ]] && args+=("--force") - debug_execute "${DB_BIN_DIR}/mysql_upgrade" "${args[@]}" || echo "This installation is already upgraded" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for mysql common - -######################## -# Extract mysql version from version string -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Version string -######################### -mysql_get_version() { - local ver_string - local -a ver_split - - ver_string=$("${DB_BIN_DIR}/mysql" "--version") - read -r -a ver_split <<< "$ver_string" - - if [[ "$ver_string" = *" Distrib "* ]]; then - echo "${ver_split[4]::-1}" - else - echo "${ver_split[2]}" - fi -} - -######################## -# Gets an environment variable name based on the suffix -# Globals: -# DB_FLAVOR -# Arguments: -# $1 - environment variable suffix -# Returns: -# environment variable name -######################### -get_env_var() { - local -r id="${1:?id is required}" - local -r prefix="${DB_FLAVOR//-/_}" - echo "${prefix^^}_${id}" -} - -######################## -# Gets an environment variable value for the master node and based on the suffix -# Arguments: -# $1 - environment variable suffix -# Returns: -# environment variable value -######################### -get_master_env_var_value() { - local envVar - - PREFIX="" - [[ "${DB_REPLICATION_MODE:-}" = "slave" ]] && PREFIX="MASTER_" - envVar="$(get_env_var "${PREFIX}${1}_FILE")" - if [[ -f "${!envVar:-}" ]]; then - echo "$(< "${!envVar}")" - else - envVar="$(get_env_var "${PREFIX}${1}")" - echo "${!envVar:-}" - fi -} - -######################## -# Execute an arbitrary query/queries against the running MySQL/MariaDB service and print to stdout -# Stdin: -# Query/queries to execute -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - Database where to run the queries -# $2 - User to run queries -# $3 - Password -# $4 - Extra MySQL CLI options -# Returns: -# None -mysql_execute_print_output() { - local -r db="${1:-}" - local -r user="${2:-root}" - local -r pass="${3:-}" - local -a opts extra_opts - read -r -a opts <<< "${@:4}" - read -r -a extra_opts <<< "$(mysql_client_extra_opts)" - - # Process mysql CLI arguments - local -a args=() - if [[ -f "$DB_CONF_FILE" ]]; then - args+=("--defaults-file=${DB_CONF_FILE}") - fi - args+=("-N" "-u" "$user") - [[ -n "$db" ]] && args+=("$db") - [[ -n "$pass" ]] && args+=("-p$pass") - [[ "${#opts[@]}" -gt 0 ]] && args+=("${opts[@]}") - [[ "${#extra_opts[@]}" -gt 0 ]] && args+=("${extra_opts[@]}") - - # Obtain the command specified via stdin - if [[ "${BITNAMI_DEBUG:-false}" = true ]]; then - local mysql_cmd - mysql_cmd="$(> "$custom_conf_file" - cat "$old_custom_conf_file" >> "$custom_conf_file" - fi - if am_i_root; then - [[ -e "$DB_VOLUME_DIR/.initialized" ]] && rm "$DB_VOLUME_DIR/.initialized" - rm -rf "$DB_VOLUME_DIR/conf" - else - warn "Old custom configuration migrated, please manually remove the 'conf' directory from the volume use to persist data" - fi -} - -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - local mysql_create_user_cmd - [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.4, the mysql.user table was replaced with a view: https://mariadb.com/kb/en/mysqluser-table/ - # Views have a definer user, in this case set to 'root', which needs to exist for the view to work - # In MySQL, to avoid issues when renaming the root user, they use the 'mysql.sys' user as a definer: https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html - # However, for MariaDB that is not the case, so when the 'root' user is renamed the 'mysql.user' table stops working and the view needs to be fixed - if [[ "$user" != "root" && ! "$(mysql_get_version)" =~ ^10.[0123]. ]]; then - alter_view_str="$(mysql_execute_print_output "mysql" "$user" "$password" "-s" <&2 - return 1 - ;; - esac - shift - done - - local -a mysql_execute_cmd=("mysql_execute") - [[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - - local -a create_database_args=() - [[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'") - [[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'") - - debug "Creating database $database" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$user") - [[ -n "$db_host" ]] && flags+=("--host" "${db_host}") - [[ -n "$db_port" ]] && flags+=("--port" "${db_port}") - if is_boolean_yes "$use_ldap"; then - flags+=("--use-ldap") - elif [[ -n "$password" ]]; then - flags+=("-p" "$password") - [[ -n "$auth_plugin" ]] && flags=("${flags[@]}" "--auth-plugin" "$auth_plugin") - fi - mysql_ensure_user_exists "${flags[@]}" -} - -######################## -# Optionally create the given database, and then optionally give a user -# full privileges on the database. -# Flags: -# -u|--user - database user -# --character-set - character set -# --collation - collation -# --host - database host -# --port - database port -# Arguments: -# $1 - database name -# Returns: -# None -######################### -mysql_ensure_optional_database_exists() { - local -r database="${1:?database is missing}" - local character_set="" - local collate="" - local user="" - local privileges="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - --character-set) - shift - character_set="${1:?missing character set}" - ;; - --collate) - shift - collate="${1:?missing collate}" - ;; - -u|--user) - shift - user="${1:?missing database user}" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - --privileges) - shift - privileges="${1:?missing privileges}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$database") - [[ -n "$character_set" ]] && flags+=("--character-set" "$character_set") - [[ -n "$collate" ]] && flags+=("--collate" "$collate") - [[ -n "$db_host" ]] && flags+=("--host" "$db_host") - [[ -n "$db_port" ]] && flags+=("--port" "$db_port") - mysql_ensure_database_exists "${flags[@]}" - - if [[ -n "$user" ]]; then - mysql_ensure_user_has_database_privileges "$user" "$database" "$privileges" "$db_host" "$db_port" - fi -} - -######################## -# Add or modify an entry in the MySQL configuration file ("$DB_CONF_FILE") -# Globals: -# DB_* -# Arguments: -# $1 - MySQL variable name -# $2 - Value to assign to the MySQL variable -# $3 - Section in the MySQL configuration file the key is located (default: mysqld) -# $4 - Configuration file (default: "$BD_CONF_FILE") -# Returns: -# None -######################### -mysql_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - read -r -a sections <<<"${3:-mysqld}" - local -r ignore_inline_comments="${4:-no}" - local -r file="${5:-"$DB_CONF_FILE"}" - info "Setting ${key} option" - debug "Setting ${key} to '${value}' in ${DB_FLAVOR} configuration file ${file}" - # Check if the configuration exists in the file - for section in "${sections[@]}"; do - if is_boolean_yes "$ignore_inline_comments"; then - ini-file set --ignore-inline-comments --section "$section" --key "$key" --value "$value" "$file" - else - ini-file set --section "$section" --key "$key" --value "$value" "$file" - fi - done -} - -######################## -# Update MySQL/MariaDB configuration file with user custom inputs -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_update_custom_config() { - # Persisted configuration files from old versions - ! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration - - # User injected custom configuration - if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then - debug "Injecting custom configuration from my_custom.conf" - cat "$DB_CONF_DIR/my_custom.cnf" > "$DB_CONF_DIR/bitnami/my_custom.cnf" - fi - - ! is_empty_value "$DB_USER" && mysql_conf_set "user" "$DB_USER" "mysqladmin" - ! is_empty_value "$DB_PORT_NUMBER" && mysql_conf_set "port" "$DB_PORT_NUMBER" "mysqld client manager" - ! is_empty_value "$DB_CHARACTER_SET" && mysql_conf_set "character_set_server" "$DB_CHARACTER_SET" - ! is_empty_value "$DB_COLLATE" && mysql_conf_set "collation_server" "$DB_COLLATE" - ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" - ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" - ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" - ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" - ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=( "/usr/lib" "/usr/lib64" ) - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} - -######################## -# Execute a reliable health check against the current mysql instance -# Globals: -# DB_ROOT_USER, DB_ROOT_PASSWORD, DB_MASTER_ROOT_PASSWORD -# Arguments: -# None -# Returns: -# mysqladmin output -######################### -mysql_healthcheck() { - local args=("-u${DB_ROOT_USER}" "-h0.0.0.0") - local root_password - - root_password="$(get_master_env_var_value ROOT_PASSWORD)" - if [[ -n "$root_password" ]]; then - args+=("-p${root_password}") - fi - - mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status -} - -######################## -# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# mysql client flavor -######################### -mysql_client_flavor() { - if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then - echo "mariadb" - else - echo "mysql" - fi -} - -######################## -# Prints extra options for MySQL client calls (i.e. SSL options) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# List of options to pass to "mysql" CLI -######################### -mysql_client_extra_opts() { - # Helper to get the proper value for the MySQL client environment variable - mysql_client_env_value() { - local env_name="MYSQL_CLIENT_${1:?missing name}" - if [[ -n "${!env_name:-}" ]]; then - echo "${!env_name:-}" - else - env_name="DB_CLIENT_${1}" - echo "${!env_name:-}" - fi - } - local -a opts=() - local key value - if is_boolean_yes "${DB_ENABLE_SSL:-no}"; then - if [[ "$(mysql_client_flavor)" = "mysql" ]]; then - opts+=("--ssl-mode=REQUIRED") - else - opts+=("--ssl=TRUE") - fi - # Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined - for key in ca key cert; do - value="$(mysql_client_env_value "SSL_${key^^}_FILE")" - [[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}") - done - else - # Skip SSL validation - if [[ "$(mysql_client_flavor)" = "mariadb" ]]; then - # SSL connections are enabled by default in MariaDB >=10.11 - local mysql_version="" - local major_version="" - local minor_version="" - mysql_version="$(mysql_get_version)" - major_version="$(get_sematic_version "${mysql_version}" 1)" - minor_version="$(get_sematic_version "${mysql_version}" 2)" - if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then - opts+=("--skip-ssl") - fi - fi - fi - echo "${opts[@]:-}" -} diff --git a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh b/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh deleted file mode 100644 index 3fe87ab875092..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for mariadb - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-mariadb}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -mariadb_env_vars=( - ALLOW_EMPTY_PASSWORD - MARIADB_AUTHENTICATION_PLUGIN - MARIADB_ROOT_USER - MARIADB_ROOT_PASSWORD - MARIADB_USER - MARIADB_PASSWORD - MARIADB_DATABASE - MARIADB_MASTER_HOST - MARIADB_MASTER_PORT_NUMBER - MARIADB_MASTER_ROOT_USER - MARIADB_MASTER_ROOT_PASSWORD - MARIADB_MASTER_DELAY - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - MARIADB_PORT_NUMBER - MARIADB_REPLICATION_MODE - MARIADB_REPLICATION_SLAVE_DUMP - MARIADB_EXTRA_FLAGS - MARIADB_INIT_SLEEP_TIME - MARIADB_CHARACTER_SET - MARIADB_COLLATE - MARIADB_BIND_ADDRESS - MARIADB_SQL_MODE - MARIADB_UPGRADE - MARIADB_SKIP_TEST_DB - MARIADB_CLIENT_ENABLE_SSL - MARIADB_CLIENT_SSL_CA_FILE - MARIADB_CLIENT_SSL_CERT_FILE - MARIADB_CLIENT_SSL_KEY_FILE - MARIADB_CLIENT_EXTRA_FLAGS - MARIADB_STARTUP_WAIT_RETRIES - MARIADB_STARTUP_WAIT_SLEEP_TIME - MARIADB_ENABLE_SLOW_QUERY - MARIADB_LONG_QUERY_TIME - DB_ENABLE_SLOW_QUERY - DB_LONG_QUERY_TIME -) -for env_var in "${mariadb_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset mariadb_env_vars -export DB_FLAVOR="mariadb" - -# Paths -export DB_BASE_DIR="${BITNAMI_ROOT_DIR}/mariadb" -export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" -export DB_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_SBIN_DIR="${DB_BASE_DIR}/sbin" -export DB_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_LOGS_DIR="${DB_BASE_DIR}/logs" -export DB_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_CONF_FILE="${DB_CONF_DIR}/my.cnf" -export DB_PID_FILE="${DB_TMP_DIR}/mysqld.pid" -export DB_SOCKET_FILE="${DB_TMP_DIR}/mysql.sock" -export PATH="${DB_SBIN_DIR}:${DB_BIN_DIR}:/opt/bitnami/common/bin:${PATH}" - -# System users (when running with a privileged user) -export DB_DAEMON_USER="mysql" -export DB_DAEMON_GROUP="mysql" - -# Default configuration (build-time) -export MARIADB_DEFAULT_PORT_NUMBER="3306" -export DB_DEFAULT_PORT_NUMBER="$MARIADB_DEFAULT_PORT_NUMBER" # only used at build time -export MARIADB_DEFAULT_CHARACTER_SET="utf8mb4" -export DB_DEFAULT_CHARACTER_SET="$MARIADB_DEFAULT_CHARACTER_SET" # only used at build time -export MARIADB_DEFAULT_BIND_ADDRESS="0.0.0.0" -export DB_DEFAULT_BIND_ADDRESS="$MARIADB_DEFAULT_BIND_ADDRESS" # only used at build time - -# MariaDB authentication. -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export MARIADB_AUTHENTICATION_PLUGIN="${MARIADB_AUTHENTICATION_PLUGIN:-}" -export DB_AUTHENTICATION_PLUGIN="$MARIADB_AUTHENTICATION_PLUGIN" -export MARIADB_ROOT_USER="${MARIADB_ROOT_USER:-root}" -export DB_ROOT_USER="$MARIADB_ROOT_USER" # only used during the first initialization -export MARIADB_ROOT_PASSWORD="${MARIADB_ROOT_PASSWORD:-}" -export DB_ROOT_PASSWORD="$MARIADB_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_USER="${MARIADB_USER:-}" -export DB_USER="$MARIADB_USER" # only used during the first initialization -export MARIADB_PASSWORD="${MARIADB_PASSWORD:-}" -export DB_PASSWORD="$MARIADB_PASSWORD" # only used during the first initialization -export MARIADB_DATABASE="${MARIADB_DATABASE:-}" -export DB_DATABASE="$MARIADB_DATABASE" # only used during the first initialization -export MARIADB_MASTER_HOST="${MARIADB_MASTER_HOST:-}" -export DB_MASTER_HOST="$MARIADB_MASTER_HOST" # only used during the first initialization -export MARIADB_MASTER_PORT_NUMBER="${MARIADB_MASTER_PORT_NUMBER:-3306}" -export DB_MASTER_PORT_NUMBER="$MARIADB_MASTER_PORT_NUMBER" # only used during the first initialization -export MARIADB_MASTER_ROOT_USER="${MARIADB_MASTER_ROOT_USER:-root}" -export DB_MASTER_ROOT_USER="$MARIADB_MASTER_ROOT_USER" # only used during the first initialization -export MARIADB_MASTER_ROOT_PASSWORD="${MARIADB_MASTER_ROOT_PASSWORD:-}" -export DB_MASTER_ROOT_PASSWORD="$MARIADB_MASTER_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_MASTER_DELAY="${MARIADB_MASTER_DELAY:-0}" -export DB_MASTER_DELAY="$MARIADB_MASTER_DELAY" # only used during the first initialization -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Settings -export MARIADB_PORT_NUMBER="${MARIADB_PORT_NUMBER:-}" -export DB_PORT_NUMBER="$MARIADB_PORT_NUMBER" -export MARIADB_REPLICATION_MODE="${MARIADB_REPLICATION_MODE:-}" -export DB_REPLICATION_MODE="$MARIADB_REPLICATION_MODE" -export MARIADB_REPLICATION_SLAVE_DUMP="${MARIADB_REPLICATION_SLAVE_DUMP:-false}" -export DB_REPLICATION_SLAVE_DUMP="$MARIADB_REPLICATION_SLAVE_DUMP" -export MARIADB_EXTRA_FLAGS="${MARIADB_EXTRA_FLAGS:-}" -export DB_EXTRA_FLAGS="$MARIADB_EXTRA_FLAGS" -export MARIADB_INIT_SLEEP_TIME="${MARIADB_INIT_SLEEP_TIME:-}" -export DB_INIT_SLEEP_TIME="$MARIADB_INIT_SLEEP_TIME" -export MARIADB_CHARACTER_SET="${MARIADB_CHARACTER_SET:-}" -export DB_CHARACTER_SET="$MARIADB_CHARACTER_SET" -# MARIADB_COLLATION is deprecated in favor of MARIADB_COLLATE -MARIADB_COLLATE="${MARIADB_COLLATE:-"${MARIADB_COLLATION:-}"}" -export MARIADB_COLLATE="${MARIADB_COLLATE:-}" -export DB_COLLATE="$MARIADB_COLLATE" -export MARIADB_BIND_ADDRESS="${MARIADB_BIND_ADDRESS:-}" -export DB_BIND_ADDRESS="$MARIADB_BIND_ADDRESS" -export MARIADB_SQL_MODE="${MARIADB_SQL_MODE:-}" -export DB_SQL_MODE="$MARIADB_SQL_MODE" -export MARIADB_UPGRADE="${MARIADB_UPGRADE:-AUTO}" -export DB_UPGRADE="$MARIADB_UPGRADE" -export MARIADB_SKIP_TEST_DB="${MARIADB_SKIP_TEST_DB:-no}" -export DB_SKIP_TEST_DB="$MARIADB_SKIP_TEST_DB" -export MARIADB_CLIENT_ENABLE_SSL="${MARIADB_CLIENT_ENABLE_SSL:-no}" -export DB_CLIENT_ENABLE_SSL="$MARIADB_CLIENT_ENABLE_SSL" -export MARIADB_CLIENT_SSL_CA_FILE="${MARIADB_CLIENT_SSL_CA_FILE:-}" -export DB_CLIENT_SSL_CA_FILE="$MARIADB_CLIENT_SSL_CA_FILE" -export MARIADB_CLIENT_SSL_CERT_FILE="${MARIADB_CLIENT_SSL_CERT_FILE:-}" -export DB_CLIENT_SSL_CERT_FILE="$MARIADB_CLIENT_SSL_CERT_FILE" -export MARIADB_CLIENT_SSL_KEY_FILE="${MARIADB_CLIENT_SSL_KEY_FILE:-}" -export DB_CLIENT_SSL_KEY_FILE="$MARIADB_CLIENT_SSL_KEY_FILE" -export MARIADB_CLIENT_EXTRA_FLAGS="${MARIADB_CLIENT_EXTRA_FLAGS:-no}" -export DB_CLIENT_EXTRA_FLAGS="$MARIADB_CLIENT_EXTRA_FLAGS" -export MARIADB_STARTUP_WAIT_RETRIES="${MARIADB_STARTUP_WAIT_RETRIES:-300}" -export DB_STARTUP_WAIT_RETRIES="$MARIADB_STARTUP_WAIT_RETRIES" -export MARIADB_STARTUP_WAIT_SLEEP_TIME="${MARIADB_STARTUP_WAIT_SLEEP_TIME:-2}" -export DB_STARTUP_WAIT_SLEEP_TIME="$MARIADB_STARTUP_WAIT_SLEEP_TIME" -MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-"${DB_ENABLE_SLOW_QUERY:-}"}" -export MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-0}" -export DB_ENABLE_SLOW_QUERY="$MARIADB_ENABLE_SLOW_QUERY" -MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-"${DB_LONG_QUERY_TIME:-}"}" -export MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-10.0}" -export DB_LONG_QUERY_TIME="$MARIADB_LONG_QUERY_TIME" - -# Custom environment variables may be defined below diff --git a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh b/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh deleted file mode 100755 index 5daeb16c64943..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/mariadb/conf) -debug "Copying files from $DB_DEFAULT_CONF_DIR to $DB_CONF_DIR" -cp -nr "$DB_DEFAULT_CONF_DIR"/. "$DB_CONF_DIR" - -if [[ "$1" = "/opt/bitnami/scripts/mariadb/run.sh" ]]; then - info "** Starting MariaDB setup **" - /opt/bitnami/scripts/mariadb/setup.sh - info "** MariaDB setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh b/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh deleted file mode 100755 index 60211b1057f6e..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libmariadb.sh - -# Load MySQL environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -mysql_healthcheck diff --git a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh b/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh deleted file mode 100755 index ee8217ffb401c..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Configure MariaDB options based on build-time defaults -info "Configuring default MariaDB options" -ensure_dir_exists "$DB_CONF_DIR" -mysql_create_default_config - -for dir in "$DB_TMP_DIR" "$DB_LOGS_DIR" "$DB_CONF_DIR" "$DB_DEFAULT_CONF_DIR" "${DB_CONF_DIR}/bitnami" "$DB_VOLUME_DIR" "$DB_DATA_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# Fix to avoid issues detecting plugins in mysql_install_db -ln -sf "$DB_BASE_DIR/plugin" "$DB_BASE_DIR/lib/plugin" - -# Redirect all logging to stdout -ln -sf "/proc/1/fd/1" "$DB_LOGS_DIR/mysqld.log" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${DB_CONF_DIR}/"* "$DB_DEFAULT_CONF_DIR" diff --git a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh b/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh deleted file mode 100755 index 97f5d80c226f0..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# mysqld_safe does not allow logging to stdout/stderr, so we stick with mysqld -EXEC="${DB_SBIN_DIR}/mysqld" - -flags=("--defaults-file=${DB_CONF_DIR}/my.cnf" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") -[[ -z "${DB_PID_FILE:-}" ]] || flags+=("--pid-file=${DB_PID_FILE}") - -# Add flags specified via the 'DB_EXTRA_FLAGS' environment variable -read -r -a db_extra_flags <<< "$(mysql_extra_flags)" -[[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - -# Add flags passed to this script -flags+=("$@") - -# Fix for MDEV-16183 - mysqld_safe already does this, but we are using mysqld -LD_PRELOAD="$(find_jemalloc_lib)${LD_PRELOAD:+ "$LD_PRELOAD"}" -export LD_PRELOAD - -info "** Starting MariaDB **" -if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "$EXEC" "${flags[@]}" -else - exec "$EXEC" "${flags[@]}" -fi diff --git a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh b/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh deleted file mode 100755 index 9dcc55c047ade..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Ensure mysql unix socket file does not exist -rm -rf "${DB_SOCKET_FILE}.lock" -# Ensure MariaDB environment variables settings are valid -mysql_validate -# Ensure MariaDB is stopped when this script ends. -trap "mysql_stop" EXIT -if am_i_root; then - # Ensure 'daemon' user exists when running as 'root' - ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" - # Fix logging issue when running as root - chmod o+w "$(readlink /dev/stdout)" -fi -# Ensure MariaDB is initialized -mysql_initialize -# Allow running custom initialization scripts -mysql_custom_scripts 'init' -# Allow running custom start scripts -mysql_custom_scripts 'start' -# Stop MariaDB before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -mysql_stop diff --git a/bitnami/mariadb/11.5/debian-12/tags-info.yaml b/bitnami/mariadb/11.5/debian-12/tags-info.yaml deleted file mode 100644 index be7a5e90b6082..0000000000000 --- a/bitnami/mariadb/11.5/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "11.5" -- 11.5-debian-12 -- 11.5.2 diff --git a/bitnami/mariadb/11.6/README.md b/bitnami/mariadb/11.6/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/mariadb/11.6/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/mariadb/11.6/debian-12/Dockerfile b/bitnami/mariadb/11.6/debian-12/Dockerfile deleted file mode 100644 index 662b98cfff330..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/Dockerfile +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-11-26T14:18:06Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mariadb/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="11.6.2-debian-12-r0" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mariadb" \ - org.opencontainers.image.title="mariadb" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="11.6.2" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libaio1 libaudit1 libcap-ng0 libcrypt1 libgcc-s1 libicu72 liblzma5 libncurses6 libpam0g libssl3 libstdc++6 libtinfo6 libxml2 procps psmisc zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "ini-file-1.4.7-7-linux-${OS_ARCH}-debian-12" \ - "mariadb-11.6.2-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get autoremove --purge -y curl && \ - apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN mkdir /docker-entrypoint-initdb.d - -COPY rootfs / -RUN /opt/bitnami/scripts/mariadb/postunpack.sh -ENV APP_VERSION="11.6.2" \ - BITNAMI_APP_NAME="mariadb" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/common/sbin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:$PATH" - -EXPOSE 3306 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/mariadb/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/mariadb/run.sh" ] diff --git a/bitnami/mariadb/11.6/debian-12/docker-compose-replication.yml b/bitnami/mariadb/11.6/debian-12/docker-compose-replication.yml deleted file mode 100644 index 3a8372f1ea8b7..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/docker-compose-replication.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb-master: - image: docker.io/bitnami/mariadb:11.6 - ports: - - '3306' - volumes: - - 'mariadb_master_data:/bitnami/mariadb' - environment: - - MARIADB_REPLICATION_MODE=master - - MARIADB_REPLICATION_USER=repl_user - - MARIADB_USER=my_user - - MARIADB_DATABASE=my_database - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - - MARIADB_ROOT_PASSWORD=my_root_password - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - - mariadb-slave: - image: docker.io/bitnami/mariadb:11.6 - ports: - - '3306' - depends_on: - - mariadb-master - environment: - - MARIADB_REPLICATION_MODE=slave - - MARIADB_REPLICATION_USER=repl_user - - MARIADB_USER=my_user - - MARIADB_DATABASE=my_database - - MARIADB_MASTER_HOST=mariadb-master - - MARIADB_MASTER_PORT_NUMBER=3306 - - MARIADB_MASTER_ROOT_PASSWORD=my_root_password - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_master_data: - driver: local diff --git a/bitnami/mariadb/11.6/debian-12/docker-compose.yml b/bitnami/mariadb/11.6/debian-12/docker-compose.yml deleted file mode 100644 index 100f9815c3067..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mariadb: - image: docker.io/bitnami/mariadb:11.6 - ports: - - '3306:3306' - volumes: - - 'mariadb_data:/bitnami/mariadb' - environment: - # ALLOW_EMPTY_PASSWORD is recommended only for development. - - ALLOW_EMPTY_PASSWORD=yes - healthcheck: - test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] - interval: 15s - timeout: 5s - retries: 6 - -volumes: - mariadb_data: - driver: local diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index a13f84d66e1b6..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ini-file": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.4.7-7" - }, - "mariadb": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "11.6.2-0" - } -} \ No newline at end of file diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/mariadb/11.6/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/mariadb/11.6/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/mariadb/11.6/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh b/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh deleted file mode 100644 index 9d6bd864f4513..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/libmariadb.sh +++ /dev/null @@ -1,1417 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami MySQL library - -# shellcheck disable=SC1090,SC1091,SC2119,SC2120 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfile.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libservice.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libversion.sh - -######################## -# Configure database extra start flags -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Array with extra flags to use -######################### -mysql_extra_flags() { - local randNumber - local -a dbExtraFlags=() - # shellcheck disable=SC2153 - read -r -a userExtraFlags <<< "$DB_EXTRA_FLAGS" - - if [[ -n "$DB_REPLICATION_MODE" ]]; then - randNumber="$(head /dev/urandom | tr -dc 0-9 | head -c 3 ; echo '')" - dbExtraFlags+=("--server-id=$randNumber" "--binlog-format=ROW" "--log-bin=mysql-bin" "--sync-binlog=1") - if [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - dbExtraFlags+=("--relay-log=mysql-relay-bin" "--log-slave-updates=1" "--read-only=1") - elif [[ "$DB_REPLICATION_MODE" = "master" ]]; then - dbExtraFlags+=("--innodb_flush_log_at_trx_commit=1") - fi - fi - - [[ "${#userExtraFlags[@]}" -eq 0 ]] || dbExtraFlags+=("${userExtraFlags[@]}") - - echo "${dbExtraFlags[@]:-}" -} - -######################## -# Validate settings in MYSQL_*/MARIADB_* environment variables -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_validate() { - info "Validating settings in MYSQL_*/MARIADB_* env vars" - local error_code=0 - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - empty_password_enabled_warn() { - warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." - } - empty_password_error() { - print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - } - backslash_password_error() { - print_validation_error "The password cannot contain backslashes ('\'). Set the environment variable $1 with no backslashes (more info at https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html)" - } - - if [[ -n "$DB_REPLICATION_MODE" ]]; then - if [[ "$DB_REPLICATION_MODE" = "master" ]]; then - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -n "$DB_REPLICATION_USER" ]] && [[ -z "$DB_REPLICATION_PASSWORD" ]]; then - empty_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if (( ${#DB_ROOT_PASSWORD} > 32 )); then - print_validation_error "The password can not be longer than 32 characters. Set the environment variable $(get_env_var ROOT_PASSWORD) with a shorter value (currently ${#DB_ROOT_PASSWORD} characters)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - elif [[ "$DB_REPLICATION_MODE" = "slave" ]]; then - if [[ -z "$DB_MASTER_HOST" ]]; then - print_validation_error "Slave replication mode chosen without setting the environment variable $(get_env_var MASTER_HOST). Use it to indicate where the Master node is running" - fi - else - print_validation_error "Invalid replication mode. Available options are 'master/slave'" - fi - else - if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then - empty_password_enabled_warn - else - if [[ -z "$DB_ROOT_PASSWORD" ]]; then - empty_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ -z "$DB_PASSWORD" ]]; then - empty_password_error "$(get_env_var PASSWORD)" - fi - fi - fi - if [[ "${DB_ROOT_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var ROOT_PASSWORD)" - fi - if [[ -n "$DB_USER" ]] && [[ "$DB_USER" = "root" ]]; then - print_validation_error "root user is already created in the database and you can't use it as username for user creation." - fi - if [[ "${DB_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var PASSWORD)" - fi - if [[ "${DB_REPLICATION_PASSWORD:-}" = *\\* ]]; then - backslash_password_error "$(get_env_var REPLICATION_PASSWORD)" - fi - - collation_env_var="$(get_env_var COLLATION)" - is_empty_value "${!collation_env_var:-}" || warn "The usage of '$(get_env_var COLLATION)' is deprecated and will soon be removed. Use '$(get_env_var COLLATE)' instead." - - [[ "$error_code" -eq 0 ]] || exit "$error_code" -} - -######################## -# Creates MySQL/MariaDB configuration file -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_create_default_config() { - debug "Creating main configuration file" - cat > "$DB_CONF_FILE" < "$dump_file" - debug "Finish dump databases" - - debug "Unlock master databases for write operations" - echo "UNLOCK TABLES;" | mysql_remote_execute "$DB_MASTER_HOST" "$DB_MASTER_PORT_NUMBER" "mysql" "$DB_MASTER_ROOT_USER" "$DB_MASTER_ROOT_PASSWORD" - - debug "Start import dump databases" - mysql_execute < "$dump_file" - mysql_execute "mysql" < "${DB_CONF_DIR}/bitnami/my_custom.cnf" - if ! grep --silent "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" "${DB_CONF_FILE}"; then - echo "!include ${DB_CONF_DIR}/bitnami/my_custom.cnf" >> "${DB_CONF_FILE}" - fi - else - warn "Could not inject custom configuration for the ${DB_FLAVOR} configuration file '$DB_CONF_DIR/bitnami/my_custom.cnf' because it is not writable." - fi - fi - - if [[ -e "$DB_DATA_DIR/mysql" ]]; then - info "Using persisted data" - # mysql_upgrade requires the server to be running - [[ -n "$(get_master_env_var_value ROOT_PASSWORD)" ]] && export ROOT_AUTH_ENABLED="yes" - # https://dev.mysql.com/doc/refman/8.0/en/replication-upgrade.html - mariadb_upgrade - else - debug "Cleaning data directory to ensure successfully initialization" - rm -rf "${DB_DATA_DIR:?}"/* - info "Installing database" - mariadb_install_db - mysql_start_bg - wait_for_mysql_access - # we delete existing users and create new ones with stricter access - # commands can still be executed until we restart or run 'flush privileges' - info "Configuring authentication" - mysql_execute "mysql" <=8 depends on this command - # users are not configured on slave nodes during initialization due to --skip-slave-start - wait_for_mysql - - # Special configuration flag for system with slow disks that could take more time - # in initializing - if [[ -n "${DB_INIT_SLEEP_TIME}" ]]; then - debug "Sleeping ${DB_INIT_SLEEP_TIME} seconds before continuing with initialization" - sleep "${DB_INIT_SLEEP_TIME}" - fi -} - -######################## -# Initialize database data -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_install_db() { - local command="${DB_BIN_DIR}/mysql_install_db" - local -a args=("--defaults-file=${DB_CONF_FILE}" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}") - - # Add flags specified via the 'DB_EXTRA_FLAGS' environment variable - read -r -a db_extra_flags <<< "$(mysql_extra_flags)" - [[ "${#db_extra_flags[@]}" -gt 0 ]] && args+=("${db_extra_flags[@]}") - - am_i_root && args=("${args[@]}" "--user=$DB_DAEMON_USER") - args+=("--auth-root-authentication-method=normal") - # Feature available only in MariaDB 10.5+ - # ref: https://mariadb.com/kb/en/mysql_install_db/#not-creating-the-test-database-and-anonymous-user - if [[ ! "$(mysql_get_version)" =~ ^10\.[01234]\. ]]; then - is_boolean_yes "$DB_SKIP_TEST_DB" && args+=("--skip-test-db") - fi - - debug_execute "$command" "${args[@]}" -} - -######################## -# Upgrade Database Schema -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mariadb_upgrade() { - local -a args=("--defaults-file=${DB_CONF_FILE}" "-u" "$DB_ROOT_USER") - info "Running mysql_upgrade" - mysql_start_bg - is_boolean_yes "${ROOT_AUTH_ENABLED:-false}" && args+=("-p$(get_master_env_var_value ROOT_PASSWORD)") - [[ "${DB_UPGRADE}" == "FORCE" ]] && args+=("--force") - debug_execute "${DB_BIN_DIR}/mysql_upgrade" "${args[@]}" || echo "This installation is already upgraded" -} - -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for mysql common - -######################## -# Extract mysql version from version string -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# Version string -######################### -mysql_get_version() { - local ver_string - local -a ver_split - - ver_string=$("${DB_BIN_DIR}/mysql" "--version") - read -r -a ver_split <<< "$ver_string" - - if [[ "$ver_string" = *" Distrib "* ]]; then - echo "${ver_split[4]::-1}" - else - echo "${ver_split[2]}" - fi -} - -######################## -# Gets an environment variable name based on the suffix -# Globals: -# DB_FLAVOR -# Arguments: -# $1 - environment variable suffix -# Returns: -# environment variable name -######################### -get_env_var() { - local -r id="${1:?id is required}" - local -r prefix="${DB_FLAVOR//-/_}" - echo "${prefix^^}_${id}" -} - -######################## -# Gets an environment variable value for the master node and based on the suffix -# Arguments: -# $1 - environment variable suffix -# Returns: -# environment variable value -######################### -get_master_env_var_value() { - local envVar - - PREFIX="" - [[ "${DB_REPLICATION_MODE:-}" = "slave" ]] && PREFIX="MASTER_" - envVar="$(get_env_var "${PREFIX}${1}_FILE")" - if [[ -f "${!envVar:-}" ]]; then - echo "$(< "${!envVar}")" - else - envVar="$(get_env_var "${PREFIX}${1}")" - echo "${!envVar:-}" - fi -} - -######################## -# Execute an arbitrary query/queries against the running MySQL/MariaDB service and print to stdout -# Stdin: -# Query/queries to execute -# Globals: -# BITNAMI_DEBUG -# DB_* -# Arguments: -# $1 - Database where to run the queries -# $2 - User to run queries -# $3 - Password -# $4 - Extra MySQL CLI options -# Returns: -# None -mysql_execute_print_output() { - local -r db="${1:-}" - local -r user="${2:-root}" - local -r pass="${3:-}" - local -a opts extra_opts - read -r -a opts <<< "${@:4}" - read -r -a extra_opts <<< "$(mysql_client_extra_opts)" - - # Process mysql CLI arguments - local -a args=() - if [[ -f "$DB_CONF_FILE" ]]; then - args+=("--defaults-file=${DB_CONF_FILE}") - fi - args+=("-N" "-u" "$user") - [[ -n "$db" ]] && args+=("$db") - [[ -n "$pass" ]] && args+=("-p$pass") - [[ "${#opts[@]}" -gt 0 ]] && args+=("${opts[@]}") - [[ "${#extra_opts[@]}" -gt 0 ]] && args+=("${extra_opts[@]}") - - # Obtain the command specified via stdin - if [[ "${BITNAMI_DEBUG:-false}" = true ]]; then - local mysql_cmd - mysql_cmd="$(> "$custom_conf_file" - cat "$old_custom_conf_file" >> "$custom_conf_file" - fi - if am_i_root; then - [[ -e "$DB_VOLUME_DIR/.initialized" ]] && rm "$DB_VOLUME_DIR/.initialized" - rm -rf "$DB_VOLUME_DIR/conf" - else - warn "Old custom configuration migrated, please manually remove the 'conf' directory from the volume use to persist data" - fi -} - -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - local mysql_create_user_cmd - [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.4, the mysql.user table was replaced with a view: https://mariadb.com/kb/en/mysqluser-table/ - # Views have a definer user, in this case set to 'root', which needs to exist for the view to work - # In MySQL, to avoid issues when renaming the root user, they use the 'mysql.sys' user as a definer: https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html - # However, for MariaDB that is not the case, so when the 'root' user is renamed the 'mysql.user' table stops working and the view needs to be fixed - if [[ "$user" != "root" && ! "$(mysql_get_version)" =~ ^10.[0123]. ]]; then - alter_view_str="$(mysql_execute_print_output "mysql" "$user" "$password" "-s" <&2 - return 1 - ;; - esac - shift - done - - local -a mysql_execute_cmd=("mysql_execute") - [[ -n "$db_host" && -n "$db_port" ]] && mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - - local -a create_database_args=() - [[ -n "$character_set" ]] && create_database_args+=("character set = '${character_set}'") - [[ -n "$collate" ]] && create_database_args+=("collate = '${collate}'") - - debug "Creating database $database" - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$user") - [[ -n "$db_host" ]] && flags+=("--host" "${db_host}") - [[ -n "$db_port" ]] && flags+=("--port" "${db_port}") - if is_boolean_yes "$use_ldap"; then - flags+=("--use-ldap") - elif [[ -n "$password" ]]; then - flags+=("-p" "$password") - [[ -n "$auth_plugin" ]] && flags=("${flags[@]}" "--auth-plugin" "$auth_plugin") - fi - mysql_ensure_user_exists "${flags[@]}" -} - -######################## -# Optionally create the given database, and then optionally give a user -# full privileges on the database. -# Flags: -# -u|--user - database user -# --character-set - character set -# --collation - collation -# --host - database host -# --port - database port -# Arguments: -# $1 - database name -# Returns: -# None -######################### -mysql_ensure_optional_database_exists() { - local -r database="${1:?database is missing}" - local character_set="" - local collate="" - local user="" - local privileges="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - --character-set) - shift - character_set="${1:?missing character set}" - ;; - --collate) - shift - collate="${1:?missing collate}" - ;; - -u|--user) - shift - user="${1:?missing database user}" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - --privileges) - shift - privileges="${1:?missing privileges}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - local -a flags=("$database") - [[ -n "$character_set" ]] && flags+=("--character-set" "$character_set") - [[ -n "$collate" ]] && flags+=("--collate" "$collate") - [[ -n "$db_host" ]] && flags+=("--host" "$db_host") - [[ -n "$db_port" ]] && flags+=("--port" "$db_port") - mysql_ensure_database_exists "${flags[@]}" - - if [[ -n "$user" ]]; then - mysql_ensure_user_has_database_privileges "$user" "$database" "$privileges" "$db_host" "$db_port" - fi -} - -######################## -# Add or modify an entry in the MySQL configuration file ("$DB_CONF_FILE") -# Globals: -# DB_* -# Arguments: -# $1 - MySQL variable name -# $2 - Value to assign to the MySQL variable -# $3 - Section in the MySQL configuration file the key is located (default: mysqld) -# $4 - Configuration file (default: "$BD_CONF_FILE") -# Returns: -# None -######################### -mysql_conf_set() { - local -r key="${1:?key missing}" - local -r value="${2:?value missing}" - read -r -a sections <<<"${3:-mysqld}" - local -r ignore_inline_comments="${4:-no}" - local -r file="${5:-"$DB_CONF_FILE"}" - info "Setting ${key} option" - debug "Setting ${key} to '${value}' in ${DB_FLAVOR} configuration file ${file}" - # Check if the configuration exists in the file - for section in "${sections[@]}"; do - if is_boolean_yes "$ignore_inline_comments"; then - ini-file set --ignore-inline-comments --section "$section" --key "$key" --value "$value" "$file" - else - ini-file set --section "$section" --key "$key" --value "$value" "$file" - fi - done -} - -######################## -# Update MySQL/MariaDB configuration file with user custom inputs -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# None -######################### -mysql_update_custom_config() { - # Persisted configuration files from old versions - ! is_dir_empty "$DB_VOLUME_DIR" && [[ -d "$DB_VOLUME_DIR/conf" ]] && mysql_migrate_old_configuration - - # User injected custom configuration - if [[ -f "$DB_CONF_DIR/my_custom.cnf" ]]; then - debug "Injecting custom configuration from my_custom.conf" - cat "$DB_CONF_DIR/my_custom.cnf" > "$DB_CONF_DIR/bitnami/my_custom.cnf" - fi - - ! is_empty_value "$DB_USER" && mysql_conf_set "user" "$DB_USER" "mysqladmin" - ! is_empty_value "$DB_PORT_NUMBER" && mysql_conf_set "port" "$DB_PORT_NUMBER" "mysqld client manager" - ! is_empty_value "$DB_CHARACTER_SET" && mysql_conf_set "character_set_server" "$DB_CHARACTER_SET" - ! is_empty_value "$DB_COLLATE" && mysql_conf_set "collation_server" "$DB_COLLATE" - ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" - ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" - ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" - ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" - ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" - - # Avoid exit code of previous commands to affect the result of this function - true -} - -######################## -# Find the path to the libjemalloc library file -# Globals: -# None -# Arguments: -# None -# Returns: -# Path to a libjemalloc shared object file -######################### -find_jemalloc_lib() { - local -a locations=( "/usr/lib" "/usr/lib64" ) - local -r pattern='libjemalloc.so.[0-9]' - local path - for dir in "${locations[@]}"; do - # Find the first element matching the pattern and quit - [[ ! -d "$dir" ]] && continue - path="$(find "$dir" -name "$pattern" -print -quit)" - [[ -n "$path" ]] && break - done - echo "${path:-}" -} - -######################## -# Execute a reliable health check against the current mysql instance -# Globals: -# DB_ROOT_USER, DB_ROOT_PASSWORD, DB_MASTER_ROOT_PASSWORD -# Arguments: -# None -# Returns: -# mysqladmin output -######################### -mysql_healthcheck() { - local args=("-u${DB_ROOT_USER}" "-h0.0.0.0") - local root_password - - root_password="$(get_master_env_var_value ROOT_PASSWORD)" - if [[ -n "$root_password" ]]; then - args+=("-p${root_password}") - fi - - mysqladmin "${args[@]}" ping && mysqladmin "${args[@]}" status -} - -######################## -# Prints flavor of 'mysql' client (useful to determine proper CLI flags that can be used) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# mysql client flavor -######################### -mysql_client_flavor() { - if "${DB_BIN_DIR}/mysql" "--version" 2>&1 | grep -q MariaDB; then - echo "mariadb" - else - echo "mysql" - fi -} - -######################## -# Prints extra options for MySQL client calls (i.e. SSL options) -# Globals: -# DB_* -# Arguments: -# None -# Returns: -# List of options to pass to "mysql" CLI -######################### -mysql_client_extra_opts() { - # Helper to get the proper value for the MySQL client environment variable - mysql_client_env_value() { - local env_name="MYSQL_CLIENT_${1:?missing name}" - if [[ -n "${!env_name:-}" ]]; then - echo "${!env_name:-}" - else - env_name="DB_CLIENT_${1}" - echo "${!env_name:-}" - fi - } - local -a opts=() - local key value - if is_boolean_yes "${DB_ENABLE_SSL:-no}"; then - if [[ "$(mysql_client_flavor)" = "mysql" ]]; then - opts+=("--ssl-mode=REQUIRED") - else - opts+=("--ssl=TRUE") - fi - # Add "--ssl-ca", "--ssl-key" and "--ssl-cert" options if the env vars are defined - for key in ca key cert; do - value="$(mysql_client_env_value "SSL_${key^^}_FILE")" - [[ -n "${value}" ]] && opts+=("--ssl-${key}=${value}") - done - else - # Skip SSL validation - if [[ "$(mysql_client_flavor)" = "mariadb" ]]; then - # SSL connections are enabled by default in MariaDB >=10.11 - local mysql_version="" - local major_version="" - local minor_version="" - mysql_version="$(mysql_get_version)" - major_version="$(get_sematic_version "${mysql_version}" 1)" - minor_version="$(get_sematic_version "${mysql_version}" 2)" - if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then - opts+=("--skip-ssl") - fi - fi - fi - echo "${opts[@]:-}" -} diff --git a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh b/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh deleted file mode 100644 index 3fe87ab875092..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb-env.sh +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Environment configuration for mariadb - -# The values for all environment variables will be set in the below order of precedence -# 1. Custom environment variables defined below after Bitnami defaults -# 2. Constants defined in this file (environment variables with no default), i.e. BITNAMI_ROOT_DIR -# 3. Environment variables overridden via external files using *_FILE variables (see below) -# 4. Environment variables set externally (i.e. current Bash context/Dockerfile/userdata) - -# Load logging library -# shellcheck disable=SC1090,SC1091 -. /opt/bitnami/scripts/liblog.sh - -export BITNAMI_ROOT_DIR="/opt/bitnami" -export BITNAMI_VOLUME_DIR="/bitnami" - -# Logging configuration -export MODULE="${MODULE:-mariadb}" -export BITNAMI_DEBUG="${BITNAMI_DEBUG:-false}" - -# By setting an environment variable matching *_FILE to a file path, the prefixed environment -# variable will be overridden with the value specified in that file -mariadb_env_vars=( - ALLOW_EMPTY_PASSWORD - MARIADB_AUTHENTICATION_PLUGIN - MARIADB_ROOT_USER - MARIADB_ROOT_PASSWORD - MARIADB_USER - MARIADB_PASSWORD - MARIADB_DATABASE - MARIADB_MASTER_HOST - MARIADB_MASTER_PORT_NUMBER - MARIADB_MASTER_ROOT_USER - MARIADB_MASTER_ROOT_PASSWORD - MARIADB_MASTER_DELAY - MARIADB_REPLICATION_USER - MARIADB_REPLICATION_PASSWORD - MARIADB_PORT_NUMBER - MARIADB_REPLICATION_MODE - MARIADB_REPLICATION_SLAVE_DUMP - MARIADB_EXTRA_FLAGS - MARIADB_INIT_SLEEP_TIME - MARIADB_CHARACTER_SET - MARIADB_COLLATE - MARIADB_BIND_ADDRESS - MARIADB_SQL_MODE - MARIADB_UPGRADE - MARIADB_SKIP_TEST_DB - MARIADB_CLIENT_ENABLE_SSL - MARIADB_CLIENT_SSL_CA_FILE - MARIADB_CLIENT_SSL_CERT_FILE - MARIADB_CLIENT_SSL_KEY_FILE - MARIADB_CLIENT_EXTRA_FLAGS - MARIADB_STARTUP_WAIT_RETRIES - MARIADB_STARTUP_WAIT_SLEEP_TIME - MARIADB_ENABLE_SLOW_QUERY - MARIADB_LONG_QUERY_TIME - DB_ENABLE_SLOW_QUERY - DB_LONG_QUERY_TIME -) -for env_var in "${mariadb_env_vars[@]}"; do - file_env_var="${env_var}_FILE" - if [[ -n "${!file_env_var:-}" ]]; then - if [[ -r "${!file_env_var:-}" ]]; then - export "${env_var}=$(< "${!file_env_var}")" - unset "${file_env_var}" - else - warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." - fi - fi -done -unset mariadb_env_vars -export DB_FLAVOR="mariadb" - -# Paths -export DB_BASE_DIR="${BITNAMI_ROOT_DIR}/mariadb" -export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" -export DB_DATA_DIR="${DB_VOLUME_DIR}/data" -export DB_BIN_DIR="${DB_BASE_DIR}/bin" -export DB_SBIN_DIR="${DB_BASE_DIR}/sbin" -export DB_CONF_DIR="${DB_BASE_DIR}/conf" -export DB_DEFAULT_CONF_DIR="${DB_BASE_DIR}/conf.default" -export DB_LOGS_DIR="${DB_BASE_DIR}/logs" -export DB_TMP_DIR="${DB_BASE_DIR}/tmp" -export DB_CONF_FILE="${DB_CONF_DIR}/my.cnf" -export DB_PID_FILE="${DB_TMP_DIR}/mysqld.pid" -export DB_SOCKET_FILE="${DB_TMP_DIR}/mysql.sock" -export PATH="${DB_SBIN_DIR}:${DB_BIN_DIR}:/opt/bitnami/common/bin:${PATH}" - -# System users (when running with a privileged user) -export DB_DAEMON_USER="mysql" -export DB_DAEMON_GROUP="mysql" - -# Default configuration (build-time) -export MARIADB_DEFAULT_PORT_NUMBER="3306" -export DB_DEFAULT_PORT_NUMBER="$MARIADB_DEFAULT_PORT_NUMBER" # only used at build time -export MARIADB_DEFAULT_CHARACTER_SET="utf8mb4" -export DB_DEFAULT_CHARACTER_SET="$MARIADB_DEFAULT_CHARACTER_SET" # only used at build time -export MARIADB_DEFAULT_BIND_ADDRESS="0.0.0.0" -export DB_DEFAULT_BIND_ADDRESS="$MARIADB_DEFAULT_BIND_ADDRESS" # only used at build time - -# MariaDB authentication. -export ALLOW_EMPTY_PASSWORD="${ALLOW_EMPTY_PASSWORD:-no}" -export MARIADB_AUTHENTICATION_PLUGIN="${MARIADB_AUTHENTICATION_PLUGIN:-}" -export DB_AUTHENTICATION_PLUGIN="$MARIADB_AUTHENTICATION_PLUGIN" -export MARIADB_ROOT_USER="${MARIADB_ROOT_USER:-root}" -export DB_ROOT_USER="$MARIADB_ROOT_USER" # only used during the first initialization -export MARIADB_ROOT_PASSWORD="${MARIADB_ROOT_PASSWORD:-}" -export DB_ROOT_PASSWORD="$MARIADB_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_USER="${MARIADB_USER:-}" -export DB_USER="$MARIADB_USER" # only used during the first initialization -export MARIADB_PASSWORD="${MARIADB_PASSWORD:-}" -export DB_PASSWORD="$MARIADB_PASSWORD" # only used during the first initialization -export MARIADB_DATABASE="${MARIADB_DATABASE:-}" -export DB_DATABASE="$MARIADB_DATABASE" # only used during the first initialization -export MARIADB_MASTER_HOST="${MARIADB_MASTER_HOST:-}" -export DB_MASTER_HOST="$MARIADB_MASTER_HOST" # only used during the first initialization -export MARIADB_MASTER_PORT_NUMBER="${MARIADB_MASTER_PORT_NUMBER:-3306}" -export DB_MASTER_PORT_NUMBER="$MARIADB_MASTER_PORT_NUMBER" # only used during the first initialization -export MARIADB_MASTER_ROOT_USER="${MARIADB_MASTER_ROOT_USER:-root}" -export DB_MASTER_ROOT_USER="$MARIADB_MASTER_ROOT_USER" # only used during the first initialization -export MARIADB_MASTER_ROOT_PASSWORD="${MARIADB_MASTER_ROOT_PASSWORD:-}" -export DB_MASTER_ROOT_PASSWORD="$MARIADB_MASTER_ROOT_PASSWORD" # only used during the first initialization -export MARIADB_MASTER_DELAY="${MARIADB_MASTER_DELAY:-0}" -export DB_MASTER_DELAY="$MARIADB_MASTER_DELAY" # only used during the first initialization -export MARIADB_REPLICATION_USER="${MARIADB_REPLICATION_USER:-}" -export DB_REPLICATION_USER="$MARIADB_REPLICATION_USER" # only used during the first initialization -export MARIADB_REPLICATION_PASSWORD="${MARIADB_REPLICATION_PASSWORD:-}" -export DB_REPLICATION_PASSWORD="$MARIADB_REPLICATION_PASSWORD" # only used during the first initialization - -# Settings -export MARIADB_PORT_NUMBER="${MARIADB_PORT_NUMBER:-}" -export DB_PORT_NUMBER="$MARIADB_PORT_NUMBER" -export MARIADB_REPLICATION_MODE="${MARIADB_REPLICATION_MODE:-}" -export DB_REPLICATION_MODE="$MARIADB_REPLICATION_MODE" -export MARIADB_REPLICATION_SLAVE_DUMP="${MARIADB_REPLICATION_SLAVE_DUMP:-false}" -export DB_REPLICATION_SLAVE_DUMP="$MARIADB_REPLICATION_SLAVE_DUMP" -export MARIADB_EXTRA_FLAGS="${MARIADB_EXTRA_FLAGS:-}" -export DB_EXTRA_FLAGS="$MARIADB_EXTRA_FLAGS" -export MARIADB_INIT_SLEEP_TIME="${MARIADB_INIT_SLEEP_TIME:-}" -export DB_INIT_SLEEP_TIME="$MARIADB_INIT_SLEEP_TIME" -export MARIADB_CHARACTER_SET="${MARIADB_CHARACTER_SET:-}" -export DB_CHARACTER_SET="$MARIADB_CHARACTER_SET" -# MARIADB_COLLATION is deprecated in favor of MARIADB_COLLATE -MARIADB_COLLATE="${MARIADB_COLLATE:-"${MARIADB_COLLATION:-}"}" -export MARIADB_COLLATE="${MARIADB_COLLATE:-}" -export DB_COLLATE="$MARIADB_COLLATE" -export MARIADB_BIND_ADDRESS="${MARIADB_BIND_ADDRESS:-}" -export DB_BIND_ADDRESS="$MARIADB_BIND_ADDRESS" -export MARIADB_SQL_MODE="${MARIADB_SQL_MODE:-}" -export DB_SQL_MODE="$MARIADB_SQL_MODE" -export MARIADB_UPGRADE="${MARIADB_UPGRADE:-AUTO}" -export DB_UPGRADE="$MARIADB_UPGRADE" -export MARIADB_SKIP_TEST_DB="${MARIADB_SKIP_TEST_DB:-no}" -export DB_SKIP_TEST_DB="$MARIADB_SKIP_TEST_DB" -export MARIADB_CLIENT_ENABLE_SSL="${MARIADB_CLIENT_ENABLE_SSL:-no}" -export DB_CLIENT_ENABLE_SSL="$MARIADB_CLIENT_ENABLE_SSL" -export MARIADB_CLIENT_SSL_CA_FILE="${MARIADB_CLIENT_SSL_CA_FILE:-}" -export DB_CLIENT_SSL_CA_FILE="$MARIADB_CLIENT_SSL_CA_FILE" -export MARIADB_CLIENT_SSL_CERT_FILE="${MARIADB_CLIENT_SSL_CERT_FILE:-}" -export DB_CLIENT_SSL_CERT_FILE="$MARIADB_CLIENT_SSL_CERT_FILE" -export MARIADB_CLIENT_SSL_KEY_FILE="${MARIADB_CLIENT_SSL_KEY_FILE:-}" -export DB_CLIENT_SSL_KEY_FILE="$MARIADB_CLIENT_SSL_KEY_FILE" -export MARIADB_CLIENT_EXTRA_FLAGS="${MARIADB_CLIENT_EXTRA_FLAGS:-no}" -export DB_CLIENT_EXTRA_FLAGS="$MARIADB_CLIENT_EXTRA_FLAGS" -export MARIADB_STARTUP_WAIT_RETRIES="${MARIADB_STARTUP_WAIT_RETRIES:-300}" -export DB_STARTUP_WAIT_RETRIES="$MARIADB_STARTUP_WAIT_RETRIES" -export MARIADB_STARTUP_WAIT_SLEEP_TIME="${MARIADB_STARTUP_WAIT_SLEEP_TIME:-2}" -export DB_STARTUP_WAIT_SLEEP_TIME="$MARIADB_STARTUP_WAIT_SLEEP_TIME" -MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-"${DB_ENABLE_SLOW_QUERY:-}"}" -export MARIADB_ENABLE_SLOW_QUERY="${MARIADB_ENABLE_SLOW_QUERY:-0}" -export DB_ENABLE_SLOW_QUERY="$MARIADB_ENABLE_SLOW_QUERY" -MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-"${DB_LONG_QUERY_TIME:-}"}" -export MARIADB_LONG_QUERY_TIME="${MARIADB_LONG_QUERY_TIME:-10.0}" -export DB_LONG_QUERY_TIME="$MARIADB_LONG_QUERY_TIME" - -# Custom environment variables may be defined below diff --git a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh b/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh deleted file mode 100755 index 5daeb16c64943..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/entrypoint.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libbitnami.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -print_welcome_page - -# We add the copy from default config in the entrypoint to not break users -# bypassing the setup.sh logic. If the file already exists do not overwrite (in -# case someone mounts a configuration file in /opt/bitnami/mariadb/conf) -debug "Copying files from $DB_DEFAULT_CONF_DIR to $DB_CONF_DIR" -cp -nr "$DB_DEFAULT_CONF_DIR"/. "$DB_CONF_DIR" - -if [[ "$1" = "/opt/bitnami/scripts/mariadb/run.sh" ]]; then - info "** Starting MariaDB setup **" - /opt/bitnami/scripts/mariadb/setup.sh - info "** MariaDB setup finished! **" -fi - -echo "" -exec "$@" diff --git a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh b/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh deleted file mode 100755 index 60211b1057f6e..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/healthcheck.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libmariadb.sh - -# Load MySQL environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -mysql_healthcheck diff --git a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh b/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh deleted file mode 100755 index ee8217ffb401c..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/postunpack.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Configure MariaDB options based on build-time defaults -info "Configuring default MariaDB options" -ensure_dir_exists "$DB_CONF_DIR" -mysql_create_default_config - -for dir in "$DB_TMP_DIR" "$DB_LOGS_DIR" "$DB_CONF_DIR" "$DB_DEFAULT_CONF_DIR" "${DB_CONF_DIR}/bitnami" "$DB_VOLUME_DIR" "$DB_DATA_DIR"; do - ensure_dir_exists "$dir" - chmod -R g+rwX "$dir" -done - -# Fix to avoid issues detecting plugins in mysql_install_db -ln -sf "$DB_BASE_DIR/plugin" "$DB_BASE_DIR/lib/plugin" - -# Redirect all logging to stdout -ln -sf "/proc/1/fd/1" "$DB_LOGS_DIR/mysqld.log" - -# Copy all initially generated configuration files to the default directory -# (this is to avoid breaking when entrypoint is being overridden) -cp -r "${DB_CONF_DIR}/"* "$DB_DEFAULT_CONF_DIR" diff --git a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh b/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh deleted file mode 100755 index 97f5d80c226f0..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/run.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# mysqld_safe does not allow logging to stdout/stderr, so we stick with mysqld -EXEC="${DB_SBIN_DIR}/mysqld" - -flags=("--defaults-file=${DB_CONF_DIR}/my.cnf" "--basedir=${DB_BASE_DIR}" "--datadir=${DB_DATA_DIR}" "--socket=${DB_SOCKET_FILE}") -[[ -z "${DB_PID_FILE:-}" ]] || flags+=("--pid-file=${DB_PID_FILE}") - -# Add flags specified via the 'DB_EXTRA_FLAGS' environment variable -read -r -a db_extra_flags <<< "$(mysql_extra_flags)" -[[ "${#db_extra_flags[@]}" -gt 0 ]] && flags+=("${db_extra_flags[@]}") - -# Add flags passed to this script -flags+=("$@") - -# Fix for MDEV-16183 - mysqld_safe already does this, but we are using mysqld -LD_PRELOAD="$(find_jemalloc_lib)${LD_PRELOAD:+ "$LD_PRELOAD"}" -export LD_PRELOAD - -info "** Starting MariaDB **" -if am_i_root; then - exec_as_user "$DB_DAEMON_USER" "$EXEC" "${flags[@]}" -else - exec "$EXEC" "${flags[@]}" -fi diff --git a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh b/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh deleted file mode 100755 index 9dcc55c047ade..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/rootfs/opt/bitnami/scripts/mariadb/setup.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# shellcheck disable=SC1091 - -set -o errexit -set -o nounset -set -o pipefail -# set -o xtrace # Uncomment this line for debugging purposes - -# Load libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/libmariadb.sh - -# Load MariaDB environment variables -. /opt/bitnami/scripts/mariadb-env.sh - -# Ensure mysql unix socket file does not exist -rm -rf "${DB_SOCKET_FILE}.lock" -# Ensure MariaDB environment variables settings are valid -mysql_validate -# Ensure MariaDB is stopped when this script ends. -trap "mysql_stop" EXIT -if am_i_root; then - # Ensure 'daemon' user exists when running as 'root' - ensure_user_exists "$DB_DAEMON_USER" --group "$DB_DAEMON_GROUP" - # Fix logging issue when running as root - chmod o+w "$(readlink /dev/stdout)" -fi -# Ensure MariaDB is initialized -mysql_initialize -# Allow running custom initialization scripts -mysql_custom_scripts 'init' -# Allow running custom start scripts -mysql_custom_scripts 'start' -# Stop MariaDB before flagging it as fully initialized. -# Relying only on the trap defined above could produce a race condition. -mysql_stop diff --git a/bitnami/mariadb/11.6/debian-12/tags-info.yaml b/bitnami/mariadb/11.6/debian-12/tags-info.yaml deleted file mode 100644 index d133693c80ab4..0000000000000 --- a/bitnami/mariadb/11.6/debian-12/tags-info.yaml +++ /dev/null @@ -1,4 +0,0 @@ -rolling-tags: -- "11.6" -- 11.6-debian-12 -- 11.6.2 diff --git a/bitnami/mongodb-sharded/7.0/README.md b/bitnami/mongodb-sharded/7.0/README.md new file mode 100644 index 0000000000000..b98e51e1f3679 --- /dev/null +++ b/bitnami/mongodb-sharded/7.0/README.md @@ -0,0 +1,5 @@ +# Only latest stable branch maintained in the free Bitnami catalog + +Starting December 10th 2024, only the latest stable branch of any container will receive updates in the free Bitnami catalog. To access up-to-date releases for all upstream-supported branches, consider upgrading to Bitnami Premium. Previous versions already released will not be deleted. They are still available to pull from DockerHub. + +Please check the Bitnami Premium page in our partner Arrow's marketplace. See https://www.arrow.com/globalecs/na/vendors/bitnami?utm_source=GitHub&utm_medium=containers for more information. \ No newline at end of file diff --git a/bitnami/mongodb-sharded/7.0/debian-12/Dockerfile b/bitnami/mongodb-sharded/7.0/debian-12/Dockerfile deleted file mode 100644 index 68e548401e905..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/Dockerfile +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -FROM docker.io/bitnami/minideb:bookworm - -ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" -ARG TARGETARCH - -LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ - org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-12-09T22:32:31Z" \ - org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ - org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mongodb-sharded/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="7.0.15-debian-12-r2" \ - org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mongodb-sharded" \ - org.opencontainers.image.title="mongodb-sharded" \ - org.opencontainers.image.vendor="Broadcom, Inc." \ - org.opencontainers.image.version="7.0.15" - -ENV HOME="/" \ - OS_ARCH="${TARGETARCH:-amd64}" \ - OS_FLAVOUR="debian-12" \ - OS_NAME="linux" - -COPY prebuildfs / -SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] -# Install required system packages and dependencies -RUN install_packages ca-certificates curl libbrotli1 libcom-err2 libcurl4 libffi8 libgcc-s1 libgmp10 libgnutls30 libgssapi-krb5-2 libhogweed6 libidn2-0 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.5-0 libnettle8 libnghttp2-14 libp11-kit0 libpsl5 librtmp1 libsasl2-2 libssh2-1 libssl3 libtasn1-6 libunistring2 libzstd1 numactl procps zlib1g -RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ - COMPONENTS=( \ - "yq-4.44.6-0-linux-${OS_ARCH}-debian-12" \ - "wait-for-port-1.0.8-8-linux-${OS_ARCH}-debian-12" \ - "render-template-1.0.7-8-linux-${OS_ARCH}-debian-12" \ - "mongodb-shell-2.3.4-0-linux-${OS_ARCH}-debian-12" \ - "mongodb-7.0.15-0-linux-${OS_ARCH}-debian-12" \ - ) ; \ - for COMPONENT in "${COMPONENTS[@]}"; do \ - if [ ! -f "${COMPONENT}.tar.gz" ]; then \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \ - curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \ - fi ; \ - sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \ - tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \ - rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \ - done -RUN apt-get update && apt-get upgrade -y && \ - apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives -RUN chmod g+rwX /opt/bitnami -RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true -RUN ln -s /opt/bitnami/scripts/mongodb-sharded/entrypoint.sh /entrypoint.sh -RUN ln -s /opt/bitnami/scripts/liblog.sh /liblog.sh -RUN ln -s /opt/bitnami/scripts/mongodb-sharded/run.sh /run.sh - -COPY rootfs / -RUN /opt/bitnami/scripts/mongodb-sharded/postunpack.sh -ENV APP_VERSION="7.0.15" \ - BITNAMI_APP_NAME="mongodb-sharded" \ - PATH="/opt/bitnami/common/bin:/opt/bitnami/mongodb/bin:$PATH" - -EXPOSE 27017 - -USER 1001 -ENTRYPOINT [ "/opt/bitnami/scripts/mongodb-sharded/entrypoint.sh" ] -CMD [ "/opt/bitnami/scripts/mongodb-sharded/run.sh" ] diff --git a/bitnami/mongodb-sharded/7.0/debian-12/docker-compose-multiple-shards.yml b/bitnami/mongodb-sharded/7.0/debian-12/docker-compose-multiple-shards.yml deleted file mode 100644 index 6abd1ce730eac..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/docker-compose-multiple-shards.yml +++ /dev/null @@ -1,154 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mongodb-sharded: - image: docker.io/bitnami/mongodb-sharded:7.0 - environment: - - MONGODB_ADVERTISED_HOSTNAME=mongodb-sharded - - MONGODB_SHARDING_MODE=mongos - - MONGODB_CFG_PRIMARY_HOST=mongodb-cfg-primary - - MONGODB_CFG_REPLICA_SET_NAME=cfgreplicaset - - MONGODB_REPLICA_SET_KEY=replicasetkey123 - - MONGODB_ROOT_PASSWORD=password123 - ports: - - "27017:27017" - - mongodb-sharded-2: - image: docker.io/bitnami/mongodb-sharded:7.0 - environment: - - MONGODB_ADVERTISED_HOSTNAME=mongodb-sharded-2 - - MONGODB_SHARDING_MODE=mongos - - MONGODB_CFG_PRIMARY_HOST=mongodb-cfg-primary - - MONGODB_CFG_REPLICA_SET_NAME=cfgreplicaset - - MONGODB_REPLICA_SET_KEY=replicasetkey123 - - MONGODB_ROOT_PASSWORD=password123 - - mongodb-shard0-primary: - image: docker.io/bitnami/mongodb-sharded:7.0 - environment: - - MONGODB_ADVERTISED_HOSTNAME=mongodb-shard0-primary - - MONGODB_SHARDING_MODE=shardsvr - - MONGODB_MONGOS_HOST=mongodb-sharded - - MONGODB_ROOT_PASSWORD=password123 - - MONGODB_REPLICA_SET_MODE=primary - - MONGODB_REPLICA_SET_KEY=replicasetkey123 - - MONGODB_REPLICA_SET_NAME=shard0 - volumes: - - 'shard0_data:/bitnami' - - mongodb-shard0-secondary: - image: docker.io/bitnami/mongodb-sharded:7.0 - depends_on: - - mongodb-shard0-primary - environment: - - MONGODB_ADVERTISED_HOSTNAME=mongodb-shard0-secondary - - MONGODB_REPLICA_SET_MODE=secondary - - MONGODB_PRIMARY_HOST=mongodb-shard0-primary - - MONGODB_PRIMARY_ROOT_PASSWORD=password123 - - MONGODB_REPLICA_SET_KEY=replicasetkey123 - - MONGODB_SHARDING_MODE=shardsvr - - MONGODB_REPLICA_SET_NAME=shard0 - volumes: - - 'shard0_sec_data:/bitnami' - - mongodb-shard1-primary: - image: docker.io/bitnami/mongodb-sharded:7.0 - environment: - - MONGODB_ADVERTISED_HOSTNAME=mongodb-shard1-primary - - MONGODB_SHARDING_MODE=shardsvr - - MONGODB_MONGOS_HOST=mongodb-sharded - - MONGODB_ROOT_PASSWORD=password123 - - MONGODB_REPLICA_SET_MODE=primary - - MONGODB_REPLICA_SET_KEY=replicasetkey123 - - MONGODB_REPLICA_SET_NAME=shard1 - volumes: - - 'shard1_data:/bitnami' - - mongodb-shard1-secondary: - image: docker.io/bitnami/mongodb-sharded:7.0 - depends_on: - - mongodb-shard1-primary - environment: - - MONGODB_ADVERTISED_HOSTNAME=mongodb-shard1-secondary - - MONGODB_REPLICA_SET_MODE=secondary - - MONGODB_PRIMARY_HOST=mongodb-shard1-primary - - MONGODB_PRIMARY_ROOT_PASSWORD=password123 - - MONGODB_REPLICA_SET_KEY=replicasetkey123 - - MONGODB_SHARDING_MODE=shardsvr - - MONGODB_REPLICA_SET_NAME=shard1 - volumes: - - 'shard1_sec_data:/bitnami' - - mongodb-shard2-primary: - image: docker.io/bitnami/mongodb-sharded:7.0 - environment: - - MONGODB_ADVERTISED_HOSTNAME=mongodb-shard2-primary - - MONGODB_SHARDING_MODE=shardsvr - - MONGODB_MONGOS_HOST=mongodb-sharded - - MONGODB_ROOT_PASSWORD=password123 - - MONGODB_REPLICA_SET_MODE=primary - - MONGODB_REPLICA_SET_KEY=replicasetkey123 - - MONGODB_REPLICA_SET_NAME=shard2 - volumes: - - 'shard2_data:/bitnami' - - mongodb-shard2-secondary: - image: docker.io/bitnami/mongodb-sharded:7.0 - depends_on: - - mongodb-shard2-primary - environment: - - MONGODB_ADVERTISED_HOSTNAME=mongodb-shard2-secondary - - MONGODB_REPLICA_SET_MODE=secondary - - MONGODB_PRIMARY_HOST=mongodb-shard2-primary - - MONGODB_PRIMARY_ROOT_PASSWORD=password123 - - MONGODB_REPLICA_SET_KEY=replicasetkey123 - - MONGODB_SHARDING_MODE=shardsvr - - MONGODB_REPLICA_SET_NAME=shard2 - volumes: - - 'shard2_sec_data:/bitnami' - - mongodb-cfg-primary: - image: docker.io/bitnami/mongodb-sharded:7.0 - environment: - - MONGODB_ADVERTISED_HOSTNAME=mongodb-cfg-primary - - MONGODB_SHARDING_MODE=configsvr - - MONGODB_ROOT_PASSWORD=password123 - - MONGODB_REPLICA_SET_MODE=primary - - MONGODB_REPLICA_SET_KEY=replicasetkey123 - - MONGODB_REPLICA_SET_NAME=cfgreplicaset - volumes: - - 'cfg_data:/bitnami' - - mongodb-cfg-secondary: - image: docker.io/bitnami/mongodb-sharded:7.0 - depends_on: - - mongodb-cfg-primary - environment: - - MONGODB_ADVERTISED_HOSTNAME=mongodb-cfg-secondary - - MONGODB_REPLICA_SET_MODE=secondary - - MONGODB_PRIMARY_HOST=mongodb-cfg-primary - - MONGODB_PRIMARY_ROOT_PASSWORD=password123 - - MONGODB_REPLICA_SET_KEY=replicasetkey123 - - MONGODB_REPLICA_SET_NAME=cfgreplicaset - - MONGODB_SHARDING_MODE=configsvr - volumes: - - 'cfg_sec_data:/bitnami' - -volumes: - shard0_data: - driver: local - shard0_sec_data: - driver: local - shard1_data: - driver: local - shard1_sec_data: - driver: local - shard2_data: - driver: local - shard2_sec_data: - driver: local - cfg_data: - driver: local - cfg_sec_data: - driver: local diff --git a/bitnami/mongodb-sharded/7.0/debian-12/docker-compose.yml b/bitnami/mongodb-sharded/7.0/debian-12/docker-compose.yml deleted file mode 100644 index 76e4e18f4b267..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/docker-compose.yml +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -services: - mongodb-sharded: - image: docker.io/bitnami/mongodb-sharded:7.0 - environment: - - MONGODB_ADVERTISED_HOSTNAME=mongodb-sharded - - MONGODB_SHARDING_MODE=mongos - - MONGODB_CFG_PRIMARY_HOST=mongodb-cfg - - MONGODB_CFG_REPLICA_SET_NAME=cfgreplicaset - - MONGODB_REPLICA_SET_KEY=replicasetkey123 - - MONGODB_ROOT_PASSWORD=password123 - ports: - - "27017:27017" - - mongodb-shard0: - image: docker.io/bitnami/mongodb-sharded:7.0 - environment: - - MONGODB_ADVERTISED_HOSTNAME=mongodb-shard0 - - MONGODB_SHARDING_MODE=shardsvr - - MONGODB_MONGOS_HOST=mongodb-sharded - - MONGODB_ROOT_PASSWORD=password123 - - MONGODB_REPLICA_SET_MODE=primary - - MONGODB_REPLICA_SET_KEY=replicasetkey123 - - MONGODB_REPLICA_SET_NAME=shard0 - volumes: - - 'shard0_data:/bitnami' - - mongodb-cfg: - image: docker.io/bitnami/mongodb-sharded:7.0 - environment: - - MONGODB_ADVERTISED_HOSTNAME=mongodb-cfg - - MONGODB_SHARDING_MODE=configsvr - - MONGODB_ROOT_PASSWORD=password123 - - MONGODB_REPLICA_SET_MODE=primary - - MONGODB_REPLICA_SET_KEY=replicasetkey123 - - MONGODB_REPLICA_SET_NAME=cfgreplicaset - volumes: - - 'cfg_data:/bitnami' - -volumes: - shard0_data: - driver: local - cfg_data: - driver: local diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json deleted file mode 100644 index fd083c99ad964..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "mongodb": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "7.0.15-0" - }, - "mongodb-shell": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "2.3.4-0" - }, - "render-template": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.7-8" - }, - "wait-for-port": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "1.0.8-8" - }, - "yq": { - "arch": "amd64", - "distro": "debian-12", - "type": "NAMI", - "version": "4.44.6-0" - } -} \ No newline at end of file diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt deleted file mode 100644 index 76956b38e82c6..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/licenses/licenses.txt +++ /dev/null @@ -1,2 +0,0 @@ -Bitnami containers ship with software bundles. You can find the licenses under: -/opt/bitnami/[name-of-bundle]/licenses/[bundle-version].txt diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh deleted file mode 100644 index d239f98535735..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libbitnami.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami custom library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Constants -BOLD='\033[1m' - -# Functions - -######################## -# Print the welcome page -# Globals: -# DISABLE_WELCOME_MESSAGE -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_welcome_page() { - if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then - if [[ -n "$BITNAMI_APP_NAME" ]]; then - print_image_welcome_page - fi - fi -} - -######################## -# Print the welcome page for a Bitnami Docker image -# Globals: -# BITNAMI_APP_NAME -# Arguments: -# None -# Returns: -# None -######################### -print_image_welcome_page() { - local github_url="https://github.com/bitnami/containers" - - info "" - info "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}" - info "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}" - info "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}" - info "Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit ${BOLD}https://bitnami.com/enterprise${RESET}" - info "" -} - diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh deleted file mode 100644 index 1c69e0e48a5d0..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing files - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libos.sh - -# Functions - -######################## -# Replace a regex-matching string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# $4 - use POSIX regex. Default: true -# Returns: -# None -######################### -replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Replace a regex-matching multiline string in a file -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - substitute regex -# Returns: -# None -######################### -replace_in_file_multiline() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - - local result - local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - result="$(perl -pe "BEGIN{undef $/;} s${del}${match_regex}${del}${substitute_regex}${del}sg" "$filename")" - echo "$result" > "$filename" -} - -######################## -# Remove a line in a file based on a regex -# Arguments: -# $1 - filename -# $2 - match regex -# $3 - use POSIX regex. Default: true -# Returns: -# None -######################### -remove_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local posix_regex=${3:-true} - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - if [[ $posix_regex = true ]]; then - result="$(sed -E "/$match_regex/d" "$filename")" - else - result="$(sed "/$match_regex/d" "$filename")" - fi - echo "$result" > "$filename" -} - -######################## -# Appends text after the last line matching a pattern -# Arguments: -# $1 - file -# $2 - match regex -# $3 - contents to add -# Returns: -# None -######################### -append_file_after_last_match() { - local file="${1:?missing file}" - local match_regex="${2:?missing pattern}" - local value="${3:?missing value}" - - # We read the file in reverse, replace the first match (0,/pattern/s) and then reverse the results again - result="$(tac "$file" | sed -E "0,/($match_regex)/s||${value}\n\1|" | tac)" - echo "$result" > "$file" -} - -######################## -# Wait until certain entry is present in a log file -# Arguments: -# $1 - entry to look for -# $2 - log file -# $3 - max retries. Default: 12 -# $4 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -wait_for_log_entry() { - local -r entry="${1:-missing entry}" - local -r log_file="${2:-missing log file}" - local -r retries="${3:-12}" - local -r interval_time="${4:-5}" - local attempt=0 - - check_log_file_for_entry() { - if ! grep -qE "$entry" "$log_file"; then - debug "Entry \"${entry}\" still not present in ${log_file} (attempt $((++attempt))/${retries})" - return 1 - fi - } - debug "Checking that ${log_file} log file contains entry \"${entry}\"" - if retry_while check_log_file_for_entry "$retries" "$interval_time"; then - debug "Found entry \"${entry}\" in ${log_file}" - true - else - error "Could not find entry \"${entry}\" in ${log_file} after ${retries} retries" - debug_execute cat "$log_file" - return 1 - fi -} diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh deleted file mode 100644 index 970d624179642..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libfs.sh +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for file system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Ensure a file/directory is owned (user and group) but the given user -# Arguments: -# $1 - filepath -# $2 - owner -# Returns: -# None -######################### -owned_by() { - local path="${1:?path is missing}" - local owner="${2:?owner is missing}" - local group="${3:-}" - - if [[ -n $group ]]; then - chown "$owner":"$group" "$path" - else - chown "$owner":"$owner" "$path" - fi -} - -######################## -# Ensure a directory exists and, optionally, is owned by the given user -# Arguments: -# $1 - directory -# $2 - owner -# Returns: -# None -######################### -ensure_dir_exists() { - local dir="${1:?directory is missing}" - local owner_user="${2:-}" - local owner_group="${3:-}" - - [ -d "${dir}" ] || mkdir -p "${dir}" - if [[ -n $owner_user ]]; then - owned_by "$dir" "$owner_user" "$owner_group" - fi -} - -######################## -# Checks whether a directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_dir_empty() { - local -r path="${1:?missing directory}" - # Calculate real path in order to avoid issues with symlinks - local -r dir="$(realpath "$path")" - if [[ ! -e "$dir" ]] || [[ -z "$(ls -A "$dir")" ]]; then - true - else - false - fi -} - -######################## -# Checks whether a mounted directory is empty or not -# arguments: -# $1 - directory -# returns: -# boolean -######################### -is_mounted_dir_empty() { - local dir="${1:?missing directory}" - - if is_dir_empty "$dir" || find "$dir" -mindepth 1 -maxdepth 1 -not -name ".snapshot" -not -name "lost+found" -exec false {} +; then - true - else - false - fi -} - -######################## -# Checks whether a file can be written to or not -# arguments: -# $1 - file -# returns: -# boolean -######################### -is_file_writable() { - local file="${1:?missing file}" - local dir - dir="$(dirname "$file")" - - if [[ (-f "$file" && -w "$file") || (! -f "$file" && -d "$dir" && -w "$dir") ]]; then - true - else - false - fi -} - -######################## -# Relativize a path -# arguments: -# $1 - path -# $2 - base -# returns: -# None -######################### -relativize() { - local -r path="${1:?missing path}" - local -r base="${2:?missing base}" - pushd "$base" >/dev/null || exit - realpath -q --no-symlinks --relative-base="$base" "$path" | sed -e 's|^/$|.|' -e 's|^/||' - popd >/dev/null || exit -} - -######################## -# Configure permisions and ownership recursively -# Globals: -# None -# Arguments: -# $1 - paths (as a string). -# Flags: -# -f|--file-mode - mode for directories. -# -d|--dir-mode - mode for files. -# -u|--user - user -# -g|--group - group -# Returns: -# None -######################### -configure_permissions_ownership() { - local -r paths="${1:?paths is missing}" - local dir_mode="" - local file_mode="" - local user="" - local group="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -f | --file-mode) - shift - file_mode="${1:?missing mode for files}" - ;; - -d | --dir-mode) - shift - dir_mode="${1:?missing mode for directories}" - ;; - -u | --user) - shift - user="${1:?missing user}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - read -r -a filepaths <<<"$paths" - for p in "${filepaths[@]}"; do - if [[ -e "$p" ]]; then - find -L "$p" -printf "" - if [[ -n $dir_mode ]]; then - find -L "$p" -type d ! -perm "$dir_mode" -print0 | xargs -r -0 chmod "$dir_mode" - fi - if [[ -n $file_mode ]]; then - find -L "$p" -type f ! -perm "$file_mode" -print0 | xargs -r -0 chmod "$file_mode" - fi - if [[ -n $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}:${group}" - elif [[ -n $user ]] && [[ -z $group ]]; then - find -L "$p" -print0 | xargs -r -0 chown "${user}" - elif [[ -z $user ]] && [[ -n $group ]]; then - find -L "$p" -print0 | xargs -r -0 chgrp "${group}" - fi - else - stderr_print "$p does not exist" - fi - done -} diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh deleted file mode 100644 index f3a5fe7868eed..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library to use for scripts expected to be used as Kubernetes lifecycle hooks - -# shellcheck disable=SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libos.sh - -# Override functions that log to stdout/stderr of the current process, so they print to process 1 -for function_to_override in stderr_print debug_execute; do - # Output is sent to output of process 1 and thus end up in the container log - # The hook output in general isn't saved - eval "$(declare -f "$function_to_override") >/proc/1/fd/1 2>/proc/1/fd/2" -done diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh deleted file mode 100644 index 450f05bd823ff..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/liblog.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for logging functions - -# Constants -RESET='\033[0m' -RED='\033[38;5;1m' -GREEN='\033[38;5;2m' -YELLOW='\033[38;5;3m' -MAGENTA='\033[38;5;5m' -CYAN='\033[38;5;6m' - -# Functions - -######################## -# Print to STDERR -# Arguments: -# Message to print -# Returns: -# None -######################### -stderr_print() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_QUIET:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - printf "%b\\n" "${*}" >&2 - fi -} - -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -log() { - stderr_print "${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")${RESET}${*}" -} -######################## -# Log an 'info' message -# Arguments: -# Message to log -# Returns: -# None -######################### -info() { - log "${GREEN}INFO ${RESET} ==> ${*}" -} -######################## -# Log message -# Arguments: -# Message to log -# Returns: -# None -######################### -warn() { - log "${YELLOW}WARN ${RESET} ==> ${*}" -} -######################## -# Log an 'error' message -# Arguments: -# Message to log -# Returns: -# None -######################### -error() { - log "${RED}ERROR${RESET} ==> ${*}" -} -######################## -# Log a 'debug' message -# Globals: -# BITNAMI_DEBUG -# Arguments: -# None -# Returns: -# None -######################### -debug() { - # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it - local bool="${BITNAMI_DEBUG:-false}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - log "${MAGENTA}DEBUG${RESET} ==> ${*}" - fi -} - -######################## -# Indent a string -# Arguments: -# $1 - string -# $2 - number of indentation characters (default: 4) -# $3 - indentation character (default: " ") -# Returns: -# None -######################### -indent() { - local string="${1:-}" - local num="${2:?missing num}" - local char="${3:-" "}" - # Build the indentation unit string - local indent_unit="" - for ((i = 0; i < num; i++)); do - indent_unit="${indent_unit}${char}" - done - # shellcheck disable=SC2001 - # Complex regex, see https://github.com/koalaman/shellcheck/wiki/SC2001#exceptions - echo "$string" | sed "s/^/${indent_unit}/" -} diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh deleted file mode 100644 index 004e426fba178..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libnet.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for network functions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Resolve IP address for a host/domain (i.e. DNS lookup) -# Arguments: -# $1 - Hostname to resolve -# $2 - IP address version (v4, v6), leave empty for resolving to any version -# Returns: -# IP -######################### -dns_lookup() { - local host="${1:?host is missing}" - local ip_version="${2:-}" - getent "ahosts${ip_version}" "$host" | awk '/STREAM/ {print $1 }' | head -n 1 -} - -######################### -# Wait for a hostname and return the IP -# Arguments: -# $1 - hostname -# $2 - number of retries -# $3 - seconds to wait between retries -# Returns: -# - IP address that corresponds to the hostname -######################### -wait_for_dns_lookup() { - local hostname="${1:?hostname is missing}" - local retries="${2:-5}" - local seconds="${3:-1}" - check_host() { - if [[ $(dns_lookup "$hostname") == "" ]]; then - false - else - true - fi - } - # Wait for the host to be ready - retry_while "check_host ${hostname}" "$retries" "$seconds" - dns_lookup "$hostname" -} - -######################## -# Get machine's IP -# Arguments: -# None -# Returns: -# Machine IP -######################### -get_machine_ip() { - local -a ip_addresses - local hostname - hostname="$(hostname)" - read -r -a ip_addresses <<< "$(dns_lookup "$hostname" | xargs echo)" - if [[ "${#ip_addresses[@]}" -gt 1 ]]; then - warn "Found more than one IP address associated to hostname ${hostname}: ${ip_addresses[*]}, will use ${ip_addresses[0]}" - elif [[ "${#ip_addresses[@]}" -lt 1 ]]; then - error "Could not find any IP address associated to hostname ${hostname}" - exit 1 - fi - # Check if the first IP address is IPv6 to add brackets - if validate_ipv6 "${ip_addresses[0]}" ; then - echo "[${ip_addresses[0]}]" - else - echo "${ip_addresses[0]}" - fi -} - -######################## -# Check if the provided argument is a resolved hostname -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_hostname_resolved() { - local -r host="${1:?missing value}" - if [[ -n "$(dns_lookup "$host")" ]]; then - true - else - false - fi -} - -######################## -# Parse URL -# Globals: -# None -# Arguments: -# $1 - uri - String -# $2 - component to obtain. Valid options (scheme, authority, userinfo, host, port, path, query or fragment) - String -# Returns: -# String -parse_uri() { - local uri="${1:?uri is missing}" - local component="${2:?component is missing}" - - # Solution based on https://tools.ietf.org/html/rfc3986#appendix-B with - # additional sub-expressions to split authority into userinfo, host and port - # Credits to Patryk Obara (see https://stackoverflow.com/a/45977232/6694969) - local -r URI_REGEX='^(([^:/?#]+):)?(//((([^@/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))?(\?([^#]*))?(#(.*))?' - # || | ||| | | | | | | | | | - # |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment - # 1 scheme: | |5 userinfo@ 8 :... 10 path 12 ?... 14 #... - # | 4 authority - # 3 //... - local index=0 - case "$component" in - scheme) - index=2 - ;; - authority) - index=4 - ;; - userinfo) - index=6 - ;; - host) - index=7 - ;; - port) - index=9 - ;; - path) - index=10 - ;; - query) - index=13 - ;; - fragment) - index=14 - ;; - *) - stderr_print "unrecognized component $component" - return 1 - ;; - esac - [[ "$uri" =~ $URI_REGEX ]] && echo "${BASH_REMATCH[${index}]}" -} - -######################## -# Wait for a HTTP connection to succeed -# Globals: -# * -# Arguments: -# $1 - URL to wait for -# $2 - Maximum amount of retries (optional) -# $3 - Time between retries (optional) -# Returns: -# true if the HTTP connection succeeded, false otherwise -######################### -wait_for_http_connection() { - local url="${1:?missing url}" - local retries="${2:-}" - local sleep_time="${3:-}" - if ! retry_while "debug_execute curl --silent ${url}" "$retries" "$sleep_time"; then - error "Could not connect to ${url}" - return 1 - fi -} diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh deleted file mode 100644 index 9d908c48579b9..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libos.sh +++ /dev/null @@ -1,657 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for operating system actions - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libvalidations.sh - -# Functions - -######################## -# Check if an user exists in the system -# Arguments: -# $1 - user -# Returns: -# Boolean -######################### -user_exists() { - local user="${1:?user is missing}" - id "$user" >/dev/null 2>&1 -} - -######################## -# Check if a group exists in the system -# Arguments: -# $1 - group -# Returns: -# Boolean -######################### -group_exists() { - local group="${1:?group is missing}" - getent group "$group" >/dev/null 2>&1 -} - -######################## -# Create a group in the system if it does not exist already -# Arguments: -# $1 - group -# Flags: -# -i|--gid - the ID for the new group -# -s|--system - Whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_group_exists() { - local group="${1:?group is missing}" - local gid="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --gid) - shift - gid="${1:?missing gid}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! group_exists "$group"; then - local -a args=("$group") - if [[ -n "$gid" ]]; then - if group_exists "$gid"; then - error "The GID $gid is already in use." >&2 - return 1 - fi - args+=("--gid" "$gid") - fi - $is_system_user && args+=("--system") - groupadd "${args[@]}" >/dev/null 2>&1 - fi -} - -######################## -# Create an user in the system if it does not exist already -# Arguments: -# $1 - user -# Flags: -# -i|--uid - the ID for the new user -# -g|--group - the group the new user should belong to -# -a|--append-groups - comma-separated list of supplemental groups to append to the new user -# -h|--home - the home directory for the new user -# -s|--system - whether to create new user as system user (uid <= 999) -# Returns: -# None -######################### -ensure_user_exists() { - local user="${1:?user is missing}" - local uid="" - local group="" - local append_groups="" - local home="" - local is_system_user=false - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -i | --uid) - shift - uid="${1:?missing uid}" - ;; - -g | --group) - shift - group="${1:?missing group}" - ;; - -a | --append-groups) - shift - append_groups="${1:?missing append_groups}" - ;; - -h | --home) - shift - home="${1:?missing home directory}" - ;; - -s | --system) - is_system_user=true - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - - if ! user_exists "$user"; then - local -a user_args=("-N" "$user") - if [[ -n "$uid" ]]; then - if user_exists "$uid"; then - error "The UID $uid is already in use." - return 1 - fi - user_args+=("--uid" "$uid") - else - $is_system_user && user_args+=("--system") - fi - useradd "${user_args[@]}" >/dev/null 2>&1 - fi - - if [[ -n "$group" ]]; then - local -a group_args=("$group") - $is_system_user && group_args+=("--system") - ensure_group_exists "${group_args[@]}" - usermod -g "$group" "$user" >/dev/null 2>&1 - fi - - if [[ -n "$append_groups" ]]; then - local -a groups - read -ra groups <<<"$(tr ',;' ' ' <<<"$append_groups")" - for group in "${groups[@]}"; do - ensure_group_exists "$group" - usermod -aG "$group" "$user" >/dev/null 2>&1 - done - fi - - if [[ -n "$home" ]]; then - mkdir -p "$home" - usermod -d "$home" "$user" >/dev/null 2>&1 - configure_permissions_ownership "$home" -d "775" -f "664" -u "$user" -g "$group" - fi -} - -######################## -# Check if the script is currently running as root -# Arguments: -# $1 - user -# $2 - group -# Returns: -# Boolean -######################### -am_i_root() { - if [[ "$(id -u)" = "0" ]]; then - true - else - false - fi -} - -######################## -# Print OS metadata -# Arguments: -# $1 - Flag name -# Flags: -# --id - Distro ID -# --version - Distro version -# --branch - Distro branch -# --codename - Distro codename -# --name - Distro name -# --pretty-name - Distro pretty name -# Returns: -# String -######################### -get_os_metadata() { - local -r flag_name="${1:?missing flag}" - # Helper function - get_os_release_metadata() { - local -r env_name="${1:?missing environment variable name}" - ( - . /etc/os-release - echo "${!env_name}" - ) - } - case "$flag_name" in - --id) - get_os_release_metadata ID - ;; - --version) - get_os_release_metadata VERSION_ID - ;; - --branch) - get_os_release_metadata VERSION_ID | sed 's/\..*//' - ;; - --codename) - get_os_release_metadata VERSION_CODENAME - ;; - --name) - get_os_release_metadata NAME - ;; - --pretty-name) - get_os_release_metadata PRETTY_NAME - ;; - *) - error "Unknown flag ${flag_name}" - return 1 - ;; - esac -} - -######################## -# Get total memory available -# Arguments: -# None -# Returns: -# Memory in bytes -######################### -get_total_memory() { - echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# None -# Flags: -# --memory - memory size (optional) -# Returns: -# Detected instance size -######################### -get_machine_size() { - local memory="" - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - --memory) - shift - memory="${1:?missing memory}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if [[ -z "$memory" ]]; then - debug "Memory was not specified, detecting available memory automatically" - memory="$(get_total_memory)" - fi - sanitized_memory=$(convert_to_mb "$memory") - if [[ "$sanitized_memory" -gt 26000 ]]; then - echo 2xlarge - elif [[ "$sanitized_memory" -gt 13000 ]]; then - echo xlarge - elif [[ "$sanitized_memory" -gt 6000 ]]; then - echo large - elif [[ "$sanitized_memory" -gt 3000 ]]; then - echo medium - elif [[ "$sanitized_memory" -gt 1500 ]]; then - echo small - else - echo micro - fi -} - -######################## -# Get machine size depending on specified memory -# Globals: -# None -# Arguments: -# $1 - memory size (optional) -# Returns: -# Detected instance size -######################### -get_supported_machine_sizes() { - echo micro small medium large xlarge 2xlarge -} - -######################## -# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) -# Globals: -# None -# Arguments: -# $1 - memory size -# Returns: -# Result of the conversion -######################### -convert_to_mb() { - local amount="${1:-}" - if [[ $amount =~ ^([0-9]+)(m|M|g|G) ]]; then - size="${BASH_REMATCH[1]}" - unit="${BASH_REMATCH[2]}" - if [[ "$unit" = "g" || "$unit" = "G" ]]; then - amount="$((size * 1024))" - else - amount="$size" - fi - fi - echo "$amount" -} - -######################### -# Redirects output to /dev/null if debug mode is disabled -# Globals: -# BITNAMI_DEBUG -# Arguments: -# $@ - Command to execute -# Returns: -# None -######################### -debug_execute() { - if is_boolean_yes "${BITNAMI_DEBUG:-false}"; then - "$@" - else - "$@" >/dev/null 2>&1 - fi -} - -######################## -# Retries a command a given number of times -# Arguments: -# $1 - cmd (as a string) -# $2 - max retries. Default: 12 -# $3 - sleep between retries (in seconds). Default: 5 -# Returns: -# Boolean -######################### -retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - - read -r -a command <<<"$cmd" - for ((i = 1; i <= retries; i += 1)); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value -} - -######################## -# Generate a random string -# Arguments: -# -t|--type - String type (ascii, alphanumeric, numeric), defaults to ascii -# -c|--count - Number of characters, defaults to 32 -# Arguments: -# None -# Returns: -# None -# Returns: -# String -######################### -generate_random_string() { - local type="ascii" - local count="32" - local filter - local result - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - -t | --type) - shift - type="$1" - ;; - -c | --count) - shift - count="$1" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - # Validate type - case "$type" in - ascii) - filter="[:print:]" - ;; - numeric) - filter="0-9" - ;; - alphanumeric) - filter="a-zA-Z0-9" - ;; - alphanumeric+special|special+alphanumeric) - # Limit variety of special characters, so there is a higher chance of containing more alphanumeric characters - # Special characters are harder to write, and it could impact the overall UX if most passwords are too complex - filter='a-zA-Z0-9:@.,/+!=' - ;; - *) - echo "Invalid type ${type}" >&2 - return 1 - ;; - esac - # Obtain count + 10 lines from /dev/urandom to ensure that the resulting string has the expected size - # Note there is a very small chance of strings starting with EOL character - # Therefore, the higher amount of lines read, this will happen less frequently - result="$(head -n "$((count + 10))" /dev/urandom | tr -dc "$filter" | head -c "$count")" - echo "$result" -} - -######################## -# Create md5 hash from a string -# Arguments: -# $1 - string -# Returns: -# md5 hash - string -######################### -generate_md5_hash() { - local -r str="${1:?missing input string}" - echo -n "$str" | md5sum | awk '{print $1}' -} - -######################## -# Create sha1 hash from a string -# Arguments: -# $1 - string -# $2 - algorithm - 1 (default), 224, 256, 384, 512 -# Returns: -# sha1 hash - string -######################### -generate_sha_hash() { - local -r str="${1:?missing input string}" - local -r algorithm="${2:-1}" - echo -n "$str" | "sha${algorithm}sum" | awk '{print $1}' -} - -######################## -# Converts a string to its hexadecimal representation -# Arguments: -# $1 - string -# Returns: -# hexadecimal representation of the string -######################### -convert_to_hex() { - local -r str=${1:?missing input string} - local -i iterator - local char - for ((iterator = 0; iterator < ${#str}; iterator++)); do - char=${str:iterator:1} - printf '%x' "'${char}" - done -} - -######################## -# Get boot time -# Globals: -# None -# Arguments: -# None -# Returns: -# Boot time metadata -######################### -get_boot_time() { - stat /proc --format=%Y -} - -######################## -# Get machine ID -# Globals: -# None -# Arguments: -# None -# Returns: -# Machine ID -######################### -get_machine_id() { - local machine_id - if [[ -f /etc/machine-id ]]; then - machine_id="$(cat /etc/machine-id)" - fi - if [[ -z "$machine_id" ]]; then - # Fallback to the boot-time, which will at least ensure a unique ID in the current session - machine_id="$(get_boot_time)" - fi - echo "$machine_id" -} - -######################## -# Get the root partition's disk device ID (e.g. /dev/sda1) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root partition disk ID -######################### -get_disk_device_id() { - local device_id="" - if grep -q ^/dev /proc/mounts; then - device_id="$(grep ^/dev /proc/mounts | awk '$2 == "/" { print $1 }' | tail -1)" - fi - # If it could not be autodetected, fallback to /dev/sda1 as a default - if [[ -z "$device_id" || ! -b "$device_id" ]]; then - device_id="/dev/sda1" - fi - echo "$device_id" -} - -######################## -# Get the root disk device ID (e.g. /dev/sda) -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk ID -######################### -get_root_disk_device_id() { - get_disk_device_id | sed -E 's/p?[0-9]+$//' -} - -######################## -# Get the root disk size in bytes -# Globals: -# None -# Arguments: -# None -# Returns: -# Root disk size in bytes -######################### -get_root_disk_size() { - fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true -} - -######################## -# Run command as a specific user and group (optional) -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -run_as_user() { - run_chroot "$@" -} - -######################## -# Execute command as a specific user and group (optional), -# replacing the current process image -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Returns: -# Exit code of the specified command -######################### -exec_as_user() { - run_chroot --replace-process "$@" -} - -######################## -# Run a command using chroot -# Arguments: -# $1 - USER(:GROUP) to switch to -# $2..$n - command to execute -# Flags: -# -r | --replace-process - Replace the current process image (optional) -# Returns: -# Exit code of the specified command -######################### -run_chroot() { - local userspec - local user - local homedir - local replace=false - local -r cwd="$(pwd)" - - # Parse and validate flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -r | --replace-process) - replace=true - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - # Parse and validate arguments - if [[ "$#" -lt 2 ]]; then - echo "expected at least 2 arguments" - return 1 - else - userspec=$1 - shift - - # userspec can optionally include the group, so we parse the user - user=$(echo "$userspec" | cut -d':' -f1) - fi - - if ! am_i_root; then - error "Could not switch to '${userspec}': Operation not permitted" - return 1 - fi - - # Get the HOME directory for the user to switch, as chroot does - # not properly update this env and some scripts rely on it - homedir=$(eval echo "~${user}") - if [[ ! -d $homedir ]]; then - homedir="${HOME:-/}" - fi - - # Obtaining value for "$@" indirectly in order to properly support shell parameter expansion - if [[ "$replace" = true ]]; then - exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - else - chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@" - fi -} diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh deleted file mode 100644 index 18445e7d27fa3..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami persistence library -# Used for bringing persistence capabilities to applications that don't have clear separation of data and logic - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libfs.sh -. /opt/bitnami/scripts/libos.sh -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libversion.sh - -# Functions - -######################## -# Persist an application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# $2 - List of app files to persist -# Returns: -# true if all steps succeeded, false otherwise -######################### -persist_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_persist <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Persist the individual files - if [[ "${#files_to_persist[@]}" -le 0 ]]; then - warn "No files are configured to be persisted" - return - fi - pushd "$install_dir" >/dev/null || exit - local file_to_persist_relative file_to_persist_destination file_to_persist_destination_folder - local -r tmp_file="/tmp/perms.acl" - for file_to_persist in "${files_to_persist[@]}"; do - if [[ ! -f "$file_to_persist" && ! -d "$file_to_persist" ]]; then - error "Cannot persist '${file_to_persist}' because it does not exist" - return 1 - fi - file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" - file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" - file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions for existing files, which will be applied later - # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume - getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" - # Copy directories to the volume - ensure_dir_exists "$file_to_persist_destination_folder" - cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" - # Restore permissions - pushd "$persist_dir" >/dev/null || exit - if am_i_root; then - setfacl --restore="$tmp_file" - else - # When running as non-root, don't change ownership - setfacl --restore=<(grep -E -v '^# (owner|group):' "$tmp_file") - fi - popd >/dev/null || exit - done - popd >/dev/null || exit - rm -f "$tmp_file" - # Install the persisted files into the installation directory, via symlinks - restore_persisted_app "$@" -} - -######################## -# Restore a persisted application directory -# Globals: -# BITNAMI_ROOT_DIR -# BITNAMI_VOLUME_DIR -# FORCE_MAJOR_UPGRADE -# Arguments: -# $1 - App folder name -# $2 - List of app files to restore -# Returns: -# true if all steps succeeded, false otherwise -######################### -restore_persisted_app() { - local -r app="${1:?missing app}" - local -a files_to_restore - read -r -a files_to_restore <<< "$(tr ',;:' ' ' <<< "$2")" - local -r install_dir="${BITNAMI_ROOT_DIR}/${app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - # Restore the individual persisted files - if [[ "${#files_to_restore[@]}" -le 0 ]]; then - warn "No persisted files are configured to be restored" - return - fi - local file_to_restore_relative file_to_restore_origin file_to_restore_destination - for file_to_restore in "${files_to_restore[@]}"; do - file_to_restore_relative="$(relativize "$file_to_restore" "$install_dir")" - # We use 'realpath --no-symlinks' to ensure that the case of '.' is covered and the directory is removed - file_to_restore_origin="$(realpath --no-symlinks "${install_dir}/${file_to_restore_relative}")" - file_to_restore_destination="$(realpath --no-symlinks "${persist_dir}/${file_to_restore_relative}")" - rm -rf "$file_to_restore_origin" - ln -sfn "$file_to_restore_destination" "$file_to_restore_origin" - done -} - -######################## -# Check if an application directory was already persisted -# Globals: -# BITNAMI_VOLUME_DIR -# Arguments: -# $1 - App folder name -# Returns: -# true if all steps succeeded, false otherwise -######################### -is_app_initialized() { - local -r app="${1:?missing app}" - local -r persist_dir="${BITNAMI_VOLUME_DIR}/${app}" - if ! is_mounted_dir_empty "$persist_dir"; then - true - else - false - fi -} diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh deleted file mode 100644 index 1f9b33096b026..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libservice.sh +++ /dev/null @@ -1,496 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing services - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/liblog.sh - -# Functions - -######################## -# Read the provided pid file and returns a PID -# Arguments: -# $1 - Pid file -# Returns: -# PID -######################### -get_pid_from_file() { - local pid_file="${1:?pid file is missing}" - - if [[ -f "$pid_file" ]]; then - if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then - echo "$(< "$pid_file")" - fi - fi -} - -######################## -# Check if a provided PID corresponds to a running service -# Arguments: -# $1 - PID -# Returns: -# Boolean -######################### -is_service_running() { - local pid="${1:?pid is missing}" - - kill -0 "$pid" 2>/dev/null -} - -######################## -# Stop a service by sending a termination signal to its pid -# Arguments: -# $1 - Pid file -# $2 - Signal number (optional) -# Returns: -# None -######################### -stop_service_using_pid() { - local pid_file="${1:?pid file is missing}" - local signal="${2:-}" - local pid - - pid="$(get_pid_from_file "$pid_file")" - [[ -z "$pid" ]] || ! is_service_running "$pid" && return - - if [[ -n "$signal" ]]; then - kill "-${signal}" "$pid" - else - kill "$pid" - fi - - local counter=10 - while [[ "$counter" -ne 0 ]] && is_service_running "$pid"; do - sleep 1 - counter=$((counter - 1)) - done -} - -######################## -# Start cron daemon -# Arguments: -# None -# Returns: -# true if started correctly, false otherwise -######################### -cron_start() { - if [[ -x "/usr/sbin/cron" ]]; then - /usr/sbin/cron - elif [[ -x "/usr/sbin/crond" ]]; then - /usr/sbin/crond - else - false - fi -} - -######################## -# Generate a cron configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Command -# Flags: -# --run-as - User to run as (default: root) -# --schedule - Cron schedule configuration (default: * * * * *) -# Returns: -# None -######################### -generate_cron_conf() { - local service_name="${1:?service name is missing}" - local cmd="${2:?command is missing}" - local run_as="root" - local schedule="* * * * *" - local clean="true" - - # Parse optional CLI flags - shift 2 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --run-as) - shift - run_as="$1" - ;; - --schedule) - shift - schedule="$1" - ;; - --no-clean) - clean="false" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - mkdir -p /etc/cron.d - if "$clean"; then - cat > "/etc/cron.d/${service_name}" <> /etc/cron.d/"$service_name" - fi -} - -######################## -# Remove a cron configuration file for a given service -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_cron_conf() { - local service_name="${1:?service name is missing}" - local cron_conf_dir="/etc/monit/conf.d" - rm -f "${cron_conf_dir}/${service_name}" -} - -######################## -# Generate a monit configuration file for a given service -# Arguments: -# $1 - Service name -# $2 - Pid file -# $3 - Start command -# $4 - Stop command -# Flags: -# --disable - Whether to disable the monit configuration -# Returns: -# None -######################### -generate_monit_conf() { - local service_name="${1:?service name is missing}" - local pid_file="${2:?pid file is missing}" - local start_command="${3:?start command is missing}" - local stop_command="${4:?stop command is missing}" - local monit_conf_dir="/etc/monit/conf.d" - local disabled="no" - - # Parse optional CLI flags - shift 4 - while [[ "$#" -gt 0 ]]; do - case "$1" in - --disable) - disabled="yes" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - - is_boolean_yes "$disabled" && conf_suffix=".disabled" - mkdir -p "$monit_conf_dir" - cat > "${monit_conf_dir}/${service_name}.conf${conf_suffix:-}" <&2 - return 1 - ;; - esac - shift - done - - mkdir -p "$logrotate_conf_dir" - cat < "${logrotate_conf_dir}/${service_name}" -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -${log_path} { - ${period} - rotate ${rotations} - dateext - compress - copytruncate - missingok -$(indent "$extra" 2) -} -EOF -} - -######################## -# Remove a logrotate configuration file -# Arguments: -# $1 - Service name -# Returns: -# None -######################### -remove_logrotate_conf() { - local service_name="${1:?service name is missing}" - local logrotate_conf_dir="/etc/logrotate.d" - rm -f "${logrotate_conf_dir}/${service_name}" -} - -######################## -# Generate a Systemd configuration file -# Arguments: -# $1 - Service name -# Flags: -# --custom-service-content - Custom content to add to the [service] block -# --environment - Environment variable to define (multiple --environment options may be passed) -# --environment-file - Text file with environment variables (multiple --environment-file options may be passed) -# --exec-start - Start command (required) -# --exec-start-pre - Pre-start command (optional) -# --exec-start-post - Post-start command (optional) -# --exec-stop - Stop command (optional) -# --exec-reload - Reload command (optional) -# --group - System group to start the service with -# --name - Service full name (e.g. Apache HTTP Server, defaults to $1) -# --restart - When to restart the Systemd service after being stopped (defaults to always) -# --pid-file - Service PID file -# --standard-output - File where to print stdout output -# --standard-error - File where to print stderr output -# --success-exit-status - Exit code that indicates a successful shutdown -# --type - Systemd unit type (defaults to forking) -# --user - System user to start the service with -# --working-directory - Working directory at which to start the service -# Returns: -# None -######################### -generate_systemd_conf() { - local -r service_name="${1:?service name is missing}" - local -r systemd_units_dir="/etc/systemd/system" - local -r service_file="${systemd_units_dir}/bitnami.${service_name}.service" - # Default values - local name="$service_name" - local type="forking" - local user="" - local group="" - local environment="" - local environment_file="" - local exec_start="" - local exec_start_pre="" - local exec_start_post="" - local exec_stop="" - local exec_reload="" - local restart="always" - local pid_file="" - local standard_output="journal" - local standard_error="" - local limits_content="" - local success_exit_status="" - local custom_service_content="" - local working_directory="" - # Parse CLI flags - shift - while [[ "$#" -gt 0 ]]; do - case "$1" in - --name \ - | --type \ - | --user \ - | --group \ - | --exec-start \ - | --exec-stop \ - | --exec-reload \ - | --restart \ - | --pid-file \ - | --standard-output \ - | --standard-error \ - | --success-exit-status \ - | --custom-service-content \ - | --working-directory \ - ) - var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" - shift - declare "$var_name"="${1:?"${var_name} value is missing"}" - ;; - --limit-*) - [[ -n "$limits_content" ]] && limits_content+=$'\n' - var_name="${1//--limit-}" - shift - limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" - ;; - --exec-start-pre) - shift - [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' - exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" - ;; - --exec-start-post) - shift - [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' - exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" - ;; - --environment) - shift - # It is possible to add multiple environment lines - [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"--environment value is missing"}" - ;; - --environment-file) - shift - # It is possible to add multiple environment-file lines - [[ -n "$environment_file" ]] && environment_file+=$'\n' - environment_file+="EnvironmentFile=${1:?"--environment-file value is missing"}" - ;; - *) - echo "Invalid command line flag ${1}" >&2 - return 1 - ;; - esac - shift - done - # Validate inputs - local error="no" - if [[ -z "$exec_start" ]]; then - error "The --exec-start option is required" - error="yes" - fi - if [[ "$error" != "no" ]]; then - return 1 - fi - # Generate the Systemd unit - cat > "$service_file" <> "$service_file" <<< "WorkingDirectory=${working_directory}" - fi - if [[ -n "$exec_start_pre" ]]; then - # This variable may contain multiple ExecStartPre= directives - cat >> "$service_file" <<< "$exec_start_pre" - fi - if [[ -n "$exec_start" ]]; then - cat >> "$service_file" <<< "ExecStart=${exec_start}" - fi - if [[ -n "$exec_start_post" ]]; then - # This variable may contain multiple ExecStartPost= directives - cat >> "$service_file" <<< "$exec_start_post" - fi - # Optional stop and reload commands - if [[ -n "$exec_stop" ]]; then - cat >> "$service_file" <<< "ExecStop=${exec_stop}" - fi - if [[ -n "$exec_reload" ]]; then - cat >> "$service_file" <<< "ExecReload=${exec_reload}" - fi - # User and group - if [[ -n "$user" ]]; then - cat >> "$service_file" <<< "User=${user}" - fi - if [[ -n "$group" ]]; then - cat >> "$service_file" <<< "Group=${group}" - fi - # PID file allows to determine if the main process is running properly (for Restart=always) - if [[ -n "$pid_file" ]]; then - cat >> "$service_file" <<< "PIDFile=${pid_file}" - fi - if [[ -n "$restart" ]]; then - cat >> "$service_file" <<< "Restart=${restart}" - fi - # Environment flags - if [[ -n "$environment" ]]; then - # This variable may contain multiple Environment= directives - cat >> "$service_file" <<< "$environment" - fi - if [[ -n "$environment_file" ]]; then - # This variable may contain multiple EnvironmentFile= directives - cat >> "$service_file" <<< "$environment_file" - fi - # Logging - if [[ -n "$standard_output" ]]; then - cat >> "$service_file" <<< "StandardOutput=${standard_output}" - fi - if [[ -n "$standard_error" ]]; then - cat >> "$service_file" <<< "StandardError=${standard_error}" - fi - if [[ -n "$custom_service_content" ]]; then - # This variable may contain multiple miscellaneous directives - cat >> "$service_file" <<< "$custom_service_content" - fi - if [[ -n "$success_exit_status" ]]; then - cat >> "$service_file" <> "$service_file" <> "$service_file" <> "$service_file" <= 0 )); then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean or is the string 'yes/true' -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean yes/no value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_yes_no_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(yes|no)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean true/false value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_true_false_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^(true|false)$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is a boolean 1/0 value -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_1_0_value() { - local -r bool="${1:-}" - if [[ "$bool" =~ ^[10]$ ]]; then - true - else - false - fi -} - -######################## -# Check if the provided argument is an empty string or not defined -# Arguments: -# $1 - Value to check -# Returns: -# Boolean -######################### -is_empty_value() { - local -r val="${1:-}" - if [[ -z "$val" ]]; then - true - else - false - fi -} - -######################## -# Validate if the provided argument is a valid port -# Arguments: -# $1 - Port to validate -# Returns: -# Boolean and error message -######################### -validate_port() { - local value - local unprivileged=0 - - # Parse flags - while [[ "$#" -gt 0 ]]; do - case "$1" in - -unprivileged) - unprivileged=1 - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [[ "$#" -gt 1 ]]; then - echo "too many arguments provided" - return 2 - elif [[ "$#" -eq 0 ]]; then - stderr_print "missing port argument" - return 1 - else - value=$1 - fi - - if [[ -z "$value" ]]; then - echo "the value is empty" - return 1 - else - if ! is_int "$value"; then - echo "value is not an integer" - return 2 - elif [[ "$value" -lt 0 ]]; then - echo "negative value provided" - return 2 - elif [[ "$value" -gt 65535 ]]; then - echo "requested port is greater than 65535" - return 2 - elif [[ "$unprivileged" = 1 && "$value" -lt 1024 ]]; then - echo "privileged port requested" - return 3 - fi - fi -} - -######################## -# Validate if the provided argument is a valid IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv6() { - local ip="${1:?ip is missing}" - local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' - local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then - stat=0 - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ipv4() { - local ip="${1:?ip is missing}" - local stat=1 - - if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - read -r -a ip_array <<< "$(tr '.' ' ' <<< "$ip")" - [[ ${ip_array[0]} -le 255 && ${ip_array[1]} -le 255 \ - && ${ip_array[2]} -le 255 && ${ip_array[3]} -le 255 ]] - stat=$? - fi - return $stat -} - -######################## -# Validate if the provided argument is a valid IPv4 or IPv6 address -# Arguments: -# $1 - IP to validate -# Returns: -# Boolean -######################### -validate_ip() { - local ip="${1:?ip is missing}" - local stat=1 - - if validate_ipv4 "$ip"; then - stat=0 - else - stat=$(validate_ipv6 "$ip") - fi - return $stat -} - -######################## -# Validate a string format -# Arguments: -# $1 - String to validate -# Returns: -# Boolean -######################### -validate_string() { - local string - local min_length=-1 - local max_length=-1 - - # Parse flags - while [ "$#" -gt 0 ]; do - case "$1" in - -min-length) - shift - min_length=${1:-} - ;; - -max-length) - shift - max_length=${1:-} - ;; - --) - shift - break - ;; - -*) - stderr_print "unrecognized flag $1" - return 1 - ;; - *) - break - ;; - esac - shift - done - - if [ "$#" -gt 1 ]; then - stderr_print "too many arguments provided" - return 2 - elif [ "$#" -eq 0 ]; then - stderr_print "missing string" - return 1 - else - string=$1 - fi - - if [[ "$min_length" -ge 0 ]] && [[ "${#string}" -lt "$min_length" ]]; then - echo "string length is less than $min_length" - return 1 - fi - if [[ "$max_length" -ge 0 ]] && [[ "${#string}" -gt "$max_length" ]]; then - echo "string length is great than $max_length" - return 1 - fi -} diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh deleted file mode 100644 index f0d5a5cd33892..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libversion.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Library for managing versions strings - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh - -# Functions -######################## -# Gets semantic version -# Arguments: -# $1 - version: string to extract major.minor.patch -# $2 - section: 1 to extract major, 2 to extract minor, 3 to extract patch -# Returns: -# array with the major, minor and release -######################### -get_sematic_version () { - local version="${1:?version is required}" - local section="${2:?section is required}" - local -a version_sections - - #Regex to parse versions: x.y.z - local -r regex='([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?' - - if [[ "$version" =~ $regex ]]; then - local i=1 - local j=1 - local n=${#BASH_REMATCH[*]} - - while [[ $i -lt $n ]]; do - if [[ -n "${BASH_REMATCH[$i]}" ]] && [[ "${BASH_REMATCH[$i]:0:1}" != '.' ]]; then - version_sections[j]="${BASH_REMATCH[$i]}" - ((j++)) - fi - ((i++)) - done - - local number_regex='^[0-9]+$' - if [[ "$section" =~ $number_regex ]] && (( section > 0 )) && (( section <= 3 )); then - echo "${version_sections[$section]}" - return - else - stderr_print "Section allowed values are: 1, 2, and 3" - return 1 - fi - fi -} diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh deleted file mode 100644 index acb84fc2339bb..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ /dev/null @@ -1,476 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -# -# Bitnami web server handler library - -# shellcheck disable=SC1090,SC1091 - -# Load generic libraries -. /opt/bitnami/scripts/liblog.sh - -######################## -# Execute a command (or list of commands) with the web server environment and library loaded -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_execute() { - local -r web_server="${1:?missing web server}" - shift - # Run program in sub-shell to avoid web server environment getting loaded when not necessary - ( - . "/opt/bitnami/scripts/lib${web_server}.sh" - . "/opt/bitnami/scripts/${web_server}-env.sh" - "$@" - ) -} - -######################## -# Prints the list of enabled web servers -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_list() { - local -r -a supported_web_servers=(apache nginx) - local -a existing_web_servers=() - for web_server in "${supported_web_servers[@]}"; do - [[ -f "/opt/bitnami/scripts/${web_server}-env.sh" ]] && existing_web_servers+=("$web_server") - done - echo "${existing_web_servers[@]:-}" -} - -######################## -# Prints the currently-enabled web server type (only one, in order of preference) -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_type() { - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - echo "${web_servers[0]:-}" -} - -######################## -# Validate that a supported web server is configured -# Globals: -# None -# Arguments: -# None -# Returns: -# None -######################### -web_server_validate() { - local error_code=0 - local supported_web_servers=("apache" "nginx") - - # Auxiliary functions - print_validation_error() { - error "$1" - error_code=1 - } - - if [[ -z "$(web_server_type)" || ! " ${supported_web_servers[*]} " == *" $(web_server_type) "* ]]; then - print_validation_error "Could not detect any supported web servers. It must be one of: ${supported_web_servers[*]}" - elif ! web_server_execute "$(web_server_type)" type -t "is_$(web_server_type)_running" >/dev/null; then - print_validation_error "Could not load the $(web_server_type) web server library from /opt/bitnami/scripts. Check that it exists and is readable." - fi - - return "$error_code" -} - -######################## -# Check whether the web server is running -# Globals: -# * -# Arguments: -# None -# Returns: -# true if the web server is running, false otherwise -######################### -is_web_server_running() { - "is_$(web_server_type)_running" -} - -######################## -# Start web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_start() { - info "Starting $(web_server_type) in background" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl start "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/start.sh" - fi -} - -######################## -# Stop web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_stop() { - info "Stopping $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl stop "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/stop.sh" - fi -} - -######################## -# Restart web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_restart() { - info "Restarting $(web_server_type)" - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl restart "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/restart.sh" - fi -} - -######################## -# Reload web server -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_reload() { - if [[ "${BITNAMI_SERVICE_MANAGER:-}" = "systemd" ]]; then - systemctl reload "bitnami.$(web_server_type).service" - else - "${BITNAMI_ROOT_DIR}/scripts/$(web_server_type)/reload.sh" - fi -} - -######################## -# Ensure a web server application configuration exists (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --type - Application type, which has an effect on which configuration template to use -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --disable - Whether to render server configurations with a .disabled prefix -# --disable-http - Whether to render the app's HTTP server configuration with a .disabled prefix -# --disable-https - Whether to render the app's HTTPS server configuration with a .disabled prefix -# --http-port - HTTP port number -# --https-port - HTTPS port number -# --document-root - Path to document root directory -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-additional-http-configuration - Additional HTTP vhost configuration (no default) -# --apache-additional-https-configuration - Additional HTTPS vhost configuration (no default) -# --apache-before-vhost-configuration - Configuration to add before the directive (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no' and type is not defined) -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-proxy-address - Address where to proxy requests -# --apache-proxy-configuration - Extra configuration for the proxy -# --apache-proxy-http-configuration - Extra configuration for the proxy HTTP vhost -# --apache-proxy-https-configuration - Extra configuration for the proxy HTTPS vhost -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup (only allowed when type is not defined) -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# --nginx-external-configuration - Configuration external to server block (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_app_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --disable \ - | --disable-http \ - | --disable-https \ - ) - apache_args+=("$1") - nginx_args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --type \ - | --allow-remote-connections \ - | --http-port \ - | --https-port \ - | --document-root \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-additional-http-configuration \ - | --apache-additional-https-configuration \ - | --apache-before-vhost-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-proxy-address \ - | --apache-proxy-configuration \ - | --apache-proxy-http-configuration \ - | --apache-proxy-https-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "${2:?missing value}") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration \ - | --nginx-external-configuration) - nginx_args+=("${1//nginx-/}" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration does not exist anymore (i.e. Apache virtual host format or NGINX server block) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Returns: -# true if the configuration was disabled, false otherwise -######################## -ensure_web_server_app_configuration_not_exists() { - local app="${1:?missing app}" - local -a web_servers - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "ensure_${web_server}_app_configuration_not_exists" "$app" - done -} - -######################## -# Ensure the web server loads the configuration for an application in a URL prefix -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --allow-remote-connections - Whether to allow remote connections or to require local connections -# --document-root - Path to document root directory -# --prefix - URL prefix from where it will be accessible (i.e. /myapp) -# --type - Application type, which has an effect on what configuration template will be used -# Apache-specific flags: -# --apache-additional-configuration - Additional vhost configuration (no default) -# --apache-allow-override - Whether to allow .htaccess files (only allowed when --move-htaccess is set to 'no') -# --apache-extra-directory-configuration - Extra configuration for the document root directory -# --apache-move-htaccess - Move .htaccess files to a common place so they can be loaded during Apache startup -# NGINX-specific flags: -# --nginx-additional-configuration - Additional server block configuration (no default) -# Returns: -# true if the configuration was enabled, false otherwise -######################## -ensure_web_server_prefix_configuration_exists() { - local app="${1:?missing app}" - shift - local -a apache_args nginx_args web_servers args_var - apache_args=("$app") - nginx_args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --allow-remote-connections \ - | --document-root \ - | --prefix \ - | --type \ - ) - apache_args+=("$1" "${2:?missing value}") - nginx_args+=("$1" "${2:?missing value}") - shift - ;; - - # Specific Apache flags - --apache-additional-configuration \ - | --apache-allow-override \ - | --apache-extra-directory-configuration \ - | --apache-move-htaccess \ - ) - apache_args+=("${1//apache-/}" "$2") - shift - ;; - - # Specific NGINX flags - --nginx-additional-configuration) - nginx_args+=("${1//nginx-/}" "$2") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - args_var="${web_server}_args[@]" - web_server_execute "$web_server" "ensure_${web_server}_prefix_configuration_exists" "${!args_var}" - done -} - -######################## -# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) -# It serves as a wrapper for the specific web server function -# Globals: -# * -# Arguments: -# $1 - App name -# Flags: -# --hosts - Host listen addresses -# --server-name - Server name -# --server-aliases - Server aliases -# --enable-http - Enable HTTP app configuration (if not enabled already) -# --enable-https - Enable HTTPS app configuration (if not enabled already) -# --disable-http - Disable HTTP app configuration (if not disabled already) -# --disable-https - Disable HTTPS app configuration (if not disabled already) -# --http-port - HTTP port number -# --https-port - HTTPS port number -# Returns: -# true if the configuration was updated, false otherwise -######################## -web_server_update_app_configuration() { - local app="${1:?missing app}" - shift - local -a args web_servers - args=("$app") - # Validate arguments - while [[ "$#" -gt 0 ]]; do - case "$1" in - # Common flags - --enable-http \ - | --enable-https \ - | --disable-http \ - | --disable-https \ - ) - args+=("$1") - ;; - --hosts \ - | --server-name \ - | --server-aliases \ - | --http-port \ - | --https-port \ - ) - args+=("$1" "${2:?missing value}") - shift - ;; - - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - read -r -a web_servers <<< "$(web_server_list)" - for web_server in "${web_servers[@]}"; do - web_server_execute "$web_server" "${web_server}_update_app_configuration" "${args[@]}" - done -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_enable_loading_page() { - ensure_web_server_app_configuration_exists "__loading" --hosts "_default_" \ - --apache-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -RedirectMatch 503 ^/$ -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -ErrorDocument 404 /index.html -ErrorDocument 503 /index.html" \ - --nginx-additional-configuration " -# Show a HTTP 503 Service Unavailable page by default -location / { - return 503; -} -# Show index.html if server is answering with 404 Not Found or 503 Service Unavailable status codes -error_page 404 @installing; -error_page 503 @installing; -location @installing { - rewrite ^(.*)$ /index.html break; -}" - web_server_reload -} - -######################## -# Enable loading page, which shows users that the initialization process is not yet completed -# Globals: -# * -# Arguments: -# None -# Returns: -# None -######################### -web_server_disable_install_page() { - ensure_web_server_app_configuration_not_exists "__loading" - web_server_reload -} diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/usr/sbin/install_packages b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/usr/sbin/install_packages deleted file mode 100755 index ccce248b2d141..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/usr/sbin/install_packages +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -eu - -n=0 -max=2 -export DEBIAN_FRONTEND=noninteractive - -until [ $n -gt $max ]; do - set +e - ( - apt-get update -qq && - apt-get install -y --no-install-recommends "$@" - ) - CODE=$? - set -e - if [ $CODE -eq 0 ]; then - break - fi - if [ $n -eq $max ]; then - exit $CODE - fi - echo "apt failed, retrying" - n=$(($n + 1)) -done -apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives diff --git a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/usr/sbin/run-script b/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/usr/sbin/run-script deleted file mode 100755 index 0e07c9038dfde..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/prebuildfs/usr/sbin/run-script +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 -set -u - -if [ $# -eq 0 ]; then - >&2 echo "No arguments provided" - exit 1 -fi - -script=$1 -exit_code="${2:-96}" -fail_if_not_present="${3:-n}" - -if test -f "$script"; then - sh $script - - if [ $? -ne 0 ]; then - exit $((exit_code)) - fi -elif [ "$fail_if_not_present" = "y" ]; then - >&2 echo "script not found: $script" - exit 127 -fi diff --git a/bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/mongodb/templates/mongodb.conf.tpl b/bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/mongodb/templates/mongodb.conf.tpl deleted file mode 100644 index 0a5dbe5765eda..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/mongodb/templates/mongodb.conf.tpl +++ /dev/null @@ -1,52 +0,0 @@ -# mongod.conf -# for documentation of all options, see: -# http://docs.mongodb.org/manual/reference/configuration-options/ - -# where and how to store data. -storage: - dbPath: {{MONGODB_DATA_DIR}}/db - journal: - enabled: {{MONGODB_DEFAULT_ENABLE_JOURNAL}} - directoryPerDB: {{MONGODB_DEFAULT_ENABLE_DIRECTORY_PER_DB}} - -# where to write logging data. -systemLog: - destination: file - quiet: {{MONGODB_DEFAULT_DISABLE_SYSTEM_LOG}} - logAppend: true - logRotate: reopen - path: {{MONGODB_LOG_DIR}}/mongodb.log - verbosity: {{MONGODB_DEFAULT_SYSTEM_LOG_VERBOSITY}} - -# network interfaces -net: - port: {{MONGODB_DEFAULT_PORT_NUMBER}} - unixDomainSocket: - enabled: true - pathPrefix: {{MONGODB_TMP_DIR}} - ipv6: {{MONGODB_DEFAULT_ENABLE_IPV6}} - bindIpAll: false - bindIp: 127.0.0.1 - -# replica set options -#replication: - #replSetName: {{MONGODB_DEFAULT_REPLICA_SET_NAME}} - #enableMajorityReadConcern: {{MONGODB_DEFAULT_ENABLE_MAJORITY_READ}} - -# sharding options -#sharding: - #clusterRole: - -# process management options -processManagement: - fork: false - pidFilePath: {{MONGODB_PID_FILE}} - -# set parameter options -setParameter: - enableLocalhostAuthBypass: true - -# security options -security: - authorization: disabled - #keyFile: replace_me diff --git a/bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/mongodb/templates/mongos.conf.tpl b/bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/mongodb/templates/mongos.conf.tpl deleted file mode 100644 index 0edc1d4a8e65f..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/mongodb/templates/mongos.conf.tpl +++ /dev/null @@ -1,38 +0,0 @@ -# mongod.conf -# for documentation of all options, see: -# http://docs.mongodb.org/manual/reference/configuration-options/ - -# where to write logging data. -systemLog: - destination: file - quiet: {{MONGODB_DEFAULT_DISABLE_SYSTEM_LOG}} - logAppend: true - logRotate: reopen - path: {{MONGODB_LOG_DIR}}/mongodb.log - verbosity: {{MONGODB_DEFAULT_SYSTEM_LOG_VERBOSITY}} - -# network interfaces -net: - port: {{MONGODB_DEFAULT_PORT_NUMBER}} - unixDomainSocket: - enabled: true - pathPrefix: {{MONGODB_TMP_DIR}} - ipv6: {{MONGODB_DEFAULT_ENABLE_IPV6}} - bindIpAll: false - bindIp: 127.0.0.1 - -# sharding options -sharding: - configDB: 127.0.0.1 - -security: - keyFile: {{MONGODB_KEY_FILE}} - -# process management options -processManagement: - fork: false - pidFilePath: {{MONGODB_PID_FILE}} - -# set parameter options -setParameter: - enableLocalhostAuthBypass: false diff --git a/bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/scripts/libmongodb-sharded.sh b/bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/scripts/libmongodb-sharded.sh deleted file mode 100644 index 93847f4462f1d..0000000000000 --- a/bitnami/mongodb-sharded/7.0/debian-12/rootfs/opt/bitnami/scripts/libmongodb-sharded.sh +++ /dev/null @@ -1,378 +0,0 @@ -#!/bin/bash -# Copyright Broadcom, Inc. All Rights Reserved. -# SPDX-License-Identifier: APACHE-2.0 - -# -# Bitnami MongoDB library - -# shellcheck disable=SC1091 - -# Load Generic Libraries -. /opt/bitnami/scripts/liblog.sh -. /opt/bitnami/scripts/libvalidations.sh -. /opt/bitnami/scripts/libmongodb.sh - -######################## -# Get current status of the shard in the cluster -# Globals: -# MONGODB_* -# Arguments: -# $1 - Name of the replica set -# Returns: -# None -######################### -mongodb_sharded_shard_currently_in_cluster() { - local -r replicaset="${1:?node is required}" - local result - - result=$( - mongodb_execute_print_output "$MONGODB_ROOT_USER" "$MONGODB_ROOT_PASSWORD" "admin" "$MONGODB_MONGOS_HOST" "$MONGODB_MONGOS_PORT_NUMBER" <"$conf_file_path" -} - -######################## -# Change common logging settings -# Globals: -# MONGODB_* -# Arguments: -# None -# Returns: -# None -######################### -mongodb_set_log_conf() { - local -r conf_file_path="${1:-$MONGODB_CONF_FILE}" - local -r conf_file_name="${conf_file_path#"$MONGODB_CONF_DIR"}" - if ! mongodb_is_file_external "$conf_file_name"; then - if [[ -n "$MONGODB_DISABLE_SYSTEM_LOG" ]]; then - mongodb_config_apply_regex "quiet:.*" "quiet: $({ is_boolean_yes "$MONGODB_DISABLE_SYSTEM_LOG" && echo 'true'; } || echo 'false')" "$conf_file_path" - fi - if [[ -n "$MONGODB_SYSTEM_LOG_VERBOSITY" ]]; then - mongodb_config_apply_regex "verbosity:.*" "verbosity: $MONGODB_SYSTEM_LOG_VERBOSITY" "$conf_file_path" - fi - else - debug "$conf_file_name mounted. Skipping setting log settings" - fi -} - -######################## -# Change journaling setting -# Globals: -# MONGODB_* -# Arguments: -# None -# Returns: -# None -######################### -mongodb_set_journal_conf() { - local -r conf_file_path="${1:-$MONGODB_CONF_FILE}" - local -r conf_file_name="${conf_file_path#"$MONGODB_CONF_DIR"}" - local mongodb_conf - - if ! mongodb_is_file_external "$conf_file_name"; then - # Disable journal.enabled since it is not supported from 7.0 on - if [[ "$(mongodb_get_major_version)" -ge 7 ]]; then - mongodb_conf="$(sed '/journal:/,/enabled: .*/d' "$conf_file_path")" - echo "$mongodb_conf" >"$conf_file_path" - else - if [[ -n "$MONGODB_ENABLE_JOURNAL" ]]; then - mongodb_conf="$(sed -E "/^ *journal:/,/^ *[^:]*:/s/enabled:.*/enabled: $({ is_boolean_yes "$MONGODB_ENABLE_JOURNAL" && echo 'true'; } || echo 'false')/" "$conf_file_path")" - echo "$mongodb_conf" >"$conf_file_path" - fi - fi - else - debug "$conf_file_name mounted. Skipping setting log settings" - fi -} - -######################## -# Change common storage settings -# Globals: -# MONGODB_* -# Arguments: -# None -# Returns: -# None -######################### -mongodb_set_storage_conf() { - local -r conf_file_path="${1:-$MONGODB_CONF_FILE}" - local -r conf_file_name="${conf_file_path#"$MONGODB_CONF_DIR"}" - - if ! mongodb_is_file_external "$conf_file_name"; then - if [[ -n "$MONGODB_ENABLE_DIRECTORY_PER_DB" ]]; then - mongodb_config_apply_regex "directoryPerDB:.*" "directoryPerDB: $({ is_boolean_yes "$MONGODB_ENABLE_DIRECTORY_PER_DB" && echo 'true'; } || echo 'false')" "$conf_file_path" - fi - else - debug "$conf_file_name mounted. Skipping setting storage settings" - fi -} - -######################## -# Change common network settings -# Globals: -# MONGODB_* -# Arguments: -# None -# Returns: -# None -######################### -mongodb_set_net_conf() { - local -r conf_file_path="${1:-$MONGODB_CONF_FILE}" - local -r conf_file_name="${conf_file_path#"$MONGODB_CONF_DIR"}" - - if ! mongodb_is_file_external "$conf_file_name"; then - if [[ -n "$MONGODB_PORT_NUMBER" ]]; then - mongodb_config_apply_regex "port:.*" "port: $MONGODB_PORT_NUMBER" "$conf_file_path" - fi - if [[ -n "$MONGODB_ENABLE_IPV6" ]]; then - mongodb_config_apply_regex "ipv6:.*" "ipv6: $({ is_boolean_yes "$MONGODB_ENABLE_IPV6" && echo 'true'; } || echo 'false')" "$conf_file_path" - fi - else - debug "$conf_file_name mounted. Skipping setting port and IPv6 settings" - fi -} -######################## -# Change bind ip address to 0.0.0.0 -# Globals: -# MONGODB_* -# Arguments: -# None -# Returns: -# None -######################### -mongodb_set_listen_all_conf() { - local -r conf_file_path="${1:-$MONGODB_CONF_FILE}" - local -r conf_file_name="${conf_file_path#"$MONGODB_CONF_DIR"}" - - if ! mongodb_is_file_external "$conf_file_name"; then - mongodb_config_apply_regex "#?bindIp:.*" "#bindIp:" "$conf_file_path" - mongodb_config_apply_regex "#?bindIpAll:.*" "bindIpAll: true" "$conf_file_path" - else - debug "$conf_file_name mounted. Skipping IP binding to all addresses" - fi -} - -######################## -# Disable javascript -# Globals: -# MONGODB_* -# Arguments: -# None -# Returns: -# None -######################### -mongodb_disable_javascript_conf() { - local -r conf_file_path="${1:-$MONGODB_CONF_FILE}" - local -r conf_file_name="${conf_file_path#"$MONGODB_CONF_DIR"}" - - if ! mongodb_is_file_external "$conf_file_name"; then - if grep -q -E "^[[:space:]]*javascriptEnabled:" "$conf_file_path"; then - mongodb_config_apply_regex "javascriptEnabled:.*" "javascriptEnabled: false" "$conf_file_path" - else - # The 'javascriptEnabled' property will be added to the config file - mongodb_config_apply_regex "#?security:" "security:\n javascriptEnabled: false" "$conf_file_path" - fi - else - debug "$conf_file_name mounted. Skipping disabling javascript" - fi -} - -######################## -# Enable Auth -# Globals: -# MONGODB_* -# Arguments: -# None -# Return -# None -######################### -mongodb_set_auth_conf() { - local -r conf_file_path="${1:-$MONGODB_CONF_FILE}" - local -r conf_file_name="${conf_file_path#"$MONGODB_CONF_DIR"}" - - local authorization - local localhostBypass - - localhostBypass="$(mongodb_conf_get "setParameter.enableLocalhostAuthBypass")" - authorization="$(mongodb_conf_get "security.authorization")" - if ! is_boolean_yes "$MONGODB_DISABLE_ENFORCE_AUTH"; then - if [[ -n "$MONGODB_ROOT_PASSWORD" ]] || [[ -n "$MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD" ]] || [[ -n "$MONGODB_PASSWORD" ]]; then - if [[ "$authorization" = "disabled" ]]; then - - info "Enabling authentication..." - # TODO: replace 'sed' calls with 'yq' once 'yq write' does not remove comments - mongodb_config_apply_regex "#?authorization:.*" "authorization: enabled" "$conf_file_path" - mongodb_config_apply_regex "#?enableLocalhostAuthBypass:.*" "enableLocalhostAuthBypass: false" "$conf_file_path" - fi - fi - else - warn "You have set MONGODB_DISABLE_ENFORCE_AUTH=true, settings enableLocalhostAuthBypass and security.authorization will remain with values '${localhostBypass}' and '${authorization}' respectively." - fi -} - -######################## -# Read a configuration setting value -# Globals: -# MONGODB_CONF_FILE -# Arguments: -# $1 - key -# Returns: -# Outputs the key to stdout (Empty response if key is not set) -######################### -mongodb_conf_get() { - local key="${1:?missing key}" - - if [[ -r "$MONGODB_CONF_FILE" ]]; then - local -r res="$(yq eval ".${key}" "$MONGODB_CONF_FILE")" - if [[ ! "$res" = "null" ]]; then - echo "$res" - fi - fi -} - -######################## -# Enable ReplicaSetMode -# Globals: -# MONGODB_* -# Arguments: -# None -# Returns: -# None -######################### -mongodb_set_replicasetmode_conf() { - local -r conf_file_path="${1:-$MONGODB_CONF_FILE}" - local -r conf_file_name="${conf_file_path#"$MONGODB_CONF_DIR"}" - - if ! mongodb_is_file_external "$conf_file_name"; then - mongodb_config_apply_regex "#?replication:.*" "replication:" "$conf_file_path" - mongodb_config_apply_regex "#?replSetName:" "replSetName:" "$conf_file_path" - mongodb_config_apply_regex "#?enableMajorityReadConcern:.*" "enableMajorityReadConcern:" "$conf_file_path" - if [[ -n "$MONGODB_REPLICA_SET_NAME" ]]; then - mongodb_config_apply_regex "replSetName:.*" "replSetName: $MONGODB_REPLICA_SET_NAME" "$conf_file_path" - fi - if [[ -n "$MONGODB_ENABLE_MAJORITY_READ" ]]; then - mongodb_config_apply_regex "enableMajorityReadConcern:.*" "enableMajorityReadConcern: $({ (is_boolean_yes "$MONGODB_ENABLE_MAJORITY_READ" || [[ "$(mongodb_get_major_version)" -eq 5 ]]) && echo 'true'; } || echo 'false')" "$conf_file_path" - fi - else - debug "$conf_file_name mounted. Skipping replicaset mode enabling" - fi -} - -######################## -# Create a MongoDB user and provide read/write permissions on a database -# Globals: -# MONGODB_ROOT_PASSWORD -# Arguments: -# $1 - Name of user -# $2 - Password for user -# $3 - Name of database (empty for default database) -# Returns: -# None -######################### -mongodb_create_user() { - local -r user="${1:?user is required}" - local -r password="${2:-}" - local -r database="${3:-}" - local query - - if [[ -z "$password" ]]; then - warn "Cannot create user '$user', no password provided" - return 0 - fi - # Build proper query (default database or specific one) - query="db.getSiblingDB('$database').createUser({ user: '$user', pwd: '$password', roles: [{role: 'readWrite', db: '$database'}] })" - [[ -z "$database" ]] && query="db.getSiblingDB(db.stats().db).createUser({ user: '$user', pwd: '$password', roles: [{role: 'readWrite', db: db.getSiblingDB(db.stats().db).stats().db }] })" - # Create user, discarding mongo CLI output for clean logs - info "Creating user '$user'..." - mongodb_execute "$MONGODB_ROOT_USER" "$MONGODB_ROOT_PASSWORD" "" "127.0.0.1" "" "${MONGODB_SHELL_EXTRA_FLAGS} --tlsAllowInvalidHostnames" <<<"$query" -} - -######################## -# Create the appropriate users -# Globals: -# MONGODB_* -# Arguments: -# None -# Returns: -# None -######################### -mongodb_create_users() { - info "Creating users..." - - if [[ -n "$MONGODB_ROOT_PASSWORD" ]] && ! [[ "$MONGODB_REPLICA_SET_MODE" =~ ^(secondary|arbiter|hidden) ]]; then - info "Creating $MONGODB_ROOT_USER user..." - mongodb_execute "" "" "" "127.0.0.1" "" "${MONGODB_SHELL_EXTRA_FLAGS} --tlsAllowInvalidHostnames" <"$MONGODB_KEY_FILE" - - chmod 600 "$MONGODB_KEY_FILE" - - if am_i_root; then - configure_permissions "$MONGODB_KEY_FILE" "$MONGODB_DAEMON_USER" "$MONGODB_DAEMON_GROUP" "" "600" - else - chmod 600 "$MONGODB_KEY_FILE" - fi - else - debug "keyfile mounted. Skipping keyfile generation" - fi -} - -######################## -# Get if primary node is initialized -# Globals: -# MONGODB_* -# Arguments: -# $1 - node -# $2 - port -# Returns: -# None -######################### -mongodb_is_primary_node_initiated() { - local node="${1:?node is required}" - local port="${2:?port is required}" - local result - result=$( - mongodb_execute_print_output "$MONGODB_ROOT_USER" "$MONGODB_ROOT_PASSWORD" "admin" "127.0.0.1" "$MONGODB_PORT_NUMBER" "${MONGODB_SHELL_EXTRA_FLAGS} --tlsAllowInvalidHostnames" < m.name === '$node:$port' && m.stateStr === 'SECONDARY').length === 1 -EOF - ) - debug "$result" - - grep -q "true" <<<"$result" -} - -######################## -# Grant voting rights to secondary node -# Globals: -# MONGODB_* -# Arguments: -# $1 - node -# $2 - port -# Returns: -# Boolean -######################### -mongodb_configure_secondary_node_voting() { - local -r node="${1:?node is required}" - local -r port="${2:?port is required}" - - debug "Granting voting rights to the node" - local reconfig_cmd="rs.reconfigForPSASet(member, cfg)" - [[ "$(mongodb_get_version)" =~ ^4\.(0|2)\. ]] && reconfig_cmd="rs.reconfig(cfg)" - result=$( - mongodb_execute_print_output "$MONGODB_INITIAL_PRIMARY_ROOT_USER" "$MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD" "admin" "$MONGODB_INITIAL_PRIMARY_HOST" "$MONGODB_INITIAL_PRIMARY_PORT_NUMBER" < m.host === '$node:$port') -cfg.members[member].priority = 1 -cfg.members[member].votes = 1 -$reconfig_cmd -EOF - ) - debug "$result" - - grep -q "ok: 1" <<<"$result" -} - -######################## -# Get if hidden node is pending -# Globals: -# MONGODB_* -# Arguments: -# $1 - node -# $2 - port -# Returns: -# Boolean -######################### -mongodb_is_hidden_node_pending() { - local node="${1:?node is required}" - local port="${2:?port is required}" - local result - - mongodb_set_dwc - - debug "Adding hidden node ${node}:${port}" - result=$( - mongodb_execute_print_output "$MONGODB_INITIAL_PRIMARY_ROOT_USER" "$MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD" "admin" "$MONGODB_INITIAL_PRIMARY_HOST" "$MONGODB_INITIAL_PRIMARY_PORT_NUMBER" <