-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move vars to dynamic, add metrics #1085
Conversation
src/routes/healthcheck/+server.ts
Outdated
@@ -0,0 +1,3 @@ | |||
export async function GET() { | |||
return new Response("OK", { status: 200 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be interesting to check the DB connectivity here and other dependencies (if there are)
src/routes/metrics/+server.ts
Outdated
@@ -0,0 +1,9 @@ | |||
import { register } from "$lib/server/metrics"; | |||
|
|||
export async function GET() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we expose this route on another port?
It would be better if we can avoid exposing metrics publicly
Good start for metrics, we should check if we can create some specific ones like: |
* Add truncate to task model (#1090) * retry text area height (#1091) * Make all the env vars dynamic * only check for db at runtime * remove secret from build step * improve dockerfile * Wrap db in singleton * add .env.local to dockerignore * changes to dockerfile * lint * aborted generations * move collections build check * Use a single dockerfile * lint * fixes * lint * don't return db during building * remove dev --------- Co-authored-by: Victor Muštar <[email protected]>
@nsarrazin since it's not possible to use env var instead of .env files , I'm not sure what should be the format of the MODELS payload as seens in an echo $MODELS command. Do we still need the ` for escaping ? |
!.env.local No newline at end of file | ||
.env.local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nsarrazin What is the recommended way to use .env.local
with Docker?
Context
The readme is currently optimised for local envs and requires changes for Docker envs.
Issue
I stumbled upon the issue that the .env.local
was ignored when building the Docker image in CI because of this ignore statement.
Possible Solutions
A temporary solution when using Docker Compose is available in PR #1238, but it doesn't apply to Kubernetes deployments. Reverting this change—i.e., to !.env.local
—would work for both Docker Compose and Kubernetes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a few examples here but i'll be improving the docs for this. Let me know if that's enough to solve your issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Furthermore, including .env.local
in Dockerfile
requires this change also:
+ COPY --chown=1000 .env.local /app/.env.local
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I faced several issues when deploying this to a Kubernetes cluster. I ended up passing somehow the .envlocal
into the Docker image.
* Add healthcheck route * Add prom client with basic metrics * wip: serve metrics on a different port * exclude server from tsconfig * latest * refacto(all): use class & singleton * refacto(all): use class & singleton * refacto(all): add request logs * Make all the env vars dynamic (huggingface#1092) * Add truncate to task model (huggingface#1090) * retry text area height (huggingface#1091) * Make all the env vars dynamic * only check for db at runtime * remove secret from build step * improve dockerfile * Wrap db in singleton * add .env.local to dockerignore * changes to dockerfile * lint * aborted generations * move collections build check * Use a single dockerfile * lint * fixes * lint * don't return db during building * remove dev --------- Co-authored-by: Victor Muštar <[email protected]> * refacto(all): update default metrics port * fix recursion error * add version check * revert vite preview * Move request logs to debug level and add an env var to filter by log level in dev mode * Set package version if needed * Set log level for prod and dev --------- Co-authored-by: rtrompier <[email protected]> Co-authored-by: Victor Muštar <[email protected]>
This PR moves all env vars to $env/dynamic
We add prometheus metrics
Get rid of
Dockerfile.local
fileDocker builds
docker build -t chat-ui .
docker build -t chat-ui-db --build-arg="INCLUDE_DB=true" .
docker build -t huggingchat --build-arg="APP_BASE=/chat" --build-arg="PUBLIC_APP_COLOR=yellow" .