-
Notifications
You must be signed in to change notification settings - Fork 7
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
chore: improve CI workflow #307
Conversation
run: | | ||
docker-compose up -d | ||
# Start backend in background (& is mandatory to run process in background otherwise the task never continue) | ||
npm run dev & |
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.
Isn't the docker compose suppose to launch the whole task, why nom run dev is needed ?
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.
Docker only run redis and elasticsearch, kuzzle is run out of docker to improve the log of errors in CI.
Also maybe it's better to run npm run prod
instead development mode for better tests.
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.
This is not a good idea, kuzzle should be ran inside the docker compose, because when it will be deployed in production it will be used inside a docker container, so when you test it you should run it in the same environment.
If you seem to be lacking of logs, you should add a docker-compose logs kuzzle when the script fails in the wait-nuzzle-start.sh
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.
The problem is not especially for wait-kuzzle.sh
but when functional tests cause errors.
IMHO it's better like that, but no problem, I can restore into docker.
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 understand why you want it this way, but in this way we diverge too much from the final environment in which a kuzzle is deployed and this creates more risk of trouble. Maybe we can talk about it on discord a bit to see if we can still have a docker environment, and more log that suit the debugging of the stack when it runs functional test
wdyt ?
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.
kuzzle-device-manager/.github/workflows/pull_request.workflow.yml
Lines 41 to 53 in d5e85cc
- name: docker pull | |
run: docker compose --profile backend pull | |
- name: docker install dependencies | |
run: docker compose run --no-deps kuzzle /bin/bash -c "npm ci" | |
- name: docker backend | |
run: | | |
# Continue when error | |
set +e | |
export BACKEND_COMMAND="npm run build && npm run prod"; | |
docker compose --profile backend up -d --wait | |
exitcode="$?" | |
[[ "$exitcode" == "0" ]] || docker compose logs kuzzle | |
exit "$exitcode" |
I'm not sure if this is the best, but I had to split the docker setup into 3 steps to avoid the ci timeout
run: | | ||
docker-compose up -d | ||
# Start backend in background (& is mandatory to run process in background otherwise the task never continue) | ||
npm run dev & |
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.
Same comment
docker-compose.yml
Outdated
depends_on: | ||
- redis | ||
healthcheck: | ||
test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] |
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.
Since you are using Kuzzle 2.25, you can use "http://localhost:7512/_healthcheck" new public route
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 think there is mistake because, I have used, this route for healthcheck on kuzzle service.
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.
http://kuzzle:7512/_healthCheck does exists indeed but it will be deprecated
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.
Hum sorry, I Don't really understand the difference between "http://localhost:7512/_healthcheck" and "http://kuzzle:7512/_healthCheck" for the test.
The only difference is the DNS and I found it's more accurate to use the service name instead localhost which is less clear.
Could you explain to me the difference ?
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.
Sorry, I tested locally then forgot to update with the service name indeed
I meant http://kuzzle:7512/_healthcheck
The route you are using http://kuzzle:7512/_healthCheck is not a public route, it will be working as is until your kuzzle instance allow the anonymous the use this controller server.
{
--
verb: "get",
path: "/_healthCheck",
controller: "server",
action: "healthCheck",
}
Whereas the http://kuzzle:7512/_healthcheck and will always return a 200 since it is a public route
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.
Ok my bad, I just saw the difference in typo between _healthCheck
and _healthcheck
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.
changed
e549f93
to
55fe83c
Compare
55fe83c
to
3406a80
Compare
3406a80
to
d5e85cc
Compare
healthcheck: | ||
test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthcheck'] | ||
timeout: 1s | ||
interval: 2s | ||
retries: 10 | ||
start_period: 30s |
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 think we should not set a Docker Compose healthcheck on Kuzzle since functional test for example could lead to permissions issues on this route
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.
Or at least you should handle 403/401 status code to be allowed
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.
The healthcheck route are not forced to be public, or in minimal case, always allow call from localhost ?
Also, I don't see how to handle 403/401 status code here
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.
The only way to do that is to create a custom healthcheck (like a Node.js or bash script for example)but for now ignore my comment
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.
This health check method is public now 👌🏼 we should not have any issue see kuzzleio/kuzzle#2455
* chore: improve docker-compose config * ci: improve ci workflows * chore: remove useless postinstall * refactor: improve build packages types * chore: update kuzzle dependency * chore: update healthcheck endpoint * fix: restore run backend in docker * fix: correct docker setup in ci
What does this PR do ?
Update and improve CI workflows, refactor actions directly in workflows steps and add
check-types
step to check types error before try to build.Other changes
Improve docker-compose
node_modules
of kuzzle backend (prevent error with packages installed in local, ex: GLIBC error)Boyscout
Update kuzzle dependency
Update
kuzzle
package from 2.23 to 2.25.This is useful to update
uWebSockets.js
package from 20.0 to 20.7 to support node version 18