Thursday, May 17, 2018

MIcroservice Case study

Microservices could be implemented in several way. In this case below is the stack used.

  • Django
  • Flask
  • Node.js
  • mysql
  • mongo
  • docker
  • kubernetes
  • ubuntu 

In this usecase API searches keyword "search_term" in the available public repositories and displays top 5 active repositories
There are 3 app services here i.e., Django (DAPP) service, FLASK(FAPP) service, NODE.JS(Nodeapp) service
There are 2 database services Mysql(ms-mysql)service and Mongo(ms-mongo)service.

All five docker images are available at location Docker Hub

Preparing the environment

Install docker and kubernetes as mentioned in the location 

Checkout and start kubernetes files from github location

Starting and Stopping services

Start the kubernetes services/pods/deployments with below steps with the files located in dhub
sh ./
sh ./

For stopping kubernetes services/pods/deployments use below step
sh ./

Consuming APIs

DAPP consumes FAPP, MySql services and exposes API

FAPP consumes Mongo service and exposed API

Nodeapp consumes Mongo service

Friday, February 16, 2018

Deployin django in nginx & uwsgi environment

1. Install uwsgi , nginx 
apt-get install uwsgi, nginx

2. Clone django helloworld program
git clone

3. Copy the helloworld program into /opt folder
cp -r Tutorials/dj_nx_wsgi  /opt

sudo chown -R www-data:www-data /opt/dj_nx_wsgi

4. Create a python virtual environment and install django
cd /opt
virtualenv env
source /opt/env/bin/activate
pip install django

5. Test uwsgi
(env) osboxes@ubuntu:/opt$ uwsgi --http  :8001 --wsgi-file /opt/dj_ng_wsgi/dj_ng_wsgi/  --virtualenv /opt/env --chdir /opt/dj_ng_wsgi/

6. Access from browser

7. Configure nginx
copy nginx.conf from dj_nj_wsgi folder to /etc/nginx/sites-available
make soft link
ln -s /etc/nginx/sites-available/nginx.conf /etc/nginx/sites-enabled/nginx.conf

8.restart nginx
service nginx restart

9. start wsgi
(env) osboxes@ubuntu:/opt$ uwsgi --socket :8001 --wsgi-file /opt/dj_ng_wsgi/dj_ng_wsgi/  --virtualenv /opt/env --chdir /opt/dj_ng_wsgi/

10.from browser access the url.