diff --git a/blueprints/warm-pool-user-machines.mdx b/blueprints/warm-pool-user-machines.mdx index c4c553d84b..ab60e56239 100644 --- a/blueprints/warm-pool-user-machines.mdx +++ b/blueprints/warm-pool-user-machines.mdx @@ -26,7 +26,7 @@ curl -X POST "https://api.machines.dev/v1/apps" \ -H "Authorization: Bearer ${FLY_API_TOKEN}" \ -H "Content-Type: application/json" \ -d '{ - "app_name": "pool-x7f3k2", + "name": "pool-x7f3k2", "org_slug": "my-org", "network": "pool-x7f3k2" }' diff --git a/machines/api/apps-resource.mdx b/machines/api/apps-resource.mdx index d864e2206c..4839bb5d2e 100644 --- a/machines/api/apps-resource.mdx +++ b/machines/api/apps-resource.mdx @@ -14,6 +14,10 @@ You can use the Apps resource to create and manage Fly Apps. A Fly App is an abs POST /v1/apps + + POST + /v1/apps/{'{app_name}'}/ip_assignments + GET /v1/apps/{'{app_name}'} @@ -38,7 +42,7 @@ Machines must be associated with a Fly App. App names must be unique. #### Body parameters - + Name of the app to create @@ -59,7 +63,7 @@ curl -i -X POST \\ -H "Authorization: Bearer ${FLY_API_TOKEN}" -H "Content-Type: application/json" \\ "${FLY_API_HOSTNAME}/v1/apps" \\ -d '{ - "app_name": "my-app-name", + "name": "my-app-name", "org_slug": "personal", "network": "my-optional-network" }' @@ -76,9 +80,37 @@ To segment the app into its own network, you can pass a `network` argument in th ## Allocate an IP address for global request routing -If you intend for Machines to be accessible to the internet, you’ll need to allocate an IP address to the app. Currently this is done using `flyctl` or the [Fly.io GraphQL API](https://api.fly.io/graphql). This offers your app automatic, global routing via [Anycast](/networking/services#about-anycast). Read more about this in [the Networking section](/machines/api/machines-resource#notes-on-networking). +`POST /v1/apps/{app_name}/ip_assignments` + +If you intend for Machines to be accessible to the internet, you’ll need to allocate an IP address to the app, with this endpoint or with `flyctl`. This offers your app automatic, global routing via [Anycast](/networking/services#about-anycast). Read more about this in [the Networking section](/machines/api/machines-resource#notes-on-networking). + +#### Body parameters + + + Type of IP address to allocate: `shared_v4` (an IPv4 address shared with other apps), `v4` (a dedicated IPv4 address), `v6`, or `private_v6` (a [Flycast](/networking/flycast) address). The [OpenAPI spec](https://docs.machines.dev/openapi.json) also lists the egress types. + + +```sh title="POST/v1/apps/{app_name}/ip_assignments" +curl -i -X POST \ + -H "Authorization: Bearer ${FLY_API_TOKEN}" -H "Content-Type: application/json" \ + "${FLY_API_HOSTNAME}/v1/apps/my-app-name/ip_assignments" \ + -d '{"type": "shared_v4"}' +``` + +```json title="Status: 200 OK - Example response" +{ + "ip": "66.241.125.240", + "region": null, + "service_name": null, + "shared": true, + "created_at": null, + "egress": false, + "network": null, + "ip_pair": null +} +``` -Example: +With flyctl: ```sh cmd diff --git a/machines/api/machines-resource.mdx b/machines/api/machines-resource.mdx index c82cb3c909..f2bacbaad4 100644 --- a/machines/api/machines-resource.mdx +++ b/machines/api/machines-resource.mdx @@ -482,7 +482,7 @@ Filter for a specific Machine `instance_id` (version). Required when waiting for -The time, in seconds, to wait for the Machine to enter the specified state. Default is 60. +The time, in seconds, to wait for the Machine to enter the specified state: a whole number from 1 to 60. Default is 60. diff --git a/model-context-protocol/deploy-with/machines-api.mdx b/model-context-protocol/deploy-with/machines-api.mdx index edfd5b46e7..faf2cef4d8 100644 --- a/model-context-protocol/deploy-with/machines-api.mdx +++ b/model-context-protocol/deploy-with/machines-api.mdx @@ -61,7 +61,7 @@ curl -i -X POST \ -H "Content-Type: application/json" \ "${FLY_API_HOSTNAME}/v1/apps" \ -d "{ \ - \"app_name\": \"${APP_NAME}\", \ + \"name\": \"${APP_NAME}\", \ \"org_slug\": \"${ORG}\" \ }" ``` @@ -70,46 +70,20 @@ Response should be a `200` Success, along with some JSON output. ## Create IP addresses for your application - -While the Fly.io GraphQL endpoint is public, our [usage of it](https://github.com/superfly/fly-go/blob/main/resource_ip_addresses.go) is [open source](https://github.com/superfly/fly-go/blob/main/LICENSE), can be directly observed by setting `LOG_LEVEL=debug` before running `flyctl` commands, and there are no current plans to change it, be aware that this interface is not guaranteed to be stable and can change without notice. If this is a concern, consider using the [`fly ips`](/flyctl/cmd/fly_ips) command instead. - - -The following will create a shared IPv4 address and a dedicated IPv6 address: +The following uses the [Allocate an IP address](/machines/api/apps-resource#allocate-an-ip-address-for-global-request-routing) API to create a shared IPv4 address and a dedicated IPv6 address: ```json curl -i -X POST \ -H "Authorization: Bearer ${FLY_API_TOKEN}" \ -H "Content-Type: application/json" \ - "https://api.fly.io/graphql" \ - -d @- <