mirror of
https://github.com/logos-messaging/docs.waku.org.git
synced 2026-01-03 21:33:05 +00:00
1 line
9.4 KiB
JavaScript
1 line
9.4 KiB
JavaScript
"use strict";(self.webpackChunkwaku_guide=self.webpackChunkwaku_guide||[]).push([[3634],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>f});var o=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function r(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){i(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,o,i=function(e,n){if(null==e)return{};var t,o,i={},a=Object.keys(e);for(o=0;o<a.length;o++)t=a[o],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)t=a[o],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var u=o.createContext({}),p=function(e){var n=o.useContext(u),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},s=function(e){var n=p(e.components);return o.createElement(u.Provider,{value:n},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},m=o.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,u=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=p(t),m=i,f=d["".concat(u,".").concat(m)]||d[m]||c[m]||a;return t?o.createElement(f,r(r({ref:n},s),{},{components:t})):o.createElement(f,r({ref:n},s))}));function f(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,r=new Array(a);r[0]=m;var l={};for(var u in n)hasOwnProperty.call(n,u)&&(l[u]=n[u]);l.originalType=e,l[d]="string"==typeof e?e:i,r[1]=l;for(var p=2;p<a;p++)r[p]=t[p];return o.createElement.apply(null,r)}return o.createElement.apply(null,t)}m.displayName="MDXCreateElement"},69399:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>r,default:()=>c,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var o=t(87462),i=(t(67294),t(3905));const a={title:"Node Configuration Methods",hide_table_of_contents:!0},r=void 0,l={unversionedId:"guides/nwaku/config-methods",id:"guides/nwaku/config-methods",title:"Node Configuration Methods",description:"Waku nodes can be configured using a combination of the following methods:",source:"@site/docs/guides/nwaku/config-methods.md",sourceDirName:"guides/nwaku",slug:"/guides/nwaku/config-methods",permalink:"/guides/nwaku/config-methods",draft:!1,editUrl:"https://github.com/waku-org/docs.waku.org/tree/develop/docs/guides/nwaku/config-methods.md",tags:[],version:"current",frontMatter:{title:"Node Configuration Methods",hide_table_of_contents:!0},sidebar:"guides",previous:{title:"Find Your Node Address",permalink:"/guides/nwaku/find-node-address"},next:{title:"Node Configuration Options",permalink:"/guides/nwaku/config-options"}},u={},p=[{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}],s={toc:p},d="wrapper";function c(e){let{components:n,...t}=e;return(0,i.kt)(d,(0,o.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Waku nodes can be configured using a combination of the following methods:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Command line options and flags"),(0,i.kt)("li",{parentName:"ol"},"Environment variables"),(0,i.kt)("li",{parentName:"ol"},"TOML configuration files (currently the only supported format)"),(0,i.kt)("li",{parentName:"ol"},"Default values")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"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).")),(0,i.kt)("h2",{id:"command-line-options"},"Command line options"),(0,i.kt)("p",null,"Node configuration is primarily done using command line options, which override other methods. Specify ",(0,i.kt)("a",{parentName:"p",href:"/guides/nwaku/config-options"},"configuration options")," by providing them in this format after the binary name:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"./build/wakunode2 --tcp-port=65000\n")),(0,i.kt)("p",null,"When running your node with Docker, provide the command line options after the image name in this format:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"docker run wakuorg/nwaku --tcp-port=65000\n")),(0,i.kt)("h2",{id:"environment-variables"},"Environment variables"),(0,i.kt)("p",null,"Nodes can be configured using environment variables by prefixing the variable name with ",(0,i.kt)("inlineCode",{parentName:"p"},"WAKUNODE2_")," and using the configuration option in ",(0,i.kt)("a",{parentName:"p",href:"https://en.wiktionary.org/wiki/screaming_snake_case"},"SCREAMING_SNAKE_CASE")," format."),(0,i.kt)("p",null,"To set the ",(0,i.kt)("inlineCode",{parentName:"p"},"tcp-port")," configuration, the ",(0,i.kt)("inlineCode",{parentName:"p"},"wakunode2")," binary should be called in this format:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"WAKUNODE2_TCP_PORT=65000 ./build/wakunode2\n")),(0,i.kt)("p",null,"When running your node with Docker, start the node using the ",(0,i.kt)("inlineCode",{parentName:"p"},"-e")," command option:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'docker run -e "WAKUNODE2_TCP_PORT=65000" wakuorg/nwaku\n')),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"This is the second configuration method in order of precedence. ",(0,i.kt)("a",{parentName:"p",href:"#command-line-options"},"Command Line Options")," override environment variables.")),(0,i.kt)("h2",{id:"configuration-files"},"Configuration files"),(0,i.kt)("p",null,"Nodes can be configured using a configuration file following the ",(0,i.kt)("a",{parentName:"p",href:"https://toml.io/en/"},"TOML")," format:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-toml",metastring:'title="TOML Config File" showLineNumbers',title:'"TOML',Config:!0,'File"':!0,showLineNumbers:!0},'log-level = "DEBUG"\ntcp-port = 65000\ntopic = ["/waku/2/default-waku/proto"]\nmetrics-logging = false\n')),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"config-file")," ",(0,i.kt)("a",{parentName:"p",href:"/guides/nwaku/config-options"},"configuration option")," lets you specify the configuration file path:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"./build/wakunode2 --config-file=[TOML CONFIGURATION FILE]\n")),(0,i.kt)("p",null,"You can also specify the configuration file via environment variables:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'# 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')),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"This is the third configuration method in order of precedence. ",(0,i.kt)("a",{parentName:"p",href:"#command-line-options"},"Command Line Options")," and ",(0,i.kt)("a",{parentName:"p",href:"#environment-variables"},"Environment Variables")," override configuration files.")),(0,i.kt)("h2",{id:"default-configuration-values"},"Default configuration values"),(0,i.kt)("p",null,"The default configuration is used when no other options are specified. By default, a ",(0,i.kt)("inlineCode",{parentName:"p"},"nwaku")," node does the following:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Generate a new ",(0,i.kt)("inlineCode",{parentName:"li"},"Node Key")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"PeerID"),"."),(0,i.kt)("li",{parentName:"ul"},"Listen for incoming libp2p connections on the default TCP port (",(0,i.kt)("inlineCode",{parentName:"li"},"60000"),")."),(0,i.kt)("li",{parentName:"ul"},"Subscribe to the default Pub/Sub topic (",(0,i.kt)("inlineCode",{parentName:"li"},"/waku/2/default-waku/proto"),")."),(0,i.kt)("li",{parentName:"ul"},"Enable the ",(0,i.kt)("inlineCode",{parentName:"li"},"Relay")," protocol for relaying messages."),(0,i.kt)("li",{parentName:"ul"},"Enable the ",(0,i.kt)("inlineCode",{parentName:"li"},"Store")," protocol as a client, allowing it to query peers for historical messages but not store any message itself.")),(0,i.kt)("p",null,"To see the default values of all ",(0,i.kt)("a",{parentName:"p",href:"/guides/nwaku/config-options"},"configuration options"),", run ",(0,i.kt)("inlineCode",{parentName:"p"},"wakunode2 --help"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"./build/wakunode2 --help\n")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"To explore the available node configuration options, have a look at the ",(0,i.kt)("a",{parentName:"p",href:"/guides/nwaku/config-options"},"Node Configuration Options")," guide.")))}c.isMDXComponent=!0}}]); |