Name: bluemix-wordpress
Owner: IBM jStart
Description: null
Created: 2017-01-20 15:12:15.0
Updated: 2018-04-21 01:09:28.0
Pushed: 2017-04-28 21:27:01.0
Homepage: null
Size: 149
Language: ApacheConf
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
WordPress is an open source content management system (CMS) that is popular with both businesses and bloggers. WordPress is extendable and customizable through themes, plugins, and templates that make it easy to transform the site to meet your exact needs.
WordPress on Bluemix uses the Composer package manager to install the wordpress package from johnpbloch and configures the installation to use Compose (MySQL) for data and IBM Object Storage for media.
ATTENTION: Since only one instance of the Object Storage Free plan is allowed per organization, this repository defaults to use of the standard plan
The SendGrid plugin is included by default, but must be activated. To add email support to your WordPress site:
Settings > SendGrid
and enter your SendGrid credentials (available via “Show Credentials” in the web UI or cf env
from the cf cli)Navigate to the plugins page in the admin dashboard.
Find the WP Super Cache plugin in the list and click Activate
A message at the top of the page says,
Super Cache is disabled. Please go to the plugin admin page to enable caching."
k on the plugin admin page.
If you are directed to a page that says, “Permalink Structure Error”, a custom URL or permalink structure is required for the plugin to work correctly.
Navigate to the WP Super Cache settings under the Settings Tab.
Turn caching on. Hit Update Status.
Congratulations! You are now using caching!
WordPress on Bluemix uses the Composer package manager for both the installation of the WordPress core and also for the installation of all plugins and themes.
Applications on Bluemix have an ephemeral filesystem, meaning that each time your application is restaged, the container that stores the files is destroyed and recreated from the application package. Therefore, WordPress on Bluemix disables in-place upgrades and warns against the web-based installation of plugins and themes.
Instead, to edit your installation, you must modify the composer.json file and re-push the application to Bluemix.
The default composer config from this repository will install the latest stable WordPress package, each time the application is staged. If you would like to avoid unexpected upgrades, please change the following line in composer.json in order to lock into a specific version or version range:
npbloch/wordpress" : "*",
After each update to WordPress core, you may need to apply changes to the database.
WordPress should detect this and prompt you to run the database update from the
WordPress dashboard (https://
Contributing to the wp-openstack-objectstorage plugin, look here on how to make your changes work.
Note: the SendGrid and WP Super Cache plugins must be manually enabled
One of the most important files in your WordPress installation is the wp-config.php file. This file is located in the root of your WordPress file directory and contains your website's base configuration details, such as database connection information.
This repository's composer.json requires a github repository which provides a specially crafted default wp-config.php. After deployment, you may choose to perform additional administrative actions (e.g. Activating/enabling WP Super Cache, etc …) which can potentially modify the Bluemix application's wp-config.php. Given the ephemeral nature of Cloud Foundry container file systems, you must capture and persist this in-use wp-config.php within the repository or risk losing your admin actions entirely upon application restart/update.
To persist requires a 3 step process …
one your deployment repo and make it the current working directory
t clone your_open_toolchain_github_repo_or_hub_jazz_net_repo
your_git_repo
tch the current wp-config.php file and save it to the lib folder
ssh appName -c "cat ~/app/htdocs/wp-config.php" > ./lib/wp-config.php
dify composer.json commands to move your persisted file into the expected location,
ther than the default one.
t-xxxxxx-cmd" : [
[...]
"mv lib/wp-config.php htdocs",
[...]
]
Both the post-update-cmd and post-install-cmd sections should be updated to look like this:
t-xxxxxx-cmd" : [
"mv vendor/ibmjstart/wp-bluemix-config/mu-plugins htdocs/wp-content/mu-plugins",
"mv vendor/ibmjstart/wp-bluemix-config/.user.ini htdocs",
"mv lib/wp-config.php htdocs",
"mv vendor htdocs/vendor",
"mv lib/.htaccess htdocs"
]
Finally, commit your changes to your git repo. The continuous delivery pipeline will trigger and redeploy your Wordpress application – with a persisted wp-config.php.
Any number of subsequent Wordpress admin changes can be recaptured by executing Step 2 again …
and committing your changes to the git repository.
ssh appName -c "cat ~/app/htdocs/wp-config.php" > ./lib/wp-config.php
IBM Object Storage is a service that exposes OpenStack Swift APIs for storing “objects” like files.
IBM Object Storage is useful because WordPress traditionally relies on the local file system for things like media uploads. Bluemix, like other cloud platform, recycles the application container each time the application is staged. This action would result in losing your media files every time that you push or restart your Bluemix app. With IBM Object Storage, files are uploaded to the service so that they are never lost. The SoftLayer Swift plugin within WordPress provides an admin settings page so that you can manage your containers and your upload options.
SendGrid is an easy to use email service that that enables your WordPress website to send emails for things like forgotten passwords or comment notifications.
WordPress on Bluemix uses composer, a PHP dependency manager, to dynamically install your plugins and themes. You can manage all plugins, even the WordPress core version, via composer by modifying the composer.json file.
Open the composer.json file. Under the required section, you enter the information for what is being added. There is a specific composer vendor, wpackagist, that mirrors WordPress' SVN repositories for both plugins and themes. This creates a simple way to add more plugins and themes.
If you want to specify a version of WordPress, you can change the following line: “johnpbloch/wordpress” : “*“. The * can be replaced with your desired version number. For more information about the version notation, see package versions.
If you are adding a plugin, the vendor name is wpackagist-plugin. The package name is whatever the plugin developer registered their plugin as. If you want to install a plugin that is called hello-world, then add wpackagist-plugin/hello-world in the require section.
Adding a theme follows a similar model, but the vendor name is wpackagist-theme
After that, specify a version number. You can use * to grab the most up-to-date version of a plugin. For themes, use the * in all cases. Example:
ckagist-plugin/hello-world": "*"
ckagist-theme/twentytwelve: "*"
For more information on packages and themes, see WordPress Packagist.
Private and premium Wordpress plugins can be challenging to incorporate in this code repository. Unlike public themes and plugins which can be obtained via wpackagist or another publically accessible git repository, private plugins usually need to be present as a local asset. To leverage private plugins, you will need to do the following 3 steps:
Download and extract your Private Wordpress Plugin(s) into separate subfolder(s) under the parent folder named lib which is located at the root of this repository. The parent folder name must remain as lib to ensure that the PHP CloudFoundry buildpack leaves the contents alone.
For each private plugin, add a composer.json file to the root of the folder with something similar to the following:
"name": "thethemefoundry/make-plus",
"type": "wordpress-plugin",
"keywords": ["wordpress", "plugin"],
"license": "This software is NOT to be distributed, but can be INCLUDED in WP themes: Premium or Contracted.",
"require": {
"php": ">=5.3.2",
"composer/installers": "v1.0.7"
}
Finally, we need to tell composer where to place this privately sourced plugin folder. Modify this projects composer.json within the post-install-cmd and post-update-cmd arrays to include a command for moving your private plugin content to the wp-content plugins folder. The command will look similar to this:
lib/my-personal-plugin-folder htdocs/wp-content/plugins"
503 Service Unavailable
You probably have too many concurrent users who are trying to access your website OR the web installer has tried to establish too many concurrent connections to the MySQL service. By default, WordPress on Bluemix uses the Standard tier of Compose's MySQL database as a service that is suitable for trial usage. However, for real usage, consider upgrading the resource allocations which provide you with more simultaneous connections and more storage space.
You can also try activating the WP Super Cache Plugin.
Bluemix supports the concept of a User-Provided Service CUPS. You will simply need to identify the mysql:// url from your service provider's web ui …
Create a custom MySQL User-Provided Service via this command:
ups myCustomDB -p '{"uri":"mysql://USER:PASSWORD@COMPOSE_REGION:PORT/compose"}'
You will need to update the manifest.yml within your project's git repository to reflect this new service instance name AND bind this new user-provided service to your application while unbinding the default MySQL service instance provided by this repository. To illustrate:
BEFORE [manifest.yml]
] ices: ObjectStorage ComposeMySQL
AFTER [manifest.yml]
] ices: ObjectStorage CustomDB
nbind-service appname myComposeMySQL ind-service appname myCustomDB
During application deployment, the environment variable parsing routines within the wp-bluemix-config repository will detect the user-provided service instance and populate the configuration accordingly during app restaging.
Remember: Association to a new empty DB will trigger the WordPress web installation sequence.
Bluemix provides built-in support for scaling your apps. If the slowdown is load-related, increasing the number of instances may improve response times. You can also try activating the WP Super Cache Plugin.
Check the health of the Object Storage service in your region via https://ibm.biz/bluemixstatus
The .htaccess is a distributed config file. Wordpress uses this file to manipulate how Apache serves files from its root directory and subdirectories thereof. Most notably, WP modifies this file to be able to handle pretty permalinks. An example of a default version can be found here . If your routes unexpectedly stop working until you reset your permalinks settings within the Admin dashboard, then you are most likely dealing with a .htaccess file that is either corrupt or being deleted after app restart. Use the cf files or the Bluemix dashboard to inspect the .htaccess file which should be present at /app/htdocs/.htaccess. Visit the lib folder of this repository and update the .htaccess default file provided in this repo.
This value, along with several others, is defined in the .user.ini file in the root directory. You can change the value to anything you like, but keep in mind that the default disk quota in a Bluemix app is 1 GB, and it can be a maximum of 2 GB.
Newer versions of this repository use composer with loose version ranges in order to help keep this project up-to-date (at the cost of some stability). Simply restage your application to pick up the updated dependencies.
If you have installed a previous version of the boilerplate that used Object Storage (v1), please see the following instructions for how to migrate your WordPress from Object Storage v1 to the new Object Storage service on Bluemix: http://blog.ibmjstart.net/2015/11/30/migrating-wordpress-on-bluemix