Commit f015db5f authored by Maarten de Waard's avatar Maarten de Waard 🤘🏻
Browse files

make values-local.yaml.example wayyy smaller, make ansibleVars not a string,...

make values-local.yaml.example wayyy smaller, make ansibleVars not a string, move some variables out of secret because they are not really secret
parent 782ef13f
......@@ -18,11 +18,9 @@ work.
### Start wordpress on Kubernetes
1. Edit `values.yaml` to set your custom settings
1. Edit `values-local.yaml` to set your custom settings
2. Install the helm dependencies by typing `helm dep update`
2. Start wordpress by typing `helm install . -f values.yaml -f
values-local.yaml` (NOTE: values-local should be provided last so you can
override any variables in values.yaml)
2. Start wordpress by typing `helm install . -f values-local.yaml`
3. If you use minikube, you can get the URL to test your wordpress by typing
`helm ls`, finding the name of your service and typing `minikube service
<service name> --url`. Otherwise follow the instructions in the note to get
......
......@@ -12,4 +12,4 @@ WORKDIR /var/local/ansible
USER www-data
CMD ["ansible-playbook", "wpdeploy.yml", "-e", "@secrets/secret-vars.yaml", "-e", "@vars/vars.yaml"]
CMD ["ansible-playbook", "wpdeploy.yml", "-e", "@secrets/secret-vars.yaml"]
---
wordpress_homedir: /var/www/html
wp_user: www-data
wp_group: www-data
dbcharset: utf8mb4
dbcollate: utf8mb4_unicode_ci
cli_args: "--path={{ wordpress_homedir }}"
## Perms
mode_0750: u+rwx-s,g+rx-ws,o-rwx
mode_0640: u+rw-sx,g+r-wxs,o-rwx
mode_0644: u+rw-sx,g+r-wxs,o+r-wx
mode_0440: u+r-wxs,u+r-wxs,o-rwx
mode_0600: u+rw-xs,g-rwxs,o-rwx
special_files:
# - wp-content/uploads/.htaccess
- index.php
- .htaccess
## Plugins
wordpress_default_plugins:
- block-bad-queries
- flush-opcache
- logbook
- wps-hide-login
- wp-cron-control
WP_VERSION: 4.9.9
WP_URL: http://localhost
WP_TITLE: Demo WP
WP_THEME: WHAT THEME
DB_NAME: wp_db
DB_USER: wp_user
DB_PASS: wp_password
DB_HOST: localhost
DB_PREFIX: wp_
LOCALE: en_GB
WP_USER: admin
WP_PASS: guest
WP_EMAIL: email@example.com
......@@ -8,6 +8,11 @@ metadata:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
vars.yaml: |-
main.yaml: |-
---
{{ tpl .Values.ansibleVars . | indent 4 }}
DB_HOST: "{{ .Release.Name }}-database"
DB_NAME: "{{ .Values.database.db.name }}"
DB_USER: "{{ .Values.database.db.user }}"
{{- range $key, $val := .Values.ansibleVars }}
{{ $key }}: {{ $val }}
{{- end }}
......@@ -30,7 +30,7 @@ spec:
- name: {{ include "wordpress.name" . }}-persistent-storage
mountPath: /var/www/html
- name: ansible-vars
mountPath: /var/local/ansible/vars
mountPath: /var/local/ansible/roles/wordpress-init/defaults/main.yaml
- name: ansible-secrets
mountPath: /var/local/ansible/secrets
env:
......
replicaCount: 1
wordPressTablePrefix: "wp_"
wordPressStorage: 10Gi
wordpressPassword: <Set A PASSWORD FOR THE ADMIN LOGIN>
# Set this for use with Minikube:
# service:
# type: NodePort
# port: 12345
persistence:
enabled: true
storageClass: local
## Contains the whole secret-vars.yaml file that ansible will use during setup.
## Note: this needs to be a string!
ansibleSecrets: |
WP_USER: wp_user
WP_PASS: <SET A PASSWORD HERE>
WP_EMAIL: youremail@example.com
DB_NAME: {{ .Values.database.db.name }}
DB_USER: {{ .Values.database.db.user }}
DB_PASS: {{ .Values.database.db.password }}
## dictionary with variables that are inserted into vars.yaml
ansibleVars: |
DB_HOST: {{ .Release.Name }}-database
WP_VERSION: 4.9.9
# TODO: this should be a more globally configured variable
WP_URL: https://<YOUR HOSTNAME HERE>
WP_TITLE: <SET A TITLE>
# NOTE: Use a theme *slug* here
# Common values to override:
ansibleVars:
WP_URL: http://localhost
WP_TITLE: Demo WP
WP_THEME: twentynineteen
# NOTE: Make sure you use underscore and that the localisation is in full caps
LOCALE: en_GB
DB_PREFIX: wp_
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: traefik
kubernetes.io/tls-acme: "true"
path: /
hosts:
- <YOUR HOSTNAME HERE>
resources:
limits:
cpu: 100m
memory: 512Mi
requests:
cpu: 50m
memory: 256Mi
database:
db:
user: wordpress
password: <SET A DATABASE PASSWORD>
name: wordpress_db
rootUser:
password: <SET A DB ROOT USER PASSWORD FOR UPGRADES TO WORK>
replicationUser:
password: <SET A REPLICATION USER PASSWORD IF YOU HAVE REPLICATION ENABLED>
master:
persistence:
size: 4Gi
# Custom SQL config
config: |-
[mysqld]
skip-name-resolve
explicit_defaults_for_timestamp
basedir=/opt/bitnami/mariadb
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
tmpdir=/opt/bitnami/mariadb/tmp
max_allowed_packet=16M
bind-address=0.0.0.0
pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
log-error=/opt/bitnami/mariadb/logs/mysqld.log
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
[client]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
default-character-set=utf8mb4
[manager]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
slave:
persistence:
size: 4Gi
config: |-
[mysqld]
skip-name-resolve
explicit_defaults_for_timestamp
basedir=/opt/bitnami/mariadb
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
tmpdir=/opt/bitnami/mariadb/tmp
max_allowed_packet=16M
bind-address=0.0.0.0
pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
log-error=/opt/bitnami/mariadb/logs/mysqld.log
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
[client]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
default-character-set=utf8mb4
[manager]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
# It's advisable to set resource limits to prevent your K8s cluster from
# crashing
# resources:
# limits:
# cpu: 100m
# memory: 512Mi
# requests:
# cpu: 50m
# memory: 256Mi
# Default values for etherpad.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
wordPressTablePrefix: "wp_"
wordPressStorage: 10Gi
persistence:
# Enable the use of a persistent volume
enabled: false
accessMode: ReadWriteOnce
size: 1Gi
# Set a storage class name if you want:
# storageClass:
# Use an existing PVC:
# existingClaim
# size:
# accessMode
# storageClass:
# existingClaim:
service:
type: ClusterIP
port: 8080
loadBalancerIP: nil
## Contains the whole secret-vars.yaml file that ansible will use during setup.
## Note: this needs to be a string!
# Be sure to set/provide these values!
ansibleSecrets: |
WP_PASS: "{{ .Values.wordpressPassword }}"
DB_PASS: "{{ .Values.database.db.password }}"
## dictionary with variables that are inserted into the wordpress-init default
## task. Feel free to override these if necessary
ansibleVars:
WP_USER: admin
WP_PASS: guest
WP_EMAIL: email@example.com
DB_NAME: {{ .Values.database.db.name }}
DB_USER: {{ .Values.database.db.user }}
DB_PASS: {{ .Values.database.db.password }}
## dictionary with variables that are inserted into vars.yaml
ansibleVars: |
DB_HOST: {{ .Release.Name }}-database
WP_VERSION: 4.9.9
# TODO: this should be a more globally configured variable
WP_URL: http://localhost
WP_TITLE: Helm WP
# NOTE: Use a theme *slug* here
WP_THEME: twentynineteen
# NOTE: Make sure you use underscore and that the localisation is in full caps
LOCALE: en_US
DB_PREFIX: wp_
wordpress_homedir: /var/www/html
wp_user: www-data
wp_group: www-data
dbcharset: utf8mb4
dbcollate: utf8mb4_unicode_ci
cli_args: "--path={{ wordpress_homedir }}"
## Perms
mode_0750: u+rwx-s,g+rx-ws,o-rwx
mode_0640: u+rw-sx,g+r-wxs,o-rwx
mode_0644: u+rw-sx,g+r-wxs,o+r-wx
mode_0440: u+r-wxs,u+r-wxs,o-rwx
mode_0600: u+rw-xs,g-rwxs,o-rwx
special_files:
- index.php
- .htaccess
## Plugins
wordpress_default_plugins:
- block-bad-queries
# - flush-opcache
# - logbook
# - wps-hide-login
# - wp-cron-control
WP_VERSION: 4.9.9
WP_URL: http://localhost
WP_TITLE: Demo WP
WP_THEME: twentynineteen
DB_PREFIX: wp_
LOCALE: en_GB
image:
repository: wordpress
......@@ -90,6 +107,48 @@ database:
master:
persistence:
size: 4Gi
config: |-
[mysqld]
skip-name-resolve
explicit_defaults_for_timestamp
basedir=/opt/bitnami/mariadb
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
tmpdir=/opt/bitnami/mariadb/tmp
max_allowed_packet=16M
bind-address=0.0.0.0
pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
log-error=/opt/bitnami/mariadb/logs/mysqld.log
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
[client]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
default-character-set=utf8mb4
[manager]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
slave:
persistence:
size: 4Gi
config: |-
[mysqld]
skip-name-resolve
explicit_defaults_for_timestamp
basedir=/opt/bitnami/mariadb
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
tmpdir=/opt/bitnami/mariadb/tmp
max_allowed_packet=16M
bind-address=0.0.0.0
pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
log-error=/opt/bitnami/mariadb/logs/mysqld.log
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
[client]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
default-character-set=utf8mb4
[manager]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment