-
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
Fix static deployment #356
Conversation
Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
This changes the type of the token of `Exercise_index' from `token' to `token option' so it can be used without a dynamic server. Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
This changes the type of the token of `Exercise' from `token' to `token option' so it can be used without a dynamic server. Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
If learn-ocaml is deployed statically, the URL of the editor should be exercise.html, and the URL of the playground must be playground.html. But when deployed with the server, it can use the clean URL. To detect it, we check the token: if it does not exists, it means the application is deployed without server. Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
When learn-ocaml is statically deployed, the buttons related to the token cannot really be used. Disable them when they are created, then enable them once the token is validated. As `sync_button_state' is unused and not fit for this purpose, it is replaced by a button group, `sync_button_group'. The buttons are associated to this group when they are created. Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
The client needs the metadata of an exercise. The server adds it dynamically, but in a static scenario, it must be present in the file in the first place. Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
The fail is the macos CI that failed to download some opam packages… |
This enables learn-ocaml-client to interact with a static instance of learn-ocaml by allowing to store no token in the configuration file. The unused function `init' is also removed. Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
I added another patch to fix |
cb12bd3
to
277548a
Compare
Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
3213b11
to
22f7f8f
Compare
Hi @yurug, I've quickly proofread @agrn's PR #356 and it looks very fine. However, I'd suggest you'd merge PR #353 beforehand because it is also ready and it will extend the CI. FYI, I've just deployed the result of this PR in a GitHub user Page here: Note that this feature of static deployment was broken at least from e0a872e, notably because of the leading "/" in the HTML/CSS/JS URLs, which was de-facto incompatible with having a With this PR, one can deploy a fully working, statically-served instance of learn-ocaml (except the server-side storage feature) incorporating some exercises from a private GitHub repository associated with a public GitHub Pages deployment. It basically suffices to run: $ learn-ocaml build --root "https://pfitaxel.github.io/pfitaxel-demo-dev" --repo=demo-repository (cf. this example deployment script (that should be rewritten to rely on Docker though)) |
367cc57
to
15bad51
Compare
Signed-off-by: Alban Gruin <alban.gruin@univ-tlse3.fr>
Note that it adds a dependency to |
@yurug CI is green now, although it seems the automatic PR status feedback from Travis → GitHub doesn't seem to work very well :-/ |
Thank you! |
If I understand correctly, it is now possible to deploy a learn-ocaml instance as a static website. That sounds like something that could be useful for my own teaching this semester. Is this static deployment mode documented in In the meantime, I'm going to experiment with @erikmd's documentation in the comment above ( #356 (comment) ). Note: last year I tried to deploy several learn-ocaml instances on the same server, using different base URLs. I sent a couple preliminary PRs, but never managed to finish the work (a lot of URLs in various places had to be fixed, etc.). If I understand correctly, doing this is possible with static deployment; this could be very helpful for me. |
Hi @gasche
just FYI the
to generate the Anyway, it's true we'll need to document further that feature before next learn-ocaml release! - I'll try to open a pull request. |
@erikmd reported in #288 that it was no longer possible to deploy learn-ocaml statically. This series fix this by checking the version of the server in the front-end. If the application is deployed statically, there is no
/version
endpoint, so the front-end will know if it needs to ask the user for a token or not.The API is also modified so some endpoints can take an optional token, but the server itself will forbid any requests without a token. There are also some modifications in the repository generation process.
This does not yet address
learn-ocaml-client
, though -- it will fail when trying to talk to a static instance of learn-ocaml.