Skip to content

Commit

Permalink
Add Spheron in the cloud infrastructure section
Browse files Browse the repository at this point in the history
  • Loading branch information
rekpero committed Sep 25, 2023
1 parent f3da6ee commit 83aad72
Show file tree
Hide file tree
Showing 3 changed files with 307 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/build-on-linea/tooling/cloud-infra/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"label": "Cloud Infrastructure"
}
300 changes: 300 additions & 0 deletions docs/build-on-linea/tooling/cloud-infra/spheron.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,300 @@
---
title: Spheron Network
---

# Spheron Network

## What is Spheron?

[Spheron](https://spheron.network/) is a PaaS designed for dApps looking to launch their applications on decentralized infra with best performance. It provides compute, decentralized storage, CDN & web hosting out of the box. With its comprehensive set of tools and services rooted in Web3 Infra, Spheron empowers developers to meet the dynamic demands of the digital landscape. Going beyond traditional Web2 infrastructures, Spheron offers a wide range of services including web hosting, storage, and compute capabilities, serving as a vital component in the Web3 ecosystem. Its exceptional performance not only rivals Web2 counterparts but also showcases the potential of Web3 technology for the next generation of applications.

> Learn more about Spheron through [our documentation](https://docs.spheron.network/).
## How to deploy static site on Spheron?

Deploying static apps on Spheron is a straightforward process. Follow these steps to deploy your static apps on Spheron:

1. **Connect your Git Provider:**<br/> Connecting your Git provider allows Spheron to sync your repositories and trigger deployments whenever new updates are made. Spheron supports the following [Git providers](https://docs.spheron.network/static/deployment/logs/): Github, Gitlab, and Bitbucket.

2. **Set up your Project:**<br/> Create a new project on Spheron and choose your desired app repository for deployment.

3. **Select deployment protocol:**<br/> Select your desired protocol for hosting your static app. Spheron supports the following protocols: **Arweave**, **Filecoin**, and **IPFS**.

4. **Configure deployment settings:**<br/> Spheron will automatically detect and configure most of these settings for you. You have to [add environment variables](https://docs.spheron.network/static/projects/variables/) in the dedicated section. If needed, modify the remaining parameters according to your requirements. That includes selecting the framework, branch, root directory, build and output settings, and the node engine.

5. **Trigger deployment:**<br/> After configuring all the required settings, initiate the deployment process. Spheron will fetch your code, build the static files, and deploy them to your specified protocol.

6. **Access your app:**<br/> Once the deployment is complete, you can access your app through the domain generated by Spheron. You also have the option to [set up a custom domain](https://docs.spheron.network/static/projects/domain/) for your app.

> Checkout our [Framework Guide](https://docs.spheron.network/framework-guide/) for more info.
## How to deploy dynamic-apps/servers on Spheron?

Deploying compute instances on Spheron is simple and effortless, whether you're using a Docker image from Docker Hub or deploying a marketplace app. Follow these steps to deploy your compute instance on Spheron:

1. **Set up your Cluster:**<br/> Create a new cluster on Spheron by selecting **Import from Docker Hub** or **Start from Marketplace App**.

2. **For Docker Hub:**<br/>

1. Click "New Cluster" on the top right corner.
2. Select **Import from Docker Hub**.
3. Enter the names for your cluster and docker image.
4. Then, Add the tag and Click "Next."
5. Choose your Compute Type option under **Compute Type**.
6. Select your preferred **Region**, if any. If you do not add a region, the container will be deployed in **any** region for **Spot**, or in the **eu-east** region for **On Demand**. [Click here](https://docs.spheron.network/compute/cluster/#region) to know more.
7. Spheron will automatically select the recommended plan for the specific template. If you intend to move forward with the recommended plan, Create new Port Policy Mapping and just Click "Deploy" to initiate deployment.
8. Select the instance plan that suits your needs. Use the "Create Custom Plan" toggle to create custom plans for your instance.
9. Configure Storage (SSD) plan for your instance. Use the "Add Persistent Storage" toggle to add persistent storage for your instance.
10. Create new Port Policy Mapping. Add the container port, and Select the exposed port you want to map it to. Click here to know more.
11. Add **Environment Variable**, if any.
12. Add **Secret Environment Variable** if the value is a secret key. It will not be saved in the database. [Click here](https://docs.spheron.network/compute/cluster/#environment-variables) to know more.
13. You can add advance configuration if required. [Click here](https://docs.spheron.network/compute/cluster/#advance-configuration) to know more.
14. You can add health checkup if required. [Click here](https://docs.spheron.network/compute/cluster/#health-checkup) to know more.
15. Click "Deploy" to initiate deployment.

<br />

> Checkout our [Server Guide](https://docs.spheron.network/server-guide/) for more info.
3. **For Marketplace App:**<br/>

1. Click "New Cluster" on the top right corner.
2. Select **Start from Marketplace App**.
3. Pick your desired template from the marketplace.
4. Choose your desired Compute Type option under **Compute Type**.
5. Select your preferred **Region**, if any. If you do not add a region, the container will be deployed in **any** region for **Spot**, or in the **eu-east** region for **On Demand**. [Click here](https://docs.spheron.network/compute/cluster/#region) to know more.
6. Spheron will automatically select the recommended plan for the specific template. If you intend to move forward with the recommended plan, just Click "Deploy" to initiate deployment.
7. Select the instance plan that suits your needs. Use the "Create Custom Plan" toggle to create custom plans for your instance.
8. Configure Storage (SSD) plan for your instance. Use the "Add Persistent Storage" toggle to add persistent storage for your instance.
9. You can add advance configuration if required. [Click here](https://docs.spheron.network/compute/cluster/#advance-configuration-1) to know more.
10. Click "Deploy" to initiate deployment.

<br />

> Checkout our [Marketplace Guide](https://docs.spheron.network/marketplace-guide/) for more info.
## How to upload to IPFS using Spheron SDK?

### 1. Spheron Storage SDK (for Nodejs environments)

### Installation

```sh
npm i @spheron/storage
```

### Usage

```js
import { SpheronClient, ProtocolEnum } from "@spheron/storage";

const client = new SpheronClient({ token });

let currentlyUploaded = 0;

const { uploadId, bucketId, protocolLink, dynamicLinks } = await client.upload(
filePath,
{
protocol: ProtocolEnum.IPFS,
name,
onUploadInitiated: (uploadId) => {
console.log(`Upload with id ${uploadId} started...`);
},
onChunkUploaded: (uploadedSize, totalSize) => {
currentlyUploaded += uploadedSize;
console.log(`Uploaded ${currentlyUploaded} of ${totalSize} Bytes.`);
},
},
);
```

> Checkout our [Storage SDK Documentation](https://docs.spheron.network/sdk/storage-v2/) for more info.
### 2. Spheron Browser Upload SDK (for Browser environments)

### Installation

```sh
npm i @spheron/browser-upload
```

### Usage

### Server

You have to set up a web server with an endpoint that will be used by the frontend to fetch the token for upload.

```js
import { SpheronClient, ProtocolEnum } from "@spheron/storage";

...

app.get("/initiate-upload", async (req, res, next) => {
try {
const bucketName = "example-browser-upload"; // use your preferred name
const protocol = ProtocolEnum.IPFS; // use your preferred protocol
const token = process.env.SPHERON_TOKEN; // add your access token in .env or paste it here

const client = new SpheronClient({ token });

const { uploadToken } = await client.createSingleUploadToken({
name: bucketName,
protocol,
});

res.status(200).json({
uploadToken,
});
} catch (error) {
console.error(error);
next(error);
}
});
```

### Client

You have to send a request to your server to create the uploadToken that will be used to upload files from the browser.

```js
import { upload } from "@spheron/browser-upload";

...

const response = await fetch(`<BACKEND_URL>/initiate-upload`); // get the temporary access token from server
const resJson = await response.json();
const token = resJson.uploadToken;

let currentlyUploaded = 0;

const { uploadId, bucketId, protocolLink, dynamicLinks } = await upload(files, {
token,
onChunkUploaded: (uploadedSize, totalSize) => {
currentlyUploaded += uploadedSize;
console.log(`Uploaded ${currentlyUploaded} of ${totalSize} Bytes.`);
},
});

...
```

> Checkout our [Browser Upload SDK](https://docs.spheron.network/sdk/browser/) for more info.
> Checkout all other [SDKs](https://docs.spheron.network/sdk/) for more in-depth information.
## How to create and deploy apps using Spheron CLI?

## Installation

#### For Mac and Linux

To install the Spheron CLI, run the following command in your terminal:

```
sudo npm install -g @spheron/cli
```

#### For Windows

To install the Spheron CLI, open your terminal as administrator mode and run the following command:

```
npm install -g @spheron/cli
```

## Usage

### spheron init

The `spheron init` command allows you to initialize a new Spheron project. A `spheron.json` file is created in your current path that describes your project. It will be utilized by the `spheron publish` command.

#### Usage

```sh
spheron init
```

Upon running this command, a prompter will appear that will allow you to select protocol, add project name, add path, and select framework. Here is how it will look:

```sh
? Project name: (Code)
? Upload protocol: (Use arrow keys)
Arweave
Filecoin
❯ IPFS
```

### spheron publish

The `spheron publish` command allows you to upload your project using the configuration that is described in the `spheron.json` file of your project.

#### Usage

```sh
spheron publish
```

<Callout type="warning">
Make sure that you create a production build before running the `spheron
publish` command.
</Callout>

Here is an example of how the result will look:

```sh
Spheron CLI 1.0.7

Publishing your dapp to IPFS 🚀
Uploading directory build
Upload started, ID of deployment: 643fce207c3c7a0012df33a7
⠙ Uploading to IPFS
✓ Success! Upload finished !
Here are upload details:
Upload ID: 643fce207c3c7a0012df33a7
Bucket ID: 643fce207c3c7a0012df33a5
Protocol Link: https://bafybeicrjwhn6nifl7tcuhkcitquvpumj426qa7r7ppcya5skmqly5n2la.ipfs.sphn.link
Dynamic Links: https://testapp-edab50.spheron.app
```

> Checkout our [CLI Documentation](https://docs.spheron.network/cli/) for more info.
## How to view and retrieve content from IPFS using Spheron?

### Dedicated IPFS Gateways

[Dedicated Gateways](https://docs.spheron.network/gateways/dedicated/) are IPFS gateways specifically designed to enhance access to pinned content across the network by offering faster speeds and increased rate limits.

Using Dedicated Gateways offers several benefits:

- Improved Speed
- Increased Rate Limits
- White-labeling Gateway
- Serve Content from Any IPFS Node

### Create a Dedicated Gateway

Follow these steps to create a Dedicated Gateway:

1. Log in to Spheron and navigate to the **Gateways** section in the navbar.
2. Click **Generate** to create a new gateway.
3. Enter a name for your gateway and Click **Create**.

### How to Use Your Gateway?

To access content through your Dedicated Gateway, simply follow these steps:

1. Obtain the CID (Content Identifier) of the file you wish to view.
2. Append the CID to your gateway URL in the following format:

```
https://{gateway-name}.spheron.link/ipfs/{cid}
```

> Checkout our [Gateway Documentation](https://docs.spheron.network/gateways/dedicated/) for more info.
## Further Resources

- Visit [our platform](https://spheron.network/) to learn more.
- Access our comprehensive [documentation](https://docs.spheron.network/) for detailed information.
- Follow us on [Twitter](https://twitter.com/SpheronFDN) for the latest updates and news.
- Join our [Community](https://community.spheron.network/) for dedicated support and assistance.
4 changes: 4 additions & 0 deletions project-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -789,3 +789,7 @@ zoomable
zpao
zpaoAave
zpaoAaveAave
Spheron
SPHERON
spheron
Filecoin

0 comments on commit 83aad72

Please sign in to comment.