WordPress 在 OpenShift Origin 中使用官方示例

WordPress in OpenShift Origin using the official example

我已经安装 All-In-One OpenShift Origin Virtual Machine (Version 1.1.6) 并按照 origin/examples/wordpress 中给出的说明部署了 WordPress。 我选择了 NFS storage

我需要知道:

  1. 当我 ls 进入 /home/data/pv0002 时,它按预期显示 MySQL 文件。但是当我 ls 进入 /home/data/pv0001 时,它什么也没显示!不是必须要有 WordPress 文件吗?

  2. 当我尝试在 WordPress 中上传媒体时,它显示如下错误消息

    Unable to create directory wp-content/uploads/2016/05. Is its parent directory writable by the server?

    我该怎么做才能解决这个问题?

  3. 当我尝试安装新主题时,它要求提供 ftp 凭据。我需要做什么才能得到它?

从 POD 登录

warning: both WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP found
  Connecting to WORDPRESS_DB_HOST (mysql)
  instead of the linked mysql container
WordPress not found in /var/www/html - copying now...
WARNING: /var/www/html is not empty - press Ctrl+C now if this is an error!
+ ls -A
+ sleep 10
.htaccess
tar: ./index.php: Cannot change ownership to uid 33, gid 33: Operation not permitted
tar: ./license.txt: Cannot change ownership to uid 33, gid 33: Operation not permitted
tar: ./readme.html: Cannot change ownership to uid 33, gid 33: Operation not permitted
tar: ./wp-activate.php: Cannot change ownership to uid 33, gid 33: Operation not permitted
tar: ./wp-admin/about.php: Cannot change ownership to uid 33, gid 33: Operation not permitted
tar: ./wp-admin/admin-ajax.php: Cannot change ownership to uid 33, gid 33: Operation not permitted
tar: ./wp-admin/admin-footer.php: Cannot change ownership to uid 33, gid 33: Operation not permitted
tar: ./wp-admin/admin-functions.php: Cannot change ownership to uid 33, gid 33: Operation not permitted
tar: ./wp-admin/admin-header.php: Cannot change ownership to uid 33, gid 33: Operation not permitted
tar: ./wp-admin/admin-post.php: Cannot change ownership to uid 33, gid 33: Operation not permitted
tar: ./wp-admin/admin.php: Cannot change ownership to uid 33, gid 33: Operation not permitted

...

tar: ./xmlrpc.php: Cannot change ownership to uid 33, gid 33: Operation not permitted
tar: .: Cannot utime: Operation not permitted
tar: .: Cannot change ownership to uid 33, gid 33: Operation not permitted
tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted
tar: Exiting with failure status due to previous errors 

在 Centos 7 中,我执行了以下步骤并且一切正常。重要的步骤是 345。并且无需将受限的 scc 编辑为 RunAsAny。

第 1 步:

# systemctl status docker
# systemctl status nfs

第 2 步: 启动集群

第 3 步:

# mkdir -p /home/data/pv0001
# mkdir -p /home/data/pv0002
# chmod -R 777 /home/data/
# chown -R nfsnobody:nfsnobody /home/data/

第 4 步:

# cat /etc/exports
/home/data/pv0001 *(rw,sync,no_root_squash)
/home/data/pv0002 *(rw,sync,no_root_squash)

# exportfs -a
# setsebool -P virt_use_nfs 1

第 5 步: 来自 wordpress 项目 system:admin

# oadm policy add-scc-to-user anyuid -z default

这意味着允许此项目中的容器作为 root 运行。

第 6 步: 部署 wordpress