O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

AMIMOTO WordPress + Amazon Web Services Hands-on

657 visualizações

Publicada em

WordCamp Polska 2015 Contributor Day
http://amimoto-ami.com/

Publicada em: Internet
  • Seja o primeiro a comentar

AMIMOTO WordPress + Amazon Web Services Hands-on

  1. 1. @Amimoto_Ami   amimoto-­‐ami.com WordPress  +  Amazon  Web  Services  Hands-­‐on     WordCamp  Polska  2015  Contributor  Day
  2. 2. KEL  San9ago     Writer  +  Evangelist   DigitalCube  Inc.   @i_Monkey_Robot
  3. 3. KOGA  Hiromichi OHTA  Tatsuki KOGA  Tatsuro JOTAKI  Taisuke MIYOSHI  Takayuki OKAMOTO  Wataru SUGIMOTO  Jun CEO Theme  &  Code  Wrangler Designer Support  /  Code  Wrangler  /  Translator   Engineer Engineer Theme  Developer  /  Director MIYAUCHI  Takayuki HORIKE  Takahiro IGARASHI  Kazue NISHIMURA  Shuhei SANTIAGO  Kel NUKAGA  Junko   WP  Plugin  Developer  /  Backend  Engineer   WP  Plugin  Developer  /  Frontend    Engineer   Code  Wrangler  /  Frontend  Engineer   Code  Wrangler   Writer  /  Evangelist Designer  /  Writer OKAMOTO  Hidetaka Engineer TSUNODA  Tomohyco Technical  Support  /  Engineer
  4. 4. What  We  Do WordPress  HosVng  Service Build  WordPress  Sites WordPress  Enterprise     Support  Service   Web  ConsulVng   en.digitalcube.jp     For  more!  
  5. 5. 86 WordPress     Plugins Books WordPress     Development     Environment Amimoto  AMI WordPress     HosVng What  We  Love  to  Create
  6. 6. We  love  connec9ng  with  the  community:
  7. 7. #AMIMOTO            @Amimoto_Ami User-­‐friendly     Has  a  lot  of  users  &   developers   Strong  community
  8. 8. #AMIMOTO            @Amimoto_Ami Lots  of  tools  &  resources   Deployment  Speed     AMI  /  CloudFormaVon     Community:  Japan  AWS   (JAWS)  User  Group
  9. 9. #AMIMOTO            @Amimoto_Ami Use  WordPress  on  AWS  easily Programmable  infrastructure Friendly  for  developers  &  users
  10. 10. #AMIMOTO            @Amimoto_Ami EC2    (ElasVc  Compute  Cloud)   easily  scale  up  &  down     to  meet  traffic  demands   HIGHLY   SCALABLE
  11. 11. #AMIMOTO            @Amimoto_Ami 1-­‐click  launch   WordPress-­‐developer   friendly   WP-­‐CLI   GIT USER-­‐FRIENDLY
  12. 12. #AMIMOTO            @Amimoto_Ami HIGH   PERFORMANCE Load  Test  with  a  Simple   (Apache  Bench)  Command
  13. 13. #AMIMOTO            @Amimoto_Ami 9  GLOBAL  DATA  CENTERS   Singapore  ⋅  Tokyo  ⋅  Sydney  ⋅     Sao  Paulo  ⋅    N.  Virginia  ⋅     Oregon  ⋅  N.  California     Ireland    ⋅    Frankfurt   —   WP  Booster  CDN   S3  (Simple  Storage  Service) NINJA     SPEED
  14. 14. vs. loader.io c3.large   instance 1   minute 0-­‐300 client   increase NGINX Reverse   Proxy  Cache Disabled TEST HHVM  vs.  php-­‐fpm
  15. 15. HHVM  is  faster php-­‐fpm TOP  PAGE HHVM  vs.  php-­‐fpm
  16. 16. Average   Response   Dme Number  of   Processed   Requests Nginx  Cache   effecDveness 1566   ms 3108     ms 5387 2637 15  ms Average   Response  Dme 386830 Processed   requests HHVM     vs.     php-­‐fpm
  17. 17. 150-200 clients HHVM     although  slower     response,   HHVM  is    sDll  operaDng     (Dl  the  end)   php-­‐fpm   is  unmeasured     (Dl  the  end)  &   50x  errors     were  received
  18. 18. WordPress  4.1.1 HHVM  vs.  PHP7
  19. 19. #AMIMOTO            @Amimoto_Ami vs. loader.io 1   minute 0-­‐300 client   increase TEST HHVM  3.6  vs.  HHVM  3.9  
  20. 20. Avg  response  Vme:  10563  ms   Success  responses:  1189 Avg  response  Vme:  8259  ms   Success  responses:  1685 HHVM  3.9   Response  Vme  improved  by  20%  &  the  total   request  processing  number  increased  by  50%. HHVM  3.6  vs.  HHVM  3.9  
  21. 21. Sites  on  AMIMOTO   WordPress  +  AWS  
  22. 22. MAZDA  Runs  on     WordPress  Powered  by  AMIMOTO
  23. 23. #AMIMOTO            @Amimoto_Ami Unpredictable   traffic  spikes   Page  views     increase  &  decline Amazon  EC2   Scalable   Capacity POPULAR  BLOG  SITE
  24. 24. Large-­‐Scale  Media  Site
  25. 25. #AMIMOTO            @Amimoto_Ami 60  Million  PV  /  month   Lots  of  Images   Lots  of  AdverVsements     Social  Media  /  Feed   Auto  Scaling   Scale  up  &  down   automaVcally LARGE-­‐SCALE  MEDIA  SITE
  26. 26. Huge  Enterprise  Site  
  27. 27. #AMIMOTO            @Amimoto_Ami MulVsite   MulVlingual     Needs  to  be  high  speed Nginx  Cache     Controller  Plugin   1  AMIMOTO  instance  =     can  have  mulVple     WordPress  installs   Install  MulVlingual     WordPress  Plugin   HUGE  ENTERPRISE  SITE
  28. 28. NewsNews  Site
  29. 29. #AMIMOTO            @Amimoto_Ami WPBooster  CDN Thousands  of  posts   MulVple  authors     Needs  to  be  MulVlingual     Sudden  traffic  surge Possible  with     WordPress NEWS  SITE
  30. 30. #AMIMOTO            @Amimoto_Ami AMIMOTO  HHVM  14  days  Free  Trial
  31. 31. EC2  Instance  SelecVon  +   OpVmal  Sizing  
  32. 32. #AMIMOTO            @Amimoto_Ami INSTANCE  TYPES   &  DETAILS T2.MICRO T2.SMALL T2.MEDIUM C4.LARGE Recommended   WordPress  Installs   3 3 3 5 Assumed  PV  /   month 100,000  PV  / month 300,000  PV  / month 300,000  PV  / month 1  Million  PV  /month Memory  (GB)   1 2 4 3.75 HDD  (ElasDc   Block  Store)   Default  Capacity:30    GB  (SSD),   addiVonal  disk  may  be  added   Purpose   web  servers,  developer  environments     &  small  databases for    high  traffic  web  servers,   media  transcoding,  online   gaming  servers,  ad  serving   engines,  compute-­‐intensive  apps
  33. 33. What  you  can  do  with   WordPress  Powered  by   AMIMOTO
  34. 34. #AMIMOTO            @Amimoto_Ami
  35. 35. #AMIMOTO            @Amimoto_Ami Auto  Scaling   in     AMIMOTO apps  with  stable   demand  paoerns     apps  with  different   usage  daily,  weekly
  36. 36. #AMIMOTO            @Amimoto_Ami Auto  Scaling   in  AMIMOTO Cost-­‐efficient   Increase  /  decrease   instances  based  on   how  high  or  low     the  load  will  be.
  37. 37. #AMIMOTO            @Amimoto_Ami Automa9c  Recovery     for  instances     that  suddenly  died Auto  Scaling   in  AMIMOTO
  38. 38. #AMIMOTO            @Amimoto_Ami Machine   Learning   discover  data  (like   buying  paoerns)  &   make  models  with  it DATA:     %  chance  customer   will  buy,  how  many  &   what  are  the  most   interesVng  products  
  39. 39. #AMIMOTO            @Amimoto_Ami Amazon  Machine   Learning Upload  data   Output upload   sample  data   to  ML Data  Set Architecture
  40. 40. #AMIMOTO            @Amimoto_Ami
  41. 41. #AMIMOTO            @Amimoto_Ami 1-­‐click  launch via  AWS  Console
  42. 42. WordPress  +  Amazon  Web  Services     Hands-­‐on
  43. 43. hbp://amimoto-­‐ami.com/slack/ Join  the  conversaDon  in:
  44. 44. #AMIMOTO            @Amimoto_Ami LOGIN  to  AWS
  45. 45. #AMIMOTO            @Amimoto_Ami Choose  the   nearest  region   where  the  site   will  mostly  be   accessed  from.    
  46. 46. #AMIMOTO            @Amimoto_Ami EC2:  ElasVc  Cloud   Compute   Provides  flexibility     Scales  up  on  high  traffic     Scales  down  on  low  traffic
  47. 47. #AMIMOTO            @Amimoto_Ami Launch  a  virtual   server  to  start   using  EC2 AMIMOTO   HHVM
  48. 48. #AMIMOTO            @Amimoto_Ami AMIMOTO   HHVM     Free  trial  is   only  for     t2.micro   instance
  49. 49. #AMIMOTO            @Amimoto_Ami Launching   mulVple  instances   is  possible,  but   the  Free  Trial  only   allows  1  instance You  can  configure  these,  or  use  the  default  sesngs
  50. 50. #AMIMOTO            @Amimoto_Ami
  51. 51. #AMIMOTO            @Amimoto_Ami
  52. 52. #AMIMOTO            @Amimoto_Ami
  53. 53. #AMIMOTO            @Amimoto_Ami
  54. 54. #AMIMOTO            @Amimoto_Ami Key  pair Download  &  Launch Instance  ID
  55. 55. #AMIMOTO            @Amimoto_Ami
  56. 56. ElasDc  IP  Address
  57. 57. #AMIMOTO            @Amimoto_Ami can  remain  with  you     even  there  is  no  associated  instance returned  (and  cannot  be  retrieved)     as  soon  as  you  stop  a  Virtual  Machine   OpVonal When  you  create  a  Virtual  Machine,     you  get  a  Public  IP   No  maoer  how  many  Vmes     you  stop  /  start  an  intance  with  EIP,     the  same  IP  will  conVnue  to  be  available     as  the  public  IP  of  the  Virtual  Machine.   If  there  is  no  EIP,     each  Vme  you  stop  and  start  the  instance,   you  get  a  new  Public  IP  every  Vme.   hop://blog.digitalcube.jp/archives/1870 ElasDc  IP  Address  vs.  Public  IP  Address
  58. 58. #AMIMOTO            @Amimoto_Ami
  59. 59. #AMIMOTO            @Amimoto_Ami Associate  &  Select  Instances  
  60. 60. #AMIMOTO            @Amimoto_Ami Now  you   can  see   that  you   have  an   ElasVc  IP   Copy  &   paste  to   your   browser
  61. 61. #AMIMOTO            @Amimoto_Ami Copy  your  instance  ID  &   paste  to  the  Welcome  Screen
  62. 62. #AMIMOTO            @Amimoto_Ami Set  up  WordPress
  63. 63. #AMIMOTO            @Amimoto_Ami
  64. 64. #AMIMOTO            @Amimoto_Ami
  65. 65. #AMIMOTO            @Amimoto_Ami AcVvate  pre-­‐installed  plugins
  66. 66. #AMIMOTO            @Amimoto_Ami You  can  customize  the  sesngs   Set  the  cache  expiraVon   for  every  page
  67. 67. #AMIMOTO            @Amimoto_Ami Enable  Flush  Cache  for   AutomaVc  Cache  DeleVon For  mulV-­‐site,  acVvate     Nginx  Cache  Controller    on  each  dashboard
  68. 68. #AMIMOTO            @Amimoto_Ami OFF:   Requests  per  second:  7.73  [#/sec]     ON:     Requests  per  second:  707.26  [#/sec]  
  69. 69. Database  Management
  70. 70. #AMIMOTO            @Amimoto_Ami phpMyAdmin   1.  switch  to  the  root  user  by  “su  -­‐”   (.conf  files  are  usually  owned  by  root)   2.  modify  default.conf  or  example.com.conf     at  /etc/nginx/conf.d/
  71. 71. #AMIMOTO            @Amimoto_Ami Line  61   Change  to:
  72. 72. #AMIMOTO            @Amimoto_Ami Aeer  ediDng:   run  #  service  nginx  restart  to  restart  Nginx   Then  you  can  access  to  phpMyAdmin  with     hop://example.com/phpMyAdmin/   Login  &  Password  of  phpMyAdmin     are  similar  to  the  one  in  wp-­‐config.php.  
  73. 73. #AMIMOTO            @Amimoto_Ami AMIMOTO  has  phpMyAdmin  installed,     but  we  disabled  it  because:     many  vulnerabiliVes  has  been  found  before  in  phpMyAdmin,   so  even  it  is  not  installed,  many  fraudulent  accesses  have  been  tried   Axer  using  phpMyAdmin,  disable  it.  
  74. 74. #AMIMOTO            @Amimoto_Ami WP-­‐CLI
  75. 75. #AMIMOTO            @Amimoto_Ami EXPORTING  DATABASE   wp  db  export  [<file>]   You  can  give  any  name  +.sql     to  the  file  name.   Axer  that,  an  sql  is  created. IMPORTING  DATABASE   wp  db  import  [<file>]   You  should  upload  an     sql  file  to  your  server.   REPLACING  STRINGS   wp  search-­‐replace  <old>   <new>   With  -­‐-­‐dry-­‐run  opVon,  you  can   see  the  result  without  execuVng   the  actual  replacement. RESETTING  PASSWORD   wp  user  update  <user>  -­‐-­‐ user_pass=marypass   <user>  is  the  login  name,  mail   address  or  user  ID.   -­‐-­‐user_pass  opVon  is  the  new   password. OPTIMIZING  DATABASE   wp  db  opVmize   <user>  is  the  login  name  or  mail   address  or  user  ID.   -­‐-­‐user_pass  opVon  is  the  new   password. FOR  OTHER   COMMANDS:     hop://wp-­‐cli.org/ commands/db/
  76. 76. Instance  Scale  Up
  77. 77. #AMIMOTO            @Amimoto_Ami Stop  t2.micro     instance
  78. 78. #AMIMOTO            @Amimoto_Ami
  79. 79. #AMIMOTO            @Amimoto_Ami Select  a  larger     instance
  80. 80. #AMIMOTO            @Amimoto_Ami Start  t2.small   instance
  81. 81. #AMIMOTO            @Amimoto_Ami You’ve  scaled  up  your    WordPress  site  to  t2.small  instance
  82. 82. Instance  Scale  Down
  83. 83. #AMIMOTO            @Amimoto_Ami Stop  t2.small     instance
  84. 84. #AMIMOTO            @Amimoto_Ami
  85. 85. #AMIMOTO            @Amimoto_Ami Select  a  smaller   instance
  86. 86. #AMIMOTO            @Amimoto_Ami Start  t2.micro   instance
  87. 87. #AMIMOTO            @Amimoto_Ami You’ve  scaled  down  your  WordPress  site  to  t2.micro  instance
  88. 88. Other  things  you  can  do:     SFTP   Route53
  89. 89. #AMIMOTO            @Amimoto_Ami Connect  AMIMOTO  instance  with:   SFTP  client  and     secret  key  file  of  the  instance  (.pem)  file  
  90. 90. #AMIMOTO            @Amimoto_Ami SERVER  CONNECTION     SETTINGS:     • Server:  Instance  IP  Address     • Username:  ec2-­‐user   • Secret  key   • Path:  /var/www/vhosts/  {instance  name   (opVonal)  }   • ConnecVon  method  (Port):  SFTP  (22)
  91. 91. #AMIMOTO            @Amimoto_Ami $ chmod 600 /Users/XXXXXXXX/Downloads/XXXXXXXXXX.pem $ ssh -i /Users/XXXXXXXX/Downloads/XXXXXXXXXX.pem ec2-user@XX.XXX.XXXX LOGIN  WITH  SSH http://amimoto-ami.com/faq/connect-amimoto-instance-sftp-client-software/
  92. 92. #AMIMOTO            @Amimoto_Ami $ sudo /usr/sbin/usermod -s /bin/bash nginx $ sudo passwd nginx Changing password for user nginx. New password: Retype new password: passwd: all authentication tokens updated successfully. $ sudo /sbin/service monit stop $ sudo /sbin/service nginx stop $ sudo /sbin/service php-fpm stop $ sudo /usr/sbin/usermod -d /var/www/vhosts nginx $ sudo /sbin/service php-fpm start $ sudo /sbin/service nginx start $ sudo /sbin/service monit start $ sudo mkdir /var/www/vhosts/.ssh $ sudo cp /home/ec2-user/.ssh/authorized_keys /var/www/vhosts/.ssh/ $ sudo chown -R nginx:nginx /var/www/vhosts/.ssh/ SET  NGINX  SFTP  LOGIN  USER http://amimoto-ami.com/faq/connect-amimoto-instance-sftp-client-software/
  93. 93. #AMIMOTO            @Amimoto_Ami ROUTE  53   is  a  Domain  Name  System  (DNS)     web  service.   FUNCTION:   to  route  end  users  to  Internet  apps  by   translaVng  www.example.com  into  the   numeric  IP  addresses  like  192.0.2.1  that   computers  use  to  connect  to  each  other.
  94. 94. #AMIMOTO            @Amimoto_Ami Domain:  amimotohandson.info   Obtained  from:  GoDaddy
  95. 95. #AMIMOTO            @Amimoto_Ami
  96. 96. #AMIMOTO            @Amimoto_Ami
  97. 97. #AMIMOTO            @Amimoto_Ami
  98. 98. #AMIMOTO            @Amimoto_Ami
  99. 99. #AMIMOTO            @Amimoto_Ami
  100. 100. #AMIMOTO            @Amimoto_Ami
  101. 101. #AMIMOTO            @Amimoto_Ami Copy  these  NS  values
  102. 102. #AMIMOTO            @Amimoto_Ami NEXT  STEPS:   Domain:  amimotohandson.info   Obtained  from:  GoDaddy   • Login  to  GoDaddy  (or  wherever  you  got  the  domain  from)   • then  paste  the  NS  Values  you  just  copied  from  AWS  Route  53.
  103. 103. #AMIMOTO            @Amimoto_Ami
  104. 104. #AMIMOTO            @Amimoto_Ami
  105. 105. TerminaDng  the  Instance
  106. 106. #AMIMOTO            @Amimoto_Ami Choose  the  instance  for  terminaVon Tagging  instances  make  them  easier  to  see
  107. 107. #AMIMOTO            @Amimoto_Ami
  108. 108. #AMIMOTO            @Amimoto_Ami
  109. 109. Release  ElasDc  IP   Address
  110. 110. #AMIMOTO            @Amimoto_Ami
  111. 111. #AMIMOTO            @Amimoto_Ami
  112. 112. DigitalCube  Team  &  What  We  Do   Why  WordPress  +  Amazon  Web  Services AMIMOTO  features   Performance  Tests     HHVM  vs.  php-­‐fpm   HHVM  3.6  vs.  3.9   Sites  on  AMIMOTO     WordPress  +  Amazon  Web  Services   Instance  SelecVon   Connect  WP  with  tools     Autoscaling     Machine  Learning  (for  e-­‐commerce)   AWS  Console   AWS  Console  /  Dashboard   Launch  Virtual  Server   Configure  Instance   Key  Pair   ElasVc  IP  Address   Public  IP  Address Set  up  WordPress   AcVvate  pre-­‐installed  plugins     NGINX  Cache  Controller  Plugin   Database  Management     phpMyAdmin   WP-­‐CLI   Scale  up  &  down  of  instance SFTP   Route  53   Terminate  Instance   Release  ElasVc  IP  Address  
  113. 113. @Amimoto_Ami   amimoto-­‐ami.com WordPress  +  Amazon  Web  Services  Hands-­‐on     WordCamp  Polska  2015  Contributor  Day Dziękuję!!!

×