IRC logs for #farmOS, 2021-06-22 (GMT)

2021-06-21
2021-06-23
TimeNickMessage
[20:01:38]<shane_aldrich[m]>Or is it "Configuration Rewrite"?
[20:01:43]<mstenta[m]>there's another module called "Config Update UI" or something like that
[20:02:00]<mstenta[m]>which provides a whole bunch of UI features for comparing/diffing/reverting config
[20:02:35]<shane_aldrich[m]>I typed "config" into the filter, and I don't see that one available.
[20:03:12]<mstenta[m]>ah it's "Configuration Update Reports" :-)
[20:03:39]<shane_aldrich[m]>OK. That one is there. Let me try it out really quick...
[20:05:25]<mstenta[m]>With that installed, go to /admin/config/development/configuration/report/type/system.all
[20:05:40]<mstenta[m]>that will show you a full comparison of all config...
[20:05:47]<mstenta[m]>which.... is gonna be a lot :-)
[20:06:03]<mstenta[m]>but if you know what you're looking for (eg: `taxonomy`) just search for that and you should fine it
[20:06:12]<mstenta[m]>find*
[20:06:28]<mstenta[m]>it will probably be under "missing config"
[20:07:11]<mstenta[m]>which shows all config that is defined by modules but is NOT created (so if your taxonomy was deleted, this will allow you to restore it)
[20:08:18]<mstenta[m]>this all assumes that the taxonomy you're trying to recreate is already exported to config in a module though...
[20:08:29]<mstenta[m]>if it's not, then there won't be an option to restore
[20:08:53]<mstenta[m]>but you can create a YML config file and then import that pretty easily
[20:09:10]<shane_aldrich[m]>Cool. I think I found it. Let me try to move around the sit.
[20:09:13]<shane_aldrich[m]>site
[20:09:54]<shane_aldrich[m]>I got it back. Let's see what happens when I enable my module...
[20:10:00]<mstenta[m]>all the stuff in this directory: https://github.com/s33a/farm_materials/tree/main/config - defines config that will be installed with the module
[20:10:45]<mstenta[m]>so the Config Updates Report module will give you a summary of what's different between the config defined in your module vs your "installed" config
[20:11:15]<mstenta[m]>this is useful to understand when you make changes to config via the Drupal UI, and then want to "export" those changes back to your module
[20:11:41]<mstenta[m]>a lot of module development can be done simply by creating/modifying these YML config files!
[20:11:43]<shane_aldrich[m]>woo hoo! it worked! I just went to the dashboard, clicked add asset, clicked materials, and everything shows up.
[20:12:13]<shane_aldrich[m]>you should do a quick test yourself 😉
[20:12:37]<shane_aldrich[m]>gotta break away for about 10 minutes
[20:13:05]<mstenta[m]>can't wait to! finishing up something else this evening - but excited to try it out!
[20:18:20]<shane_aldrich[m]>It's really simple and only has substrates right now. I've got to head out and run some errands. Tomorrow afternoon I'll dive further in to `farm_materials` and `farm_fungi`
[20:18:43]<mstenta[m]>Awesome! ttyl
[00:25:17]* farmBOT has joined #farmos
[16:45:36]<shane_aldrich[m]>ACTION < https://libera.ems.host/_matrix/media/r0/download/libera.chat/2d3b9d9c4e... >
[16:47:29]<mstenta[m]>Oh that's actually fixed upstream!
[16:48:54]<mstenta[m]>We were patching the state machine module to fix a bug, and then they merged our patch
[16:49:11]<mstenta[m]>So the patch doesn't work anymore
[16:50:26]<shane_aldrich[m]>What's the best way for me to update my local site? Remember, I'm not using Docker. Should I create a project in PhpStorm for my farmOS installation, then do a pull request from my updated fork?
[16:51:21]<mstenta[m]>That's a good question :-)
[16:51:38]<shane_aldrich[m]>Crap. That won't work. My fork is based on Docker.
[16:51:53]<mstenta[m]>Not at my computer at the moment and distracted by toddlers
[16:52:47]<shane_aldrich[m]>I used the alpha 2 `tar.gz` to install. No rush. Let me know when you have a lollipop in their mouths. 😂
[16:53:15]<mstenta[m]>Ha! Used that trick already today
[16:53:48]<mstenta[m]>Ok so you could just download the tar all again
[16:54:01]<mstenta[m]>And avoid doing composer update
[16:57:03]<shane_aldrich[m]>That's fine by me. Installation doesn't take too long. Thanks!
[16:59:11]<mstenta[m]>Shouldn't have to reinstall as long as you keep the sites directory
[16:59:24]<mstenta[m]>https://docs.farmos.org/hosting/update.html#updating-via-packaged-releases
[17:00:44]<shane_aldrich[m]>I just went to the alpha 2 release page and it says that it was last updated 13 days ago.
[17:00:48]<mstenta[m]>But do you have any changes in the profiles/farm for?
[17:00:54]<mstenta[m]>dir*
[17:01:09]<mstenta[m]>Yep that's when we released alpha 2
[17:01:17]<shane_aldrich[m]>I don't think I made any changes there.
[17:01:26]<mstenta[m]>That will have the old version of the module and it will be patched already
[17:02:00]<shane_aldrich[m]>Ah! So you packaged the update in there?
[17:02:52]<shane_aldrich[m]>And I still have the `tar.gz` on my wsl2. No need to re-download it.
[17:04:16]<shane_aldrich[m]>Thanks for the link. One question. If I unzip that file with `-xzvf`, will it delete `sites/all`?
[17:20:24]<shane_aldrich[m]>Well, I messed something up. When I extracted the file to my directory, it put all of the files in a new `farmOS` directory inside that one. How can I unzip the file and ignore the top level `farmOS` directory so everything extracts properly?
[17:24:50]<mstenta[m]>> Ah! So you packaged the update in there?
[17:24:50]<mstenta[m]>No, the `state_machine` update happened after we released alpha2... but alpha2 includes the old version of `state_machine` with the old patch - so it will work as intended.
[17:25:06]<mstenta[m]>When alpha3 is released, it will include the new version of `state_machine`
[17:25:23]<mstenta[m]>But that's all fine for your purposes - won't make any difference
[17:25:42]<mstenta[m]>> Thanks for the link. One question. If I unzip that file with `-xzvf`, will it delete `sites/all`?
[17:25:42]<mstenta[m]>Yes most likely it will
[17:26:30]<mstenta[m]>> it put all of the files in a new farmOS directory inside that one
[17:26:30]<mstenta[m]>Ok, so go ahead and delete that
[17:27:06]<mstenta[m]>Then probably easiest thing to do is just move your `sites` directory OUT of the webroot, delete everything (**assuming you don't have anything else you want to save**) and unpack the tarball into the correct place... then delete the new `sites` dir and replace it with your old one
[17:27:28]<mstenta[m]>(Lots of ways to achieve the same thing, but that's probably most sure fire)
[17:28:09]<shane_aldrich[m]>I figured it out. Here is what I used to accomplish removing the `farmOS` directory: `sudo tar -xzvf farmOS-2.0.0-alpha2.tar.gz -C /var/www/shane-farmos.edu/ --strip 1`
[17:28:09]<mstenta[m]>are you using command line to do this? or your operating system's UI?
[17:28:32]<mstenta[m]>oh ok great! haven't used the --strip option before
[17:28:40]<mstenta[m]>did you save your sites dir?
[17:28:46]<shane_aldrich[m]>command line. windows UI doesn't play nice with wsl files.
[17:28:59]<mstenta[m]>one thing to watch out for... described in the docs:
[17:28:59]<mstenta[m]>> Be sure to replace (not merge) all files and directories.
[17:29:48]<mstenta[m]>your tar command probably merges the files... which may not cause any issue for you in this instance... but could result in files that should be deleted remaining
[17:30:09]<mstenta[m]>that's bit others in the past
[17:30:18]<shane_aldrich[m]>I did copy `sites/all` prior to doing this. After extracting with `--strip 1` everything was replaced and left `sites/all` alone.
[17:30:19]<mstenta[m]>so when in doubt, delete all then untar :-)
[17:30:46]<shane_aldrich[m]>In that tar command what should I have used?
[17:33:10]<mstenta[m]>you can just `rm` everything in the webroot directory, then run your `tar` command to unpack the codebase
[17:34:05]<shane_aldrich[m]>it looks like everything is still working. i'll try to do the composer update again and see what happens
[17:34:05]<mstenta[m]>(actually come to think of it maybe tar would complain if the destination wasn't already empty? i forget... i always `rm` first)
[17:35:36]<mstenta[m]>WAIT! haha
[17:35:46]<mstenta[m]>no ... if you `composer update` the same thing will happen
[17:36:03]<mstenta[m]>if you're using packaged releases then you shouldn't be using `composer`
[17:36:12]<shane_aldrich[m]>what?
[17:36:58]<mstenta[m]>there are a few different ways to update farmOS... 1) docker (which you aren't using), 2) packaged releases (which you are using), 3) composer (which is not officially supported yet)
[17:37:19]<mstenta[m]>https://docs.farmos.org/hosting/update
[17:37:31]<mstenta[m]>> Update the farmOS codebase. This will depend on how you have deployed farmOS. See Updating via Docker or Updating via packaged releases below for specific instructions
[17:38:46]<mstenta[m]>I honestly have never run `composer update` with farmOS
[17:38:46]<shane_aldrich[m]>OK. So if I want to get `phpcs` `phpcbf` and `php-cs-fixer` working with PhpStorm, should I just manually edit the `composer.json` file to require `squizlabs` and `friendsofphp`?
[17:39:24]<mstenta[m]>Ah hmm... so this is where using the Docker image would help - the dev image comes with these already!
[17:39:26]<shane_aldrich[m]>Then run `Update.php`
[17:39:38]<mstenta[m]>But let's see...
[17:39:56]<shane_aldrich[m]>Damn my interest in not using Docker! 😜
[17:40:03]<mstenta[m]>Sorry... just `phpcs` actually.. I've never used `phpcbf` or `php-cs-fixer` so you're on your own with those
[17:40:45]<mstenta[m]>Alright ... we may want to take a different approach... and basically replicate what the Docker dev image is doing :-)
[17:41:25]<mstenta[m]>https://github.com/farmOS/farmOS/blob/2.x/docker/dev/Dockerfile
[17:41:42]<mstenta[m]>> Damn my interest in not using Docker! 😜
[17:41:42]<mstenta[m]>Haha well you pay the price by having to set all this up!
[17:41:45]<mstenta[m]>:-P
[17:42:11]<mstenta[m]>Notice how the Dockerfile configures phpcs: https://github.com/farmOS/farmOS/blob/a00edf93cd82f860dbbd2cf1b5c8c25cd2...
[17:42:29]<shane_aldrich[m]>I guess so! 🤣
[17:42:29]<shane_aldrich[m]>But I'm learning a lot while doing this. Linux is slowly coming back to me.
[17:42:39]<mstenta[m]>Yea! nothing wrong with that!
[17:42:54]<mstenta[m]>See my approach is: put all this in a Dockerfile and then I can forget about it lol
[17:43:13]<mstenta[m]>Hence why I need to remember all these things :-)
[17:44:56]<shane_aldrich[m]>Ha! I'm going to see what happens with adding the requirements directly in `composer.json` and then running `update.php`.
[17:44:56]<shane_aldrich[m]>Can't hurt. And I can always start fresh since my code is updated on gitHub.
[17:45:22]<mstenta[m]>So... on that note...
[17:45:35]<mstenta[m]>the `composer.json` already has what's needed
[17:46:15]<mstenta[m]>but it's in the `require-dev` section
[17:46:54]<mstenta[m]>which only gets installed if you do `composer install` without the `--no-dev` flag
[17:47:26]<mstenta[m]>> Alright ... we may want to take a different approach... and basically replicate what the Docker dev image is doing :-)
[17:47:26]<mstenta[m]>So... here's another thing to try... if you want to set up the composer approach
[17:48:03]<shane_aldrich[m]>just `nano` 'd `composer.json`, and `phpcs` isn't there. probably because I just overwrote the file and haven't updated yet?
[17:48:31]<mstenta[m]>i believe `phpcs` is pulled in via `drupal/core-dev`
[17:49:16]<shane_aldrich[m]>cool. let me get into a few things and then I'll report back.
[17:49:19]<mstenta[m]>err hmm maybe not... i'm not sure where it gets pulled in from in our dev setup actually
[17:50:12]<mstenta[m]>but yea you could just try `composer require squizlabs/php_codesniffer`
[17:50:31]<mstenta[m]>(no `composer update` necessary)
[17:50:42]<mstenta[m]>dinner time... ttyl!
[17:51:41]<mstenta[m]>ahh i think it gets pulled in via `drupal/coder`
[17:51:48]<mstenta[m]>you might want to require that instead
[17:51:56]<mstenta[m]>that has the drupal coding standards sniffs
[17:52:19]<mstenta[m]>and you'll definitely want to copy the config we have to ensure that our automated tests pass: https://github.com/farmOS/farmOS/blob/a00edf93cd82f860dbbd2cf1b5c8c25cd2...
[17:52:28]<mstenta[m]>good luck
[17:52:31]<mstenta[m]>!
[17:53:15]<shane_aldrich[m]>Most of this is just to try and get PhpStorm on windows to use the remote versions of `phpcs` on wsl
[18:17:37]<shane_aldrich[m]>Everything is still working. Turns out that I had my path to `phpcs` and `phpcbf` configured for local, ie `\\wsl$\Ubuntu-20.04\usr\bin\` instead of `/usr/bin/`
[18:19:16]<shane_aldrich[m]>Got to prep dinner. After that, I'll read through the links for the coding standards and see if I need to add the `xml` file to PhpStorm.
[18:29:29]<mstenta[m]>Cool!!
[18:46:04]<shane_aldrich[m]>Which xml files should I be looking for? I know I can add them to PhpStorm for better coding standards.
[18:47:17]<mstenta[m]>Do you mean for the phpcs config?
[18:47:35]<shane_aldrich[m]>yes. Looking for it now
[18:49:36]<mstenta[m]>You can manually create it by copying lines from our Dockerfile
[18:49:47]<mstenta[m]>(link above)
[18:49:58]<mstenta[m]>That basically just creates the file from scratch
[18:50:16]<shane_aldrich[m]>Cool. I was looking for the actual xml file. I'll just create one with that code.
[18:50:57]<mstenta[m]>Ah yea that won't be in the packaged release
[18:51:09]<mstenta[m]>The packaged release doesn't include dev dependencies
[18:52:02]<mstenta[m]>Tip: you *could* consider using Docker to *build* the dev codebase, without using Docker to run farmOS
[18:53:06]<shane_aldrich[m]>Hmmm. Interesting. I know PhpStorm has a Docker plugin. Can you give me a link to help with that?
[18:53:31]<mstenta[m]>Just by running the container with a directory mounted in... If it's empty the docker image will automatically copy the codebase into it
[18:53:55]<mstenta[m]>But maybe not worth it .. if you're getting this working
[18:54:45]<shane_aldrich[m]>You're probably right about that. I'll create the xml file manually first, then look into the Docker stuff over the next few days.
[19:02:32]<shane_aldrich[m]>Where should I save that file?
[19:09:27]<shane_aldrich[m]>And is your xml standard different that what PhpStorm provides for Drupal? GTG... time to cook. Back tomorrow. Take your time.
[19:23:35]<shane_aldrich[m]>Last message for today... Look at these warnings in PhpStorm (only `farm_materials` module project open) and let me know what you think about how to configure things properly:
[19:23:42]<shane_aldrich[m]>ACTION uploaded an image: (203KiB) < https://libera.ems.host/_matrix/media/r0/download/matrix.org/pOIJsqfIXRT... >
[19:39:50]<mstenta[m]>The file basically says: use the Drupal and DrupalPractice rulesets with a few minor exceptions
[19:40:13]<mstenta[m]>I dunno how that compares to what phpstorm supplies