Skip to content

Commit

Permalink
Change default server command to not use debugpy (#714)
Browse files Browse the repository at this point in the history
  • Loading branch information
puehringer authored May 6, 2022
1 parent 01afd3f commit efb6afb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions deploy/Dockerfile_dev
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN echo '#!/bin/sh\npip install --no-cache-dir --no-deps -r /phovea/requirement
RUN chmod +x /tmp/entrypoint.sh
ENTRYPOINT [ "/tmp/entrypoint.sh" ]

# Default command is to start the server in debug mode
CMD [ "python -m debugpy --listen 0.0.0.0:5678 -m uvicorn tdp_core.server.main:app --reload --host 0.0.0.0 --port 9000"]
# Default command is to start the server
CMD [ "python -m uvicorn tdp_core.server.main:app --reload --host 0.0.0.0 --port 9000" ]

EXPOSE 9000
5 changes: 4 additions & 1 deletion deploy/docker-compose-debug.partial.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ version: '2.0'
services:
db_mongo:
ports:
- '27017:27017'
- '27017:27017'
api:
# Override the default server command to add a debugging process. This causes the app to run slower, therefore it is optional.
command: 'python -m debugpy --listen 0.0.0.0:5678 -m uvicorn tdp_core.server.main:app --reload --host 0.0.0.0 --port 9000'
8 changes: 4 additions & 4 deletions tdp_core/dbmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ def create_web_session(self, engine_or_id: Union[Engine, str]) -> Session:
session = self.create_session(engine_or_id)

try:
existing_session = get_request().state.db_sessions
existing_sessions = get_request().state.db_sessions
except (KeyError, AttributeError):
existing_session = []
get_request().state.db_sessions = existing_session
existing_session.append(session)
existing_sessions = []
get_request().state.db_sessions = existing_sessions
existing_sessions.append(session)

return session

0 comments on commit efb6afb

Please sign in to comment.