SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
Company Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptxCompany Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptxMario
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书rnrncn29
 
IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119APNIC
 
Cybersecurity Threats and Cybersecurity Best Practices
Cybersecurity Threats and Cybersecurity Best PracticesCybersecurity Threats and Cybersecurity Best Practices
Cybersecurity Threats and Cybersecurity Best PracticesLumiverse Solutions Pvt Ltd
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
TRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptxTRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptxAndrieCagasanAkio
 
Unidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxUnidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxmibuzondetrabajo
 
ETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptxETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptxNIMMANAGANTI RAMAKRISHNA
 

Kürzlich hochgeladen (9)

SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
Company Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptxCompany Snapshot Theme for Business by Slidesgo.pptx
Company Snapshot Theme for Business by Slidesgo.pptx
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
 
IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119IP addressing and IPv6, presented by Paul Wilson at IETF 119
IP addressing and IPv6, presented by Paul Wilson at IETF 119
 
Cybersecurity Threats and Cybersecurity Best Practices
Cybersecurity Threats and Cybersecurity Best PracticesCybersecurity Threats and Cybersecurity Best Practices
Cybersecurity Threats and Cybersecurity Best Practices
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
TRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptxTRENDS Enabling and inhibiting dimensions.pptx
TRENDS Enabling and inhibiting dimensions.pptx
 
Unidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptxUnidad 4 – Redes de ordenadores (en inglés).pptx
Unidad 4 – Redes de ordenadores (en inglés).pptx
 
ETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptxETHICAL HACKING dddddddddddddddfnandni.pptx
ETHICAL HACKING dddddddddddddddfnandni.pptx
 

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