Code Monkey home page Code Monkey logo

scalable-web-app's Introduction

Scalable-web-app

A client-server based application to demonstrate deployment and packaging abilities of Kubernetes and Docker combination. Following is the list of tools along with useful documentation:

  • Docker - Container runtime for packaging applications.
  • Kubernetes - Cluster manager for life cycle management of applications.
  • Minikube - Kubernetes flavor for single node developement environment.
  • Docker Registry - Docker registry hosting application images.

You will need a kubernetes environment for running the application. Please refer to above documentation for k8s installation.

server

The server is a docker based nginx server hosting our favourite Hello,World page. The docker image for server is available here.

client

The client is a cURL based utility that will be used to send periodic HTTP requests to the server. The docker image for client is available here.

get the code

Download the code using git:

$ git clone https://github.com/MQasimSarfraz/scalable-web-app.git

Deployments

All the entities will be deployed via kubectl utility using respective yaml files. All the deployment files are kept in scalable-web-app/kubernetes

server deployment

Deploy the server using:

$ kubectl create -f kubernetes/deployments/server.yaml

You can verify that the server is running using:

$ kubectl get deployment server
$ kubectl describe deployment server

For the server to be accessible it needs to be exposed as a service using:

$ kubectl create -f kubernetes/services/server.yaml

client deployment

Client issues periodic HTTP request to server and has following configurable attributes:

  • Time between each request (optional)

You can configure the time for HTTP request in client.yaml. The format of the schedule string is explained here. Now deploy client using:

$ kubectl create -f kubernetes/deployments/client.yaml

scaling server

In order to scale the server, update the replicas in kubernetes/deployments/server.yaml to the required number of server. Once done scale the servers using:

$ kubectl apply -f kubernetes/deployments/server.yaml

updating server

The server has two versions available:

  • server v1 with nginx 1.10.1
  • server v2 with nginx 1.11.1

Both of these images are available at smqasims docker registry. By default server:v1 is deployed.

In order to update the server, update the image in kubernetes/deployments/server.yaml to the the newer version i.e smqasims/server:v2. Once done update the servers using:

$ kubectl apply -f kubernetes/deployments/server.yaml

Docker images

Images can be uploaded using scalable-web-app/app/build-image.sh script. Specify the required tags of images in the script and run it using:

$ chmod +x build-image.sh
$ ./build-image.sh

Cleanup

Cleanup the application using scalable-web-app/kubernetes/scripts/cleanup.sh script:

$ chmod +x cleanup.sh
$ ./cleanup.sh

scalable-web-app's People

Contributors

mqasimsarfraz avatar

Watchers

James Cloos avatar  avatar  avatar

scalable-web-app's Issues

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.