| 07:26 | * | farmBOT has joined |
| 13:31 | mstenta[m] | paul121 symbioquine I'm wondering if we should remove the logic for auto-generating OAuth2 keys during `farm_api` installation, and instead provide documentation for how to set them up. The convenience of auto-generating them is nice, but there are some issues with it currently... |
| 13:32 | mstenta[m] | The reason I'm looking into this now is because I realized we don't have any documentation for setting up keysin our installation docs. |
| 13:34 | mstenta[m] | We also don't do anything in our Docker image to set them up automatically. |
| 13:34 | mstenta[m] | And I'm not sure we easily can... |
| 13:35 | mstenta[m] | The keys need to be persisted in a Docker volume. But in order to auto-generate them, that volume also needs to be writable by Apache. Once they're generated, though, it should be read only. |
| 13:36 | mstenta[m] | On Farmier, I generate keys ahead of time, and bind-mount them as read-only. So the code in farm_api's install hook detects that they already exist and doesn't attempt to create them. |
| 13:41 | mstenta[m] | If the keys directory is not mounted as a volume, then they are lost during the first farmOS upgrade. :-/ |
| 13:44 | mstenta[m] | Oh but I guess that doesn't even happen because keys doesn't exist in the first place 😅 |
| 13:45 | mstenta[m] | Another tricky thing is that keys needs to be readable by Apache, but nothing else. And the Apache user (uid 33) inside the container may have a different ID outside the container. |
| 13:47 | mstenta[m] | > remove the logic for auto-generating OAuth2 keys during `farm_api` installation, and instead provide documentation for how to set them up |
| 13:47 | mstenta[m] | I'm curious what kinds of warning/guidance (if any) `simple_oauth` shows in the UI when keys don't exist? |
| 13:49 | mstenta[m] | > We also don't do anything in our Docker image to set them up automatically. |
| 13:49 | mstenta[m] | We could create a `/opt/drupal/keys` directory in our Docker build process as a first step. Then it at least exists (for both Docker and packaged releases). And we could include a volume mount in our `docker-compose.production.yml` example. Although it would still require manual steps to make it writable before Drupal installation takes place. |
| 14:00 | symbioquine[m] | Hmmm... |
| 14:02 | symbioquine[m] | I guess we should test the different scenarios to know what the "bad things" we're trying to avoid are. |
| 14:03 | mstenta[m] | Curious what the experience has been of other folks who set up self-hosted instances |
| 14:03 | mstenta[m] | (and are using Oauth2) |
| 14:03 | mstenta[m] | They must have run into this |
| 14:03 | symbioquine[m] | I'm sure I did, I just can't remember, other than needing to configure that bind-mount. |
| 14:03 | mstenta[m] | (cc botlfarm postmanpat Farmer Ed ) |
| 14:04 | mstenta[m] | (ps this is inspired by helping riotmiked the other day...) |
| 14:05 | mstenta[m] | Yea and if you don't have keys set up and writable before installation, then you need to manually create the keys. The farm_api installation code only runs once when the module gets installed. |
| 14:05 | mstenta[m] | (Although uninstalling it and reinstalling it would trigger that again...) |
| 14:05 | mstenta[m] | But maybe it would be better for us to provide a button in the UI for doing that 🤔 |
| 14:06 | mstenta[m] | farm_api is a "default" module that is installed with farmOS, but not everyone who has it needs the API, and of that subset, not everyone needs OAuth2 connection |
| 14:07 | mstenta[m] | (for what it's worth... so adding docs for "setting up API" might be nice) |
| 14:08 | * | FarmerEd[m] has joined |
| 14:08 | FarmerEd[m] | I can't remember off the top of my head, but I'm pretty sure anytime I setup a new instance I end up going in circles with this. |
| 14:08 | * | botlfarm[m] has joined |
| 14:08 | botlfarm[m] | I believe I set up oauth2 a while ago, but have no recollection of what the process was. I also no longer use it. |
| 14:08 | FarmerEd[m] | Probably should have documented it myself by now |
| 20:09 | * | paul121[m] has joined |
| 20:09 | paul121[m] | <mstenta[m]> "The keys need to be persisted in..." <- Is there any reason it can't be left as writable by Apache? Or is it just a safety thing, to prevent it accidentally being changed in the future? |
| 20:11 | paul121[m] | it kinds sounds like this is a hosting level concern, it would be nice if we could try to auto-create when we have write permission, otherwise skip, and add a (what is it called?) a hook_module_requirements info piece? or maybe simple_oauth already does this? |
| 20:11 | mstenta[m] | Yea just best practice. But in theory we might be able to revoke write access via PHP too, after keys are written 🤔 |
| 20:12 | mstenta[m] | Yea it is a hosting level concern. It came up because I realized we don't have any documentation for it, and it does not work out of the box with our Docker or packaged releases |
| 20:12 | mstenta[m] | At the very least we need docs |
| 20:12 | mstenta[m] | But it got me thinking about whether or not we should rethink the auto generating logic |
| 20:13 | mstenta[m] | I don't think we should require keys be generated manually, but maybe we could provide a drush command or something that allows the keys to be generated after farm_api install |
| 20:14 | mstenta[m] | But also got me thinking that OAuth is technically a separate layer on top of the API that not every necessarily needs |
| 20:15 | mstenta[m] | Eg Asset Link uses the API but not OAuth (I think) |
| 20:15 | mstenta[m] | So in some cases it isn't necessary to set up keys at all |
| 20:15 | paul121[m] | True |