0

Take bitnami/wordpress or bitnami/drupal for example. There are millions of articles on how to run two lines of code (helm get repo / helm install my-release chart) and have a fully working new version of an app in 30 seconds. But I cannot find ANY information about how to get my existing data into that deployment.

In my development workflow, I use two docker images. One is for the app files and the other is for the database. Locally, it's easy enough to get my data into these images. Using MariaDB's docker instructions, I mount a local directory containing my db.sql file into /docker-entrypoint-initdb.d. The same goes for my files - pull them down into a local directory that's then mounted into the container's /var/www folder. Voila! Instant running app with all existing data.

So how do I do this with a public Helm chart?

Scenario: I get local copies of my db.sql and web files. I make my changes. I want to use bitnami/drupal to install this into a cluster (so a colleague can see it, UAT, etc). So how do I do that? If this is a values.yaml issue, how do I configure that file to point to the database file I want to initialize with? Or, how do I use Helm install with --set to do it?

If getting a new app up and running is as easy as helm install my-release bitnami/drupal

then shouldn't it be just as easy to run something like

helm install --set mariadb.docker-entrypoint-initdb.d.file=db.sql --set volume.www.initial.data=/local/web/files new-feature-ticket bitnami/drupal

I know that's pseudo code, but that's exactly the type of answer I'm looking for. I want to be able to deploy this as quickly as I do a new app, but initialized with my existing data, and the bare minimum config need to do so whether that's via values.yaml or --set.

user658182
  • 2,148
  • 5
  • 21
  • 36
  • For drupal it looks like it uses `persistence.existingClaim` to specify an existing PVC with data. – jordanm Dec 09 '21 at 22:48
  • It also has `mariadb.primary.persistence.hostPath` to use a hostpath volume and `mariadb.primary.persistence.existingClaim` to use an existing PVC for the database – jordanm Dec 09 '21 at 22:49
  • How would you approach this without a container system? I can run `brew install mysql` or `apt-get install mysql-server` to easily get a MySQL server locally; how would I reproducibly get data into it? – David Maze Dec 10 '21 at 00:23
  • You probably need a [persistent volume](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes) with your data and you need to set a proper [drupal parameters](https://github.com/bitnami/charts/tree/master/bitnami/drupal#drupal-parameters), which Kubernetes solution are you using - some cloud provider or bare-metal? – Mikolaj S. Dec 10 '21 at 18:09
  • To touch a bit on the comments so far. If one were to run `helm install my-release bitnami/drupal` You get a fully working vanilla installation. PV, PVC, the database, db server, all connection parameters, Secrets, all of that is 100% taken care of automatically behind the scenes by the bitnami/drupal chart. I don't know the implementation details. That's the point - I don't want to know or have to worry about them. All I want to do is run that same command and seed that install process with my data from my-backup-db.sql file. – user658182 Dec 12 '21 at 13:15
  • @DavidMaze The Bitnami helm chart automatically creates the database server and installs mysql, so I don't have to worry about that. I'm just trying to figure out how to get my data into that installation step _automatically_ (I don't want to have to use kubectl exec and mysql import, etc as manual post deployment step.) – user658182 Dec 12 '21 at 13:18
  • @MikolajS. That's the question I'm trying to answer. Which parameter do I set in my values.yaml file so that it uses my backup-db.sql data? The bitnami/drupal helm chart creates the database and installs drupal automatically, so there is a working database with default data after the install process is finished. I need to replace that data with my data automatically during the install process. – user658182 Dec 12 '21 at 13:26
  • @MikolajS. In a similar thread, a Bitnami chart engineer says to use `initDbScript` parameter. But she never actually answers the question of HOW. I could not get it to work nor with the other parameters suggested in the comments so far. https://stackoverflow.com/questions/66344724/deploying-bitnami-mysql-helm-chart-with-an-existing-persistence-volume-claim. To answer your question, I use skaffold / minikube for local dev and it eventually makes its way to Azure AKS, but I'm looking for a generic k8s / helm answer instead of provider specific. – user658182 Dec 12 '21 at 13:33

0 Answers0