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

docs: installation guide #62

Merged
merged 22 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
605532d
docs: installation guide
cold-briu Sep 24, 2023
aaf92c7
docs: codespace guide
cold-briu Sep 24, 2023
db3fce9
docs: added fuel nix
cold-briu Sep 24, 2023
a286bf7
docs: link to docs hub fuel installation guide
cold-briu Sep 25, 2023
9258380
docs: removed fuel nix
cold-briu Sep 27, 2023
e15931c
docs: remove fuel nix sub module
cold-briu Sep 27, 2023
76deb2c
docs: small copy fixes
cold-briu Sep 27, 2023
2719dfd
Merge branch 'master' into feature/installation-guide
sarahschwartz Sep 27, 2023
25088cc
Update docs/guides/docs/installation/index.mdx
cold-briu Sep 28, 2023
e71c4d1
Update docs/guides/docs/installation/index.mdx
cold-briu Sep 28, 2023
b36c8e2
Update docs/guides/docs/guides.json
cold-briu Sep 28, 2023
4302ee3
Update docs/guides/docs/installation/index.mdx
sarahschwartz Sep 28, 2023
b4a9e39
Update docs/guides/docs/installation/index.mdx
sarahschwartz Sep 28, 2023
2ce9e59
Update contentlayer.config.ts
sarahschwartz Sep 28, 2023
9c5b7bb
docs: linter format
cold-briu Sep 29, 2023
aca9dbb
Merge branch 'master' into feature/installation-guide
sarahschwartz Sep 29, 2023
1cdc1eb
docs: fix spelling and grammar
cold-briu Sep 29, 2023
8ecf130
docs: prereq instead of pre-req
cold-briu Oct 2, 2023
738f2b1
docs: fix spelling and grammar #2
cold-briu Oct 3, 2023
660d036
Merge branch 'feature/installation-guide-diverged' into feature/insta…
cold-briu Oct 4, 2023
3f957fc
bump: fuels and fuel-sdk due to audit
cold-briu Oct 4, 2023
c5cef4d
docs: adding line breaks and rewording
cold-briu Oct 4, 2023
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
4 changes: 3 additions & 1 deletion contentlayer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const includeDirs = [
'docs/fuel-graphql-docs/docs',
'docs/fuels-wallet/packages/docs/docs',
'docs/guides/docs',
// 'docs/fuel-nix/book/src',
// 'docs/about-fuel',
];

Expand All @@ -73,7 +74,8 @@ const excludeDirs = [
'docs/fuels-rs/docs/src/SUMMARY.md',
'docs/fuel-indexer/docs/src/SUMMARY.md',
'docs/fuel-specs/src/SUMMARY.md',
];
// 'docs/fuel-nix/book/src/SUMMARY.md',
];0
sarahschwartz marked this conversation as resolved.
Show resolved Hide resolved

export default makeSource({
contentDirPath: './',
Expand Down
4 changes: 4 additions & 0 deletions docs/guides/docs/guides.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"installation": {
"title": "Toolchain Installation",
"description": "Install the Fuel toolchain and binaries."
},
"quickstart": {
"title": "Developer Quickstart",
"description": "Get started by building a counter dApp in Fuel"
cold-briu marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
74 changes: 74 additions & 0 deletions docs/guides/docs/installation/codespace.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: Fuel Github Codespace
category: Installation
parent:
label: Guides
link: /guides
---

# Github Codespace

### Introduction

The way to think about [Github Codespaces](https://github.com/features/codespaces) is essentially VSCode in a browser. It’s a remote development environment that is extremely easy to spin up. While not all VSCode plugins are supported, the Sway LSP plugin is supported and works out of the box.

### How to set up for a new repo

1. Create a devcontainer.json file. The easiest way is by navigating to the repo and clicking Code → … → Configure dev container

<Box.Centered>
![dev contaienr walktrough](/images/dev-container.gif)
</Box.Centered>

2. Edit the file to include the following features:

```json
"features": {
"ghcr.io/devcontainers/features/common-utils:1": {},
"ghcr.io/FuelLabs/devcontainer-features/fuelup:1.0.1": {},
}
```

3. Add any plugins that you want to be installed for this repo under “customizations”.

```json
"customizations": {
"vscode": {
"extensions": [
"fuellabs.sway-vscode-plugin"
]
}
}
```

Here are examples that include the Sway LSP plugin.

1. [https://github.com/FuelLabs/sway/blob/master/.devcontainer/devcontainer.json](https://github.com/FuelLabs/sway/blob/master/.devcontainer/devcontainer.json)
2. [https://github.com/FuelLabs/quickstart/blob/master/.devcontainer/devcontainer.json](https://github.com/FuelLabs/quickstart/blob/master/.devcontainer/devcontainer.json)

### How to start a codespace

1. Navigate to the repo that has codespaces configured.
2. Choose Code → Create codespace on master

<Box.Centered>
![Create codespace walktrough](/images/create-codespace.gif)
</Box.Centered>

3. This will open a new tab with your codespace. It can take several minutes to start up.
1. You now have a fully functional remote dev environment with the fuel toolchain installed! You can use `forc` to build and deploy sway code, or `fuelup` to manage the toolchain version. You also have the Sway LSP plugin with full feature support for sway, like syntax highlighting, hover docs, go-to definition, etc.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved
cold-briu marked this conversation as resolved.
Show resolved Hide resolved
2. Note: if you are working on a large repository and find the codespace is running slow, you can configure it to use a larger instance by clicking Code → … → change machine type on a running instance, or starting a new instance with Code → … → New with options.

### Suggested uses
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

This is a great tool for hackathons! Users can easily get started with a full development environment without having to install anything on their personal machine, which could be a barrier for people who are new to Fuel/Sway.

### Pricing & billing

For all contributors that are part of the Github organization, Codespaces is billed to Fuel. For other users, they will be required to enter billing information. There is a substantial free tier so hackathon users don’t have to worry about getting billed as long as they shut down the codespace when they’re finished using it.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

## What's next?

Now you are ready to start building with Fuel.

👉 Check out the [quickstart guide](/guides/quickstart) to deploy your first smart contract.
211 changes: 211 additions & 0 deletions docs/guides/docs/installation/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
---
title: Installation
category: Installation
parent:
label: Guides
link: /guides
---

# Toolchain Installation

This guide will help you to install the Fuel toolchain binaries and pre requisites.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

This guide covers the following topics:
1. [Installing rust](#installing-rust)
cold-briu marked this conversation as resolved.
Show resolved Hide resolved
2. [Installing the fuel toolchain using fuelup](#installing-the-fuel-toolchain-using-fuelup)
cold-briu marked this conversation as resolved.
Show resolved Hide resolved
3. [Setting up a default toolchain](#setting-up-a-default-toolchain)

## Installing Rust

The Fuel toolchain is built on top of the Rust programming language. To install Rust, you can use the `rustup` tool.

Run the following command in your shell; this downloads and runs rustup-init.sh, which in turn downloads and runs the correct version of the rustup-init executable for your platform.

```console
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

Check the official Rust documentation to get more information on [installing the Rust toolchain](https://www.rust-lang.org/tools/install).

## Installing the fuel toolchain using fuelup

`fuelup` is the official package manager for Fuel that installs the Fuel toolchain
from the official release channels, enabling you to easily switch between different
toolchains and keep them updated. It makes building and maintaining Sway applications
simpler with [forc](docs/forc) and [fuel-core](https://github.com/FuelLabs/fuel-core) for common platforms.

> 💡 Check out the [Fuelup docs](docs/fuelup) for more information.


### Running fuelup-init

To install the fuel toolchain, you'll use the `fuelup-init` script. This will install `forc`, `forc-client`, `forc-fmt`, `forc-lsp`, `forc-wallet` as well as `fuel-core` in `~/.fuelup/bin`.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

👉 Just paste the following line in your terminal and press _Enter_.

```sh
curl --proto '=https' --tlsv1.2 -sSf https://install.fuel.network/fuelup-init.sh | sh
```

> 🚧 Be aware that currently we do not natively support Windows. If you wish to use `fuelup` on Windows, please use Windows Subsystem for Linux.

### Setup PATH

Once the script is downloaded it will be executed automatically. The `fuelup-init` script will prompt something as this.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

```sh
fuelup uses "/home/username/.fuelup" as its home directory to manage the Fuel toolchain, and will install binaries there.

To use the toolchain, you will have to configure your PATH, which tells your machine where to locate fuelup and the Fuel toolchain.

If permitted, fuelup-init will configure your PATH for you by running the following:

echo "export PATH="$HOME/.fuelup/bin:$PATH"" >> /home/username/.bashrc

Would you like fuelup-init to modify your PATH variable for you? (N/y)
```

👉 If this is your first time installing the Fuel toolchain just press the `Y` key in your terminal and press _Enter_
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

### Checking the installation

After allowing the `fuelup-init` script to modify your `PATH` variable, you will see a lot of information about packages being downloaded and installed. If everything goes as expected you will see the following message:

```sh
The Fuel toolchain is installed and up to date

fuelup 0.19.5 has been installed in /home/username/.fuelup/bin.
To fetch the latest toolchain containing the forc and fuel-core binaries, run 'fuelup toolchain install latest'.
To generate completions for your shell, run 'fuelup completions --shell=SHELL'.
```

👉 Use `fuelup --version`any time to check which version of the package you are using.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

```sh
fuelup --version
```
That will output your current `fuelup` verison:
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

```sh
fuelup 0.19.5
```

## Setting up a default toolchain

Just as seen in [Rust](https://rust-lang.github.io/rustup/concepts/toolchains.html) Fuel supports multiple toolchains. A toolchain is a collection of tools (such as the compiler, lsp, etc).
cold-briu marked this conversation as resolved.
Show resolved Hide resolved
By default, Fuelup includes a series of toolchain with packages tested to work with each other, providing a realiable set of tools.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

In this case, we will install the `beta-4` toolchain, which is the stable toolchain compatible with the beta-4 network. For more information on `beta-4` check the [Fuel blog](https://fuel-labs.ghost.io/announcing-beta-4-testnet/) page.

### Updating fuelup

Make sure you have the latest version of `fuelup` so you can accesses the latest features and have the best performance.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

👉 Update `fuelup` by running the following command:

```console
fuelup self update
```
Then you will get an output like this:
```console
Fetching binary from https://github.com/FuelLabs/fuelup/releases/download/v0.19.5/fuelup-0.19.5-aarch64-apple-darwin.tar.gz
Downloading component fuelup without verifying checksum
Unpacking and moving fuelup to /var/folders/tp/0l8zdx9j4s9_n609ykwxl0qw0000gn/T/.tmpiNJQHt
Moving /var/folders/tp/0l8zdx9j4s9_n609ykwxl0qw0000gn/T/.tmpiNJQHt/fuelup to /Users/.fuelup/bin/fuelup
```

### Installing the beta-4 toolchain

The `beta-4` network is the latest Fuel testnet. This includes public infrastructure such a the [Beta-4 faucet](https://faucet-beta-4.fuel.network/) and the [Beta-4 GraphQL endpoint](https://beta-4.fuel.network/playground).
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

To properly interact with the `beta-4` network is necessary to use it's corresponding toolchain.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

👉 Run the following command to install the `beta-4`:
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

```console
fuelup toolchain install beta-4
```
If the toolchain was successfully installed, you will see this output:

```sh
The Fuel toolchain is installed and up to date
```

The toolchain was installed correctly, however is in use yet. You need to indicate `fuelup` to use the `beta-4` toolchain.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

👉 set the `beta-4` as your default toolchain with the following command:
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

```console
fuelup default beta-4
```

You will get the following output indicating that you are ready to go.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

```console
default toolchain set to 'beta-4'
```

### Checking your current toolchain

Sometimes you might end up using multiples toolchain at once, don't worry if you get confused about wich toolchain your are using since you can check your current toolchain anytime.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

👉 Run the `fuelup show` command to see toolchain that your are using and the version of the binaries of that toolchain.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

```sh
fuelup show
```

This command will give you the following output

```sh
active toolchain
-----------------
beta-4-x86_64-unknown-linux-gnu (default)
forc : 0.45.0
- forc-client
- forc-deploy : 0.45.0
- forc-run : 0.45.0
- forc-doc : 0.45.0
- forc-explore : 0.28.1
- forc-fmt : 0.45.0
- forc-index : 0.20.7
- forc-lsp : 0.45.0
- forc-tx : 0.45.0
- forc-wallet : 0.3.0
fuel-core : 0.20.4
fuel-core-keygen : Error getting version string
fuel-indexer : 0.20.7

fuels versions
---------------
forc : 0.45
forc-wallet : 0.45
```

As you can see the beta-4 toolchain is active 🚀

## What's next?

Now you are ready to start building with Fuel.

👉 Check out the [quickstart guide](/guides/quickstart) to deploy your first smart contract.

## Beyond the basics

### Custom toolchains

You can create your own set of specific versions, this is known as 'custom toolchains'.

> 👉 Visit the [Fuelup docs](docs/fuelup/concepts/toolchains) to learn how to set up your own custom toolchains.

### Build form source

You can always build the Fuel packages from source.

> 👉 visit the [Fuelup docs](docs/fuelup/install/other) to get more details other types of installation.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

### Github codespaces

It's always possible to run a developement enviroment on the browser.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

> 👉 Please visit our guide on [Github Codespaces](guides/install/codespaces) to use the Fuel Toolchain on the browser.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions docs/guides/docs/nav.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"menu": ["Quickstart", "Running a Node", "Testnet Migration"],
"installation": ["Fuel Github Codespace"],
"quickstart": ["Building a Smart Contract", "Building a Frontend"],
"running_a_node": ["Running a Local Node", "Running a Beta-4 Node"],
"testnet_migration": ["Beta 4 Testnet Migration"]
Expand Down
49 changes: 1 addition & 48 deletions docs/guides/docs/quickstart/building-a-smart-contract.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,54 +10,7 @@ parent:

## Installation

{/* This example should include the instructions for installing Rust & Fuelup */}
{/* installation:example:start */}
Start by [installing the Rust toolchain](https://www.rust-lang.org/tools/install).

```console
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

Then, [install the Fuel toolchain](/docs/fuelup/installation).

```console
curl --proto '=https' --tlsv1.2 -sSf https://install.fuel.network/fuelup-init.sh | sh
```
{/* installation:example:end */}

{/* This example should include the instructions for installing the latest toolchain */}
{/* toolchain_installation:example:start */}
Make sure you have the latest version of `fuelup` by running the following command:

```console
fuelup self update
```

```console
Fetching binary from https://github.com/FuelLabs/fuelup/releases/download/v0.19.5/fuelup-0.19.5-aarch64-apple-darwin.tar.gz
Downloading component fuelup without verifying checksum
Unpacking and moving fuelup to /var/folders/tp/0l8zdx9j4s9_n609ykwxl0qw0000gn/T/.tmpiNJQHt
Moving /var/folders/tp/0l8zdx9j4s9_n609ykwxl0qw0000gn/T/.tmpiNJQHt/fuelup to /Users/.fuelup/bin/fuelup
```

Next, install the `beta-4` toolchain with:

```console
fuelup toolchain install beta-4
```

Finally, set the `beta-4` toolchain as your default distribution with the following command:

```console
fuelup default beta-4
```

```console
default toolchain set to 'beta-4'
```

You can check your current toolchain anytime by running `fuelup show`.
{/* toolchain_installation:example:end */}
Please visit the [installation guide](guides/installation) to install the Fuel toolchain binaries and pre-requisites.
cold-briu marked this conversation as resolved.
Show resolved Hide resolved

> Having problems with this part? Post your question on our forum [https://forum.fuel.network/](https://forum.fuel.network/). To help you as efficiently as possible, include the output of this command in your post: `fuelup show.`

Expand Down
Binary file added public/images/create-codespace.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/dev-container.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading