Deploy a Local Portal
To view a website deployed using Walrus Sites, you must use a Sites Portal. A portal retrieves site resources from Walrus and their corresponding Sui objects before serving the site in your browser. You can browse any Walrus Site deployed on Mainnet or Testnet using a Sites Portal.
Use Docker to deploy a Sites Portal locally. There are no Testnet portals hosted for public good, and Mainnet sites must use a SuiNS domain name to be resolved through Walrus Foundation's public Mainnet portal.
- Prerequisites
-
Install Docker.
Clone the walrus-sites repository and check out the stable branch:
$ git clone https://github.com/MystenLabs/walrus-sites.git
$ cd walrus-sites
$ git checkout mainnet
Copy the template configuration file for your target network and rename it to portal-config.yaml:
- Mainnet
- Testnet
$ cp portal/server/portal-config.mainnet.example.yaml portal/server/portal-config.yaml
$ cp portal/server/portal-config.testnet.example.yaml portal/server/portal-config.yaml
Run the Docker container:
docker run \
-it \
--rm \
-v $(pwd)/portal/server/portal-config.yaml:/portal-config.yaml:ro \
-e PORTAL_CONFIG=/portal-config.yaml \
-p 3000:3000 \
mysten/walrus-sites-server-portal:mainnet-v2.8.0
The portal Docker image version must match your site-builder version. Run the following command to get the version tag:
$ site-builder -V | awk '{ print $2 }' | awk -F - '{ printf("v%s\n", $1) }'
Be sure that version tag matches the version in mysten/walrus-sites-server-portal:mainnet-v2.8.0.
Once the Docker container is running, open your browser and navigate to the following URL:
http:/localhost:3000
Local development
This method requires bun. Check whether bun is installed:
$ bun --version
If bun is not installed, run the following command:
$ curl -fsSL https://bun.sh/install | bash
Install the dependencies:
$ git clone https://github.com/MystenLabs/walrus-sites.git
$ cd walrus-sites/portal
$ bun install
To run a server-side portal, copy the example portal-config.yaml for your target network and start the server. The server portal runs at localhost:3000.
# Mainnet
$ cp server/portal-config.mainnet.example.yaml server/portal-config.yaml
# Testnet
$ cp server/portal-config.testnet.example.yaml server/portal-config.yaml
$ bun run server
To run a service-worker portal, copy the example .env.local for your target network and start the worker. The service-worker portal runs at localhost:8080.
# Mainnet
$ cp worker/.env.mainnet.example worker/.env.local
# Testnet
$ cp worker/.env.testnet.example worker/.env.local
$ bun run build:worker
$ bun run worker