GithubHelp home page GithubHelp logo

mateothegreat / k8-byexamples-wordpress Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 35 KB

wordpress @ kubernetes. Persistent Volumes, ConfigMaps, Ingress, Let's Encrypt, oh my!

Home Page: https://matthewdavis.io

License: MIT License

Makefile 100.00%
kubernetes-manifests wordpress makefile k8-byexamples

k8-byexamples-wordpress's Introduction

Clickity click Twitter Follow Skype Contact

Wordpress @ Kubernetes

k8 by example -- straight to the point, simple execution.

  • Tuned settings to allow large file uploads.
  • Disabled "X-Powered-By: php7.6" response headers.

Create Persistent Disk

$ make create-disk
     
    gcloud compute disks create wp-matthewdavis-io --zone us-central1-a --size 10
    
    Created [https://www.googleapis.com/compute/v1/projects/streaming-platform-devqa/zones/us-central1-a/disks/wp-matthewdavis-io].
    
    NAME                ZONE           SIZE_GB  TYPE         STATUS
    wp-matthewdavis-io  us-central1-a  10       pd-standard  READY

Install

$ make install MYSQL_HOST=some.mysql.host.com MYSQL_USER=someuser MYSQL_password=supersecret MYSQL_DATABASE=my_wordpress

    [ INSTALLING MANIFESTS/CONFIGMAP.YAML ]: configmap "wordpress-config" created
    [ INSTALLING MANIFESTS/STORAGE-PERSISTENTVOLUMECLAIM.YAML ]: persistentvolumeclaim "wp-matthewdavis-io-volume" created
    [ INSTALLING MANIFESTS/STORAGE-PERSISTENTVOLUME.YAML ]: persistentvolume "es-data" created
    [ INSTALLING MANIFESTS/SERVICE.YAML ]: service "wp-matthewdavis-io" created
    [ INSTALLING MANIFESTS/DEPLOYMENT.YAML ]: deployment "wp-matthewdavis-io" created

Setup Ingress & LetsEncrypt Certificate

In order to route http traffic to our new wordpress pod we can either change the service type to LoadBalancer or use an Ingress resource. This is handled by the submodule k8-byexamples-ingress-controller (included in this repo) which will auto-magically create the Ingress resource for you:

make ingress-issue HOST=matthewdavis.io

    make[1]: Entering directory '/workspace/k8-byexamples-monorepo/modules/k8-byexamples-wordpress/k8-byexamples-ingress-controller'
    ingress "matthewdavis.io" created

Now lets request a certificate from LetsEncrypt (see: https://github.com/mateothegreat/k8-byexamples-cert-manager):

$ make certificate-issue 

    make[1]: Entering directory '/workspace/k8-byexamples-monorepo/modules/k8-byexamples-wordpress/k8-byexamples-ingress-controller'
    certificate "matthewdavis.io" created

Usage

$  make help
  
                                  __                 __
     __  ______  ____ ___  ____ _/ /____  ____  ____/ /
    / / / / __ \/ __  __ \/ __  / __/ _ \/ __ \/ __  / 
   / /_/ / /_/ / / / / / / /_/ / /_/  __/ /_/ / /_/ /  
   \__, /\____/_/ /_/ /_/\__,_/\__/\___/\____/\__,_/   
  /____                                                
                          yomateo.io, it ain't easy.   
  
  Usage: make <target(s)>
  
  Targets:
  
    create-disk          Create disk
    initdb               Create mysql database & grant (DROP DATABASE is performed!)
    ingress-issue        Create Ingress Resource
    certificate-issue    Create LetsEncrypt Certificate Request
    dump/submodules      Output list of submodules & repositories
    install              Installs manifests to kubernetes using kubectl apply (make manifests to see what will be installed)
    delete               Deletes manifests to kubernetes using kubectl delete (make manifests to see what will be installed)
    get                  Retrieves manifests to kubernetes using kubectl get (make manifests to see what will be installed)
    get/all              Retrives all resources (in color!)
    describe             Describes manifests to kubernetes using kubectl describe (make manifests to see what will be installed)
    context              Globally set the current-context (default namespace)
    shell                Grab a shell in a running container
    dump/logs            Find first pod and follow log output
    dump/manifests       Output manifests detected (used with make install, delete, get, describe, etc)
  
  
  Tools:
  
    get/myip              Get your external ip
    testing-curl          Try to curl http & https from $(HOST)
    testing/curlhttp      Try to curl http://$(HOST)
    testing/curlhttps     Try to curl https://$(HOST)
    testing/getip         Retrieve external IP from api.ipify.org
    git/update            Update submodule(s) to HEAD from origin
    git/up                Update all .make submodules
    rbac/grant-google     Create clusterrolebinding for cluster-admin

Cleanup

$ make delete

[ DELETING MANIFESTS/SERVICE.YAML ]: service "wordpress" deleted
[ DELETING MANIFESTS/PERSISTENTVOLUMECLAIM.YAML ]: persistentvolumeclaim "wordpress" deleted
[ DELETING MANIFESTS/DEPLOYMENT.YAML ]: deployment "wordpress" deleted
[ DELETING MANIFESTS/INGRESS.YAML ]: ingress "wordpress.gcp.streaming-platform.com" deleted
[ DELETING MANIFESTS/CERTIFICATE.YAML ]: certificate "wordpress.gcp.streaming-platform.com" deleted
[ DELETING MANIFESTS/CONFIGMAP.YAML ]: configmap "wordpress-config" deleted

k8-byexamples-wordpress's People

Contributors

mateothegreat avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.