Spheron CLI
The Spheron CLI is a Command Line Interface (CLI) tool to create and deploy dapps to web3.
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
Help
The --help
argument allows you to get more details about Spheron CLI commands.
Usage
spheron --help
Here is an example of how the result will look:
Spheron CLI 1.0.7
spheron [command]
Commands:
spheron login Logs into yout Spheron account
spheron logout Logs out of your account
spheron upload Upload
spheron publish Upload your project setup in spheron.json
spheron create-organization Create organization
spheron get <resource> Get resource/s <<resource>>
spheron init Spheron file initialization in project
spheron configure Change spheron default configuration
spheron create-dapp Create a dapp which can run on Spheron out of the
box
Options:
--help Show help [boolean]
--version Show version number [boolean]
With Commands
spheron [command] --help
# example
spheron login --help
Here is how the result of the above example will look:
Spheron CLI 1.0.7
Usage: spheron login [--github|--gitlab|--bitbucket]
Options:
--github Login using Github credentials
--gitlab Login using Gitlab credentials
--bitbucket Login using Bitbucket credentials
--help Show help [boolean]
Authentication
spheron login
The spheron login
command allows you to connect to your Spheron account. It is necessary to execute this command before running upload or publish commands.
Usage
spheron login
Upon running this command, a prompter will appear that will allow you to select the provider that you want to use for login. Here is how it will look:
? Select your provider: (Use arrow keys)
❯ Github
Gitlab
Bitbucket
Extended Usage
You can use the following command if you want to connect to your Spheron account without prompter:
GitHub
The --github
argument can be used to initiate GitHub OAuth login.
spheron login --github
GitLab
The --gitlab
argument can be used to initiate GitLab OAuth login.
spheron login --gitlab
Bitbucket
The --bitbucket
argument can be used to initiate Bitbucket OAuth login.
spheron login --bitbucket
Upload
spheron upload
The spheron upload
command allows you to directly upload your file/directory to the specific protocol without having to set up a project. You must be logged in to use this command. If you are not, you can use the spheron login
command first to login.
Usage
spheron upload
Upon running this command, a prompter will appear that will allow you to add path, select protocol, add project name, and add organization id. Here is how it will look:
? Path to file: (./)
? Upload protocol: (Use arrow keys)
❯ Arweave
Filecoin
IPFS
Extended Usage
Direct Upload
You can use the following command if you want to directly upload the file without prompter:
spheron upload --path {file_path} --protocol {protocol} [--project {project_name}] [--organization {organizationId}]
Arguments
--path
: The location of dir/file that you want to upload. The default path is./
.--protocol
: Choose fromarweave
,filecoin
, oripfs
.--project
(Optional) : The name of the project. If not provided, the last segment of the path will be taken.--organization
(Optional) : TheorganizationId
to override the existing one. By default, it will take the one received after runningspheron login
.
NOTE: The prompter will be opened if all the required arguments are not entered.
Site
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
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:
? Project name: (Code)
? Upload protocol: (Use arrow keys)
❯ Arweave
Filecoin
IPFS
Extended Usage
Direct Initialization
You can use the following command if you want to directly initialize a new Spheron project without prompter:
spheron init --protocol {protocol} [--project {project_name}] [--path {path}] [--framework {framework}]
Arguments
-
--protocol
: Choose fromarweave
,filecoin
, oripfs
. -
--project
(Optional) : The name of the project. If not provided, the last segment of the path will be taken. -
--path
(Optional) : The location of dir/file that you want to upload. The default path is./
. -
--framework
(Optional) : Choose from the following frameworks:- static
- react
- vue
- angular
- next
- preact
- nuxt2
- docusaurus
- hugo
- eleventy
- svelte
- gatsby
- sanity
- ionicreact
- vite
- scully
- stencil
- brunch
- ionicangular
NOTE: The prompter will be opened if all the required arguments are not entered.
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
spheron publish
Make sure that you create a production build before running the spheron publish
command.
Here is an example of how the result will look:
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
Template
spheron create-dapp
The spheron create-dapp
allows you to create a template project that can be easily deployed on Spheron.
Usage
spheron create-dapp
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:
? What type of dapp do you want to create? (Use arrow keys)
❯ Default dapp
Template
Extended Usage
Direct Project Creation
You can use the following command if you want to directly create a template project without prompter:
spheron create-dapp --protocol {protocol} [--project {project_name}] [--path {path}] [--framework {framework}]
Arguments
-
--protocol
: Choose fromarweave
,filecoin
, oripfs
. -
--project
(Optional) : The name of the project. If not provided, the last segment of the path will be taken. -
--path
(Optional) : The location of dir/file that you want to upload. The default path is./
. -
--framework
(Optional) : Choose from the following frameworks:- static
- react
- vue
- angular
- next
- preact
- nuxt2
- docusaurus
- hugo
- eleventy
- svelte
- gatsby
- sanity
- ionicreact
- vite
- scully
- stencil
- brunch
- ionicangular
NOTE: The prompter will be opened if all the required arguments are not entered.
Organization
spheron create-organization
The spheron create-organization
command allows you to create a new organization. It will be set as the default organization and will be used by the upload/publish
commands by default.
NOTE:
When you run the spheron login
command for the first time, a new
organization will be created if you don't already have one set up.
Usage
spheron create-organization
Upon running this command, a prompter will appear that will allow you to add organization name, and add organization username. Here is how it will look:
? Name of the organization: (org-593)
? Username of the organization: (org-593)
Extended Usage
Direct Organization Creation
You can use the following command if you want to directly create a new organization without prompter:
spheron create-organization --name {organization_name} --username {organization_username}
Arguments
--name
: The name of the organization.--username
: The username for the organization.
NOTE: The prompter will be opened if all the required arguments are not entered.
spheron configure
The spheron configure
command allows you to switch your default organization.
Usage
spheron configure
Upon running this command, a prompter will appear that will allow you to add organization id. Here is how it will look:
? Default organization ID:
Extended Usage
Directly Switch Organization
You can use the following command if you want to directly switch your default organization without prompter:
spheron configure --organization {organizationId}
Arguments
--organization
: TheorganizationId
of the organization that you want to switch to.
NOTE: The prompter will be opened if the required argument is not entered.
Get Data from Spheron
spheron get organization
The spheron get organization
command allows you to get the details of an organization.
Usage
spheron get organization [--id {organizationId}]
Arguments
--organization
(Optional) : TheorganizationId
of the organization whose details you want to get.
NOTE: The details of the default organization will be returned if the
organization
argument is not entered.
spheron get organizations
The spheron get organizations
command allows you to get the details of all your organizations.
Usage
spheron get organizations
Upon running this command, the details of all your organizations will be returned as an array of objects
.
spheron get deployment
The spheron get deployment
command allows you to get the details of a deployment.
Usage
spheron get deployment --id {deploymentId}
Arguments
--id
: ThedeploymentId
of the deployment whose details you want to get.
spheron get deployments
The spheron get deployments
command allows you to get the details of all your deployments.
Usage
spheron get deployments --projectId {projectId}
Upon running this command, the details of all your deployments will be returned as an array of objects
.
Arguments
--projectId
: TheprojectId
of the project whose deployment details you want to get.
NOTE: The last 10 deployments will be returned if the limit arguments are not entered.
Extended Usage
Limit Results
You can use the following command if you want to limit the results:
spheron get deployments --projectId {projectId} [--skip {skip}] [--limit {limit}] [--status {status}]
Arguments
-
--projectId
: TheprojectId
whose deployment details you want to get. -
--skip
(Optional) : The number of items to skip in the query. -
--limit
(Optional) : The number of items to return. -
--status
(Optional) : Choose from the following statuses:- PreQueue
- Queued
- Pending
- Canceled
- Deployed
- Failed
- AuthorizationNeeded
- Killing
- TimedOut
spheron get project
The spheron get project
command allows you to get the details of a project.
Usage
spheron get project --id {projectId}
Arguments
--id
: TheprojectId
whose details you want to get.
spheron get projects
The spheron get projects
command allows you to get the details of all your projects.
Usage
spheron get projects [--organizationId {organizationId}]
Upon running this command, the details of all your projects will be returned as an array of objects
.
Arguments
--organizationId
(Optional) : TheorganizationId
whose project details you want to get.
NOTE:
1. The projects of the default organization will be returned if
the organizationId
argument is not entered.
2. The last 10 projects will
be returned if the limit arguments are not entered.
Extended Usage
Limit Results
You can use the following command if you want to limit the results:
spheron get projects [--organizationId {organizationId}] [--skip {skip}] [--limit {limit}] [--state {state}]
Arguments
--organizationId
(Optional) : TheorganizationId
whose project details you want to get.--skip
(Optional) : The number of items to skip in the query.--limit
(Optional) : The number of items to return.--state
(Optional) : Choose fromMAINTAINED
orARCHIVED
.
spheron get domains
The spheron get domains
command allows you to get the details of all your domains.
Usage
spheron get domains --projectId {projectId}
Upon running this command, the details of all your domains will be returned as an array of objects
.
Arguments
--projectId
: TheprojectId
whose domain details you want to get.
spheron get deployment-environments
The spheron get deployment-environments
command allows you to get the details of all your deployment environments.
Usage
spheron get deployment-environments --projectId {projectId}
Upon running this command, the details of all your deployment environments will be returned as an array of objects
.
Arguments
--projectId
: TheprojectId
whose deployment environment details you want to get.