Skip to content

Deploying farmOS

Introduction

farmOS is a comprehensive open-source farm management system built on Drupal. It provides farmers, ranchers, and agricultural organizations with tools to record and manage all aspects of their operations, from field planning and planting to harvest tracking and equipment maintenance.

Designed by farmers for farmers, farmOS supports diverse agricultural systems including row crops, livestock, aquaculture, and permaculture. Its flexible data model allows users to track any type of asset and log any type of activity, making it adaptable to virtually any farming operation.

Key highlights of farmOS:

  • Asset Management: Track fields, animals, equipment, plants, and any other farm assets
  • Activity Logging: Record observations, inputs, harvests, and maintenance activities
  • Mapping: Built-in GIS capabilities for mapping fields and tracking asset locations
  • Planning: Create and manage farm plans with scheduled tasks
  • Reporting: Generate reports and analyze farm data over time
  • Multi-Farm Support: Manage multiple farms from a single installation
  • API Access: Full JSON:API for integration with sensors, equipment, and other systems
  • Mobile Friendly: Responsive design works in the field on any device
  • Extensible: Drupal-based architecture allows custom modules and integrations
  • Open Source: Licensed under GPLv2 with active community development

This guide walks through deploying farmOS on Klutch.sh using Docker, configuring persistent storage for your farm data, and setting up the application for production use.

Why Deploy farmOS on Klutch.sh

Deploying farmOS on Klutch.sh provides several advantages:

Field Access: Access your farm records from anywhere, even in the field with mobile data.

Persistent Storage: Your years of farm data survive container updates and remain safely stored.

HTTPS Security: Secure access to sensitive farm records and business data.

Team Access: Enable farm staff to access records without complex VPN setups.

Automatic Backups: Combine with volume backups to protect critical farm records.

Integration Hub: Use as a central point for IoT sensors and automation systems.

Prerequisites

Before deploying farmOS on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your configuration
  • Basic familiarity with Docker and Drupal
  • (Optional) A custom domain for your farmOS instance
  • (Optional) Existing farm data for import

Understanding farmOS Architecture

farmOS is built on Drupal 9/10 and consists of several components:

Drupal Core: Provides the content management framework and user interface.

farmOS Modules: Custom Drupal modules that implement farm management functionality.

PostgreSQL Database: Stores all farm data, user accounts, and configuration.

GEOS/PostGIS: Geospatial extensions for mapping and location tracking.

PHP-FPM: Processes PHP requests for the web application.

Preparing Your Repository

Create a GitHub repository with your farmOS configuration.

Repository Structure

farmos-deploy/
├── Dockerfile
├── settings.php
└── .dockerignore

Creating the Dockerfile

FROM farmos/farmos:3.x
# Set environment variables
ENV FARMOS_DB_HOST=${DB_HOST}
ENV FARMOS_DB_PORT=5432
ENV FARMOS_DB_NAME=${DB_NAME}
ENV FARMOS_DB_USER=${DB_USER}
ENV FARMOS_DB_PASS=${DB_PASS}
# Create directories for files
RUN mkdir -p /opt/drupal/web/sites/default/files \
&& mkdir -p /opt/drupal/private
# Set permissions
RUN chown -R www-data:www-data /opt/drupal/web/sites/default/files \
&& chown -R www-data:www-data /opt/drupal/private
# Expose web port
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost/user/login || exit 1

Environment Variables Reference

VariableRequiredDescription
DB_HOSTYesPostgreSQL database host
DB_PORTNoDatabase port (default: 5432)
DB_NAMEYesDatabase name
DB_USERYesDatabase username
DB_PASSYesDatabase password
HASH_SALTYesDrupal hash salt for security
TRUSTED_HOSTNoTrusted host pattern for security

Deploying farmOS on Klutch.sh

    Set Up PostgreSQL Database

    farmOS requires PostgreSQL with PostGIS extension. Deploy a PostgreSQL database first:

    1. Create a PostgreSQL database app on Klutch.sh or use an external provider
    2. Enable the PostGIS extension
    3. Note the connection details for configuration

    Generate Security Keys

    Create a secure hash salt:

    Terminal window
    openssl rand -hex 64

    Push Your Repository to GitHub

    Commit your Dockerfile and configuration to GitHub.

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project named “farmos” or “farm-management”.

    Create a New App

    Create a new app and connect your GitHub repository.

    Configure HTTP Traffic

    Set up HTTP traffic:

    • Select HTTP as the traffic type
    • Set the internal port to 80

    Set Environment Variables

    VariableValue
    DB_HOSTYour PostgreSQL host
    DB_NAMEfarmos
    DB_USERYour database user
    DB_PASSYour database password
    HASH_SALTYour generated hash salt
    TRUSTED_HOSTyour-app.klutch.sh

    Attach Persistent Volumes

    Mount PathSizePurpose
    /opt/drupal/web/sites/default/files10 GBUploaded files and images
    /opt/drupal/private5 GBPrivate files

    Deploy Your Application

    Click Deploy to build and launch farmOS.

    Complete Installation

    Access your farmOS URL and complete the Drupal installation wizard:

    1. Select language
    2. Choose installation profile (farmOS)
    3. Verify database settings
    4. Create admin account
    5. Configure site settings

Initial Configuration

Creating Asset Types

farmOS supports various asset types:

  • Land: Fields, pastures, forests, water bodies
  • Plant: Crops, cover crops, trees
  • Animal: Livestock, poultry, bees
  • Equipment: Tractors, implements, tools
  • Structure: Buildings, fences, infrastructure
  • Material: Seeds, feed, supplies

Setting Up Your Farm

  1. Navigate to Farm Settings
  2. Add your farm name and location
  3. Configure measurement units (metric/imperial)
  4. Set up seasons and growing zones

Mapping Your Farm

  1. Go to the Maps page
  2. Use the drawing tools to outline fields
  3. Add markers for important locations
  4. Import KML/GeoJSON if you have existing maps

Recording Farm Activities

Log Types

farmOS supports multiple log types:

  • Activity: General farm activities
  • Observation: Weather, soil, pest observations
  • Input: Fertilizers, pesticides, amendments
  • Harvest: Crop harvests and yields
  • Maintenance: Equipment and infrastructure maintenance
  • Medical: Animal health records
  • Movement: Asset location changes

Creating Logs

For each activity:

  1. Select the log type
  2. Choose the date and time
  3. Associate with relevant assets
  4. Add notes and photos
  5. Record quantities and units
  6. Set status (pending, done)

Quick Logs

Use the quick log feature for rapid data entry in the field.

Planning Features

Creating Plans

Build farm plans to organize activities:

  • Crop rotation schedules
  • Grazing rotations
  • Planting calendars
  • Maintenance schedules

Task Management

Track upcoming tasks:

  • Assign due dates
  • Set priorities
  • Assign to team members
  • Mark completion

Sensor Integration

farmOS supports sensor data integration:

Supported Integrations:

  • Weather stations
  • Soil moisture sensors
  • Temperature monitors
  • GPS trackers
  • Water meters

API Access: Use the JSON:API to:

  • Push sensor data automatically
  • Integrate with IoT platforms
  • Connect to automation systems

Reporting and Analysis

Built-in Reports

  • Harvest summaries by crop
  • Input applications by field
  • Animal health history
  • Equipment usage logs

Data Export

Export data for external analysis:

  • CSV export for spreadsheets
  • JSON:API for custom applications
  • Integration with analytics tools

Multi-User Setup

User Roles

  • Manager: Full access to all features
  • Worker: Limited access for field staff
  • Viewer: Read-only access for stakeholders

Team Permissions

Configure granular permissions for:

  • Asset types
  • Log types
  • Location access
  • Report generation

Troubleshooting

Installation Issues

  • Verify database connection and PostGIS extension
  • Check file permissions on volumes
  • Review PHP error logs

Mapping Not Working

  • Ensure GEOS extension is enabled
  • Check browser geolocation permissions
  • Verify PostGIS installation

Slow Performance

  • Optimize database queries
  • Increase PHP memory limit
  • Enable caching

Additional Resources

Conclusion

Deploying farmOS on Klutch.sh provides a robust platform for agricultural record-keeping and farm management. Whether you are managing a small market garden or a large diversified operation, farmOS offers the flexibility to track what matters to your farm while keeping your data private and accessible from anywhere.

The combination of farmOS’s comprehensive features and Klutch.sh’s reliable hosting creates an ideal solution for modern farm management.