I plan to deploy farmos to kubernetes and was kind of remembering seeing a base dockerfile that I could use to build my own docker image with the modules I want where it builds the farmos installation with composer. But either I dreamt that or I’m not that good at searching now because I cant find it anywhere. DO anybody here now of any or is the best thing just borrowing the Dockerfile from the farmos github repo and try to modify it to fit my setup?
Hi @jorblad - there is some documentation on farmOS.org about how to build farmOS with Composer:
At the bottom of that page is an example Dockerfile
for building a production image with your own Composer build.
I recommend reading that entire page to learn how everything works. It’s good to understand the distinction between “farmOS” and your “composer project” which is essentially your own composer.json
that you maintain, which pulls farmos/farmos
in as a dependency, along with any other modules you want.
This is essentially the same process we use to build the “official” farmOS Docker images. We just use the “default” composer.json
from GitHub - farmOS/composer-project, which doesn’t include any additional modules.
Hope that gets you headed in the right direction!
That was probably the one I was remembering seeing, weird that I didn’t see that today
Getting farmOS running in a container is the easy part.
This might be obvious, but you’ll also need address some other details:
- Have a persistent/shared filesystem between all nodes - used for uploads and possibly CSS/JS aggregation/caching
- Automatically populate the key data,
settings.php
(and possiblysites.php
) for new nodes - including secrets which you may or may not want baked into your container image - Load balancing - table stakes for running stuff in k8s (slightly non-trivial if you’re running your own bare-metal cluster instead of using a cloud service)
- DB Hosting - could require some thought if you’re rolling your own db hosting on the same cluster
These are all general problems shared with Drupal so you should be able to find good resources/tutorials.
Yes and all that I’m still learning, the storage I will do with longhorn, populating key data I don’t know yet but will look into how to do that, loadbalancing from web entry I do with metallb and db hosting I use cloudnative-pg to simplify getting a good db setup. Yes I’m going to look for drupal guides a lot because there I’m not alone in running it in kubernetes while I don’t think there are that many running farmos in kubernetes.
Well this migration will have to pause for a while until I can get more storage for my kubernetes cluster because even though farmos don’t need that much space I was already starting to run out of space…
Since the beginning of Y2025, there has been some progress on this issue.
[pcambra] has started Farm multitenant project.based on Group module developed for Drupal.
pcambra has also started farmOS module developement for forest management:
co-maintained with “the boss” @mstenta you might also check out.
farmOS Forest.
My personal project (on of several, still in porogress) was to use Kubernetes/NGINX framework to cluster multiple farmOS instances (with or without Docker), on bare or non-bare metal cluster and shut the instance down when user signs off, and restart it when user logges in, so instance lives and occupies processor core only when needed, leaving cores for other instances to other users (other farmOS instances). Certain property (e.g. leased land from government could be leased to another farmer, or private land sold to another farmer, but could maintenain historical records in the farmOS, if import-export of all features of such plot per plot could be utilised). With central multi-tenancy this feature and managing multiple farms where plots also shift from “user to user”, e.g. for crop rotation…could be easier
About my projects I hope I will find time for proper posts soon.
Greetings
SF