unstract icon indicating copy to clipboard operation
unstract copied to clipboard

[FIX] Platform service access log

Open Deepak-Kesavan opened this issue 1 year ago • 2 comments

What

  • Fixed platform service access log not visible
  • Refactored platform-service
  • Added entrypoint.sh for platfrom service and pdm run platform_service uses gunicorn instead of flask now.

Why

  • Log fix - To make debugging easier
  • Refactor - To improve maintainability
  • Added entrypoint.sh to run platform-service locally and easily try different configurations.

Note: entrypoint is not added anywhere in our docker compose. We need to review that and add it wherever applicable.

How

  • Updated the logging config

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • No. Changes are only on logger part. The functionality remains the same.

Database Migrations

Env Config

Flask

FLASK_APP=src/unstract/platform_service/run.py
FLASK_RUN_PORT=3001

Note: These are used when we run flask run

Logging

LOG_LEVEL=INFO

Relevant Docs

Related Issues or PRs

Dependencies Versions

Notes on Testing

Screenshots

Checklist

I have read and understood the Contribution Guidelines.

Deepak-Kesavan avatar Sep 24 '24 08:09 Deepak-Kesavan

@Deepak-Kesavan can you add a screenshot comparing the logs before and after? Here's the existing logger for plaform-service image

@Deepak-Kesavan when you combine multiple changes in to single PR it becomes very difficult to review. Could you raise it as a 2 separate PRs? One for log change fixes and other one for the db refactoring

Making the changes now.

Deepak-Kesavan avatar Sep 25 '24 05:09 Deepak-Kesavan

This PR now contains platform service refactor without modifying any functionality.

Deepak-Kesavan avatar Sep 26 '24 09:09 Deepak-Kesavan

filepath function $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_logs}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_cleanup}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_cleanup\_skip}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_client\_init}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_image\_exists}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_image}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_container\_run\_config}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_container\_run\_config\_without\_mount}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_run\_container}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{9}}$$ $$\textcolor{#23d18b}{\tt{9}}$$

github-actions[bot] avatar Sep 26 '24 10:09 github-actions[bot]

Security hotspot related to CSRF will be handled separately.

hari-kuriakose avatar Sep 26 '24 13:09 hari-kuriakose

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Sep 26 '24 13:09 sonarqubecloud[bot]

Security hotspot related to CSRF will be handled separately.

@hari-kuriakose We can mark it as safe, because we don't expose this service outside. Only internal calls from other services within the machine reaches this service.

Deepak-Kesavan avatar Sep 26 '24 14:09 Deepak-Kesavan