diff --git a/wordpress/Dockerfile b/wordpress/Dockerfile deleted file mode 100644 index 5b2a2c6..0000000 --- a/wordpress/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM clearlinux/php-fpm - -VOLUME /var/www/html - -ENV WORDPRESS_VERSION 5.3.2 -ENV WORDPRESS_SHA1 fded476f112dbab14e3b5acddd2bcfa550e7b01b - -RUN set -ex; \ - curl -o wordpress.tar.gz -fSL "https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz"; \ - echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c -; \ - # upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress - tar -xzf wordpress.tar.gz -C /usr/src/; \ - rm wordpress.tar.gz; \ - chown -R httpd:httpd /usr/src/wordpress - -COPY docker-entrypoint.sh /usr/local/bin/ -ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["php-fpm"] diff --git a/wordpress/README.md b/wordpress/README.md deleted file mode 100644 index e6d9fa1..0000000 --- a/wordpress/README.md +++ /dev/null @@ -1,197 +0,0 @@ -# Clear Linux* OS `wordpress` container image - - -## What is this image? - -`clearlinux/wordpress` is a Docker image with `wordpress` running on top of the -[official clearlinux base image](https://hub.docker.com/_/clearlinux). - - -> [wordpress](https://en.wikipedia.org/wiki/WordPress) is a free and open source -> blogging tool and a content management system (CMS) based on PHP and MySQL, -> which runs on a web hosting service. - -For other Clear Linux* OS -based container images, see: https://hub.docker.com/u/clearlinux - -## Why use a clearlinux based image? - - -> [Clear Linux* OS](https://clearlinux.org/) is an open source, rolling release -> Linux distribution optimized for performance and security, from the Cloud to -> the Edge, designed for customization, and manageability. - -Clear Linux* OS based container images use: -* Optimized libraries that are compiled with latest compiler versions and - flags. -* Software packages that follow upstream source closely and update frequently. -* An aggressive security model and best practices for CVE patching. -* A multi-staged build approach to keep a reduced container image size. -* The same container syntax as the official images to make getting started - easy. - -To learn more about Clear Linux* OS, visit: https://clearlinux.org. - - -## Deployment: - -### Deploy with Docker -The easiest way to get started with this image is by simply pulling it from -Docker Hub. - -*Note: This container is compatible with the [official wordpress -image (fpm tag)](https://hub.docker.com/_/wordpress). It usually works together -with containers mysql(mariadb) and nginx. - - -1. Pull the image from Docker Hub: - ``` - docker pull clearlinux/wordpress - ``` - -2. Start wordpress using the examples below: - - * Use docker-compose to start the wordpress/nginx/mariadb in one-shot: - ``` - docker-compose up - ``` - The configuration is defined in the - [`docker-compose.yml`](https://github.com/clearlinux/dockerfiles/blob/master/wordpress/docker-compose.yml) - - * List wordpress containers info: - ``` - docker container ls - - CONTAINER ID IMAGE PORTS NAMES - - eff987d8f6e9 clearlinux/nginx:latest 0.0.0.0:8080->80/tcp wordpress_nginx_1 - 738f71a6e7fa clearlinux/wordpress:latest 9000/tcp wordpress_wordpress_1 - deaa8614ce8d clearlinux/mariadb:latest 3306/tcp wordpress_db_1 - ``` - -3. Edit web/blog in wordpress: - Open one brower to connect the wordpress blog with URL below. - ``` - http://host-ipaddr:8080/wp-login.php - ``` - - -### Deploy with Kubernetes -This image can also be deployed on a Kubernetes cluster, such as -[minikube](https://kubernetes.io/docs/setup/learning-environment/minikube/).The -following example YAML files are provided in the repository as -reference for Kubernetes deployment: - - * [`pv-local.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/wordpress/pv-local.yaml), [`pvc-local.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/wordpress/pvc-local.yaml): - local persistent volumes for databse and wordpress. - * [`nfs-deployment.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/wordpress/nfs-deployment.yaml), [`pvc-nfs.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/wordpress/pvc-nfs.yaml): - nfs provisioner and volumes for database and wordpress, modified from - [nfs](https://github.com/kubernetes-incubator/external-storage/tree/master/nfs) - * [`mysql-deployment.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/wordpress/mysql-deployment.yaml): - database deployment for wordpress. - * [`wordpress-deployment.yaml`](https://github.com/clearlinux/dockerfiles/blob/master/wordpress/wordpress-deployment.yaml): - example wordpress plus nginx as web server. - -The example utilies nginx, mariadb and wordpress containers. All are Clear Linux -published ones on [official clearlinux base -image](https://hub.docker.com/_/clearlinux). -To deploy the image on a Kubernetes cluster you have two volumes configuration -choices: - - * Use local volume, not appropriate for scaling on multi-node cluster. - ``` - kubectl apply -f pv-local.yaml - kubectl apply -f pvc-local.yaml - ``` - * Use nfs volume, capable for scaling on multi-node cluster. - ``` - kubectl apply -f rbac.yaml - kubectl apply -f nfs-deployment.yaml - kubectl apply -f pvc-nfs.yaml - ``` - -Once the persistent volumes got created, you can continue the wordpress -deployment. - -1. Create secret password for database. - ``` - kubectl apply -f secret.yaml - ``` - -2. Deploy database and wordpress. - ``` - kubectl apply -f mysql-deployment.yaml - kubectl apply -f wordpress-deployment.yaml - ``` - -3. Then check if the pods are running well. - ``` - kubectl get pods -o wide - ``` - -4. Get wordpress PORT and IP - ``` - kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services wordpress - kubectl get nodes -o jsonpath="{.items[0].status.addresses[0].address}" - ``` - -5. Edit web/blog in wordpress: - Open one brower to connect the wordpress blog with PORT and IP got on step 2. - ``` - http://$IP:$PORT - ``` - -If using nfs volumes, you can scale the wordpress depolyment. - ``` - kubectl scale deployments/wordpress --replicas=4 - ``` - -There are two scripts for deploy/clean the wordpress in one-shot command. - * Use local volume, [`deploy-local.sh`](https://github.com/clearlinux/dockerfiles/blob/master/wordpress/). - ``` - ./deploy-local.sh # deploy the wordpress - ./deploy-local.sh down # destroy and clean the wordpress - ``` - - * Use nfs volume, [`deploy-nfs.sh`](https://github.com/clearlinux/dockerfiles/blob/master/wordpress/). - ``` - ./deploy-nfs.sh # deploy the wordpress - ./deploy-nfs.sh down # destroy and clean the wordpress - ``` - - -## Build and modify: - -The Dockerfiles for all Clear Linux* OS based container images are available at -https://github.com/clearlinux/dockerfiles. These can be used to build and -modify the container images. - -1. Clone the clearlinux/dockerfiles repository. - ``` - git clone https://github.com/clearlinux/dockerfiles.git - ``` - -2. Change to the directory of the application: - ``` - cd wordpress/ - ``` - -3. Build the container image: - ``` - docker build -t clearlinux/wordpress . - ``` - - Refer to the Docker documentation for [default build - arguments](https://docs.docker.com/engine/reference/builder/#arg). - Additionally: - - - `swupd_args` - specifies arguments to pass to the Clear Linux* OS software - manager. See the [swupd man - pages](https://github.com/clearlinux/swupd-client/blob/master/docs/swupd.1.rst#options) - for more information. - - -## Licenses - -All licenses for the Clear Linux* Project and distributed software can be found -at https://clearlinux.org/terms-and-policies diff --git a/wordpress/deploy-local.sh b/wordpress/deploy-local.sh deleted file mode 100755 index aababf5..0000000 --- a/wordpress/deploy-local.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -wp_deploy() { - # create local persistent volume claims for database and wordpress - kubectl apply -f pv-local.yaml - kubectl apply -f pvc-local.yaml - - # create secret password for database - kubectl apply -f secret.yaml - - # deploy database and wordpress - kubectl apply -f mysql-deployment.yaml - kubectl apply -f wordpress-deployment.yaml -} - -wp_clean() { - kubectl delete -f wordpress-deployment.yaml - kubectl delete -f mysql-deployment.yaml - kubectl delete -f secret.yaml - kubectl delete -f pvc-local.yaml - kubectl delete -f pv-local.yaml -} - -if [[ $1 =~ "down" ]]; then - wp_clean -else - wp_deploy -fi - - diff --git a/wordpress/deploy-nfs.sh b/wordpress/deploy-nfs.sh deleted file mode 100755 index 4d70b32..0000000 --- a/wordpress/deploy-nfs.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -wp_deploy() { - # create nfs persistent volume claims for database and wordpress - kubectl apply -f rbac.yaml - kubectl apply -f nfs-deployment.yaml - kubectl apply -f pvc-nfs.yaml - - # create secret password for database - kubectl apply -f secret.yaml - - # deploy database and wordpress - kubectl apply -f mysql-deployment.yaml - kubectl apply -f wordpress-deployment.yaml -} - -wp_clean() { - kubectl delete -f wordpress-deployment.yaml - kubectl delete -f mysql-deployment.yaml - kubectl delete -f secret.yaml - kubectl delete -f pvc-nfs.yaml - kubectl delete -f nfs-deployment.yaml - kubectl delete -f rbac.yaml -} - -if [[ $1 =~ "down" ]]; then - wp_clean -else - wp_deploy -fi - - diff --git a/wordpress/docker-compose.yml b/wordpress/docker-compose.yml deleted file mode 100644 index f60bd86..0000000 --- a/wordpress/docker-compose.yml +++ /dev/null @@ -1,45 +0,0 @@ -version: '2' - -services: - db: - image: clearlinux/mariadb:latest - restart: always - environment: - MYSQL_DATABASE: wordpress - MYSQL_USER: clear - MYSQL_PASSWORD: 1234 - MYSQL_ROOT_PASSWORD: 1234 - command: --bind-address=0.0.0.0 - networks: - - code-network - nginx: - image: clearlinux/nginx:latest - ports: - - "8080:80" - links: - - wordpress - volumes: - - html:/var/www/html - - ./wordpress.conf:/etc/nginx/conf.d/default.conf - networks: - - code-network - wordpress: - depends_on: - - db - image: clearlinux/wordpress:latest - restart: always - volumes: - - html:/var/www/html - environment: - WORDPRESS_DB_HOST: db:3306 - WORDPRESS_DB_USER: clear - WORDPRESS_DB_PASSWORD: 1234 - WORDPRESS_DB_NAME: wordpress - command: php-fpm - networks: - - code-network -networks: - code-network: - driver: bridge -volumes: - html: diff --git a/wordpress/docker-entrypoint.sh b/wordpress/docker-entrypoint.sh deleted file mode 100755 index 1ac086d..0000000 --- a/wordpress/docker-entrypoint.sh +++ /dev/null @@ -1,278 +0,0 @@ -#!/bin/bash -set -euo pipefail - -# usage: file_env VAR [DEFAULT] -# ie: file_env 'XYZ_DB_PASSWORD' 'example' -# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of -# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) -file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 - fi - local val="$def" - if [ "${!var:-}" ]; then - val="${!var}" - elif [ "${!fileVar:-}" ]; then - val="$(< "${!fileVar}")" - fi - export "$var"="$val" - unset "$fileVar" -} - -if [ "$1" == php-fpm ]; then - if [ "$(id -u)" = '0' ]; then - # php-fpm - user='httpd' - group='httpd' - else - user="$(id -u)" - group="$(id -g)" - fi - - if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then - # if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) - if [ "$(id -u)" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then - chown "$user:$group" . - fi - - echo >&2 "WordPress not found in $PWD - copying now..." - if [ -n "$(ls -A)" ]; then - echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" - fi - sourceTarArgs=( - --create - --file - - --directory /usr/src/wordpress - --owner "$user" --group "$group" - ) - targetTarArgs=( - --extract - --file - - ) - if [ "$user" != '0' ]; then - # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" - targetTarArgs+=( --no-overwrite-dir ) - fi - tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" - echo >&2 "Complete! WordPress has been successfully copied to $PWD" - if [ ! -e .htaccess ]; then - # NOTE: The "Indexes" option is disabled in the php:apache base image - cat > .htaccess <<-'EOF' - # BEGIN WordPress - - RewriteEngine On - RewriteBase / - RewriteRule ^index\.php$ - [L] - RewriteCond %{REQUEST_FILENAME} !-f - RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule . /index.php [L] - - # END WordPress - EOF - chown "$user:$group" .htaccess - fi - fi - - # allow any of these "Authentication Unique Keys and Salts." to be specified via - # environment variables with a "WORDPRESS_" prefix (ie, "WORDPRESS_AUTH_KEY") - uniqueEnvs=( - AUTH_KEY - SECURE_AUTH_KEY - LOGGED_IN_KEY - NONCE_KEY - AUTH_SALT - SECURE_AUTH_SALT - LOGGED_IN_SALT - NONCE_SALT - ) - envs=( - WORDPRESS_DB_HOST - WORDPRESS_DB_USER - WORDPRESS_DB_PASSWORD - WORDPRESS_DB_NAME - WORDPRESS_DB_CHARSET - WORDPRESS_DB_COLLATE - "${uniqueEnvs[@]/#/WORDPRESS_}" - WORDPRESS_TABLE_PREFIX - WORDPRESS_DEBUG - WORDPRESS_CONFIG_EXTRA - ) - haveConfig= - for e in "${envs[@]}"; do - file_env "$e" - if [ -z "$haveConfig" ] && [ -n "${!e}" ]; then - haveConfig=1 - fi - done - - # linking backwards-compatibility - if [ -n "${!MYSQL_ENV_MYSQL_*}" ]; then - haveConfig=1 - # host defaults to "mysql" below if unspecified - : "${WORDPRESS_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}" - if [ "$WORDPRESS_DB_USER" = 'root' ]; then - : "${WORDPRESS_DB_PASSWORD:=${MYSQL_ENV_MYSQL_ROOT_PASSWORD:-}}" - else - : "${WORDPRESS_DB_PASSWORD:=${MYSQL_ENV_MYSQL_PASSWORD:-}}" - fi - : "${WORDPRESS_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-}}" - fi - - # only touch "wp-config.php" if we have environment-supplied configuration values - if [ "$haveConfig" ]; then - : "${WORDPRESS_DB_HOST:=mysql}" - : "${WORDPRESS_DB_USER:=root}" - : "${WORDPRESS_DB_PASSWORD:=}" - : "${WORDPRESS_DB_NAME:=wordpress}" - : "${WORDPRESS_DB_CHARSET:=utf8}" - : "${WORDPRESS_DB_COLLATE:=}" - - # version 4.4.1 decided to switch to windows line endings, that breaks our seds and awks - # https://github.com/docker-library/wordpress/issues/116 - # https://github.com/WordPress/WordPress/commit/1acedc542fba2482bab88ec70d4bea4b997a92e4 - sed -ri -e 's/\r$//' wp-config* - - if [ ! -e wp-config.php ]; then - awk ' - /^\/\*.*stop editing.*\*\/$/ && c == 0 { - c = 1 - system("cat") - if (ENVIRON["WORDPRESS_CONFIG_EXTRA"]) { - print "// WORDPRESS_CONFIG_EXTRA" - print ENVIRON["WORDPRESS_CONFIG_EXTRA"] "\n" - } - } - { print } - ' wp-config-sample.php > wp-config.php <<'EOPHP' -// If we're behind a proxy server and using HTTPS, we need to alert Wordpress of that fact -// see also http://codex.wordpress.org/Administration_Over_SSL#Using_a_Reverse_Proxy -if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { - $_SERVER['HTTPS'] = 'on'; -} - -EOPHP - chown "$user:$group" wp-config.php - elif [ -e wp-config.php ] && [ -n "$WORDPRESS_CONFIG_EXTRA" ] && [[ "$(< wp-config.php)" != *"$WORDPRESS_CONFIG_EXTRA"* ]]; then - # (if the config file already contains the requested PHP code, don't print a warning) - echo >&2 - echo >&2 'WARNING: environment variable "WORDPRESS_CONFIG_EXTRA" is set, but "wp-config.php" already exists' - echo >&2 ' The contents of this variable will _not_ be inserted into the existing "wp-config.php" file.' - echo >&2 ' (see https://github.com/docker-library/wordpress/issues/333 for more details)' - echo >&2 - fi - - # see http://stackoverflow.com/a/2705678/433558 - sed_escape_lhs() { - echo "$@" | sed -e 's/[]\/$*.^|[]/\\&/g' - } - sed_escape_rhs() { - echo "$@" | sed -e 's/[\/&]/\\&/g' - } - php_escape() { - local escaped="$(php -r 'var_export(('"$2"') $argv[1]);' -- "$1")" - if [ "$2" = 'string' ] && [ "${escaped:0:1}" = "'" ]; then - escaped="${escaped//$'\n'/"' + \"\\n\" + '"}" - fi - echo "$escaped" - } - set_config() { - key="$1" - value="$2" - var_type="${3:-string}" - start="(['\"])$(sed_escape_lhs "$key")\2\s*," - end="\);" - if [ "${key:0:1}" = '$' ]; then - start="^(\s*)$(sed_escape_lhs "$key")\s*=" - end=";" - fi - sed -ri -e "s/($start\s*).*($end)$/\1$(sed_escape_rhs "$(php_escape "$value" "$var_type")")\3/" wp-config.php - } - - set_config 'DB_HOST' "$WORDPRESS_DB_HOST" - set_config 'DB_USER' "$WORDPRESS_DB_USER" - set_config 'DB_PASSWORD' "$WORDPRESS_DB_PASSWORD" - set_config 'DB_NAME' "$WORDPRESS_DB_NAME" - set_config 'DB_CHARSET' "$WORDPRESS_DB_CHARSET" - set_config 'DB_COLLATE' "$WORDPRESS_DB_COLLATE" - - for unique in "${uniqueEnvs[@]}"; do - uniqVar="WORDPRESS_$unique" - if [ -n "${!uniqVar}" ]; then - set_config "$unique" "${!uniqVar}" - else - # if not specified, let's generate a random value - currentVal="$(sed -rn -e "s/define\(\s*(([\'\"])$unique\2\s*,\s*)(['\"])(.*)\3\s*\);/\4/p" wp-config.php)" - if [ "$currentVal" = 'put your unique phrase here' ]; then - set_config "$unique" "$(head -c1m /dev/urandom | sha1sum | cut -d' ' -f1)" - fi - fi - done - - if [ "$WORDPRESS_TABLE_PREFIX" ]; then - set_config '$table_prefix' "$WORDPRESS_TABLE_PREFIX" - fi - - if [ "$WORDPRESS_DEBUG" ]; then - set_config 'WP_DEBUG' 1 boolean - fi - - if ! TERM=dumb php -- <<'EOPHP' -connect_error) { - fwrite($stderr, "\n" . 'MySQL Connection Error: (' . $mysql->connect_errno . ') ' . $mysql->connect_error . "\n"); - --$maxTries; - if ($maxTries <= 0) { - exit(1); - } - sleep(3); - } -} while ($mysql->connect_error); - -if (!$mysql->query('CREATE DATABASE IF NOT EXISTS `' . $mysql->real_escape_string($dbName) . '`')) { - fwrite($stderr, "\n" . 'MySQL "CREATE DATABASE" Error: ' . $mysql->error . "\n"); - $mysql->close(); - exit(1); -} - -$mysql->close(); -EOPHP - then - echo >&2 - echo >&2 "WARNING: unable to establish a database connection to '$WORDPRESS_DB_HOST'" - echo >&2 ' continuing anyways (which might have unexpected results)' - echo >&2 - fi - fi - - # now that we're definitely done writing configuration, let's clear out the relevant envrionment variables (so that stray "phpinfo()" calls don't leak secrets from our code) - for e in "${envs[@]}"; do - unset "$e" - done -fi - -exec "$@" diff --git a/wordpress/mysql-deployment.yaml b/wordpress/mysql-deployment.yaml deleted file mode 100644 index 8af8b93..0000000 --- a/wordpress/mysql-deployment.yaml +++ /dev/null @@ -1,54 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: wordpress-mysql - labels: - app: wordpress -spec: - ports: - - port: 3306 - selector: - app: wordpress - tier: mysql - clusterIP: None ---- -apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 -kind: Deployment -metadata: - name: wordpress-mysql - labels: - app: wordpress -spec: - selector: - matchLabels: - app: wordpress - tier: mysql - strategy: - type: Recreate - template: - metadata: - labels: - app: wordpress - tier: mysql - spec: - containers: - - image: clearlinux/mariadb - name: mysql - imagePullPolicy: IfNotPresent - args: ["--bind-address=0.0.0.0"] - env: - - name: MYSQL_ROOT_PASSWORD - valueFrom: - secretKeyRef: - name: mysql-pass - key: password - ports: - - containerPort: 3306 - name: mysql - volumeMounts: - - name: mysql-persistent-storage - mountPath: /var/lib/mysql - volumes: - - name: mysql-persistent-storage - persistentVolumeClaim: - claimName: pvc-db diff --git a/wordpress/nfs-deployment.yaml b/wordpress/nfs-deployment.yaml deleted file mode 100644 index 8cca046..0000000 --- a/wordpress/nfs-deployment.yaml +++ /dev/null @@ -1,82 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: nfs-provisioner ---- -kind: Service -apiVersion: v1 -metadata: - name: nfs-provisioner - labels: - app: nfs-provisioner -spec: - ports: - - name: nfs - port: 2049 - - name: mountd - port: 20048 - - name: rpcbind - port: 111 - - name: rpcbind-udp - port: 111 - protocol: UDP - selector: - app: nfs-provisioner ---- -kind: Deployment -apiVersion: apps/v1 -metadata: - name: nfs-provisioner -spec: - selector: - matchLabels: - app: nfs-provisioner - replicas: 1 - strategy: - type: Recreate - template: - metadata: - labels: - app: nfs-provisioner - spec: - serviceAccount: nfs-provisioner - containers: - - name: nfs-provisioner - image: quay.io/kubernetes_incubator/nfs-provisioner:latest - ports: - - name: nfs - containerPort: 2049 - - name: mountd - containerPort: 20048 - - name: rpcbind - containerPort: 111 - - name: rpcbind-udp - containerPort: 111 - protocol: UDP - securityContext: - capabilities: - add: - - DAC_READ_SEARCH - - SYS_RESOURCE - args: - - "-provisioner=example.com/nfs" - env: - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - - name: SERVICE_NAME - value: nfs-provisioner - - name: POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - imagePullPolicy: "IfNotPresent" - volumeMounts: - - name: export-volume - mountPath: /export - volumes: - - name: export-volume - hostPath: - path: /tmp/nfs - diff --git a/wordpress/pv-local.yaml b/wordpress/pv-local.yaml deleted file mode 100644 index 2ef154b..0000000 --- a/wordpress/pv-local.yaml +++ /dev/null @@ -1,29 +0,0 @@ -kind: PersistentVolume -apiVersion: v1 -metadata: - name: pv-1 - labels: - type: local -spec: - capacity: - storage: 500Mi - accessModes: - - ReadWriteOnce - hostPath: - path: "/tmp/data/pv-1" - persistentVolumeReclaimPolicy: Recycle ---- -kind: PersistentVolume -apiVersion: v1 -metadata: - name: pv-2 - labels: - type: local -spec: - capacity: - storage: 500Mi - accessModes: - - ReadWriteOnce - hostPath: - path: "/tmp/data/pv-2" - persistentVolumeReclaimPolicy: Recycle diff --git a/wordpress/pvc-local.yaml b/wordpress/pvc-local.yaml deleted file mode 100644 index 7a1b929..0000000 --- a/wordpress/pvc-local.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: pvc-db - labels: - app: wordpress -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 500Mi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: pvc-wp - labels: - app: wordpress -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 500Mi diff --git a/wordpress/pvc-nfs.yaml b/wordpress/pvc-nfs.yaml deleted file mode 100644 index 38a777c..0000000 --- a/wordpress/pvc-nfs.yaml +++ /dev/null @@ -1,33 +0,0 @@ -kind: StorageClass -apiVersion: storage.k8s.io/v1 -metadata: - name: example-nfs -provisioner: example.com/nfs -mountOptions: - - vers=4.1 ---- -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: pvc-db - annotations: - volume.beta.kubernetes.io/storage-class: "example-nfs" -spec: - accessModes: - - ReadWriteMany - resources: - requests: - storage: 500Mi ---- -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: pvc-wp - annotations: - volume.beta.kubernetes.io/storage-class: "example-nfs" -spec: - accessModes: - - ReadWriteMany - resources: - requests: - storage: 500Mi diff --git a/wordpress/rbac.yaml b/wordpress/rbac.yaml deleted file mode 100644 index 0d96ad1..0000000 --- a/wordpress/rbac.yaml +++ /dev/null @@ -1,61 +0,0 @@ -kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: nfs-provisioner-runner -rules: - - apiGroups: [""] - resources: ["persistentvolumes"] - verbs: ["get", "list", "watch", "create", "delete"] - - apiGroups: [""] - resources: ["persistentvolumeclaims"] - verbs: ["get", "list", "watch", "update"] - - apiGroups: ["storage.k8s.io"] - resources: ["storageclasses"] - verbs: ["get", "list", "watch"] - - apiGroups: [""] - resources: ["events"] - verbs: ["create", "update", "patch"] - - apiGroups: [""] - resources: ["services", "endpoints"] - verbs: ["get"] - - apiGroups: ["extensions"] - resources: ["podsecuritypolicies"] - resourceNames: ["nfs-provisioner"] - verbs: ["use"] ---- -kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: run-nfs-provisioner -subjects: - - kind: ServiceAccount - name: nfs-provisioner - # replace with namespace where provisioner is deployed - namespace: default -roleRef: - kind: ClusterRole - name: nfs-provisioner-runner - apiGroup: rbac.authorization.k8s.io ---- -kind: Role -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: leader-locking-nfs-provisioner -rules: - - apiGroups: [""] - resources: ["endpoints"] - verbs: ["get", "list", "watch", "create", "update", "patch"] ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: leader-locking-nfs-provisioner -subjects: - - kind: ServiceAccount - name: nfs-provisioner - # replace with namespace where provisioner is deployed - namespace: default -roleRef: - kind: Role - name: leader-locking-nfs-provisioner - apiGroup: rbac.authorization.k8s.io diff --git a/wordpress/secret.yaml b/wordpress/secret.yaml deleted file mode 100644 index 7980109..0000000 --- a/wordpress/secret.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: mysql-pass -type: Opaque -data: - password: Y2xlYXJsaW51eA== diff --git a/wordpress/wordpress-deployment.yaml b/wordpress/wordpress-deployment.yaml deleted file mode 100644 index 3a9984b..0000000 --- a/wordpress/wordpress-deployment.yaml +++ /dev/null @@ -1,95 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: wordpress - labels: - app: wordpress -spec: - ports: - - port: 80 - nodePort: 30180 - selector: - app: wordpress - tier: frontend -# type: LoadBalancer - type: NodePort ---- -kind: ConfigMap -apiVersion: v1 -metadata: - name: nginx-config -data: - nginx.conf: | - server { - listen 80; - index index.php index.html; - server_name localhost; - error_log /var/log/nginx/error.log; - access_log /var/log/nginx/access.log; - root /var/www/html; - - location ~ \.php$ { - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass localhost:9000; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - } - } - ---- -apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 -kind: Deployment -metadata: - name: wordpress - labels: - app: wordpress -spec: - selector: - matchLabels: - app: wordpress - tier: frontend - strategy: - type: Recreate - template: - metadata: - labels: - app: wordpress - tier: frontend - spec: - containers: - - image: clearlinux/nginx - name: nginx - imagePullPolicy: IfNotPresent - ports: - - containerPort: 80 - volumeMounts: - - name: wordpress-persistent-storage - mountPath: /var/www/html - - name: nginx-config-volume - mountPath: /etc/nginx/conf.d - - image: clearlinux/wordpress - name: wordpress - imagePullPolicy: IfNotPresent - env: - - name: WORDPRESS_DB_HOST - value: wordpress-mysql - - name: WORDPRESS_DB_PASSWORD - valueFrom: - secretKeyRef: - name: mysql-pass - key: password - volumeMounts: - - mountPath: /var/www/html - name: wordpress-persistent-storage - volumes: - - name: wordpress-persistent-storage - persistentVolumeClaim: - claimName: pvc-wp - # Add the ConfigMap we declared above as a volume for the pod - - name: nginx-config-volume - configMap: - name: nginx-config - diff --git a/wordpress/wordpress.conf b/wordpress/wordpress.conf deleted file mode 100644 index 06e286d..0000000 --- a/wordpress/wordpress.conf +++ /dev/null @@ -1,19 +0,0 @@ -server { - listen 80; - index index.php index.html; - server_name localhost; - error_log /var/log/nginx/error.log; - access_log /var/log/nginx/access.log; - root /var/www/html; - - location ~ \.php$ { - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass wordpress:9000; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - } -} -