Skip to content

Commit 2335996

Browse files
authored
Merge pull request #137 from itowlson/spin-3.5
Spin 3.5 updates
2 parents 4c7fca0 + cf4923b commit 2335996

File tree

5 files changed

+54
-17
lines changed

5 files changed

+54
-17
lines changed

content/v3/cli-reference.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ The Spin CLI
4949

5050
* `add` — Scaffold a new component into an existing application
5151
* `build` — Build the Spin application
52-
* `deploy` — Package and upload an application to the Fermyon Cloud.
52+
* `deploy` — Package and upload an application to a deployment environment.
5353
* `doctor` — Detect and fix problems with Spin applications
54-
* `login` — Log into the Fermyon Cloud.
54+
* `login` — Log into a deployment environment.
5555
* `new` — Scaffold a new application based on a template
5656
* `plugins` — Install/uninstall Spin plugins
5757
* `registry` — Commands for working with OCI registries to distribute applications
@@ -100,7 +100,7 @@ Scaffold a new component into an existing application
100100
Build the Spin application
101101

102102
**Usage:** `spin USAGE:
103-
build [OPTIONS] [--] [UP_ARGS]...`
103+
build [OPTIONS] [UP_ARGS]...`
104104

105105
###### **Arguments:**
106106

@@ -111,14 +111,15 @@ Build the Spin application
111111
* `-c`, `--component-id <COMPONENT_ID>` — Component ID to build. This can be specified multiple times. The default is all components
112112
* `-f`, `--from <APP_MANIFEST_FILE>` — The application to build. This may be a manifest (spin.toml) file, or a directory containing a spin.toml file. If omitted, it defaults to "spin.toml"
113113
* `--help <HELP>` — Print help information
114+
* `--skip-target-checks <SKIP-TARGET-CHECKS>` — By default, if the application manifest specifies one or more deployment targets, Spin checks that all components are compatible with those deployment targets. Specify this option to bypass those target checks
114115
* `-u`, `--up <UP>` — Run the application after building
115116
* `--version <VERSION>` — Print version information
116117

117118

118119

119120
## `spin deploy`
120121

121-
Package and upload an application to the Fermyon Cloud.
122+
Package and upload an application to a deployment environment.
122123

123124
**Usage:** `spin USAGE:
124125
deploy`
@@ -151,7 +152,7 @@ Detect and fix problems with Spin applications
151152

152153
## `spin login`
153154

154-
Log into the Fermyon Cloud.
155+
Log into a deployment environment.
155156

156157
**Usage:** `spin USAGE:
157158
login`
@@ -259,9 +260,6 @@ List available or installed plugins
259260
* `--format <FORMAT>` — The format in which to list the templates
260261

261262
Default value: `plain`
262-
263-
Possible values: `plain`, `json`
264-
265263
* `--help <HELP>` — Print help information
266264
* `--installed <INSTALLED>` — List only installed plugins
267265
* `--summary <SUMMARY>` — List latest and installed versions of plugins
@@ -285,9 +283,6 @@ Search for plugins by name
285283
* `--format <FORMAT>` — The format in which to list the plugins
286284

287285
Default value: `plain`
288-
289-
Possible values: `plain`, `json`
290-
291286
* `--help <HELP>` — Print help information
292287
* `--version <VERSION>` — Print version information
293288

@@ -444,7 +439,7 @@ Push a Spin application to a registry
444439
###### **Options:**
445440

446441
* `--annotation <ANNOTATIONS>` — Specifies the OCI image manifest annotations (in key=value format). Any existing value will be overwritten. Can be used multiple times
447-
* `--build <BUILD>` — Specifies to perform `spin build` before pushing the application
442+
* `--build <BUILD>` — Specifies to perform `spin build` (with the default options) before pushing the application
448443
* `--cache-dir <CACHE_DIR>` — Cache directory for downloaded registry data
449444
* `--compose <COMPOSE>` — Compose component dependencies before pushing the application.
450445

@@ -566,7 +561,7 @@ Start the Spin application
566561

567562
###### **Options:**
568563

569-
* `--build <BUILD>` — For local apps, specifies to perform `spin build` before running the application.
564+
* `--build <BUILD>` — For local apps, specifies to perform `spin build` (with the default options) before running the application.
570565

571566
This is ignored on remote applications, as they are already built.
572567
* `-c`, `--component-id <COMPONENTS>`[Experimental] Component ID to run. This can be specified multiple times. The default is all components
@@ -614,4 +609,3 @@ Build and run the Spin application, rebuilding and restarting it when files chan
614609
This document was generated automatically by
615610
<a href="https://crates.io/crates/clap-markdown"><code>clap-markdown</code></a>.
616611
</i></small>
617-

content/v3/dynamic-configuration.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ url = "https://github.com/spinframework/spin-docs/blob/main/content/v3/dynamic-c
2323
- [LibSQL Storage Provider](#libsql-storage-provider)
2424
- [LLM Runtime Configuration](#llm-runtime-configuration)
2525
- [Remote Compute Provider](#remote-compute-provider)
26+
- [`default` API](#default-api)
27+
- [`open_ai` API](#open_ai-api)
2628

2729
You can change the configuration for Spin application features such as [application variables](./variables),
2830
[key value storage](./kv-store-api-guide), [SQL storage](./sqlite-api-guide)
@@ -389,10 +391,19 @@ The following is an example of how an application's `runtime-config.toml` file c
389391
type = "remote_http"
390392
url = "http://example.com"
391393
auth_token = "<auth_token>"
394+
api_type = "default"
392395
```
393396

394-
Currently, the remote compute option requires an user to deploy their own LLM proxy service. You can find a reference implementation of a proxy service in the [`spin-cloud-gpu plugin repository`](https://github.com/fermyon/spin-cloud-gpu/blob/main/fermyon-cloud-gpu/src/index.ts).
397+
By default, components will not have access to the LLM models unless granted explicit access through the `component.ai_models` entry in the component manifest within `spin.toml`. See [Serverless AI](./serverless-ai-api-guide) for more details.
398+
399+
Remote compute supports two APIs, selected using the `api_type` field.
400+
401+
#### `default` API
402+
403+
If the `api_type` is `default`, Spin uses its own "Cloud GPU" API. This requires you to deploy your own LLM proxy service. You can find a reference implementation of a proxy service in the [`spin-cloud-gpu plugin repository`](https://github.com/fermyon/spin-cloud-gpu/blob/main/fermyon-cloud-gpu/src/index.ts).
395404

396405
> If you have a Fermyon Cloud account, you can deploy a proxy service there using the [`cloud-gpu` plugin](https://github.com/fermyon/spin-cloud-gpu).
397406
398-
By default, components will not have access to the LLM models unless granted explicit access through the `component.ai_models` entry in the component manifest within `spin.toml`. See [Serverless AI](./serverless-ai-api-guide) for more details.
407+
#### `open_ai` API
408+
409+
If the `api_type` is `open_ai`, Spin uses the [OpenAI API](https://github.com/openai/openai-openapi). This API is offered by some commercial LLM providers.

content/v3/http-trigger.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ url = "https://github.com/spinframework/spin-docs/blob/main/content/v3/http-trig
1616
- [Getting Request and Response Information](#getting-request-and-response-information)
1717
- [Additional Request Information](#additional-request-information)
1818
- [Inside HTTP Components](#inside-http-components)
19+
- [Static Responses with the HTML Trigger](#static-responses-with-the-html-trigger)
1920
- [HTTP With Wagi (WebAssembly Gateway Interface)](#http-with-wagi-webassembly-gateway-interface)
2021
- [Wagi Component Requirements](#wagi-component-requirements)
2122
- [Request Handling in Wagi](#request-handling-in-wagi)
@@ -393,6 +394,24 @@ But if you wish, and if your language supports it, you can implement the `incomi
393394

394395
> The WASI family of specifications, and tool support for some component model features that WASI depends on, are not yet fully stabilized. If you implement `wasi-http` directly, you may need to do some trialing to find tool versions which work together and with Spin.
395396
397+
## Static Responses with the HTML Trigger
398+
399+
You can write short, static responses within the HTTP trigger by setting `static_response` (instead of `component`):
400+
401+
```toml
402+
# Example use case: fallback 404 handling
403+
[[trigger.http]]
404+
route = "/..."
405+
static_response = { status_code = 404, body = "not found" }
406+
407+
# Example use case: redirect
408+
[[trigger.http]]
409+
route = "/bob"
410+
static_response = { status_code = 302, headers = { location = "/users/bob" } }
411+
```
412+
413+
Static responses may have only text or empty bodies.
414+
396415
## HTTP With Wagi (WebAssembly Gateway Interface)
397416

398417
A number of languages support WASI Preview 1 but not the component model. To enable developers to use these languages, Spin supports an

content/v3/manifest-reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ Each array entry contains a mix of common fields and trigger-specific fields.
151151
| `executor` | Optional | Table | How Spin should invoke the component. If present, this is a table. The `type` key is required and may have the values `"spin"` or `"wagi"`. If omitted. the default is `{ type = "spin"}`. See [the HTTP trigger documentation](http-trigger) for details. | `{ type = "wagi" }` |
152152
| | | | If `type = "spin"` there are no other keys defined. In this case, Spin calls the component using a standard Wasm component interface. Components built using Spin SDKs or Spin interface files use this convention. | `{ type = "spin" }` |
153153
| | | | If `type = "wagi"`, Spin calls the component's "main" (`_start`) function using [a CGI-like interface](https://github.com/deislabs/wagi). Components built using languages or toolchains that do not support Wasm interfaces will need to be called in this way. In this case, the following additional keys may be set:<br/><br/>* `argv` (optional): The string representation of the `argv` list that should be passed into the handler. `${SCRIPT_NAME}` will be replaced with the script name, and `${ARGS}` will be replaced with the query parameters of the request, formatted as arguments. The default is to follow the CGI specification, and pass `${SCRIPT_NAME} ${ARGS}`<br/><br/>* `entrypoint` (optional): The name of the function to call as the entry point to this handler. By default, it is `_start` (which in most languages translates to `main` in the source code).<br/><br/>See [the HTTP trigger documentation](http-trigger) for details. | `{ type = "wagi" }` |
154+
| `static_response` | Optional | Table | The response Spin should give to requests on this route. A route may not specify both `static_response` and `component`. The response may contain the following fields, all optional:<br/><br/>* `status_code`: The HTTP status code. Default is 200.<br/><br/>* `headers`: Table of header names and values. Default is no headers.<br/><br/>* `body`: The response body. Default is no response body. | { status_code = 404, body = "not found" } |
154155

155156
### Additional Fields for `trigger.redis` Tables
156157

content/v3/writing-apps.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ url = "https://github.com/spinframework/spin-docs/blob/main/content/v3/writing-a
2727
- [Specifying Dependencies](#specifying-dependencies)
2828
- [Dependencies from a Registry](#dependencies-from-a-registry)
2929
- [Dependencies from a Local Component](#dependencies-from-a-local-component)
30+
- [Dependencies from a Component in the Application](#dependencies-from-a-component-in-the-application)
3031
- [Dependencies from a URL](#dependencies-from-a-url)
3132
- [Mapping All Imports from a Package](#mapping-all-imports-from-a-package)
3233
- [Dependency Permissions](#dependency-permissions)
@@ -454,7 +455,7 @@ During loading, Spin will download the package from the registry, locate its `se
454455
455456
### Specifying Dependencies
456457

457-
Spin supports three sources for dependencies.
458+
Spin supports four sources for dependencies.
458459

459460
#### Dependencies from a Registry
460461

@@ -483,6 +484,17 @@ To use a dependency from a component on your file system, specify the following
483484
| `path` | Required | The path to the Wasm file containing the component. | `"../validation/request-checker.wasm"` |
484485
| `export` | Optional | The name of the export in the package. If omitted, this defaults to the name of the import. | `"more-secure:checking-it-out/web"` |
485486

487+
#### Dependencies from a Component in the Application
488+
489+
You can use a component in your application as a dependency by specifying the following fields:
490+
491+
| Field | Required? | Description | Example |
492+
|------------|-------------|----------------------------------------------------------------------------------------------|---------|
493+
| `component` | Required | The name (ID) of the component. | `"request-checker"` |
494+
| `export` | Optional | The name of the export in the package. If omitted, this defaults to the name of the import. | `"more-secure:checking-it-out/web"` |
495+
496+
Components referenced as dependencies may not have any Spin runtime configuration, such as `files`, `allowed_outbound_hosts`, `variables`, etc., because these are determined by the 'main' component. They may have `build` sections.
497+
486498
#### Dependencies from a URL
487499

488500
To use a dependency from an HTTP URL, such as a GitHub release, specify the following fields:

0 commit comments

Comments
 (0)