Skip to content
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 cli script to install webservice, user and role. #15

Merged

Conversation

melanietreitinger
Copy link
Contributor

CLI script to install the webservice - including user and role - automatically.

@ngandrass
Copy link
Owner

That's a great contribution! Thanks a lot for your work 🎉

I think it would be a good idea to extend this CLI script to also set the corresponding configuration options within the quiz_archiver plugin. This way we should be able to reduce the setup steps significantly. Maybe we could even extend this further by creating an "Autoconfigure" button on the plugins settings page.

Without wanting to unnecessarily delay this, I'd still would like to do all these changes in a single coordinated move. This saves us a lot of README back and forth, and should confuse users a little less. I'll look into this the next days and keep you posted 😃

@ngandrass ngandrass changed the base branch from master to develop March 5, 2024 09:28
@ngandrass ngandrass self-assigned this Mar 5, 2024
@ngandrass ngandrass self-requested a review March 5, 2024 09:28
@ngandrass ngandrass added the enhancement New feature or request label Mar 5, 2024
@ngandrass
Copy link
Owner

I made some adjustments to the script and added automatic configuration of the quiz archiver plugin settings for the webservice and the user. See added commits for more details :)

Next up is the integration into the Moodle Plugin itself. It would probably be good to add an "Autoconfigure"-Button to the settings page, that is disabled once webservice settings are entered.

@melanietreitinger
Copy link
Contributor Author

Thansk a lot for refining this script, that looks great and is very inspiring!
I'm looking forward to the button - although you will have to change the script from CLI to "normal". 🙃

@ngandrass
Copy link
Owner

[...] although you will have to change the script from CLI to "normal". 🙃

I just started to move the whole setup functionality into a local class of the plugin. From here on I'll add proper permission checks so that only site admins can execute it. I'll keep the CLI script available but simply rely on the implementation within the local plugin class.

This way we get the best of both worlds: Simpler configuration using the Moodle GUI and support for automatic configuration, e.g., within CI jobs 👍

@ngandrass
Copy link
Owner

I now successfully moved all routines into an autoinstall local class and prepared for integration into the plugin settings page.

Currently outstanding tasks:

  • Finally integrate into plugin settings page
  • Check if we can display an autoinstall button on plugin install (I think h5p is doing something similar)
  • Update installation instructions in the README
  • Additional testing (CLI based autoinstall is already tested 👍 )

@ngandrass
Copy link
Owner

Quick update: I created a basic form (not yet pretty 😅) that allows to trigger the automatic installation from the plugins page within the admin UI. This still needs some more work, but technically works.

I'll have to get some other tasks done and will come back to finish this after the upcoming Moodle conference in Leipzig :)

Here are some screenshots of how it looks now:

CLI:
image
image

Moodle Admin UI:
image
image
image
image

@ngandrass
Copy link
Owner

We are getting there. I completed all open tasks, updated the README file and created unit tests for the auto-config routines.

Are you able to test, if the current version of this feature works for you? If so, I'd like to finally merge it 👍

@melanietreitinger
Copy link
Contributor Author

Very cool - I hope we can test this next week. 👍

@ngandrass
Copy link
Owner

Just two small notes:

  • All the logic now resides inside classes/local/autoinstall.php, while the Moodle admin UI and CLI script are basically just "frontends" to the library function and (should) behave identical.
  • As I was writing the README I noticed, that the worker service URL was basically the only thing missing to have a full "one click" install and hence added it to the auto configuration solution. This way we can achieve a fully operational plugin after the "one click install" 😄

@ngandrass ngandrass mentioned this pull request Mar 18, 2024
@ngandrass
Copy link
Owner

@melanietreitinger Have you been able to test the latest version of this feature?

@melanietreitinger
Copy link
Contributor Author

Hi @ngandrass!
We testet this feature - everything went well! 😍

We have some remarks regarding the displayed messages:

  1. Installation of the plugin: when the plugin is installed, there should be a hint on the admin settings overview page that there is an auto-installer and that all settings regarding the webservice can be left empty for the moment.

  2. After the autoinstaller has finished the error oder success message should be displayed more distinguished (perhaps bold).

  3. There should be a hint that the admin settings page should be reloaded (or the reload should be performed automatically) - or we don't open a new window and can simply return to the then newly configured admin settings page 🤔.

(A "bonus feature" might be the auto-detection of the docker url which then could be filled in already when starting the auto-installer. 😁)

@ngandrass
Copy link
Owner

Thanks for your suggestions! 👍

  1. IIRC there even is a possibility to display some text during the installation dialog but I do not remember on which plugin I've seen this before. I'll look around a bit :)
  2. Good idea!
  3. We could replace the "autoinstall opens in new tab" behavior with a normal redirection and include a "back to plugin config page" button. That should eliminate the need for extra instructions.

Regarding the auto-detection of docker URLs: I don't know how the plugin should determine the worker URL reliably. I could try probing some common names during installation but this will most likely not work reliably. Do you have any idea on how this could work?

@ngandrass
Copy link
Owner

I implemented suggestions 1 to 3 and prepared for release.

The autoinstall dialog is now opened within the same tab as the plugin settings page and redirects back to it, hereby eliminating the need for additional information about the required page refresh. Additionally the result is now displayed with a bold font:

Screenshot_20240409_110324

At the first installation, an info message is displayed, allowing the user to directly choose between automatic installation of manual configuration (via the plugin settings page):

Screenshot_20240409_120407

I'll finalize this now and create a new release. Thanks a lot for your work and active collaboration with this PR

@ngandrass ngandrass merged commit 5737f43 into ngandrass:develop Apr 9, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants