milaidy 1.0.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.
Files changed (253) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +538 -0
  3. package/dist/argv-CfSowvEA.js +63 -0
  4. package/dist/config-B-mboG4v.js +4 -0
  5. package/dist/eliza-CPJjgw-e.js +1491 -0
  6. package/dist/eliza.js +2192 -0
  7. package/dist/entry.js +232 -0
  8. package/dist/index.js +209 -0
  9. package/dist/links-BFKlWqSe.js +15 -0
  10. package/dist/paths-D_yh1DEJ.js +69 -0
  11. package/dist/plugins-cli-B7kSre2c.js +134 -0
  12. package/dist/program-6KwWwKKh.js +510 -0
  13. package/dist/register.agents-CPVmSjMG.js +17 -0
  14. package/dist/register.browser-B2ooXxNx.js +15 -0
  15. package/dist/register.channels-CMYQ6K6Y.js +42 -0
  16. package/dist/register.cron-D91lY1_Y.js +9 -0
  17. package/dist/register.devices-rU5I5L_y.js +13 -0
  18. package/dist/register.gateway-82SLAvw3.js +22 -0
  19. package/dist/register.hooks-B_XTBEkt.js +9 -0
  20. package/dist/register.logs-BgEGcPd8.js +10 -0
  21. package/dist/register.models-BJt9eVgZ.js +26 -0
  22. package/dist/register.nodes-B5xY1s8a.js +9 -0
  23. package/dist/register.skills-SFQqYIhg.js +10 -0
  24. package/dist/register.subclis-uF_AsbWR.js +187 -0
  25. package/dist/run-main-XODklzS-.js +56 -0
  26. package/dist/theme-DBvtuGeq.js +36 -0
  27. package/dist/utils-C1AUpp_V.js +42 -0
  28. package/dist/version-Cpn3yr5D.js +26 -0
  29. package/dist/workspace-Co3Wul2D.js +206 -0
  30. package/dist/workspace-DCA6MNVK.js +350 -0
  31. package/docs/.i18n/README.md +31 -0
  32. package/docs/.i18n/glossary.zh-CN.json +210 -0
  33. package/docs/.i18n/zh-CN.tm.jsonl +1329 -0
  34. package/docs/CNAME +1 -0
  35. package/docs/automation/cron-jobs.md +468 -0
  36. package/docs/automation/cron-vs-heartbeat.md +254 -0
  37. package/docs/automation/gmail-pubsub.md +256 -0
  38. package/docs/automation/poll.md +69 -0
  39. package/docs/automation/webhook.md +163 -0
  40. package/docs/bedrock.md +176 -0
  41. package/docs/brave-search.md +41 -0
  42. package/docs/broadcast-groups.md +442 -0
  43. package/docs/cli/acp.md +170 -0
  44. package/docs/cli/agent.md +24 -0
  45. package/docs/cli/agents.md +75 -0
  46. package/docs/cli/approvals.md +50 -0
  47. package/docs/cli/browser.md +107 -0
  48. package/docs/cli/channels.md +79 -0
  49. package/docs/cli/config.md +50 -0
  50. package/docs/cli/configure.md +33 -0
  51. package/docs/cli/cron.md +42 -0
  52. package/docs/cli/dashboard.md +16 -0
  53. package/docs/cli/devices.md +67 -0
  54. package/docs/cli/directory.md +63 -0
  55. package/docs/cli/dns.md +23 -0
  56. package/docs/cli/docs.md +15 -0
  57. package/docs/cli/doctor.md +41 -0
  58. package/docs/cli/gateway.md +199 -0
  59. package/docs/cli/health.md +21 -0
  60. package/docs/cli/hooks.md +291 -0
  61. package/docs/cli/index.md +1029 -0
  62. package/docs/cli/logs.md +24 -0
  63. package/docs/cli/memory.md +45 -0
  64. package/docs/cli/message.md +239 -0
  65. package/docs/cli/models.md +79 -0
  66. package/docs/cli/node.md +112 -0
  67. package/docs/cli/nodes.md +73 -0
  68. package/docs/cli/onboard.md +29 -0
  69. package/docs/cli/pairing.md +21 -0
  70. package/docs/cli/plugins.md +62 -0
  71. package/docs/cli/reset.md +17 -0
  72. package/docs/cli/sandbox.md +152 -0
  73. package/docs/cli/security.md +26 -0
  74. package/docs/cli/sessions.md +16 -0
  75. package/docs/cli/setup.md +29 -0
  76. package/docs/cli/skills.md +26 -0
  77. package/docs/cli/status.md +26 -0
  78. package/docs/cli/system.md +60 -0
  79. package/docs/cli/tui.md +23 -0
  80. package/docs/cli/uninstall.md +17 -0
  81. package/docs/cli/update.md +98 -0
  82. package/docs/cli/voicecall.md +34 -0
  83. package/docs/cli/webhooks.md +25 -0
  84. package/docs/concepts/agent-loop.md +146 -0
  85. package/docs/concepts/agent-workspace.md +229 -0
  86. package/docs/concepts/agent.md +122 -0
  87. package/docs/concepts/architecture.md +129 -0
  88. package/docs/concepts/channel-routing.md +114 -0
  89. package/docs/concepts/compaction.md +61 -0
  90. package/docs/concepts/context.md +159 -0
  91. package/docs/concepts/features.md +53 -0
  92. package/docs/concepts/group-messages.md +84 -0
  93. package/docs/concepts/groups.md +373 -0
  94. package/docs/concepts/markdown-formatting.md +130 -0
  95. package/docs/concepts/memory.md +546 -0
  96. package/docs/concepts/messages.md +154 -0
  97. package/docs/concepts/model-failover.md +149 -0
  98. package/docs/concepts/model-providers.md +315 -0
  99. package/docs/concepts/models.md +208 -0
  100. package/docs/concepts/multi-agent.md +376 -0
  101. package/docs/concepts/oauth.md +145 -0
  102. package/docs/concepts/plugins.md +454 -0
  103. package/docs/concepts/presence.md +102 -0
  104. package/docs/concepts/queue.md +89 -0
  105. package/docs/concepts/retry.md +69 -0
  106. package/docs/concepts/secrets.md +300 -0
  107. package/docs/concepts/session-pruning.md +122 -0
  108. package/docs/concepts/session-tool.md +193 -0
  109. package/docs/concepts/session.md +188 -0
  110. package/docs/concepts/sessions.md +10 -0
  111. package/docs/concepts/skills.md +392 -0
  112. package/docs/concepts/streaming.md +135 -0
  113. package/docs/concepts/system-prompt.md +114 -0
  114. package/docs/concepts/timezone.md +91 -0
  115. package/docs/concepts/typebox.md +289 -0
  116. package/docs/concepts/typing-indicators.md +68 -0
  117. package/docs/concepts/usage-tracking.md +35 -0
  118. package/docs/custom.css +4 -0
  119. package/docs/date-time.md +128 -0
  120. package/docs/debugging.md +162 -0
  121. package/docs/docs.json +1599 -0
  122. package/docs/environment.md +81 -0
  123. package/docs/hooks.md +876 -0
  124. package/docs/index.md +179 -0
  125. package/docs/install/ansible.md +208 -0
  126. package/docs/install/bun.md +59 -0
  127. package/docs/install/development-channels.md +75 -0
  128. package/docs/install/docker.md +567 -0
  129. package/docs/install/index.md +185 -0
  130. package/docs/install/installer.md +123 -0
  131. package/docs/install/migrating.md +192 -0
  132. package/docs/install/nix.md +96 -0
  133. package/docs/install/node.md +78 -0
  134. package/docs/install/uninstall.md +128 -0
  135. package/docs/install/updating.md +228 -0
  136. package/docs/logging.md +350 -0
  137. package/docs/multi-agent-sandbox-tools.md +395 -0
  138. package/docs/network.md +54 -0
  139. package/docs/nodes/audio.md +114 -0
  140. package/docs/nodes/camera.md +156 -0
  141. package/docs/nodes/images.md +72 -0
  142. package/docs/nodes/index.md +341 -0
  143. package/docs/nodes/location-command.md +113 -0
  144. package/docs/nodes/media-understanding.md +379 -0
  145. package/docs/nodes/talk.md +90 -0
  146. package/docs/nodes/voicewake.md +65 -0
  147. package/docs/northflank.mdx +53 -0
  148. package/docs/perplexity.md +80 -0
  149. package/docs/platforms/android.md +129 -0
  150. package/docs/platforms/digitalocean.md +262 -0
  151. package/docs/platforms/exe-dev.md +125 -0
  152. package/docs/platforms/fly.md +486 -0
  153. package/docs/platforms/gcp.md +503 -0
  154. package/docs/platforms/hetzner.md +330 -0
  155. package/docs/platforms/index.md +53 -0
  156. package/docs/platforms/ios.md +106 -0
  157. package/docs/platforms/linux.md +94 -0
  158. package/docs/platforms/mac/bundled-gateway.md +73 -0
  159. package/docs/platforms/mac/canvas.md +125 -0
  160. package/docs/platforms/mac/child-process.md +69 -0
  161. package/docs/platforms/mac/dev-setup.md +102 -0
  162. package/docs/platforms/mac/health.md +34 -0
  163. package/docs/platforms/mac/icon.md +31 -0
  164. package/docs/platforms/mac/logging.md +57 -0
  165. package/docs/platforms/mac/menu-bar.md +81 -0
  166. package/docs/platforms/mac/peekaboo.md +65 -0
  167. package/docs/platforms/mac/permissions.md +44 -0
  168. package/docs/platforms/mac/release.md +85 -0
  169. package/docs/platforms/mac/remote.md +83 -0
  170. package/docs/platforms/mac/signing.md +47 -0
  171. package/docs/platforms/mac/skills.md +33 -0
  172. package/docs/platforms/mac/voice-overlay.md +60 -0
  173. package/docs/platforms/mac/voicewake.md +67 -0
  174. package/docs/platforms/mac/webchat.md +41 -0
  175. package/docs/platforms/mac/xpc.md +61 -0
  176. package/docs/platforms/macos-vm.md +281 -0
  177. package/docs/platforms/macos.md +203 -0
  178. package/docs/platforms/oracle.md +303 -0
  179. package/docs/platforms/raspberry-pi.md +358 -0
  180. package/docs/platforms/windows.md +159 -0
  181. package/docs/plugin.md +651 -0
  182. package/docs/plugins/agent-tools.md +99 -0
  183. package/docs/plugins/manifest.md +71 -0
  184. package/docs/plugins/voice-call.md +273 -0
  185. package/docs/plugins/zalouser.md +70 -0
  186. package/docs/providers/anthropic.md +152 -0
  187. package/docs/providers/claude-max-api-proxy.md +148 -0
  188. package/docs/providers/cloudflare-ai-gateway.md +71 -0
  189. package/docs/providers/deepgram.md +93 -0
  190. package/docs/providers/glm.md +33 -0
  191. package/docs/providers/index.md +63 -0
  192. package/docs/providers/minimax.md +208 -0
  193. package/docs/providers/models.md +51 -0
  194. package/docs/providers/moonshot.md +142 -0
  195. package/docs/providers/ollama.md +223 -0
  196. package/docs/providers/openai.md +62 -0
  197. package/docs/providers/opencode.md +36 -0
  198. package/docs/providers/openrouter.md +37 -0
  199. package/docs/providers/qwen.md +53 -0
  200. package/docs/providers/synthetic.md +99 -0
  201. package/docs/providers/venice.md +267 -0
  202. package/docs/providers/vercel-ai-gateway.md +50 -0
  203. package/docs/providers/xiaomi.md +64 -0
  204. package/docs/providers/zai.md +36 -0
  205. package/docs/railway.mdx +99 -0
  206. package/docs/reference/templates/AGENTS.md +9 -0
  207. package/docs/reference/templates/BOOTSTRAP.md +3 -0
  208. package/docs/reference/templates/HEARTBEAT.md +3 -0
  209. package/docs/reference/templates/IDENTITY.md +3 -0
  210. package/docs/reference/templates/TOOLS.md +3 -0
  211. package/docs/reference/templates/USER.md +3 -0
  212. package/docs/render.mdx +165 -0
  213. package/docs/start/docs-directory.md +63 -0
  214. package/docs/start/getting-started.md +212 -0
  215. package/docs/start/milaidy.md +247 -0
  216. package/docs/start/onboarding.md +258 -0
  217. package/docs/start/pairing.md +86 -0
  218. package/docs/start/quickstart.md +81 -0
  219. package/docs/start/setup.md +149 -0
  220. package/docs/start/showcase.md +416 -0
  221. package/docs/start/wizard.md +418 -0
  222. package/docs/testing.md +368 -0
  223. package/docs/token-use.md +112 -0
  224. package/docs/tools/agent-send.md +53 -0
  225. package/docs/tools/apply-patch.md +50 -0
  226. package/docs/tools/browser-linux-troubleshooting.md +139 -0
  227. package/docs/tools/browser-login.md +68 -0
  228. package/docs/tools/browser.md +576 -0
  229. package/docs/tools/chrome-extension.md +178 -0
  230. package/docs/tools/clawhub.md +257 -0
  231. package/docs/tools/creating-skills.md +54 -0
  232. package/docs/tools/elevated.md +57 -0
  233. package/docs/tools/exec-approvals.md +246 -0
  234. package/docs/tools/exec.md +179 -0
  235. package/docs/tools/firecrawl.md +61 -0
  236. package/docs/tools/index.md +508 -0
  237. package/docs/tools/llm-task.md +115 -0
  238. package/docs/tools/reactions.md +22 -0
  239. package/docs/tools/skills-config.md +76 -0
  240. package/docs/tools/skills.md +300 -0
  241. package/docs/tools/slash-commands.md +196 -0
  242. package/docs/tools/subagents.md +151 -0
  243. package/docs/tools/thinking.md +73 -0
  244. package/docs/tools/web.md +261 -0
  245. package/docs/tui.md +159 -0
  246. package/docs/vps.md +43 -0
  247. package/docs/web/control-ui.md +221 -0
  248. package/docs/web/dashboard.md +46 -0
  249. package/docs/web/index.md +116 -0
  250. package/docs/web/webchat.md +49 -0
  251. package/milaidy.mjs +14 -0
  252. package/package.json +271 -0
  253. package/skills/.cache/catalog.json +88519 -0
@@ -0,0 +1,486 @@
1
+ ---
2
+ title: Fly.io
3
+ description: Deploy Milaidy on Fly.io
4
+ ---
5
+
6
+ # Fly.io Deployment
7
+
8
+ **Goal:** Milaidy Gateway running on a [Fly.io](https://fly.io) machine with persistent storage, automatic HTTPS, and Discord/channel access.
9
+
10
+ ## What you need
11
+
12
+ - [flyctl CLI](https://fly.io/docs/hands-on/install-flyctl/) installed
13
+ - Fly.io account (free tier works)
14
+ - Model auth: Anthropic API key (or other provider keys)
15
+ - Channel credentials: Discord bot token, Telegram token, etc.
16
+
17
+ ## Beginner quick path
18
+
19
+ 1. Clone repo → customize `fly.toml`
20
+ 2. Create app + volume → set secrets
21
+ 3. Deploy with `fly deploy`
22
+ 4. SSH in to create config or use Control UI
23
+
24
+ ## 1) Create the Fly app
25
+
26
+ ```bash
27
+ # Clone the repo
28
+ git clone https://github.com/milaidy/milaidy.git
29
+ cd milaidy
30
+
31
+ # Create a new Fly app (pick your own name)
32
+ fly apps create my-milaidy
33
+
34
+ # Create a persistent volume (1GB is usually enough)
35
+ fly volumes create milaidy_data --size 1 --region iad
36
+ ```
37
+
38
+ **Tip:** Choose a region close to you. Common options: `lhr` (London), `iad` (Virginia), `sjc` (San Jose).
39
+
40
+ ## 2) Configure fly.toml
41
+
42
+ Edit `fly.toml` to match your app name and requirements.
43
+
44
+ **Security note:** The default config exposes a public URL. For a hardened deployment with no public IP, see [Private Deployment](#private-deployment-hardened) or use `fly.private.toml`.
45
+
46
+ ```toml
47
+ app = "my-milaidy" # Your app name
48
+ primary_region = "iad"
49
+
50
+ [build]
51
+ dockerfile = "Dockerfile"
52
+
53
+ [env]
54
+ NODE_ENV = "production"
55
+ MILAIDY_PREFER_PNPM = "1"
56
+ MILAIDY_STATE_DIR = "/data"
57
+ NODE_OPTIONS = "--max-old-space-size=1536"
58
+
59
+ [processes]
60
+ app = "node dist/index.js gateway --allow-unconfigured --port 3000 --bind lan"
61
+
62
+ [http_service]
63
+ internal_port = 3000
64
+ force_https = true
65
+ auto_stop_machines = false
66
+ auto_start_machines = true
67
+ min_machines_running = 1
68
+ processes = ["app"]
69
+
70
+ [[vm]]
71
+ size = "shared-cpu-2x"
72
+ memory = "2048mb"
73
+
74
+ [mounts]
75
+ source = "milaidy_data"
76
+ destination = "/data"
77
+ ```
78
+
79
+ **Key settings:**
80
+
81
+ | Setting | Why |
82
+ | ------------------------------ | --------------------------------------------------------------------------- |
83
+ | `--bind lan` | Binds to `0.0.0.0` so Fly's proxy can reach the gateway |
84
+ | `--allow-unconfigured` | Starts without a config file (you'll create one after) |
85
+ | `internal_port = 3000` | Must match `--port 3000` (or `MILAIDY_GATEWAY_PORT`) for Fly health checks |
86
+ | `memory = "2048mb"` | 512MB is too small; 2GB recommended |
87
+ | `MILAIDY_STATE_DIR = "/data"` | Persists state on the volume |
88
+
89
+ ## 3) Set secrets
90
+
91
+ ```bash
92
+ # Required: Gateway token (for non-loopback binding)
93
+ fly secrets set MILAIDY_GATEWAY_TOKEN=$(openssl rand -hex 32)
94
+
95
+ # Model provider API keys
96
+ fly secrets set ANTHROPIC_API_KEY=sk-ant-...
97
+
98
+ # Optional: Other providers
99
+ fly secrets set OPENAI_API_KEY=sk-...
100
+ fly secrets set GOOGLE_API_KEY=...
101
+
102
+ # Channel tokens
103
+ fly secrets set DISCORD_BOT_TOKEN=MTQ...
104
+ ```
105
+
106
+ **Notes:**
107
+
108
+ - Non-loopback binds (`--bind lan`) require `MILAIDY_GATEWAY_TOKEN` for security.
109
+ - Treat these tokens like passwords.
110
+ - **Prefer env vars over config file** for all API keys and tokens. This keeps secrets out of `milaidy.json` where they could be accidentally exposed or logged.
111
+
112
+ ## 4) Deploy
113
+
114
+ ```bash
115
+ fly deploy
116
+ ```
117
+
118
+ First deploy builds the Docker image (~2-3 minutes). Subsequent deploys are faster.
119
+
120
+ After deployment, verify:
121
+
122
+ ```bash
123
+ fly status
124
+ fly logs
125
+ ```
126
+
127
+ You should see:
128
+
129
+ ```
130
+ [gateway] listening on ws://0.0.0.0:3000 (PID xxx)
131
+ [discord] logged in to discord as xxx
132
+ ```
133
+
134
+ ## 5) Create config file
135
+
136
+ SSH into the machine to create a proper config:
137
+
138
+ ```bash
139
+ fly ssh console
140
+ ```
141
+
142
+ Create the config directory and file:
143
+
144
+ ```bash
145
+ mkdir -p /data
146
+ cat > /data/milaidy.json << 'EOF'
147
+ {
148
+ "agents": {
149
+ "defaults": {
150
+ "model": {
151
+ "primary": "anthropic/claude-opus-4-5",
152
+ "fallbacks": ["anthropic/claude-sonnet-4-5", "openai/gpt-5"]
153
+ },
154
+ "maxConcurrent": 4
155
+ },
156
+ "list": [
157
+ {
158
+ "id": "main",
159
+ "default": true
160
+ }
161
+ ]
162
+ },
163
+ "auth": {
164
+ "profiles": {
165
+ "anthropic:default": { "mode": "token", "provider": "anthropic" },
166
+ "openai:default": { "mode": "token", "provider": "openai" }
167
+ }
168
+ },
169
+ "bindings": [
170
+ {
171
+ "agentId": "main",
172
+ "match": { "channel": "discord" }
173
+ }
174
+ ],
175
+ "channels": {
176
+ "discord": {
177
+ "enabled": true,
178
+ "groupPolicy": "allowlist",
179
+ "guilds": {
180
+ "YOUR_GUILD_ID": {
181
+ "channels": { "general": { "allow": true } },
182
+ "requireMention": false
183
+ }
184
+ }
185
+ }
186
+ },
187
+ "gateway": {
188
+ "mode": "local",
189
+ "bind": "auto"
190
+ },
191
+ "meta": {
192
+ "lastTouchedVersion": "2026.1.29"
193
+ }
194
+ }
195
+ EOF
196
+ ```
197
+
198
+ **Note:** With `MILAIDY_STATE_DIR=/data`, the config path is `/data/milaidy.json`.
199
+
200
+ **Note:** The Discord token can come from either:
201
+
202
+ - Environment variable: `DISCORD_BOT_TOKEN` (recommended for secrets)
203
+ - Config file: `channels.discord.token`
204
+
205
+ If using env var, no need to add token to config. The gateway reads `DISCORD_BOT_TOKEN` automatically.
206
+
207
+ Restart to apply:
208
+
209
+ ```bash
210
+ exit
211
+ fly machine restart <machine-id>
212
+ ```
213
+
214
+ ## 6) Access the Gateway
215
+
216
+ ### Control UI
217
+
218
+ Open in browser:
219
+
220
+ ```bash
221
+ fly open
222
+ ```
223
+
224
+ Or visit `https://my-milaidy.fly.dev/`
225
+
226
+ Paste your gateway token (the one from `MILAIDY_GATEWAY_TOKEN`) to authenticate.
227
+
228
+ ### Logs
229
+
230
+ ```bash
231
+ fly logs # Live logs
232
+ fly logs --no-tail # Recent logs
233
+ ```
234
+
235
+ ### SSH Console
236
+
237
+ ```bash
238
+ fly ssh console
239
+ ```
240
+
241
+ ## Troubleshooting
242
+
243
+ ### "App is not listening on expected address"
244
+
245
+ The gateway is binding to `127.0.0.1` instead of `0.0.0.0`.
246
+
247
+ **Fix:** Add `--bind lan` to your process command in `fly.toml`.
248
+
249
+ ### Health checks failing / connection refused
250
+
251
+ Fly can't reach the gateway on the configured port.
252
+
253
+ **Fix:** Ensure `internal_port` matches the gateway port (set `--port 3000` or `MILAIDY_GATEWAY_PORT=3000`).
254
+
255
+ ### OOM / Memory Issues
256
+
257
+ Container keeps restarting or getting killed. Signs: `SIGABRT`, `v8::internal::Runtime_AllocateInYoungGeneration`, or silent restarts.
258
+
259
+ **Fix:** Increase memory in `fly.toml`:
260
+
261
+ ```toml
262
+ [[vm]]
263
+ memory = "2048mb"
264
+ ```
265
+
266
+ Or update an existing machine:
267
+
268
+ ```bash
269
+ fly machine update <machine-id> --vm-memory 2048 -y
270
+ ```
271
+
272
+ **Note:** 512MB is too small. 1GB may work but can OOM under load or with verbose logging. **2GB is recommended.**
273
+
274
+ ### Gateway Lock Issues
275
+
276
+ Gateway refuses to start with "already running" errors.
277
+
278
+ This happens when the container restarts but the PID lock file persists on the volume.
279
+
280
+ **Fix:** Delete the lock file:
281
+
282
+ ```bash
283
+ fly ssh console --command "rm -f /data/gateway.*.lock"
284
+ fly machine restart <machine-id>
285
+ ```
286
+
287
+ The lock file is at `/data/gateway.*.lock` (not in a subdirectory).
288
+
289
+ ### Config Not Being Read
290
+
291
+ If using `--allow-unconfigured`, the gateway creates a minimal config. Your custom config at `/data/milaidy.json` should be read on restart.
292
+
293
+ Verify the config exists:
294
+
295
+ ```bash
296
+ fly ssh console --command "cat /data/milaidy.json"
297
+ ```
298
+
299
+ ### Writing Config via SSH
300
+
301
+ The `fly ssh console -C` command doesn't support shell redirection. To write a config file:
302
+
303
+ ```bash
304
+ # Use echo + tee (pipe from local to remote)
305
+ echo '{"your":"config"}' | fly ssh console -C "tee /data/milaidy.json"
306
+
307
+ # Or use sftp
308
+ fly sftp shell
309
+ > put /local/path/config.json /data/milaidy.json
310
+ ```
311
+
312
+ **Note:** `fly sftp` may fail if the file already exists. Delete first:
313
+
314
+ ```bash
315
+ fly ssh console --command "rm /data/milaidy.json"
316
+ ```
317
+
318
+ ### State Not Persisting
319
+
320
+ If you lose credentials or sessions after a restart, the state dir is writing to the container filesystem.
321
+
322
+ **Fix:** Ensure `MILAIDY_STATE_DIR=/data` is set in `fly.toml` and redeploy.
323
+
324
+ ## Updates
325
+
326
+ ```bash
327
+ # Pull latest changes
328
+ git pull
329
+
330
+ # Redeploy
331
+ fly deploy
332
+
333
+ # Check health
334
+ fly status
335
+ fly logs
336
+ ```
337
+
338
+ ### Updating Machine Command
339
+
340
+ If you need to change the startup command without a full redeploy:
341
+
342
+ ```bash
343
+ # Get machine ID
344
+ fly machines list
345
+
346
+ # Update command
347
+ fly machine update <machine-id> --command "node dist/index.js gateway --port 3000 --bind lan" -y
348
+
349
+ # Or with memory increase
350
+ fly machine update <machine-id> --vm-memory 2048 --command "node dist/index.js gateway --port 3000 --bind lan" -y
351
+ ```
352
+
353
+ **Note:** After `fly deploy`, the machine command may reset to what's in `fly.toml`. If you made manual changes, re-apply them after deploy.
354
+
355
+ ## Private Deployment (Hardened)
356
+
357
+ By default, Fly allocates public IPs, making your gateway accessible at `https://your-app.fly.dev`. This is convenient but means your deployment is discoverable by internet scanners (Shodan, Censys, etc.).
358
+
359
+ For a hardened deployment with **no public exposure**, use the private template.
360
+
361
+ ### When to use private deployment
362
+
363
+ - You only make **outbound** calls/messages (no inbound webhooks)
364
+ - You use **ngrok or Tailscale** tunnels for any webhook callbacks
365
+ - You access the gateway via **SSH, proxy, or WireGuard** instead of browser
366
+ - You want the deployment **hidden from internet scanners**
367
+
368
+ ### Setup
369
+
370
+ Use `fly.private.toml` instead of the standard config:
371
+
372
+ ```bash
373
+ # Deploy with private config
374
+ fly deploy -c fly.private.toml
375
+ ```
376
+
377
+ Or convert an existing deployment:
378
+
379
+ ```bash
380
+ # List current IPs
381
+ fly ips list -a my-milaidy
382
+
383
+ # Release public IPs
384
+ fly ips release <public-ipv4> -a my-milaidy
385
+ fly ips release <public-ipv6> -a my-milaidy
386
+
387
+ # Switch to private config so future deploys don't re-allocate public IPs
388
+ # (remove [http_service] or deploy with the private template)
389
+ fly deploy -c fly.private.toml
390
+
391
+ # Allocate private-only IPv6
392
+ fly ips allocate-v6 --private -a my-milaidy
393
+ ```
394
+
395
+ After this, `fly ips list` should show only a `private` type IP:
396
+
397
+ ```
398
+ VERSION IP TYPE REGION
399
+ v6 fdaa:x:x:x:x::x private global
400
+ ```
401
+
402
+ ### Accessing a private deployment
403
+
404
+ Since there's no public URL, use one of these methods:
405
+
406
+ **Option 1: Local proxy (simplest)**
407
+
408
+ ```bash
409
+ # Forward local port 3000 to the app
410
+ fly proxy 3000:3000 -a my-milaidy
411
+
412
+ # Then open http://localhost:3000 in browser
413
+ ```
414
+
415
+ **Option 2: WireGuard VPN**
416
+
417
+ ```bash
418
+ # Create WireGuard config (one-time)
419
+ fly wireguard create
420
+
421
+ # Import to WireGuard client, then access via internal IPv6
422
+ # Example: http://[fdaa:x:x:x:x::x]:3000
423
+ ```
424
+
425
+ **Option 3: SSH only**
426
+
427
+ ```bash
428
+ fly ssh console -a my-milaidy
429
+ ```
430
+
431
+ ### Webhooks with private deployment
432
+
433
+ If you need webhook callbacks (Twilio, Telnyx, etc.) without public exposure:
434
+
435
+ 1. **ngrok tunnel** - Run ngrok inside the container or as a sidecar
436
+ 2. **Tailscale Funnel** - Expose specific paths via Tailscale
437
+ 3. **Outbound-only** - Some providers (Twilio) work fine for outbound calls without webhooks
438
+
439
+ Example voice-call config with ngrok:
440
+
441
+ ```json
442
+ {
443
+ "plugins": {
444
+ "entries": {
445
+ "voice-call": {
446
+ "enabled": true,
447
+ "config": {
448
+ "provider": "twilio",
449
+ "tunnel": { "provider": "ngrok" },
450
+ "webhookSecurity": {
451
+ "allowedHosts": ["example.ngrok.app"]
452
+ }
453
+ }
454
+ }
455
+ }
456
+ }
457
+ }
458
+ ```
459
+
460
+ The ngrok tunnel runs inside the container and provides a public webhook URL without exposing the Fly app itself. Set `webhookSecurity.allowedHosts` to the public tunnel hostname so forwarded host headers are accepted.
461
+
462
+ ### Security benefits
463
+
464
+ | Aspect | Public | Private |
465
+ | ----------------- | ------------ | ---------- |
466
+ | Internet scanners | Discoverable | Hidden |
467
+ | Direct attacks | Possible | Blocked |
468
+ | Control UI access | Browser | Proxy/VPN |
469
+ | Webhook delivery | Direct | Via tunnel |
470
+
471
+ ## Notes
472
+
473
+ - Fly.io uses **x86 architecture** (not ARM)
474
+ - The Dockerfile is compatible with both architectures
475
+ - For WhatsApp/Telegram onboarding, use `fly ssh console`
476
+ - Persistent data lives on the volume at `/data`
477
+ - Signal requires Java + signal-cli; use a custom image and keep memory at 2GB+.
478
+
479
+ ## Cost
480
+
481
+ With the recommended config (`shared-cpu-2x`, 2GB RAM):
482
+
483
+ - ~$10-15/month depending on usage
484
+ - Free tier includes some allowance
485
+
486
+ See [Fly.io pricing](https://fly.io/docs/about/pricing/) for details.