@deftai/directive-content 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/deft/SKILL.md +6 -0
- package/.agents/skills/deft-directive-article-review/SKILL.md +11 -0
- package/.agents/skills/deft-directive-build/SKILL.md +10 -0
- package/.agents/skills/deft-directive-cost/SKILL.md +12 -0
- package/.agents/skills/deft-directive-debug/SKILL.md +13 -0
- package/.agents/skills/deft-directive-gh-arch/SKILL.md +11 -0
- package/.agents/skills/deft-directive-gh-slice/SKILL.md +10 -0
- package/.agents/skills/deft-directive-glossary/SKILL.md +10 -0
- package/.agents/skills/deft-directive-interview/SKILL.md +9 -0
- package/.agents/skills/deft-directive-pre-pr/SKILL.md +9 -0
- package/.agents/skills/deft-directive-refinement/SKILL.md +10 -0
- package/.agents/skills/deft-directive-release/SKILL.md +12 -0
- package/.agents/skills/deft-directive-review-cycle/SKILL.md +10 -0
- package/.agents/skills/deft-directive-setup/SKILL.md +10 -0
- package/.agents/skills/deft-directive-swarm/SKILL.md +10 -0
- package/.agents/skills/deft-directive-sync/SKILL.md +9 -0
- package/.agents/skills/deft-directive-triage/SKILL.md +9 -0
- package/.agents/skills/deft-directive-write-skill/SKILL.md +9 -0
- package/LICENSE.md +22 -0
- package/QUICK-START.md +167 -0
- package/UPGRADING.md +517 -0
- package/coding/build-output.md +28 -0
- package/coding/coding.md +235 -0
- package/coding/debugging.md +110 -0
- package/coding/holzmann.md +96 -0
- package/coding/hygiene.md +127 -0
- package/coding/security.md +158 -0
- package/coding/testing.md +162 -0
- package/coding/toolchain.md +44 -0
- package/commands.md +300 -0
- package/context/context.md +57 -0
- package/context/deterministic-split.md +67 -0
- package/context/examples.md +26 -0
- package/context/fractal-summaries.md +69 -0
- package/context/long-horizon.md +46 -0
- package/context/spec-deltas.md +177 -0
- package/context/tool-design.md +34 -0
- package/context/working-memory.md +62 -0
- package/contracts/boundary-maps.md +65 -0
- package/contracts/deterministic-questions.md +59 -0
- package/contracts/hierarchy.md +77 -0
- package/conventions/content-manifest.json +399 -0
- package/conventions/machine-generated-banner.md +130 -0
- package/conventions/references.md +120 -0
- package/conventions/rule-ownership.json +382 -0
- package/conventions/task-caching.md +43 -0
- package/conventions/vbrief-filenames.md +70 -0
- package/deployments/README.md +37 -0
- package/deployments/agentuity/README.md +138 -0
- package/deployments/agentuity/via-cli.md +380 -0
- package/deployments/agentuity/via-cloud.md +425 -0
- package/deployments/agentuity/via-github-actions.md +664 -0
- package/deployments/agentuity/via-gravity-network.md +606 -0
- package/deployments/agentuity/via-vpc.md +607 -0
- package/deployments/aws/README.md +38 -0
- package/deployments/aws/via-app-runner.md +612 -0
- package/deployments/aws/via-ecs-fargate.md +561 -0
- package/deployments/aws/via-elastic-beanstalk.md +628 -0
- package/deployments/aws/via-lambda.md +649 -0
- package/deployments/azure/README.md +37 -0
- package/deployments/azure/via-aks.md +390 -0
- package/deployments/azure/via-app-service.md +564 -0
- package/deployments/azure/via-container-apps.md +599 -0
- package/deployments/azure/via-functions.md +552 -0
- package/deployments/cloud-gov/README.md +63 -0
- package/deployments/cloud-gov/agents/compliance-docs.md +154 -0
- package/deployments/cloud-gov/agents.md +39 -0
- package/deployments/cloud-gov/cicd.md +64 -0
- package/deployments/cloud-gov/deployment.md +150 -0
- package/deployments/cloud-gov/logging.md +43 -0
- package/deployments/cloud-gov/manifest.md +121 -0
- package/deployments/cloud-gov/overview.md +58 -0
- package/deployments/cloud-gov/security.md +46 -0
- package/deployments/cloud-gov/services.md +72 -0
- package/deployments/cloud-gov/upstream/README.md +18 -0
- package/deployments/cloudflare/README.md +33 -0
- package/deployments/cloudflare/via-dashboard.md +83 -0
- package/deployments/cloudflare/via-git.md +90 -0
- package/deployments/cloudflare/via-github-actions.md +185 -0
- package/deployments/cloudflare/via-terraform.md +157 -0
- package/deployments/cloudflare/via-wrangler.md +165 -0
- package/deployments/fly-io/README.md +37 -0
- package/deployments/fly-io/via-dockerfile.md +648 -0
- package/deployments/fly-io/via-flyctl.md +653 -0
- package/deployments/fly-io/via-github-actions.md +695 -0
- package/deployments/fly-io/via-multi-region.md +598 -0
- package/deployments/google/README.md +34 -0
- package/deployments/google/via-app-engine.md +42 -0
- package/deployments/google/via-cloud-functions.md +23 -0
- package/deployments/google/via-cloud-run.md +330 -0
- package/deployments/google/via-gke.md +23 -0
- package/deployments/netlify/README.md +99 -0
- package/deployments/netlify/via-cli.md +17 -0
- package/deployments/netlify/via-functions.md +19 -0
- package/deployments/netlify/via-git.md +25 -0
- package/deployments/vercel/README.md +90 -0
- package/deployments/vercel/via-api.md +16 -0
- package/deployments/vercel/via-cli.md +17 -0
- package/deployments/vercel/via-git.md +24 -0
- package/docs/BROWNFIELD.md +179 -0
- package/docs/getting-started.md +137 -0
- package/docs/good-agents-md.md +137 -0
- package/events/README.md +89 -0
- package/events/event-record.schema.json +26 -0
- package/events/registry.json +166 -0
- package/events/registry.schema.json +71 -0
- package/glossary.md +145 -0
- package/incidents/README.md +81 -0
- package/incidents/_template.md +38 -0
- package/interfaces/cli.md +104 -0
- package/interfaces/rest.md +212 -0
- package/interfaces/tui.md +242 -0
- package/interfaces/web.md +123 -0
- package/languages/6502-DASM.md +132 -0
- package/languages/c.md +235 -0
- package/languages/commands.md +23 -0
- package/languages/cpp.md +132 -0
- package/languages/csharp.md +259 -0
- package/languages/dart.md +183 -0
- package/languages/delphi.md +218 -0
- package/languages/elixir.md +208 -0
- package/languages/go.md +78 -0
- package/languages/java.md +278 -0
- package/languages/javascript.md +163 -0
- package/languages/julia.md +175 -0
- package/languages/kotlin.md +193 -0
- package/languages/markdown.md +168 -0
- package/languages/mermaid.md +146 -0
- package/languages/officejs.md +392 -0
- package/languages/python.md +209 -0
- package/languages/r.md +163 -0
- package/languages/rust.md +216 -0
- package/languages/sql.md +216 -0
- package/languages/swift.md +153 -0
- package/languages/typescript.md +132 -0
- package/languages/vba.md +279 -0
- package/languages/vhdl.md +180 -0
- package/languages/visual-basic.md +151 -0
- package/languages/zig.md +196 -0
- package/meta/SOUL.md +27 -0
- package/meta/code-field.md +44 -0
- package/meta/morals.md +40 -0
- package/meta/philosophy.md +39 -0
- package/meta/project.md +49 -0
- package/meta/ralph.md +223 -0
- package/meta/security.md +80 -0
- package/meta/versioning.md +326 -0
- package/package.json +22 -0
- package/packs/lessons/lessons-pack-0.1.json +553 -0
- package/packs/patterns/patterns-pack-0.1.json +57 -0
- package/packs/rules/rules-pack-0.1.json +4767 -0
- package/packs/skills/skills-pack-0.1.json +262 -0
- package/packs/strategies/strategies-pack-0.1.json +167 -0
- package/packs/swarm-spec/swarm-spec-pack-0.1.json +17 -0
- package/patterns/executor-layer-credentials.md +227 -0
- package/patterns/llm-app.md +156 -0
- package/patterns/multi-agent.md +278 -0
- package/patterns/prompt-assembly-layer-ordering.md +154 -0
- package/patterns/role-as-overlay.md +179 -0
- package/platforms/2600.md +137 -0
- package/platforms/unity.md +329 -0
- package/references/composer-skill-porting.md +152 -0
- package/references/cost-models.md +163 -0
- package/references/ip-risk.md +246 -0
- package/references/plain-english-ux.md +275 -0
- package/resilience/context-pruning.md +67 -0
- package/resilience/continue-here.md +62 -0
- package/scm/changelog.md +276 -0
- package/scm/git.md +139 -0
- package/scm/github.md +265 -0
- package/secrets/.gitkeep +0 -0
- package/skills/deft-build/SKILL.md +20 -0
- package/skills/deft-directive-article-review/SKILL.md +156 -0
- package/skills/deft-directive-build/SKILL.md +302 -0
- package/skills/deft-directive-cost/SKILL.md +201 -0
- package/skills/deft-directive-debug/SKILL.md +140 -0
- package/skills/deft-directive-decompose/SKILL.md +96 -0
- package/skills/deft-directive-gh-arch/SKILL.md +160 -0
- package/skills/deft-directive-gh-slice/SKILL.md +199 -0
- package/skills/deft-directive-glossary/SKILL.md +118 -0
- package/skills/deft-directive-interview/SKILL.md +528 -0
- package/skills/deft-directive-pre-pr/SKILL.md +131 -0
- package/skills/deft-directive-probe/SKILL.md +127 -0
- package/skills/deft-directive-refinement/SKILL.md +403 -0
- package/skills/deft-directive-release/SKILL.md +266 -0
- package/skills/deft-directive-review-cycle/SKILL.md +401 -0
- package/skills/deft-directive-setup/SKILL.md +717 -0
- package/skills/deft-directive-swarm/SKILL.md +989 -0
- package/skills/deft-directive-sync/SKILL.md +288 -0
- package/skills/deft-directive-triage/SKILL.md +137 -0
- package/skills/deft-directive-write-skill/SKILL.md +169 -0
- package/skills/deft-interview/SKILL.md +16 -0
- package/skills/deft-pre-pr/SKILL.md +16 -0
- package/skills/deft-review-cycle/SKILL.md +16 -0
- package/skills/deft-roadmap-refresh/SKILL.md +16 -0
- package/skills/deft-setup/SKILL.md +20 -0
- package/skills/deft-swarm/SKILL.md +16 -0
- package/skills/deft-sync/SKILL.md +16 -0
- package/strategies/README.md +83 -0
- package/strategies/artifact-guards.md +85 -0
- package/strategies/bdd.md +115 -0
- package/strategies/brownfield.md +7 -0
- package/strategies/discuss.md +129 -0
- package/strategies/emit-hints.md +69 -0
- package/strategies/enterprise.md +193 -0
- package/strategies/interview.md +551 -0
- package/strategies/map.md +179 -0
- package/strategies/probe.md +151 -0
- package/strategies/rapid.md +155 -0
- package/strategies/research.md +155 -0
- package/strategies/roadmap.md +9 -0
- package/strategies/speckit.md +437 -0
- package/strategies/v0-20-contract.md +134 -0
- package/strategies/yolo.md +169 -0
- package/swarm/swarm.md +300 -0
- package/templates/COST-ESTIMATE.md +114 -0
- package/templates/PULL_REQUEST_TEMPLATE.md +35 -0
- package/templates/agent-prompt-preamble.md +409 -0
- package/templates/agents-entry.md +211 -0
- package/templates/agents-entry.placeholders.md +75 -0
- package/templates/embed.go +20 -0
- package/templates/embed_test.go +36 -0
- package/templates/make-spec-example.md +9 -0
- package/templates/make-spec.md +246 -0
- package/templates/project.md.template +52 -0
- package/templates/specification.md +1 -0
- package/templates/swarm-greptile-poller-prompt.md +556 -0
- package/templates/user.md.template +31 -0
- package/tools/RWLDL.md +80 -0
- package/tools/greptile.md +141 -0
- package/tools/installer.md +23 -0
- package/tools/taskfile-migration.md +32 -0
- package/tools/taskfile.md +185 -0
- package/tools/telemetry.md +285 -0
- package/vbrief/schemas/cache-meta.schema.json +137 -0
- package/vbrief/schemas/candidates.schema.json +130 -0
- package/vbrief/schemas/codebase-map.schema.json +213 -0
- package/vbrief/schemas/lessons-pack.schema.json +134 -0
- package/vbrief/schemas/patterns-pack.schema.json +84 -0
- package/vbrief/schemas/rules-pack.schema.json +105 -0
- package/vbrief/schemas/skills-pack.schema.json +94 -0
- package/vbrief/schemas/slices.schema.json +87 -0
- package/vbrief/schemas/strategies-pack.schema.json +89 -0
- package/vbrief/schemas/swarm-spec-pack.schema.json +84 -0
- package/vbrief/schemas/vbrief-core.schema.json +1022 -0
- package/vbrief/vbrief.md +684 -0
- package/verification/integration.md +76 -0
- package/verification/plan-checking.md +85 -0
- package/verification/uat.md +60 -0
- package/verification/verification.md +117 -0
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
# Deploy via Multi-Region
|
|
2
|
+
|
|
3
|
+
Deploy your applications globally across Fly.io's 30+ regions for low latency, high availability, and disaster recovery. Run close to your users worldwide.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Fly.io makes global deployment simple:
|
|
8
|
+
- **30+ Regions**: Deploy worldwide with one command
|
|
9
|
+
- **Automatic Routing**: Users connect to nearest region
|
|
10
|
+
- **Built-In Load Balancing**: Distribute traffic intelligently
|
|
11
|
+
- **Data Replication**: Keep data close to users
|
|
12
|
+
- **Disaster Recovery**: Automatic failover between regions
|
|
13
|
+
|
|
14
|
+
## Available Regions
|
|
15
|
+
|
|
16
|
+
### North America
|
|
17
|
+
- `iad` - Ashburn, Virginia (US East)
|
|
18
|
+
- `ord` - Chicago, Illinois
|
|
19
|
+
- `dfw` - Dallas, Texas
|
|
20
|
+
- `sea` - Seattle, Washington
|
|
21
|
+
- `sjc` - San Jose, California
|
|
22
|
+
- `lax` - Los Angeles, California
|
|
23
|
+
- `yyz` - Toronto, Canada
|
|
24
|
+
- `ewr` - Secaucus, NJ (US East)
|
|
25
|
+
|
|
26
|
+
### Europe
|
|
27
|
+
- `lhr` - London, United Kingdom
|
|
28
|
+
- `ams` - Amsterdam, Netherlands
|
|
29
|
+
- `fra` - Frankfurt, Germany
|
|
30
|
+
- `cdg` - Paris, France
|
|
31
|
+
- `mad` - Madrid, Spain
|
|
32
|
+
- `waw` - Warsaw, Poland
|
|
33
|
+
- `arn` - Stockholm, Sweden
|
|
34
|
+
|
|
35
|
+
### Asia Pacific
|
|
36
|
+
- `nrt` - Tokyo, Japan
|
|
37
|
+
- `hkg` - Hong Kong
|
|
38
|
+
- `sin` - Singapore
|
|
39
|
+
- `syd` - Sydney, Australia
|
|
40
|
+
- `bom` - Mumbai, India
|
|
41
|
+
- `scl` - Santiago, Chile
|
|
42
|
+
|
|
43
|
+
### South America
|
|
44
|
+
- `gru` - São Paulo, Brazil
|
|
45
|
+
- `scl` - Santiago, Chile
|
|
46
|
+
|
|
47
|
+
### Africa & Middle East
|
|
48
|
+
- `jnb` - Johannesburg, South Africa
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
### View Available Regions
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# List all Fly.io regions
|
|
56
|
+
fly platform regions
|
|
57
|
+
|
|
58
|
+
# Output shows code, name, and gateway status
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Deploy to Multiple Regions
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Deploy initial app
|
|
65
|
+
fly launch
|
|
66
|
+
|
|
67
|
+
# Add regions
|
|
68
|
+
fly regions add lhr # London
|
|
69
|
+
fly regions add nrt # Tokyo
|
|
70
|
+
fly regions add syd # Sydney
|
|
71
|
+
|
|
72
|
+
# Scale to run in all regions
|
|
73
|
+
fly scale count 3 --region iad,lhr,syd
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Check Current Deployment
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# List app regions
|
|
80
|
+
fly regions list
|
|
81
|
+
|
|
82
|
+
# Show all instances
|
|
83
|
+
fly status --all
|
|
84
|
+
|
|
85
|
+
# See which regions have instances
|
|
86
|
+
fly scale show
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Configuration
|
|
90
|
+
|
|
91
|
+
### Set Primary Region
|
|
92
|
+
|
|
93
|
+
```toml
|
|
94
|
+
# fly.toml
|
|
95
|
+
app = "my-global-app"
|
|
96
|
+
primary_region = "iad" # Primary region for writes
|
|
97
|
+
|
|
98
|
+
[env]
|
|
99
|
+
PRIMARY_REGION = "iad"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Set via CLI
|
|
104
|
+
fly regions set iad --primary
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Configure Backup Regions
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Add backup regions for failover
|
|
111
|
+
fly regions backup lhr ord
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Region Groups
|
|
115
|
+
|
|
116
|
+
```toml
|
|
117
|
+
# fly.toml - Deploy to region groups
|
|
118
|
+
[regions]
|
|
119
|
+
primary = "iad"
|
|
120
|
+
backup = ["ord", "dfw"]
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Scaling Strategies
|
|
124
|
+
|
|
125
|
+
### Uniform Distribution
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Deploy equal instances to each region
|
|
129
|
+
fly scale count 6 --region iad,lhr,nrt,syd
|
|
130
|
+
|
|
131
|
+
# Results in:
|
|
132
|
+
# - 2 instances in IAD
|
|
133
|
+
# - 2 instances in LHR
|
|
134
|
+
# - 1 instance in NRT
|
|
135
|
+
# - 1 instance in SYD
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Weighted Distribution
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# More instances in high-traffic regions
|
|
142
|
+
fly scale count 3 --region iad # 3 in US East
|
|
143
|
+
fly scale count 2 --region lhr # 2 in London
|
|
144
|
+
fly scale count 1 --region syd # 1 in Sydney
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Auto-Scaling Per Region
|
|
148
|
+
|
|
149
|
+
```toml
|
|
150
|
+
# fly.toml
|
|
151
|
+
[autoscaling]
|
|
152
|
+
min_machines_running = 1
|
|
153
|
+
max_machines_running = 10
|
|
154
|
+
|
|
155
|
+
# This applies per region
|
|
156
|
+
# With 3 regions: min 3, max 30 total instances
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Data and State Management
|
|
160
|
+
|
|
161
|
+
### Stateless Applications
|
|
162
|
+
|
|
163
|
+
```toml
|
|
164
|
+
# fly.toml for stateless apps
|
|
165
|
+
app = "stateless-api"
|
|
166
|
+
primary_region = "iad"
|
|
167
|
+
|
|
168
|
+
# No volumes needed
|
|
169
|
+
# All regions serve traffic equally
|
|
170
|
+
|
|
171
|
+
[[services]]
|
|
172
|
+
internal_port = 8080
|
|
173
|
+
protocol = "tcp"
|
|
174
|
+
|
|
175
|
+
[[services.ports]]
|
|
176
|
+
handlers = ["http"]
|
|
177
|
+
port = 80
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Distributed Databases
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Create multi-region Postgres
|
|
184
|
+
fly postgres create --region iad,lhr,syd
|
|
185
|
+
|
|
186
|
+
# Attach to app
|
|
187
|
+
fly postgres attach my-postgres-app
|
|
188
|
+
|
|
189
|
+
# Automatic read replicas in each region
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Volumes and Persistent Storage
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Create volumes in each region
|
|
196
|
+
fly volumes create data --region iad --size 10
|
|
197
|
+
fly volumes create data --region lhr --size 10
|
|
198
|
+
fly volumes create data --region syd --size 10
|
|
199
|
+
|
|
200
|
+
# Fly will place instances with their volumes
|
|
201
|
+
fly scale count 3
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
```toml
|
|
205
|
+
# fly.toml with volumes
|
|
206
|
+
[mounts]
|
|
207
|
+
source = "data"
|
|
208
|
+
destination = "/data"
|
|
209
|
+
|
|
210
|
+
# One instance per volume
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Redis at the Edge
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Use Upstash Redis for multi-region caching
|
|
217
|
+
fly redis create
|
|
218
|
+
|
|
219
|
+
# Automatically replicates globally
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Routing and Load Balancing
|
|
223
|
+
|
|
224
|
+
### Anycast Routing
|
|
225
|
+
|
|
226
|
+
Fly.io uses Anycast - users automatically connect to nearest region:
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
User in UK → Routes to LHR
|
|
230
|
+
User in US → Routes to IAD
|
|
231
|
+
User in Japan → Routes to NRT
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
No configuration needed!
|
|
235
|
+
|
|
236
|
+
### Internal Routing
|
|
237
|
+
|
|
238
|
+
```toml
|
|
239
|
+
# fly.toml
|
|
240
|
+
[private_network]
|
|
241
|
+
name = "my-app-net"
|
|
242
|
+
|
|
243
|
+
# Instances can communicate across regions
|
|
244
|
+
# via .internal DNS (e.g., my-app.internal)
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Sticky Sessions
|
|
248
|
+
|
|
249
|
+
```toml
|
|
250
|
+
# fly.toml
|
|
251
|
+
[[services]]
|
|
252
|
+
internal_port = 8080
|
|
253
|
+
|
|
254
|
+
[[services.ports]]
|
|
255
|
+
handlers = ["http"]
|
|
256
|
+
port = 80
|
|
257
|
+
|
|
258
|
+
# Enable sticky sessions
|
|
259
|
+
[services.concurrency]
|
|
260
|
+
type = "connections"
|
|
261
|
+
hard_limit = 200
|
|
262
|
+
soft_limit = 100
|
|
263
|
+
|
|
264
|
+
[services.http_options.response]
|
|
265
|
+
[services.http_options.response.headers]
|
|
266
|
+
fly-force-instance-id = "true" # Sticky sessions
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## High Availability Patterns
|
|
270
|
+
|
|
271
|
+
### Active-Active (Multi-Region Writes)
|
|
272
|
+
|
|
273
|
+
```toml
|
|
274
|
+
# All regions serve reads and writes
|
|
275
|
+
app = "active-active-app"
|
|
276
|
+
primary_region = "iad"
|
|
277
|
+
|
|
278
|
+
# Use conflict-free data structures (CRDTs)
|
|
279
|
+
# Or database with multi-master replication
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Deploy to all regions
|
|
284
|
+
fly regions add iad lhr syd nrt
|
|
285
|
+
fly scale count 8
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Active-Passive (Read Replicas)
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
# Primary region for writes
|
|
292
|
+
fly regions set iad --primary
|
|
293
|
+
|
|
294
|
+
# Secondary regions for reads only
|
|
295
|
+
fly regions add lhr syd --backup
|
|
296
|
+
|
|
297
|
+
# Application routes writes to primary
|
|
298
|
+
# Reads can go to any region
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Regional Failover
|
|
302
|
+
|
|
303
|
+
```toml
|
|
304
|
+
# fly.toml
|
|
305
|
+
[deploy]
|
|
306
|
+
strategy = "rolling"
|
|
307
|
+
|
|
308
|
+
[deploy.max_unavailable]
|
|
309
|
+
count = 1 # Only take down one instance at a time
|
|
310
|
+
|
|
311
|
+
[[services]]
|
|
312
|
+
[[services.tcp_checks]]
|
|
313
|
+
interval = "15s"
|
|
314
|
+
timeout = "2s"
|
|
315
|
+
grace_period = "5s"
|
|
316
|
+
restart_limit = 3 # Auto-restart on failure
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## Database Strategies
|
|
320
|
+
|
|
321
|
+
### Fly Postgres Multi-Region
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
# Create Postgres with replicas
|
|
325
|
+
fly postgres create \
|
|
326
|
+
--name my-db \
|
|
327
|
+
--region iad,lhr,syd \
|
|
328
|
+
--initial-cluster-size 3
|
|
329
|
+
|
|
330
|
+
# Attach to application
|
|
331
|
+
fly postgres attach my-db
|
|
332
|
+
|
|
333
|
+
# Automatic failover enabled
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### LiteFS for SQLite
|
|
337
|
+
|
|
338
|
+
```toml
|
|
339
|
+
# fly.toml with LiteFS for distributed SQLite
|
|
340
|
+
[mounts]
|
|
341
|
+
source = "litefs"
|
|
342
|
+
destination = "/var/lib/litefs"
|
|
343
|
+
|
|
344
|
+
[env]
|
|
345
|
+
LITEFS_CLOUD_TOKEN = "your-token"
|
|
346
|
+
|
|
347
|
+
# SQLite replicated across regions
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### External Database with Replicas
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
# Use external database with read replicas
|
|
354
|
+
fly secrets set DATABASE_URL=postgres://primary...
|
|
355
|
+
fly secrets set READ_REPLICA_IAD=postgres://replica-iad...
|
|
356
|
+
fly secrets set READ_REPLICA_LHR=postgres://replica-lhr...
|
|
357
|
+
|
|
358
|
+
# App routes based on FLY_REGION environment variable
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## Latency Optimization
|
|
362
|
+
|
|
363
|
+
### Check Latency Between Regions
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
# From your local machine
|
|
367
|
+
fly ping my-app.fly.dev
|
|
368
|
+
|
|
369
|
+
# Between regions (from running instance)
|
|
370
|
+
fly ssh console -C "curl -w '%{time_total}' https://my-app.internal/health"
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Optimal Region Selection
|
|
374
|
+
|
|
375
|
+
```javascript
|
|
376
|
+
// In your application
|
|
377
|
+
const FLY_REGION = process.env.FLY_REGION;
|
|
378
|
+
|
|
379
|
+
// Route to nearest database replica
|
|
380
|
+
const databaseUrl = process.env[`DATABASE_${FLY_REGION.toUpperCase()}`]
|
|
381
|
+
|| process.env.DATABASE_URL;
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### CDN and Asset Caching
|
|
385
|
+
|
|
386
|
+
```toml
|
|
387
|
+
# fly.toml - Cache static assets
|
|
388
|
+
[[services]]
|
|
389
|
+
[[services.ports]]
|
|
390
|
+
handlers = ["http"]
|
|
391
|
+
port = 80
|
|
392
|
+
|
|
393
|
+
[services.http_options]
|
|
394
|
+
compress = true
|
|
395
|
+
|
|
396
|
+
[services.http_options.response.headers]
|
|
397
|
+
Cache-Control = "public, max-age=31536000"
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## Monitoring Multi-Region Deployments
|
|
401
|
+
|
|
402
|
+
### View Status Across Regions
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
# See all instances by region
|
|
406
|
+
fly status --all
|
|
407
|
+
|
|
408
|
+
# JSON output for scripting
|
|
409
|
+
fly status --json | jq '.allocations[] | {region, status}'
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### Regional Metrics
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
# Open Grafana dashboard
|
|
416
|
+
fly dashboard
|
|
417
|
+
|
|
418
|
+
# Filter by region in Grafana
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### Logs from Specific Region
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
# Filter logs by region
|
|
425
|
+
fly logs --region iad
|
|
426
|
+
|
|
427
|
+
# View logs from all regions
|
|
428
|
+
fly logs
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
## Disaster Recovery
|
|
432
|
+
|
|
433
|
+
### Automatic Failover
|
|
434
|
+
|
|
435
|
+
```bash
|
|
436
|
+
# Fly automatically routes around failed instances
|
|
437
|
+
# No configuration needed
|
|
438
|
+
|
|
439
|
+
# View failover events
|
|
440
|
+
fly events
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### Manual Region Removal
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
# Remove unhealthy region
|
|
447
|
+
fly regions remove iad
|
|
448
|
+
|
|
449
|
+
# Traffic automatically routes to other regions
|
|
450
|
+
|
|
451
|
+
# Re-add when healthy
|
|
452
|
+
fly regions add iad
|
|
453
|
+
fly scale count 3 --region iad
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### Backup and Recovery
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
# Snapshot volumes in each region
|
|
460
|
+
fly volumes snapshots create VOLUME_ID
|
|
461
|
+
|
|
462
|
+
# Restore in different region if needed
|
|
463
|
+
fly volumes create data --snapshot-id SNAPSHOT_ID --region lhr
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
## Cost Optimization
|
|
467
|
+
|
|
468
|
+
### Region Selection
|
|
469
|
+
|
|
470
|
+
```bash
|
|
471
|
+
# Deploy only to regions you need
|
|
472
|
+
# More regions = more cost
|
|
473
|
+
|
|
474
|
+
# Start with primary market
|
|
475
|
+
fly regions add iad # US customers
|
|
476
|
+
|
|
477
|
+
# Add as needed
|
|
478
|
+
fly regions add lhr # European customers
|
|
479
|
+
fly regions add syd # Asia-Pacific customers
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### Instance Scaling
|
|
483
|
+
|
|
484
|
+
```bash
|
|
485
|
+
# Run minimum instances
|
|
486
|
+
fly scale count 1 --region iad # Primary
|
|
487
|
+
fly scale count 0 --region lhr # Only scale up when needed
|
|
488
|
+
|
|
489
|
+
# Use autoscaling
|
|
490
|
+
fly autoscale set min=1 max=10
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
## Best Practices
|
|
494
|
+
|
|
495
|
+
1. **Start Small**: Begin with 1-2 regions, expand based on traffic
|
|
496
|
+
2. **Choose Primary Wisely**: Primary region near main database
|
|
497
|
+
3. **Monitor Latency**: Track response times per region
|
|
498
|
+
4. **Use Read Replicas**: Keep reads local, centralize writes
|
|
499
|
+
5. **Health Checks**: Ensure automatic failover works
|
|
500
|
+
6. **Test Failover**: Regularly test disaster recovery
|
|
501
|
+
7. **Cache Aggressively**: Reduce database queries
|
|
502
|
+
8. **Use Private Network**: For inter-region communication
|
|
503
|
+
9. **Monitor Costs**: Watch per-region resource usage
|
|
504
|
+
10. **Deploy in Waves**: Roll out to one region at a time
|
|
505
|
+
|
|
506
|
+
## Common Patterns
|
|
507
|
+
|
|
508
|
+
### Global Read, Regional Write
|
|
509
|
+
|
|
510
|
+
```javascript
|
|
511
|
+
// Route writes to primary region
|
|
512
|
+
if (operation === 'write') {
|
|
513
|
+
const primaryUrl = process.env.PRIMARY_DATABASE_URL;
|
|
514
|
+
await database.connect(primaryUrl).write(data);
|
|
515
|
+
} else {
|
|
516
|
+
// Reads from local replica
|
|
517
|
+
const localReplica = process.env[`DATABASE_${FLY_REGION}`];
|
|
518
|
+
return await database.connect(localReplica).read();
|
|
519
|
+
}
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
### Active-Active with Conflict Resolution
|
|
523
|
+
|
|
524
|
+
```javascript
|
|
525
|
+
// Use CRDTs or timestamp-based resolution
|
|
526
|
+
const writeToAllRegions = async (data) => {
|
|
527
|
+
data.timestamp = Date.now();
|
|
528
|
+
data.region = FLY_REGION;
|
|
529
|
+
|
|
530
|
+
// Write locally
|
|
531
|
+
await localDB.save(data);
|
|
532
|
+
|
|
533
|
+
// Replicate to other regions asynchronously
|
|
534
|
+
replicateToRegions(data);
|
|
535
|
+
};
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
### Region-Specific Configuration
|
|
539
|
+
|
|
540
|
+
```toml
|
|
541
|
+
# fly.toml
|
|
542
|
+
[env]
|
|
543
|
+
LOG_LEVEL = "info"
|
|
544
|
+
|
|
545
|
+
[processes]
|
|
546
|
+
web = "node server.js"
|
|
547
|
+
|
|
548
|
+
# Override per region if needed via secrets
|
|
549
|
+
# fly secrets set CONFIG_IAD=value --region iad
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
## Troubleshooting
|
|
553
|
+
|
|
554
|
+
### Uneven Traffic Distribution
|
|
555
|
+
|
|
556
|
+
```bash
|
|
557
|
+
# Check instance health
|
|
558
|
+
fly status --all
|
|
559
|
+
|
|
560
|
+
# Restart unhealthy instances
|
|
561
|
+
fly restart --region iad
|
|
562
|
+
|
|
563
|
+
# Check health checks
|
|
564
|
+
fly checks list
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### High Latency in Specific Region
|
|
568
|
+
|
|
569
|
+
```bash
|
|
570
|
+
# Test from that region
|
|
571
|
+
fly ssh console --region lhr -C "curl localhost:8080/health"
|
|
572
|
+
|
|
573
|
+
# Check database connection
|
|
574
|
+
fly ssh console --region lhr -C "ping database.internal"
|
|
575
|
+
|
|
576
|
+
# Consider adding database replica in that region
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
### Instance Not Starting in Region
|
|
580
|
+
|
|
581
|
+
```bash
|
|
582
|
+
# Check events
|
|
583
|
+
fly events --region iad
|
|
584
|
+
|
|
585
|
+
# View detailed status
|
|
586
|
+
fly status --json | jq '.allocations[] | select(.region=="iad")'
|
|
587
|
+
|
|
588
|
+
# Try manual allocation
|
|
589
|
+
fly scale count 2 --region iad
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
## References
|
|
593
|
+
|
|
594
|
+
- [Fly.io Regions](https://fly.io/docs/reference/regions/)
|
|
595
|
+
- [Multi-Region Postgres](https://fly.io/docs/postgres/high-availability-and-global-replication/)
|
|
596
|
+
- [LiteFS for SQLite](https://fly.io/docs/litefs/)
|
|
597
|
+
- [Anycast Routing](https://fly.io/docs/reference/anycast/)
|
|
598
|
+
- [Private Networking](https://fly.io/docs/reference/private-networking/)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Google Cloud Deployment Module
|
|
2
|
+
|
|
3
|
+
Deft guidance for deploying applications to Google Cloud Platform.
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
- ! Optional module
|
|
8
|
+
- ~ Good for Deft usage
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Google Cloud offers serverless to full infrastructure control deployment options.
|
|
13
|
+
|
|
14
|
+
## Deployment Methods
|
|
15
|
+
|
|
16
|
+
| File | Method | Best For |
|
|
17
|
+
|------|--------|----------|
|
|
18
|
+
| `via-cloud-run.md` | Cloud Run | Containerized web apps, serverless containers (default) |
|
|
19
|
+
| `via-app-engine.md` | App Engine | Traditional PaaS, opinionated runtimes |
|
|
20
|
+
| `via-cloud-functions.md` | Cloud Functions | Serverless functions, event-driven code |
|
|
21
|
+
| `via-gke.md` | Google Kubernetes Engine | Complex Kubernetes workloads |
|
|
22
|
+
|
|
23
|
+
## Quick Decision Guide
|
|
24
|
+
|
|
25
|
+
- **Default path**: `via-cloud-run.md` — `gcloud run deploy` for most containerized apps
|
|
26
|
+
- **Traditional PaaS**: `via-app-engine.md` — `gcloud app deploy` for managed runtimes
|
|
27
|
+
- **Serverless functions**: `via-cloud-functions.md` — event-driven compute
|
|
28
|
+
- **Kubernetes needs**: `via-gke.md` — full K8s control for complex architectures
|
|
29
|
+
|
|
30
|
+
## References
|
|
31
|
+
|
|
32
|
+
- [Google Cloud Hosting Options](https://cloud.google.com/hosting-options)
|
|
33
|
+
- [Cloud Run Documentation](https://cloud.google.com/run)
|
|
34
|
+
- [App Engine Documentation](https://cloud.google.com/appengine)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Deploy via App Engine
|
|
2
|
+
|
|
3
|
+
Deploy applications using Google App Engine. Fully managed PaaS with automatic scaling, load balancing, and monitoring.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
App Engine provides:
|
|
8
|
+
- **Managed Platform**: Zero infrastructure management
|
|
9
|
+
- **Auto-scaling**: Automatic traffic-based scaling
|
|
10
|
+
- **Multiple Runtimes**: Python, Java, Node.js, Go, PHP, Ruby
|
|
11
|
+
- **Built-in Services**: Memcache, Task Queue, Cron
|
|
12
|
+
- **Traffic Splitting**: Gradual rollouts
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Deploy application
|
|
18
|
+
gcloud app deploy
|
|
19
|
+
|
|
20
|
+
# View application
|
|
21
|
+
gcloud app browse
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## app.yaml Configuration
|
|
25
|
+
|
|
26
|
+
```yaml
|
|
27
|
+
runtime: python311
|
|
28
|
+
|
|
29
|
+
instance_class: F2
|
|
30
|
+
|
|
31
|
+
automatic_scaling:
|
|
32
|
+
min_instances: 1
|
|
33
|
+
max_instances: 10
|
|
34
|
+
target_cpu_utilization: 0.65
|
|
35
|
+
|
|
36
|
+
env_variables:
|
|
37
|
+
APP_ENV: "production"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## References
|
|
41
|
+
|
|
42
|
+
- [App Engine Documentation](https://cloud.google.com/appengine/docs)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Deploy via Cloud Functions
|
|
2
|
+
|
|
3
|
+
Deploy serverless functions using Google Cloud Functions. Event-driven compute with automatic scaling.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Deploy HTTP function
|
|
9
|
+
gcloud functions deploy myfunction \
|
|
10
|
+
--runtime python311 \
|
|
11
|
+
--trigger-http \
|
|
12
|
+
--allow-unauthenticated \
|
|
13
|
+
--entry-point hello_world
|
|
14
|
+
|
|
15
|
+
# Deploy event-driven function
|
|
16
|
+
gcloud functions deploy myfunction \
|
|
17
|
+
--runtime nodejs18 \
|
|
18
|
+
--trigger-topic my-topic
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## References
|
|
22
|
+
|
|
23
|
+
- [Cloud Functions Documentation](https://cloud.google.com/functions/docs)
|