mirror of
https://github.com/logos-messaging/docs.waku.org.git
synced 2026-01-05 22:33:06 +00:00
1 line
8.0 KiB
JavaScript
1 line
8.0 KiB
JavaScript
"use strict";(self.webpackChunkwaku_guide=self.webpackChunkwaku_guide||[]).push([[3937],{27702:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>t,metadata:()=>i,toc:()=>d});const i=JSON.parse('{"id":"run-node/config-methods","title":"Node Configuration Methods","description":"Waku nodes can be configured using a combination of the following methods:","source":"@site/docs/run-node/config-methods.md","sourceDirName":"run-node","slug":"/run-node/config-methods","permalink":"/run-node/config-methods","draft":false,"unlisted":false,"editUrl":"https://github.com/waku-org/docs.waku.org/tree/develop/docs/run-node/config-methods.md","tags":[],"version":"current","lastUpdatedAt":null,"frontMatter":{"title":"Node Configuration Methods","hide_table_of_contents":true,"displayed_sidebar":"runNode"},"sidebar":"runNode","previous":{"title":"Find Your Node Address","permalink":"/run-node/find-node-address"},"next":{"title":"Node Configuration Options","permalink":"/run-node/config-options"}}');var r=o(74848),s=o(28453);const t={title:"Node Configuration Methods",hide_table_of_contents:!0,displayed_sidebar:"runNode"},a=void 0,l={},d=[{value:"Command line options",id:"command-line-options",level:2},{value:"Environment variables",id:"environment-variables",level:2},{value:"Configuration files",id:"configuration-files",level:2},{value:"Default configuration values",id:"default-configuration-values",level:2}];function c(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.p,{children:"Waku nodes can be configured using a combination of the following methods:"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsx)(n.li,{children:"Command line options and flags"}),"\n",(0,r.jsx)(n.li,{children:"Environment variables"}),"\n",(0,r.jsx)(n.li,{children:"TOML configuration files (currently the only supported format)"}),"\n",(0,r.jsx)(n.li,{children:"Default values"}),"\n"]}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsx)(n.p,{children:"Take note of the precedence order: Each configuration method overrides the one below it (e.g., command line options override environment variables and configuration files)."})}),"\n",(0,r.jsx)(n.h2,{id:"command-line-options",children:"Command line options"}),"\n",(0,r.jsxs)(n.p,{children:["Node configuration is primarily done using command line options, which override other methods. Specify ",(0,r.jsx)(n.a,{href:"/run-node/config-options",children:"configuration options"})," by providing them in this format after the binary name:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"./build/wakunode2 --tcp-port=65000\n"})}),"\n",(0,r.jsx)(n.p,{children:"When running your node with Docker, provide the command line options after the image name in this format:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"docker run wakuorg/nwaku --tcp-port=65000\n"})}),"\n",(0,r.jsx)(n.h2,{id:"environment-variables",children:"Environment variables"}),"\n",(0,r.jsxs)(n.p,{children:["Nodes can be configured using environment variables by prefixing the variable name with ",(0,r.jsx)(n.code,{children:"WAKUNODE2_"})," and using the configuration option in ",(0,r.jsx)(n.a,{href:"https://en.wiktionary.org/wiki/screaming_snake_case",children:"SCREAMING_SNAKE_CASE"})," format."]}),"\n",(0,r.jsxs)(n.p,{children:["To set the ",(0,r.jsx)(n.code,{children:"tcp-port"})," configuration, the ",(0,r.jsx)(n.code,{children:"wakunode2"})," binary should be called in this format:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"WAKUNODE2_TCP_PORT=65000 ./build/wakunode2\n"})}),"\n",(0,r.jsxs)(n.p,{children:["When running your node with Docker, start the node using the ",(0,r.jsx)(n.code,{children:"-e"})," command option:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:'docker run -e "WAKUNODE2_TCP_PORT=65000" wakuorg/nwaku\n'})}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsxs)(n.p,{children:["This is the second configuration method in order of precedence. ",(0,r.jsx)(n.a,{href:"#command-line-options",children:"Command Line Options"})," override environment variables."]})}),"\n",(0,r.jsx)(n.h2,{id:"configuration-files",children:"Configuration files"}),"\n",(0,r.jsxs)(n.p,{children:["Nodes can be configured using a configuration file following the ",(0,r.jsx)(n.a,{href:"https://toml.io/en/",children:"TOML"})," format:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-toml",metastring:'title="TOML Config File" showLineNumbers',children:'log-level = "DEBUG"\ntcp-port = 65000\ntopic = ["/waku/2/default-waku/proto"]\nmetrics-logging = false\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"config-file"})," ",(0,r.jsx)(n.a,{href:"/run-node/config-options",children:"configuration option"})," lets you specify the configuration file path:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"./build/wakunode2 --config-file=[TOML CONFIGURATION FILE]\n"})}),"\n",(0,r.jsx)(n.p,{children:"You can also specify the configuration file via environment variables:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:'# Using environment variables\nWAKUNODE2_CONFIG_FILE=[TOML CONFIGURATION FILE] ./build/wakunode2\n\n# Using environment variables with Docker\ndocker run -e "WAKUNODE2_CONFIG_FILE=[TOML CONFIGURATION FILE]" wakuorg/nwaku\n'})}),"\n",(0,r.jsx)(n.admonition,{type:"info",children:(0,r.jsxs)(n.p,{children:["This is the third configuration method in order of precedence. ",(0,r.jsx)(n.a,{href:"#command-line-options",children:"Command Line Options"})," and ",(0,r.jsx)(n.a,{href:"#environment-variables",children:"Environment Variables"})," override configuration files."]})}),"\n",(0,r.jsx)(n.h2,{id:"default-configuration-values",children:"Default configuration values"}),"\n",(0,r.jsxs)(n.p,{children:["The default configuration is used when no other options are specified. By default, a ",(0,r.jsx)(n.code,{children:"nwaku"})," node does the following:"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Generate a new ",(0,r.jsx)(n.code,{children:"Node Key"})," and ",(0,r.jsx)(n.code,{children:"PeerID"}),"."]}),"\n",(0,r.jsxs)(n.li,{children:["Listen for incoming libp2p connections on the default TCP port (",(0,r.jsx)(n.code,{children:"60000"}),")."]}),"\n",(0,r.jsxs)(n.li,{children:["Subscribe to the default Pub/Sub topic (",(0,r.jsx)(n.code,{children:"/waku/2/default-waku/proto"}),")."]}),"\n",(0,r.jsxs)(n.li,{children:["Enable the ",(0,r.jsx)(n.code,{children:"Relay"})," protocol for relaying messages."]}),"\n",(0,r.jsxs)(n.li,{children:["Enable the ",(0,r.jsx)(n.code,{children:"Store"})," protocol as a client, allowing it to query peers for historical messages but not store any message itself."]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["To see the default values of all ",(0,r.jsx)(n.a,{href:"/run-node/config-options",children:"configuration options"}),", run ",(0,r.jsx)(n.code,{children:"wakunode2 --help"}),":"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",children:"./build/wakunode2 --help\n"})}),"\n",(0,r.jsx)(n.admonition,{type:"tip",children:(0,r.jsxs)(n.p,{children:["To explore the available node configuration options, have a look at the ",(0,r.jsx)(n.a,{href:"/run-node/config-options",children:"Node Configuration Options"})," guide."]})})]})}function h(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},28453:(e,n,o)=>{o.d(n,{R:()=>t,x:()=>a});var i=o(96540);const r={},s=i.createContext(r);function t(e){const n=i.useContext(s);return i.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:t(e.components),i.createElement(s.Provider,{value:n},e.children)}}}]); |