-
Notifications
You must be signed in to change notification settings - Fork 66
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
Add option learn-ocaml build serve --serve-during-build
and fix related minor issues
#597
Conversation
2bb83c6
to
6707bc9
Compare
6707bc9
to
efddc57
Compare
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.
Wow, this is more complex than I anticipated.
It's fine overall but I think some points should be clarified, in particular I have trouble following the meaning and processing of the child_pid
variable/flag.
I also added some suggestions to make the user-facing information easier to grasp.
efddc57
to
246da7a
Compare
246da7a
to
907b425
Compare
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.
Nice, besides nitpicking on the manpage section the new option appears in, this seems all fine! :)
Motivation: - Makes it possible to provide a feature similar to the `--replace` option (namely, `learn-ocaml build serve --replace`) within a Docker context. As `--replace` needed to successively start 2 learn-ocaml processes listening to the same port, but if we spin two different containers, ./www is not shared between containers, nor the local TCP interface. - If tweaking the default entrypoint could be an alternative solution, the shell script would be involved to cope with the need to handle signals properly. - The solution implemented in this commit is simpler and can be enabled in a docker-compose context by passing: ``` environment: LEARNOCAML_SERVE_DURING_BUILD: 'true' ``` or: ``` environment: - 'LEARNOCAML_SERVE_DURING_BUILD=true' ``` then run a command such as `docker restart learn-ocaml`. Remarks: - Using docker-compose, to restart a server and benefit from this feature, use ( docker compose stop ; docker compose restart ) rather than ( docker compose down ; docker compose up -d ) - This commit has been double-checked with both native server ( make ; make opaminstall ; learn-ocaml build serve --serve-during-build --repo=$REPO ) and bytecode server ( make ; make opaminstall ; mv $(which learn-ocaml-server){,~} ; learn-ocaml build serve --serve-during-build --repo=$REPO ) - For uniformity, this commit also introduces an environment variable 'LEARNOCAML_REPLACE=true' as a fallback for `--replace`. Close ocaml-sf#594
Beforehand: - Learnocaml v.1.0.0 running. - Learnocaml server v.1.0.0 starting on port 8080 Henceforth: - Learnocaml v1.0.0 running. - Learnocaml server v1.0.0 starting on port 8080
This makes it possible to fix the error: ``` Waiting for process 9 to terminate... 0 Error: process didn't terminate in time ``` triggered by either `--serve-during-build` or `--replace` CLI options.
907b425
to
cc6caa3
Compare
Very good point, thanks! I fixed it as suggested. Thanks again for your advice and help! |
Kind: feature
Close Feature: new option à la
--replace
to leverage this existing feature in adocker restart
context #594Description
Good news, @AltGr @yurug !
I was able (with Louis' advice from last week) to implement #594.
Regarding the naming of the CLI command, I now propose
--serve-during-build
(better than my initial try,--fork-replace
)Each commit comes with a detailed description (or motivation), in particular note that:
--replace
PR) due to the fact alpine's defaultlsof
supports no option; unlike thelsof
package;Learnocaml_server.kill_running
;Learnocaml v1.1.0 running
instead ofLearnocaml v.1.1.0 running
, which was making less sense given our current git tag convention).I thoroughly tested the new option as summarized in the message of the main commit f0108a3
but as suggested by @AltGr, I didn't turn the option on by default in the Dockerfile.
Regarding performance, I ran an experiment on learn-ocaml-corpus endowed with the following docker-compose.yml:
docker-compose.yml
along with the following script:
shell session
And I got:
So I believe the effort was worth it for this quite standard use case :)
Now, let's wait for the CI ! and let me know if you have review comments.
And last hint: we shouldn't squash-merge this PR but rather do a regular merge (to preserve the atomic commits).
Checklist
Note to maintainers
Close #…
if a related issue exists.