diff --git a/proyecto/docker-compose-devel-mongo.yml b/proyecto/docker-compose-devel-mongo.yml index a726ccc..7602ef8 100644 --- a/proyecto/docker-compose-devel-mongo.yml +++ b/proyecto/docker-compose-devel-mongo.yml @@ -4,16 +4,17 @@ services: ssdd-frontend: build: frontend/. ports: - - 5010:5000 + - 5010:5010 env_file: mongo.env environment: - FLASK_APP=app/app.py - FLASK_DEBUG=true + - PORT=5010 ssdd-llamachat: image: dsevilla/ssdd-llamachat:1.0 ports: - - 5020:5000 + - 5020:5020 db-mongo: build: db-mongo/. diff --git a/proyecto/docker-compose-devel.yml b/proyecto/docker-compose-devel.yml index 7b03860..4c1e3f6 100644 --- a/proyecto/docker-compose-devel.yml +++ b/proyecto/docker-compose-devel.yml @@ -4,16 +4,17 @@ services: ssdd-frontend: build: frontend/. ports: - - 5010:5000 + - 5010:5010 env_file: sql.env environment: - FLASK_APP=app/app.py - FLASK_DEBUG=true + - PORT=5010 ssdd-llamachat: image: dsevilla/ssdd-llamachat:1.0 ports: - - 5020:5000 + - 5020:5020 db-mysql: build: db-mysql/. diff --git a/proyecto/docker-compose.yml b/proyecto/docker-compose.yml index 8be51c5..d8c7af9 100644 --- a/proyecto/docker-compose.yml +++ b/proyecto/docker-compose.yml @@ -4,16 +4,17 @@ services: ssdd-frontend: image: dsevilla/ssdd-frontend:1.0 ports: - - 5010:5000 + - 5010:5010 env_file: sql.env environment: - FLASK_APP=app/app.py - FLASK_DEBUG=true + - PORT=5010 ssdd-llamachat: image: dsevilla/ssdd-llamachat:1.0 ports: - - 5020:5000 + - 5020:5020 db-mysql: build: db-mysql/. diff --git a/proyecto/frontend/Dockerfile b/proyecto/frontend/Dockerfile index ce4aa4e..21c2694 100644 --- a/proyecto/frontend/Dockerfile +++ b/proyecto/frontend/Dockerfile @@ -8,7 +8,8 @@ RUN pip install -r requirements.txt ENV FLASK_APP="app/app.py" ENV FLASK_DEBUG=true +ENV PORT=5010 -EXPOSE 5000 +EXPOSE 5010 -CMD [ "flask", "run", "--host=0.0.0.0" ] +CMD [ "flask", "run", "--host=0.0.0.0", "--port=5010" ] diff --git a/proyecto/frontend/Dockerfile-devel b/proyecto/frontend/Dockerfile-devel index 2fd6941..2b42e26 100644 --- a/proyecto/frontend/Dockerfile-devel +++ b/proyecto/frontend/Dockerfile-devel @@ -11,7 +11,8 @@ RUN pip install -r requirements.txt ENV FLASK_APP="app/app.py" ENV FLASK_DEBUG=false +ENV PORT=5010 -EXPOSE 5000 +EXPOSE 5010 -CMD [ "flask", "run", "--host=0.0.0.0" ] +CMD [ "flask", "run", "--host=0.0.0.0", "--port=5010" ] diff --git a/proyecto/frontend/app/app.py b/proyecto/frontend/app/app.py index d1c5e54..e72b836 100644 --- a/proyecto/frontend/app/app.py +++ b/proyecto/frontend/app/app.py @@ -64,4 +64,4 @@ def load_user(user_id): return None if __name__ == '__main__': - app.run(debug=True, host='0.0.0.0') + app.run(debug=True, host='0.0.0.0', port=int(os.environ.get('PORT', 5010))) diff --git a/proyecto/frontend/docker-compose-devel.yml b/proyecto/frontend/docker-compose-devel.yml index fbf78a3..d9cac4b 100644 --- a/proyecto/frontend/docker-compose-devel.yml +++ b/proyecto/frontend/docker-compose-devel.yml @@ -6,7 +6,7 @@ services: context: . dockerfile: Dockerfile-devel ports: - - "5010:5000" + - "5010:5010" volumes: - .:/ssdd-frontend user: root @@ -15,4 +15,5 @@ services: environment: - FLASK_APP=app/app.py - FLASK_DEBUG=false + - PORT=5010 diff --git a/proyecto/llamachat/Dockerfile b/proyecto/llamachat/Dockerfile index 2fb35f9..0f5f608 100644 --- a/proyecto/llamachat/Dockerfile +++ b/proyecto/llamachat/Dockerfile @@ -12,4 +12,4 @@ ENV FLASK_DEBUG=true EXPOSE 5020 -CMD [ "flask", "run", "--host=0.0.0.0" ] +CMD [ "flask", "run", "--host=0.0.0.0", "--port=5020" ] diff --git a/proyecto/llamachat/app/app.py b/proyecto/llamachat/app/app.py index 4043b4e..19d9f29 100644 --- a/proyecto/llamachat/app/app.py +++ b/proyecto/llamachat/app/app.py @@ -50,7 +50,6 @@ def llm(self, token, prompt): llm = LLM() -app = Flask(__name__, static_url_path='') def init_model_and_process_requests(): global llm @@ -85,6 +84,10 @@ def handle_response_request(prompt: dict) -> dict: return token + +app = Flask(__name__, static_url_path='', port=) + + # Configurar el secret_key. OJO, no debe ir en un servidor git público. # Python ofrece varias formas de almacenar esto de forma segura, que # no cubriremos aquí. @@ -134,4 +137,4 @@ def healthcheck(): # Start the download of the model, if needed Thread(target=init_model_and_process_requests).start() - app.run(debug=True, host='0.0.0.0') + app.run(debug=True, host='0.0.0.0', port=int(os.environ.get('PORT', 5020)))