From 2965293bfb87c3ef83828565ae75415d3a149808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Henrique?= Date: Mon, 30 Oct 2023 20:34:20 -0300 Subject: [PATCH] fixes & adding spring docker --- FlaskAPI/controllers/simulation.py | 2 +- docker-compose.yml | 12 ++++++++++++ scripts/common.py | 3 ++- scripts/init.py | 9 +++++++-- scripts/testes.py | 2 ++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/FlaskAPI/controllers/simulation.py b/FlaskAPI/controllers/simulation.py index ab7c764..9cde57f 100644 --- a/FlaskAPI/controllers/simulation.py +++ b/FlaskAPI/controllers/simulation.py @@ -26,5 +26,5 @@ def return_ok(): return str(sum), 200 @simulation_blueprint.route('/simulation/json', methods=['GET']) -def return_ok(): +def return_helloworld(): return simulation_controller.return_helloworld(), 200 diff --git a/docker-compose.yml b/docker-compose.yml index 373409b..561f826 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -49,3 +49,15 @@ services: limits: cpus: '1' memory: 1GB + tcc-spring: + image: tcc:spring + container_name: tcc-spring + build: ./springtcc + restart: always + ports: + - "9085:8080" + deploy: + resources: + limits: + cpus: '1' + memory: 1GB diff --git a/scripts/common.py b/scripts/common.py index 74f8fe6..e4e26b6 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -3,6 +3,7 @@ FRAMEWORKS = [ ('ASP.NET', 'tcc-aspnet', 'blue'), ('Flask', 'tcc-flask', 'green'), ('Express', 'tcc-express', 'red'), + ('Spring', 'tcc-spring', 'pink'), ] ENDPOINTS = { @@ -10,6 +11,7 @@ ENDPOINTS = { 'ASP.NET': 'http://localhost:9081', 'Flask': 'http://localhost:9082', 'Express': 'http://localhost:9084', + 'Spring': 'http://localhost:9085', } AVG_RUNS = 5 @@ -23,6 +25,5 @@ API_REQUESTS = [ ('/static/small-image.png', 'GET', range(0, 30_000, 5000), None), ('/image/load-big-image', 'GET', range(0, 500, 50), None), ('/static/big-image.png', 'GET', range(0, 500, 50), None), - ('/static/video.mp4', 'GET', range(0, 10_000, 1_000), None), ('/static/nginx.html', 'GET', range(0, 30_000, 5000), None), ] diff --git a/scripts/init.py b/scripts/init.py index 6347e80..a898fb4 100644 --- a/scripts/init.py +++ b/scripts/init.py @@ -1,4 +1,5 @@ import requests +import os def download_file(url): local_filename = url.split('/')[-1] @@ -13,5 +14,9 @@ def download_file(url): return local_filename def init(): - download_file('https://files.ivanch.me/api/public/dl/iFuXSNhw/small-image.png') - download_file('https://files.ivanch.me/api/public/dl/81Bkht5C/big-image.png') \ No newline at end of file + if not os.path.exists('small-image.png'): + download_file('https://files.ivanch.me/api/public/dl/iFuXSNhw/small-image.png') + if not os.path.exists('big-image.png'): + download_file('https://files.ivanch.me/api/public/dl/iFuXSNhw/big-image.png') + +init() \ No newline at end of file diff --git a/scripts/testes.py b/scripts/testes.py index aca1b86..dcb3c9f 100644 --- a/scripts/testes.py +++ b/scripts/testes.py @@ -135,6 +135,8 @@ if __name__ == "__main__": if not os.path.exists("data"): os.mkdir("data") + init() + for i in range(len(FRAMEWORKS)): FRAMEWORK_NAME = FRAMEWORKS[i][0] CONTAINER_NAME = FRAMEWORKS[i][1]