diff --git a/.vib/wordpress/goss/goss.yaml b/.vib/wordpress/goss/goss.yaml new file mode 100644 index 000000000000..0fb0b285fd8b --- /dev/null +++ b/.vib/wordpress/goss/goss.yaml @@ -0,0 +1,11 @@ +gossfile: + # Goss tests exclusive to the current container + ../../wordpress/goss/wordpress.yaml: {} + # Load scripts from .vib/common/goss/templates + ../../common/goss/templates/check-broken-symlinks.yaml: {} + ../../common/goss/templates/check-ca-certs.yaml: {} + ../../common/goss/templates/check-components-binaries.yaml: {} + ../../common/goss/templates/check-components-files.yaml: {} + ../../common/goss/templates/check-directories-permissions.yaml: {} + ../../common/goss/templates/check-linked-libraries.yaml: {} + ../../common/goss/templates/check-sed-in-place.yaml: {} \ No newline at end of file diff --git a/.vib/wordpress/goss/vars.yaml b/.vib/wordpress/goss/vars.yaml new file mode 100644 index 000000000000..f8a5411c0b1d --- /dev/null +++ b/.vib/wordpress/goss/vars.yaml @@ -0,0 +1,44 @@ +components: + binaries: + - apachectl + - gosu + - mariadb + - php + - render-template + - wp + files: + - /opt/bitnami/apache/modules/libphp.so + - /opt/bitnami/wordpress/wp-config.php +filesystem: + - mode: "0775" + directories: + - /bitnami/wordpress + - /opt/bitnami/wordpress + - /opt/bitnami/wordpress/tmp + - /opt/bitnami/wordpress/wp-content/upgrade + - /opt/bitnami/wordpress/wp-content/uploads + - /opt/bitnami/wordpress/wp-content/languages + # WP-CLI + - /opt/bitnami/wp-cli/.cache + - /opt/bitnami/wp-cli/.packages +phpmodules: +# Based on https://make.wordpress.org/hosting/handbook/server-environment/#php-extensions +# Required + - json + - mysqli +# Recommended + - curl + - dom + - exif + - fileinfo + - hash + - imagick + - mbstring + - sodium + - openssl + - pcre + - xml + - zip +# Specific from postunpack logic + - memcached +root_dir: /opt/bitnami \ No newline at end of file diff --git a/.vib/wordpress/goss/wordpress.yaml b/.vib/wordpress/goss/wordpress.yaml new file mode 100644 index 000000000000..0970fdf38651 --- /dev/null +++ b/.vib/wordpress/goss/wordpress.yaml @@ -0,0 +1,49 @@ +file: + # HTTP vhost should have been properly rendered + {{ .Vars.root_dir }}/apache/conf/vhosts/wordpress-vhost.conf: + exists: true + filetype: file + contains: + - "RewriteRule ^bitnami/wordpress(/.*) $1" + - /DocumentRoot.*{{ .Vars.root_dir }}/wordpress/ + # HTTPs vhost should have been properly rendered + {{ .Vars.root_dir }}/apache/conf/vhosts/wordpress-https-vhost.conf: + exists: true + filetype: file + contains: + - "SSLEngine on" + - "RewriteRule ^bitnami/wordpress(/.*) $1" + - /DocumentRoot.*{{ .Vars.root_dir }}/wordpress/ + # WP-CLI should point to wordpress' installation path + {{ .Vars.root_dir }}/wp-cli/conf/wp-cli.yml: + exists: true + filetype: file + contains: + - /path.*{{ .Vars.root_dir }}/wordpress/ +command: + check-app-version: + exec: cat {{ .Vars.root_dir }}/wordpress/wp-includes/version.php | grep "wp_version" + exit-status: 0 + stdout: + - {{ .Env.APP_VERSION }} + # WP-CLI points to correct binaries and config file + check-wp-cli-conf: + exec: wp --info + exit-status: 0 + stdout: + - "{{ .Vars.root_dir }}/php/bin/php" + - "{{ .Vars.root_dir }}/mysql/bin/mysql" + - "{{ .Vars.root_dir }}/wp-cli/conf/wp-cli.yml" + check-enabled-modules: + exec: php -m + exit-status: 0 + stdout: + {{ range $module := .Vars.phpmodules }} + - "{{ $module }}" + {{ end }} +group: + daemon: + exists: true +user: + daemon: + exists: true \ No newline at end of file diff --git a/.vib/wordpress/vib-publish.json b/.vib/wordpress/vib-publish.json index f58738648055..2f41af0c5941 100644 --- a/.vib/wordpress/vib-publish.json +++ b/.vib/wordpress/vib-publish.json @@ -3,7 +3,8 @@ "resources": { "url": "{VIB_ENV_CONTAINER_URL}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -33,6 +34,19 @@ }, "verify": { "actions": [ + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "wordpress/goss/goss.yaml", + "vars_file": "wordpress/goss/vars.yaml", + "remote": { + "workload": "deploy-wordpress" + } + } + }, { "action_id": "trivy", "params": { diff --git a/.vib/wordpress/vib-verify.json b/.vib/wordpress/vib-verify.json index 835cd556e241..b510c81ec3e9 100644 --- a/.vib/wordpress/vib-verify.json +++ b/.vib/wordpress/vib-verify.json @@ -3,7 +3,8 @@ "resources": { "url": "{SHA_ARCHIVE}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -29,6 +30,19 @@ }, "verify": { "actions": [ + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "wordpress/goss/goss.yaml", + "vars_file": "wordpress/goss/vars.yaml", + "remote": { + "workload": "deploy-wordpress" + } + } + }, { "action_id": "trivy", "params": {