Commit 1f634d10 authored by Alexander Lercher's avatar Alexander Lercher

Added participation hub and business logic microservice

parent 6706e220
FROM python:3
LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update
EXPOSE 5000
WORKDIR /app
COPY src/participation-hub/business-logic-microservice/app/requirements.txt /app/
RUN pip install -r requirements.txt
COPY src/modules/ /app/
COPY src/participation-hub/business-logic-microservice/app/ /app/
RUN chmod a+x main.py
CMD ["python", "./main.py"]
\ No newline at end of file
# Business Logic Microservice
The business model microservice serves as an interface for the individual use cases. Here, schema information for all use cases is stored to enable context-aware processing.
## Technologies
- Python 3.x
- Docker
- Kubernetes
\ No newline at end of file
swagger: "2.0"
info:
title: Business Logic microservice
description: This is the documentation for the business logic 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"
from flask import request
def echo():
return request.json
\ No newline at end of file
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 business-logic-microservice!'
# start app
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)
attrs==19.3.0
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
clickclick==1.2.2
connexion==2.7.0
Flask==1.1.2
idna==2.10
importlib-metadata==1.7.0
inflection==0.5.0
itsdangerous==1.1.0
Jinja2==2.11.2
jsonschema==3.2.0
MarkupSafe==1.1.1
openapi-spec-validator==0.2.9
pyrsistent==0.16.0
PyYAML==5.3.1
requests==2.24.0
six==1.15.0
swagger-ui-bundle==0.0.8
urllib3==1.25.10
Werkzeug==1.0.1
zipp==3.1.0
apiVersion: v1
kind: Service
metadata:
name: business-logic
spec:
type: LoadBalancer
selector:
app: business-logic
ports:
- name: http
port: 80
targetPort: 5000
nodePort: 30420
protocol: TCP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: business-logic
spec:
replicas: 1
selector:
matchLabels:
app: business-logic
template:
metadata:
labels:
app: business-logic
spec:
containers:
- name: business-logic
image: alexx882/business-logic-microservice
ports:
- containerPort: 5000
---
apiVersion: v1
kind: Service
metadata:
name: business-logic-db
spec:
type: LoadBalancer
selector:
app: business-logic-db
ports:
- name: http
port: 27017
targetPort: 27017
nodePort: 30421
protocol: TCP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: business-logic-db
spec:
replicas: 1
selector:
matchLabels:
app: business-logic-db
template:
metadata:
labels:
app: business-logic-db
spec:
containers:
- name: business-logic-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