This project is a template for installing and running WordPress on Heroku. The repository comes bundled with:
- Clone the app (i.e. this repo).
git clone https://github.com/18F/cf-ex-wordpress.git cf-ex-wordpress
cd cf-ex-wordpress
-
Create a service instance of a MySQL Database View Services
cf marketplace
View Specific Service Plans
Template:cf marketplace -s SERVICE
Example:cf marketplace -s mysql56
Create Service Instance
Template:cf create-service SERVICE PLAN SERVICE_INSTANCE
Example:cf create-service mysql56 free mysql-service
-
Create a service instance of S3 Template:
cf create-service SERVICE PLAN SERVICE_INSTANCE
Example:cf create-service s3service free SERVICE_INSTANCE
-
Edit the manifest.yml file. Change the 'host' attribute to something unique. Then under "services:" change "mysql-service" to the name of your MySQL service. This is the name of the service that will be bound to your application and thus used by Wordpress.
-
Deploy the app with a no start command
cf push --no-start
-
Set environment variables for secret keys using Wordpress Secret Key Generator
cf set-env mywordpress-new AUTH_KEY YOUR_KEY
cf set-env mywordpress-new SECURE_AUTH_KEY YOUR_KEY
cf set-env mywordpress-new LOGGED_IN_KEY YOUR_KEY
cf set-env mywordpress-new NONCE_KEY YOUR_KEY
cf set-env mywordpress-new AUTH_SALT YOUR_KEY
cf set-env mywordpress-new SECURE_AUTH_SALT YOUR_KEY
cf set-env mywordpress-new LOGGED_IN_SALT YOUR_KEY
cf set-env mywordpress-new NONCE_SALT YOUR_KEY
- Push it to CloudFoundry.
cf push
Because a file cannot be written to Cloud Foundry's file system, updating and installing plugins or themes should be done locally and then pushed to Cloud Foundry.
Updating your WordPress version is just a matter of merging the updates into the branch created from the installation.
$ git pull # Get the latest
Using the same branch name from our installation:
$ git checkout production
$ git merge master # Merge latest
$ git push heroku production:master
WordPress needs to update the database. After push, navigate to:
http://your-app-url.herokuapp.com/wp-admin
WordPress will prompt for updating the database. After that you'll be good to go.
If you have files that you want tracked in your repo, but do not need deploying (for example, *.md, *.pdf, *.zip). Then add path or linux file match to the .slugignore
file & these will not be deployed.
Examples:
path/to/ignore/
bin/
*.md
*.pdf
*.zip