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

Building Web in a Container World

Building Web in a Container World

Containerised apps are becoming the new normal, yet it's not always apparent to how to put these applications live in a DevOps style. In this talk I will look at how I use Wercker to deploy a web app I have built.

Martin Beeby

January 25, 2018
Tweet

More Decks by Martin Beeby

Other Decks in Technology

Transcript

  1. Martin Beeby @thebeebs E commerce Systems Microsoft 8 Years Joined

    Oracle 2 months ago MARTIN BEEBY @thebeebs Web Developer Developer since I was 16
  2. Martin Beeby @thebeebs SIMPLE APP AI Emotion Service Microservice API

    x 2 Container – Node.JS Port 3000 Endpoint Service IP Load Balancer Port 80 Front End Container – Oracle Jet x 3 Port 80 Endpoint Service IP Load Balancer Port 80 Redis Master Redis Slave x 2
  3. Martin Beeby @thebeebs apiVersion: v1 kind: Service metadata: name: frontend

    labels: app: audienceanalyser tier: frontend spec: type: LoadBalancer ports: - port: 80 selector: app: audienceanalyser tier: frontend --- KUBERNETES YML - SERVICE
  4. Martin Beeby @thebeebs --- apiVersion: extensions/v1beta1 kind: Deployment metadata: name:

    frontend spec: replicas: 3 template: metadata: labels: app: audienceanalyser tier: frontend spec: containers: - name: beebs image: thebeebs/howareyou:THIS_STRING_IS_REPLACED_DURING_BUILD imagePullPolicy: Always resources: requests: cpu: 100m memory: 100Mi env: - name: GET_HOSTS_FROM value: dns ports: - containerPort: 80 KUBERNETES YML
  5. Martin Beeby @thebeebs FRONT END Front End Container – Oracle

    Jet x 3 Port 80 Endpoint Service IP Load Balancer Port 80
  6. Martin Beeby @thebeebs SIMPLE APP AI Emotion Service Microservice API

    x 2 Container – Node.JS Port 3000 Endpoint Service IP Load Balancer Port 80 Front End Container – Oracle Jet x 3 Port 80 Endpoint Service IP Load Balancer Port 80 Redis Master Redis Slave x 2
  7. Martin Beeby @thebeebs build: steps: - npm-install - npm-test -

    script: name: oracle jet build code: | npm install -g @oracle/ojet-cli ojet build - script: name: copy code to output code: cp -r web "$WERCKER_OUTPUT_DIR" - script: name: copy yml file to output code: cp service.yml "$WERCKER_OUTPUT_DIR" BUILD - PIPELINE
  8. Martin Beeby @thebeebs steps: - npm-install - npm-test - script:

    name: oracle jet build code: | npm install -g @oracle/ojet-cli ojet build - script: name: copy code to output code: cp -r web "$WERCKER_OUTPUT_DIR" STEPS
  9. Martin Beeby @thebeebs push-release: # Override the node:4-slim box box:

    id: nginx:alpine cmd: /bin/sh steps: - script: name: list whats on disk code: | echo "Listings files on disk" ls cd web echo "Checing whats in index" cat index.html - script: name: mv static files code: | echo "CAT Index file" cat $WERCKER_SOURCE_DIR/web/index.html ls $WERCKER_SOURCE_DIR/web/ rm -rf /usr/share/nginx/html/* mv web/* /usr/share/nginx/html PUSH-RELEASE - PIPELINE - script: name: list file code: | echo "ls files:" ls - internal/docker-push: disable-sync: true repository: thebeebs/howareyou username: $DOCKER_USERNAME password: $DOCKER_PASSWORD registry: https://registry.hub.docker.com/v2 tag: $WERCKER_GIT_COMMIT cmd: nginx -g 'daemon off;'
  10. Martin Beeby @thebeebs - internal/docker-push: disable-sync: true repository: thebeebs/howareyou username:

    $DOCKER_USERNAME password: $DOCKER_PASSWORD registry: https://registry.hub.docker.com/v2 tag: $WERCKER_GIT_COMMIT cmd: nginx -g 'daemon off;' VARIABLES
  11. Martin Beeby @thebeebs deploy: steps: - script: name: list file

    code: | echo "ls files:" ls - script: name: update image build code: sed -ie "s/THIS_STRING_IS_REPLACED_DURING_BUILD/$WERCKER_GIT_COMMIT/g" service.yml - script: name: show file code: cat service.yml - kubectl: server: $KUBERNETES_MASTER username: $KUBERNETES_USERNAME password: $KUBERNETES_PASSWORD insecure-skip-tls-verify: true command: apply -f service.yml DEPLOY - PIPELINE
  12. Martin Beeby @thebeebs --- apiVersion: extensions/v1beta1 kind: Deployment metadata: name:

    frontend spec: replicas: 3 template: metadata: labels: app: audienceanalyser tier: frontend spec: containers: - name: beebs image: thebeebs/howareyou:THIS_STRING_IS_REPLACED_DURING_BUILD imagePullPolicy: Always resources: requests: cpu: 100m memory: 100Mi env: - name: GET_HOSTS_FROM value: dns ports: - containerPort: 80 KUBERNETES YML
  13. Martin Beeby @thebeebs Kubernetes Bare Metal / VM / Hybrid

    Highly Available CLUSTERS TECHNICAL PREVIEW
  14. Martin Beeby @thebeebs Add more AI and host TensorFlow serving

    in my cluster Add https to the front end containers Look into Ways to hot swap between klusters WHAT’S NEXT FOR MY APP Add webcam support