Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mqasimsarfraz/scalable-web-app
A simple web application packaged and managed by combination of Kubernetes and Docker.
https://github.com/mqasimsarfraz/scalable-web-app
docker dockerfile kubernetes kubernetes-service nginx
Last synced: 5 days ago
JSON representation
A simple web application packaged and managed by combination of Kubernetes and Docker.
- Host: GitHub
- URL: https://github.com/mqasimsarfraz/scalable-web-app
- Owner: mqasimsarfraz
- Created: 2017-03-04T07:33:26.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-10T12:25:57.000Z (almost 8 years ago)
- Last Synced: 2024-12-02T11:45:55.912Z (2 months ago)
- Topics: docker, dockerfile, kubernetes, kubernetes-service, nginx
- Language: Shell
- Size: 13.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://docs.docker.com/) - Container runtime for packaging applications.
- [Kubernetes](https://kubernetes.io/docs/) - Cluster manager for life cycle management of applications.
- [Minikube](https://kubernetes.io/docs/getting-started-guides/minikube/) - Kubernetes flavor for single node developement environment.
- [Docker Registry](https://hub.docker.com/u/smqasims/) - 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](https://hub.docker.com/r/smqasims/server/).
## 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](https://hub.docker.com/r/smqasims/client/).## 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](https://en.wikipedia.org/wiki/Cron). 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.1Both of these images are available at [smqasims](https://hub.docker.com/u/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
```