Giter VIP home page Giter VIP logo

urllookupservice's Introduction

URL Lookup Service

This application exposes an API to lookup if a URL is malicious. The project is built in Java, Spring Boot and uses Redis as the datastore. The application is stateless and hence can be scaled to n number of instances behind a loadbalancer(eg. see kubernetes deployment) . The Redis datastore can also be scaled to create a cluster of several nodes.

Usage

To check if url is malicious GET /urlinfo/1/{URL to verify} eg.

    $ curl localhost:8080/urlinfo/1/hjaoopoa.top%2Fadmin.php%3Ff%3D1.gif

returns

    {"fullUrl":"hjaoopoa.top/admin.php?f=1.gif","isMalicious":"true"}% 

To add a URL to the malicious list POST /urladd/1/{malicious URL}

eg.

    $ curl -X POST localhost:8080/urladd/1/www.hjaoopoa.top%2Fadmin.php%3Ff%3D1.gif

response with

    {"fullUrl":"hjaoopoa.top/admin.php?f=1.gif","isMalicious":"true"}% 

Running and Deploying

Instructions to run using Docker Compose

  $ ./mvnw install dockerfile:build
  $ docker-compose up -d

Instructions to run without Docker ( Requires Redis to be running locally)

 $ ./mvnw package && java -jar target/urllookupservice-0.0.1-SNAPSHOT.jar --redis.servername=localhost

Instructions to deploy using Kubernetes (Minikube)

Make sure that minikube and kubectl is installed and running

Install kubectl Install minikube

  1. Create Redis Master Deployment
	$ kubectl create -f k8s/redis-master-deployment.yaml
  1. Create Redis Master Service
	$ kubectl create -f k8s/redis-master-service.yaml
  1. Create Redis Slave Deployment
	$ kubectl create -f k8s/redis-slave-deployment.yaml
  1. Create Redis Slave Service
	$ kubectl create -f k8s/redis-slave-service.yaml
  1. Create the URLService Deployment ( deploys 3 instances)
	$ kubectl create -f k8s/urlservice-frontend-deployment.yaml
  1. Create the URLService Service to expose the API
	$ kubectl create -f k8s/urlservice-frontend-service.yaml

To get the API URL via the NodePort

	$ minikube service frontend --url

should return a response similar to this

	http://192.168.99.100:31323

Open the returned URL in a browser to go to the URLService home page

urllookupservice's People

Contributors

darshansundaresh 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.