1
votes

We are trying to see if Google App Engine will be a good fit for our Wordpress Sites. I just ran into an issue with a plugin that needs to have a folder with read/write/execute permissions.

"All in One WP Migration is not able to create /app/wordpress/wp-content/plugins/all-in-one-wp-migration/storage folder. You will need to create this folder and grant it read/write/execute permissions (0777) for the All in One WP Migration plugin to function properly."

I noticed in order to upload media files, you need to activate the Google Cloud Storage plugin. So this takes care of that issue, but how should I handle plugins and other I/O?

I thought using Flex instead of Standard would fix this.

App.yaml

runtime: php
env: flex

beta_settings:
  cloud_sql_instances: my-project:us-east4:test-instance

runtime_config:
  document_root: wordpress

env_variables:
  WHITELIST_FUNCTIONS: escapeshellarg,escapeshellcmd,exec,pclose,popen,shell_exec,phpversion,php_uname

php.ini

extension=bcmath.so
extension=gd.so
zend_extension=opcache.so
short_open_tag=On
google_app_engine.disable_readonly_filesystem = 1

EDIT:

I found something to put in app.yaml HOWEVER I don't know if this should be something on production

In the runtime_config I added

skip_lockdown_document_root: true

I'd like to know if this acceptable to put on a live site.

I also put:

handlers:
- url: /(.*\.(htm|html|css|js))$
  static_files: wordpress/\1
  upload: wordpress/.*\.(htm|html|css|js)$
  application_readable: true

- url: /wp-content/(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))$
  static_files: wordpress/wp-content/\1
  upload: wordpress/wp-content/.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$
  application_readable: true

- url: /(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))$
  static_files: wordpress/\1
  upload: wordpress/.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$
  application_readable: true

- url: /wp-includes/images/media/(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))$
  static_files: wordpress/wp-includes/images/media/\1
  upload: wordpress/wp-includes/images/media/.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$
  application_readable: true

- url: /wp-admin/(.+)
  script: wordpress/wp-admin/\1
  secure: always

- url: /wp-admin/
  script: wordpress/wp-admin/index.php
  secure: always

- url: /wp-login.php
  script: wordpress/wp-login.php
  secure: always

- url: /wp-cron.php
  script: wordpress/wp-cron.php
  login: admin

- url: /xmlrpc.php
  script: wordpress/xmlrpc.php

- url: /wp-(.+).php
  script: wordpress/wp-\1.php

- url: /(.+)?/?
  script: wordpress/index.php
1

1 Answers

0
votes

If you want to use standard, there's the limitation that GAE apps can't write to the filesystem.

If the plugin requires to write to the filesystem, then you should use flex.

Even when using flex, whatever is written in the filesystem will not be persisted as the only current storage option is to create a ramdisk in the instance, but the data stored there is not shared among instances, and will be lost on instance death.

There seems to be some workaround to use GCSfuse to mount a somewhat persistent storage in GAE flex, but I would not suggest it as you would run into concurrent write issues.

To summarize, if you need to read and write data into a persistent storage shared between all the instances, GAE is not the solution for you. After all, the whole point of serverless is the idempotence of executions. If your app depends on locally stored files (as this Wordpress plugin seems to do), then the result of the execution will depend on what instance is handling the request.