The Juno CLI (GitHub: https://github.com/junobuild) provides a variety of tools for managing and deploying satellites(../terminology.md#satellite).
- Install Node.js (version LTS or above) from https://nodejs.org/en/download/. You can use nvm (https://github.com/nvm-sh/nvm) to manage multiple Node.js versions on a single machine.
- When installing Node.js, it is recommended to check all related dependency checkboxes.
- Install the Juno CLI globally or in your sandbox using npm:
npm i -g @junobuild/cli
The CLI requires authentication to make changes, such as deploying an application, upgrading a satellite or mission control, etc.
The authentication process requires a browser:
- Start the login process with the following command:
Sign in to the console if not already logged in.
Select the satellites and/or mission control you would like to control from your local device.
The terminal on your local machine should now be authorized to control the selected objects.
If you've previously authenticated your terminal and decide to log in again, the CLI will prompt you about reusing your existing identity. This allows you to reuse your authorization, especially when creating new segments like satellites or orbiters.
How it works?
A new principal is generated on your local machine and added as a controller of the selected satellites and/or mission control. This principal is then used to authenticate any CLI calls made from your terminal to your satellites and mission controls.
The key is saved in the OS-specific user's variables path.
To get the paths for storing data the CLI is using the library env-paths.
To remove the authorization of your local machine:
This currently does not remove the controllers from satellites and/or mission control. It only logs out your local machine and removes the locally saved key (principal).
juno init command creates a
juno.json configuration file in the root of your project directory.
This file is necessary to deploy your app with the CLI as it specifies which files from your project directory will be deployed to which satellite.
The satellite ID and path can be configured or edited manually through juno init.
juno init will overwrite the
juno.json configuration file.
The following is an example
You can configure your Hosting behavior by specifying various options within that file.
To deploy an app to a satellite using Juno, run the following command from the project directory:
This command uploads each file separately and computes and uploads the corresponding hashes. Subsequent deploys will only upload files that have changed.
To apply any changes to your storage configuration, run the following command from your project directory:
To clear the on-chain assets of the app, run the following command:
This command removes existing files from the satellite and only affects the app assets. The user's uploaded files will not be cleared as the app is deployed to a reserved collection,
If you have compressed (gzip and brotli) your bundle and assets after deploying your app, it is also necessary to clear the assets. This is because a certification tree of all assets needs to be calculated.
If the smart contracts' code of your mission control or satellites become outdated, you can upgrade them.
Running the following command from the project directory upgrade your satellite (default option):
By adding a suffix, you can upgrade your mission control:
juno upgrade -m
- We recommend that you stay current with the Juno releases, as some features may not perform correctly in the console if your smart contracts are outdated.
- Upgrading is as complex as migrating storage and requires a stable internet connection for a successful process.