Local setup
Localhost mode
Follow these steps to create an Infernet Cloud instance and access the UI from a browser running on the same machine.
Clone the repository (opens in a new tab)
git clone https://github.com/ritual-net/infernet-cloud
For easier file navigation, follow these instructions in your IDE by opening README.md (opens in a new tab).
Install Node.js (opens in a new tab) and pnpm (opens in a new tab)
Install EdgeDB (opens in a new tab)
Install Terraform (opens in a new tab)
Initialize the local setup
pnpm init:local
This script will:
- Create an
.env.local
file with default values copied from.env.local.example
(opens in a new tab), if one doesn't already exist - Install package dependencies from npm
- Initialize a local EdgeDB instance (default name:
infernet_cloud
) - Apply EdgeDB database migrations
If you have already created an EdgeDB instance with the default name and want to start over, run:
pnpm local:edgedb:destroy
Start the Infernet Cloud UI
pnpm start:local
Access the Infernet Cloud UI
-
Open a web browser and navigate to
http://localhost:4173
(opens in a new tab). -
Jump to Using Infernet Cloud to get started with deploying an Infernet Node.
Hosted mode
To access the Infernet Cloud UI from a different machine, you will need to set up HTTPS. Follow steps 1-5 from Localhost mode above, then follow these additional steps.
Install Caddy (opens in a new tab)
Configure environment variables
- Open
.env.local
in a text editor and adjust the following environment variables:-
SERVER_HOST
: The public-facing URL of your Infernet Cloud server (defaulthttp://localhost:4173
(opens in a new tab) when accessing locally; otherwisehttps://<ip-or-domain>
).-
To list all the local network addresses through which an outside machine may access the Infernet Cloud UI, run the following command:
node -e 'for(const interface of Object.values(require("os").networkInterfaces())) for(const { address, family, internal } of interface) if(family === "IPv4" && !internal) console.log(address)'
-
-
EDGEDB_HOST
,EDGEDB_PORT
,EDGEDB_SERVER_USER
,EDGEDB_BRANCH
: The connection details of your EdgeDB instance.- Make sure these values match your EdgeDB instance configuration. To find the details of your local EdgeDB instance, run:
edgedb instance credentials
- Make sure these values match your EdgeDB instance configuration. To find the details of your local EdgeDB instance, run:
-
- Save
.env.local
.
Configure EdgeDB Auth (opens in a new tab)
-
Open
dbschema/bootstrap/auth.edgeql
(opens in a new tab) in a text editor.- Set
ext::auth::AuthConfig::allowed_redirect_urls
to the public-facing URL of your Infernet Cloud server (matching theSERVER_HOST
environment variable from above). - Set
ext::auth::AuthConfig::auth_signing_key
to a unique high-entropy value. - Set
ext::auth::SMTPConfig::sender
to the email address to send verification emails from. Configure the other SMTP configuration values according to your email relay service as needed. - Under
ext::auth::EmailPasswordProviderConfig
, setrequire_verification
totrue
to require new accounts to verify their email address before logging in; otherwise set it tofalse
.
- Set
-
Apply changes to EdgeDB Auth settings:
pnpm local:edgedb:init:auth
For more information, see the EdgeDB Auth documentation (opens in a new tab).
Configure Caddy (optional)
-
Open
caddy/local.Caddyfile
(opens in a new tab) in a text editor.- By default, Caddy will serve the Infernet Cloud UI through the site address (IP or domain) defined in the
SERVER_HOST
environment variable. For every additional site address through which you want to access Infernet Cloud, duplicate the site block and replace the site address with the desired value.
- By default, Caddy will serve the Infernet Cloud UI through the site address (IP or domain) defined in the
-
If hosting Infernet Cloud on a machine with a public-facing URL, ensure the appropriate ports are forwarded and whitelisted in your machine's firewall settings.
For more information, see the Caddyfile documentation (opens in a new tab).
Trust Caddy's root certificate
-
Start Caddy:
pnpm local:caddy:start
-
Export the contents of
/pki/authorities/local/root.crt
under Caddy's data directory (opens in a new tab):Linux / BSD:
cat $HOME/.local/share/caddy/pki/authorities/local/root.crt
macOS:
cat "$HOME/Library/Application Support/Caddy/pki/authorities/local/root.crt"
Windows:
Get-Content "$env:APPDATA\Caddy\pki\authorities\local\root.crt"
-
On the machine you'd like to access Infernet Cloud from, save the contents as a
.crt
file and install it as a trusted certificate (opens in a new tab).
Start the Infernet Cloud UI
pnpm start:local:host
- Ensure
SERVER_HOST
in.env.local
matches the desired public-facing URL of your Infernet Cloud server.
Access the Infernet Cloud UI
-
Open a web browser and navigate to the
https://
URL of your server defined in theSERVER_HOST
environment variable. -
If you're having trouble, double-check that the following values match:
- The
SERVER_HOST
environment variable in.env.local
- The value of
ext::auth::AuthConfig::allowed_redirect_urls
indbschema/bootstrap/auth.edgeql
(opens in a new tab)
- The
-
Jump to Using Infernet Cloud to get started with deploying an Infernet Node.
Development scripts
Server
-
Start the local Vite (opens in a new tab) server. Changes to the SvelteKit backend or frontend will cause an automatic hot-reload:
pnpm local:server:start
-
Start the local Vite server with Node.js debugging enabled:
pnpm local:server:debug
EdgeDB
-
Initialize a local EdgeDB database instance (default name:
infernet_cloud
):pnpm local:edgedb:init
-
After making changes to
dbschema/schema.esdl
(opens in a new tab), create and apply migrations to local EdgeDB database instance, and regenerate TypeScript types:pnpm local:edgedb:migrate
-
Destroy the local EdgeDB database instance and all of its data:
pnpm local:edgedb:destroy
-
Open an EdgeDB CLI (opens in a new tab) session:
pnpm local:edgedb:cli
-
Open the EdgeDB UI (opens in a new tab):
pnpm local:edgedb:ui
Find more commands and their definitions in the scripts
section of package.json
(opens in a new tab).