-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c47325f
commit b345c51
Showing
14 changed files
with
180 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: Access the Control Panel | ||
description: You'll manage your Homestar node and its view of the Everywhere Computer network via the Control Panel. | ||
sidebar: | ||
order: 4 | ||
--- | ||
|
||
You'll manage your Homestar node and its view of the Everywhere Computer network via the Control Panel: [control.everywhere.computer](https://control.everywhere.computer/) | ||
|
||
Now that Everywhere Computer (via `homestar`) and IPFS (via `kubo`) are running locally, it's time to experiment by [running a workflow](../run-a-workflow). | ||
|
||
:::note[Want to run it local?] | ||
The exercises in our Getting Started guides are written for the hosted version of the control panel, for ease of setup. In the spirit of local-first software, of course you can also [run it locally](../control-panel/running-it-locally). | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
title: Intro | ||
description: Write and run your first custom functions on the Everywhere Computer. | ||
sidebar: | ||
order: 1 | ||
--- | ||
|
||
:::tip[Before you continue] | ||
We highly recommend following the [Quick Start](../quick-start) guide that makes use of the `every cli`, which is the path we will be putting more energy into supporting in the near future. | ||
|
||
However, this Manual Setup guide does contain additional information about the platform, which may be helpful for a deeper understanding of the system. | ||
::: | ||
|
||
This Getting Started guide will help you manually: | ||
|
||
1. **Prepare** IPFS on your local machine — a dependency of the Everywhere Computer | ||
2. **Setup** your local node | ||
3. **Access** the Everywhere Computer control panel | ||
4. **Run & Customize** workflows | ||
6. **Write** custom functions in JavaScript, Rust or Python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
title: Prepare IPFS | ||
description: IPFS helps make the Everywhere Computer portable and durable. | ||
sidebar: | ||
order: 2 | ||
--- | ||
|
||
The Everywhere Computer is both portable and durable. These two traits are made possible by [IPFS’ content addressing](https://fission.codes/blog/content-addressing-what-it-is-and-how-it-works/) and WebAssembly's ability to execute in _any_ environment — including browsers. | ||
|
||
## 1. Install IPFS | ||
|
||
Just as the Everywhere Computer is powered by Homestar nodes, IPFS is powered by kubo nodes — the GoLang IPFS implementation. You have two options for installing it: | ||
|
||
1. Install the kubo binary directly: [https://docs.ipfs.tech/install/command-line/#install-official-binary-distributions](https://docs.ipfs.tech/install/command-line/#install-official-binary-distributions) | ||
2. or, install IPFS Desktop GUI which includes kubo: [https://docs.ipfs.tech/install/ipfs-desktop/](https://docs.ipfs.tech/install/ipfs-desktop/) | ||
|
||
## 2. Run IPFS | ||
|
||
Make sure kubo is running! Either by launching IPFS Desktop, or running `ipfs daemon` in your terminal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
title: Quick Start | ||
description: Use the `every cli` to write and run custom functions within 5 minutes. | ||
--- | ||
|
||
Get introduced to the Everywhere Computer's core concepts while using the `every cli` to write and run custom functions on your local machine: | ||
|
||
```shell | ||
npm i -g @everywhere-computer/every-cli | ||
``` | ||
|
||
## Setup & Run a Local IPFS Node | ||
|
||
The Everywhere Computer is both portable and durable. These two traits are made possible by [IPFS’ content addressing](https://fission.codes/blog/content-addressing-what-it-is-and-how-it-works/) and WebAssembly's ability to execute in _any_ environment — including browsers. | ||
|
||
If you are not already running an IPFS Kubo node on your local machine: | ||
1. Download & install the [IPFS Desktop](https://docs.ipfs.tech/install/ipfs-desktop/) client. | ||
2. Launch the IPFS Desktop client — this will ensure an IPFS node is running on your local machine. | ||
|
||
## Run Your First Function | ||
|
||
Clone down our [custom TypeScript functions repo](https://github.com/everywhere-computer/custom-homestar-functions-ts). In the `src/functions` directory you'll find four *very* basic functions: | ||
1. `add.ts` - adds two numbers together | ||
2. `concat.ts` - concatenates two strings | ||
3. `hello.ts` - a simple `hello ${world}` | ||
4. `message-and-number.ts` - concatenates together a string and a number | ||
|
||
### Boot Up The Everywhere Computer | ||
|
||
Let's beging with `hello.ts`. From the root directory of the repository run: | ||
|
||
```shell | ||
every dev --fn src/functions/hello.ts | ||
``` | ||
|
||
This should produce an output like the following in your terminal: | ||
```bash | ||
✔ Functions parsed and compiled | ||
✔ Homestar is running at http://127.0.0.1:8020 | ||
✔ Control Panel is running at http://127.0.0.1:4173 | ||
|
||
◐ Starting cloudflared tunnel to http://127.0.0.1:3000/ | ||
|
||
... a QR code ... | ||
|
||
➜ Local: http://127.0.0.1:3000/ | ||
➜ Tunnel: https://sometimes-comical-word-set.trycloudflare.com | ||
``` | ||
|
||
Everything is now ready to run your function: | ||
1. **The function has been compiled to WebAssembly (Wasm)** which is the Everywhere Computer's native format. | ||
2. **A local Homestar node** is running — these are what power the Everything Computer. | ||
3. **A local instance of the Control Panel** is running so that we can interact with our local Homestar node. | ||
4. **A Cloudflare tunnel** has been opened, enabling your function to be called over the public internet via an HTTP Gateway. | ||
|
||
### Run `hello` From The Control Panel | ||
|
||
Visit your local Control Panel at [http://127.0.0.1:4173](http://127.0.0.1:4173). You should see the following interface: | ||
|
||
![The Control Panel](./assets/quickstart-1.jpg) | ||
|
||
Enter a name and hit the "Run" button. You should see your first result! | ||
|
||
You may have noticed it took a moment to compile the result. Because of the Everywhere Computer's memoization, that result is now cached. If you hit run again, it should be nearly instantaneous — we skipped straight to the result. | ||
|
||
### Run `hello` From Your Phone | ||
|
||
Take out your phone and scan the QR code from your terminal. This will open the Cloudflare tunnel on your device. | ||
|
||
Append `hello?name=Gary` to the url (eg. https://YOUR-TUNNEL-URL/hello?name=test). Because of the content type of the response, your browser will likely download (or prompt you to download) a text file that reads "Hello Gary". | ||
|
||
Congrats! You've just run the Everywhere Computer over the internet. | ||
|
||
## Write A Multi-Function Workflow | ||
|
||
When you called that first sample function, it was wrapped with the input you proved as a `task` and executed as part of a `workflow`: a sequence of functions that define compute jobs to be run on the Everywhere Computer. Just to repeat: | ||
|
||
1. **A Function:** The code you've written that accepts inputs and returns an output | ||
2. **A Task:** Function + a specific set of Inputs | ||
3. **A Workflow:** Multiple tasks run in sequence | ||
|
||
Workflows can be big. They can be small. They can run in isolation. They can be composed together. | ||
|
||
Let's construct a two task workflow to test this out. To do this, we'll instruct the cli to compile both the `hello` and `concat` functions: | ||
|
||
```shell | ||
every dev --fn src/functions/hello.ts --fn src/functions/concat.ts | ||
``` | ||
|
||
![A Multi-Function Workflow](./assets/quickstart-2.jpg) | ||
|
||
## Next Steps | ||
|
||
For additional instructions on local development with the `every cli` — including writing custom functions in TypeScript and Rust — check out [Every CLI Usage](/everycli/local-dev). |