This guide covers setting up a new Harvester installation for a franchise.
Prerequisites
- Raspberry Pi (3B+ or newer) with Ubuntu
- RP850A thermal printer with USB connection
- Gmail account for order forwarding
- Google Cloud project with OAuth credentials
- AWS account (SES, Lambda, DynamoDB)
- Railway account for cloud service hosting
Cloud Service Setup
1. Deploy to Railway
The cloud service deploys automatically from the main branch:
- Connect your GitHub repository to Railway
- Set the root directory to
cloud-service/ - Configure environment variables (see below)
- Railway auto-deploys on push to
main
2. Environment Variables
Configure these in the Railway dashboard:
AWS_ACCESS_KEY_ID— AWS credentials for SES and DynamoDBAWS_SECRET_ACCESS_KEY— AWS secret keyAWS_REGION—us-east-1EDGE_AGENT_SECRET— Shared secret for edge agent authenticationGOOGLE_CLIENT_ID— Google OAuth client IDGOOGLE_CLIENT_SECRET— Google OAuth client secretJWT_SECRET— Strong random key for JWT signingDASHBOARD_BASE_URL— Your Railway deployment URL
3. Google OAuth Configuration
- Create a project in Google Cloud Console
- Enable the Gmail API and Google Calendar API
- Configure the OAuth consent screen
- Create OAuth 2.0 credentials (Web application type)
- Add authorized redirect URIs pointing to your Railway URL
Edge Agent Setup
1. Install on Raspberry Pi
# Clone the repository
git clone <repo-url> /home/ubuntu/cmy-edge-agent
# Create virtual environment
cd /home/ubuntu/cmy-edge-agent
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
2. Configure Environment
Create /home/ubuntu/cmy-edge-agent/.env:
CLOUD_URL=https://your-railway-url.up.railway.app
EDGE_AGENT_SECRET=your-shared-secret
FRANCHISE_IDS=your_franchise_id
PRINTER_VENDOR=0x0fe6
PRINTER_PRODUCT=0x811e
3. Install as System Service
sudo cp cmy-edge-agent.service /etc/systemd/system/
sudo systemctl enable cmy-edge-agent
sudo systemctl start cmy-edge-agent
4. Verify Connection
Check that the edge agent connects to the cloud service:
sudo systemctl status cmy-edge-agent
tail -20 /home/ubuntu/cmy-edge-agent/edge_agent.log
Email Forwarding Setup
1. Configure AWS SES
- Verify the franchise email domain in SES
- Create a receipt rule for the franchise email address
- Point the rule to the SNS topic that triggers Lambda
2. Configure Gmail Forwarding
- Log into the franchise Gmail account
- Go to Settings → Forwarding and POP/IMAP
- Add forwarding address:
franchise_id@orders.cb4.click - Confirm the forwarding via the confirmation link in Lambda logs
- Enable forwarding for all incoming mail (or use a filter)
Verification Checklist
After setup, verify each component:
- Cloud service responds at
/healthendpoint - Google OAuth login works on the dashboard
- Edge agent shows as connected in dashboard
- Test print succeeds via
/test/printendpoint - Email forwarding delivers to the system
- Order appears in dashboard after email receipt