Status: Ready to Execute Prerequisites: Phase 1 & 2 Complete (✅) Estimated Time: 2-4 hours
This guide walks through deploying a chittysecrets Connect server and migrating all ChittyConnect credentials from environment variables to chittysecrets vaults. The implementation is designed to be executed gradually with zero downtime.
Current State: All code is deployed and ready. The system currently uses automatic failover to environment variables because the chittysecrets Connect server is not yet deployed.
After Phase 3: All credentials will be retrieved dynamically from chittysecrets vaults at runtime, with environment variables serving as emergency fallback only.
ChittyConnect Routes
↓
getServiceToken() / getCredential()
↓
OnePasswordConnectClient
├─→ [1] Try chittysecrets Connect Server (NEW in Phase 3)
└─→ [2] Fallback to environment variables (CURRENT)
↓
ContextConsciousness™ Risk Analysis
↓
Encrypted KV Cache (TTL-based)
- Docker or cloud hosting platform
- chittysecrets CLI (
op) installed locally - Access to chittysecrets account with admin permissions
-
wranglerCLI for Cloudflare Workers -
opensslfor generating encryption keys
You should have these already set in Cloudflare Workers:
Infrastructure:
CLOUDFLARE_MAKE_API_KEYCLOUDFLARE_ACCOUNT_IDNEON_DATABASE_URL
ChittyOS Services:
CHITTY_ID_TOKENCHITTY_AUTH_TOKENCHITTY_CHRONICLE_TOKENCHITTY_FINANCE_TOKENCHITTY_CASES_TOKENCHITTY_SYNC_TOKENCHITTY_EVIDENCE_TOKENCHITTY_CONTEXTUAL_TOKEN
Third-Party Integrations:
NOTION_TOKENOPENAI_API_KEYGOOGLE_ACCESS_TOKEN
# 1. Create a chittysecrets Connect credentials file
# Log into chittysecrets and generate a credentials file from:
# https://my.chittysecrets.com/integrations/active
# Save the credentials.json file to a secure location
mkdir -p ~/chittysecrets-connect
cd ~/chittysecrets-connect
# 2. Run chittysecrets Connect server
docker run -d \
--name chittysecrets-connect \
-p 8080:8080 \
-v $(pwd)/1op-sessions:/home/opuser/.op/data \
-v $(pwd)/credentials.json:/home/opuser/.op/credentials.json \
chittysecrets/connect-api:latest
# 3. Verify it's running
docker ps | grep chittysecrets-connect
# 4. Test health endpoint
curl http://localhost:8080/health
# Should return: {"name":"chittysecrets Connect API","version":"1.x.x"}AWS ECS:
# Create ECS task definition with chittysecrets/connect-api:latest
# Mount credentials.json as secret
# Expose port 8080
# Set up Application Load Balancer with SSLGoogle Cloud Run:
# Deploy container to Cloud Run
# Set credentials.json as secret
# Enable HTTPS endpointCloudflare Workers (not supported - requires persistent storage)
# Set up a dedicated VM
# Install Docker
# Follow Option A steps
# Configure reverse proxy (nginx/caddy) with SSL
# Set up monitoring and logging# Using chittysecrets CLI
op vault create "ChittyOS Infrastructure" --allow-admins-to-manage=true
op vault create "ChittyOS Services" --allow-admins-to-manage=true
op vault create "ChittyOS Integrations" --allow-admins-to-manage=true
op vault create "ChittyOS Emergency" --allow-admins-to-manage=true
# Note the vault UUIDs from the output - you'll need these laterInfrastructure Vault:
# Cloudflare credentials
op item create \
--category=login \
--title="Cloudflare API Credentials" \
--vault="ChittyOS Infrastructure" \
make_api_key[password]="$(wrangler secret get CLOUDFLARE_MAKE_API_KEY)" \
account_id[text]="$(wrangler secret get CLOUDFLARE_ACCOUNT_ID)" \
zone_id[text]="your-zone-id"
# Neon database
op item create \
--category=database \
--title="Neon PostgreSQL" \
--vault="ChittyOS Infrastructure" \
database_url[password]="$(wrangler secret get NEON_DATABASE_URL)"Services Vault:
# ChittyID
op item create \
--category=api \
--title="ChittyID Service Token" \
--vault="ChittyOS Services" \
service_token[password]="$(wrangler secret get CHITTY_ID_TOKEN)"
# ChittyAuth
op item create \
--category=api \
--title="ChittyAuth Service Token" \
--vault="ChittyOS Services" \
service_token[password]="$(wrangler secret get CHITTY_AUTH_TOKEN)"
# Repeat for all ChittyOS services...
# ChittyChronicle, ChittyFinance, ChittyCases, etc.Integrations Vault:
# Notion
op item create \
--category=api \
--title="Notion Integration" \
--vault="ChittyOS Integrations" \
api_key[password]="$(wrangler secret get NOTION_TOKEN)"
# OpenAI
op item create \
--category=api \
--title="OpenAI API" \
--vault="ChittyOS Integrations" \
api_key[password]="$(wrangler secret get OPENAI_API_KEY)"
# Google
op item create \
--category=api \
--title="Google Calendar" \
--vault="ChittyOS Integrations" \
access_token[password]="$(wrangler secret get GOOGLE_ACCESS_TOKEN)"# List all vaults
op vault list
# List items in each vault
op item list --vault="ChittyOS Infrastructure"
op item list --vault="ChittyOS Services"
op item list --vault="ChittyOS Integrations"
# Test retrieving a credential
op item get "Cloudflare API Credentials" --vault="ChittyOS Infrastructure" --fields make_api_key# In chittysecrets web interface:
# 1. Go to Integrations → chittysecrets Connect
# 2. Create new service account
# 3. Grant access to all four vaults (Infrastructure, Services, Integrations, Emergency)
# 4. Copy the token (you'll only see it once!)
# Save the token securely
echo "your-chittysecrets-connect-token" > ~/chittysecrets-connect-token.txt# Generate a 32-byte random encryption key for KV cache
openssl rand -base64 32
# Save this securely - you'll need it for Wrangler secrets# Get vault UUIDs
op vault list --format=json | jq '.[] | {name: .name, id: .id}'
# Update wrangler.toml
# Replace placeholder UUIDs with real ones:
# ONEPASSWORD_VAULT_INFRASTRUCTURE = "your-infrastructure-vault-uuid"
# ONEPASSWORD_VAULT_SERVICES = "your-services-vault-uuid"
# ONEPASSWORD_VAULT_INTEGRATIONS = "your-integrations-vault-uuid"
# ONEPASSWORD_VAULT_EMERGENCY = "your-emergency-vault-uuid"# Set chittysecrets Connect URL (update if using custom domain)
# Default assumes localhost for testing
# For production, use your actual domain
# Set chittysecrets Connect token
cat ~/chittysecrets-connect-token.txt | wrangler secret put ONEPASSWORD_CONNECT_TOKEN --env=staging
cat ~/chittysecrets-connect-token.txt | wrangler secret put ONEPASSWORD_CONNECT_TOKEN --env=production
# Set encryption key
openssl rand -base64 32 | wrangler secret put ENCRYPTION_KEY --env=staging
openssl rand -base64 32 | wrangler secret put ENCRYPTION_KEY --env=production
# Verify secrets are set
wrangler secret list --env=staging | grep -E "(ONEPASSWORD|ENCRYPTION)"
wrangler secret list --env=production | grep -E "(ONEPASSWORD|ENCRYPTION)"# In wrangler.toml, update for your actual chittysecrets Connect server:
[env.staging.vars]
ONEPASSWORD_CONNECT_URL = "https://chittysecrets-connect-staging.chitty.cc" # Your staging URL
[env.production.vars]
ONEPASSWORD_CONNECT_URL = "https://chittysecrets-connect.chitty.cc" # Your production URL# Test with curl
curl -H "Authorization: Bearer YOUR_CONNECT_TOKEN" \
http://localhost:8080/v1/vaults
# Should return JSON with all vaults
# Test retrieving an item
curl -H "Authorization: Bearer YOUR_CONNECT_TOKEN" \
"http://localhost:8080/v1/vaults/VAULT_UUID/items/ITEM_UUID"# Deploy to staging first
npm run deploy:staging
# Test credential provisioning endpoint
curl -X POST https://chittyconnect-staging.workers.dev/api/credentials/provision \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "openai_api_key",
"context": {
"service": "chittyconnect",
"purpose": "api-call"
}
}'
# Should return credential successfully retrieved from chittysecrets
# Check health endpoint
curl https://chittyconnect-staging.workers.dev/api/credentials/health \
-H "Authorization: Bearer $API_KEY"
# Should show: "onepassword_connect": "healthy"# Stop chittysecrets Connect server temporarily
docker stop chittysecrets-connect
# Test that ChittyConnect still works (should fall back to env vars)
curl -X POST https://chittyconnect-staging.workers.dev/api/credentials/provision \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "openai_api_key",
"context": {
"service": "chittyconnect",
"purpose": "api-call"
}
}'
# Should still succeed (using environment variable fallback)
# Check logs - should see warning about chittysecrets fallback
# Restart chittysecrets Connect
docker start chittysecrets-connect
# Verify it switches back to chittysecrets
# (may take up to cache TTL - 15 min for integrations)# Test ChittyID
curl -X POST https://chittyconnect-staging.workers.dev/api/chittyid/mint \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"entity": "PEO"}'
# Test Notion integration
curl -X POST https://chittyconnect-staging.workers.dev/api/thirdparty/notion/query \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"databaseId": "your-db-id"}'
# Test OpenAI integration
curl -X POST https://chittyconnect-staging.workers.dev/api/thirdparty/openai/chat \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "Hello"}]}'
# All should succeed using chittysecrets-retrieved credentials# Use production-grade hosting (AWS ECS, GKE, etc.)
# Ensure SSL/TLS enabled
# Set up monitoring and alerting
# Configure backup for credentials.json
# Set up logging to ChittyChronicle# Update wrangler.toml production URL
# Set production secrets
# Deploy to production
npm run deploy:production# Test health endpoint
curl https://connect.chitty.cc/api/credentials/health \
-H "Authorization: Bearer $API_KEY"
# Test one integration from each category
# - Third-party (Notion/OpenAI)
# - ChittyOS service (ChittyID)
# - Infrastructure (Cloudflare credentials)
# Monitor logs for any issues
npm run tail --env=production- ✅ chittysecrets Connect deployed and tested
- ✅ All credentials in vaults
- ✅ ChittyConnect retrieving from chittysecrets
- ✅ Environment variables still in place as failback
- 📊 Monitor cache hit rates
- 📊 Monitor chittysecrets Connect uptime
- 📊 Monitor for any failover events
- 🔧 Tune cache TTLs based on actual usage
- 🔧 Add more detailed metrics to ChittyChronicle
- 🔧 Implement credential rotation schedules
- 🔧 Set up alerting for high-risk access patterns
Only after confirming 99.9% uptime and no issues:
# Begin removing environment variable fallbacks (optional)
# This makes the system fully dependent on chittysecrets Connect
# Start with non-critical integrations
wrangler secret delete NOTION_TOKEN --env=production
wrangler secret delete GOOGLE_ACCESS_TOKEN --env=production
# Monitor for 1 week - any issues?
# Continue with service tokens
wrangler secret delete CHITTY_SYNC_TOKEN --env=production
wrangler secret delete CHITTY_EVIDENCE_TOKEN --env=production
# Monitor for 1 week
# Finally, critical services (keep as emergency backup)
# KEEP THESE: CHITTY_ID_TOKEN, CHITTY_AUTH_TOKEN, CHITTY_CHRONICLE_TOKEN
# KEEP THESE: CLOUDFLARE_MAKE_API_KEY, NEON_DATABASE_URLRecommendation: Keep critical infrastructure credentials in environment variables permanently as emergency fallback.
-- Query cache performance
SELECT
credential_path,
cache_hits,
cache_misses,
ROUND(cache_hits * 100.0 / (cache_hits + cache_misses), 2) as hit_rate_percent,
average_fetch_time_ms
FROM onepassword_cache_metadata
ORDER BY cache_hits + cache_misses DESC
LIMIT 20;
-- Query credential access patterns
SELECT
service,
credential_path,
access_count,
average_risk_score,
anomaly_count,
last_access
FROM credential_access_patterns
WHERE anomaly_count > 0 OR average_risk_score > 50
ORDER BY average_risk_score DESC;- Alert on chittysecrets Connect health check failures
- Alert on high cache miss rates (> 20%)
- Alert on high-risk credential requests (score >= 70)
- Alert on anomaly detection
- Alert on failover events
Weekly:
- Review credential access patterns
- Check for anomalies
- Review cache performance metrics
Monthly:
- Rotate service tokens
- Audit vault access logs
- Review and update credential purposes
- Update vault organization if needed
Quarterly:
- Full security audit
- Review and update risk scoring thresholds
- Test disaster recovery procedures
Automatic: System automatically falls back to environment variables (if still set)
Manual Steps:
- Check chittysecrets Connect server logs
- Restart chittysecrets Connect container/service
- Verify health endpoint
- Monitor ChittyConnect logs for automatic recovery
Steps:
- Generate new service account token in chittysecrets web interface
- Update Wrangler secrets:
echo "new-token" | wrangler secret put ONEPASSWORD_CONNECT_TOKEN --env=production
- Clear credential cache in KV (to force re-fetch with new token)
- Monitor logs for successful retrieval
Prevention: Regular backups of chittysecrets vaults
Recovery:
- Restore vault from chittysecrets backup
- Verify all credentials are present
- Update vault UUID in wrangler.toml if changed
- Redeploy ChittyConnect
- Test all integrations
If environment variables still set: Automatic failover, zero downtime
If environment variables removed:
- Emergency restore environment variables from secure backup
- Deploy with environment variables
- Investigate chittysecrets outage
- Restore chittysecrets Connect when available
✅ Phase 3 Complete When:
- chittysecrets Connect server deployed and healthy
- All credentials migrated to chittysecrets vaults
- ChittyConnect successfully retrieving credentials from vaults
- Cache hit rate > 80%
- Zero production incidents related to credentials
- All service proxies and integrations working
- Monitoring and alerting configured
- Documentation updated
- Team trained on new system
If Phase 3 needs to be rolled back:
# 1. Stop chittysecrets Connect server
docker stop chittysecrets-connect
# 2. Verify automatic failover to environment variables works
# (Should be seamless if env vars still set)
# 3. If needed, redeploy previous version
git checkout <previous-commit>
npm run deploy:production
# 4. Investigate issues before retrying Phase 3chittysecrets Connect Server:
- Docker (self-hosted): ~$10-50/month (VM costs)
- AWS ECS: ~$30-100/month (container + load balancer)
- Google Cloud Run: ~$20-80/month (container + ingress)
chittysecrets Business Account:
- Required for Connect API
- ~$8-20/user/month
Cloudflare KV (Credential Cache):
- Read operations: ~1M/month = $0.50
- Write operations: ~100K/month = $0.50
- Storage: Negligible (< 1MB)
- Total KV: ~$1/month
Total Estimated Monthly Cost: $40-170 (Mainly chittysecrets subscription + hosting)
ROI: Enhanced security, centralized credential management, automated rotation, comprehensive audit trail
Issue: "chittysecrets Connect not healthy"
- Check chittysecrets Connect server logs
- Verify network connectivity
- Verify credentials.json is valid
- Check service account token hasn't expired
Issue: "High cache miss rate"
- Check cache TTL settings
- Verify ENCRYPTION_KEY is set correctly
- Check KV namespace is accessible
- Review credential access patterns
Issue: "Risk score too high, access denied"
- Review ContextConsciousness™ analysis
- Check if service is in registry
- Verify purpose is valid for credential type
- Check time-based patterns (unusual hours)
- Documentation: See 1PASSWORD_ARCHITECT_IMPLEMENTATION.md
- Logs:
npm run tail --env=production - Database Queries: Use D1 to query credential_access_patterns
- chittysecrets Support: https://support.chittysecrets.com
Phase 3 migration complete! ChittyConnect is now a fully operational context-aware credential orchestration platform powered by chittysecrets Connect. 🎉