< 162021-05-17⋎18 >

farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Feature requests and bug reports: github.com/farmOS/farmOS/issuesSet by ChanServ on 2018-08-16 at 14:32
02:34*kta[m] has joined
16:19*wgardiner[m] has joined
16:36ssoyrnoz[m]I have been using farmOS for a couple months now on a virtual machine and I have a database loaded with all my livestock info. I just got an always-on comp set up that I want to move my farmOS stuff to. I'm using Docker to contain the farmOS on the VM, is there an easy way to pack up the docker, and drop it on the new machine with all my database additions intact? Thank you.
16:39mstenta[m]Hi ssoyrnoz - Yes! You basically just need to take a database dump from the old one and import it into the new one.
16:39mstenta[m]Have you uploaded any files? (Photos etc?)
16:40ssoyrnoz[m]I think one pic just to test it out.
16:40mstenta[m]OK, well if you're OK losing that, it will make things easier.
16:41ssoyrnoz[m]Yeah, I don't have any files in the DB that can't be replaced easily.
16:42ssoyrnoz[m]I do have a couple customizations to farmOS via the drupal admin page and also user made modules. Again, nothing I can't replicate but would be nice if I could move them over too, but not necessary
16:43mstenta[m]Well just to be safe, can you find the asset/log that you uploaded that test file to, edit it, and delete the file from it? That will ensure that there are no missing files referenced later on (which might interrupt your eventual migration to farmOS 2.x)
16:43ssoyrnoz[m]Yea, that is easy enough
16:43mstenta[m]If you've made changes through the UI, those will be stored in the database, so they will come over with the database basckup
16:43ssoyrnoz[m]Nice
16:43mstenta[m]If you've made changes to code, you will need to move/replicate those separately
16:44mstenta[m]Are you familiar with how to dump and import a MariaDB/MySQL database?
16:44ssoyrnoz[m]Nothing code based yet, I wish I had more time to do a few changes but alas life gets in the way. I can't say I am familiar with that process.
16:46mstenta[m]Ok, I might not be able to walk you through it myself today... but basically you need to run `mysqldump [options] > database.sql` on the old server, then move that `database.sql` to the new server and run `mysql [options] < database.sql`
16:47mstenta[m]There are other ways to do it, like with PHPMyAdmin
16:47mstenta[m]But that's the basic idea
16:47mstenta[m]Before you do that, you should install farmOS on the new server
16:47ssoyrnoz[m]I'm assuming those are linux terminal commands, and the [options] part I can google easily enough?
16:47mstenta[m]and then you'll just drop that new database entirely, recreate it as a blank db, then import
16:48mstenta[m]that will ensure that your new server's `settings.php` is set up and has the new database credentials
16:48mstenta[m]Yep!
16:48mstenta[m]are you running mysql/mariadb in docker too?
16:48ssoyrnoz[m]K, I'll give it a shot. Can I use the same dump command as a method to backup/archive my DB?
16:49ssoyrnoz[m]I'm using basically the docker container you provided instructions on how to install and build.
16:49ssoyrnoz[m]farmOS 1.7x?
16:51mstenta[m]Yep! Same dump command works for backups
16:51mstenta[m]Ok, this one? github.com/farmOS/farmOS/blob/7.x-1.x/do
16:53mstenta[m]If that's the one you're using, then you'll also want to run `[myfarmOS-url]/update.php` after you import the database dump - because there's a good chance that you'll be updating to a newer version at the same time
16:53mstenta[m](that development docker image is not pinned to a specific version, FYI)
16:53ssoyrnoz[m]Yeah, I am behind a bit on my farmOS version. I used the instructions found at farmos.org/hosting/docker/
16:54mstenta[m]Oh OK... can you copy and paste your `docker-compose.yml` file? that will tell me all i need to know
16:54ssoyrnoz[m]Sure, sec
16:54* < matrix.org/_matrix/media/r0/download/mat >
16:55mstenta[m]ok cool thanks
16:56mstenta[m]can you run `sudo docker ps`?
16:57ssoyrnoz[m]CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
16:57ssoyrnoz[m]0ee27ccae187 farmos/farmos:dev "docker-entrypoint.s…" 5 weeks ago Up 4 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp farmos_www_1
16:57ssoyrnoz[m]bd9e9bdcc9c8 mariadb:latest "docker-entrypoint.s…" 5 weeks ago Up 4 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp farmos_db_1
16:57ssoyrnoz[m]Bit messy, sorry
16:57mstenta[m]perfect! thanks!
16:57mstenta[m]one sec...
16:57mstenta[m]`sudo docker exec farmos_db_1 mysqldump -u farm --password=farm farm > database.sql`
16:58mstenta[m]try running that...
16:58mstenta[m]that *should* dump your database to a file called `database.sql`
17:00ssoyrnoz[m]File created, size is 10M, sounds like there's something in there
17:00mstenta[m]then, on your new server, after you install farmOS from scratch, you'll need to run:
17:00mstenta[m]`sudo docker exec farmos_db_1 mysql -u farm --password=farm farm -e "drop database farm; create database farm;"`
17:01mstenta[m]that will drop the new database and recreate it (leaving you will a completely blank `farm` database)
17:01mstenta[m]DO NOT run that on the old server
17:01mstenta[m]:-)
17:01ssoyrnoz[m]Heh, thanks.
17:01mstenta[m]then, move the `database.sql` file to the new server and run:
17:02mstenta[m]`cat database.sql | sudo docker exec -i farmos_db_1 mysql -u farm --password=farm farm`
17:02mstenta[m]that should import the databsae
17:03mstenta[m]then go to `[myfarmOS-url]/update.php` in your browser and click through the steps
17:03mstenta[m]then you should be all set!
17:04ssoyrnoz[m]Awesome, thank you very much for all your help
17:04mstenta[m]sure thing - no guarantees everything will work - but that's the basic idea ;-)
17:05mstenta[m]come to think of it, you may need to use `-u root` instead of `-u farm`... but give it a try first
17:05ssoyrnoz[m]Heh, yeah
17:05ssoyrnoz[m]Ok
17:06mstenta[m]and just to be clear: you shouldn't be exposing these development containers to the public...
17:06mstenta[m]because the root password is known to all :-)
17:07mstenta[m]you can change that in your `docker-compose.yml` file - and stop exposing port 3306 entirely if you do plan to make your farmOS available on a public network
17:07mstenta[m](this is why these are considered "for development only") ;-)
17:09ssoyrnoz[m]For now I plan on running it over the LAN, which is behind at least two firewalls. I might put this on a public facing page one day, but no time soon.
17:09ssoyrnoz[m]I'm no web developer so security in this context is not something I know how to handle other than throwing it behind firewalls and keeping it local only if possible.
17:10mstenta[m]cool cool that'll work! i would feel irresponsible if i didn't at least say it :-)
17:16ssoyrnoz[m]I understand, it's like using password for a password.
17:22ssoyrnoz[m]Thank you for all your help :)
20:34shane_aldrich[m]mstenta: I think I've finally got everything set up properly with GitHub, the fork, the local repository, etc. How do you recommend I approach adding in my Fungi module while working along this path? Should I place it in `/farm/modules/assets`, or create a new folder somewhere else? No rush.
20:37symbioquine[m]<mstenta[m] "`cat database.sql | sudo docker "> MariaDB has a feature for loading data on first-startup...
20:38symbioquine[m]See "Initializing a fresh instance" at hub.docker.com/_/mariadb
20:40symbioquine[m]TL;DR; Add a new volume mount `- './db-init:/docker-entrypoint-initdb.d'` and put your `database.sql` file in `./db-init/`
20:41symbioquine[m]See farmos.discourse.group/t/symbioquines-2- for an example of how I use it for my development testing.
20:46mstenta[m]shane_aldrich put your module in `sites/all/modules`
20:47mstenta[m]And whenever you need to update your version of farmOS you'll just preserve that sites folder
20:49shane_aldrich[m]That's how I was doing it before. Since I have a complete fork of farmOS 2.x, I just wanted to double-check. I did get the Material asset module created in my local repository and pushed it to my instance of farmOS under the shane_farmOS branch. Thanks!
20:49mstenta[m]Cool!
20:49shane_aldrich[m] * That's how I was doing it before. Since I have a complete fork of `farmOS 2.x`, I just wanted to double-check. I did get the Material asset module created in my local repository and pushed it to my instance of farmOS under the `shane_farmOS` branch. Thanks!
20:49mstenta[m]Yea bottom line is you just want to keep your custom module code separate from the farmOS code in profiles/farm
20:50mstenta[m](with the exception of the material asset, which is intended to be part of core pull request)
20:51shane_aldrich[m]Sweet! All I did was copy Compost and replace all instances of compost/Compost with material/Material. Nothing more than that yet.
20:54shane_aldrich[m]Another question... I see that others are using MariaDB, is that only used outside of Docker?
20:54mstenta[m]Cool! That might be all you need!
20:54mstenta[m]Have you tried installing and testing it out?
20:54mstenta[m](sorry for quick replies... Chasing kids around here)
20:55shane_aldrich[m]<mstenta[m] "Have you tried installing and te"> Just installing farmOS again now. That's what inspired the question.
20:58mstenta[m]🙌
21:22shane_aldrich[m]Installed again. However, having the Material module in `/farm/modules/asset/material` doesn't show up anywhere on the site. Just the taxonomy.
21:23mstenta[m]did you rename the files too? or just replacements in the files?
21:24mstenta[m]eg `farm_compost.info.yml` -> `farm_material.info.yml`
21:25shane_aldrich[m]All of the files were renamed as well.
21:27shane_aldrich[m]Also, it did not show up on the list of modules at the beginning of the installation process. Not sure if that's hard-coded into the install procedure or not.
21:28mstenta[m]oh yea that's hard coded
21:28mstenta[m](good point we'll need to add it there as well)
21:28mstenta[m]but it should show in /admin/modules
21:28mstenta[m](after install)
21:28shane_aldrich[m]I just checked it again, and it still isn't showing up. Is there a way to re-scan the directory for updates?
21:29mstenta[m]yea maybe need to clear cache...
21:29mstenta[m] /admin/config/development/performance
21:29mstenta[m](although i don't think you need to)
21:31shane_aldrich[m]No luck with the admin panel or `drush cr`
21:38mstenta[m]Womp. Gonna need to see the code I guess
21:39shane_aldrich[m]github.com/s33a/farmOS/tree/shane_farmOS
21:41mstenta[m]that all looks perfect to me (well done!)
21:41mstenta[m]strange that it isn't showing up
21:41mstenta[m]100% sure that your branch is checked out? maybe it got revered to 2.x branch somehow?
21:42shane_aldrich[m]Aww, shucks! That was super easy!
21:42*uploaded an image: (11KiB) < matrix.org/_matrix/media/r0/download/mat >
21:46shane_aldrich[m]What if I switch from Docker moving forward? It was easy to set up, but now I'm thinking about building my stack in WSL2/Ubuntu. If I was to go that route, what would be the preferred stack with versions?
21:49mstenta[m]sorry gotta run - time for dinner
21:49shane_aldrich[m]No worries! Fill that belly! 🍔
21:49mstenta[m]i might try to join the dev call on thursday - maybe we can take a look then!
21:50mstenta[m]if you don't figure it out before!
21:50shane_aldrich[m]Yeah, I'll be on the call. But I hope to have it fixed first.
21:50mstenta[m]i think i'll need to see your screen to debug better
21:50mstenta[m]cool! good luck! if i have any ideas i'll ping you here
21:51mstenta[m]oh what happens if you do `drush en farm_material`?
21:56shane_aldrich[m]That says "already enabled", but doesn't show up in the interface. Hmmm
21:56mstenta[m]oh DOH! i forgot... oh this is embarassing...
21:56mstenta[m]we already have a module called `farm_material` lol
21:56mstenta[m](for the taxonomy)
21:57shane_aldrich[m]Doh! 😂
21:57mstenta[m]so we'll need to figure out how best to merge them - but for now just try renaming `farm_material.info.yml` to `farm_material_asset.info.yml`
21:57mstenta[m]then `drush en farm_material_asset`
22:01shane_aldrich[m]Doesn't work that way due to both PHP files being named the same "Material.php". I'll change the name of the new file to "MaterialAsset.php" and see what happens.
22:01mstenta[m]oh you have to update the `namespace`
22:01mstenta[m]but the class name and file name won't matter
22:03shane_aldrich[m]`namespace` and `class` had to be updated
22:06shane_aldrich[m]It shows up now. But trying to add a `Material Asset` results in "Page Not Found"
22:10mstenta[m]Try drush cr
22:10mstenta[m](really shouldn't need to change class name)
22:10mstenta[m](that's what the namespace is for)
22:11shane_aldrich[m]I did that and got an error. I'm about to start from scratch again. Only after I see if I can move away from Docker with a stack using this:
22:11shane_aldrich[m]www.drupal.org/docs/develop/local-server
22:12shane_aldrich[m]My inner geek is coming out strong! 🤣
23:06mstenta[m]scratch the itch! :-)
23:07shane_aldrich[m]🐕️ Listening in on a Mycology Clubhouse chat while I configure my new stack from scratch 😉

< 162021-05-17⋏18 >