User Tools

Site Tools


eolab:ioa:offline_farmos:installing_farmos

Installing FarmOS

“farmOS is a web-based application for farm management, planning, and record keeping. It is developed by a community of farmers, developers, researchers, and organizations with the aim of providing a standard platform for agricultural data collection and management.” (farmos.org, 2022)

So I have one good news and one bad news for you. Fortunately, FarmOS can be run inside a Docker container. Unfortunately by the time of writing this guide, there is no prebuild container for running FarmOS on the Raspberry Pi. The Raspberry Pi´s CPU has a completely different architecture than your normal PC does. But no worries, it is pretty easy to let it run on our small Pi. Docker normally pulls a so-called image (a building plan for a container) from a hub called Docker Hub. But the software needs to be made available for all the different CPU architectures out there. FarmOS is only available for normal PCs by default (amd64). But the main developers of FarmOS made it easy to build it for your specific architecture.

First, we will download the software from GitHub (FarmOS on GitHub), and then we are going to build it for our Raspberry Pi.

pi@ioa-webserver:~ $ sudo apt install git
pi@ioa-webserver:~ $ mkdir git
pi@ioa-webserver:~ $ cd git
pi@ioa-webserver:~/git $ git clone -b 2.x https://github.com/farmOS/farmOS.git
pi@ioa-webserver:~/git $ cd farmOS/docker
pi@ioa-webserver:~/git $ sudo docker build -t farmos .

We now have everything set to start our FarmOS instance. Now we need to configure how we want to run our instance. Because we also need a separate database for running FarmOS, we will use Docker Compose. With Docker Compose we can define all our wanted services in one file and be able to start and stop them easily.

pi@ioa-webserver:~/git $ cd /home/pi
pi@ioa-webserver:~ $ mkdir farmOS
pi@ioa-webserver:~ $ cd farmOS
pi@ioa-webserver:~/farmOS $ nano docker-compose.yml

With nano you can now create and edit the configuration file. Nano is a text-editor.

docker-compose.yml
version: '3'
services:
  db:
    image: postgres:12
    volumes:
      - './db:/var/lib/postgresql/data'
    ports:
      - '5432:5432'
    environment:
      POSTGRES_USER: farm
      POSTGRES_PASSWORD: farm
      POSTGRES_DB: farm
 
  www:
    depends_on:
      - db
    image: farmos:latest
    volumes:
      - './www:/opt/drupal'
    ports:
      - '8080:80'

You are already seeing some of Dockers magic. with “ports” we can define on which port we want our service to be available. Normally farmOS runs on port 80. But with Docker we can just select any port we want. I choose 8080.

You can leave and save the file in nano by hitting Ctrl+X and select yes by hitting “y”. We can now test our configuration.

pi@ioa-webserver:~/farmOS $ docker compose up -d

You should now be able to go to your own instance of FarmOS by going to your favorite browser and going to the webpage http://ioa-webserver.local:8080. Make sure you are in the same network as your Pi. “ioa-webserver” is the hostname we defined during the operating system installation.

eolab/ioa/offline_farmos/installing_farmos.txt · Last modified: 2022/09/28 17:06 by jan001