Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big Compute docs clarification blitz #155

Merged
merged 25 commits into from
Aug 19, 2022
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b6d9362
fix: simplify wording, add relative links
LauraLangdon Jul 13, 2022
34f5736
fix: partial draft of updates
LauraLangdon Jul 22, 2022
90a813f
fix: next draft of updates
LauraLangdon Jul 23, 2022
280c81f
more draft
LauraLangdon Jul 28, 2022
4fdc1a1
more draft
LauraLangdon Jul 29, 2022
27e9a38
fix links, change wording
LauraLangdon Aug 2, 2022
452b1f6
more link fixes and wording changes
LauraLangdon Aug 2, 2022
cc4a1b5
make penultimate changes to some compute pages, fix pagination
LauraLangdon Aug 3, 2022
46264c0
link fixes
LauraLangdon Aug 4, 2022
bcaf34f
add deployment category
LauraLangdon Aug 4, 2022
cf9cdfe
fix: typo
Aug 11, 2022
dcd191f
specify greater Node version
LauraLangdon Aug 11, 2022
2661447
remove npm upgrade since npm upgrades with Node
LauraLangdon Aug 11, 2022
f10bd82
clarify instructions
LauraLangdon Aug 15, 2022
d9848d5
Update website/docs/compute/get-started.md
LauraLangdon Aug 11, 2022
9c1a1ea
Update website/docs/compute/customizing-functions/code-editor.md
LauraLangdon Aug 18, 2022
02f1204
Update website/docs/compute/using-api.md
LauraLangdon Aug 18, 2022
4f6e7af
Apply suggestions from code review
LauraLangdon Aug 18, 2022
aed1eff
fix whitespace, typos
LauraLangdon Aug 18, 2022
7730c66
add .idea to .gitignore
LauraLangdon Aug 18, 2022
8b3c40a
delete .idea
LauraLangdon Aug 18, 2022
dcada02
add back hook points section
LauraLangdon Aug 18, 2022
7b1100d
Apply suggestions from code review
LauraLangdon Aug 18, 2022
f154e07
add words to dictionary
LauraLangdon Aug 18, 2022
2f6c137
LauraLangdon Aug 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: partial draft of updates
LauraLangdon committed Jul 22, 2022

Verified

This commit was signed with the committer’s verified signature.
LauraLangdon Laura Langdon
commit 34f573678dffa6914d0cce3d6f0ff733f81f11eb
8 changes: 8 additions & 0 deletions website/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions website/.idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions website/.idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions website/.idea/markdown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions website/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions website/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions website/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions website/.idea/website.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ const suborbital = new Suborbital(configuration);

## Getting started

Using the [Compute APIs](../../api-reference/api-reference.md), this guide will use the Administrative and Execution APIs to get a list of available functions and execute one.
Using the [Compute APIs](docs/compute/api-reference/api-reference.md), this guide will use the Administrative and Execution APIs to get a list of available functions and execute one.

The Administrative APIs `getFunctions` method takes an object with a `userId` and a `namespace` and returns a list of available functions for that user in the provided namespace.

Original file line number Diff line number Diff line change
@@ -8,13 +8,13 @@ To install Compute in the cloud, you'll use the `subo` tool to automatically ins
* If you would like assistance with storage, [send us an email](mailto:[email protected])!
2. [Install the `kubectl` tool](https://kubernetes.io/docs/tasks/tools/#kubectl) and authenticate it with the cluster you want to use.
3. Ensure you have access to modify your company's DNS records, as you need to create a domain name for the builder service (it must run on HTTPS, which requires a domain)
4. Ensure you've run the `subo compute create token <email>` command from [Create an environment token](../quickstart/1.-create-an-environment-token-with-subo.md) before attempting the install
4. Ensure you've run the `subo compute create token <email>` command from [Create an environment token](docs/compute/Start here!/1.-create-an-environment-token-with-subo.md) before attempting the install

:::info
`subo` creates a `suborbital` Kubernetes namespace and installs the `KEDA` autoscaler. Don't worry about existing applications installed in the cluster; this won't affect them!
:::

Once you have the pre-requisites in place, navigate to the `suborbital` directory you created in the [quickstart guide](../quickstart/1.-create-an-environment-token-with-subo.md) and use `subo` to install:
Once you have the pre-requisites in place, navigate to the `suborbital` directory you created in the [quickstart guide](docs/compute/Start here!/1.-create-an-environment-token-with-subo.md) and use `subo` to install:

```bash
subo compute deploy core
6 changes: 2 additions & 4 deletions website/docs/compute/compute.md
Original file line number Diff line number Diff line change
@@ -3,15 +3,13 @@ pagination_prev: null
---
# Suborbital Compute

### The SaaS extensibility platform

![](/img/suborbital-logo-wide.svg)
![Suborbital logo](/img/suborbital-logo-wide.svg)

Suborbital Compute is a platform that allows your users to write and deploy
functions for your app, so they can develop custom integrations and
workflows. Our WebAssembly-based compute core lets you run user code within your infrastructure while being sure you're protected from malicious code.

Compute is now in public beta! We are excited for you to [give it a try](create-an-environment-token-with-subo)
Compute is now in public beta! We are excited for you to [give it a try](/get-started)
and send us your feedback.

Compute gives you everything you need to run your users' functions in a secure sandbox and integrate them into your product in whatever way makes sense for you. This includes a code editor, builder service, and an easy-to-use API.
179 changes: 179 additions & 0 deletions website/docs/compute/get-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
# Get started with Compute

## Installation

To use Compute, you need an environment token and the Subo command line
tool. This token allows the control plane to authenticate with the Suborbital Compute Network, our hosted service that manages billing, metadata storage, telemetry, and more.

### Install Subo: the Compute CLI

If you use macOS, you can use [Homebrew](https://brew.sh) to install the `subo` command line tool:

```bash
brew tap suborbital/subo
brew install subo
```

Then, run `subo --version` to ensure the installation was successful.

To install on Linux (or macOS without Homebrew), you can [download Subo directly](https://github.com/suborbital/subo/releases).

## Generate your token
You can get a Compute Environment token either with our [environment token generator web app](https://suborbital.network/) or with the `subo` command line tool.

:::info
The domain of your email address should match the `environment` you
configure for Compute; i.e., if your email is `[email protected]`, your
Compute environment would be called `com.awesomeco`. See [Fully-qualified
function names](,/concepts/fully-qualified-function-names.md) for more
information.
:::

To create your token, run:

```bash
subo compute create token <email>
```

A verification code will be sent to your email address, and the token will be
used to authenticate you and link your Compute installation to you.

**Subo will print out your token in your terminal, and cache it for use in
subsequent steps.**

Keep your environment token safe (store it in your password manager), and
only use it when running or installing Compute. If you lose it, just repeat
the token generation process.


## Run Compute locally

To run Compute locally, you'll use the Subo CLI and [Docker](https://docs.docker.com), both of which must be installed before continuing.

### Prepare your local environment

The Subo CLI will create some files on disk to set up your local deployment, so get started by creating a `suborbital` directory somewhere on your filesystem:

```bash
mkdir suborbital
cd suborbital
```

### Start Compute

Next, use Subo to start your local Compute Core instance:

```bash
subo compute deploy core --local
```

You may be asked to enter your Environment Token, and then Subo will use `docker-compose` to launch your Compute Core instance automatically. Compute runs in the background by default. You can use `docker-compose logs -f` to view the logs of the running containers. Run `docker-compose down` to terminate the containers.

### Run Compute
When you run Compute, it will wait for you to press enter to start a REPL
where you can add or edit functions (see [Meet the Compute Editor]()).

```
✅ DONE: ready to start installation
⏩ START: installing...
▶️ docker-compose up -d
Container suborbital-scc-control-plane-1 Recreate
Container suborbital-scc-control-plane-1 Recreated
Container suborbital-scc-atmo-1 Recreate
Container suborbital-scc-atmo-1 Recreated
Container suborbital-scc-control-plane-1 Starting
Container suborbital-scc-builder-1 Starting
Container suborbital-scc-control-plane-1 Started
Container suborbital-scc-builder-1 Started
Container suborbital-scc-atmo-1 Starting
Container suborbital-scc-atmo-1 Started
ℹ️ use `docker ps` and `docker-compose logs` to check deployment status
PROXY: local tunnel to function editor started
Press enter to launch the local Compute REPL...
1. Create or edit a function
Choose an option: 1
To create or edit a function, enter its name (or FQFN): new-fn
```

This will allow you to create functions and use the Compute editor locally
while you work on integrating your application. Follow the instructions in the REPL to create your first function.

## Meet the function editor

Compute functions are built, tested, deployed, and run through the Compute API.

The Suborbital Compute function editor uses the API to provide a low-friction environment for your users to write, build, test, and deploy functions to your Compute an instance in a single place.

Alternatively, the Builder API can be used programmatically, if that better
suits your use case. (see [Connect your application](/get-started#connect-your-application)).

### Compute function editor
A quick way to try the editor is to use the REPL built into the Subo CLI
introduced in [Run Compute Locally](get-started#run-compute-locally). The
Subo REPL includes a proxy that makes it easy to connect the hosted editor to your local Compute installation.

By default, it makes the editor accessible on [`local.suborbital.network:80`](http://local.suborbital.network:80/). The editor proxy port can be configured with the `subo compute deploy core --local --proxy-port <some port>` option.

The `local.suborbital.network` subdomain points to `127.0.0.1`, i.e. `localhost`. You may need to substitute a different hostname or IP address depending on your particular network setup.


#### Editor URLs

To edit a function via the editor, you—or more likely your application—must build a valid URL to pass to the editor. When working locally, the Subo REPL can generate editor URLs for you automatically.

In a **development environment**, the URL should have these components:

```
http://local.suborbital.network/?builder=http://local.suborbital.network:8082&token=ogbWUbzCZaYLga3GggP0cxht&ident=com.suborbital.acmeco&namespace=default&fn=foobar
```

In a **production environment**, the URL may look something like this:

```
https://editor.suborbital.network?builder=https://builder.acmeco.com&token=K78as0aslwi30l8h5lbF4lS7&ident=com.suborbital.customer&fn=add-record&template=rust
```

The important differences to note between these URLs are the local and public hostnames and HTTP and HTTPS schemes for the editor itself and the `&builder=` parameter.

For more information, check out our [complete documentation for each of the URL parameters](./integrate-the-function-editor/code-editor.md#configuration).

## Build, test and deploy functions

Once inside the editor, you can edit, build, test, and deploy your functions all in one place.

![Editor displaying a "Hello" function](assets/editor-screen.png)

### Executing functions
[]
Once your first function has been built and deployed, it can be run with a request to the Execution API.

```bash
export ENV_TOKEN=<your previously generated token>

curl http://local.suborbital.network:8080/com.suborbital.acmeco/default/hello/v1.0.0 \
--header "Authorization: Bearer $ENV_TOKEN" \
-d 'my friend'

hello, my friend
```
**Please note**: If you are invoking the Test API, you will need to import the [Editor Token](https://docs.suborbital.dev/integrate-the-function-editor/code-editor#editor-token) provided by the [Control Plane service](https://docs.suborbital.dev/concepts/data-plane-vs-control-plane#control-plane) [API](https://suborbital-compute.readme.io/reference/api-reference) instead of the Environment token in the code snippet above.

### Your first function

## Connect your application

Now that you have set up Compute and created your first function, use the Compute client libraries to start integrating functions into your application:

If your application is written in JavaScript or TypeScript in Node.js, use our [Node.js Library](./client-libraries/nodejs.md).

If your application is written in Go, use our [Go Library](./client-libraries/golang.md).

### API Reference
We also provide [reference documentation for each of the Compute APIs](https://suborbital-compute.readme.io/reference/api-reference).
9 changes: 0 additions & 9 deletions website/docs/compute/quickstart/connect-your-application.md

This file was deleted.

This file was deleted.

58 changes: 0 additions & 58 deletions website/docs/compute/quickstart/run-compute-locally.md

This file was deleted.

51 changes: 0 additions & 51 deletions website/docs/compute/quickstart/write-functions.md

This file was deleted.

11 changes: 1 addition & 10 deletions website/sidebars.js
Original file line number Diff line number Diff line change
@@ -34,16 +34,7 @@ module.exports = {
id: 'compute/compute',
},
items: [
{
'Quickstart': [
'compute/quickstart/create-an-environment-token-with-subo',
'compute/quickstart/run-compute-locally',
'compute/quickstart/write-functions',
'compute/quickstart/connect-your-application',
'compute/quickstart/client-libraries/nodejs',
'compute/quickstart/client-libraries/golang'
]
},
'compute/get-started',
{
'Concepts': [
'compute/concepts/data-plane-vs-control-plane',