fix
This commit is contained in:
@@ -117,6 +117,21 @@ options:
|
||||
default: false
|
||||
type: boolean
|
||||
type: object
|
||||
config:
|
||||
default:
|
||||
admin_name: wordpress_admin
|
||||
is_debug: false
|
||||
examples:
|
||||
- admin_name: wordpress_admin
|
||||
is_debug: false
|
||||
properties:
|
||||
admin_name:
|
||||
default: wordpress_admin
|
||||
type: string
|
||||
is_debug:
|
||||
default: false
|
||||
type: boolean
|
||||
type: object
|
||||
domain:
|
||||
default: your-company
|
||||
examples:
|
||||
|
||||
@@ -34,6 +34,12 @@ resource "kubectl_manifest" "wordpress_files" {
|
||||
labels: ${jsonencode(local.common_labels)}
|
||||
namespace: ${var.namespace}
|
||||
data:
|
||||
"vynil-configurator.sh": |-
|
||||
#!/bin/sh
|
||||
if [ -z $(wp core is-installed) ]; then
|
||||
echo Should configure....
|
||||
fi
|
||||
env
|
||||
wp-cli: |-
|
||||
#!/bin/sh
|
||||
WP_PATH=/var/www/html/
|
||||
|
||||
@@ -38,6 +38,16 @@ resource "random_password" "NONCE_SALT" {
|
||||
special = false
|
||||
}
|
||||
|
||||
resource "random_password" "NONCE_SALT" {
|
||||
length = 32
|
||||
special = false
|
||||
}
|
||||
|
||||
resource "random_password" "ADM_PASS" {
|
||||
length = 18
|
||||
special = false
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "secret" {
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: v1
|
||||
@@ -56,6 +66,8 @@ resource "kubectl_manifest" "secret" {
|
||||
WORDPRESS_LOGGED_IN_SALT: "${random_password.LOGGED_IN_SALT.result}"
|
||||
WORDPRESS_NONCE_SALT: "${random_password.NONCE_SALT.result}"
|
||||
WORDPRESS_DB_PASSWORD: "${random_password.mysql_comp_pass.result}"
|
||||
WORDPRESS_ADMIN_NAME: "${var.config.admin_name}"
|
||||
WORDPRESS_ADMIN_PASSWORD: "${random_password.ADM_PASS.result}"
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,33 @@ resource "kubectl_manifest" "Deployment_wordpress" {
|
||||
- mountPath: /wordpress-data/wp-content/
|
||||
name: wordpress-data
|
||||
subPath: wp-content
|
||||
- name: wordpress-config
|
||||
image: ${var.images.wordpress.registry}/${var.images.wordpress.repository}:${var.images.wordpress.tag}
|
||||
imagePullPolicy: ${var.images.wordpress.pull_policy}
|
||||
command: [/usr/local/bin/vynil-configurator]
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
privileged: false
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: "${kubectl_manifest.wordpress_cfg.name}"
|
||||
- secretRef:
|
||||
name: "${kubectl_manifest.secret.name}"
|
||||
volumeMounts:
|
||||
- mountPath: /var/www/html/
|
||||
name: wordpress-app
|
||||
- name: wordpress-data
|
||||
mountPath: /var/www/html/wp-content/
|
||||
subPath: wp-content
|
||||
- name: wordpress-scripts
|
||||
mountPath: /usr/local/bin/wp
|
||||
subPath: wp-cli
|
||||
- name: wordpress-scripts
|
||||
mountPath: /usr/local/bin/vynil-configurator
|
||||
subPath: "vynil-configurator.sh"
|
||||
containers:
|
||||
- name: wordpress
|
||||
image: ${var.images.wordpress.registry}/${var.images.wordpress.repository}:${var.images.wordpress.tag}
|
||||
@@ -101,10 +128,10 @@ resource "kubectl_manifest" "Deployment_wordpress" {
|
||||
- name: wordpress-config
|
||||
mountPath: /usr/local/etc/php/conf.d/opcache-recommended.ini
|
||||
subPath: php-opcache-recommended.ini
|
||||
- name: wordpress-config
|
||||
mountPath: /usr/local/etc/php/conf.d/docker-php-ext-redis.ini
|
||||
subPath: docker-php-ext-redis.ini
|
||||
- name: wordpress-config
|
||||
# - name: wordpress-config
|
||||
# mountPath: /usr/local/etc/php/conf.d/docker-php-ext-redis.ini
|
||||
# subPath: docker-php-ext-redis.ini
|
||||
- name: wordpress-scripts
|
||||
mountPath: /usr/local/bin/wp
|
||||
subPath: wp-cli
|
||||
- name: nginx
|
||||
@@ -154,6 +181,15 @@ resource "kubectl_manifest" "Deployment_wordpress" {
|
||||
volumes:
|
||||
- name: wordpress-app
|
||||
emptyDir: {}
|
||||
- name: wordpress-scripts
|
||||
configMap:
|
||||
defaultMode: 0755
|
||||
name: ${kubectl_manifest.wordpress_files.name}
|
||||
items:
|
||||
- key: "vynil-configurator.sh"
|
||||
path: "vynil-configurator.sh"
|
||||
- key: "wp-cli"
|
||||
path: "wp-cli"
|
||||
- name: wordpress-config
|
||||
configMap:
|
||||
name: ${kubectl_manifest.wordpress_files.name}
|
||||
|
||||
Reference in New Issue
Block a user