Commit 15ef25dd authored by Alexander Lercher's avatar Alexander Lercher

Renamed microservices and moved source code

parent a697b99c
# add modules folder to interpreter path
import sys
import os
modules_path = '../../../modules/'
if os.path.exists(modules_path):
sys.path.insert(1, modules_path)
### init logging ###
import logging
LOG_FORMAT = ('%(levelname) -5s %(asctime)s %(name)s:%(funcName) -35s %(lineno) -5d: %(message)s')
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
LOGGER = logging.getLogger(__name__)
#############################
import connexion
# load swagger config
app = connexion.App(__name__, specification_dir='configs/')
app.add_api('swagger.yml')
@app.route('/', methods=['GET'])
def api_root():
return 'Endpoint of community-detection-microservice!'
# start app
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)
...@@ -5,17 +5,14 @@ ENV http_proxy http://proxy.uni-klu.ac.at:3128/ ...@@ -5,17 +5,14 @@ ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/ ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
RUN pip install flask
RUN pip install connexion[swagger-ui]
EXPOSE 5000 EXPOSE 5000
WORKDIR /app WORKDIR /app
# https://www.aptible.com/documentation/faq/deploy/dockerfile-caching/pip-dockerfile-caching.html COPY src/data-hub/proactive-community-detection-microservice/app/ /app/
COPY src/data-hub/community-detection-microservice/app/requirements.txt /app/
RUN pip install -r requirements.txt
COPY src/modules/ /app/
COPY src/data-hub/community-detection-microservice/app/ /app/
RUN chmod a+x main.py RUN chmod a+x main.py
CMD ["python", "./main.py"] CMD ["python", "./main.py"]
\ No newline at end of file
# Community Detection Microservice # Proactive Community Detection Microservice
The community detection microservice helps in deeper network understand- The community detection microservice helps in deeper network understand-
ing and reveals interesting properties shared by the members. We propose a novel approach that combines event clustering and link analysis to detect communities along with clustering users into overlapping communities via agent, role, stage discovery microservices. ing and reveals interesting properties shared by the members. We propose a novel approach that combines event clustering and link analysis to detect communities along with clustering users into overlapping communities via agent, role, stage discovery microservices.
......
swagger: "2.0"
info:
title: Proactive Community Detection microservice
description: This is the documentation for the proactive community detection microservice.
version: "1.0.0"
consumes:
- "application/json"
produces:
- "application/json"
basePath: "/api"
paths:
/debug:
post:
operationId: "debug.echo"
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
200:
description: "Successful echo of request data"
import connexion
# load swagger config
app = connexion.App(__name__, specification_dir='configs/')
app.add_api('swagger.yml')
@app.route('/', methods=['GET'])
def api_root():
return 'Endpoint of proactive-community-detection-microservice!'
# start app
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: community-detection name: proactive-community-detection
spec: spec:
type: LoadBalancer type: LoadBalancer
selector: selector:
app: community-detection app: proactive-community-detection
ports: ports:
- name: http - name: http
port: 80 port: 80
...@@ -16,54 +16,54 @@ spec: ...@@ -16,54 +16,54 @@ spec:
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: community-detection name: proactive-community-detection
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
app: community-detection app: proactive-community-detection
template: template:
metadata: metadata:
labels: labels:
app: community-detection app: proactive-community-detection
spec: spec:
containers: containers:
- name: community-detection - name: proactive-community-detection
image: alexx882/community-detection-microservice image: alexx882/proactive-community-detection-microservice
ports: ports:
- containerPort: 5000 - containerPort: 5000
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: community-detection-db name: proactive-community-detection-db
spec: spec:
type: LoadBalancer type: LoadBalancer
selector: selector:
app: community-detection-db app: proactive-community-detection-db
ports: ports:
- name: http - name: http
port: 27017 port: 27017
targetPort: 27017 targetPort: 27017
nodePort: 30110 nodePort: 30111
protocol: TCP protocol: TCP
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: community-detection-db name: proactive-community-detection-db
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
app: community-detection-db app: proactive-community-detection-db
template: template:
metadata: metadata:
labels: labels:
app: community-detection-db app: proactive-community-detection-db
spec: spec:
containers: containers:
- name: community-detection-db - name: proactive-community-detection-db
image: mongo image: mongo
env: env:
- name: MONGO_INITDB_ROOT_USERNAME - name: MONGO_INITDB_ROOT_USERNAME
......
...@@ -5,12 +5,16 @@ ENV http_proxy http://proxy.uni-klu.ac.at:3128/ ...@@ -5,12 +5,16 @@ ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/ ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
RUN pip install flask
RUN pip install connexion[swagger-ui]
EXPOSE 5000 EXPOSE 5000
WORKDIR /app WORKDIR /app
# https://www.aptible.com/documentation/faq/deploy/dockerfile-caching/pip-dockerfile-caching.html
COPY src/data-hub/role-stage-discovery-microservice/app/requirements.txt /app/
RUN pip install -r requirements.txt
COPY src/modules/ /app/
COPY src/data-hub/role-stage-discovery-microservice/app/ /app/ COPY src/data-hub/role-stage-discovery-microservice/app/ /app/
RUN chmod a+x main.py RUN chmod a+x main.py
......
# add modules folder to interpreter path
import sys
import os
modules_path = '../../../modules/'
if os.path.exists(modules_path):
sys.path.insert(1, modules_path)
### init logging ###
import logging
LOG_FORMAT = ('%(levelname) -5s %(asctime)s %(name)s:%(funcName) -35s %(lineno) -5d: %(message)s')
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
LOGGER = logging.getLogger(__name__)
#############################
import connexion import connexion
# load swagger config # load swagger config
app = connexion.App(__name__, specification_dir='configs/') app = connexion.App(__name__, specification_dir='configs/')
app.add_api('swagger.yml') app.add_api('swagger.yml')
@app.route('/', methods=['GET']) @app.route('/', methods=['GET'])
def api_root(): def api_root():
return 'Endpoint of role-discovery-microservice!' return 'Endpoint of role-stage-discovery-microservice!'
# start app # start app
if __name__ == '__main__': if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True) app.run(host='0.0.0.0', port=5000, debug=True)
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: role-discovery name: role-stage-discovery
spec: spec:
type: LoadBalancer type: LoadBalancer
selector: selector:
app: role-discovery app: role-stage-discovery
ports: ports:
- name: http - name: http
port: 80 port: 80
targetPort: 5000 targetPort: 5000
nodePort: 30102 nodePort: 30103
protocol: TCP protocol: TCP
--- ---
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: role-discovery name: role-stage-discovery
spec: spec:
replicas: 1 replicas: 1
selector: selector:
matchLabels: matchLabels:
app: role-discovery app: role-stage-discovery
template: template:
metadata: metadata:
labels: labels:
app: role-discovery app: role-stage-discovery
spec: spec:
containers: containers:
- name: role-discovery - name: role-discovery
image: alexx882/role-discovery-microservice image: alexx882/role-stage-discovery-microservice
ports: ports:
- containerPort: 5000 - containerPort: 5000
\ No newline at end of file ---
# todo change DB name!
apiVersion: v1
kind: Service
metadata:
name: community-detection-db
spec:
type: LoadBalancer
selector:
app: community-detection-db
ports:
- name: http
port: 27017
targetPort: 27017
nodePort: 30110
protocol: TCP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: community-detection-db
spec:
replicas: 1
selector:
matchLabels:
app: community-detection-db
template:
metadata:
labels:
app: community-detection-db
spec:
containers:
- name: community-detection-db
image: mongo
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: root
- name: MONGO_INITDB_ROOT_PASSWORD
value: root
ports:
- containerPort: 27017
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment