SlideShare a Scribd company logo
1 of 21
Download to read offline
Deploying WP Multisite
to Heroku
WordCamp Finland 2016
Helsinki 15.4.2016
Jussi Kinnula <jussi.kinnula@frantic.com>
https://github.com/jussikinnula
Prerequisites
- Mac OS X (latest)
- Note! Most of the tools are available also on Linux systems
- Homebrew:
- http://brew.sh/
- Heroku toolbelt:
- https://toolbelt.heroku.com/
- ClearDB dump (Heroku utility):
- https://github.com/josepfrantic/heroku-cleardbdump
- Bedrock (boilerplate):
- Original version (without Heroku-specific configuration): https://github.com/roots/bedrock
- Fork with Heroku & multisite related configuration: https://github.com/frc/bedrock-on-heroku
Installing tools, part I
After installing Homebrew & Heroku toolbelt & ClearDB dump utility, we need to
install some packages that WordPress and Heroku Local needed.
$ brew install php56 --with-fpm
$ brew install mysql redis
$ brew install php56-redis php56-timezonedb php56-igbinary
composer
$ brew install libpng jpeg giflib libtiff
…
Installing tools, part II
…
$ brew tap homebrew/nginx
$ brew install nginx-full --with-realip
Reverse proxy is needed for local development, we use a Node module:
$ brew install node
$ npm install -g reverse-proxy-js
Please test, that everything works…
Setup the project
$ cd ~/dev
$ git clone git@github.com:frc/bedrock-on-heroku.git my-project
$ cd my-project
$ rm -rf .git
$ git init
$ git add -A . && git commit -am ‘initial commit’
Set local “environment”
Make sure first that MySQL and Redis servers are running.
$ mysqladmin -uroot create my-project
$ cat > .env
CLEARDB_DATABASE_URL=mysql://root:@127.0.0.1/my-project
#WP_ALLOW_MULTISITE=true
#WP_MULTISITE_MAIN_DOMAIN=localhost.frc.io
^C
Composer configuration, part I
{
"name": "roots/bedrock",
"type": "project",
"license": "MIT",
"description": "A modern WordPress stack",
"homepage": "https://roots.io/bedrock/",
"authors": [
{
"name": "Scott Walkinshaw",
"email": "scott.walkinshaw@gmail.com",
"homepage": "https://github.com/swalkinshaw"
},
{
"name": "Ben Word",
"email": "ben@benword.com",
"homepage": "https://github.com/retlehs"
}
],
Please edit to your needs (project-
specific stuff generally).
Composer configuration, part II
"keywords": [
"bedrock", "roots", "wordpress", "stack",
"composer", "vagrant", "wp"
],
"support": {
"issues": "https://github.
com/roots/bedrock/issues",
"forum": "https://discourse.roots.
io/category/bedrock"
},
"config": {
"preferred-install": "dist"
},
Composer configuration, part III
"repositories": [
{
"type": "vcs",
"url": "https://github.com/frc/wp-amazon-s3-and-cloudfront"
},
{
"type": "composer",
"url": "http://wpackagist.org"
}
],
Extra repositories to get stuff
from. By default composer
installs stuff from packagist.
org repositories.
WordPress packages are
generally on wpackagist.org
and there’s on GitHub
repository + a Satis custom
repository for extra packages.
Composer configuration, part IV
"require-dev": {
"heroku/heroku-buildpack-php": "dev-master"
},
Heroku Local development tools are installed by
simply having a development require for Heroku’
s PHP buildpack.
Composer configuration, part V
"require": {
"ext-redis": "*",
"ext-gd": "*",
"frc/batcache": "~1.2-p1",
"deliciousbrains/wp-amazon-s3-and-cloudfront": "dev-frc",
"wpackagist-plugin/amazon-web-services": "~0.3.2",
"wpackagist-plugin/sendgrid-email-delivery-simplified": "~1.
6.2",
"wpackagist-plugin/limit-login-attempts": "~1.7.1",
"tillkruss/redis-object-cache": "~1.2.1",
"frc/wp-env-heroku-cleardb": "~1.0.1",
"frc/wp-env-heroku-redis": "~1.0.0",
"frc/wp-env-heroku-sendgrid": "~1.0.0",
"frc/wp-env-heroku-amazon-aws": "~1.0.0",
"php": "^5.6",
"composer/installers": "~1.0.21",
"vlucas/phpdotenv": "~2.0.1",
"johnpbloch/wordpress": "~4.3.1"
},
Requirements include some extra
packages related to caching (page
cache batcache, object cache redis-
object-cache), Amazon integration
(media files to S3 bucket), Sendgrid
integration (send E-mails via Sendgrid)
and Advanced Custom Fields Pro.
Heroku configuration is read with wp-
env-heroku-???????? Modules
(ClearDB, Redis, SendGrid and Amazon
AWS credentials).
Composer configuration, part VI
"scripts": {
"post-update-cmd": [
"cp web/app/plugins/wordpress-mu-domain-mapping/sunrise.php
web/app/sunrise.php",
"cp web/app/plugins/redis-object-cache/includes/object-cache.
php web/app/object-cache.php",
"cp web/app/mu-plugins/batcache/advanced-cache.php
web/app/advanced-cache.php"
],
"post-install-cmd": [
"cp web/app/plugins/wordpress-mu-domain-mapping/sunrise.php
web/app/sunrise.php",
"cp web/app/plugins/redis-object-cache/includes/object-cache.
php web/app/object-cache.php",
"cp web/app/mu-plugins/batcache/advanced-cache.php
web/app/advanced-cache.php"
]
},
Post update commands are run to
copy sunrise.php, object-cache.php
and advanced-cache.php to their
correct places. Post install does
similar stuff.
Sunrise is for custom domain names
plug-in, and the other two are for
caching.
Composer configuration, part VII
"extra": {
"installer-paths": {
"web/app/mu-plugins/{$name}/": ["type:wordpress-
muplugin"],
"web/app/plugins/{$name}/": ["type:wordpress-plugin"],
"web/app/themes/{$name}/": ["type:wordpress-theme"]
},
"wordpress-install-dir": "web/wp"
}
}
Defining installer paths and WordPress
installation directory.
Note that this “web” and “web/wp” style of
directories comes from the Bedrock
structures.
$ composer install
# Get reverse proxy running
$ sudo reverse-proxy 
--port 80 --target 5000
$ heroku local
http://localhost.frc.io
WordPress setup (common)
● We’ll do first a regular WordPress setup, no multi-site related stuff
● After everything is setup, then heroku local will be stopped (CTRL+C) - and
.env modified to the following:
CLEARDB_DATABASE_URL=mysql://root:@127.0.0.1/my-project
WP_ALLOW_MULTISITE=true
#WP_MULTISITE=localhost.frc.io
● Then just restart heroku local …
WordPress setup (enable multisite)
● Now with WP_ALLOW_MULTISITE=true
being active, you can get to enabling
multisite on WP admin
● You don’t have to actually do any
copy&pasting for the code after
enabling multisite, as we have the
necessary code already implemented
in config/application.php -file
● After enabling multisite, just stop
heroku local (CTRL+C) and
uncomment the last line in .env and
start it again
● Setting the multisite domain sets also
the other definitions
CLEARDB_DATABASE_URL=mysql://root:@127.0.0.1
/my-project
WP_ALLOW_MULTISITE=true
WP_MULTISITE_MAIN_DOMAIN=localhost.frc.io
if (getenv('WP_MULTISITE_MAIN_DOMAIN')) {
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', getenv
('WP_MULTISITE_MAIN_DOMAIN'));
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define('SUNRISE', true);
}
Main site:
http://localhost.frc.io
Site #1:
http://anything.localhost.frc.io
Site #2:
http://else.localhost.frc.io
Deploy to Heroku
$ heroku create --region eu my-project
$ heroku addons:create cleardb:ignite
$ heroku addons:create heroku-redis:hobby-dev
$ git push heroku master
$ heroku cleardb:push my-project --search localhost.frc.io 
--replace wordcamp.frc.io
$ heroku domains:add wordcamp.frc.io
$ heroku domains:add *.wordcamp.frc.io
http://wordcamp.frc.io
http://anything.wordcamp.frc.io
http://else.wordcamp.frc.io
http://wordcamp.aksurules.com
Thanks

More Related Content

What's hot

2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Herokuronnywang_tw
 
Bower - A package manager for the web
Bower - A package manager for the webBower - A package manager for the web
Bower - A package manager for the webLarry Nung
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Soshi Nemoto
 
GIT, RVM, FIRST HEROKU APP
GIT, RVM, FIRST HEROKU APPGIT, RVM, FIRST HEROKU APP
GIT, RVM, FIRST HEROKU APPPavel Tyk
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
DevOps for Opensource Geospatial Applications
DevOps for Opensource Geospatial ApplicationsDevOps for Opensource Geospatial Applications
DevOps for Opensource Geospatial Applicationstlpinney
 
Using Composer with Drupal and Drush
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Using Composer with Drupal and DrushPantheon
 
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史Shengyou Fan
 
Composer Tools & Frameworks for Drupal
Composer Tools & Frameworks for DrupalComposer Tools & Frameworks for Drupal
Composer Tools & Frameworks for DrupalPantheon
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with AugeasPuppet
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Cosimo Streppone
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetOmar Reygaert
 
Lessons from running potentially malicious code inside Docker containers
Lessons from running potentially malicious code inside Docker containersLessons from running potentially malicious code inside Docker containers
Lessons from running potentially malicious code inside Docker containersBen Hall
 

What's hot (20)

2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 
Bower - A package manager for the web
Bower - A package manager for the webBower - A package manager for the web
Bower - A package manager for the web
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)
 
GIT, RVM, FIRST HEROKU APP
GIT, RVM, FIRST HEROKU APPGIT, RVM, FIRST HEROKU APP
GIT, RVM, FIRST HEROKU APP
 
Ansible project-deploy
Ansible project-deployAnsible project-deploy
Ansible project-deploy
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
DevOps for Opensource Geospatial Applications
DevOps for Opensource Geospatial ApplicationsDevOps for Opensource Geospatial Applications
DevOps for Opensource Geospatial Applications
 
Bower power
Bower powerBower power
Bower power
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
 
Using Composer with Drupal and Drush
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Using Composer with Drupal and Drush
 
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
[PHP 也有 Day] 垃圾留言守城記 - 用 Laravel 阻擋 SPAM 留言的奮鬥史
 
Sprockets
SprocketsSprockets
Sprockets
 
Composer Tools & Frameworks for Drupal
Composer Tools & Frameworks for DrupalComposer Tools & Frameworks for Drupal
Composer Tools & Frameworks for Drupal
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with Augeas
 
Front-end tools
Front-end toolsFront-end tools
Front-end tools
 
Grunt and Bower
Grunt and BowerGrunt and Bower
Grunt and Bower
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + Puppet
 
Lessons from running potentially malicious code inside Docker containers
Lessons from running potentially malicious code inside Docker containersLessons from running potentially malicious code inside Docker containers
Lessons from running potentially malicious code inside Docker containers
 

Similar to Deploying WP Multisite to Heroku

WordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwaltenWordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwaltenWalter Ebert
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packerfrastel
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)Soshi Nemoto
 
Docker for Ruby Developers
Docker for Ruby DevelopersDocker for Ruby Developers
Docker for Ruby DevelopersAptible
 
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2Yros
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp HamiltonPaul Bearne
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environmentSumedt Jitpukdebodin
 
Wordpress development: A Modern Approach
Wordpress development:  A Modern ApproachWordpress development:  A Modern Approach
Wordpress development: A Modern ApproachAlessandro Fiore
 
JUDCon 2010 Boston : BoxGrinder
JUDCon 2010 Boston : BoxGrinderJUDCon 2010 Boston : BoxGrinder
JUDCon 2010 Boston : BoxGrindermarekgoldmann
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPressdotCloud
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPressDocker, Inc.
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerOrtus Solutions, Corp
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Ortus Solutions, Corp
 
Building and Customizing CoreOS
Building and Customizing CoreOSBuilding and Customizing CoreOS
Building and Customizing CoreOS雄也 日下部
 
Manage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliManage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliGetSource
 
Docker & FieldAware
Docker & FieldAwareDocker & FieldAware
Docker & FieldAwareJakub Jarosz
 
Docker workshop DevOpsDays Amsterdam 2014
Docker workshop DevOpsDays Amsterdam 2014Docker workshop DevOpsDays Amsterdam 2014
Docker workshop DevOpsDays Amsterdam 2014Pini Reznik
 
Bower & Grunt - A practical workflow
Bower & Grunt - A practical workflowBower & Grunt - A practical workflow
Bower & Grunt - A practical workflowRiccardo Coppola
 
WP-CLI Workshop at WordPress Meetup Cluj-Napoca
WP-CLI Workshop at WordPress Meetup Cluj-NapocaWP-CLI Workshop at WordPress Meetup Cluj-Napoca
WP-CLI Workshop at WordPress Meetup Cluj-Napoca4nd4p0p
 

Similar to Deploying WP Multisite to Heroku (20)

WordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwaltenWordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwalten
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packer
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 
Docker for Ruby Developers
Docker for Ruby DevelopersDocker for Ruby Developers
Docker for Ruby Developers
 
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
Wordpress development: A Modern Approach
Wordpress development:  A Modern ApproachWordpress development:  A Modern Approach
Wordpress development: A Modern Approach
 
JUDCon 2010 Boston : BoxGrinder
JUDCon 2010 Boston : BoxGrinderJUDCon 2010 Boston : BoxGrinder
JUDCon 2010 Boston : BoxGrinder
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
 
Building and Customizing CoreOS
Building and Customizing CoreOSBuilding and Customizing CoreOS
Building and Customizing CoreOS
 
Manage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliManage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cli
 
Docker & FieldAware
Docker & FieldAwareDocker & FieldAware
Docker & FieldAware
 
Docker workshop DevOpsDays Amsterdam 2014
Docker workshop DevOpsDays Amsterdam 2014Docker workshop DevOpsDays Amsterdam 2014
Docker workshop DevOpsDays Amsterdam 2014
 
Bower & Grunt - A practical workflow
Bower & Grunt - A practical workflowBower & Grunt - A practical workflow
Bower & Grunt - A practical workflow
 
WP-CLI Workshop at WordPress Meetup Cluj-Napoca
WP-CLI Workshop at WordPress Meetup Cluj-NapocaWP-CLI Workshop at WordPress Meetup Cluj-Napoca
WP-CLI Workshop at WordPress Meetup Cluj-Napoca
 

Recently uploaded

Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...SUHANI PANDEY
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...SUHANI PANDEY
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...nilamkumrai
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查ydyuyu
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...SUHANI PANDEY
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...roncy bisnoi
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...singhpriety023
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceDelhi Call girls
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLimonikaupta
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...SUHANI PANDEY
 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...SUHANI PANDEY
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋nirzagarg
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445ruhi
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftAanSulistiyo
 

Recently uploaded (20)

Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck Microsoft
 

Deploying WP Multisite to Heroku

  • 1. Deploying WP Multisite to Heroku WordCamp Finland 2016 Helsinki 15.4.2016 Jussi Kinnula <jussi.kinnula@frantic.com> https://github.com/jussikinnula
  • 2. Prerequisites - Mac OS X (latest) - Note! Most of the tools are available also on Linux systems - Homebrew: - http://brew.sh/ - Heroku toolbelt: - https://toolbelt.heroku.com/ - ClearDB dump (Heroku utility): - https://github.com/josepfrantic/heroku-cleardbdump - Bedrock (boilerplate): - Original version (without Heroku-specific configuration): https://github.com/roots/bedrock - Fork with Heroku & multisite related configuration: https://github.com/frc/bedrock-on-heroku
  • 3. Installing tools, part I After installing Homebrew & Heroku toolbelt & ClearDB dump utility, we need to install some packages that WordPress and Heroku Local needed. $ brew install php56 --with-fpm $ brew install mysql redis $ brew install php56-redis php56-timezonedb php56-igbinary composer $ brew install libpng jpeg giflib libtiff …
  • 4. Installing tools, part II … $ brew tap homebrew/nginx $ brew install nginx-full --with-realip Reverse proxy is needed for local development, we use a Node module: $ brew install node $ npm install -g reverse-proxy-js
  • 5. Please test, that everything works…
  • 6. Setup the project $ cd ~/dev $ git clone git@github.com:frc/bedrock-on-heroku.git my-project $ cd my-project $ rm -rf .git $ git init $ git add -A . && git commit -am ‘initial commit’
  • 7. Set local “environment” Make sure first that MySQL and Redis servers are running. $ mysqladmin -uroot create my-project $ cat > .env CLEARDB_DATABASE_URL=mysql://root:@127.0.0.1/my-project #WP_ALLOW_MULTISITE=true #WP_MULTISITE_MAIN_DOMAIN=localhost.frc.io ^C
  • 8. Composer configuration, part I { "name": "roots/bedrock", "type": "project", "license": "MIT", "description": "A modern WordPress stack", "homepage": "https://roots.io/bedrock/", "authors": [ { "name": "Scott Walkinshaw", "email": "scott.walkinshaw@gmail.com", "homepage": "https://github.com/swalkinshaw" }, { "name": "Ben Word", "email": "ben@benword.com", "homepage": "https://github.com/retlehs" } ], Please edit to your needs (project- specific stuff generally).
  • 9. Composer configuration, part II "keywords": [ "bedrock", "roots", "wordpress", "stack", "composer", "vagrant", "wp" ], "support": { "issues": "https://github. com/roots/bedrock/issues", "forum": "https://discourse.roots. io/category/bedrock" }, "config": { "preferred-install": "dist" },
  • 10. Composer configuration, part III "repositories": [ { "type": "vcs", "url": "https://github.com/frc/wp-amazon-s3-and-cloudfront" }, { "type": "composer", "url": "http://wpackagist.org" } ], Extra repositories to get stuff from. By default composer installs stuff from packagist. org repositories. WordPress packages are generally on wpackagist.org and there’s on GitHub repository + a Satis custom repository for extra packages.
  • 11. Composer configuration, part IV "require-dev": { "heroku/heroku-buildpack-php": "dev-master" }, Heroku Local development tools are installed by simply having a development require for Heroku’ s PHP buildpack.
  • 12. Composer configuration, part V "require": { "ext-redis": "*", "ext-gd": "*", "frc/batcache": "~1.2-p1", "deliciousbrains/wp-amazon-s3-and-cloudfront": "dev-frc", "wpackagist-plugin/amazon-web-services": "~0.3.2", "wpackagist-plugin/sendgrid-email-delivery-simplified": "~1. 6.2", "wpackagist-plugin/limit-login-attempts": "~1.7.1", "tillkruss/redis-object-cache": "~1.2.1", "frc/wp-env-heroku-cleardb": "~1.0.1", "frc/wp-env-heroku-redis": "~1.0.0", "frc/wp-env-heroku-sendgrid": "~1.0.0", "frc/wp-env-heroku-amazon-aws": "~1.0.0", "php": "^5.6", "composer/installers": "~1.0.21", "vlucas/phpdotenv": "~2.0.1", "johnpbloch/wordpress": "~4.3.1" }, Requirements include some extra packages related to caching (page cache batcache, object cache redis- object-cache), Amazon integration (media files to S3 bucket), Sendgrid integration (send E-mails via Sendgrid) and Advanced Custom Fields Pro. Heroku configuration is read with wp- env-heroku-???????? Modules (ClearDB, Redis, SendGrid and Amazon AWS credentials).
  • 13. Composer configuration, part VI "scripts": { "post-update-cmd": [ "cp web/app/plugins/wordpress-mu-domain-mapping/sunrise.php web/app/sunrise.php", "cp web/app/plugins/redis-object-cache/includes/object-cache. php web/app/object-cache.php", "cp web/app/mu-plugins/batcache/advanced-cache.php web/app/advanced-cache.php" ], "post-install-cmd": [ "cp web/app/plugins/wordpress-mu-domain-mapping/sunrise.php web/app/sunrise.php", "cp web/app/plugins/redis-object-cache/includes/object-cache. php web/app/object-cache.php", "cp web/app/mu-plugins/batcache/advanced-cache.php web/app/advanced-cache.php" ] }, Post update commands are run to copy sunrise.php, object-cache.php and advanced-cache.php to their correct places. Post install does similar stuff. Sunrise is for custom domain names plug-in, and the other two are for caching.
  • 14. Composer configuration, part VII "extra": { "installer-paths": { "web/app/mu-plugins/{$name}/": ["type:wordpress- muplugin"], "web/app/plugins/{$name}/": ["type:wordpress-plugin"], "web/app/themes/{$name}/": ["type:wordpress-theme"] }, "wordpress-install-dir": "web/wp" } } Defining installer paths and WordPress installation directory. Note that this “web” and “web/wp” style of directories comes from the Bedrock structures.
  • 16. # Get reverse proxy running $ sudo reverse-proxy --port 80 --target 5000 $ heroku local http://localhost.frc.io
  • 17. WordPress setup (common) ● We’ll do first a regular WordPress setup, no multi-site related stuff ● After everything is setup, then heroku local will be stopped (CTRL+C) - and .env modified to the following: CLEARDB_DATABASE_URL=mysql://root:@127.0.0.1/my-project WP_ALLOW_MULTISITE=true #WP_MULTISITE=localhost.frc.io ● Then just restart heroku local …
  • 18. WordPress setup (enable multisite) ● Now with WP_ALLOW_MULTISITE=true being active, you can get to enabling multisite on WP admin ● You don’t have to actually do any copy&pasting for the code after enabling multisite, as we have the necessary code already implemented in config/application.php -file ● After enabling multisite, just stop heroku local (CTRL+C) and uncomment the last line in .env and start it again ● Setting the multisite domain sets also the other definitions CLEARDB_DATABASE_URL=mysql://root:@127.0.0.1 /my-project WP_ALLOW_MULTISITE=true WP_MULTISITE_MAIN_DOMAIN=localhost.frc.io if (getenv('WP_MULTISITE_MAIN_DOMAIN')) { define('MULTISITE', true); define('SUBDOMAIN_INSTALL', true); define('DOMAIN_CURRENT_SITE', getenv ('WP_MULTISITE_MAIN_DOMAIN')); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); define('SUNRISE', true); }
  • 20. Deploy to Heroku $ heroku create --region eu my-project $ heroku addons:create cleardb:ignite $ heroku addons:create heroku-redis:hobby-dev $ git push heroku master $ heroku cleardb:push my-project --search localhost.frc.io --replace wordcamp.frc.io $ heroku domains:add wordcamp.frc.io $ heroku domains:add *.wordcamp.frc.io