Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions managed_vms/wordpress/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
my-wordpress-project
15 changes: 11 additions & 4 deletions managed_vms/wordpress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ running):

```
$ cd my-wordpress-project
$ php -S localhost:8000 -t wordpress wp.php
$ vendor/bin/wp(.bat) server --path=wordpress
```

Then access http://localhost:8000/. Follow the installation steps,
Then access http://localhost:8080/. Follow the installation steps,
create the admin user and its password. Login to the Dashboard and
update if any of the plugins have update. I’m assuming that the local
network is secure here. If you think differently, maybe you can first
Expand All @@ -133,7 +133,7 @@ Use the shell script wrapper for deployment as follows:
```
$ sh deploy_wrapper.sh \
gcloud preview app deploy \
--promote --stop-previous-version app.yaml
--promote --stop-previous-version app.yaml cron.yaml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI --promote and --stop-previous-version are both the default behavior now, though specifying them isn't necessarily a bad thing

```

Then access your site, use the username and the password you created
Expand Down Expand Up @@ -170,7 +170,14 @@ see the following Batcache stats in the HTML source:
Because the wp-content directory on the server is read-only, you have
to do this locally. Run WordPress locally and update plugins/themes in
the local Dashboard, then deploy, then activate them in the production
Dashboard.
Dashboard. You can also use the `wp-cli` utility as follows:

```
# To update all the plugins
$ vendor/bin/wp plugin update --all --path=wordpress
# To update all the themes
$ vendor/bin/wp theme update --all --path=wordpress
```

### Remove plugins/themes

Expand Down
4 changes: 2 additions & 2 deletions managed_vms/wordpress/src/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ public function runComposer()
{
chdir($this->dir);
exec(
'composer install --no-interaction --no-progress --no-ansi',
'composer update --no-interaction --no-progress --no-ansi',
$output, $ret);
$this->info = array_merge($this->info, $output);
if ($ret !== 0) {
$this->info[] = 'Failed to run composer install in ' . $dir
$this->info[] = 'Failed to run composer update in ' . $dir
. '. Please run it by yourself before running WordPress.';
}
}
Expand Down
2 changes: 1 addition & 1 deletion managed_vms/wordpress/src/WordPressSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
);
$copyFiles = array(
'app.yaml' => '/',
'cron.yaml' => '/',
'composer.json' => '/',
'deploy_wrapper.sh' => '/',
'Dockerfile' => '/',
'gcs-media.php' => '/wordpress/wp-content/plugins/',
'nginx-app.conf' => '/',
'php.ini' => '/',
'wp-config.php' => '/wordpress/',
'wp.php' => '/'
);
$authKeys = array(
'auth_key', 'secure_auth_key', 'logged_in_key', 'nonce_key',
Expand Down
3 changes: 3 additions & 0 deletions managed_vms/wordpress/src/files/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"require": {
"google/appengine-php-sdk": "^1.9"
},
"require-dev": {
"wp-cli/wp-cli": "^0.22.0"
}
}
4 changes: 4 additions & 0 deletions managed_vms/wordpress/src/files/cron.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cron:
- description: wordpress cron tasks
url: /wp-cron.php
schedule: every 15 minutes
17 changes: 12 additions & 5 deletions managed_vms/wordpress/src/files/wp-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,25 @@
// Cache settings
define('WP_CACHE', ON_MVM);

// Disable pseudo cron behavior
define('DISABLE_WP_CRON', true);

if (isset($_SERVER['HTTP_HOST'])) {
define('HTTP_HOST', $_SERVER['HTTP_HOST']);
} else {
define('HTTP_HOST', 'localhost');
}

$memcached_servers = array(
'default' => array(
getenv('MEMCACHE_PORT_11211_TCP_ADDR')
. ':' . getenv('MEMCACHE_PORT_11211_TCP_PORT')
)
);

// Auto detect the URL fails.
define('WP_HOME', ON_MVM ? 'https://' . $_SERVER['HTTP_HOST']
: 'http://' . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', ON_MVM ? 'https://' . $_SERVER['HTTP_HOST']
: 'http://' . $_SERVER['HTTP_HOST']);
// Use https on MVMs.
define('WP_HOME', ON_MVM ? 'https://' . HTTP_HOST : 'http://' . HTTP_HOST);
define('WP_SITEURL', ON_MVM ? 'https://' . HTTP_HOST : 'http://' . HTTP_HOST);

// Need this for cookies.
define('FORCE_SSL_ADMIN', ON_MVM);
Expand Down
49 changes: 0 additions & 49 deletions managed_vms/wordpress/src/files/wp.php

This file was deleted.

2 changes: 1 addition & 1 deletion managed_vms/wordpress/tests/DeployTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static function deploy($project_id, $e2e_test_version)
"sh $target/deploy_wrapper.sh gcloud -q preview app deploy "
. "--version $e2e_test_version "
. "--project $project_id --no-promote "
. "$target/app.yaml",
. "$target/app.yaml $target/cron.yaml",
$output,
$ret
);
Expand Down