@cardelli/ambit 0.3.5 → 0.4.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/README.md CHANGED
@@ -104,7 +104,7 @@ npx @cardelli/ambit share browsers group:team alice@example.com group:contractor
104
104
 
105
105
  This puts an app onto your private network. This is what you run whenever you want to host something. If the app doesn't exist yet, ambit creates it on the right network for you. The network can be specified as part of the name (`my-app.lab`) or with `--network` (`my-app --network lab`).
106
106
 
107
- Before deploying, ambit scans your config for settings that don't make sense on a private network (like `force_https`, which only matters for public traffic). After deploying, it checks that no public IPs were allocated, releases any that were, and verifies the app has a private address on the network you specified.
107
+ Before deploying, ambit scans your config for settings that don't make sense on a private network (like `force_https`, which only matters for public traffic). After deploying, it checks that no public IPs were allocated, releases any that were, and verifies the app has a private address on the network you specified. Three environment variables are set automatically: `AMBIT_APP_NAME`, `AMBIT_NETWORK_NAME`, and `AMBIT_OUTBOUND_PROXY`.
108
108
 
109
109
  There are three deployment modes. They are mutually exclusive — you can only use one at a time.
110
110
 
@@ -1 +1 @@
1
- {"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/deploy/machine.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACvB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAM/C,MAAM,MAAM,WAAW,GACnB,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,OAAO,GACP,UAAU,CAAC;AAMf,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE;QACL,mB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G,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,iBAAiB,CAAC;IACjC,KAAK,CAAC,EAAE;QACN,mBAAmB,EAAE,MAAM,CAAC;QAC5B,aAAa,EAAE,MAAM,CAAC;QACtB,mBAAmB,EAAE,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACjE,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;CACH;AAaD,eAAO,MAAM,mBAAmB,GAC9B,KAAK,MAAM,CAAC,YAAY,CAAC,EACzB,YAAY,WAAW,SAMxB,CAAC;AAMF,eAAO,MAAM,aAAa,GACxB,KAAK,SAAS,KACb,OAAO,CAAC,WAAW,CAMrB,CAAC;AAMF,eAAO,MAAM,gBAAgB,GAC3B,OAAO,WAAW,EAClB,KAAK,SAAS,KACb,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAiH7B,CAAC"}
@@ -59,11 +59,16 @@ export const deployTransition = async (phase, ctx) => {
59
59
  if (!ctx.created) {
60
60
  ctx.out.skip(`App '${ctx.flyAppName}' Exists`);
61
61
  }
62
+ const ambitSecrets = {
63
+ AMBIT_APP_NAME: ctx.app,
64
+ AMBIT_NETWORK_NAME: ctx.network,
65
+ };
62
66
  if (ctx.routerPrivateIp) {
63
67
  const proxyUrl = `socks5://[${ctx.routerPrivateIp}]:${SOCKS_PROXY_PORT}`;
64
- await ctx.out.spin("Setting Outbound Proxy", () => ctx.fly.secrets.set(ctx.flyAppName, { [SECRET_AMBIT_OUTBOUND_PROXY]: proxyUrl }, { stage: true }));
68
+ ambitSecrets[SECRET_AMBIT_OUTBOUND_PROXY] = proxyUrl;
65
69
  ctx.out.ok(`Outbound Proxy: ${proxyUrl}`);
66
70
  }
71
+ await ctx.out.spin("Staging Ambit Secrets", () => ctx.fly.secrets.set(ctx.flyAppName, ambitSecrets, { stage: true }));
67
72
  return Result.ok("deploy");
68
73
  }
69
74
  case "deploy": {
@@ -108,6 +108,20 @@ const stageAppChecks = async (fly, tailscale, org, report, app, network) => {
108
108
  report(`App Running (${app}.${network})`, started !== undefined, machines.length > 0
109
109
  ? `Machine State: ${machines[0].state}`
110
110
  : "No Machines Found");
111
+ const secrets = await fly.secrets.list(workload.appName);
112
+ const secretNames = new Set(secrets.map((s) => s.name));
113
+ const hasAmbitSecrets = secretNames.has("AMBIT_APP_NAME") &&
114
+ secretNames.has("AMBIT_NETWORK_NAME");
115
+ if (!hasAmbitSecrets) {
116
+ await fly.secrets.set(workload.appName, {
117
+ AMBIT_APP_NAME: app,
118
+ AMBIT_NETWORK_NAME: network,
119
+ });
120
+ report(`Ambit Secrets Set (${app}.${network})`, true, "Auto-configured");
121
+ }
122
+ else {
123
+ report(`Ambit Secrets Set (${app}.${network})`, true);
124
+ }
111
125
  const router = await findRouterApp(fly, org, network);
112
126
  if (!router) {
113
127
  report(`Router Exists (${network})`, false, `Create with: ambit create ${network}`);
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "@cardelli/ambit",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "Deploy apps to the cloud that only you and your AI agents can reach",
5
5
  "license": "MIT",
6
6
  "tasks": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cardelli/ambit",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "Deploy apps to the cloud that only you and your AI agents can reach",
5
5
  "license": "MIT",
6
6
  "scripts": {},