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└── .dockerignoreCreating the Dockerfile
FROM farmos/farmos:3.x
# Set environment variablesENV FARMOS_DB_HOST=${DB_HOST}ENV FARMOS_DB_PORT=5432ENV FARMOS_DB_NAME=${DB_NAME}ENV FARMOS_DB_USER=${DB_USER}ENV FARMOS_DB_PASS=${DB_PASS}
# Create directories for filesRUN mkdir -p /opt/drupal/web/sites/default/files \ && mkdir -p /opt/drupal/private
# Set permissionsRUN chown -R www-data:www-data /opt/drupal/web/sites/default/files \ && chown -R www-data:www-data /opt/drupal/private
# Expose web portEXPOSE 80
# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD curl -f http://localhost/user/login || exit 1Environment Variables Reference
| Variable | Required | Description |
|---|---|---|
DB_HOST | Yes | PostgreSQL database host |
DB_PORT | No | Database port (default: 5432) |
DB_NAME | Yes | Database name |
DB_USER | Yes | Database username |
DB_PASS | Yes | Database password |
HASH_SALT | Yes | Drupal hash salt for security |
TRUSTED_HOST | No | Trusted host pattern for security |
Deploying farmOS on Klutch.sh
- Create a PostgreSQL database app on Klutch.sh or use an external provider
- Enable the PostGIS extension
- Note the connection details for configuration
- Select HTTP as the traffic type
- Set the internal port to 80
- Select language
- Choose installation profile (farmOS)
- Verify database settings
- Create admin account
- Configure site settings
Set Up PostgreSQL Database
farmOS requires PostgreSQL with PostGIS extension. Deploy a PostgreSQL database first:
Generate Security Keys
Create a secure hash salt:
openssl rand -hex 64Push 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:
Set Environment Variables
| Variable | Value |
|---|---|
DB_HOST | Your PostgreSQL host |
DB_NAME | farmos |
DB_USER | Your database user |
DB_PASS | Your database password |
HASH_SALT | Your generated hash salt |
TRUSTED_HOST | your-app.klutch.sh |
Attach Persistent Volumes
| Mount Path | Size | Purpose |
|---|---|---|
/opt/drupal/web/sites/default/files | 10 GB | Uploaded files and images |
/opt/drupal/private | 5 GB | Private files |
Deploy Your Application
Click Deploy to build and launch farmOS.
Complete Installation
Access your farmOS URL and complete the Drupal installation wizard:
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
- Navigate to Farm Settings
- Add your farm name and location
- Configure measurement units (metric/imperial)
- Set up seasons and growing zones
Mapping Your Farm
- Go to the Maps page
- Use the drawing tools to outline fields
- Add markers for important locations
- 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:
- Select the log type
- Choose the date and time
- Associate with relevant assets
- Add notes and photos
- Record quantities and units
- 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
- farmOS Official Website
- farmOS User Guide
- farmOS GitHub Repository
- farmOS Community Forum
- Developer Documentation
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.