Deployment & Docker
Secrets Reference
This document lists all secrets required for FlowState production deployment, including token scopes and permissions.
API Tokens & Keys
GITHUB_TOKEN
Purpose: Clone private repositories during Docker image builds
Token Type: Fine-grained Personal Access Token (recommended) or Classic PAT
Fine-grained PAT (Recommended)
| Setting | Value |
|---|---|
| Repository access | epic-digital-im/epic-flow-workspace (or All repositories) |
| Permissions | Contents: Read-only |
| Metadata: Read-only (automatically selected) |
Classic PAT (Alternative)
| Scope | Required | Purpose |
|---|---|---|
repo | Yes | Full control of private repositories |
How to Create:
- Go to GitHub → Settings → Developer settings → Personal access tokens
- Choose "Fine-grained tokens" (recommended)
- Set expiration (recommend 1 year for production)
- Select repository:
epic-digital-im/epic-flow-workspace - Set permissions: Contents (Read-only)
- Generate token
RXDB_PREMIUM
Purpose: Access RxDB Premium npm packages during builds
Token Type: npm Access Token from RxDB
Required Scope: Read-only access to rxdb-premium packages
How to Obtain:
- Purchase RxDB Premium license at https://rxdb.info/premium
- Receive npm access token via email
- Token format:
npm_xxxxxxxxxxxx
ANTHROPIC_API_KEY
Purpose: Claude AI API access for orchestrator and RAG services
Token Type: Anthropic API Key
Required Permissions:
| Permission | Required |
|---|---|
| Messages API | Yes |
| Model access | claude-3-opus, claude-3-sonnet, claude-3-haiku |
How to Create:
- Go to https://console.anthropic.com/
- Navigate to API Keys
- Create new key with descriptive name (e.g., "flowstate-prod")
- Copy key (starts with
sk-ant-)
Rate Limits: Ensure your plan supports production workloads
OPENAI_API_KEY
Purpose: OpenAI API access for Agent Memory Server (AMS) embeddings
Token Type: OpenAI API Key
Required Permissions:
| Permission | Required |
|---|---|
| Models | text-embedding-ada-002, text-embedding-3-small |
| Usage tier | Tier 1+ recommended for production |
How to Create:
- Go to https://platform.openai.com/api-keys
- Create new secret key
- Copy key (starts with
sk-)
Note: AMS can also use Ollama for embeddings (configured via OLLAMA_EMBEDDING_MODEL)
SENDGRID_API_KEY
Purpose: Email delivery for authentication codes
Token Type: SendGrid API Key
Required Permissions:
| Permission | Access Level |
|---|---|
| Mail Send | Full Access |
How to Create:
- Go to https://app.sendgrid.com/settings/api_keys
- Create API Key
- Select "Restricted Access"
- Enable only: Mail Send → Full Access
- Create & copy key (starts with
SG.)
Additional Setup Required:
- Verify sender identity for
MAIL_FROMemail address - Go to Settings → Sender Authentication
- Complete domain authentication (recommended) or single sender verification
Encryption Keys
LUKS_KEYFILE
Purpose: Unlock encrypted production volume at boot
Type: Binary key file (4096 bytes random data)
Storage: Base64-encoded in 1Password
Generation:
dd if=/dev/urandom of=/root/.luks-keyfile bs=4096 count=1
chmod 600 /root/.luks-keyfile
Recovery: Required to access data if server is destroyed but volume survives
RXDB_ENCRYPTION_KEY
Purpose: Application-level encryption for RxDB documents (future use)
Type: 256-bit key, base64-encoded
Generation:
openssl rand -base64 32
Current Status: Available but not yet implemented
REDIS_ENCRYPTION_KEY
Purpose: Application-level encryption for Redis values (future use)
Type: 256-bit key, base64-encoded
Generation:
openssl rand -base64 32
Current Status: Available but not yet implemented
JWT Keys
JWT_PRIVATE_KEY
Purpose: Sign JWT tokens for authentication
Type: RSA 2048-bit private key (PEM format)
Used By: Auth Server
Generation:
openssl genrsa -out private.pem 2048
Security: Never expose. Store only in 1Password and on server.
JWT_PUBLIC_KEY
Purpose: Verify JWT token signatures
Type: RSA public key (PEM format)
Used By: Auth Server, RxDB Server, Kong Gateway
Generation:
openssl rsa -in private.pem -pubout -out public.pem
Note: This key is embedded in Kong configuration for JWT validation
Configuration Values
MAIL_FROM
Purpose: Sender email address for authentication emails
Type: Email address string
Requirements:
- Must be verified in SendGrid as a Sender Identity
- Domain authentication recommended for deliverability
Example: noreply@epicflowstate.ai or auth@epicflowstate.ai
RXDB_AUTH_TOKEN
Purpose: Service-to-service authentication for internal API calls
Type: JWT token (long-lived)
Used By: Orchestrator → RxDB Server
Generation: See PRODUCTION.md "Generating Service JWT" section
Claims Required:
{
"iss": "https://api.epicflowstate.ai",
"sub": "orchestrator-service",
"domainId": "flowstate-prod",
"orgId": "org_xxxxxxxxxx",
"role": "service",
"exp": <10 years from now>
}
1Password Vault Structure
Recommended Structure for flowstate-prod Vault
flowstate-prod/
├── GitHub/
│ └── GITHUB_TOKEN [Password]
├── npm/
│ └── RXDB_PREMIUM [Password]
├── AI-Services/
│ ├── ANTHROPIC_API_KEY [Password]
│ └── OPENAI_API_KEY [Password]
├── Email/
│ ├── SENDGRID_API_KEY [Password]
│ └── MAIL_FROM [Password]
├── Encryption/
│ ├── LUKS_KEYFILE [Secure Note - base64]
│ ├── RXDB_ENCRYPTION_KEY [Password]
│ └── REDIS_ENCRYPTION_KEY [Password]
├── JWT/
│ ├── JWT_PRIVATE_KEY [Secure Note - PEM]
│ └── JWT_PUBLIC_KEY [Secure Note - PEM]
└── Service-Tokens/
└── RXDB_AUTH_TOKEN [Password]
Service Account Token
OP_SERVICE_ACCOUNT_TOKEN
Purpose: Allow production server to fetch secrets from 1Password
Type: 1Password Service Account Token
Required Vault Access: flowstate-prod (Read)
How to Create:
- Go to 1Password → Developer → Service Accounts
- Create new service account
- Name:
flowstate-prod-server - Grant access to
flowstate-prodvault (Read Items) - Copy token (starts with
ops_)
Server Setup:
export OP_SERVICE_ACCOUNT_TOKEN="ops_xxxxxxxx"
Security Best Practices
- Rotate tokens regularly: Set calendar reminders for annual rotation
- Use minimum required scopes: Don't grant unnecessary permissions
- Monitor usage: Enable logging/alerts for API key usage
- Separate environments: Use different tokens for dev/staging/prod
- Never commit secrets: Use .gitignore and pre-commit hooks
- Audit access: Review who has access to 1Password vault quarterly
Token Expiration Schedule
| Token | Recommended Expiration | Notes |
|---|---|---|
| GITHUB_TOKEN | 1 year | Fine-grained PATs have max 1 year |
| RXDB_PREMIUM | No expiration | Tied to license |
| ANTHROPIC_API_KEY | No expiration | Rotate annually |
| OPENAI_API_KEY | No expiration | Rotate annually |
| SENDGRID_API_KEY | No expiration | Rotate annually |
| JWT Keys | 2-5 years | Rotation requires client updates |
| RXDB_AUTH_TOKEN | 10 years | Long-lived service token |
| OP_SERVICE_ACCOUNT_TOKEN | No expiration | Rotate if compromised |
Built with Epic Flowstate