Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Scaling WordPress with Containers - WordPress L...

Scaling WordPress with Containers - WordPress London November 2017

Avatar for craigwillis85

craigwillis85

December 01, 2017
Tweet

More Decks by craigwillis85

Other Decks in Programming

Transcript

  1. https://en.wikipedia.org/wiki/Scalability Scalability is the capability of a system, network, or

    process to handle a growing amount of work, or its potential to be enlarged to accommodate that growth
  2. What is a container? Lightweight, stand-alone, executable package (.exe, .jar)

    Includes everything it needs to run Runtime, system tools, libraries, settings Built on top of facilities of linux kernel Does not include / require a separate operating system Should do ONE thing only (PHP, Apache)
  3. version: '2' services: database: image: mysql:5.6 environment: MYSQL_USER: 'root' MYSQL_DATABASE:

    'wordpressdemo' MYSQL_ALLOW_EMPTY_PASSWORD: 'true' ON_CREATE_DB: 'wordpressdemo' ports: - "3306:3306" wordpressdemoapp: image: craigwillis85/wp-demo:v1 volumes: - "./public:/var/www/html" - "./public/wp-config-dev.php:/var/www/html/wp-config.php" ports: - "80:80"
  4. version: '2' services: database: image: mysql:5.6 environment: MYSQL_USER: 'root' MYSQL_DATABASE:

    'wordpressdemo' MYSQL_ALLOW_EMPTY_PASSWORD: 'true' ON_CREATE_DB: 'wordpressdemo' ports: - "3306:3306" wordpressdemoapp: image: craigwillis85/wp-demo:v1 volumes: - "./public:/var/www/html" - "./public/wp-config-dev.php:/var/www/html/wp-config.php" ports: - "80:80"
  5. version: '2' services: database: image: mysql:5.6 environment: MYSQL_USER: 'root' MYSQL_DATABASE:

    'wordpressdemo' MYSQL_ALLOW_EMPTY_PASSWORD: 'true' ON_CREATE_DB: 'wordpressdemo' ports: - "3306:3306" wordpressdemoapp: image: craigwillis85/wp-demo:v1 volumes: - "./public:/var/www/html" - "./public/wp-config-dev.php:/var/www/html/wp-config.php" ports: - "80:80"
  6. version: '2' services: database: image: mysql:5.6 environment: MYSQL_USER: 'root' MYSQL_DATABASE:

    'wordpressdemo' MYSQL_ALLOW_EMPTY_PASSWORD: 'true' ON_CREATE_DB: 'wordpressdemo' ports: - "3306:3306" wordpressdemoapp: image: craigwillis85/wp-demo:v1 volumes: - "./public:/var/www/html" - "./public/wp-config-dev.php:/var/www/html/wp-config.php" ports: - "80:80"
  7. version: '2' services: database: image: mysql:5.6 environment: MYSQL_USER: 'root' MYSQL_DATABASE:

    'wordpressdemo' MYSQL_ALLOW_EMPTY_PASSWORD: 'true' ON_CREATE_DB: 'wordpressdemo' ports: - "3306:3306" wordpressdemoapp: image: craigwillis85/wp-demo:v1 volumes: - "./public:/var/www/html" - "./public/wp-config-dev.php:/var/www/html/wp-config.php" ports: - "80:80"
  8. version: '2' services: database: image: mysql:5.6 environment: MYSQL_USER: 'root' MYSQL_DATABASE:

    'wordpressdemo' MYSQL_ALLOW_EMPTY_PASSWORD: 'true' ON_CREATE_DB: 'wordpressdemo' ports: - "3306:3306" wordpressdemoapp: image: craigwillis85/wp-demo:v1 volumes: - "./api:/var/www/html" - "./api/configs/wp-config-dev.php:/var/www/html/wp-config.php" ports: - "80:80"
  9. $ docker ps CONTAINER ID IMAGE PORTS NAMES f41a217b93a mysql:5.6

    0.0.0.0:3306->3306/tcp wordpressdemo_database 8ad8f1ad3a1c craigwillis85/wp-demo:v1 0.0.0.0:80->80/tcp wordpressdemo_demoapp
  10. A Pod is a collection of containers sharing a network

    and mount namespace and is the basic unit of deployment in Kubernetes. All containers in a pod are scheduled on the same node.
  11. A Service is an abstraction for pods, providing a stable,

    virtual IP (VIP) address allowing clients to reliably connect to the containers by forwarding traffic to one or more pods
  12. A deployment is a supervisor for pods and replica sets,

    giving you fine-grained control over how and when a new pod version is rolled out as well as rolled back to a previous state.
  13. A ReplicaSet is a supervisor for long-running pods. An RC

    will launch a specified number of pods called replicas and makes sure that they keep running, for example when a node fails or something inside of a pod, that is, in one of its containers goes wrong.
  14. $ kubectl get nodes NAME STATUS AGE VERSION Gke-scaling-wordpress-default-pool-3359c7d4-42wv Ready

    1h v1.7.8-gke.0 Gke-scaling-wordpress-default-pool-3359c7d4-6rdr Ready 1h v1.7.8-gke.0 Gke-scaling-wordpress-default-pool-3359c7d4-l6sv Ready 1h v1.7.8-gke.0 Wahey! We have a cluster