Clone the repository from Github
$ git clone git://github.com/mhoofman/wordpress-heroku.git
With the Heroku gem, create your app
$ cd wordpress-heroku $ heroku create --stack cedar > Creating strange-turtle-1234... done, stack is cedar > http://strange-turtle-1234.herokuapp.com/ | email@example.com:strange-turtle-1234.git > Git remote heroku added
Add a database to your app
$ heroku addons:add shared-database:5mb > -----> Adding shared-database:5mb to strange-turtle-1234... done, v3 (free)
Create a new branch for any configuration/setup changes needed
$ git checkout -b production
$ cp wp-config-sample.php wp-config.php
.gitignore and commit
$ >.gitignore $ git add . $ git commit -m "zomg wordpress"
Deploy to Heroku
$ git push heroku production:master > -----> Heroku receiving push > -----> PHP app detected > -----> Bundling Apache v2.2.19 > -----> Bundling PHP v5.3.6 > -----> Discovering process types > Procfile declares types -> (none) > Default types for PHP -> web > -----> Compiled slug size is 24.9MB > -----> Launcing... done, v5 > http://strange-turtle-1234.herokuapp.com deployed to Heroku > > To git@heroku:strange-turtle-1234.git > * [new branch] production -> master
After deployment WordPress has a few more steps to setup and thats it!
- Because a file cannot be written to Heroku's file system, updating and installing plugins or themes should be done locally and then pushed to Heroku.
- To run WordPress locally on Mac OS X try MAMP.
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:
WordPress will prompt for updating the database. After that you'll be good to go.
Heroku allows you to add custom domains to your site hosted with them. To add your custom domain, enter in the follow commands.
$ heroku domains:add www.example.com > Added www.example.com as a custom domain name to myapp.heroku.com
You'll also want to cover the non "www" side of the url.
$ heroku domains:add example.com > Added example.com as a custom domain name to myapp.heroku.com
Once Heroku recognizes your custom domain(s) you'll then need to setup separate DNS A records for the following ip addresses to point to your domain:
18.104.22.168 22.214.171.124 126.96.36.199
Once the DNS A records propagate, then simply test out your change by hitting the url in the browser to make sure you are good to go. If you are in need of cheap DNS hosting then I would recommend DNSimple.
The last step is updating your WordPress installation to recognize the new domain. You'll need to open up the WordPress Admin Dashboard and go to Settings --> General. From there just update the URL for the WordPress address and you're done.
If you find yourself running into problems, there is a guide posted in the Heroku Docs which can be found here.