|
| 1 | +--- |
| 2 | +sidebar_position: 1 |
| 3 | +title: Local WebNode (Docker) |
| 4 | +description: How to deploy and launch a webnode using Docker images |
| 5 | +--- |
| 6 | + |
| 7 | +# Deploying and launching a webnode using Docker |
| 8 | + |
| 9 | +If you intend to just run the webnode instead of actively developing it, it is |
| 10 | +substantially easier to get set up using prebuilt Docker images. These images |
| 11 | +are automatically built on every versioned release. |
| 12 | + |
| 13 | +## Steps |
| 14 | + |
| 15 | +### 1. Generate a node key |
| 16 | + |
| 17 | +:::info This step should be redundant in a future version. |
| 18 | + |
| 19 | +::: |
| 20 | + |
| 21 | +The current version of the webnode requires you to supply a node key, even if |
| 22 | +you don't plan to produce blocks, or you supply your own key archive. This can |
| 23 | +be generated once and reused across launches of the webnode container. |
| 24 | + |
| 25 | +```sh |
| 26 | +# Using the latest version of the Rust node, generate a keypair. |
| 27 | +# The --web-node-secrets flag formats the generated keypair into JSON the webnode can use. |
| 28 | +docker run --rm o1labs/mina-rust:latest misc mina-key-pair --web-node-secrets > $HOME/web-node-key-pair.json |
| 29 | +``` |
| 30 | + |
| 31 | +### 2. Launch the webnode container |
| 32 | + |
| 33 | +You can now simply launch the webnode as a container. Note that once |
| 34 | +pre-generating a node keypair is no longer necessary, the `-v` can be removed. |
| 35 | + |
| 36 | +```sh |
| 37 | +# Launch the latest version of the frontend in webnode configuration. |
| 38 | +# We mount the keypair generated in step 1, and bind port 4200 on the host to 80 (http) in the container |
| 39 | +docker run \ |
| 40 | + -e MINA_FRONTEND_ENVIRONMENT=webnode \ |
| 41 | + -v ~/web-node-key-pair.json:/usr/local/apache2/htdocs/assets/webnode/web-node-secrets.json \ |
| 42 | + -p 4200:80 \ |
| 43 | + o1labs/mina-rust-frontend:latest |
| 44 | +``` |
| 45 | + |
| 46 | +### 3. Open your browser |
| 47 | + |
| 48 | +Navigate to [http://localhost:4200](http://localhost:4200) and enjoy using the |
| 49 | +webnode! If you used a different port (`-p`) when launching the container, then |
| 50 | +update the port accordingly. |
| 51 | + |
| 52 | +## Environment Variable Reference |
| 53 | + |
| 54 | +The Dockerized WebNode can be configured with additional environment variables |
| 55 | +to customize behavior. |
| 56 | + |
| 57 | +| Environment Variable | Required? | Description | |
| 58 | +| :-------------------------- | :-------: | :--------------------------------------------------------------------- | |
| 59 | +| `MINA_FRONTEND_ENVIRONMENT` | Yes | Must be set to `webnode` to run the frontend in webnode mode | |
| 60 | +| `MINA_WEBNODE_SEED_URLS` | No | A comma-separated list of http(s) URLs to fetch initial P2P Seeds from | |
| 61 | +| `MINA_WEBNODE_BOOTNODES` | No | A comma-separated list of initial peers in WebRTC-Multiaddrish format | |
0 commit comments