< 212021-06-22⋎23 >

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

< 212021-06-22⋏23 >