Skip to content

Commit

Permalink
add machine generation tool src in the repo for docker deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaz040 committed Sep 20, 2024
1 parent e02ceb8 commit 868012d
Show file tree
Hide file tree
Showing 23 changed files with 367 additions and 71 deletions.
Binary file not shown.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
>[!NOTE]
This repository is still work in progress and not intended for **production purpose**. It is developed as part of the components for **TP 2.4 PoC**.

### Acronyms
AAS --> Asset Administration

# fx-ccm-dataspace-poc-mapping

AAS Mapper is a **python (back-end)** and **react (front-end)** based implementation to integrate shopfloor data into AAS.
Asset Administration Shell(AAS) Mapper is a **python (back-end)** and **react (front-end)** based implementation to integrate shopfloor data into AAS.

The react front-end is a simple UI that help facilitate the inputation of endpoints that AAS mapper is interfacing with and also datapoints of the shopfloor asset.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file added backend-flask/__pycache__/Models.cpython-311.pyc
Binary file not shown.
File renamed without changes.
23 changes: 12 additions & 11 deletions BackendFlask/server.py → backend-flask/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
# current module (__name__) as argument.
app = Flask(__name__)

#Interface object
# Interface object

aasmapper = InterfaceSetup.AasMapper()
ui_origin_localhost = "http://localhost:3000"
ui_origin_docker = "http://client:3000"


# The route() function of the Flask class is a decorator,
# which tells the application which URL should call
# the associated function.
Expand All @@ -23,16 +24,17 @@ def hello_world():
return "Hello World"


@app.route("/adddatapoint/", methods=["POST"])
@cross_origin(origins=[ui_origin_localhost])
#/add-datapoint is bound with addDatapoint() function to add new datapoint
@app.route("/adddatapoint", methods=["POST"])
@cross_origin(origins=[ui_origin_docker])
# /add-datapoint is bound with addDatapoint() function to add new datapoint
def addDatapoint():
data = json.loads(request.data)
assets = aasmapper.add_datapoint(data)
return {"assets":assets}
return {"assets": assets}


@app.route("/getdatapoints", methods=["GET"])
@cross_origin(origins=[ui_origin_localhost])
@cross_origin(origins=[ui_origin_docker])
# ‘/’ URL is bound with getDatapoint() function.
def getDatapoints():

Expand All @@ -41,21 +43,20 @@ def getDatapoints():
return {"assets": datapoints, "endpoints": endpoints}


@app.route("/readdatapoint/", methods=["GET"])
@cross_origin(origins=[ui_origin_localhost])
@app.route("/readdatapoint", methods=["GET"])
@cross_origin(origins=[ui_origin_docker])
# ‘/’ URL is bound with readDatapoint() function.
def readDatapoint():
id = request.args.get("id")
assetId = request.args.get("assetId")

payload = aasmapper.read_datapoint_from_source(assetId=assetId, id=id)


return payload


@app.route("/configinfo", methods=["POST"])
@cross_origin(origins=[ui_origin_localhost])
@cross_origin(origins=[ui_origin_docker])
# ‘/’ URL is bound with submitConfigInfo() function.
def submitConfigInfo():
data = json.loads(request.data)
Expand Down
22 changes: 12 additions & 10 deletions data-source-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
FROM python:3
# simple BASE-Image
FROM python:3.10.11

WORKDIR /assetapp
# working directory for te container
WORKDIR /fx_data_source

ENV FLASK_APP=app.py
# Install requirements
COPY ./req.txt /fx_data_source/req.txt
RUN pip install --no-cache-dir --upgrade -r /fx_data_source/req.txt

COPY . .

RUN pip install -r requirements.txt

EXPOSE 8500

CMD ["python", "app.py"]
# Run "API-APP"
COPY ./app /fx_data_source/app
CMD ["uvicorn", "app.poc_data_source:app", "--host", "0.0.0.0", "--port", "80"]
# NOTE: we might want to change the port-cfg depending on the deployment
# on the individual k8s-clusters (Arno's cluster, Catena cluster, SFH ...)
3 changes: 3 additions & 0 deletions data-source-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# fx-ccm-dataspace-poc-business-int-logic

docker pull fraunhoferiosb/fx-ccm-dataspace-poc-business-int-logic:latest
42 changes: 0 additions & 42 deletions data-source-app/app.py

This file was deleted.

Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 868012d

Please sign in to comment.