HANDOVER_PROMPT.md

Edit Back to List

HANDOVER PROMPT FOR WEBSITE DEPLOYMENT ASSISTANT

Context

You are assisting Anthony Stratton with deploying a Flask-based dashboard for his gbrain (second brain) content to be accessible at vault.easieragency.com.

What Has Been Prepared (by Hermes Agent)

All application code and configuration files are ready in /home/admin/gbrain-dashboard/: - app.py - Flask application - requirements.txt - Python dependencies (Flask, Markdown, PyYAML) - templates/ - HTML templates (base.html, index.html, view_note.html, edit_note.html, new_note.html) - gbrain.service - Systemd service file for Gunicorn - nginx.conf - Nginx reverse proxy configuration - static/ - Directory for static assets

Tasks Requiring Completion

1. System Deployment (VM-side)

Execute these commands in sequence:

A. Install system dependencies (if not already done):

sudo apt update && sudo apt install -y nginx gunicorn

B. Deploy application files:

# Copy systemd service file
sudo cp /home/admin/gbrain-dashboard/gbrain.service /etc/systemd/system/

# Copy Nginx configuration
sudo cp /home/admin/gbrain-dashboard/nginx.conf /etc/nginx/sites-available/vault.easieragency.com

# Enable the site
sudo ln -s /etc/nginx/sites-available/vault.easieragency.com /etc/nginx/sites-enabled/

# Test Nginx configuration
sudo nginx -t

# Reload systemd and start services
sudo systemctl daemon-reload
sudo systemctl start gbrain
sudo systemctl enable gbrain
sudo systemctl restart nginx

C. Verify deployment:

# Check service status
sudo systemctl status gbrain
sudo systemctl status nginx

# Check if socket exists
ls -la /home/admin/gbrain-dashboard/gbrain.sock

# Test locally (should return HTML)
curl -I http://localhost
curl http://localhost | head -5

2. DNS Configuration (Your Responsibility - Anthony's Domain)

Since you own vault.easieragency.com:

A. Create DNS A record: - Log into your DNS provider's control panel - Create an A record for vault.easieragency.com - Point it to your VM's public IP address - Set TTL to automatic or low (300-3600 seconds) for faster propagation

B. Verify DNS propagation:

# From your local machine after waiting 5-10 minutes:
nslookup vault.easieragency.com
# Should return your VM's IP address

# Or:
dig vault.easieragency.com

3. Optional Security Enhancements

A. Change Flask secret key (recommended):

# Generate a secure key:
python3 -c 'import secrets; print(secrets.token_hex(32))'

# Edit /home/admin/gbrain-dashboard/app.py and replace:
# app.secret_key = 'your-secret-key-here'
# with the generated key

# Then restart the service:
sudo systemctl restart gbrain

B. Set up HTTPS with Let's Encrypt (highly recommended):

# Install certbot
sudo apt install -y certbot python3-certbot-nginx

# Obtain and install certificate
sudo certbot --nginx -d vault.easieragency.com

# Follow prompts to redirect HTTP to HTTPS

4. Firewall Configuration

# Allow HTTP/HTTPS traffic
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw reload

5. Verification After DNS Propagation

Once DNS resolves:

# Test from local machine:
curl -I http://vault.easieragency.com  # Should return 200 OK
curl http://vault.easieragency.com    # Should return dashboard HTML

# Test note creation/viewing through browser at:
# http://vault.easieragency.com/

Troubleshooting Guide

If Gunicorn fails to start:

# Check logs
sudo journalctl -u gbrain -f

# Test manually:
cd /home/admin/gbrain-dashboard
source bin/activate
gunicorn --workers 3 --bind unix:/home/admin/gbrain-dashboard/gbrain.sock app:app

If Nginx shows 502 Bad Gateway:

# Check if Gunicorn socket exists and has correct permissions
ls -la /home/admin/gbrain-dashboard/gbrain.sock

# Check Nginx error logs
sudo tail -f /var/log/nginx/error.log

# Check Gunicorn logs via journalctl
sudo journalctl -u gbrain -f

If application errors occur:

# Check Gunicorn logs
sudo journalctl -u gbrain -f

# Test Flask app directly:
cd /home/admin/gbrain-dashboard
source bin/activate
python app.py
# Then test on http://localhost:5000

Success Criteria

✅ Dashboard accessible at http://vault.easieragency.com
✅ Ability to browse existing notes
✅ Ability to create new notes
✅ Ability to edit existing notes
✅ Changes persist to /srv/easier-hermes/vault/
✅ System starts automatically on boot

Notes for gbrain Integration

Estimated Time

Please proceed with the deployment steps above and report back when complete for final verification.