# Eggs module installation/development

**URL:** <https://farmos.discourse.group/t/eggs-module-installation-development/645>\
**Category:** Development\
**Created:** [January 30, 2021, 11:37am UTC](https://farmos.discourse.group/t/eggs-module-installation-development/645 "2021-01-30T11:37:01Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![raleonardo](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/raleonardo/32/329_2.png) [@raleonardo](https://farmos.discourse.group/u/raleonardo)\
**Post date:** [January 30, 2021, 11:37am UTC](https://farmos.discourse.group/t/eggs-module-installation-development/645/1 "2021-01-30T11:37:01Z")

</div>

Hello,

I’m running a local development instance in docker and I wonder how to enable/install the eggs module.

Is there a direct button/menu from somewhere to the quickforms (I reached it directly on the url /farm/eggs instead). There I can see checkboxes for other modules (milk, planting, move animals etc) but not for eggs.  
I also checked the installed modules in the configurations but  
How to enable it?

Also I’m thinking about customizing the eggs module, as the european/german regulation needs us to count classes and sizes of eggs, ex:  
Class A:  
Size S:   
…  
Size XL:   
Class B:   
Class C:

Whats the best way to develop a module locally, and then what entails on making it into a deployment?

---

<div class="post-metadata">

**Author:** ![raleonardo](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/raleonardo/32/329_2.png) [@raleonardo](https://farmos.discourse.group/u/raleonardo)\
**Post date:** [January 30, 2021, 12:32pm UTC](https://farmos.discourse.group/t/eggs-module-installation-development/645/2 "2021-01-30T12:32:56Z")

</div>

OK I got one part:

I git cloned [git@github.com](mailto:git@github.com):farmOS/farm\_eggs.git  
into www/sites/all/modules/custom  
then went into the admin/modules and enabled:

- Farm Eggs
- Farm Asset Property

Now I’ll look in ways how to change the module.  
Any documentation/tutorials on drupal modules you might recommend?

What is the workflow for updating the module and deployit into the local instance?  
drusc cc all and install the module again, for example? or is there a more expedited way?

Thanks!

---

<div class="post-metadata">

**Author:** ![raleonardo](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/raleonardo/32/329_2.png) [@raleonardo](https://farmos.discourse.group/u/raleonardo)\
**Post date:** [January 31, 2021, 12:38am UTC](https://farmos.discourse.group/t/eggs-module-installation-development/645/3 "2021-01-31T00:38:48Z")

</div>

I figured it out.  
First draft in [GitHub - raleonardo/farm\_eggs: Provides a simple UI for creating egg harvest logs.](https://github.com/raleonardo/farm_eggs) if someone wants to use

---

<div class="post-metadata">

**Author:** ![Symbioquine](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/symbioquine/32/284_2.png) [@Symbioquine](https://farmos.discourse.group/u/Symbioquine)\
**Post date:** [January 31, 2021, 6:02am UTC](https://farmos.discourse.group/t/eggs-module-installation-development/645/4 "2021-01-31T06:02:21Z")

</div>

You might find the development flow I’ve created for farmOS\_wfs interesting. See [GitHub - symbioquine/farmOS\_wfs at 7.x-1.x](https://github.com/symbioquine/farmOS_wfs/tree/7.x-1.x#development-environment)

Basically, it’s a `docker-compose.yml` file which bind mounts and installs the module on startup. This allows for a fully automated and disposable development environment where live editing of the module is mostly possible - though some cases will require a cache clear or disable/enable cycle where DB changes are involved on installation.

---

<div class="post-metadata">

**Author:** ![raleonardo](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/raleonardo/32/329_2.png) [@raleonardo](https://farmos.discourse.group/u/raleonardo)\
**Post date:** [February 8, 2021, 5:32pm UTC](https://farmos.discourse.group/t/eggs-module-installation-development/645/5 "2021-02-08T17:32:12Z")

</div>

Thanks @Symbioquine, it looks interesting.

as the whole /var/www/html dir was mapped in my docker-compose.yml, I cloned the farm\_eggs module in sites/all/modules/custom subdir and seems to work.

Sometimes takes a while for the changes to take effect, i think regardless of running a “docker run drush cc all” (is this the right way to clear the cache?)

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [February 8, 2021, 7:33pm UTC](https://farmos.discourse.group/t/eggs-module-installation-development/645/6 "2021-02-08T19:33:24Z")

</div>

> I cloned the farm\_eggs module in sites/all/modules/custom subdir and seems to work.

That’s a good place for it. 👍

> Sometimes takes a while for the changes to take effect, i think regardless of running a “docker run drush cc all” (is this the right way to clear the cache?)

Yep! That will clear the cache!

There are some other considerations you may be running into though…

`drush cc menu` will rebuild the `{menu_router}` database table - which does not happen on `drush cc` itself. This is only necessary if changes are being made to `hook_menu()` implementations, though, so that’s probably not what you’re running into.

The other “gotcha” is that PHP’s opcode cache is enabled by default in the Docker image, which means changes to files might not get picked up immediately (I think it defaults to watching for changes every 60 seconds). We fixed this in the 2.x branch but haven’t backported it to 1.x.

The workaround (as well as some other helpful hints) are available here: [Bump engine.io from 4.1.1 to 4.1.2 by dependabot[bot] · Pull Request #36 · farmOS/farmOS.org · GitHub](https://github.com/farmOS/farmOS.org/issues/36)

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [February 8, 2021, 7:35pm UTC](https://farmos.discourse.group/t/eggs-module-installation-development/645/7 "2021-02-08T19:35:21Z")

</div>

> [@mstenta](#):
>
> “docker run drush cc all”

Oh wait… that’s not right actually.

It should be either:

`docker exec -it [container-name] drush cc all`

or:

`docker-compose exec www drush cc all`

(`docker run` will start a new container, whereas `docker exec` is for executing a command inside a running container. Maybe that’s what you meant… but figured I’d clarify.) 🙂

---

<div class="post-metadata">

**Author:** ![raleonardo](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/raleonardo/32/329_2.png) [@raleonardo](https://farmos.discourse.group/u/raleonardo)\
**Post date:** [February 8, 2021, 9:40pm UTC](https://farmos.discourse.group/t/eggs-module-installation-development/645/8 "2021-02-08T21:40:31Z")

</div>

Hi Y’all

I’m trying to figure out how to relate each egg collection to an area where currently the asset (bird group) is, or manually selecting it. Is it somehow possible to implement this with the eggs quickform?

As I see in the code, farm\_quantity\_log\_create and farm\_quick\_entity\_link don’t implement any area reference.

---

<div class="post-metadata">

**Author:** ![raleonardo](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/raleonardo/32/329_2.png) [@raleonardo](https://farmos.discourse.group/u/raleonardo)\
**Post date:** [February 8, 2021, 9:42pm UTC](https://farmos.discourse.group/t/eggs-module-installation-development/645/9 "2021-02-08T21:42:35Z")

</div>

> [@](#):
>
> (`docker run` will start a new container, whereas `docker exec` is for executing a command inside a running container. Maybe that’s what you meant… but figured I’d clarify.) 🙂

Ahhh that’s right!.. Thanks!

> [@](#):
>
> The other “gotcha” is that PHP’s opcode cache is enabled by default in the Docker image, which means changes to files might not get picked up immediately (I think it defaults to watching for changes every 60 seconds). We fixed this in the 2.x branch but haven’t backported it to 1.x.

This might be what’s getting me the random times for the new code to be picked up…

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [February 9, 2021, 12:14am UTC](https://farmos.discourse.group/t/eggs-module-installation-development/645/10 "2021-02-09T00:14:19Z")

</div>

> I’m trying to figure out how to relate each egg collection to an area where currently the asset (bird group) is

In the submit function (`farm_eggs_form_submit()`), right after the log is created (via `farm_quantity_log_create()`) you could add some additional code that adds more info to the `$log` object, and then call `log_save($log)` to save those changes.

So, you could look up the location of the referenced animal assets (with `farm_movement_asset_location()`: [https://github.com/farmOS/farmOS/blob/1d687d8ae0234af1ed00c0d7be35a79fef4ebb17/modules/farm/farm\_movement/farm\_movement.location.inc#L204](https://github.com/farmOS/farmOS/blob/1d687d8ae0234af1ed00c0d7be35a79fef4ebb17/modules/farm/farm_movement/farm_movement.location.inc#L204)), and then use that to fill in the log’s `field_farm_area` reference field.

Cool idea!

> This might be what’s getting me the random times for the new code to be picked up…

FYI Here is the fix we did in 1.x for this: [https://github.com/farmOS/farmOS/blob/f3dd0d5a6153bab07c3782286e12cc55e6d77dd2/docker/dev/Dockerfile#L22](https://github.com/farmOS/farmOS/blob/f3dd0d5a6153bab07c3782286e12cc55e6d77dd2/docker/dev/Dockerfile#L22)

---

<div class="post-metadata">

**Author:** ![jubha](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@jubha](https://farmos.discourse.group/u/jubha)\
**Post date:** [September 29, 2021, 3:26pm UTC](https://farmos.discourse.group/t/eggs-module-installation-development/645/11 "2021-09-29T15:26:22Z")

</div>

Hello raleonardo and others who posted here,  
I am into poultry farm business, looking to utilise a software to manage the farm. I am researching to know if farmOS is a good fit for the farm. The thread attracted me as Ricardo seems to do something like a im looking for. Will this farrmOs fit for poultry farm business? Ricardo can i contact you? this is my email: [basstone40@gmail.com](mailto:basstone40@gmail.com)

Thank you all, and i am sorry for the noise i may have made!
