This is a simple guide to show how to deploy Drupal using Bitnami Stacksmith
-
Go to stacksmith.bitnami.com.
-
Create a new application and select the
Generic application with DB (MySQL)stack template. -
Select the targets you are interested on (AWS, Kubernetes,...).
-
Download Drupal manually or with the command below, and upload the
drupal-latest.zipapplication file:wget -O drupal-latest.zip https://www.drupal.org/download-latest/zip
-
Select
Git repositoryfor the application scripts and paste the URL of this repo. Usemasteras theRepository Reference. -
Click the Create button.
-
Wait for app to be built and deploy it in your favorite target platform.
Stacksmith will compare the latest commit for a reference (e.g. new commits made to a branch) against the last commit used during packaging. If there are any new commits available, these will be available to view within the Repository Details pane in the application history. If you choose to repackage your application, these newer commits will be incorporated and used during the packaging.
-
Download a new version of Drupal. You can download the latest available version with the command below:
wget -O drupal-latest.zip https://www.drupal.org/download-latest/zip
-
Go to your app stacksmith.bitnami.com
-
Click on Edit configuration, delete the existing
drupal-latest.zipand upload the newdrupal-latest.zip. -
Click Update.
-
Wait for the new version to be built and re-deploy it in your favorite target platform.
Stacksmith will use the latest Application Scripts from the GitHub repository.
-
Go to stacksmith.bitnami.com, create a new application and select the
Generic application with DB (MySQL)stack template. -
Install Stacksmith CLI and authenticate with Stacksmith.
-
Download the latest version of Drupal:
wget -O drupal-latest.zip https://www.drupal.org/download-latest/zip
-
Edit the
Stackerfile.yml, update theappIdwith the URL of your project and the name ofuserUploads. -
Run the build for a specific target like
awsordocker. E.g.stacksmith build --target docker
-
Wait for app to be built and deploy it in your favorite target platform.
-
Download the latest version of Drupal:
wget -O drupal-latest.zip https://www.drupal.org/download-latest/zip
-
Run the build for a specific target like
awsordocker. E.g.stacksmith build --target docker
-
Wait for the new version to be built and re-deploy it in your favorite target platform.
In the stacksmith/user-scripts folder, you can find the required scripts to build and run this application:
This script takes care of configuring the environment for the application to be installed. It performs the following steps:
- Install application dependencies such as Apache, PHP and Composer.
- Uncompress the application code to the
/var/www/htmlfolder.
This script takes care of installing the application.
This script starts the Apache server, so that the application can be accessed via HTTP port 80.
In some applications like Drupal you need to store application data in a persistent storage unit. It allows you to keep the uploaded files and other assets in a safe place if the instance or pod goes down. In these cases, you need to customize the Generic application with DB (MySQL) stack template depending on the target that you have choosen.
In the steps below you can find a practical case where you add a persistent volume for Kubernetes. Read more about it here: Creating a Stack Template.
Go to your application build history view, select the build (Kubernetes Target) that you want to customize and click on Download Helm Chart.
Unpack the downloaded tarball and edit the following files:
-
values.yamlimage: - name: ************************** + name: @@IMAGE@@ pullPolicy: IfNotPresent
Add at the end of the file:
+ +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + enabled: false + ## Drupal data Persistent Volume Storage Class + ## If defined, storageClassName: <storageClass> + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + accessMode: ReadWriteOnce + size: 10Gi
-
templates/deployment.yamlAt the end of the file, add a
volumeMountfor the Drupal container and define a new volume.+ volumeMounts: + - mountPath: /var/www/html + name: drupal-data + volumes: + - name: drupal-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (include "fullname" .) }} + {{- else }} + emptyDir: {} + {{ end }}
-
Create a new file
templates/pvc.yamlwith the following content:{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} kind: PersistentVolumeClaim apiVersion: v1 metadata: name: {{ template "fullname" . }} labels: app: {{ template "fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" spec: accessModes: - {{ .Values.persistence.accessMode | quote }} resources: requests: storage: {{ .Values.persistence.size | quote }} {{- if .Values.persistence.storageClass }} {{- if (eq "-" .Values.persistence.storageClass) }} storageClassName: "" {{- else }} storageClassName: "{{ .Values.persistence.storageClass }}" {{- end }} {{- end }} {{- end }}
Package the files again as a tar.gz. Go to Settings > Stack Templates > Create a new stack template and fill the creation form. Upload the new stack template for the Kubernetes target and click on Update.
Go to your application and click on Edit Configuration. Select the new stack template that you have just created and click on Update.
That's all! Stacksmith will repackage Drupal with your custom stack template. When you want to deploy the new Helm Chart, make sure you enable the persistence. Otherwise, it will behave as the generic stack template:
helm install yourapp.tgz --set persistence.enabled=true