Deploying juntagrico
Introduction
juntagrico is a comprehensive, open-source management platform designed specifically for community-supported agriculture (CSA) cooperatives. Built with Django, it provides tools for managing members, subscriptions, work assignments, delivery locations, and financial operations that are essential for running a successful CSA farm.
The platform was created to address the unique challenges of CSA management, where members purchase shares of a farm’s harvest in advance and often contribute labor hours in exchange for reduced costs. juntagrico handles the complexity of subscription management, job scheduling, and member communication.
Key highlights of juntagrico:
- Member Management: Track members, shares, and subscription types
- Work Assignments: Schedule and track member labor contributions
- Subscription Handling: Manage different subscription sizes and types
- Delivery Locations: Organize pickup points and delivery schedules
- Financial Tracking: Handle payments, billing, and financial reports
- Email Integration: Built-in email system for member communication
- Multi-Language Support: Available in German, English, French, and more
- Customizable: Extensive configuration options for different CSA models
- Role-Based Access: Different permission levels for members, coordinators, and admins
- 100% Open Source: LGPL licensed with active community development
This guide walks through deploying juntagrico on Klutch.sh using Docker, configuring your CSA settings, and getting started with member management.
Why Deploy juntagrico on Klutch.sh
Deploying juntagrico on Klutch.sh provides several advantages for CSA cooperatives:
Simplified Deployment: Klutch.sh builds and deploys juntagrico without complex Django setup.
Persistent Storage: Member data, subscriptions, and configurations survive restarts.
HTTPS by Default: Secure access for members managing their accounts and payments.
GitHub Integration: Track configuration changes and automate deployments.
Scalable Resources: Handle growing membership with easy resource scaling.
Environment Variable Management: Store database credentials and email settings securely.
Custom Domains: Use your CSA’s domain for a professional member portal.
Always-On Availability: Members can access their accounts 24/7.
Prerequisites
Before deploying juntagrico on Klutch.sh, ensure you have:
- A Klutch.sh account
- A GitHub account with a repository for your configuration
- Basic familiarity with Docker and Django applications
- Email service credentials for member communication
- (Optional) A custom domain for your CSA portal
Understanding juntagrico Architecture
juntagrico is built on Django with the following components:
Django Framework: The web application framework providing MVC structure, ORM, and admin interface.
PostgreSQL Database: Stores all member, subscription, and operational data.
Static Files: CSS, JavaScript, and images served through Django or a CDN.
Email Backend: Sends notifications, job reminders, and member communications.
Template System: Customizable HTML templates for the member portal.
Preparing Your Repository
Create a GitHub repository for your juntagrico deployment.
Repository Structure
juntagrico-deploy/├── Dockerfile├── juntagrico_app/│ ├── settings.py│ ├── urls.py│ └── wsgi.py├── requirements.txt├── README.md└── .dockerignoreCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM python:3.11-slim
# Set environment variablesENV PYTHONDONTWRITEBYTECODE=1ENV PYTHONUNBUFFERED=1ENV DJANGO_SETTINGS_MODULE=juntagrico_app.settings
# Install system dependenciesRUN apt-get update && apt-get install -y \ libpq-dev \ gcc \ && rm -rf /var/lib/apt/lists/*
# Create app directoryWORKDIR /app
# Install Python dependenciesCOPY requirements.txt .RUN pip install --no-cache-dir -r requirements.txt
# Copy application codeCOPY . .
# Collect static filesRUN python manage.py collectstatic --noinput || true
# Expose the application portEXPOSE 8000
# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/')" || exit 1
# Run the applicationCMD ["gunicorn", "--bind", "0.0.0.0:8000", "juntagrico_app.wsgi:application"]Creating requirements.txt
juntagrico>=1.6.0gunicorn>=21.0.0psycopg2-binary>=2.9.0dj-database-url>=2.0.0whitenoise>=6.0.0Creating Django Settings
Create juntagrico_app/settings.py:
import osimport dj_database_urlfrom juntagrico.util.settings import *
# Basic Django settingsSECRET_KEY = os.environ.get('SECRET_KEY', 'change-me-in-production')DEBUG = os.environ.get('DEBUG', 'False').lower() == 'true'ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '*').split(',')
# Database configurationDATABASES = { 'default': dj_database_url.config( default=os.environ.get('DATABASE_URL', 'sqlite:///db.sqlite3') )}
# Static files with WhiteNoiseSTATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'MIDDLEWARE.insert(1, 'whitenoise.middleware.WhiteNoiseMiddleware')
# Email configurationEMAIL_HOST = os.environ.get('EMAIL_HOST', 'localhost')EMAIL_PORT = int(os.environ.get('EMAIL_PORT', 587))EMAIL_USE_TLS = os.environ.get('EMAIL_USE_TLS', 'True').lower() == 'true'EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER', '')EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD', '')DEFAULT_FROM_EMAIL = os.environ.get('DEFAULT_FROM_EMAIL', 'noreply@example.com')
# juntagrico settingsORGANISATION_NAME = os.environ.get('ORGANISATION_NAME', 'My CSA Farm')ORGANISATION_ADDRESS = { 'name': os.environ.get('ORG_NAME', 'My CSA Farm'), 'street': os.environ.get('ORG_STREET', '123 Farm Road'), 'city': os.environ.get('ORG_CITY', 'Farmville'), 'extra': os.environ.get('ORG_EXTRA', ''),}SHARE_PRICE = float(os.environ.get('SHARE_PRICE', '250'))CURRENCY = os.environ.get('CURRENCY', 'USD')BUSINESS_YEAR_START = {'day': 1, 'month': 1}
# Install juntagrico appINSTALLED_APPS.insert(0, 'juntagrico')Creating URL Configuration
Create juntagrico_app/urls.py:
from django.urls import path, include
urlpatterns = [ path('', include('juntagrico.urls')),]Creating WSGI Application
Create juntagrico_app/wsgi.py:
import osfrom django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'juntagrico_app.settings')application = get_wsgi_application()Environment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
SECRET_KEY | Yes | - | Django secret key for cryptographic signing |
DATABASE_URL | Yes | - | PostgreSQL connection URL |
ALLOWED_HOSTS | No | * | Comma-separated list of allowed hostnames |
DEBUG | No | False | Enable Django debug mode |
EMAIL_HOST | Yes | - | SMTP server hostname |
EMAIL_PORT | No | 587 | SMTP server port |
EMAIL_HOST_USER | Yes | - | SMTP username |
EMAIL_HOST_PASSWORD | Yes | - | SMTP password |
DEFAULT_FROM_EMAIL | Yes | - | Sender email address |
ORGANISATION_NAME | No | My CSA Farm | Your CSA’s name |
SHARE_PRICE | No | 250 | Price per share |
CURRENCY | No | USD | Currency code |
Deploying juntagrico on Klutch.sh
- Select HTTP as the traffic type
- Set the internal port to 8000
Generate a Secret Key
Create a secure Django secret key:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"Set Up PostgreSQL Database
Deploy a PostgreSQL database on Klutch.sh or use an external database service. Note the connection URL.
Push Your Repository to GitHub
Initialize and push your repository:
git initgit add .git commit -m "Initial juntagrico deployment configuration"git remote add origin https://github.com/yourusername/juntagrico-deploy.gitgit push -u origin mainCreate a New Project on Klutch.sh
Navigate to the Klutch.sh dashboard and create a new project named “juntagrico” or “csa-portal”.
Create a New App
Within your project, create a new app. Connect your GitHub account and select the repository containing your Dockerfile.
Configure HTTP Traffic
In the deployment settings:
Set Environment Variables
Add the following environment variables:
| Variable | Value |
|---|---|
SECRET_KEY | Your generated secret key |
DATABASE_URL | postgresql://user:pass@host:5432/juntagrico |
ALLOWED_HOSTS | your-app-name.klutch.sh |
EMAIL_HOST | Your SMTP server |
EMAIL_PORT | 587 |
EMAIL_HOST_USER | Your SMTP username |
EMAIL_HOST_PASSWORD | Your SMTP password |
DEFAULT_FROM_EMAIL | noreply@yourcsa.org |
ORGANISATION_NAME | Your CSA Name |
Attach Persistent Volumes
Add a volume for uploaded files:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/app/media | 5 GB | User uploads and media files |
/app/staticfiles | 1 GB | Collected static files |
Deploy Your Application
Click Deploy to start the build process.
Run Database Migrations
After deployment, run migrations to set up the database:
python manage.py migratepython manage.py createsuperuserAccess juntagrico
Once deployed, access your CSA portal at https://your-app-name.klutch.sh.
Initial Configuration
Creating an Admin Account
Access the Django admin at /admin/ and log in with your superuser credentials.
Setting Up Subscription Types
Configure the subscription offerings for your CSA:
- Go to Subscription Types
- Add subscription sizes (e.g., Small, Medium, Large)
- Set prices and share requirements
- Configure pickup frequencies
Adding Delivery Locations
Set up pickup points for members:
- Go to Depots
- Add each pickup location with address and schedule
- Assign coordinators
Creating Jobs
Define work assignments for member participation:
- Go to Jobs
- Create job types (harvesting, packing, delivery)
- Set required participants and time slots
Managing Members
Member Registration
Members can self-register through the portal:
- New members sign up with email
- They select subscription type and size
- Choose delivery location
- Agree to terms and submit payment information
Assigning Shares
Admins can manage member subscriptions:
- View member profiles
- Adjust subscription sizes
- Manage payment status
- Track work hour contributions
Customization
Branding
Customize the portal appearance:
- Override templates in your repository
- Add custom CSS for your CSA’s branding
- Upload logo and images
Email Templates
Customize notification emails:
- Welcome messages
- Job reminders
- Payment notifications
Troubleshooting
Migration Errors
- Ensure database credentials are correct
- Check for conflicting migrations
- Run
python manage.py migrate --run-syncdb
Email Not Sending
- Verify SMTP credentials
- Check email service limits
- Review Django email logs
Static Files Missing
- Run
collectstaticcommand - Check WhiteNoise configuration
- Verify static file URLs
Additional Resources
- juntagrico Official Website
- juntagrico GitHub Repository
- juntagrico Documentation
- juntagrico Demo Instance
- Klutch.sh Persistent Volumes
- Klutch.sh Deployments
Conclusion
Deploying juntagrico on Klutch.sh gives your CSA cooperative a professional, reliable platform for managing members, subscriptions, and farm operations. With persistent storage for member data and secure HTTPS access, you can focus on growing food and building community rather than managing IT infrastructure.
Whether you’re running a small neighborhood farm share or a large regional CSA, juntagrico on Klutch.sh provides the tools you need for successful community-supported agriculture.