From 7f6e6d9833cc84abcfb43163fd9f2ab486561dbf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 20 Oct 2023 16:28:04 +0000 Subject: [PATCH] deploy: 0ccf60e575ee2e404a875aac533aac609243d9e6 --- 404.html | 4 ++-- assets/js/{1c14429f.1c39ae8b.js => 1c14429f.8304ed86.js} | 2 +- assets/js/{1d8a5d15.892ac60d.js => 1d8a5d15.007acdee.js} | 2 +- assets/js/{2730e145.653238d1.js => 2730e145.43b66d7d.js} | 2 +- assets/js/{29b62a39.80ee5756.js => 29b62a39.c0bf41f4.js} | 2 +- assets/js/{29b83576.6072e2a5.js => 29b83576.507a0b0b.js} | 2 +- assets/js/{40aeb86f.13d479d3.js => 40aeb86f.c592360f.js} | 2 +- assets/js/{445e9e2a.cd1e4df3.js => 445e9e2a.f5d9aefe.js} | 2 +- assets/js/4c9535f7.07ee15ee.js | 1 + assets/js/4c9535f7.1505dcc3.js | 1 - assets/js/{4d7007b2.6418c206.js => 4d7007b2.bc866e91.js} | 2 +- assets/js/{51d5b592.ef253045.js => 51d5b592.e890f6e2.js} | 2 +- assets/js/{5437f376.426b68ec.js => 5437f376.7410f8c6.js} | 2 +- assets/js/{5b6134d1.bd33ad36.js => 5b6134d1.d8e23f3c.js} | 2 +- assets/js/{5bc389a1.0b96f914.js => 5bc389a1.3fe4b2bd.js} | 2 +- assets/js/{6be32138.c839bfac.js => 6be32138.ee48b118.js} | 2 +- assets/js/{7aefc753.5dcd8f5d.js => 7aefc753.695b86b0.js} | 2 +- assets/js/{8a92e787.a803ca01.js => 8a92e787.8a1b5d51.js} | 2 +- assets/js/{98f9308d.8dde6aa3.js => 98f9308d.b6142649.js} | 2 +- assets/js/{b2f554cd.89e02325.js => b2f554cd.26978dab.js} | 2 +- assets/js/{b35f1b7f.5506d9ad.js => b35f1b7f.902fd0cd.js} | 2 +- assets/js/{d1b78a4d.e12e16bb.js => d1b78a4d.b9f410cf.js} | 2 +- assets/js/{d23df0ea.a6176b99.js => d23df0ea.a1dd5725.js} | 2 +- assets/js/{d7d81bf6.9e13fcfa.js => d7d81bf6.4a15a96e.js} | 2 +- assets/js/{d8be0e5a.5b73083f.js => d8be0e5a.683fe5b5.js} | 2 +- assets/js/{fd2b74dc.550c03dc.js => fd2b74dc.711c1116.js} | 2 +- ...{runtime~main.395a551d.js => runtime~main.fa9eda83.js} | 2 +- blog/archive/index.html | 4 ++-- blog/atom.xml | 4 ++-- .../index.html | 8 ++++---- blog/feed.json | 2 +- blog/index.html | 6 +++--- blog/rss.xml | 4 ++-- blog/tags/blog/index.html | 6 +++--- blog/tags/content-routing/index.html | 6 +++--- blog/tags/engineering/index.html | 6 +++--- blog/tags/fleek-network/index.html | 6 +++--- blog/tags/index.html | 4 ++-- docs/Open-source/code-of-conduct/index.html | 4 ++-- docs/Open-source/contributing/index.html | 4 ++-- docs/Open-source/index.html | 4 ++-- docs/Open-source/repositories/index.html | 4 ++-- docs/develop/client/index.html | 4 ++-- docs/develop/json-rpc/index.html | 4 ++-- docs/develop/overview/index.html | 4 ++-- docs/develop/service-development/index.html | 4 ++-- docs/index.html | 4 ++-- docs/learn/delivery-acknowledgements/index.html | 4 ++-- docs/learn/developers/index.html | 4 ++-- docs/learn/introduction/index.html | 4 ++-- docs/learn/services/index.html | 4 ++-- docs/learn/the-network/index.html | 4 ++-- docs/learn/token-and-economics/index.html | 4 ++-- docs/node/analyzing-logs/index.html | 4 ++-- docs/node/configuration/index.html | 4 ++-- docs/node/diagnostics/index.html | 4 ++-- docs/node/health-check/index.html | 4 ++-- docs/node/install/index.html | 8 ++++---- docs/node/overview/index.html | 4 ++-- docs/node/requirements/index.html | 4 ++-- docs/node/systemd-service/index.html | 4 ++-- docs/node/testnet-onboarding/index.html | 4 ++-- docs/roadmap/index.html | 4 ++-- docs/tags/about/index.html | 4 ++-- docs/tags/algorithms/index.html | 4 ++-- docs/tags/architecture/index.html | 4 ++-- docs/tags/awards/index.html | 4 ++-- docs/tags/build/index.html | 4 ++-- docs/tags/cdn/index.html | 4 ++-- docs/tags/client/index.html | 4 ++-- docs/tags/code-of-conduct/index.html | 4 ++-- docs/tags/codebase/index.html | 4 ++-- docs/tags/compile/index.html | 4 ++-- docs/tags/configuration/index.html | 4 ++-- docs/tags/consensus/index.html | 4 ++-- docs/tags/contribute/index.html | 4 ++-- docs/tags/control/index.html | 4 ++-- docs/tags/decentralization/index.html | 4 ++-- docs/tags/develop/index.html | 4 ++-- docs/tags/diagnostic/index.html | 4 ++-- docs/tags/diagnostics/index.html | 4 ++-- docs/tags/economics/index.html | 4 ++-- docs/tags/edge-network/index.html | 4 ++-- docs/tags/edge-platform/index.html | 4 ++-- docs/tags/fleek-network/index.html | 4 ++-- docs/tags/getting-started/index.html | 4 ++-- docs/tags/git/index.html | 4 ++-- docs/tags/guide/index.html | 4 ++-- docs/tags/healthcheck/index.html | 4 ++-- docs/tags/incentives/index.html | 4 ++-- docs/tags/index.html | 4 ++-- docs/tags/learn/index.html | 4 ++-- docs/tags/logs/index.html | 4 ++-- docs/tags/manage/index.html | 4 ++-- docs/tags/manual/index.html | 4 ++-- docs/tags/node-status/index.html | 4 ++-- docs/tags/onboarding/index.html | 4 ++-- docs/tags/open-source/index.html | 4 ++-- docs/tags/permissionless/index.html | 4 ++-- docs/tags/phases/index.html | 4 ++-- docs/tags/pledge/index.html | 4 ++-- docs/tags/ports/index.html | 4 ++-- docs/tags/protocol/index.html | 4 ++-- docs/tags/repository/index.html | 4 ++-- docs/tags/reputation/index.html | 4 ++-- docs/tags/requirements/index.html | 4 ++-- docs/tags/rewards/index.html | 4 ++-- docs/tags/roadmap/index.html | 4 ++-- docs/tags/rpc/index.html | 4 ++-- docs/tags/rust-dependencies/index.html | 4 ++-- docs/tags/sdk/index.html | 4 ++-- docs/tags/server/index.html | 4 ++-- docs/tags/services/index.html | 4 ++-- docs/tags/snarks/index.html | 4 ++-- docs/tags/standards/index.html | 4 ++-- docs/tags/systemctl/index.html | 4 ++-- docs/tags/systemd/index.html | 4 ++-- docs/tags/testnet/index.html | 4 ++-- docs/tags/token/index.html | 4 ++-- docs/tags/tokenomics/index.html | 4 ++-- docs/tags/toolkit/index.html | 4 ++-- docs/tags/verification/index.html | 4 ++-- docs/tags/whitepaper/index.html | 4 ++-- docs/tags/wizard/index.html | 4 ++-- docs/whitepaper/index.html | 4 ++-- guides/Node Operators/getting-started/index.html | 6 +++--- guides/Node Operators/managing-the-keystore/index.html | 6 +++--- guides/Node Operators/running-a-node-in-docker/index.html | 8 ++++---- .../Node Operators/transfering-setup-ownership/index.html | 6 +++--- guides/Node Operators/updating-lightning/index.html | 6 +++--- guides/index.html | 6 +++--- guides/tags/configuration/index.html | 4 ++-- guides/tags/container/index.html | 4 ++-- guides/tags/docker/index.html | 4 ++-- guides/tags/edge-computing/index.html | 4 ++-- guides/tags/fleek-network/index.html | 4 ++-- guides/tags/getting-started/index.html | 4 ++-- guides/tags/guide/index.html | 4 ++-- guides/tags/guides/index.html | 4 ++-- guides/tags/help/index.html | 4 ++-- guides/tags/index.html | 4 ++-- guides/tags/keys/index.html | 4 ++-- guides/tags/keystore/index.html | 4 ++-- guides/tags/ownership/index.html | 4 ++-- guides/tags/private-keys/index.html | 4 ++-- guides/tags/public-keys/index.html | 4 ++-- guides/tags/rebuild/index.html | 4 ++-- guides/tags/setup/index.html | 4 ++-- guides/tags/transfer/index.html | 4 ++-- guides/tags/update/index.html | 4 ++-- index.html | 4 ++-- references/Docker/build-and-run-in-docker/index.html | 6 +++--- .../Lightning CLI/backing-up-the-keystore/index.html | 6 +++--- .../Lightning CLI/error-building-on-arm64/index.html | 6 +++--- .../index.html | 6 +++--- .../file-permissions-and-ownership/index.html | 6 +++--- references/Lightning CLI/keys-not-found/index.html | 6 +++--- .../node-secret-key-does-not-exist/index.html | 6 +++--- .../permission-denied-os-error-13/index.html | 6 +++--- .../Lightning CLI/uninstall-lightning-node/index.html | 6 +++--- .../Lightning CLI/update-cli-from-source-code/index.html | 6 +++--- .../service-keeps-running-after-shutdown/index.html | 6 +++--- references/Systemd/shutting-down-persistance/index.html | 6 +++--- references/Systemd/user-service/index.html | 6 +++--- references/index.html | 6 +++--- references/tags/backup/index.html | 4 ++-- references/tags/build/index.html | 4 ++-- references/tags/clean/index.html | 4 ++-- references/tags/clear/index.html | 4 ++-- references/tags/container/index.html | 4 ++-- references/tags/delete/index.html | 4 ++-- references/tags/docker/index.html | 4 ++-- references/tags/file-permissions/index.html | 4 ++-- references/tags/fix/index.html | 4 ++-- references/tags/frozen/index.html | 4 ++-- references/tags/help/index.html | 4 ++-- references/tags/idle/index.html | 4 ++-- references/tags/image/index.html | 4 ++-- references/tags/index.html | 4 ++-- references/tags/keystore/index.html | 4 ++-- references/tags/lost-keys/index.html | 4 ++-- references/tags/ownership/index.html | 4 ++-- references/tags/permissions/index.html | 4 ++-- references/tags/pkill/index.html | 4 ++-- references/tags/process/index.html | 4 ++-- references/tags/reference/index.html | 4 ++-- references/tags/references/index.html | 4 ++-- references/tags/remove/index.html | 4 ++-- references/tags/restore/index.html | 4 ++-- references/tags/root/index.html | 4 ++-- references/tags/service-error/index.html | 4 ++-- references/tags/shutdown/index.html | 4 ++-- references/tags/sudoer/index.html | 4 ++-- references/tags/systemctl/index.html | 4 ++-- references/tags/systemd/index.html | 4 ++-- references/tags/uninstall/index.html | 4 ++-- references/tags/unit/index.html | 4 ++-- references/tags/update/index.html | 4 ++-- references/tags/upgrade/index.html | 4 ++-- references/tags/user-service/index.html | 4 ++-- search/index.html | 4 ++-- 201 files changed, 404 insertions(+), 404 deletions(-) rename assets/js/{1c14429f.1c39ae8b.js => 1c14429f.8304ed86.js} (99%) rename assets/js/{1d8a5d15.892ac60d.js => 1d8a5d15.007acdee.js} (99%) rename assets/js/{2730e145.653238d1.js => 2730e145.43b66d7d.js} (99%) rename assets/js/{29b62a39.80ee5756.js => 29b62a39.c0bf41f4.js} (98%) rename assets/js/{29b83576.6072e2a5.js => 29b83576.507a0b0b.js} (99%) rename assets/js/{40aeb86f.13d479d3.js => 40aeb86f.c592360f.js} (99%) rename assets/js/{445e9e2a.cd1e4df3.js => 445e9e2a.f5d9aefe.js} (97%) create mode 100644 assets/js/4c9535f7.07ee15ee.js delete mode 100644 assets/js/4c9535f7.1505dcc3.js rename assets/js/{4d7007b2.6418c206.js => 4d7007b2.bc866e91.js} (98%) rename assets/js/{51d5b592.ef253045.js => 51d5b592.e890f6e2.js} (88%) rename assets/js/{5437f376.426b68ec.js => 5437f376.7410f8c6.js} (99%) rename assets/js/{5b6134d1.bd33ad36.js => 5b6134d1.d8e23f3c.js} (99%) rename assets/js/{5bc389a1.0b96f914.js => 5bc389a1.3fe4b2bd.js} (99%) rename assets/js/{6be32138.c839bfac.js => 6be32138.ee48b118.js} (99%) rename assets/js/{7aefc753.5dcd8f5d.js => 7aefc753.695b86b0.js} (99%) rename assets/js/{8a92e787.a803ca01.js => 8a92e787.8a1b5d51.js} (99%) rename assets/js/{98f9308d.8dde6aa3.js => 98f9308d.b6142649.js} (99%) rename assets/js/{b2f554cd.89e02325.js => b2f554cd.26978dab.js} (99%) rename assets/js/{b35f1b7f.5506d9ad.js => b35f1b7f.902fd0cd.js} (99%) rename assets/js/{d1b78a4d.e12e16bb.js => d1b78a4d.b9f410cf.js} (98%) rename assets/js/{d23df0ea.a6176b99.js => d23df0ea.a1dd5725.js} (99%) rename assets/js/{d7d81bf6.9e13fcfa.js => d7d81bf6.4a15a96e.js} (99%) rename assets/js/{d8be0e5a.5b73083f.js => d8be0e5a.683fe5b5.js} (99%) rename assets/js/{fd2b74dc.550c03dc.js => fd2b74dc.711c1116.js} (98%) rename assets/js/{runtime~main.395a551d.js => runtime~main.fa9eda83.js} (90%) diff --git a/404.html b/404.html index 15abd7c2e..04b7853b4 100644 --- a/404.html +++ b/404.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/assets/js/1c14429f.1c39ae8b.js b/assets/js/1c14429f.8304ed86.js similarity index 99% rename from assets/js/1c14429f.1c39ae8b.js rename to assets/js/1c14429f.8304ed86.js index 6caca5074..e413b2823 100644 --- a/assets/js/1c14429f.1c39ae8b.js +++ b/assets/js/1c14429f.8304ed86.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[2702],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var o=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=o.createContext({}),d=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=d(e.components);return o.createElement(s.Provider,{value:t},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},h=o.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||r;return n?o.createElement(m,i(i({ref:t},c),{},{components:n})):o.createElement(m,i({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,i=new Array(r);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var d=2;d{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>u});var o=n(7462),a=(n(7294),n(3905)),r=n(3872),i=n(2915);const l={template:"post",draft:!1,hide_title:!0,title:"Getting Started",slug:"getting-started",date:new Date("2023-08-31T23:00:00.000Z"),image:"./assets/getting-started.png?202311181211",canonical:"",description:"A first look at what Fleek Network is, why it's important, and a simple tutorial of running and interacting with a node on your local machine!",category:"Tutorial",tags:["Edge computing","Guide","Getting Started"]},s=void 0,d={unversionedId:"Node Operators/getting-started-guide",id:"Node Operators/getting-started-guide",title:"Getting Started",description:"A first look at what Fleek Network is, why it's important, and a simple tutorial of running and interacting with a node on your local machine!",source:"@site/guides/Node Operators/getting-started-guide.md",sourceDirName:"Node Operators",slug:"/Node Operators/getting-started",permalink:"/guides/Node Operators/getting-started",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/guides/Node Operators/getting-started-guide.md",tags:[{label:"Edge computing",permalink:"/guides/tags/edge-computing"},{label:"Guide",permalink:"/guides/tags/guide"},{label:"Getting Started",permalink:"/guides/tags/getting-started"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{template:"post",draft:!1,hide_title:!0,title:"Getting Started",slug:"getting-started",date:"2023-08-31T23:00:00.000Z",image:"./assets/getting-started.png?202311181211",canonical:"",description:"A first look at what Fleek Network is, why it's important, and a simple tutorial of running and interacting with a node on your local machine!",category:"Tutorial",tags:["Edge computing","Guide","Getting Started"]},sidebar:"defaultSidebar",previous:{title:"About guides",permalink:"/guides/"},next:{title:"Managing the keystore",permalink:"/guides/Node Operators/managing-the-keystore"}},c={image:n(7860).Z},u=[{value:"Introduction",id:"introduction",level:2},{value:"Pre-requisites",id:"pre-requisites",level:2},{value:"Need a quick Fleek Network TL;DR?",id:"need-a-quick-fleek-network-tldr",level:2},{value:"Why is Fleek Network needed?",id:"why-is-fleek-network-needed",level:2},{value:"How Does Fleek Network Work?",id:"how-does-fleek-network-work",level:2},{value:"Running a Node",id:"running-a-node",level:2},{value:"Clone the source code",id:"clone-the-source-code",level:3},{value:"Dependencies",id:"dependencies",level:3},{value:"Build",id:"build",level:3},{value:"Node Launch",id:"node-launch",level:3},{value:"Health check",id:"health-check",level:3},{value:"Next steps",id:"next-steps",level:2},{value:"Conclusion",id:"conclusion",level:2}],p={toc:u},h="wrapper";function m(e){let{components:t,...l}=e;return(0,a.kt)(h,(0,o.Z)({},p,l,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"Getting started guide",src:n(7860).Z,width:"1450",height:"816"})),(0,a.kt)("h2",{id:"introduction"},"Introduction"),(0,a.kt)("p",null,"For this guide, we\u2019ll have a simple look into how Fleek Network works in its current development phase and briefly share some of the core concepts like spinning up a node."),(0,a.kt)("p",null,"For those seeking advanced knowledge:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Read our ",(0,a.kt)("a",{parentName:"li",href:"/docs/whitepaper"},"whitepaper"),"."),(0,a.kt)("li",{parentName:"ul"},"Check out ",(0,a.kt)("a",{parentName:"li",href:"https://github.com/fleek-network/lightning"},"our open-source code"),".")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you find any typos in our documentation, feel free to ",(0,a.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"provide us feedback")," or contribute by opening a PR in our repository ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/fleek-network-docs/"},"here"),".")),(0,a.kt)("h2",{id:"pre-requisites"},"Pre-requisites"),(0,a.kt)("p",null,"To follow the guide, you will need the following:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Familiarity with the command-line interface"),(0,a.kt)("li",{parentName:"ul"},"Git")),(0,a.kt)("h2",{id:"need-a-quick-fleek-network-tldr"},"Need a quick Fleek Network TL;DR?"),(0,a.kt)("p",null,"Fleek Network is an open-source edge computing platform to accelerate the development and execution of the next generation of web services."),(0,a.kt)("p",null,"The system is built on a distributed network of nodes, where services run within a fair and incentivized ecosystem constituted by an open community of developers and operators. It relies on blockchain technology at its core, allowing governance and token rewards as incentives for participation in serving the network."),(0,a.kt)("p",null,"Made by an open community that's free to operate nodes or build services without the need for approvals, permissions, or intermediaries. Or simply, consume Fleek Network resources on demand, from anywhere, provided by services running on the edge."),(0,a.kt)("p",null,"Applications, platforms and protocols build and utilize decentralized services on the Fleek Network to optimize performance and reduce dependency on typical centralized cloud providers and corporate infrastructure."),(0,a.kt)("p",null,"Developers can build faster and launch better products by offloading parts of the development stack to the edge to focus on core features for the value proposition of the services being developed."),(0,a.kt)("p",null,"To get started, install a Network Node in a ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/requirements"},"supported")," Linux server, such as Debian or Ubuntu (latest) by utilizing our simple ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/install#assisted-installer"},"assisted installer")," to help onboard as quickly as possible."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"Our network is open to everyone, so you're more than welcome to join us anytime without any restrictions, permission or formalities. We'd be happy to have you as part of our community!")),(0,a.kt)("p",null,"Once connected to the server, open a terminal window and execute the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"curl https://get.fleek.network | bash\n")),(0,a.kt)("p",null,"Follow the install assistant recommendations to have the node ready without hassle and as quickly as possible."),(0,a.kt)("h2",{id:"why-is-fleek-network-needed"},"Why is Fleek Network needed?"),(0,a.kt)("p",null,"Web3 products typically rely on centralized cloud infrastructure, which is vulnerable to attacks as computation and data can be easily manipulated to suit business goals. However, blockchain technology has paved the way for a new era of decentralized cloud computing and data storage. The Fleek Network offers a sustainable alternative to traditional centralized architectures, providing a secure, transparent, and accessible decentralized edge computing future for everyone."),(0,a.kt)("h2",{id:"how-does-fleek-network-work"},"How Does Fleek Network Work?"),(0,a.kt)("p",null,"When a client requests a service, the protocol determines the best route to the nodes where the service replicas and workload are allocated."),(0,a.kt)("p",null,"Once the computation is successful, the data streaming routes to the client. On-client request fulfillment, a proof of delivery is generated containing cryptographically secured metadata about the original request, any parts involved and the resources consumed."),(0,a.kt)("p",null,"The Delivery Acknowledgements are stored locally in the participating node memory pools, rolled up to the protocol consensus consistently throughout the Epoch. This agreement is formed by a random committee of any healthy Nodes that use the information provided to reward the Nodes fairly."),(0,a.kt)("h2",{id:"running-a-node"},"Running a Node"),(0,a.kt)("p",null,"A Fleek Network node can be built and run on your machine. It\u2019s an ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"open-source project")," and is open for contributions."),(0,a.kt)("p",null,"The project is written with Rust, a general-purpose programming language that you need to have installed in advance to be able to follow the current guide."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"To set up Rust, packages and library dependencies can be tricky. The quickest is to visit the ",(0,a.kt)("a",{parentName:"p",href:"https://rustup.rs/"},"rustup.rs"),". Alternatively, if you haven't already, the build section has a ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/install#manual-installation"},"manual installation")," document to help.")),(0,a.kt)("h3",{id:"clone-the-source-code"},"Clone the source code"),(0,a.kt)("p",null,"We\u2019ll clone the repository locally, build it and interact with the node through the binary or the HTTP JSON-RPC API with a client like cURL, but you can use a GUI (Postman, Insomnia, amongst others) if you prefer."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"The ~/fleek-network/lightning or $HOME/fleek-network/lightning directory is the default or recommended location to store the repository. If you like to follow conventions, then is best to stick with the recommendation, to avoid confusion and make it easier to follow our documentation.")),(0,a.kt)("p",null,"Start by cloning the repository located at ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"https://github.com/fleek-network/lightning")),(0,a.kt)(i.ZP,{mdxType:"GitCloneOptions"}),(0,a.kt)("p",null,"Once the git clone completes, you\u2019ll have the latest version at the time of cloning. You should use git to fetch or pull the latest versions consequently."),(0,a.kt)("h3",{id:"dependencies"},"Dependencies"),(0,a.kt)("p",null,"Install the required dependencies necessary for compiling general software and for our use-case Lightning CLI."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get install \\\n build-essential \\\n clang \\\n pkg-config \\\n libssl-dev \\\n gcc-multilib \\\n protobuf-compiler\n")),(0,a.kt)("h3",{id:"build"},"Build"),(0,a.kt)("p",null,"Start by changing the directory to the project directory where the source code is stored. If you have followed the recommended location that'll be ",(0,a.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning"),", as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,a.kt)("p",null,"Run the Rust package manager clean and update commands."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"cargo clean\ncargo update\n")),(0,a.kt)("p",null,"Next, execute the build command to compile the Fleek Network Lightning CLI binary."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"cargo +stable build --release\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"The build command uses the Rust compiler, which might take a while depending on how speedy the host machine is capable.")),(0,a.kt)("p",null,"Once the Rust compiler completes, the generated binary will be available in the source code project directory. If you stick with the default, that'll look like ",(0,a.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/target/debug/lightning-node"),"."),(0,a.kt)("p",null,"To avoid having to specify the pathname every time, create a symbolic link to keep it short. Here we'll name the process as the global ",(0,a.kt)("inlineCode",{parentName:"p"},"lgtn"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'sudo ln -s "~/fleek-network/lightning/target/debug/lightning-node" /usr/local/bin/lgtn\n')),(0,a.kt)("p",null,"Run the CLI with the flag ",(0,a.kt)("inlineCode",{parentName:"p"},"version")," to confirm it's available globally."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn --version\n")),(0,a.kt)("p",null,"The output should look like:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"Usage: lgtn [OPTIONS] \n\nCommands:\n run Start the node\n keys Handle keys\n print-config Print the loaded configuration\n dev-init-only Initialize the node without starting it\n dev-dump-graph Dump the infusion graph of the node instance\n help Print this message or the help of the given subcommand(s)\n\nOptions:\n -c, --config Path to the toml configuration file [default: ~/.lightning/config.toml]\n --with-mock-consensus Determines that we should be using the mock consensus backend\n -v... Increases the level of verbosity (the max level is -vvv)\n --log-location Print code location on console logs\n -h, --help Print help\n -V, --version Print version\n")),(0,a.kt)("h3",{id:"node-launch"},"Node Launch"),(0,a.kt)("p",null,"After ",(0,a.kt)("a",{parentName:"p",href:"#build"},"building"),", the node can be launched by running the subcommand ",(0,a.kt)("inlineCode",{parentName:"p"},"run"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn run\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"It's highly recommend to use systemd to manage the Fleek Network service for node operators. Systemd is a system and service manager for Linux operating systems that provides a consistent way to manage system services across various distributions.")),(0,a.kt)("p",null,"Learn how to create a new Systemd service in the ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/install#manual-installation"},"manual installation")," document."),(0,a.kt)("h3",{id:"health-check"},"Health check"),(0,a.kt)("p",null,"It's important for Node operators to regularly check on the health of their resources to make sure everything is running smoothly. By doing this, they can get helpful feedback and know for sure if their Node is up and running. Some experienced node operators even automate this process using cronjobs and get reports sent to them via email or other custom methods."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'curl -w "\\n" localhost:4230/health\n')),(0,a.kt)("p",null,"If everything goes well, the response should be:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"OK\n")),(0,a.kt)("p",null,"Alternatively, use the JSON-RPC method ",(0,a.kt)("inlineCode",{parentName:"p"},"flk_ping"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'curl -s \\\n -X POST \\\n -H "Content-Type: application/json" \\\n -d \'{\n "jsonrpc": "2.0",\n "method": "flk_ping",\n "params": [],\n "id": 1\n }\' \\\n localhost:4230/rpc/v0\n')),(0,a.kt)("p",null,"Which response should return the key ",(0,a.kt)("inlineCode",{parentName:"p"},"result")," with value ",(0,a.kt)("inlineCode",{parentName:"p"},"pong"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'{\n "jsonrpc": "2.0",\n "result": "pong",\n "id": 1\n}\n')),(0,a.kt)("h2",{id:"next-steps"},"Next steps"),(0,a.kt)("p",null,"While you can run the Network Node as described here, it's required to set up the Network Node correctly and securely! It requires some degree of patience, knowledge and time to go through our guides, but we'll provide some guides and references to help you manage your network node server!"),(0,a.kt)("p",null,"To avoid having to go through all the steps manually, we recommend reading our ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/install#assisted-installer"},"assisted installer")," document for quick onboarding."),(0,a.kt)("h2",{id:"conclusion"},"Conclusion"),(0,a.kt)("p",null,"We introduced Fleek Network as an open-source edge computing platform to help us accelerate the development and execution of the next generation of web services."),(0,a.kt)("p",null,"We have learned a bit about the importance of a decentralized edge computing network to reach and fulfill the future of computation and how the Fleek Network protocol works succinctly."),(0,a.kt)("p",null,"Furthermore, we guide you through a step-by-step installation of the network node process, where we pull the source code, build the binary and launch the service."),(0,a.kt)("p",null,"Finally, we do a quick health check to confirm the status of our node."),(0,a.kt)("p",null,"Discover more about the project by ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"watching/contributing on GitHub"),", following us on ",(0,a.kt)("a",{parentName:"p",href:"https://twitter.com/fleek_net"},"Twitter"),", and joining ",(0,a.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"our community Discord")," for any updates."),(0,a.kt)(r.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}m.isMDXComponent=!0},2915:(e,t,n)=>{n.d(t,{ZP:()=>l});var o=n(7462),a=(n(7294),n(3905));const r={toc:[]},i="wrapper";function l(e){let{components:t,...n}=e;return(0,a.kt)(i,(0,o.Z)({},r,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"You have several ways of doing this:"),(0,a.kt)("ul",{parentName:"admonition"},(0,a.kt)("li",{parentName:"ul"},"Clone via HTTPS"),(0,a.kt)("li",{parentName:"ul"},"Clone via SSH"),(0,a.kt)("li",{parentName:"ul"},"Download via Github CLI"),(0,a.kt)("li",{parentName:"ul"},"Download the ",(0,a.kt)("a",{parentName:"li",href:"https://github.com/fleek-network/lightning/archive/refs/heads/main.zip"},"zip package")," from the repository")),(0,a.kt)("p",{parentName:"admonition"},"We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this.\nAlthough, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it ",(0,a.kt)("a",{parentName:"p",href:"https://docs.github.com/en/authentication/connecting-to-github-with-ssh"},"here"),"."),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git \n")),(0,a.kt)("p",{parentName:"admonition"},"At time of writing, we are checking the branch name ",(0,a.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1")," that corresponds to the testnet phase.\nHere's an example of what it'd look like when sticking to the recommended path location:"),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning\n"))))}l.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>a});var o=n(7294);const a=e=>{let{image:t,name:n,title:a,url:r,communityMember:i=!1}=e;return o.createElement("section",{className:"author_card"},o.createElement("div",null,o.createElement("span",{className:"avatar"},o.createElement("a",{href:r,target:"_blank",alt:n},o.createElement("img",{src:t,alt:n}))),o.createElement("div",null,o.createElement("span",{className:"name"},o.createElement("a",{href:r,target:"_blank",alt:n},n)),o.createElement("span",{className:"title"},a),o.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",o.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}},7860:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/getting-started-e00548e77105d1efbb6c436314fca278.png"}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[2702],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var o=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=o.createContext({}),d=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=d(e.components);return o.createElement(s.Provider,{value:t},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},h=o.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(n),h=a,m=u["".concat(s,".").concat(h)]||u[h]||p[h]||r;return n?o.createElement(m,i(i({ref:t},c),{},{components:n})):o.createElement(m,i({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,i=new Array(r);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var d=2;d{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>u});var o=n(7462),a=(n(7294),n(3905)),r=n(3872),i=n(2915);const l={template:"post",draft:!1,hide_title:!0,title:"Getting Started",slug:"getting-started",date:new Date("2023-08-31T23:00:00.000Z"),image:"./assets/getting-started.png?202311181211",canonical:"",description:"A first look at what Fleek Network is, why it's important, and a simple tutorial of running and interacting with a node on your local machine!",category:"Tutorial",tags:["Edge computing","Guide","Getting Started"]},s=void 0,d={unversionedId:"Node Operators/getting-started-guide",id:"Node Operators/getting-started-guide",title:"Getting Started",description:"A first look at what Fleek Network is, why it's important, and a simple tutorial of running and interacting with a node on your local machine!",source:"@site/guides/Node Operators/getting-started-guide.md",sourceDirName:"Node Operators",slug:"/Node Operators/getting-started",permalink:"/guides/Node Operators/getting-started",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/guides/Node Operators/getting-started-guide.md",tags:[{label:"Edge computing",permalink:"/guides/tags/edge-computing"},{label:"Guide",permalink:"/guides/tags/guide"},{label:"Getting Started",permalink:"/guides/tags/getting-started"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{template:"post",draft:!1,hide_title:!0,title:"Getting Started",slug:"getting-started",date:"2023-08-31T23:00:00.000Z",image:"./assets/getting-started.png?202311181211",canonical:"",description:"A first look at what Fleek Network is, why it's important, and a simple tutorial of running and interacting with a node on your local machine!",category:"Tutorial",tags:["Edge computing","Guide","Getting Started"]},sidebar:"defaultSidebar",previous:{title:"About guides",permalink:"/guides/"},next:{title:"Managing the keystore",permalink:"/guides/Node Operators/managing-the-keystore"}},c={image:n(7860).Z},u=[{value:"Introduction",id:"introduction",level:2},{value:"Pre-requisites",id:"pre-requisites",level:2},{value:"Need a quick Fleek Network TL;DR?",id:"need-a-quick-fleek-network-tldr",level:2},{value:"Why is Fleek Network needed?",id:"why-is-fleek-network-needed",level:2},{value:"How Does Fleek Network Work?",id:"how-does-fleek-network-work",level:2},{value:"Running a Node",id:"running-a-node",level:2},{value:"Clone the source code",id:"clone-the-source-code",level:3},{value:"Dependencies",id:"dependencies",level:3},{value:"Build",id:"build",level:3},{value:"Node Launch",id:"node-launch",level:3},{value:"Health check",id:"health-check",level:3},{value:"Next steps",id:"next-steps",level:2},{value:"Conclusion",id:"conclusion",level:2}],p={toc:u},h="wrapper";function m(e){let{components:t,...l}=e;return(0,a.kt)(h,(0,o.Z)({},p,l,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"Getting started guide",src:n(7860).Z,width:"1450",height:"816"})),(0,a.kt)("h2",{id:"introduction"},"Introduction"),(0,a.kt)("p",null,"For this guide, we\u2019ll have a simple look into how Fleek Network works in its current development phase and briefly share some of the core concepts like spinning up a node."),(0,a.kt)("p",null,"For those seeking advanced knowledge:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Read our ",(0,a.kt)("a",{parentName:"li",href:"/docs/whitepaper"},"whitepaper"),"."),(0,a.kt)("li",{parentName:"ul"},"Check out ",(0,a.kt)("a",{parentName:"li",href:"https://github.com/fleek-network/lightning"},"our open-source code"),".")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"If you find any typos in our documentation, feel free to ",(0,a.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"provide us feedback")," or contribute by opening a PR in our repository ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/fleek-network-docs/"},"here"),".")),(0,a.kt)("h2",{id:"pre-requisites"},"Pre-requisites"),(0,a.kt)("p",null,"To follow the guide, you will need the following:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Familiarity with the command-line interface"),(0,a.kt)("li",{parentName:"ul"},"Git")),(0,a.kt)("h2",{id:"need-a-quick-fleek-network-tldr"},"Need a quick Fleek Network TL;DR?"),(0,a.kt)("p",null,"Fleek Network is an open-source edge computing platform to accelerate the development and execution of the next generation of web services."),(0,a.kt)("p",null,"The system is built on a distributed network of nodes, where services run within a fair and incentivized ecosystem constituted by an open community of developers and operators. It relies on blockchain technology at its core, allowing governance and token rewards as incentives for participation in serving the network."),(0,a.kt)("p",null,"Made by an open community that's free to operate nodes or build services without the need for approvals, permissions, or intermediaries. Or simply, consume Fleek Network resources on demand, from anywhere, provided by services running on the edge."),(0,a.kt)("p",null,"Applications, platforms and protocols build and utilize decentralized services on the Fleek Network to optimize performance and reduce dependency on typical centralized cloud providers and corporate infrastructure."),(0,a.kt)("p",null,"Developers can build faster and launch better products by offloading parts of the development stack to the edge to focus on core features for the value proposition of the services being developed."),(0,a.kt)("p",null,"To get started, install a Network Node in a ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/requirements"},"supported")," Linux server, such as Debian or Ubuntu (latest) by utilizing our simple ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/install#assisted-installer"},"assisted installer")," to help onboard as quickly as possible."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"Our network is open to everyone, so you're more than welcome to join us anytime without any restrictions, permission or formalities. We'd be happy to have you as part of our community!")),(0,a.kt)("p",null,"Once connected to the server, open a terminal window and execute the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"curl https://get.fleek.network | bash\n")),(0,a.kt)("p",null,"Follow the install assistant recommendations to have the node ready without hassle and as quickly as possible."),(0,a.kt)("h2",{id:"why-is-fleek-network-needed"},"Why is Fleek Network needed?"),(0,a.kt)("p",null,"Web3 products typically rely on centralized cloud infrastructure, which is vulnerable to attacks as computation and data can be easily manipulated to suit business goals. However, blockchain technology has paved the way for a new era of decentralized cloud computing and data storage. The Fleek Network offers a sustainable alternative to traditional centralized architectures, providing a secure, transparent, and accessible decentralized edge computing future for everyone."),(0,a.kt)("h2",{id:"how-does-fleek-network-work"},"How Does Fleek Network Work?"),(0,a.kt)("p",null,"When a client requests a service, the protocol determines the best route to the nodes where the service replicas and workload are allocated."),(0,a.kt)("p",null,"Once the computation is successful, the data streaming routes to the client. On-client request fulfillment, a proof of delivery is generated containing cryptographically secured metadata about the original request, any parts involved and the resources consumed."),(0,a.kt)("p",null,"The Delivery Acknowledgements are stored locally in the participating node memory pools, rolled up to the protocol consensus consistently throughout the Epoch. This agreement is formed by a random committee of any healthy Nodes that use the information provided to reward the Nodes fairly."),(0,a.kt)("h2",{id:"running-a-node"},"Running a Node"),(0,a.kt)("p",null,"A Fleek Network node can be built and run on your machine. It\u2019s an ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"open-source project")," and is open for contributions."),(0,a.kt)("p",null,"The project is written with Rust, a general-purpose programming language that you need to have installed in advance to be able to follow the current guide."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"To set up Rust, packages and library dependencies can be tricky. The quickest is to visit the ",(0,a.kt)("a",{parentName:"p",href:"https://rustup.rs/"},"rustup.rs"),". Alternatively, if you haven't already, the build section has a ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/install#manual-installation"},"manual installation")," document to help.")),(0,a.kt)("h3",{id:"clone-the-source-code"},"Clone the source code"),(0,a.kt)("p",null,"We\u2019ll clone the repository locally, build it and interact with the node through the binary or the HTTP JSON-RPC API with a client like cURL, but you can use a GUI (Postman, Insomnia, amongst others) if you prefer."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"The ~/fleek-network/lightning or $HOME/fleek-network/lightning directory is the default or recommended location to store the repository. If you like to follow conventions, then is best to stick with the recommendation, to avoid confusion and make it easier to follow our documentation.")),(0,a.kt)("p",null,"Start by cloning the repository located at ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"https://github.com/fleek-network/lightning")),(0,a.kt)(i.ZP,{mdxType:"GitCloneOptions"}),(0,a.kt)("p",null,"Once the git clone completes, you\u2019ll have the latest version at the time of cloning. You should use git to fetch or pull the latest versions consequently."),(0,a.kt)("h3",{id:"dependencies"},"Dependencies"),(0,a.kt)("p",null,"Install the required dependencies necessary for compiling general software and for our use-case Lightning CLI."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get install \\\n build-essential \\\n clang \\\n pkg-config \\\n libssl-dev \\\n gcc-multilib \\\n protobuf-compiler\n")),(0,a.kt)("h3",{id:"build"},"Build"),(0,a.kt)("p",null,"Start by changing the directory to the project directory where the source code is stored. If you have followed the recommended location that'll be ",(0,a.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning"),", as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,a.kt)("p",null,"Run the Rust package manager clean and update commands."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"cargo clean\ncargo update\n")),(0,a.kt)("p",null,"Next, execute the build command to compile the Fleek Network Lightning CLI binary."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"cargo +stable build --release\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"The build command uses the Rust compiler, which might take a while depending on how speedy the host machine is capable.")),(0,a.kt)("p",null,"Once the Rust compiler completes, the generated binary will be available in the source code project directory. If you stick with the default, that'll look like ",(0,a.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/target/debug/lightning-node"),"."),(0,a.kt)("p",null,"To avoid having to specify the pathname every time, create a symbolic link to keep it short. Here we'll name the process as the global ",(0,a.kt)("inlineCode",{parentName:"p"},"lgtn"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'sudo ln -s "~/fleek-network/lightning/target/debug/lightning-node" /usr/local/bin/lgtn\n')),(0,a.kt)("p",null,"Run the CLI with the flag ",(0,a.kt)("inlineCode",{parentName:"p"},"version")," to confirm it's available globally."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn --version\n")),(0,a.kt)("p",null,"The output should look like:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"Usage: lgtn [OPTIONS] \n\nCommands:\n run Start the node\n keys Handle keys\n print-config Print the loaded configuration\n dev-init-only Initialize the node without starting it\n dev-dump-graph Dump the infusion graph of the node instance\n help Print this message or the help of the given subcommand(s)\n\nOptions:\n -c, --config Path to the toml configuration file [default: ~/.lightning/config.toml]\n --with-mock-consensus Determines that we should be using the mock consensus backend\n -v... Increases the level of verbosity (the max level is -vvv)\n --log-location Print code location on console logs\n -h, --help Print help\n -V, --version Print version\n")),(0,a.kt)("h3",{id:"node-launch"},"Node Launch"),(0,a.kt)("p",null,"After ",(0,a.kt)("a",{parentName:"p",href:"#build"},"building"),", the node can be launched by running the subcommand ",(0,a.kt)("inlineCode",{parentName:"p"},"run"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn run\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"It's highly recommend to use systemd to manage the Fleek Network service for node operators. Systemd is a system and service manager for Linux operating systems that provides a consistent way to manage system services across various distributions.")),(0,a.kt)("p",null,"Learn how to create a new Systemd service in the ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/install#manual-installation"},"manual installation")," document."),(0,a.kt)("h3",{id:"health-check"},"Health check"),(0,a.kt)("p",null,"It's important for Node operators to regularly check on the health of their resources to make sure everything is running smoothly. By doing this, they can get helpful feedback and know for sure if their Node is up and running. Some experienced node operators even automate this process using cronjobs and get reports sent to them via email or other custom methods."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'curl -w "\\n" localhost:4230/health\n')),(0,a.kt)("p",null,"If everything goes well, the response should be:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"OK\n")),(0,a.kt)("p",null,"Alternatively, use the JSON-RPC method ",(0,a.kt)("inlineCode",{parentName:"p"},"flk_ping"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'curl -s \\\n -X POST \\\n -H "Content-Type: application/json" \\\n -d \'{\n "jsonrpc": "2.0",\n "method": "flk_ping",\n "params": [],\n "id": 1\n }\' \\\n localhost:4230/rpc/v0\n')),(0,a.kt)("p",null,"Which response should return the key ",(0,a.kt)("inlineCode",{parentName:"p"},"result")," with value ",(0,a.kt)("inlineCode",{parentName:"p"},"pong"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'{\n "jsonrpc": "2.0",\n "result": "pong",\n "id": 1\n}\n')),(0,a.kt)("h2",{id:"next-steps"},"Next steps"),(0,a.kt)("p",null,"While you can run the Network Node as described here, it's required to set up the Network Node correctly and securely! It requires some degree of patience, knowledge and time to go through our guides, but we'll provide some guides and references to help you manage your network node server!"),(0,a.kt)("p",null,"To avoid having to go through all the steps manually, we recommend reading our ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/install#assisted-installer"},"assisted installer")," document for quick onboarding."),(0,a.kt)("h2",{id:"conclusion"},"Conclusion"),(0,a.kt)("p",null,"We introduced Fleek Network as an open-source edge computing platform to help us accelerate the development and execution of the next generation of web services."),(0,a.kt)("p",null,"We have learned a bit about the importance of a decentralized edge computing network to reach and fulfill the future of computation and how the Fleek Network protocol works succinctly."),(0,a.kt)("p",null,"Furthermore, we guide you through a step-by-step installation of the network node process, where we pull the source code, build the binary and launch the service."),(0,a.kt)("p",null,"Finally, we do a quick health check to confirm the status of our node."),(0,a.kt)("p",null,"Discover more about the project by ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"watching/contributing on GitHub"),", following us on ",(0,a.kt)("a",{parentName:"p",href:"https://twitter.com/fleek_net"},"Twitter"),", and joining ",(0,a.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"our community Discord")," for any updates."),(0,a.kt)(r.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}m.isMDXComponent=!0},2915:(e,t,n)=>{n.d(t,{ZP:()=>l});var o=n(7462),a=(n(7294),n(3905));const r={toc:[]},i="wrapper";function l(e){let{components:t,...n}=e;return(0,a.kt)(i,(0,o.Z)({},r,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"You have several ways of doing this:"),(0,a.kt)("ul",{parentName:"admonition"},(0,a.kt)("li",{parentName:"ul"},"Clone via HTTPS"),(0,a.kt)("li",{parentName:"ul"},"Clone via SSH"),(0,a.kt)("li",{parentName:"ul"},"Download via Github CLI"),(0,a.kt)("li",{parentName:"ul"},"Download the ",(0,a.kt)("a",{parentName:"li",href:"https://github.com/fleek-network/lightning/archive/refs/heads/main.zip"},"zip package")," from the repository")),(0,a.kt)("p",{parentName:"admonition"},"We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this.\nAlthough, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it ",(0,a.kt)("a",{parentName:"p",href:"https://docs.github.com/en/authentication/connecting-to-github-with-ssh"},"here"),"."),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git \n")),(0,a.kt)("p",{parentName:"admonition"},"At time of writing, we are checking the branch name ",(0,a.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1")," that corresponds to the testnet phase.\nHere's an example of what it'd look like when sticking to the recommended path location:"),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning\n"))))}l.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>a});var o=n(7294);const a=e=>{let{image:t,name:n,title:a,url:r,communityMember:i=!1}=e;return o.createElement("section",{className:"author_card"},o.createElement("div",null,o.createElement("span",{className:"avatar"},o.createElement("a",{href:r,target:"_blank",alt:n},o.createElement("img",{src:t,alt:n}))),o.createElement("div",null,o.createElement("span",{className:"name"},o.createElement("a",{href:r,target:"_blank",alt:n},n)),o.createElement("span",{className:"title"},a),o.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",o.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}},7860:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/getting-started-e00548e77105d1efbb6c436314fca278.png"}}]); \ No newline at end of file diff --git a/assets/js/1d8a5d15.892ac60d.js b/assets/js/1d8a5d15.007acdee.js similarity index 99% rename from assets/js/1d8a5d15.892ac60d.js rename to assets/js/1d8a5d15.007acdee.js index 0b1dda735..4d623dd60 100644 --- a/assets/js/1d8a5d15.892ac60d.js +++ b/assets/js/1d8a5d15.007acdee.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[9854],{3905:(e,t,n)=>{n.d(t,{Zo:()=>h,kt:()=>c});var o=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=o.createContext({}),p=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},h=function(e){var t=p(e.components);return o.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,h=s(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,c=d["".concat(l,".").concat(m)]||d[m]||u[m]||a;return n?o.createElement(c,i(i({ref:t},h),{},{components:n})):o.createElement(c,i({ref:t},h))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[d]="string"==typeof e?e:r,i[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>g,frontMatter:()=>l,metadata:()=>h,toc:()=>u});var o=n(7462),r=(n(7294),n(3905)),a=n(3872),i=n(6733),s=n(3242);const l={template:"post",draft:!1,hide_title:!0,title:"Transfering setup ownership",slug:"transfering-setup-ownership",image:"./assets/transfering-setup-ownership.png?202311181223",date:new Date("2023-09-12T23:00:00.000Z"),description:"A step-by-step guide to transfer the ownership of the Fleek Network Lightning CLI and service setup",category:"Tutorial",tags:["transfer","ownership","guide","setup","configuration"]},p=void 0,h={unversionedId:"Node Operators/transfering-setup-ownership",id:"Node Operators/transfering-setup-ownership",title:"Transfering setup ownership",description:"A step-by-step guide to transfer the ownership of the Fleek Network Lightning CLI and service setup",source:"@site/guides/Node Operators/transfering-setup-ownership.md",sourceDirName:"Node Operators",slug:"/Node Operators/transfering-setup-ownership",permalink:"/guides/Node Operators/transfering-setup-ownership",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/guides/Node Operators/transfering-setup-ownership.md",tags:[{label:"transfer",permalink:"/guides/tags/transfer"},{label:"ownership",permalink:"/guides/tags/ownership"},{label:"guide",permalink:"/guides/tags/guide"},{label:"setup",permalink:"/guides/tags/setup"},{label:"configuration",permalink:"/guides/tags/configuration"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{template:"post",draft:!1,hide_title:!0,title:"Transfering setup ownership",slug:"transfering-setup-ownership",image:"./assets/transfering-setup-ownership.png?202311181223",date:"2023-09-12T23:00:00.000Z",description:"A step-by-step guide to transfer the ownership of the Fleek Network Lightning CLI and service setup",category:"Tutorial",tags:["transfer","ownership","guide","setup","configuration"]},sidebar:"defaultSidebar",previous:{title:"Running a node in Docker",permalink:"/guides/Node Operators/running-a-node-in-docker"},next:{title:"Updating Lightning",permalink:"/guides/Node Operators/updating-lightning"}},d={image:n(1e3).Z},u=[{value:"TL;DR",id:"tldr",level:2},{value:"Introduction",id:"introduction",level:2},{value:"Pre-requisites",id:"pre-requisites",level:2},{value:"Ownership of Lightning CLI files",id:"ownership-of-lightning-cli-files",level:2},{value:"Systemd Service",id:"systemd-service",level:2},{value:"Stop the service",id:"stop-the-service",level:2},{value:"Clear the .lightning data",id:"clear-the-lightning-data",level:2},{value:"Create a user",id:"create-a-user",level:2},{value:"Move lightning system and source code directory to user's home",id:"move-lightning-system-and-source-code-directory-to-users-home",level:2},{value:"1) Move the /root/.lightning directory from one user to the other",id:"1-move-the-rootlightning-directory-from-one-user-to-the-other",level:3},{value:"2) Move the /root/fleek-network directory from one user to the other",id:"2-move-the-rootfleek-network-directory-from-one-user-to-the-other",level:3},{value:"3) Confirm move by finding both directories",id:"3-confirm-move-by-finding-both-directories",level:3},{value:"Change ownership of files",id:"change-ownership-of-files",level:2},{value:"The lgtn symbolic link (symlink)",id:"the-lgtn-symbolic-link-symlink",level:2},{value:"Update the Systemd service unit",id:"update-the-systemd-service-unit",level:2},{value:"Update the config.toml with user-preferred file locations",id:"update-the-configtoml-with-user-preferred-file-locations",level:2},{value:"Start the service",id:"start-the-service",level:2},{value:"Conclusion",id:"conclusion",level:2}],m={toc:u},c="wrapper";function g(e){let{components:t,...l}=e;return(0,r.kt)(c,(0,o.Z)({},m,l,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Transfering setup ownership",src:n(2867).Z,width:"1450",height:"816"})),(0,r.kt)("h2",{id:"tldr"},"TL;DR"),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"The step-by-step instructions provided in the guide should be simple to follow, but the process is also available as an automated script from our familiar ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/get.fleek.network"},"get.fleek.network")," tool."),(0,r.kt)("p",{parentName:"admonition"},"To use the automated script execute the following command in your server terminal and follow the instructions:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"curl -sS https://get.fleek.network/transfer_system_user_setup_ownership | bash\n")),(0,r.kt)("p",{parentName:"admonition"},"We try to make the auomated scripts as useful as possible, but it's impossible to fit every single use-case. So, if you find any isses or have feedback to help us improve ",(0,r.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"message us through our Discord"),".")),(0,r.kt)("h2",{id:"introduction"},"Introduction"),(0,r.kt)("p",null,"Our Lightning CLI and Node process is run by a user, that has some sort of permissions\u2013some users run it as a super user (root) which is questionable as root privileges are not a necessary good. We'll look into how to create a user to manage and control the Fleek Network Lightning CLI and Systemd unit service. Also, presents the concept of file permissions and ownership which is crucial in preventing private or sensitive data from being exposed to dodgy actors."),(0,r.kt)("p",null,"Let's discuss the topic and open up a few ideas to help us improve the security of our server."),(0,r.kt)("h2",{id:"pre-requisites"},"Pre-requisites"),(0,r.kt)("p",null,"To follow the guide, you will need the following:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Familiarity with the command-line interface"),(0,r.kt)("li",{parentName:"ul"},"Have installed and set up the Lightning CLI and service")),(0,r.kt)("h2",{id:"ownership-of-lightning-cli-files"},"Ownership of Lightning CLI files"),(0,r.kt)("p",null,"The user who installs the Lightning CLI and sets the Service takes an important role that determines the location of the configuration files, the setup, and how the Systemd service is managed or controlled."),(0,r.kt)("p",null,"Our ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install"},"install")," document recommends creating a user and switching to the user to set up the service. You shouldn't want installed applications to run with elevated privileges. Applications are meant to be run with non-administrative privileges. If an application requires higher privileges, the administrator, such as a ",(0,r.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Sudo"},"sudoer")," should be able to elevate it. An application that has full access and control of a system can modify it in harmful ways, e.g. compromise the private keys."),(0,r.kt)("p",null,"For our guide, we'll illustrate the process of migration from a super user (root) to another user (sudo). The knowledge should be easily appliable for any other user-to-user migration. We stick with root user for simplicity and because that's the most common use case."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"A reference document about ",(0,r.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/file-permissions-and-ownership"},"File permissions and ownership")," is available that explains how it works practically, by showcasing how the process can be started, how the node process locates the Keystore, etc.")),(0,r.kt)("h2",{id:"systemd-service"},"Systemd Service"),(0,r.kt)("p",null,"In systemd, a unit refers to any resource that the system knows how to operate on and manage. This is the primary object that the systemd tools know how to deal with. These resources are defined using configuration files called unit files."),(0,r.kt)("p",null,"The recommended installation process features a ",(0,r.kt)("a",{parentName:"p",href:"https://www.freedesktop.org/software/systemd/man/systemd.service.html"},"systemd.service")," which is a resource that the system knows how to operate and manage by an administrator user."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"When using a Systemd service to run a process, it operates comparably to running it directly. The key difference is that Systemd keeps track of all the processes and threads that are spawned. This means that when a service is stopped using systemctl, such as the Fleek Network Lightning Node service, all the child processes that were started by the service are also terminated. Additionally, by utilizing Systemd, a user can run the process in the background and configure it to start automatically on system startup.")),(0,r.kt)("p",null,"If you have followed the installation recommendations, find the systemd service unit in the location ",(0,r.kt)("inlineCode",{parentName:"p"},"/etc/systemd/system/lightning.service")," (we are using Ubuntu Linux as an example to keep it short)."),(0,r.kt)("p",null,"Make sure that you have set up a ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install#systemd-service-setup"},"Systemd unit service"),", as recommended during the installation as this guide assumes you have one setup."),(0,r.kt)("h2",{id:"stop-the-service"},"Stop the service"),(0,r.kt)("p",null,"Before we proceed with any changes required for the migration, you'll have to stop the ",(0,r.kt)("inlineCode",{parentName:"p"},"lightning.service"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl stop lightning\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"For this guide, we are assuming that you are migrating ownership from ",(0,r.kt)("strong",{parentName:"p"},"root")," to a ",(0,r.kt)("strong",{parentName:"p"},"sudoer")," user. If not, you might be required to elevate privileges as ",(0,r.kt)("strong",{parentName:"p"},"sudo**")," where required. For example, ",(0,r.kt)("inlineCode",{parentName:"p"},"sudo systemctl stop lightning"),".")),(0,r.kt)("h2",{id:"clear-the-lightning-data"},"Clear the .lightning data"),(0,r.kt)("p",null,"Run the following command to clear the ",(0,r.kt)("inlineCode",{parentName:"p"},"/root/.lightning/data"),", as it can be quite large, and we don't need to move it."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo rm -rf /root/.lightning/data\n")),(0,r.kt)("h2",{id:"create-a-user"},"Create a user"),(0,r.kt)(i.ZP,{mdxType:"CreateAUser"}),(0,r.kt)("h2",{id:"move-lightning-system-and-source-code-directory-to-users-home"},"Move lightning system and source code directory to user's home"),(0,r.kt)("p",null,"A user should've been created, added the user to the sudo group, switched to the user, and changed the directory to the user's home."),(0,r.kt)("p",null,"Run the command ",(0,r.kt)("inlineCode",{parentName:"p"},"pwd"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"pwd\n")),(0,r.kt)("p",null,"The output would look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"/home/\n")),(0,r.kt)("p",null,"Given the username ",(0,r.kt)("strong",{parentName:"p"},"lgtn"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"/home/lgtn\n")),(0,r.kt)("p",null,"You'll then move two directories:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"The ",(0,r.kt)("inlineCode",{parentName:"li"},"/root/.lightning")),(0,r.kt)("li",{parentName:"ul"},"The source code under the parent ",(0,r.kt)("inlineCode",{parentName:"li"},"/root/fleek-network"))),(0,r.kt)("h3",{id:"1-move-the-rootlightning-directory-from-one-user-to-the-other"},"1) Move the ",(0,r.kt)("inlineCode",{parentName:"h3"},"/root/.lightning")," directory from one user to the other"),(0,r.kt)("p",null,"For our demo, we have assumed ",(0,r.kt)("strong",{parentName:"p"},"root")," user to ",(0,r.kt)("strong",{parentName:"p"},"sudoer")," user named ",(0,r.kt)("strong",{parentName:"p"},"lgtn"),", thus that'll look like this:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo mv /root/.lightning /home/lgtn/\n")),(0,r.kt)("h3",{id:"2-move-the-rootfleek-network-directory-from-one-user-to-the-other"},"2) Move the ",(0,r.kt)("inlineCode",{parentName:"h3"},"/root/fleek-network")," directory from one user to the other"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo mv /root/fleek-network /home/lgtn/\n")),(0,r.kt)("h3",{id:"3-confirm-move-by-finding-both-directories"},"3) Confirm move by finding both directories"),(0,r.kt)("p",null,"In the user $HOME directory, you should be able to list the content of the directory and find the ",(0,r.kt)("inlineCode",{parentName:"p"},".lightning")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"fleek-network")," directory."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"ls -la\n")),(0,r.kt)("p",null,"The output should be similar to the following."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"drwxr-x--- 6 lgtn lgtn 4096 Sep 12 13:51 .\ndrwxr-xr-x 3 root root 4096 Sep 11 12:28 ..\ndrwxrwxr-x 5 root root 4096 Sep 11 15:25 .lightning\ndrwxrwxr-x 3 root root 4096 Sep 11 12:28 fleek-network\n")),(0,r.kt)("h2",{id:"change-ownership-of-files"},"Change ownership of files"),(0,r.kt)("p",null,"Once the directories and files are moved, they should have the wrong ownership, which should be set to ",(0,r.kt)("strong",{parentName:"p"},"root:root"),". We'll now have to change the ownership of the directories and files recursively."),(0,r.kt)("p",null,"Change the ownership of ",(0,r.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning")," to the user ",(0,r.kt)("strong",{parentName:"p"},"lgtn")," as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo chown -R lgtn:lgtn .lightning\n")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Make sure that you use the ",(0,r.kt)("inlineCode",{parentName:"p"},"-R")," flag to have the ownership changes applied to the parent, the child directories and all the files.")),(0,r.kt)("p",null,"Change the ownership of ",(0,r.kt)("inlineCode",{parentName:"p"},"/home/lgtn/fleek-network")," to the user ",(0,r.kt)("strong",{parentName:"p"},"lgtn")," as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo chown -R lgtn:lgtn fleek-network\n")),(0,r.kt)("p",null,"Once completed, if you list the content of the directory the ownership should have changed from ",(0,r.kt)("inlineCode",{parentName:"p"},"root:root")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"lgtn:lgtn"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"ls -la\n")),(0,r.kt)("p",null,"The output should be similar to the following."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"drwxr-x--- 6 lgtn lgtn 4096 Sep 12 13:51 .\ndrwxr-xr-x 3 root root 4096 Sep 11 12:28 ..\ndrwxrwxr-x 5 lgtn lgtn 4096 Sep 11 15:25 .lightning\ndrwxrwxr-x 3 lgtn lgtn 4096 Sep 11 12:28 fleek-network\n")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Remember that we are using ",(0,r.kt)("strong",{parentName:"p"},"lgtn")," for our demo. If you have opted for a different username, make sure you use the correct username. To find the username you are logged in with run the command:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"whoami\n")),(0,r.kt)("p",{parentName:"admonition"},"For our demo, we'll assume that you understand that ",(0,r.kt)("strong",{parentName:"p"},"lgtn")," is the user we opted in for our demo.")),(0,r.kt)("h2",{id:"the-lgtn-symbolic-link-symlink"},"The lgtn symbolic link (symlink)"),(0,r.kt)("p",null,"We have the symbolic link that links the binary built from the source code, to the alias ",(0,r.kt)("strong",{parentName:"p"},"lgtn")," that's set under the ",(0,r.kt)("inlineCode",{parentName:"p"},"/usr/local/bin/lgtn")," pathname."),(0,r.kt)("p",null,"For example, you can find where that is linked to by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"ls -la $(which lgtn)\n")),(0,r.kt)("p",null,"On the output below, we can see that the ",(0,r.kt)("inlineCode",{parentName:"p"},"/usr/local/bin/lgtn")," points to ",(0,r.kt)("inlineCode",{parentName:"p"},"/root/fleek-network/lightning/target/release/lightning-node"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"lrwxrwxrwx 1 root root 64 Sep 11 15:48 /usr/local/bin/lgtn -> /root/fleek-network/lightning/target/release/lightning-node\n")),(0,r.kt)("p",null,"The target base path is ",(0,r.kt)("inlineCode",{parentName:"p"},"/root"),", and we know that we've moved the source code directory to the user home ",(0,r.kt)("inlineCode",{parentName:"p"},"/home/lgtn"),". For this reason, we need to create a new symlink with the updated location of the binary file."),(0,r.kt)("p",null,"Unlink the symlink:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo unlink /usr/local/bin/lgtn\n")),(0,r.kt)("p",null,"Create the symlink:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'sudo ln -s "/home/lgtn/fleek-network/lightning/target/release/lightning-node" /usr/local/bin/lgtn\n')),(0,r.kt)("p",null,"If successful, you should be able to execute the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn help\n")),(0,r.kt)("p",null,"The output should look similar to:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"Usage: lgtn [OPTIONS] \n\nCommands:\n run Start the node\n keys Handle keys\n print-config Print the loaded configuration\n help Print this message or the help of the given subcommand(s)\n\nOptions:\n -c, --config Path to the toml configuration file [default: ~/.lightning/config.toml]\n --with-mock-consensus Determines that we should be using the mock consensus backend\n -v... Increases the level of verbosity (the max level is -vvv)\n --log-location Print code location on console logs\n -h, --help Print help\n -V, --version Print version\n")),(0,r.kt)("h2",{id:"update-the-systemd-service-unit"},"Update the Systemd service unit"),(0,r.kt)("p",null,"Open the file, its settings should be similar to the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home//.lightning/config.toml run\nExecStop=killall lgtn\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,r.kt)("p",null,"Since we opted in for the username ",(0,r.kt)("strong",{parentName:"p"},"lgtn")," for our demo, replaced ",(0,r.kt)("inlineCode",{parentName:"p"},"")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"lgtn"),", and it would look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home/lgtn/.lightning/config.toml run\nExecStop=killall lgtn\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Notice the ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecStart=")," which includes the flag ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," where the location of the user files is declared. Learn how to ",(0,r.kt)("a",{parentName:"p",href:"#update-the-configtoml-with-user-preferred-file-locations"},"update the config.toml")," to include the user-preferred file paths, e.g. declare the keystore pathname.")),(0,r.kt)("p",null,"Complete the step by reloading the daemon, to apply the newly created changes. You can do this by executing:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,r.kt)("h2",{id:"update-the-configtoml-with-user-preferred-file-locations"},"Update the config.toml with user-preferred file locations"),(0,r.kt)("p",null,"Open the ",(0,r.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/config.toml")," file in your favorite text editor."),(0,r.kt)("p",null,"Replace every instance of ",(0,r.kt)("inlineCode",{parentName:"p"},"~")," (tilde) with the user's home path. We do this to ensure that every time we control the service via systemctl, the configuration file that tells which keystore to use is declared upfront regardless of running it as user or delegating to root with ",(0,r.kt)("strong",{parentName:"p"},"sudo"),". Learn more about ",(0,r.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/file-permissions-and-ownership"},"file permissions and ownership")," by reading the reference document."),(0,r.kt)(s.ZP,{mdxType:"FindAndReplaceConfigWithUserPaths"}),(0,r.kt)("h2",{id:"start-the-service"},"Start the service"),(0,r.kt)("p",null,"At this stage, you should have migrated the essential files to the user home."),(0,r.kt)("p",null,"Ideally, you would now manage the service as the ",(0,r.kt)("inlineCode",{parentName:"p"},"user")," (as described in the ",(0,r.kt)("a",{parentName:"p",href:"/references/Systemd/user-service/"},"user service reference"),"). To keep our guide wider to all users, we'll prefix the commands with ",(0,r.kt)("strong",{parentName:"p"},"sudo"),", which elevates the permissions to ",(0,r.kt)("strong",{parentName:"p"},"root"),". But since we have provided the configuration file the ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," in our ",(0,r.kt)("a",{parentName:"p",href:"#systemd-service"},"systemd service"),", we'll have the user-preferred configuration options ruling. "),(0,r.kt)("p",null,"Start the service by running the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl start lightning.service\n")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Find the timeline of events for the Lightning service by checking the log files. Learn about it in the section ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install#analyzing-log-messages"},"Log Messages"),".")),(0,r.kt)("p",null,"To learn more, visit the section ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install#use-systemctl-to-manage-systemd-service"},"Use Systemctl to manage the Lightning Service")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"We started by giving a brief introduction to ownership of the Lightning CLI files."),(0,r.kt)("p",null,"Jumped through topics of Systemd service that helps the user manage the service in the Linux environment, which helps keep track of all the processes and threads that are spawned."),(0,r.kt)("p",null,"We've gone through the step-by-step process to migrate the Fleek Network CLI and Systemd service setup from one user to the other. To keep it short, we decided to go with the use-case of where the migration happens between a ",(0,r.kt)("strong",{parentName:"p"},"root")," user and a ",(0,r.kt)("strong",{parentName:"p"},"sudoer"),"."),(0,r.kt)("p",null,"Discover more about the project by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"watching/contributing on GitHub"),", following us on ",(0,r.kt)("a",{parentName:"p",href:"https://twitter.com/fleek_net"},"Twitter"),", and joining ",(0,r.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"our community Discord")," for any updates."),(0,r.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}g.isMDXComponent=!0},6733:(e,t,n)=>{n.d(t,{ZP:()=>s});var o=n(7462),r=(n(7294),n(3905));const a={toc:[]},i="wrapper";function s(e){let{components:t,...n}=e;return(0,r.kt)(i,(0,o.Z)({},a,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"We recommend creating a ",(0,r.kt)("inlineCode",{parentName:"p"},"non-root")," user with administrative privileges. It'll allow us to install any system requirements."),(0,r.kt)("p",null,"You can create a new user and add to the ",(0,r.kt)("strong",{parentName:"p"},"sudo")," group by running:"),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"For our example, we'll be using the name ",(0,r.kt)("inlineCode",{parentName:"p"},"lgtn")," but you can pick whichever you'd like. If you already have a ",(0,r.kt)("strong",{parentName:"p"},"sudoer")," account, you can skip this step.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo adduser lgtn\n")),(0,r.kt)("p",null,"After completing the ",(0,r.kt)("inlineCode",{parentName:"p"},"adduser")," steps, execute the ",(0,r.kt)("inlineCode",{parentName:"p"},"usermod")," to add the ",(0,r.kt)("inlineCode",{parentName:"p"},"user")," to the ",(0,r.kt)("strong",{parentName:"p"},"sudo")," group, as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo usermod -aG sudo lgtn\n")),(0,r.kt)("p",null,"Switch to the new ",(0,r.kt)("strong",{parentName:"p"},"user")," by using the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"su lgtn\n")),(0,r.kt)("p",null,"Change the directory to the new user's home, as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cd /home/lgtn\n")))}s.isMDXComponent=!0},3242:(e,t,n)=>{n.d(t,{ZP:()=>s});var o=n(7462),r=(n(7294),n(3905));const a={toc:[]},i="wrapper";function s(e){let{components:t,...n}=e;return(0,r.kt)(i,(0,o.Z)({},a,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"In the ",(0,r.kt)("inlineCode",{parentName:"p"},"/home//.lightning/config.toml")," you'll find some and more of the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"The configuration properties and values presented above are a shorter version of what you'll find on your ",(0,r.kt)("strong",{parentName:"p"},"configuration.toml"),". We keep it short to make it easier to follow, do not copy and paste.")),(0,r.kt)("p",null,"Find and replace all instances of ~ in the config file ",(0,r.kt)("inlineCode",{parentName:"p"},"/home//.lightning/config.toml"),". "),(0,r.kt)("p",null,"Here's an example of how to do it using ",(0,r.kt)("strong",{parentName:"p"},"sed"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home//.lightning|g" "/home//.lightning/config.toml"\n')),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"")," with your username. For example, if you have followed the recommendation to ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user"},"create a user")," it would look like ",(0,r.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/config.toml")," for the username ",(0,r.kt)("strong",{parentName:"p"},"lgtn"),".")),(0,r.kt)("p",null,"For example, if your username is ",(0,r.kt)("inlineCode",{parentName:"p"},"lgtn")," that'd look like this:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"\n')),(0,r.kt)("p",null,"Once modified, you can run a ",(0,r.kt)("inlineCode",{parentName:"p"},"cat")," to see the content of the files to confirm it has been updated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cat /home/lgtn/.lightning/config.toml\n")),(0,r.kt)("p",null,"For our example where we opted in for the username ",(0,r.kt)("inlineCode",{parentName:"p"},"lgtn")," that would look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,r.kt)("admonition",{title:"Warning",type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"Bear in mind that we are keeping the content of the file short to make it easier to read and follow. The content of your configuration file should look slightly different, amongst these it should contain other properties and values. You should not copy and replace the content of your files with the ones presented here.")))}s.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>r});var o=n(7294);const r=e=>{let{image:t,name:n,title:r,url:a,communityMember:i=!1}=e;return o.createElement("section",{className:"author_card"},o.createElement("div",null,o.createElement("span",{className:"avatar"},o.createElement("a",{href:a,target:"_blank",alt:n},o.createElement("img",{src:t,alt:n}))),o.createElement("div",null,o.createElement("span",{className:"name"},o.createElement("a",{href:a,target:"_blank",alt:n},n)),o.createElement("span",{className:"title"},r),o.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",o.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}},2867:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/transfering-setup-ownership-e59591d6c2b6023384e94dfa4873964a.png"},1e3:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/transfering-setup-ownership-e59591d6c2b6023384e94dfa4873964a.png"}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[9854],{3905:(e,t,n)=>{n.d(t,{Zo:()=>h,kt:()=>c});var o=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=o.createContext({}),p=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},h=function(e){var t=p(e.components);return o.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,h=s(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,c=d["".concat(l,".").concat(m)]||d[m]||u[m]||a;return n?o.createElement(c,i(i({ref:t},h),{},{components:n})):o.createElement(c,i({ref:t},h))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[d]="string"==typeof e?e:r,i[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>g,frontMatter:()=>l,metadata:()=>h,toc:()=>u});var o=n(7462),r=(n(7294),n(3905)),a=n(3872),i=n(6733),s=n(3242);const l={template:"post",draft:!1,hide_title:!0,title:"Transfering setup ownership",slug:"transfering-setup-ownership",image:"./assets/transfering-setup-ownership.png?202311181223",date:new Date("2023-09-12T23:00:00.000Z"),description:"A step-by-step guide to transfer the ownership of the Fleek Network Lightning CLI and service setup",category:"Tutorial",tags:["transfer","ownership","guide","setup","configuration"]},p=void 0,h={unversionedId:"Node Operators/transfering-setup-ownership",id:"Node Operators/transfering-setup-ownership",title:"Transfering setup ownership",description:"A step-by-step guide to transfer the ownership of the Fleek Network Lightning CLI and service setup",source:"@site/guides/Node Operators/transfering-setup-ownership.md",sourceDirName:"Node Operators",slug:"/Node Operators/transfering-setup-ownership",permalink:"/guides/Node Operators/transfering-setup-ownership",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/guides/Node Operators/transfering-setup-ownership.md",tags:[{label:"transfer",permalink:"/guides/tags/transfer"},{label:"ownership",permalink:"/guides/tags/ownership"},{label:"guide",permalink:"/guides/tags/guide"},{label:"setup",permalink:"/guides/tags/setup"},{label:"configuration",permalink:"/guides/tags/configuration"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{template:"post",draft:!1,hide_title:!0,title:"Transfering setup ownership",slug:"transfering-setup-ownership",image:"./assets/transfering-setup-ownership.png?202311181223",date:"2023-09-12T23:00:00.000Z",description:"A step-by-step guide to transfer the ownership of the Fleek Network Lightning CLI and service setup",category:"Tutorial",tags:["transfer","ownership","guide","setup","configuration"]},sidebar:"defaultSidebar",previous:{title:"Running a node in Docker",permalink:"/guides/Node Operators/running-a-node-in-docker"},next:{title:"Updating Lightning",permalink:"/guides/Node Operators/updating-lightning"}},d={image:n(1e3).Z},u=[{value:"TL;DR",id:"tldr",level:2},{value:"Introduction",id:"introduction",level:2},{value:"Pre-requisites",id:"pre-requisites",level:2},{value:"Ownership of Lightning CLI files",id:"ownership-of-lightning-cli-files",level:2},{value:"Systemd Service",id:"systemd-service",level:2},{value:"Stop the service",id:"stop-the-service",level:2},{value:"Clear the .lightning data",id:"clear-the-lightning-data",level:2},{value:"Create a user",id:"create-a-user",level:2},{value:"Move lightning system and source code directory to user's home",id:"move-lightning-system-and-source-code-directory-to-users-home",level:2},{value:"1) Move the /root/.lightning directory from one user to the other",id:"1-move-the-rootlightning-directory-from-one-user-to-the-other",level:3},{value:"2) Move the /root/fleek-network directory from one user to the other",id:"2-move-the-rootfleek-network-directory-from-one-user-to-the-other",level:3},{value:"3) Confirm move by finding both directories",id:"3-confirm-move-by-finding-both-directories",level:3},{value:"Change ownership of files",id:"change-ownership-of-files",level:2},{value:"The lgtn symbolic link (symlink)",id:"the-lgtn-symbolic-link-symlink",level:2},{value:"Update the Systemd service unit",id:"update-the-systemd-service-unit",level:2},{value:"Update the config.toml with user-preferred file locations",id:"update-the-configtoml-with-user-preferred-file-locations",level:2},{value:"Start the service",id:"start-the-service",level:2},{value:"Conclusion",id:"conclusion",level:2}],m={toc:u},c="wrapper";function g(e){let{components:t,...l}=e;return(0,r.kt)(c,(0,o.Z)({},m,l,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Transfering setup ownership",src:n(2867).Z,width:"1450",height:"816"})),(0,r.kt)("h2",{id:"tldr"},"TL;DR"),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"The step-by-step instructions provided in the guide should be simple to follow, but the process is also available as an automated script from our familiar ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/get.fleek.network"},"get.fleek.network")," tool."),(0,r.kt)("p",{parentName:"admonition"},"To use the automated script execute the following command in your server terminal and follow the instructions:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"curl -sS https://get.fleek.network/transfer_system_user_setup_ownership | bash\n")),(0,r.kt)("p",{parentName:"admonition"},"We try to make the auomated scripts as useful as possible, but it's impossible to fit every single use-case. So, if you find any isses or have feedback to help us improve ",(0,r.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"message us through our Discord"),".")),(0,r.kt)("h2",{id:"introduction"},"Introduction"),(0,r.kt)("p",null,"Our Lightning CLI and Node process is run by a user, that has some sort of permissions\u2013some users run it as a super user (root) which is questionable as root privileges are not a necessary good. We'll look into how to create a user to manage and control the Fleek Network Lightning CLI and Systemd unit service. Also, presents the concept of file permissions and ownership which is crucial in preventing private or sensitive data from being exposed to dodgy actors."),(0,r.kt)("p",null,"Let's discuss the topic and open up a few ideas to help us improve the security of our server."),(0,r.kt)("h2",{id:"pre-requisites"},"Pre-requisites"),(0,r.kt)("p",null,"To follow the guide, you will need the following:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Familiarity with the command-line interface"),(0,r.kt)("li",{parentName:"ul"},"Have installed and set up the Lightning CLI and service")),(0,r.kt)("h2",{id:"ownership-of-lightning-cli-files"},"Ownership of Lightning CLI files"),(0,r.kt)("p",null,"The user who installs the Lightning CLI and sets the Service takes an important role that determines the location of the configuration files, the setup, and how the Systemd service is managed or controlled."),(0,r.kt)("p",null,"Our ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install"},"install")," document recommends creating a user and switching to the user to set up the service. You shouldn't want installed applications to run with elevated privileges. Applications are meant to be run with non-administrative privileges. If an application requires higher privileges, the administrator, such as a ",(0,r.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Sudo"},"sudoer")," should be able to elevate it. An application that has full access and control of a system can modify it in harmful ways, e.g. compromise the private keys."),(0,r.kt)("p",null,"For our guide, we'll illustrate the process of migration from a super user (root) to another user (sudo). The knowledge should be easily appliable for any other user-to-user migration. We stick with root user for simplicity and because that's the most common use case."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"A reference document about ",(0,r.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/file-permissions-and-ownership"},"File permissions and ownership")," is available that explains how it works practically, by showcasing how the process can be started, how the node process locates the Keystore, etc.")),(0,r.kt)("h2",{id:"systemd-service"},"Systemd Service"),(0,r.kt)("p",null,"In systemd, a unit refers to any resource that the system knows how to operate on and manage. This is the primary object that the systemd tools know how to deal with. These resources are defined using configuration files called unit files."),(0,r.kt)("p",null,"The recommended installation process features a ",(0,r.kt)("a",{parentName:"p",href:"https://www.freedesktop.org/software/systemd/man/systemd.service.html"},"systemd.service")," which is a resource that the system knows how to operate and manage by an administrator user."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"When using a Systemd service to run a process, it operates comparably to running it directly. The key difference is that Systemd keeps track of all the processes and threads that are spawned. This means that when a service is stopped using systemctl, such as the Fleek Network Lightning Node service, all the child processes that were started by the service are also terminated. Additionally, by utilizing Systemd, a user can run the process in the background and configure it to start automatically on system startup.")),(0,r.kt)("p",null,"If you have followed the installation recommendations, find the systemd service unit in the location ",(0,r.kt)("inlineCode",{parentName:"p"},"/etc/systemd/system/lightning.service")," (we are using Ubuntu Linux as an example to keep it short)."),(0,r.kt)("p",null,"Make sure that you have set up a ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install#systemd-service-setup"},"Systemd unit service"),", as recommended during the installation as this guide assumes you have one setup."),(0,r.kt)("h2",{id:"stop-the-service"},"Stop the service"),(0,r.kt)("p",null,"Before we proceed with any changes required for the migration, you'll have to stop the ",(0,r.kt)("inlineCode",{parentName:"p"},"lightning.service"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl stop lightning\n")),(0,r.kt)("admonition",{type:"note"},(0,r.kt)("p",{parentName:"admonition"},"For this guide, we are assuming that you are migrating ownership from ",(0,r.kt)("strong",{parentName:"p"},"root")," to a ",(0,r.kt)("strong",{parentName:"p"},"sudoer")," user. If not, you might be required to elevate privileges as ",(0,r.kt)("strong",{parentName:"p"},"sudo**")," where required. For example, ",(0,r.kt)("inlineCode",{parentName:"p"},"sudo systemctl stop lightning"),".")),(0,r.kt)("h2",{id:"clear-the-lightning-data"},"Clear the .lightning data"),(0,r.kt)("p",null,"Run the following command to clear the ",(0,r.kt)("inlineCode",{parentName:"p"},"/root/.lightning/data"),", as it can be quite large, and we don't need to move it."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo rm -rf /root/.lightning/data\n")),(0,r.kt)("h2",{id:"create-a-user"},"Create a user"),(0,r.kt)(i.ZP,{mdxType:"CreateAUser"}),(0,r.kt)("h2",{id:"move-lightning-system-and-source-code-directory-to-users-home"},"Move lightning system and source code directory to user's home"),(0,r.kt)("p",null,"A user should've been created, added the user to the sudo group, switched to the user, and changed the directory to the user's home."),(0,r.kt)("p",null,"Run the command ",(0,r.kt)("inlineCode",{parentName:"p"},"pwd"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"pwd\n")),(0,r.kt)("p",null,"The output would look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"/home/\n")),(0,r.kt)("p",null,"Given the username ",(0,r.kt)("strong",{parentName:"p"},"lgtn"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"/home/lgtn\n")),(0,r.kt)("p",null,"You'll then move two directories:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"The ",(0,r.kt)("inlineCode",{parentName:"li"},"/root/.lightning")),(0,r.kt)("li",{parentName:"ul"},"The source code under the parent ",(0,r.kt)("inlineCode",{parentName:"li"},"/root/fleek-network"))),(0,r.kt)("h3",{id:"1-move-the-rootlightning-directory-from-one-user-to-the-other"},"1) Move the ",(0,r.kt)("inlineCode",{parentName:"h3"},"/root/.lightning")," directory from one user to the other"),(0,r.kt)("p",null,"For our demo, we have assumed ",(0,r.kt)("strong",{parentName:"p"},"root")," user to ",(0,r.kt)("strong",{parentName:"p"},"sudoer")," user named ",(0,r.kt)("strong",{parentName:"p"},"lgtn"),", thus that'll look like this:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo mv /root/.lightning /home/lgtn/\n")),(0,r.kt)("h3",{id:"2-move-the-rootfleek-network-directory-from-one-user-to-the-other"},"2) Move the ",(0,r.kt)("inlineCode",{parentName:"h3"},"/root/fleek-network")," directory from one user to the other"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo mv /root/fleek-network /home/lgtn/\n")),(0,r.kt)("h3",{id:"3-confirm-move-by-finding-both-directories"},"3) Confirm move by finding both directories"),(0,r.kt)("p",null,"In the user $HOME directory, you should be able to list the content of the directory and find the ",(0,r.kt)("inlineCode",{parentName:"p"},".lightning")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"fleek-network")," directory."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"ls -la\n")),(0,r.kt)("p",null,"The output should be similar to the following."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"drwxr-x--- 6 lgtn lgtn 4096 Sep 12 13:51 .\ndrwxr-xr-x 3 root root 4096 Sep 11 12:28 ..\ndrwxrwxr-x 5 root root 4096 Sep 11 15:25 .lightning\ndrwxrwxr-x 3 root root 4096 Sep 11 12:28 fleek-network\n")),(0,r.kt)("h2",{id:"change-ownership-of-files"},"Change ownership of files"),(0,r.kt)("p",null,"Once the directories and files are moved, they should have the wrong ownership, which should be set to ",(0,r.kt)("strong",{parentName:"p"},"root:root"),". We'll now have to change the ownership of the directories and files recursively."),(0,r.kt)("p",null,"Change the ownership of ",(0,r.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning")," to the user ",(0,r.kt)("strong",{parentName:"p"},"lgtn")," as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo chown -R lgtn:lgtn .lightning\n")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Make sure that you use the ",(0,r.kt)("inlineCode",{parentName:"p"},"-R")," flag to have the ownership changes applied to the parent, the child directories and all the files.")),(0,r.kt)("p",null,"Change the ownership of ",(0,r.kt)("inlineCode",{parentName:"p"},"/home/lgtn/fleek-network")," to the user ",(0,r.kt)("strong",{parentName:"p"},"lgtn")," as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo chown -R lgtn:lgtn fleek-network\n")),(0,r.kt)("p",null,"Once completed, if you list the content of the directory the ownership should have changed from ",(0,r.kt)("inlineCode",{parentName:"p"},"root:root")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"lgtn:lgtn"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"ls -la\n")),(0,r.kt)("p",null,"The output should be similar to the following."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"drwxr-x--- 6 lgtn lgtn 4096 Sep 12 13:51 .\ndrwxr-xr-x 3 root root 4096 Sep 11 12:28 ..\ndrwxrwxr-x 5 lgtn lgtn 4096 Sep 11 15:25 .lightning\ndrwxrwxr-x 3 lgtn lgtn 4096 Sep 11 12:28 fleek-network\n")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Remember that we are using ",(0,r.kt)("strong",{parentName:"p"},"lgtn")," for our demo. If you have opted for a different username, make sure you use the correct username. To find the username you are logged in with run the command:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"whoami\n")),(0,r.kt)("p",{parentName:"admonition"},"For our demo, we'll assume that you understand that ",(0,r.kt)("strong",{parentName:"p"},"lgtn")," is the user we opted in for our demo.")),(0,r.kt)("h2",{id:"the-lgtn-symbolic-link-symlink"},"The lgtn symbolic link (symlink)"),(0,r.kt)("p",null,"We have the symbolic link that links the binary built from the source code, to the alias ",(0,r.kt)("strong",{parentName:"p"},"lgtn")," that's set under the ",(0,r.kt)("inlineCode",{parentName:"p"},"/usr/local/bin/lgtn")," pathname."),(0,r.kt)("p",null,"For example, you can find where that is linked to by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"ls -la $(which lgtn)\n")),(0,r.kt)("p",null,"On the output below, we can see that the ",(0,r.kt)("inlineCode",{parentName:"p"},"/usr/local/bin/lgtn")," points to ",(0,r.kt)("inlineCode",{parentName:"p"},"/root/fleek-network/lightning/target/release/lightning-node"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"lrwxrwxrwx 1 root root 64 Sep 11 15:48 /usr/local/bin/lgtn -> /root/fleek-network/lightning/target/release/lightning-node\n")),(0,r.kt)("p",null,"The target base path is ",(0,r.kt)("inlineCode",{parentName:"p"},"/root"),", and we know that we've moved the source code directory to the user home ",(0,r.kt)("inlineCode",{parentName:"p"},"/home/lgtn"),". For this reason, we need to create a new symlink with the updated location of the binary file."),(0,r.kt)("p",null,"Unlink the symlink:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo unlink /usr/local/bin/lgtn\n")),(0,r.kt)("p",null,"Create the symlink:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'sudo ln -s "/home/lgtn/fleek-network/lightning/target/release/lightning-node" /usr/local/bin/lgtn\n')),(0,r.kt)("p",null,"If successful, you should be able to execute the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn help\n")),(0,r.kt)("p",null,"The output should look similar to:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"Usage: lgtn [OPTIONS] \n\nCommands:\n run Start the node\n keys Handle keys\n print-config Print the loaded configuration\n help Print this message or the help of the given subcommand(s)\n\nOptions:\n -c, --config Path to the toml configuration file [default: ~/.lightning/config.toml]\n --with-mock-consensus Determines that we should be using the mock consensus backend\n -v... Increases the level of verbosity (the max level is -vvv)\n --log-location Print code location on console logs\n -h, --help Print help\n -V, --version Print version\n")),(0,r.kt)("h2",{id:"update-the-systemd-service-unit"},"Update the Systemd service unit"),(0,r.kt)("p",null,"Open the file, its settings should be similar to the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home//.lightning/config.toml run\nExecStop=killall lgtn\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,r.kt)("p",null,"Since we opted in for the username ",(0,r.kt)("strong",{parentName:"p"},"lgtn")," for our demo, replaced ",(0,r.kt)("inlineCode",{parentName:"p"},"")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"lgtn"),", and it would look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home/lgtn/.lightning/config.toml run\nExecStop=killall lgtn\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Notice the ",(0,r.kt)("inlineCode",{parentName:"p"},"ExecStart=")," which includes the flag ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," where the location of the user files is declared. Learn how to ",(0,r.kt)("a",{parentName:"p",href:"#update-the-configtoml-with-user-preferred-file-locations"},"update the config.toml")," to include the user-preferred file paths, e.g. declare the keystore pathname.")),(0,r.kt)("p",null,"Complete the step by reloading the daemon, to apply the newly created changes. You can do this by executing:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,r.kt)("h2",{id:"update-the-configtoml-with-user-preferred-file-locations"},"Update the config.toml with user-preferred file locations"),(0,r.kt)("p",null,"Open the ",(0,r.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/config.toml")," file in your favorite text editor."),(0,r.kt)("p",null,"Replace every instance of ",(0,r.kt)("inlineCode",{parentName:"p"},"~")," (tilde) with the user's home path. We do this to ensure that every time we control the service via systemctl, the configuration file that tells which keystore to use is declared upfront regardless of running it as user or delegating to root with ",(0,r.kt)("strong",{parentName:"p"},"sudo"),". Learn more about ",(0,r.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/file-permissions-and-ownership"},"file permissions and ownership")," by reading the reference document."),(0,r.kt)(s.ZP,{mdxType:"FindAndReplaceConfigWithUserPaths"}),(0,r.kt)("h2",{id:"start-the-service"},"Start the service"),(0,r.kt)("p",null,"At this stage, you should have migrated the essential files to the user home."),(0,r.kt)("p",null,"Ideally, you would now manage the service as the ",(0,r.kt)("inlineCode",{parentName:"p"},"user")," (as described in the ",(0,r.kt)("a",{parentName:"p",href:"/references/Systemd/user-service/"},"user service reference"),"). To keep our guide wider to all users, we'll prefix the commands with ",(0,r.kt)("strong",{parentName:"p"},"sudo"),", which elevates the permissions to ",(0,r.kt)("strong",{parentName:"p"},"root"),". But since we have provided the configuration file the ",(0,r.kt)("inlineCode",{parentName:"p"},"-c")," in our ",(0,r.kt)("a",{parentName:"p",href:"#systemd-service"},"systemd service"),", we'll have the user-preferred configuration options ruling. "),(0,r.kt)("p",null,"Start the service by running the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl start lightning.service\n")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Find the timeline of events for the Lightning service by checking the log files. Learn about it in the section ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install#analyzing-log-messages"},"Log Messages"),".")),(0,r.kt)("p",null,"To learn more, visit the section ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install#use-systemctl-to-manage-systemd-service"},"Use Systemctl to manage the Lightning Service")),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"We started by giving a brief introduction to ownership of the Lightning CLI files."),(0,r.kt)("p",null,"Jumped through topics of Systemd service that helps the user manage the service in the Linux environment, which helps keep track of all the processes and threads that are spawned."),(0,r.kt)("p",null,"We've gone through the step-by-step process to migrate the Fleek Network CLI and Systemd service setup from one user to the other. To keep it short, we decided to go with the use-case of where the migration happens between a ",(0,r.kt)("strong",{parentName:"p"},"root")," user and a ",(0,r.kt)("strong",{parentName:"p"},"sudoer"),"."),(0,r.kt)("p",null,"Discover more about the project by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"watching/contributing on GitHub"),", following us on ",(0,r.kt)("a",{parentName:"p",href:"https://twitter.com/fleek_net"},"Twitter"),", and joining ",(0,r.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"our community Discord")," for any updates."),(0,r.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}g.isMDXComponent=!0},6733:(e,t,n)=>{n.d(t,{ZP:()=>s});var o=n(7462),r=(n(7294),n(3905));const a={toc:[]},i="wrapper";function s(e){let{components:t,...n}=e;return(0,r.kt)(i,(0,o.Z)({},a,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"We recommend creating a ",(0,r.kt)("inlineCode",{parentName:"p"},"non-root")," user with administrative privileges. It'll allow us to install any system requirements."),(0,r.kt)("p",null,"You can create a new user and add to the ",(0,r.kt)("strong",{parentName:"p"},"sudo")," group by running:"),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"For our example, we'll be using the name ",(0,r.kt)("inlineCode",{parentName:"p"},"lgtn")," but you can pick whichever you'd like. If you already have a ",(0,r.kt)("strong",{parentName:"p"},"sudoer")," account, you can skip this step.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo adduser lgtn\n")),(0,r.kt)("p",null,"After completing the ",(0,r.kt)("inlineCode",{parentName:"p"},"adduser")," steps, execute the ",(0,r.kt)("inlineCode",{parentName:"p"},"usermod")," to add the ",(0,r.kt)("inlineCode",{parentName:"p"},"user")," to the ",(0,r.kt)("strong",{parentName:"p"},"sudo")," group, as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo usermod -aG sudo lgtn\n")),(0,r.kt)("p",null,"Switch to the new ",(0,r.kt)("strong",{parentName:"p"},"user")," by using the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"su lgtn\n")),(0,r.kt)("p",null,"Change the directory to the new user's home, as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cd /home/lgtn\n")))}s.isMDXComponent=!0},3242:(e,t,n)=>{n.d(t,{ZP:()=>s});var o=n(7462),r=(n(7294),n(3905));const a={toc:[]},i="wrapper";function s(e){let{components:t,...n}=e;return(0,r.kt)(i,(0,o.Z)({},a,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"In the ",(0,r.kt)("inlineCode",{parentName:"p"},"/home//.lightning/config.toml")," you'll find some and more of the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"The configuration properties and values presented above are a shorter version of what you'll find on your ",(0,r.kt)("strong",{parentName:"p"},"configuration.toml"),". We keep it short to make it easier to follow, do not copy and paste.")),(0,r.kt)("p",null,"Find and replace all instances of ~ in the config file ",(0,r.kt)("inlineCode",{parentName:"p"},"/home//.lightning/config.toml"),". "),(0,r.kt)("p",null,"Here's an example of how to do it using ",(0,r.kt)("strong",{parentName:"p"},"sed"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home//.lightning|g" "/home//.lightning/config.toml"\n')),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"")," with your username. For example, if you have followed the recommendation to ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user"},"create a user")," it would look like ",(0,r.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/config.toml")," for the username ",(0,r.kt)("strong",{parentName:"p"},"lgtn"),".")),(0,r.kt)("p",null,"For example, if your username is ",(0,r.kt)("inlineCode",{parentName:"p"},"lgtn")," that'd look like this:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"\n')),(0,r.kt)("p",null,"Once modified, you can run a ",(0,r.kt)("inlineCode",{parentName:"p"},"cat")," to see the content of the files to confirm it has been updated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cat /home/lgtn/.lightning/config.toml\n")),(0,r.kt)("p",null,"For our example where we opted in for the username ",(0,r.kt)("inlineCode",{parentName:"p"},"lgtn")," that would look like:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,r.kt)("admonition",{title:"Warning",type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"Bear in mind that we are keeping the content of the file short to make it easier to read and follow. The content of your configuration file should look slightly different, amongst these it should contain other properties and values. You should not copy and replace the content of your files with the ones presented here.")))}s.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>r});var o=n(7294);const r=e=>{let{image:t,name:n,title:r,url:a,communityMember:i=!1}=e;return o.createElement("section",{className:"author_card"},o.createElement("div",null,o.createElement("span",{className:"avatar"},o.createElement("a",{href:a,target:"_blank",alt:n},o.createElement("img",{src:t,alt:n}))),o.createElement("div",null,o.createElement("span",{className:"name"},o.createElement("a",{href:a,target:"_blank",alt:n},n)),o.createElement("span",{className:"title"},r),o.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",o.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}},2867:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/transfering-setup-ownership-e59591d6c2b6023384e94dfa4873964a.png"},1e3:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/transfering-setup-ownership-e59591d6c2b6023384e94dfa4873964a.png"}}]); \ No newline at end of file diff --git a/assets/js/2730e145.653238d1.js b/assets/js/2730e145.43b66d7d.js similarity index 99% rename from assets/js/2730e145.653238d1.js rename to assets/js/2730e145.43b66d7d.js index 84f5a30a1..c788aa736 100644 --- a/assets/js/2730e145.653238d1.js +++ b/assets/js/2730e145.43b66d7d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[7147],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>h});var r=t(7294);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 r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var l=r.createContext({}),d=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},p=function(e){var n=d(e.components);return r.createElement(l.Provider,{value:n},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(t),u=i,h=c["".concat(l,".").concat(u)]||c[u]||m[u]||a;return t?r.createElement(h,o(o({ref:n},p),{},{components:t})):r.createElement(h,o({ref:n},p))}));function h(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=u;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s[c]="string"==typeof e?e:i,o[1]=s;for(var d=2;d{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var r=t(7462),i=(t(7294),t(3905)),a=t(3872);const o={title:"Permission denied (os error 13)",slug:"permission-denied-os-error-13",hide_title:!0,tags:["permissions"]},s=void 0,l={unversionedId:"Lightning CLI/permission-denied-os-error-13",id:"Lightning CLI/permission-denied-os-error-13",title:"Permission denied (os error 13)",description:"Ownership and file permissions",source:"@site/references/Lightning CLI/permission-denied-os-error-13.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/permission-denied-os-error-13",permalink:"/references/Lightning CLI/permission-denied-os-error-13",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/permission-denied-os-error-13.md",tags:[{label:"permissions",permalink:"/references/tags/permissions"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Permission denied (os error 13)",slug:"permission-denied-os-error-13",hide_title:!0,tags:["permissions"]},sidebar:"defaultSidebar",previous:{title:"Node secret key does not exist",permalink:"/references/Lightning CLI/node-secret-key-does-not-exist"},next:{title:"Uninstall Lightning Node",permalink:"/references/Lightning CLI/uninstall-lightning-node"}},d={},p=[{value:"Ownership and file permissions",id:"ownership-and-file-permissions",level:2},{value:"Override the TMPDIR",id:"override-the-tmpdir",level:2}],c={toc:p},m="wrapper";function u(e){let{components:n,...t}=e;return(0,i.kt)(m,(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h2",{id:"ownership-and-file-permissions"},"Ownership and file permissions"),(0,i.kt)("p",null,"When running the Lightning CLI, the user who's in control can delegate to ",(0,i.kt)("strong",{parentName:"p"},"root")," via ",(0,i.kt)("strong",{parentName:"p"},"sudo"),". Depending on how the Fleek Networking Lightning CLI was installed, this might cause some confusion, which is better explained by reading the reference ",(0,i.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/keys-not-found"},"Keys not found"),", which illustrates a situation where a user gets an error message about the wrong location of a system path (keystore)."),(0,i.kt)("p",null,"Some reasons why the ",(0,i.kt)("inlineCode",{parentName:"p"},"Permission denied (os error 13)")," might occur are related to:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"The Fleek Network Lightning CLI process trying to write to a ",(0,i.kt)("inlineCode",{parentName:"li"},".lightning")," stored in a non permitted location"),(0,i.kt)("li",{parentName:"ul"},"The Fleek Network Lightning CLI process trying to write to ",(0,i.kt)("inlineCode",{parentName:"li"},"/tmp"))),(0,i.kt)("p",null,"The most common issue can be fixed by reading the section ",(0,i.kt)("a",{parentName:"p",href:"#override-the-tmpdir"},"Override the TMPDIR"),"."),(0,i.kt)("h2",{id:"override-the-tmpdir"},"Override the TMPDIR"),(0,i.kt)("p",null,"The Fleek Network Lightning process requires writing to a temporary directory. As the process requires permissions, this might fail as demonstrated by some of the output logs we have below."),(0,i.kt)("p",null,"a) A permission denied error message"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"Permission denied (os error 13)\n")),(0,i.kt)("p",null,"b) Rust panic error message which includes a permission denied"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }', core/node/src/cli.rs:181:18\nnote: run with RUST_BACKTRACE=1 environment variable to display a backtrace\nthread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }', core/node/src/cli.rs:181:18\nnote: run with RUST_BACKTRACE=1 environment variable to display a backtrace\nthread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }', core/node/src/cli.rs:181:18\nnote: run with RUST_BACKTRACE=1 environment variable to display a backtrace\nthread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }', core/node/src/cli.rs:181:18\nnote: run with RUST_BACKTRACE=1 environment variable to display a backtrace\nthread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }', core/node/src/cli.rs:181:18\nnote: run with RUST_BACKTRACE=1 environment variable to display a backtrace\n")),(0,i.kt)("p",null,"c) A trace showing the path where this has failed"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},'[00007fcbe168e764] openat(AT_FDCWD, "/tmp/lightning.log", O_WRONLY|O_CREAT|O_APPEND|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)\n[00007fcbe168ea6f] write(2, "thread \'", 8thread \') = 8\n[00007fcbe168ea6f] write(2, "main", 4main) = 4\n[00007fcbe168ea6f] write(2, "\' panicked at \'", 15\' panicked at \') = 15\n[00007fcbe168ea6f] write(2, "called `Result::unwrap()` on an "..., 114called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }) = 114\n[00007fcbe168ea6f] write(2, "\', ", 3\', ) = 3\n')),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"The ",(0,i.kt)("inlineCode",{parentName:"p"},"/tmp")," directory should have wide permissions for all applications, but to mitigate any permission issues the user can override the system environment ",(0,i.kt)("inlineCode",{parentName:"p"},"TMPDIR"),". For example, the ",(0,i.kt)("inlineCode",{parentName:"p"},"installer")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"update")," scripts override ",(0,i.kt)("inlineCode",{parentName:"p"},"TMPDIR")," environment variable to ",(0,i.kt)("inlineCode",{parentName:"p"},"/var/tmp")," setting it in the service unit ",(0,i.kt)("inlineCode",{parentName:"p"},"Environment="),".")),(0,i.kt)("p",null,"The Lightning CLI process is aware of the environment variable TMPDIR, which the operators can override as discussed in the reference for ",(0,i.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/update-cli-from-source-code/#update-the-systemd-service-unit"},"Update the System service unit"),"."),(0,i.kt)("p",null,"In short, it requires you to include a ",(0,i.kt)("inlineCode",{parentName:"p"},"Environment=")," value of ",(0,i.kt)("inlineCode",{parentName:"p"},"TMPDIR=/var/tmp")," as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"[Service]\n...\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n")),(0,i.kt)("admonition",{title:"attention",type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"The ",(0,i.kt)("inlineCode",{parentName:"p"},"/etc/systemd/system/lightning.service")," service unit file presented here is a shorter version for simplicity. Do not replace your service unit file with the shorter content version presented here.")),(0,i.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}u.isMDXComponent=!0},3872:(e,n,t)=>{t.d(n,{Z:()=>i});var r=t(7294);const i=e=>{let{image:n,name:t,title:i,url:a,communityMember:o=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:a,target:"_blank",alt:t},r.createElement("img",{src:n,alt:t}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:a,target:"_blank",alt:t},t)),r.createElement("span",{className:"title"},i),r.createElement("span",{className:"discord"},o?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[7147],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>h});var r=t(7294);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 r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var l=r.createContext({}),d=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},p=function(e){var n=d(e.components);return r.createElement(l.Provider,{value:n},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(t),u=i,h=c["".concat(l,".").concat(u)]||c[u]||m[u]||a;return t?r.createElement(h,o(o({ref:n},p),{},{components:t})):r.createElement(h,o({ref:n},p))}));function h(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=u;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s[c]="string"==typeof e?e:i,o[1]=s;for(var d=2;d{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var r=t(7462),i=(t(7294),t(3905)),a=t(3872);const o={title:"Permission denied (os error 13)",slug:"permission-denied-os-error-13",hide_title:!0,tags:["permissions"]},s=void 0,l={unversionedId:"Lightning CLI/permission-denied-os-error-13",id:"Lightning CLI/permission-denied-os-error-13",title:"Permission denied (os error 13)",description:"Ownership and file permissions",source:"@site/references/Lightning CLI/permission-denied-os-error-13.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/permission-denied-os-error-13",permalink:"/references/Lightning CLI/permission-denied-os-error-13",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/permission-denied-os-error-13.md",tags:[{label:"permissions",permalink:"/references/tags/permissions"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Permission denied (os error 13)",slug:"permission-denied-os-error-13",hide_title:!0,tags:["permissions"]},sidebar:"defaultSidebar",previous:{title:"Node secret key does not exist",permalink:"/references/Lightning CLI/node-secret-key-does-not-exist"},next:{title:"Uninstall Lightning Node",permalink:"/references/Lightning CLI/uninstall-lightning-node"}},d={},p=[{value:"Ownership and file permissions",id:"ownership-and-file-permissions",level:2},{value:"Override the TMPDIR",id:"override-the-tmpdir",level:2}],c={toc:p},m="wrapper";function u(e){let{components:n,...t}=e;return(0,i.kt)(m,(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h2",{id:"ownership-and-file-permissions"},"Ownership and file permissions"),(0,i.kt)("p",null,"When running the Lightning CLI, the user who's in control can delegate to ",(0,i.kt)("strong",{parentName:"p"},"root")," via ",(0,i.kt)("strong",{parentName:"p"},"sudo"),". Depending on how the Fleek Networking Lightning CLI was installed, this might cause some confusion, which is better explained by reading the reference ",(0,i.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/keys-not-found"},"Keys not found"),", which illustrates a situation where a user gets an error message about the wrong location of a system path (keystore)."),(0,i.kt)("p",null,"Some reasons why the ",(0,i.kt)("inlineCode",{parentName:"p"},"Permission denied (os error 13)")," might occur are related to:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"The Fleek Network Lightning CLI process trying to write to a ",(0,i.kt)("inlineCode",{parentName:"li"},".lightning")," stored in a non permitted location"),(0,i.kt)("li",{parentName:"ul"},"The Fleek Network Lightning CLI process trying to write to ",(0,i.kt)("inlineCode",{parentName:"li"},"/tmp"))),(0,i.kt)("p",null,"The most common issue can be fixed by reading the section ",(0,i.kt)("a",{parentName:"p",href:"#override-the-tmpdir"},"Override the TMPDIR"),"."),(0,i.kt)("h2",{id:"override-the-tmpdir"},"Override the TMPDIR"),(0,i.kt)("p",null,"The Fleek Network Lightning process requires writing to a temporary directory. As the process requires permissions, this might fail as demonstrated by some of the output logs we have below."),(0,i.kt)("p",null,"a) A permission denied error message"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"Permission denied (os error 13)\n")),(0,i.kt)("p",null,"b) Rust panic error message which includes a permission denied"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }', core/node/src/cli.rs:181:18\nnote: run with RUST_BACKTRACE=1 environment variable to display a backtrace\nthread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }', core/node/src/cli.rs:181:18\nnote: run with RUST_BACKTRACE=1 environment variable to display a backtrace\nthread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }', core/node/src/cli.rs:181:18\nnote: run with RUST_BACKTRACE=1 environment variable to display a backtrace\nthread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }', core/node/src/cli.rs:181:18\nnote: run with RUST_BACKTRACE=1 environment variable to display a backtrace\nthread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }', core/node/src/cli.rs:181:18\nnote: run with RUST_BACKTRACE=1 environment variable to display a backtrace\n")),(0,i.kt)("p",null,"c) A trace showing the path where this has failed"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},'[00007fcbe168e764] openat(AT_FDCWD, "/tmp/lightning.log", O_WRONLY|O_CREAT|O_APPEND|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)\n[00007fcbe168ea6f] write(2, "thread \'", 8thread \') = 8\n[00007fcbe168ea6f] write(2, "main", 4main) = 4\n[00007fcbe168ea6f] write(2, "\' panicked at \'", 15\' panicked at \') = 15\n[00007fcbe168ea6f] write(2, "called `Result::unwrap()` on an "..., 114called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }) = 114\n[00007fcbe168ea6f] write(2, "\', ", 3\', ) = 3\n')),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"The ",(0,i.kt)("inlineCode",{parentName:"p"},"/tmp")," directory should have wide permissions for all applications, but to mitigate any permission issues the user can override the system environment ",(0,i.kt)("inlineCode",{parentName:"p"},"TMPDIR"),". For example, the ",(0,i.kt)("inlineCode",{parentName:"p"},"installer")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"update")," scripts override ",(0,i.kt)("inlineCode",{parentName:"p"},"TMPDIR")," environment variable to ",(0,i.kt)("inlineCode",{parentName:"p"},"/var/tmp")," setting it in the service unit ",(0,i.kt)("inlineCode",{parentName:"p"},"Environment="),".")),(0,i.kt)("p",null,"The Lightning CLI process is aware of the environment variable TMPDIR, which the operators can override as discussed in the reference for ",(0,i.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/update-cli-from-source-code/#update-the-systemd-service-unit"},"Update the System service unit"),"."),(0,i.kt)("p",null,"In short, it requires you to include a ",(0,i.kt)("inlineCode",{parentName:"p"},"Environment=")," value of ",(0,i.kt)("inlineCode",{parentName:"p"},"TMPDIR=/var/tmp")," as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"[Service]\n...\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n")),(0,i.kt)("admonition",{title:"attention",type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"The ",(0,i.kt)("inlineCode",{parentName:"p"},"/etc/systemd/system/lightning.service")," service unit file presented here is a shorter version for simplicity. Do not replace your service unit file with the shorter content version presented here.")),(0,i.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}u.isMDXComponent=!0},3872:(e,n,t)=>{t.d(n,{Z:()=>i});var r=t(7294);const i=e=>{let{image:n,name:t,title:i,url:a,communityMember:o=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:a,target:"_blank",alt:t},r.createElement("img",{src:n,alt:t}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:a,target:"_blank",alt:t},t)),r.createElement("span",{className:"title"},i),r.createElement("span",{className:"discord"},o?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file diff --git a/assets/js/29b62a39.80ee5756.js b/assets/js/29b62a39.c0bf41f4.js similarity index 98% rename from assets/js/29b62a39.80ee5756.js rename to assets/js/29b62a39.c0bf41f4.js index fb5eb7252..0112aab27 100644 --- a/assets/js/29b62a39.80ee5756.js +++ b/assets/js/29b62a39.c0bf41f4.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1498],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(7294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),d=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=d(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=d(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var d=2;d{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>l});var n=r(7462),o=(r(7294),r(3905));const a=r.p+"assets/images/banner-guides-cd76f6e8aac3594bb5d072a564e0e277.png",i={title:"About guides",hide_title:!0,sidebar_position:1,tags:["Guides","Help","Fleek Network"]},s=void 0,c={unversionedId:"index",id:"index",title:"About guides",description:"The guides provide step-by-step instructions and descriptions to help understand how and why you'd have to do or execute certain commands or processes.",source:"@site/guides/index.md",sourceDirName:".",slug:"/",permalink:"/guides/",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/guides/index.md",tags:[{label:"Guides",permalink:"/guides/tags/guides"},{label:"Help",permalink:"/guides/tags/help"},{label:"Fleek Network",permalink:"/guides/tags/fleek-network"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",sidebarPosition:1,frontMatter:{title:"About guides",hide_title:!0,sidebar_position:1,tags:["Guides","Help","Fleek Network"]},sidebar:"defaultSidebar",next:{title:"Getting Started",permalink:"/guides/Node Operators/getting-started"}},d={},l=[],u={toc:l},p="wrapper";function f(e){let{components:t,...r}=e;return(0,o.kt)(p,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("img",{className:"banner",src:a}),(0,o.kt)("p",null,"The guides provide step-by-step instructions and descriptions to help understand how and why you'd have to do or execute certain commands or processes."),(0,o.kt)("p",null,"It differs from the ",(0,o.kt)("a",{parentName:"p",href:"/references"},"references")," documentation which serves as a quick direct breakdown of commands and processes without much explanation, as the name implies."),(0,o.kt)("p",null,"To start, find guides by consulting the available categories to locate the content on the sidebar. Our guides are also available as a result when using the search feature located at the very top of the documentation site."))}f.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1498],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(7294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),d=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=d(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=d(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||p[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var d=2;d{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>l});var n=r(7462),o=(r(7294),r(3905));const a=r.p+"assets/images/banner-guides-cd76f6e8aac3594bb5d072a564e0e277.png",i={title:"About guides",hide_title:!0,sidebar_position:1,tags:["Guides","Help","Fleek Network"]},s=void 0,c={unversionedId:"index",id:"index",title:"About guides",description:"The guides provide step-by-step instructions and descriptions to help understand how and why you'd have to do or execute certain commands or processes.",source:"@site/guides/index.md",sourceDirName:".",slug:"/",permalink:"/guides/",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/guides/index.md",tags:[{label:"Guides",permalink:"/guides/tags/guides"},{label:"Help",permalink:"/guides/tags/help"},{label:"Fleek Network",permalink:"/guides/tags/fleek-network"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",sidebarPosition:1,frontMatter:{title:"About guides",hide_title:!0,sidebar_position:1,tags:["Guides","Help","Fleek Network"]},sidebar:"defaultSidebar",next:{title:"Getting Started",permalink:"/guides/Node Operators/getting-started"}},d={},l=[],u={toc:l},p="wrapper";function f(e){let{components:t,...r}=e;return(0,o.kt)(p,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("img",{className:"banner",src:a}),(0,o.kt)("p",null,"The guides provide step-by-step instructions and descriptions to help understand how and why you'd have to do or execute certain commands or processes."),(0,o.kt)("p",null,"It differs from the ",(0,o.kt)("a",{parentName:"p",href:"/references"},"references")," documentation which serves as a quick direct breakdown of commands and processes without much explanation, as the name implies."),(0,o.kt)("p",null,"To start, find guides by consulting the available categories to locate the content on the sidebar. Our guides are also available as a result when using the search feature located at the very top of the documentation site."))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/29b83576.6072e2a5.js b/assets/js/29b83576.507a0b0b.js similarity index 99% rename from assets/js/29b83576.6072e2a5.js rename to assets/js/29b83576.507a0b0b.js index 317f4f103..ed72b6f5a 100644 --- a/assets/js/29b83576.6072e2a5.js +++ b/assets/js/29b83576.507a0b0b.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1510],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>g});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),d=a,g=u["".concat(s,".").concat(d)]||u[d]||h[d]||o;return n?r.createElement(g,i(i({ref:t},c),{},{components:n})):r.createElement(g,i({ref:t},c))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=n(7462),a=(n(7294),n(3905)),o=n(3872);const i={title:"Backing up the keystore",slug:"backing-up-the-keystore",hide_title:!0,tags:["references","help","keystore","backup","restore"]},l=void 0,s={unversionedId:"Lightning CLI/keystore-backup",id:"Lightning CLI/keystore-backup",title:"Backing up the keystore",description:"The security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.",source:"@site/references/Lightning CLI/keystore-backup.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/backing-up-the-keystore",permalink:"/references/Lightning CLI/backing-up-the-keystore",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/keystore-backup.md",tags:[{label:"references",permalink:"/references/tags/references"},{label:"help",permalink:"/references/tags/help"},{label:"keystore",permalink:"/references/tags/keystore"},{label:"backup",permalink:"/references/tags/backup"},{label:"restore",permalink:"/references/tags/restore"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Backing up the keystore",slug:"backing-up-the-keystore",hide_title:!0,tags:["references","help","keystore","backup","restore"]},sidebar:"defaultSidebar",previous:{title:"Keys not found",permalink:"/references/Lightning CLI/keys-not-found"},next:{title:"Node secret key does not exist",permalink:"/references/Lightning CLI/node-secret-key-does-not-exist"}},p={},c=[{value:"Keystore pathname",id:"keystore-pathname",level:2},{value:"Configuration file settings",id:"configuration-file-settings",level:2},{value:"Loading the configuration file on runtime",id:"loading-the-configuration-file-on-runtime",level:2},{value:"Low security backup",id:"low-security-backup",level:2},{value:"Higher security",id:"higher-security",level:2}],u={toc:c},h="wrapper";function d(e){let{components:t,...n}=e;return(0,a.kt)(h,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"The security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.")),(0,a.kt)("h2",{id:"keystore-pathname"},"Keystore pathname"),(0,a.kt)("p",null,"The default location for the keystore is in the user home. The $HOME or ",(0,a.kt)("inlineCode",{parentName:"p"},"~")," refers to the user home, as such consider the logged-in username."),(0,a.kt)("p",null,"To Check the user you are logged in with:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"whoami\n")),(0,a.kt)("p",null,"The default location for the keystore is:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"$HOME/.lightning/keystore\n")),(0,a.kt)("h2",{id:"configuration-file-settings"},"Configuration file settings"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"config.toml")," should have some and more of the following properties and values that are used to locate crucial files, such as the consensus and node keys of the keystore."),(0,a.kt)("p",null,"Here's an incomplete example of how the ",(0,a.kt)("inlineCode",{parentName:"p"},"config.toml")," looks like:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'[BLANK]\n...\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n...\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n...\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n...\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n...\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n...\n')),(0,a.kt)("p",null,"If you've followed the installation recommendations, it's very likely that you'll have the username path defined at the base of the pathnames declared in the properties, such as the following except instead of ",(0,a.kt)("inlineCode",{parentName:"p"},"")," you'll have your username:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'[signer]\nconsensus_key_path = "/home//.lightning/keystore/consensus.pem"\nnode_key_path = "/home//.lightning/keystore/node.pem"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"config.toml")," if loaded on Lightning node process runtime, will pick the desired paths declared in the file."),(0,a.kt)("h2",{id:"loading-the-configuration-file-on-runtime"},"Loading the configuration file on runtime"),(0,a.kt)("p",null,"Use the configuration flag ",(0,a.kt)("inlineCode",{parentName:"p"},"-c")," to pass the configuration ",(0,a.kt)("inlineCode",{parentName:"p"},"config.toml")," path:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn -c /home//.lightning/config.toml run\n")),(0,a.kt)("p",null,"Replace the ",(0,a.kt)("inlineCode",{parentName:"p"},"")," with the correct username, where the config is located."),(0,a.kt)("p",null,"Executing the subcommand ",(0,a.kt)("inlineCode",{parentName:"p"},"run")," without the configuration flag ",(0,a.kt)("inlineCode",{parentName:"p"},"-c"),", doesn't mean that it'll locate the desired ",(0,a.kt)("inlineCode",{parentName:"p"},"config.toml"),", as it'll default to ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml"),", e.g. if you were logged in with ",(0,a.kt)("strong",{parentName:"p"},"root"),", that'd be ",(0,a.kt)("inlineCode",{parentName:"p"},"/root/.lightning/config.toml"),"."),(0,a.kt)("h2",{id:"low-security-backup"},"Low security backup"),(0,a.kt)("p",null,"To zip and encrypt the ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore")," directory run:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"# It'll prompt for password (remember)\nzip --encrypt -r keystore.zip.enc $HOME/.lightning/keystore\n")),(0,a.kt)("p",null,"To unzip and decrypt the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.zip.enc"),", you'd run:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"# It'll prompt for password (recall)\nunzip keystore.zip.enc -d $HOME/.lightning/keystore\n")),(0,a.kt)("h2",{id:"higher-security"},"Higher security"),(0,a.kt)("p",null,"Create a ",(0,a.kt)("inlineCode",{parentName:"p"},"tarbar")," by executing:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'tar -cf "keystore.tar" $HOME/.lightning/keystore\n')),(0,a.kt)("p",null,"The encryption command is:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo gpg -a --symmetric --cipher-algo AES256 keystore.tar\n")),(0,a.kt)("p",null,"To decrypt the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.tar.asc")," file, enter:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo gpg -a --output keystore.tar --decrypt keystore.tar.asc\n")),(0,a.kt)("p",null,"Create a temporary directory to extract the tar archive with the original full pathname."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"mkdir $HOME/tar_keystore_extract\n")),(0,a.kt)("p",null,"Now, run the command to extract to the target directory, as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"tar -xf keystore.tar -C $HOME/tar_keystore_extract\n")),(0,a.kt)("p",null,"Locate the extracted files in ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/tar_keystore_extract"),", which should look like ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/tar_keystore/home//.lightning/keystore")),(0,a.kt)("p",null,"For a more in depth or step-by-step instructions read the guide ",(0,a.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/managing-the-keystore"},"managing the keystore"),"."),(0,a.kt)(o.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}d.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(7294);const a=e=>{let{image:t,name:n,title:a,url:o,communityMember:i=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:o,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:o,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},a),r.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1510],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>g});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),d=a,g=u["".concat(s,".").concat(d)]||u[d]||h[d]||o;return n?r.createElement(g,i(i({ref:t},c),{},{components:n})):r.createElement(g,i({ref:t},c))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=n(7462),a=(n(7294),n(3905)),o=n(3872);const i={title:"Backing up the keystore",slug:"backing-up-the-keystore",hide_title:!0,tags:["references","help","keystore","backup","restore"]},l=void 0,s={unversionedId:"Lightning CLI/keystore-backup",id:"Lightning CLI/keystore-backup",title:"Backing up the keystore",description:"The security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.",source:"@site/references/Lightning CLI/keystore-backup.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/backing-up-the-keystore",permalink:"/references/Lightning CLI/backing-up-the-keystore",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/keystore-backup.md",tags:[{label:"references",permalink:"/references/tags/references"},{label:"help",permalink:"/references/tags/help"},{label:"keystore",permalink:"/references/tags/keystore"},{label:"backup",permalink:"/references/tags/backup"},{label:"restore",permalink:"/references/tags/restore"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Backing up the keystore",slug:"backing-up-the-keystore",hide_title:!0,tags:["references","help","keystore","backup","restore"]},sidebar:"defaultSidebar",previous:{title:"Keys not found",permalink:"/references/Lightning CLI/keys-not-found"},next:{title:"Node secret key does not exist",permalink:"/references/Lightning CLI/node-secret-key-does-not-exist"}},p={},c=[{value:"Keystore pathname",id:"keystore-pathname",level:2},{value:"Configuration file settings",id:"configuration-file-settings",level:2},{value:"Loading the configuration file on runtime",id:"loading-the-configuration-file-on-runtime",level:2},{value:"Low security backup",id:"low-security-backup",level:2},{value:"Higher security",id:"higher-security",level:2}],u={toc:c},h="wrapper";function d(e){let{components:t,...n}=e;return(0,a.kt)(h,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"The security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.")),(0,a.kt)("h2",{id:"keystore-pathname"},"Keystore pathname"),(0,a.kt)("p",null,"The default location for the keystore is in the user home. The $HOME or ",(0,a.kt)("inlineCode",{parentName:"p"},"~")," refers to the user home, as such consider the logged-in username."),(0,a.kt)("p",null,"To Check the user you are logged in with:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"whoami\n")),(0,a.kt)("p",null,"The default location for the keystore is:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"$HOME/.lightning/keystore\n")),(0,a.kt)("h2",{id:"configuration-file-settings"},"Configuration file settings"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"config.toml")," should have some and more of the following properties and values that are used to locate crucial files, such as the consensus and node keys of the keystore."),(0,a.kt)("p",null,"Here's an incomplete example of how the ",(0,a.kt)("inlineCode",{parentName:"p"},"config.toml")," looks like:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'[BLANK]\n...\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n...\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n...\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n...\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n...\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n...\n')),(0,a.kt)("p",null,"If you've followed the installation recommendations, it's very likely that you'll have the username path defined at the base of the pathnames declared in the properties, such as the following except instead of ",(0,a.kt)("inlineCode",{parentName:"p"},"")," you'll have your username:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'[signer]\nconsensus_key_path = "/home//.lightning/keystore/consensus.pem"\nnode_key_path = "/home//.lightning/keystore/node.pem"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"config.toml")," if loaded on Lightning node process runtime, will pick the desired paths declared in the file."),(0,a.kt)("h2",{id:"loading-the-configuration-file-on-runtime"},"Loading the configuration file on runtime"),(0,a.kt)("p",null,"Use the configuration flag ",(0,a.kt)("inlineCode",{parentName:"p"},"-c")," to pass the configuration ",(0,a.kt)("inlineCode",{parentName:"p"},"config.toml")," path:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn -c /home//.lightning/config.toml run\n")),(0,a.kt)("p",null,"Replace the ",(0,a.kt)("inlineCode",{parentName:"p"},"")," with the correct username, where the config is located."),(0,a.kt)("p",null,"Executing the subcommand ",(0,a.kt)("inlineCode",{parentName:"p"},"run")," without the configuration flag ",(0,a.kt)("inlineCode",{parentName:"p"},"-c"),", doesn't mean that it'll locate the desired ",(0,a.kt)("inlineCode",{parentName:"p"},"config.toml"),", as it'll default to ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml"),", e.g. if you were logged in with ",(0,a.kt)("strong",{parentName:"p"},"root"),", that'd be ",(0,a.kt)("inlineCode",{parentName:"p"},"/root/.lightning/config.toml"),"."),(0,a.kt)("h2",{id:"low-security-backup"},"Low security backup"),(0,a.kt)("p",null,"To zip and encrypt the ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore")," directory run:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"# It'll prompt for password (remember)\nzip --encrypt -r keystore.zip.enc $HOME/.lightning/keystore\n")),(0,a.kt)("p",null,"To unzip and decrypt the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.zip.enc"),", you'd run:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"# It'll prompt for password (recall)\nunzip keystore.zip.enc -d $HOME/.lightning/keystore\n")),(0,a.kt)("h2",{id:"higher-security"},"Higher security"),(0,a.kt)("p",null,"Create a ",(0,a.kt)("inlineCode",{parentName:"p"},"tarbar")," by executing:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'tar -cf "keystore.tar" $HOME/.lightning/keystore\n')),(0,a.kt)("p",null,"The encryption command is:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo gpg -a --symmetric --cipher-algo AES256 keystore.tar\n")),(0,a.kt)("p",null,"To decrypt the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.tar.asc")," file, enter:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo gpg -a --output keystore.tar --decrypt keystore.tar.asc\n")),(0,a.kt)("p",null,"Create a temporary directory to extract the tar archive with the original full pathname."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"mkdir $HOME/tar_keystore_extract\n")),(0,a.kt)("p",null,"Now, run the command to extract to the target directory, as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"tar -xf keystore.tar -C $HOME/tar_keystore_extract\n")),(0,a.kt)("p",null,"Locate the extracted files in ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/tar_keystore_extract"),", which should look like ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/tar_keystore/home//.lightning/keystore")),(0,a.kt)("p",null,"For a more in depth or step-by-step instructions read the guide ",(0,a.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/managing-the-keystore"},"managing the keystore"),"."),(0,a.kt)(o.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}d.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(7294);const a=e=>{let{image:t,name:n,title:a,url:o,communityMember:i=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:o,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:o,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},a),r.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file diff --git a/assets/js/40aeb86f.13d479d3.js b/assets/js/40aeb86f.c592360f.js similarity index 99% rename from assets/js/40aeb86f.13d479d3.js rename to assets/js/40aeb86f.c592360f.js index f02c06c21..da0da4c0f 100644 --- a/assets/js/40aeb86f.13d479d3.js +++ b/assets/js/40aeb86f.c592360f.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[4402],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},h="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),h=p(n),d=o,m=h["".concat(s,".").concat(d)]||h[d]||u[d]||r;return n?a.createElement(m,l(l({ref:t},c),{},{components:n})):a.createElement(m,l({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,l=new Array(r);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[h]="string"==typeof e?e:o,l[1]=i;for(var p=2;p{n.d(t,{ZP:()=>i});var a=n(7462),o=(n(7294),n(3905));const r={toc:[]},l="wrapper";function i(e){let{components:t,...n}=e;return(0,o.kt)(l,(0,a.Z)({},r,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"In the ",(0,o.kt)("inlineCode",{parentName:"p"},"/home//.lightning/config.toml")," you'll find some and more of the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The configuration properties and values presented above are a shorter version of what you'll find on your ",(0,o.kt)("strong",{parentName:"p"},"configuration.toml"),". We keep it short to make it easier to follow, do not copy and paste.")),(0,o.kt)("p",null,"Find and replace all instances of ~ in the config file ",(0,o.kt)("inlineCode",{parentName:"p"},"/home//.lightning/config.toml"),". "),(0,o.kt)("p",null,"Here's an example of how to do it using ",(0,o.kt)("strong",{parentName:"p"},"sed"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home//.lightning|g" "/home//.lightning/config.toml"\n')),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Replace the ",(0,o.kt)("inlineCode",{parentName:"p"},"")," with your username. For example, if you have followed the recommendation to ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user"},"create a user")," it would look like ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/config.toml")," for the username ",(0,o.kt)("strong",{parentName:"p"},"lgtn"),".")),(0,o.kt)("p",null,"For example, if your username is ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," that'd look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"\n')),(0,o.kt)("p",null,"Once modified, you can run a ",(0,o.kt)("inlineCode",{parentName:"p"},"cat")," to see the content of the files to confirm it has been updated."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cat /home/lgtn/.lightning/config.toml\n")),(0,o.kt)("p",null,"For our example where we opted in for the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," that would look like:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,o.kt)("admonition",{title:"Warning",type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"Bear in mind that we are keeping the content of the file short to make it easier to read and follow. The content of your configuration file should look slightly different, amongst these it should contain other properties and values. You should not copy and replace the content of your files with the ones presented here.")))}i.isMDXComponent=!0},3813:(e,t,n)=>{n.d(t,{ZP:()=>i});var a=n(7462),o=(n(7294),n(3905));const r={toc:[]},l="wrapper";function i(e){let{components:t,...n}=e;return(0,o.kt)(l,(0,a.Z)({},r,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The flag ",(0,o.kt)("inlineCode",{parentName:"p"},"-c")," in the ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning.service")," ",(0,o.kt)("strong",{parentName:"p"},"ExecStart"),", is to provide the toml configuration file path e.g. defaults to ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml"),". This is to avoid the path being determined dynamically (given path base ~ or $HOME), as users might control the systemctl service as a ",(0,o.kt)("strong",{parentName:"p"},"user")," or ",(0,o.kt)("strong",{parentName:"p"},"sudoer"),". For example, a ",(0,o.kt)("strong",{parentName:"p"},"sudoer")," would have the ",(0,o.kt)("strong",{parentName:"p"},"configuration")," set to ",(0,o.kt)("inlineCode",{parentName:"p"},"/root/.lightning/config.toml")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/username/.lightning/config.toml")," depending on using ",(0,o.kt)("strong",{parentName:"p"},"sudo")," which might cause some confusion to some users.")))}i.isMDXComponent=!0},2300:(e,t,n)=>{n.d(t,{ZP:()=>i});var a=n(7462),o=(n(7294),n(3905));const r={toc:[]},l="wrapper";function i(e){let{components:t,...n}=e;return(0,o.kt)(l,(0,a.Z)({},r,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"You should be following the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user-1"},"create a user")," recommendation. For our example, we have the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn"),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"If you have chosen a different username, replace ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," by the correct username you have selected.")),(0,o.kt)("p",null,"In the ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")," you'll find some and more of the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,o.kt)("p",null,"Find and replace all instances of ",(0,o.kt)("inlineCode",{parentName:"p"},"~")," in the config file ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/config.toml"),". Here's an example using ",(0,o.kt)("inlineCode",{parentName:"p"},"sed"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"\n')),(0,o.kt)("admonition",{type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"The ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")," example below is a shorter version of what you'll encounter, yours might look different. We do this to keep the guide simple to read. Do not copy and replace with the version demonstrated here.")),(0,o.kt)("p",null,"Once changed, all the instances of ",(0,o.kt)("inlineCode",{parentName:"p"},"~/")," should be replaced by your user path e.g. ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn/"),". For our example, the output would look like the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "/home/lgtn/.lightning/data/app_db"\n\n[consensus]\nstore_path = "/home/lgtn/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "/home/lgtn/.lightning/blockstore"\n\n[resolver]\nstore_path = "/home/lgtn/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"\nnode_key_path = "/home/lgtn/.lightning/keystore/node.pem"\n')))}i.isMDXComponent=!0},1054:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>k,frontMatter:()=>p,metadata:()=>h,toc:()=>d});var a=n(7462),o=(n(7294),n(3905)),r=n(3872),l=n(2300),i=n(3813),s=n(3242);const p={title:"Update CLI from source code",slug:"update-cli-from-source-code",hide_title:!0,tags:["references","help","update","upgrade","fix"]},c=void 0,h={unversionedId:"Lightning CLI/update-cli-from-source-code",id:"Lightning CLI/update-cli-from-source-code",title:"Update CLI from source code",description:"Although the step-by-step instructions described here are simple to follow, this process is available as an automated script. To use it execute the following command in your server terminal and follow the instructions:",source:"@site/references/Lightning CLI/update-cli-from-source-code.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/update-cli-from-source-code",permalink:"/references/Lightning CLI/update-cli-from-source-code",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/update-cli-from-source-code.md",tags:[{label:"references",permalink:"/references/tags/references"},{label:"help",permalink:"/references/tags/help"},{label:"update",permalink:"/references/tags/update"},{label:"upgrade",permalink:"/references/tags/upgrade"},{label:"fix",permalink:"/references/tags/fix"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Update CLI from source code",slug:"update-cli-from-source-code",hide_title:!0,tags:["references","help","update","upgrade","fix"]},sidebar:"defaultSidebar",previous:{title:"Uninstall Lightning Node",permalink:"/references/Lightning CLI/uninstall-lightning-node"},next:{title:"Service keeps running after shutdown",permalink:"/references/Systemd/service-keeps-running-after-shutdown"}},u={},d=[{value:"Switch to the installation user",id:"switch-to-the-installation-user",level:2},{value:"Change directory to the source code",id:"change-directory-to-the-source-code",level:2},{value:"Checkout to branch",id:"checkout-to-branch",level:2},{value:"Pull the latest changes",id:"pull-the-latest-changes",level:2},{value:"Build binary from the source",id:"build-binary-from-the-source",level:2},{value:"Update the symlink",id:"update-the-symlink",level:2},{value:"Set user path in config.toml",id:"set-user-path-in-configtoml",level:2},{value:"Update the systemd service unit",id:"update-the-systemd-service-unit",level:2},{value:"Clear the data",id:"clear-the-data",level:2},{value:"Update the config.toml",id:"update-the-configtoml",level:2},{value:"Update the config.toml with user home path",id:"update-the-configtoml-with-user-home-path",level:2},{value:"Restart the service",id:"restart-the-service",level:2},{value:"Health checkup",id:"health-checkup",level:2}],m={toc:d},g="wrapper";function k(e){let{components:t,...n}=e;return(0,o.kt)(g,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Although the step-by-step instructions described here are simple to follow, this process is available as an automated script. To use it execute the following command in your server terminal and follow the instructions:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"curl -sS https://get.fleek.network/update | bash\n"))),(0,o.kt)("h2",{id:"switch-to-the-installation-user"},"Switch to the installation user"),(0,o.kt)("p",null,"Switch to the username you've used throughout the installation process."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"su \n")),(0,o.kt)("p",null,"For example, if you used the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," it'll look like the following command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"su lgtn\n")),(0,o.kt)("h2",{id:"change-directory-to-the-source-code"},"Change directory to the source code"),(0,o.kt)("p",null,"If you have installed it via the recommended process or instructions, then the default location where the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"source code")," is stored is ",(0,o.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Notice that we use ",(0,o.kt)("inlineCode",{parentName:"p"},"~"),", which refers to ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME"),". You must use the username used for the installation process. For example, on ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"Ubuntu")," if you use the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn"),", the pathname for ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME")," is ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn"),".")),(0,o.kt)("h2",{id:"checkout-to-branch"},"Checkout to branch"),(0,o.kt)("p",null,"Make sure that you are checked in to the correct branch. For the current testnet phase that'd be ",(0,o.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1"),". If you use any other branch name, your node will not function correctly. Use the branch name ",(0,o.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"git checkout testnet-alpha-1\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"We try to update our documentation promptly but sometimes are a bit behind on any changes we might make in real-time. If you find any typos, such as the wrong branch name, help us by letting us know! Find us in Fleek Network section of our ",(0,o.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"Discord"),".")),(0,o.kt)("h2",{id:"pull-the-latest-changes"},"Pull the latest changes"),(0,o.kt)("p",null,"Before make sure that you stash or clear any changes you may have in the working directory, as otherwise, ",(0,o.kt)("inlineCode",{parentName:"p"},"git")," will let you know about local changes\u2013if you'd like to learn more about it read the ",(0,o.kt)("a",{parentName:"p",href:"https://git-scm.com/docs/git-stash"},"git stash document"),"."),(0,o.kt)("p",null,"A quick way to clean is to ",(0,o.kt)("inlineCode",{parentName:"p"},"stash")," the changes, for example:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"git stash \n")),(0,o.kt)("p",null,"To pull the latest changes use the ",(0,o.kt)("inlineCode",{parentName:"p"},"git pull")," command, as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"git pull origin testnet-alpha-1\n")),(0,o.kt)("p",null,"Alternatively, to have to stash and pull, you can reset the repository to the origin."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"git fetch origin testnet-alpha-1\ngit reset --hard origin/testnet-alpha-1\ngit clean -f\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"We are using the branch named ",(0,o.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1"),", which is specific to the early testnet launch. Change to the correct branch name according to needs. For example, in the future the mainnet version will go on branch name ",(0,o.kt)("inlineCode",{parentName:"p"},"main"),".")),(0,o.kt)("h2",{id:"build-binary-from-the-source"},"Build binary from the source"),(0,o.kt)("p",null,"To build the binary from the source code, we execute the cargo build command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cargo +stable build --release\n")),(0,o.kt)("h2",{id:"update-the-symlink"},"Update the symlink"),(0,o.kt)("p",null,"Start by removing the existing one:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sudo rm -f "/usr/local/bin/lgtn"\n')),(0,o.kt)("p",null,"Create a new symlink that links the new build binary to ",(0,o.kt)("inlineCode",{parentName:"p"},"/usr/local/bin/lgtn"),", as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo ln -s ~/fleek-network/lightning/target/release/lightning-node /usr/local/bin/lgtn\n")),(0,o.kt)("h2",{id:"set-user-path-in-configtoml"},"Set user path in config.toml"),(0,o.kt)(l.ZP,{mdxType:"SetUserPathInConfigToml"}),(0,o.kt)("h2",{id:"update-the-systemd-service-unit"},"Update the systemd service unit"),(0,o.kt)("p",null,"Open and edit the ",(0,o.kt)("inlineCode",{parentName:"p"},"/etc/systemd/system/lightning.service")," file."),(0,o.kt)("p",null,"1) Replace ",(0,o.kt)("inlineCode",{parentName:"p"},"")," with the username. For example, in the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user"},"documentation")," we use the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn"),"."),(0,o.kt)("p",null,"2) Make sure that the ",(0,o.kt)("inlineCode",{parentName:"p"},"ExecStart")," is set correctly"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home//.lightning/config.toml run\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,o.kt)(i.ZP,{mdxType:"NoteExecStartFlagCConfigPath"}),(0,o.kt)("p",null,"When complete make sure the file is saved. Followed by a systemctl daemon reload:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,o.kt)("h2",{id:"clear-the-data"},"Clear the data"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"rm -rf ~/.lightning/data\n")),(0,o.kt)("p",null,"Depending on how you control the system, this might need ",(0,o.kt)("strong",{parentName:"p"},"sudo"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo rm -rf ~/.lightning/data\n")),(0,o.kt)("h2",{id:"update-the-configtoml"},"Update the ",(0,o.kt)("inlineCode",{parentName:"h2"},"config.toml")),(0,o.kt)("p",null,"Remove the ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"rm ~/.lightning/config.toml\n")),(0,o.kt)("p",null,"Create a new ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn print-config --default > ~/.lightning/config.toml\n")),(0,o.kt)("h2",{id:"update-the-configtoml-with-user-home-path"},"Update the ",(0,o.kt)("inlineCode",{parentName:"h2"},"config.toml")," with user home path"),(0,o.kt)(s.ZP,{mdxType:"FindAndReplaceConfigWithUserPaths"}),(0,o.kt)("h2",{id:"restart-the-service"},"Restart the service"),(0,o.kt)("p",null,"Once the cargo build process is completed, you have to restart the service. We're assuming you are using non-root user as ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user"},"recommended"),", you won't use ",(0,o.kt)("strong",{parentName:"p"},"sudo")," to start the service. The command will look as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl restart lightning\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"If you have installed the Fleek Network lightning manually, the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#systemd-service-setup"},"installation instructions")," recommended setting up a systemd service for the Fleek Network process. If you haven't, you're advised to check the instructions provided.")),(0,o.kt)("h2",{id:"health-checkup"},"Health checkup"),(0,o.kt)("p",null,"Do a quick health check by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'curl -w "\\p" localhost:4230/health\n')),(0,o.kt)("p",null,"If successful, you should get the response ",(0,o.kt)("inlineCode",{parentName:"p"},"running and staked"),", as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"running and staked\n")),(0,o.kt)(r.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}k.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(7294);const o=e=>{let{image:t,name:n,title:o,url:r,communityMember:l=!1}=e;return a.createElement("section",{className:"author_card"},a.createElement("div",null,a.createElement("span",{className:"avatar"},a.createElement("a",{href:r,target:"_blank",alt:n},a.createElement("img",{src:t,alt:n}))),a.createElement("div",null,a.createElement("span",{className:"name"},a.createElement("a",{href:r,target:"_blank",alt:n},n)),a.createElement("span",{className:"title"},o),a.createElement("span",{className:"discord"},l?"Join our community on":"Got questions? Find us on"," ",a.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[4402],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},h="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),h=p(n),d=o,m=h["".concat(s,".").concat(d)]||h[d]||u[d]||r;return n?a.createElement(m,l(l({ref:t},c),{},{components:n})):a.createElement(m,l({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,l=new Array(r);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[h]="string"==typeof e?e:o,l[1]=i;for(var p=2;p{n.d(t,{ZP:()=>i});var a=n(7462),o=(n(7294),n(3905));const r={toc:[]},l="wrapper";function i(e){let{components:t,...n}=e;return(0,o.kt)(l,(0,a.Z)({},r,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"In the ",(0,o.kt)("inlineCode",{parentName:"p"},"/home//.lightning/config.toml")," you'll find some and more of the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The configuration properties and values presented above are a shorter version of what you'll find on your ",(0,o.kt)("strong",{parentName:"p"},"configuration.toml"),". We keep it short to make it easier to follow, do not copy and paste.")),(0,o.kt)("p",null,"Find and replace all instances of ~ in the config file ",(0,o.kt)("inlineCode",{parentName:"p"},"/home//.lightning/config.toml"),". "),(0,o.kt)("p",null,"Here's an example of how to do it using ",(0,o.kt)("strong",{parentName:"p"},"sed"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home//.lightning|g" "/home//.lightning/config.toml"\n')),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Replace the ",(0,o.kt)("inlineCode",{parentName:"p"},"")," with your username. For example, if you have followed the recommendation to ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user"},"create a user")," it would look like ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/config.toml")," for the username ",(0,o.kt)("strong",{parentName:"p"},"lgtn"),".")),(0,o.kt)("p",null,"For example, if your username is ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," that'd look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"\n')),(0,o.kt)("p",null,"Once modified, you can run a ",(0,o.kt)("inlineCode",{parentName:"p"},"cat")," to see the content of the files to confirm it has been updated."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cat /home/lgtn/.lightning/config.toml\n")),(0,o.kt)("p",null,"For our example where we opted in for the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," that would look like:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,o.kt)("admonition",{title:"Warning",type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"Bear in mind that we are keeping the content of the file short to make it easier to read and follow. The content of your configuration file should look slightly different, amongst these it should contain other properties and values. You should not copy and replace the content of your files with the ones presented here.")))}i.isMDXComponent=!0},3813:(e,t,n)=>{n.d(t,{ZP:()=>i});var a=n(7462),o=(n(7294),n(3905));const r={toc:[]},l="wrapper";function i(e){let{components:t,...n}=e;return(0,o.kt)(l,(0,a.Z)({},r,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The flag ",(0,o.kt)("inlineCode",{parentName:"p"},"-c")," in the ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning.service")," ",(0,o.kt)("strong",{parentName:"p"},"ExecStart"),", is to provide the toml configuration file path e.g. defaults to ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml"),". This is to avoid the path being determined dynamically (given path base ~ or $HOME), as users might control the systemctl service as a ",(0,o.kt)("strong",{parentName:"p"},"user")," or ",(0,o.kt)("strong",{parentName:"p"},"sudoer"),". For example, a ",(0,o.kt)("strong",{parentName:"p"},"sudoer")," would have the ",(0,o.kt)("strong",{parentName:"p"},"configuration")," set to ",(0,o.kt)("inlineCode",{parentName:"p"},"/root/.lightning/config.toml")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/username/.lightning/config.toml")," depending on using ",(0,o.kt)("strong",{parentName:"p"},"sudo")," which might cause some confusion to some users.")))}i.isMDXComponent=!0},2300:(e,t,n)=>{n.d(t,{ZP:()=>i});var a=n(7462),o=(n(7294),n(3905));const r={toc:[]},l="wrapper";function i(e){let{components:t,...n}=e;return(0,o.kt)(l,(0,a.Z)({},r,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"You should be following the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user-1"},"create a user")," recommendation. For our example, we have the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn"),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"If you have chosen a different username, replace ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," by the correct username you have selected.")),(0,o.kt)("p",null,"In the ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")," you'll find some and more of the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,o.kt)("p",null,"Find and replace all instances of ",(0,o.kt)("inlineCode",{parentName:"p"},"~")," in the config file ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/config.toml"),". Here's an example using ",(0,o.kt)("inlineCode",{parentName:"p"},"sed"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"\n')),(0,o.kt)("admonition",{type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"The ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")," example below is a shorter version of what you'll encounter, yours might look different. We do this to keep the guide simple to read. Do not copy and replace with the version demonstrated here.")),(0,o.kt)("p",null,"Once changed, all the instances of ",(0,o.kt)("inlineCode",{parentName:"p"},"~/")," should be replaced by your user path e.g. ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn/"),". For our example, the output would look like the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "/home/lgtn/.lightning/data/app_db"\n\n[consensus]\nstore_path = "/home/lgtn/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "/home/lgtn/.lightning/blockstore"\n\n[resolver]\nstore_path = "/home/lgtn/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"\nnode_key_path = "/home/lgtn/.lightning/keystore/node.pem"\n')))}i.isMDXComponent=!0},1054:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>k,frontMatter:()=>p,metadata:()=>h,toc:()=>d});var a=n(7462),o=(n(7294),n(3905)),r=n(3872),l=n(2300),i=n(3813),s=n(3242);const p={title:"Update CLI from source code",slug:"update-cli-from-source-code",hide_title:!0,tags:["references","help","update","upgrade","fix"]},c=void 0,h={unversionedId:"Lightning CLI/update-cli-from-source-code",id:"Lightning CLI/update-cli-from-source-code",title:"Update CLI from source code",description:"Although the step-by-step instructions described here are simple to follow, this process is available as an automated script. To use it execute the following command in your server terminal and follow the instructions:",source:"@site/references/Lightning CLI/update-cli-from-source-code.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/update-cli-from-source-code",permalink:"/references/Lightning CLI/update-cli-from-source-code",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/update-cli-from-source-code.md",tags:[{label:"references",permalink:"/references/tags/references"},{label:"help",permalink:"/references/tags/help"},{label:"update",permalink:"/references/tags/update"},{label:"upgrade",permalink:"/references/tags/upgrade"},{label:"fix",permalink:"/references/tags/fix"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Update CLI from source code",slug:"update-cli-from-source-code",hide_title:!0,tags:["references","help","update","upgrade","fix"]},sidebar:"defaultSidebar",previous:{title:"Uninstall Lightning Node",permalink:"/references/Lightning CLI/uninstall-lightning-node"},next:{title:"Service keeps running after shutdown",permalink:"/references/Systemd/service-keeps-running-after-shutdown"}},u={},d=[{value:"Switch to the installation user",id:"switch-to-the-installation-user",level:2},{value:"Change directory to the source code",id:"change-directory-to-the-source-code",level:2},{value:"Checkout to branch",id:"checkout-to-branch",level:2},{value:"Pull the latest changes",id:"pull-the-latest-changes",level:2},{value:"Build binary from the source",id:"build-binary-from-the-source",level:2},{value:"Update the symlink",id:"update-the-symlink",level:2},{value:"Set user path in config.toml",id:"set-user-path-in-configtoml",level:2},{value:"Update the systemd service unit",id:"update-the-systemd-service-unit",level:2},{value:"Clear the data",id:"clear-the-data",level:2},{value:"Update the config.toml",id:"update-the-configtoml",level:2},{value:"Update the config.toml with user home path",id:"update-the-configtoml-with-user-home-path",level:2},{value:"Restart the service",id:"restart-the-service",level:2},{value:"Health checkup",id:"health-checkup",level:2}],m={toc:d},g="wrapper";function k(e){let{components:t,...n}=e;return(0,o.kt)(g,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Although the step-by-step instructions described here are simple to follow, this process is available as an automated script. To use it execute the following command in your server terminal and follow the instructions:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"curl -sS https://get.fleek.network/update | bash\n"))),(0,o.kt)("h2",{id:"switch-to-the-installation-user"},"Switch to the installation user"),(0,o.kt)("p",null,"Switch to the username you've used throughout the installation process."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"su \n")),(0,o.kt)("p",null,"For example, if you used the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," it'll look like the following command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"su lgtn\n")),(0,o.kt)("h2",{id:"change-directory-to-the-source-code"},"Change directory to the source code"),(0,o.kt)("p",null,"If you have installed it via the recommended process or instructions, then the default location where the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"source code")," is stored is ",(0,o.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Notice that we use ",(0,o.kt)("inlineCode",{parentName:"p"},"~"),", which refers to ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME"),". You must use the username used for the installation process. For example, on ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"Ubuntu")," if you use the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn"),", the pathname for ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME")," is ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn"),".")),(0,o.kt)("h2",{id:"checkout-to-branch"},"Checkout to branch"),(0,o.kt)("p",null,"Make sure that you are checked in to the correct branch. For the current testnet phase that'd be ",(0,o.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1"),". If you use any other branch name, your node will not function correctly. Use the branch name ",(0,o.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"git checkout testnet-alpha-1\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"We try to update our documentation promptly but sometimes are a bit behind on any changes we might make in real-time. If you find any typos, such as the wrong branch name, help us by letting us know! Find us in Fleek Network section of our ",(0,o.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"Discord"),".")),(0,o.kt)("h2",{id:"pull-the-latest-changes"},"Pull the latest changes"),(0,o.kt)("p",null,"Before make sure that you stash or clear any changes you may have in the working directory, as otherwise, ",(0,o.kt)("inlineCode",{parentName:"p"},"git")," will let you know about local changes\u2013if you'd like to learn more about it read the ",(0,o.kt)("a",{parentName:"p",href:"https://git-scm.com/docs/git-stash"},"git stash document"),"."),(0,o.kt)("p",null,"A quick way to clean is to ",(0,o.kt)("inlineCode",{parentName:"p"},"stash")," the changes, for example:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"git stash \n")),(0,o.kt)("p",null,"To pull the latest changes use the ",(0,o.kt)("inlineCode",{parentName:"p"},"git pull")," command, as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"git pull origin testnet-alpha-1\n")),(0,o.kt)("p",null,"Alternatively, to have to stash and pull, you can reset the repository to the origin."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"git fetch origin testnet-alpha-1\ngit reset --hard origin/testnet-alpha-1\ngit clean -f\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"We are using the branch named ",(0,o.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1"),", which is specific to the early testnet launch. Change to the correct branch name according to needs. For example, in the future the mainnet version will go on branch name ",(0,o.kt)("inlineCode",{parentName:"p"},"main"),".")),(0,o.kt)("h2",{id:"build-binary-from-the-source"},"Build binary from the source"),(0,o.kt)("p",null,"To build the binary from the source code, we execute the cargo build command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cargo +stable build --release\n")),(0,o.kt)("h2",{id:"update-the-symlink"},"Update the symlink"),(0,o.kt)("p",null,"Start by removing the existing one:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sudo rm -f "/usr/local/bin/lgtn"\n')),(0,o.kt)("p",null,"Create a new symlink that links the new build binary to ",(0,o.kt)("inlineCode",{parentName:"p"},"/usr/local/bin/lgtn"),", as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo ln -s ~/fleek-network/lightning/target/release/lightning-node /usr/local/bin/lgtn\n")),(0,o.kt)("h2",{id:"set-user-path-in-configtoml"},"Set user path in config.toml"),(0,o.kt)(l.ZP,{mdxType:"SetUserPathInConfigToml"}),(0,o.kt)("h2",{id:"update-the-systemd-service-unit"},"Update the systemd service unit"),(0,o.kt)("p",null,"Open and edit the ",(0,o.kt)("inlineCode",{parentName:"p"},"/etc/systemd/system/lightning.service")," file."),(0,o.kt)("p",null,"1) Replace ",(0,o.kt)("inlineCode",{parentName:"p"},"")," with the username. For example, in the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user"},"documentation")," we use the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn"),"."),(0,o.kt)("p",null,"2) Make sure that the ",(0,o.kt)("inlineCode",{parentName:"p"},"ExecStart")," is set correctly"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home//.lightning/config.toml run\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,o.kt)(i.ZP,{mdxType:"NoteExecStartFlagCConfigPath"}),(0,o.kt)("p",null,"When complete make sure the file is saved. Followed by a systemctl daemon reload:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,o.kt)("h2",{id:"clear-the-data"},"Clear the data"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"rm -rf ~/.lightning/data\n")),(0,o.kt)("p",null,"Depending on how you control the system, this might need ",(0,o.kt)("strong",{parentName:"p"},"sudo"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo rm -rf ~/.lightning/data\n")),(0,o.kt)("h2",{id:"update-the-configtoml"},"Update the ",(0,o.kt)("inlineCode",{parentName:"h2"},"config.toml")),(0,o.kt)("p",null,"Remove the ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"rm ~/.lightning/config.toml\n")),(0,o.kt)("p",null,"Create a new ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn print-config --default > ~/.lightning/config.toml\n")),(0,o.kt)("h2",{id:"update-the-configtoml-with-user-home-path"},"Update the ",(0,o.kt)("inlineCode",{parentName:"h2"},"config.toml")," with user home path"),(0,o.kt)(s.ZP,{mdxType:"FindAndReplaceConfigWithUserPaths"}),(0,o.kt)("h2",{id:"restart-the-service"},"Restart the service"),(0,o.kt)("p",null,"Once the cargo build process is completed, you have to restart the service. We're assuming you are using non-root user as ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user"},"recommended"),", you won't use ",(0,o.kt)("strong",{parentName:"p"},"sudo")," to start the service. The command will look as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl restart lightning\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"If you have installed the Fleek Network lightning manually, the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#systemd-service-setup"},"installation instructions")," recommended setting up a systemd service for the Fleek Network process. If you haven't, you're advised to check the instructions provided.")),(0,o.kt)("h2",{id:"health-checkup"},"Health checkup"),(0,o.kt)("p",null,"Do a quick health check by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'curl -w "\\p" localhost:4230/health\n')),(0,o.kt)("p",null,"If successful, you should get the response ",(0,o.kt)("inlineCode",{parentName:"p"},"running and staked"),", as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"running and staked\n")),(0,o.kt)(r.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}k.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(7294);const o=e=>{let{image:t,name:n,title:o,url:r,communityMember:l=!1}=e;return a.createElement("section",{className:"author_card"},a.createElement("div",null,a.createElement("span",{className:"avatar"},a.createElement("a",{href:r,target:"_blank",alt:n},a.createElement("img",{src:t,alt:n}))),a.createElement("div",null,a.createElement("span",{className:"name"},a.createElement("a",{href:r,target:"_blank",alt:n},n)),a.createElement("span",{className:"title"},o),a.createElement("span",{className:"discord"},l?"Join our community on":"Got questions? Find us on"," ",a.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file diff --git a/assets/js/445e9e2a.cd1e4df3.js b/assets/js/445e9e2a.f5d9aefe.js similarity index 97% rename from assets/js/445e9e2a.cd1e4df3.js rename to assets/js/445e9e2a.f5d9aefe.js index ace968078..e021fad55 100644 --- a/assets/js/445e9e2a.cd1e4df3.js +++ b/assets/js/445e9e2a.f5d9aefe.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[8578],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>g});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),p=c(n),u=o,g=p["".concat(l,".").concat(u)]||p[u]||m[u]||s;return n?r.createElement(g,i(i({ref:t},d),{},{components:n})):r.createElement(g,i({ref:t},d))}));function g(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,i=new Array(s);i[0]=u;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[p]="string"==typeof e?e:o,i[1]=a;for(var c=2;c{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var r=n(7462),o=(n(7294),n(3905)),s=n(3872);const i={title:"Node secret key does not exist",slug:"node-secret-key-does-not-exist",hide_title:!0,tags:["keystore","lost keys","ownership","file permissions"]},a=void 0,l={unversionedId:"Lightning CLI/node-secret-key-does-not-exist",id:"Lightning CLI/node-secret-key-does-not-exist",title:"Node secret key does not exist",description:"Node secret key does not exist",source:"@site/references/Lightning CLI/node-secret-key-does-not-exist.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/node-secret-key-does-not-exist",permalink:"/references/Lightning CLI/node-secret-key-does-not-exist",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/node-secret-key-does-not-exist.md",tags:[{label:"keystore",permalink:"/references/tags/keystore"},{label:"lost keys",permalink:"/references/tags/lost-keys"},{label:"ownership",permalink:"/references/tags/ownership"},{label:"file permissions",permalink:"/references/tags/file-permissions"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Node secret key does not exist",slug:"node-secret-key-does-not-exist",hide_title:!0,tags:["keystore","lost keys","ownership","file permissions"]},sidebar:"defaultSidebar",previous:{title:"Backing up the keystore",permalink:"/references/Lightning CLI/backing-up-the-keystore"},next:{title:"Permission denied (os error 13)",permalink:"/references/Lightning CLI/permission-denied-os-error-13"}},c={},d=[{value:"Node secret key does not exist",id:"node-secret-key-does-not-exist",level:2}],p={toc:d},m="wrapper";function u(e){let{components:t,...n}=e;return(0,o.kt)(m,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"node-secret-key-does-not-exist"},"Node secret key does not exist"),(0,o.kt)("p",null,'When watching the Fleek Network Lightning service log output, you find the "Node secret key does not exist" message as follows:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"Error: Could not start the node.\n\nCaused by:\n Node Initialization failed: InitializationFailed(Tag as SignerInterface>, Node secret key does not exist. Use the CLI to generate keys.)\n")),(0,o.kt)("p",null,"Edit the ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml")," to include the full location for the PEM files. For example, let's say that it's located under ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/skywalker")," that'd look like:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'[signer]\nconsensus_key_path = "/home/skywalker/.lightning/keystore/consensus.pem"\nnode_key_path = "/home/skywalker/.lightning/keystore/node.pem"\n')),(0,o.kt)("p",null,"To learn more about how file permissions and ownership work, you're advised to read the reference document ",(0,o.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/file-permissions-and-ownership"},"here"),"."),(0,o.kt)(s.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}u.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(7294);const o=e=>{let{image:t,name:n,title:o,url:s,communityMember:i=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:s,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:s,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},o),r.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[8578],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>g});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),p=c(n),u=o,g=p["".concat(l,".").concat(u)]||p[u]||m[u]||s;return n?r.createElement(g,i(i({ref:t},d),{},{components:n})):r.createElement(g,i({ref:t},d))}));function g(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,i=new Array(s);i[0]=u;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[p]="string"==typeof e?e:o,i[1]=a;for(var c=2;c{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var r=n(7462),o=(n(7294),n(3905)),s=n(3872);const i={title:"Node secret key does not exist",slug:"node-secret-key-does-not-exist",hide_title:!0,tags:["keystore","lost keys","ownership","file permissions"]},a=void 0,l={unversionedId:"Lightning CLI/node-secret-key-does-not-exist",id:"Lightning CLI/node-secret-key-does-not-exist",title:"Node secret key does not exist",description:"Node secret key does not exist",source:"@site/references/Lightning CLI/node-secret-key-does-not-exist.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/node-secret-key-does-not-exist",permalink:"/references/Lightning CLI/node-secret-key-does-not-exist",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/node-secret-key-does-not-exist.md",tags:[{label:"keystore",permalink:"/references/tags/keystore"},{label:"lost keys",permalink:"/references/tags/lost-keys"},{label:"ownership",permalink:"/references/tags/ownership"},{label:"file permissions",permalink:"/references/tags/file-permissions"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Node secret key does not exist",slug:"node-secret-key-does-not-exist",hide_title:!0,tags:["keystore","lost keys","ownership","file permissions"]},sidebar:"defaultSidebar",previous:{title:"Backing up the keystore",permalink:"/references/Lightning CLI/backing-up-the-keystore"},next:{title:"Permission denied (os error 13)",permalink:"/references/Lightning CLI/permission-denied-os-error-13"}},c={},d=[{value:"Node secret key does not exist",id:"node-secret-key-does-not-exist",level:2}],p={toc:d},m="wrapper";function u(e){let{components:t,...n}=e;return(0,o.kt)(m,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"node-secret-key-does-not-exist"},"Node secret key does not exist"),(0,o.kt)("p",null,'When watching the Fleek Network Lightning service log output, you find the "Node secret key does not exist" message as follows:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"Error: Could not start the node.\n\nCaused by:\n Node Initialization failed: InitializationFailed(Tag as SignerInterface>, Node secret key does not exist. Use the CLI to generate keys.)\n")),(0,o.kt)("p",null,"Edit the ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml")," to include the full location for the PEM files. For example, let's say that it's located under ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/skywalker")," that'd look like:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'[signer]\nconsensus_key_path = "/home/skywalker/.lightning/keystore/consensus.pem"\nnode_key_path = "/home/skywalker/.lightning/keystore/node.pem"\n')),(0,o.kt)("p",null,"To learn more about how file permissions and ownership work, you're advised to read the reference document ",(0,o.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/file-permissions-and-ownership"},"here"),"."),(0,o.kt)(s.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}u.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(7294);const o=e=>{let{image:t,name:n,title:o,url:s,communityMember:i=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:s,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:s,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},o),r.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file diff --git a/assets/js/4c9535f7.07ee15ee.js b/assets/js/4c9535f7.07ee15ee.js new file mode 100644 index 000000000..8b088a35b --- /dev/null +++ b/assets/js/4c9535f7.07ee15ee.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[6296],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=c(n),h=r,m=d["".concat(s,".").concat(h)]||d[h]||p[h]||o;return n?a.createElement(m,i(i({ref:t},u),{},{components:n})):a.createElement(m,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:r,i[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>g,frontMatter:()=>s,metadata:()=>u,toc:()=>p});var a=n(7462),r=(n(7294),n(3905)),o=n(3872),i=n(2915),l=n(6733);const s={title:"Running a node in Docker",hide_title:!0,slug:"running-a-node-in-docker",image:"./assets/running-a-node-in-docker.png?202311181211",date:new Date("2023-09-18T17:00:00.000Z"),description:"A guide on how to run Fleek Network's node in a Docker container",category:"Tutorial",tags:["guide","docker","container"]},c=void 0,u={unversionedId:"Node Operators/running-a-node-in-docker",id:"Node Operators/running-a-node-in-docker",title:"Running a node in Docker",description:"A guide on how to run Fleek Network's node in a Docker container",source:"@site/guides/Node Operators/running-a-node-in-docker.md",sourceDirName:"Node Operators",slug:"/Node Operators/running-a-node-in-docker",permalink:"/guides/Node Operators/running-a-node-in-docker",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/guides/Node Operators/running-a-node-in-docker.md",tags:[{label:"guide",permalink:"/guides/tags/guide"},{label:"docker",permalink:"/guides/tags/docker"},{label:"container",permalink:"/guides/tags/container"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Running a node in Docker",hide_title:!0,slug:"running-a-node-in-docker",image:"./assets/running-a-node-in-docker.png?202311181211",date:"2023-09-18T17:00:00.000Z",description:"A guide on how to run Fleek Network's node in a Docker container",category:"Tutorial",tags:["guide","docker","container"]},sidebar:"defaultSidebar",previous:{title:"Managing the keystore",permalink:"/guides/Node Operators/managing-the-keystore"},next:{title:"Transfering setup ownership",permalink:"/guides/Node Operators/transfering-setup-ownership"}},d={image:n(8597).Z},p=[{value:"Introduction",id:"introduction",level:2},{value:"Pre-requisites",id:"pre-requisites",level:2},{value:"For the impatient",id:"for-the-impatient",level:2},{value:"Pull and run image",id:"pull-and-run-image",level:3},{value:"Setup",id:"setup",level:2},{value:"Requirements",id:"requirements",level:3},{value:"Create a user",id:"create-a-user",level:3},{value:"Lightning CLI source code",id:"lightning-cli-source-code",level:3},{value:"Change directory to Lightning source code",id:"change-directory-to-lightning-source-code",level:3},{value:"Install Docker",id:"install-docker",level:3},{value:"Create the Docker image",id:"create-the-docker-image",level:3},{value:"Build the Docker image",id:"build-the-docker-image",level:3},{value:"Docker Container",id:"docker-container",level:2},{value:"Generate keys",id:"generate-keys",level:2},{value:"Run the Docker Container as Systemd Service",id:"run-the-docker-container-as-systemd-service",level:2},{value:"Create the Systemd Service Unit",id:"create-the-systemd-service-unit",level:3},{value:"Viewing logs",id:"viewing-logs",level:2},{value:"Conclusion",id:"conclusion",level:2}],h={toc:p},m="wrapper";function g(e){let{components:t,...s}=e;return(0,r.kt)(m,(0,a.Z)({},h,s,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Running a node in Docker",src:n(8597).Z,width:"1450",height:"816"})),(0,r.kt)("h2",{id:"introduction"},"Introduction"),(0,r.kt)("p",null,"Our ",(0,r.kt)("a",{parentName:"p",href:"https://www.docker.com/"},"Docker")," ",(0,r.kt)("a",{parentName:"p",href:"https://docs.docker.com/engine/reference/commandline/images/"},"image")," provides all the requirements to have Fleek Network running quickly and the following guide will provide you a quick reference to get you started with Docker. "),(0,r.kt)("p",null,"Alternatively, if you need a deep dive into Docker, check the official getting started ",(0,r.kt)("a",{parentName:"p",href:"https://docs.docker.com/get-started/"},"here"),"."),(0,r.kt)("p",null,"TL;DR If you have Docker experience then you'll find our ",(0,r.kt)("a",{parentName:"p",href:"#for-the-impatient"},"for the impatient")," sufficient to get started."),(0,r.kt)("h2",{id:"pre-requisites"},"Pre-requisites"),(0,r.kt)("p",null,"To follow the guide, you will need the following:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Familiarity with the command-line interface"),(0,r.kt)("li",{parentName:"ul"},"Git")),(0,r.kt)("h2",{id:"for-the-impatient"},"For the impatient"),(0,r.kt)("p",null,"Building a Docker image requires some effort and some of our users might find it easier to pull our ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning/pkgs/container/lightning"},"latest image")," for quick access to Lightning CLI, which doesn't require them to build from source."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"The Docker Container image for Lightning is located at ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning/pkgs/container/lightning"},"https://github.com/fleek-network/lightning/pkgs/container/lightning"),".")),(0,r.kt)("h3",{id:"pull-and-run-image"},"Pull and run image"),(0,r.kt)("p",null,"You can pull an run the Lightning pre-built Docker image from our GitHub and run the Docker container quickly by executing the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run \\\n -p 4200-4299:4200-4299 \\\n -p 4300-4399:4300-4399 \\\n --mount type=bind,source=$HOME/.lightning,target=/root/.lightning \\\n --name lightning-cli \\\n -it ghcr.io/fleek-network/lightning:latest\n")),(0,r.kt)("p",null,"Keys have to be generated when launching the service. On Docker run, if the ",(0,r.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/managing-the-keystore"},"keystore")," is not found, the keys are automatically generated and stored in the Docker host's ",(0,r.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore")," directory. To learn more about how to manage the keystore, visit the ",(0,r.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/managing-the-keystore"},"managing keystore")," section."),(0,r.kt)("admonition",{title:"warning",type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"The Docker image is tied to a CPU architecture, make sure that you have verified the ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/requirements#specs"},"required")," specifications to run the container successfully.")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"The command has a list of ports ",(0,r.kt)("inlineCode",{parentName:"p"},"-p")," values that map ports in the container on the Docker host. While we try to keep the information across our documentation in sync with the latest changes or requirements e.g. port number changes, make sure that you check the section ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/requirements#ports"},"ports")," to find the latest updates.")),(0,r.kt)("h2",{id:"setup"},"Setup"),(0,r.kt)("h3",{id:"requirements"},"Requirements"),(0,r.kt)("p",null,"To follow the guide successfully, a good amount of memory and disk space is necessary to run Docker. The main reason for our use-case is that your host machine requires a generous amount of memory and disk space, for the containers."),(0,r.kt)("p",null,"For this guide, we used a server with the 4vCPU, 32\xa0GB ram memory and 20 GB disk space specifications. Learn more about the recommended specifications ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/requirements"},"here"),"."),(0,r.kt)("h3",{id:"create-a-user"},"Create a user"),(0,r.kt)(l.ZP,{mdxType:"CreateAUser"}),(0,r.kt)("h3",{id:"lightning-cli-source-code"},"Lightning CLI source code"),(0,r.kt)("p",null,"Start by cloning the repository located at ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"https://github.com/fleek-network/lightning"),"."),(0,r.kt)(i.ZP,{mdxType:"GitCloneOptions"}),(0,r.kt)("h3",{id:"change-directory-to-lightning-source-code"},"Change directory to Lightning source code"),(0,r.kt)("p",null,"If you have cloned the project correctly, you should ",(0,r.kt)("inlineCode",{parentName:"p"},"change directory")," to the project source code directory which by default is ",(0,r.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,r.kt)("p",null,"At time of writing, this is how the project root looks like (e.g. use the ",(0,r.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Ls"},"ls")," to see the list):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},".\n\u251c\u2500\u2500 CODE_OF_CONDUCT.md\n\u251c\u2500\u2500 CONTRIBUTING.md\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 Dockerfile\n\u251c\u2500\u2500 LICENSE\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 codecov.yml\n\u251c\u2500\u2500 core\n\u251c\u2500\u2500 docs\n\u251c\u2500\u2500 etc\n\u251c\u2500\u2500 lib\n\u251c\u2500\u2500 rust-toolchain\n\u251c\u2500\u2500 rustfmt.toml\n\u251c\u2500\u2500 services\n\u2514\u2500\u2500 target\n")),(0,r.kt)("h3",{id:"install-docker"},"Install Docker"),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"To keep our guide short, we're using Ubuntu Linux. You'll have to make the required tweaks for your preferred Linux Distro. Find the list of support operating systems ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"here"),".")),(0,r.kt)("p",null,"First, update the existing list of packages:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt update\n")),(0,r.kt)("p",null,"Next, install the required packages to let apt use packages over HTTPS:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt install apt-transport-https ca-certificates software-properties-common\n")),(0,r.kt)("p",null,"Add the GPG key for the official Docker repository to your system:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -\n")),(0,r.kt)("p",null,"Add the Docker repository to apt sources and update the package database with the Docker packages from the new added repository:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable"\n')),(0,r.kt)("p",null,"Set to install from the Docker repo instead of the default Ubuntu repo:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"apt-cache policy docker-ce\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"docker-ce:\n Installed: (none)\n Candidate: 5:24.0.6-1~ubuntu.22.04~jammy\n Version table:\n 5:24.0.6-1~ubuntu.22.04~jammy 500\n 500 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages\n 5:24.0.6-1~ubuntu.22.04~jammy 500\n")),(0,r.kt)("p",null,"Finally, install Docker:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt install docker-ce\n")),(0,r.kt)("p",null,"Once complete you should be able to run it via the CLI, as such:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"docker -v\n")),(0,r.kt)("p",null,"Here's the output (versions might differ a bit from the time of writing):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"Docker version 24.0.6, build ed223bc\n")),(0,r.kt)("p",null,"The following command's output will indicate if Docker's working correctly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run hello-world\n")),(0,r.kt)("p",null,"Here's an example of the output you'll find us \"Hello from Docker!\":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'Hello from Docker!\nThis message shows that your installation appears to be working correctly.\n\nTo generate this message, Docker took the following steps:\n 1. The Docker client contacted the Docker daemon.\n 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.\n (amd64)\n 3. The Docker daemon created a new container from that image which runs the\n executable that produces the output you are currently reading.\n 4. The Docker daemon streamed that output to the Docker client, which sent it\n to your terminal.\n\nTo try something more ambitious, you can run an Ubuntu container with:\n $ docker run -it ubuntu bash\n\nShare images, automate workflows, and more with a free Docker ID:\n https://hub.docker.com/\n\nFor more examples and ideas, visit:\n https://docs.docker.com/get-started/\n')),(0,r.kt)("p",null,"Run all the commands above in your terminal, to confirm everything's working before proceeding to the next steps."),(0,r.kt)("h3",{id:"create-the-docker-image"},"Create the Docker image"),(0,r.kt)("p",null,"A Docker image is a read-only template with instructions for creating a Docker container, like a template. Docker images also act as a starting point when using Docker. "),(0,r.kt)("p",null,'The starting point for our use-case is a Dockerfile, where all those "template instructions" are declared.'),(0,r.kt)("p",null,"A ",(0,r.kt)("a",{parentName:"p",href:"https://raw.githubusercontent.com/fleek-network/lightning/main/Dockerfile"},"Dockerfile")," should exist in the repository source code, so make sure you have ",(0,r.kt)("a",{parentName:"p",href:"#change-directory-to-lightning-source-code"},"chage directory to the lightning source code")," to find it."),(0,r.kt)("h3",{id:"build-the-docker-image"},"Build the Docker image"),(0,r.kt)("p",null,"Build the image named as ",(0,r.kt)("inlineCode",{parentName:"p"},"lightning")," from our Dockerfile:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker build -t lightning -f ./Dockerfile .\n")),(0,r.kt)("p",null,"The build process takes awhile and you have to wait for completion. "),(0,r.kt)("p",null,"The output should be similar to:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"[+] Building 1.2s (16/16) FINISHED docker:default\n => [internal] load build definition from Dockerfile 0.0s\n => => transferring dockerfile: 990B 0.0s\n => [internal] load .dockerignore 0.0s\n => => transferring context: 2B 0.0s\n => [internal] load metadata for docker.io/library/debian:bullseye-slim 0.6s\n => [internal] load metadata for docker.io/library/rust:latest 0.9s\n => [stage-1 1/3] FROM docker.io/library/debian:bullseye-slim@sha256:3bc5e94a0e8329c102203c3f5f26fd67835f0c81633dd6949de0557867a87fac 0.0s\n => [builder 1/7] FROM docker.io/library/rust:latest@sha256:8a4ca3ca75afbc97bcf5362e9a694fe049d15734fbbaf82b8b7e224616c1254b 0.0s\n => [internal] load build context 0.3s\n => => transferring context: 948.93kB 0.3s\n => CACHED [stage-1 2/3] RUN DEBIAN_FRONTEND=noninteractive apt-get update -yq && DEBIAN_FRONTEND=noninteractive apt-get install -yq libs 0.0s\n => CACHED [builder 2/7] WORKDIR /lightning 0.0s\n => CACHED [builder 3/7] RUN apt-get update 0.0s\n => CACHED [builder 4/7] RUN apt-get install -y build-essential cmake clang pkg-config libssl-dev gcc protobuf-comp 0.0s\n => CACHED [builder 5/7] RUN --mount=type=cache,target=/usr/local/cargo/registry cargo install cargo-strip 0.0s\n => CACHED [builder 6/7] COPY . . 0.0s\n => CACHED [builder 7/7] RUN --mount=type=cache,target=/usr/local/cargo/registry --mount=type=cache,target=/lightning/target cargo buil 0.0s\n => CACHED [stage-1 3/3] COPY --from=builder /lightning/target/release/lightning-node /usr/local/bin/lgtn 0.0s\n => exporting to image 0.0s\n => => exporting layers 0.0s\n => => writing image sha256:e8e5ed19f59c3cc6a9add5bdb578c464904e9789d5f386cc4af81044c062d998 0.0s\n => => naming to docker.io/library/lightning\n")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"The Docker image is only required to be built once and/or, when changes are pulled from the remote repository, or specific versions you might be interested in. Otherwise, you're not required to build it everytime to run the node. If you'd like to learn how to update the Lightning CLI, find our references ",(0,r.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/update-cli-from-source-code"},"here"),".")),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"If you don't update your source code and binary build often, you won't have the latest changes, which should happen frequently to take advandate of all the ongoing development. This is quite important to understand, as it causes confusion to some users. The Lightning application at time of writing does not update automatically.")),(0,r.kt)("h2",{id:"docker-container"},"Docker Container"),(0,r.kt)("p",null,"A container is what's originated from the image we discussed in the section ",(0,r.kt)("a",{parentName:"p",href:"#build-the-docker-image"},"build the docker image"),", it is a runnable instance of an image. We can create, start, stop, move, or delete a container using the Docker API or CLI."),(0,r.kt)("p",null,"Following up, we'll learn how to run the Docker container that includes our Lightning CLI program, built from our Dockerfile."),(0,r.kt)("p",null,"Once the ",(0,r.kt)("a",{parentName:"p",href:"#build-the-docker-image"},"Docker image")," is ready, run the container based on the image ",(0,r.kt)("inlineCode",{parentName:"p"},"lightning"),". Effectively running the Fleek Network Lighthing node process:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run \\\n -p 4200-4299:4200-4299 \\\n -p 4300-4399:4300-4399 \\\n --mount type=bind,source=$HOME/.lightning,target=/root/.lightning \\\n --name lightning-cli \\\n -it lightning\n")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Notice that the command arguments we pass are for the flag's ",(0,r.kt)("inlineCode",{parentName:"p"},"-p")," port numbers, ",(0,r.kt)("inlineCode",{parentName:"p"},"-v")," to bind mount a location in your host to a container path (useful to persist your configuration files, e.g. keystore), ",(0,r.kt)("inlineCode",{parentName:"p"},"--name")," to make it easier to identify, ",(0,r.kt)("inlineCode",{parentName:"p"},"-it")," to make it interactive (e.g. presents output to the terminal), and the image name we ",(0,r.kt)("a",{parentName:"p",href:"#build-the-docker-image"},"built earlier"),".")),(0,r.kt)("p",null,'The output would look as the following, showing the error message "Node is not whitelisted" (this error message is due to the testnet phase that requires nodes to be whitelisted to run successfully):'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"thread 'main' panicked at 'Node is not whitelisted. Please join the Fleek Discord to get invited.', core/cli/src/testnet_sync.rs:45:9\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n/root/init: line 7: 7 Aborted (core dumped) lgtn run\n")),(0,r.kt)("p",null,"Keys have to be generated when launching the service. On Docker run, if the ",(0,r.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/managing-the-keystore"},"keystore")," is not found, the keys are automatically generated and stored in the Docker host's ",(0,r.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore")," directory."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Have in mind that the ",(0,r.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml")," is where the keystore location paths are configured, which default value is in the user ",(0,r.kt)("inlineCode",{parentName:"p"},"$HOME")," path. The users who customize or modify the default location, need to apply the required customizations. To learn more about how to manage the keystore, visit the ",(0,r.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/managing-the-keystore"},"managing keystore")," section.")),(0,r.kt)("h2",{id:"generate-keys"},"Generate keys"),(0,r.kt)("p",null,"Execute the ",(0,r.kt)("inlineCode",{parentName:"p"},"keys generate")," command on the container ",(0,r.kt)("inlineCode",{parentName:"p"},"lightning-cli"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker exec -it lightning-cli lgtn keys generate\n")),(0,r.kt)("p",null,"We've bound the host path ",(0,r.kt)("inlineCode",{parentName:"p"},"~/.lightning")," into the container ",(0,r.kt)("inlineCode",{parentName:"p"},"/root/.lightning"),"."),(0,r.kt)("p",null,"You can list the contents of the ",(0,r.kt)("inlineCode",{parentName:"p"},"~/.lightning"),", where you should find the ",(0,r.kt)("inlineCode",{parentName:"p"},"config.toml")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"keystore"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},".\n..\nconfig.toml\nkeystore\n")),(0,r.kt)("p",null,"You only have to run the ",(0,r.kt)("inlineCode",{parentName:"p"},"keys generate")," once from your host."),(0,r.kt)("p",null,"Finaly, you can start the Fleek Network node by running the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker start lightning-cli\n")),(0,r.kt)("h2",{id:"run-the-docker-container-as-systemd-service"},"Run the Docker Container as Systemd Service"),(0,r.kt)("p",null,"In this section we\u2019ll cover how to wrap a Docker Container as a Systemd Service without the need for third party tools or complex commands. Some reasons include, minimizing the dependency on the Docker Daemon as we can move to a ",(0,r.kt)("a",{parentName:"p",href:"https://opencontainers.org/"},"OCI complaint solution")," other that Docker at anytime, or the fact we recommend Systemd Service Units and Systemctl to control the Service in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install"},"Native install")," that most users are familiar."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Docker recommends using their cross-platform built-in restart policy for running a Container as a Service. For that, configure your Docker service to ",(0,r.kt)("a",{parentName:"p",href:"https://docs.docker.com/install/linux/linux-postinstall/#configure-docker-to-start-on-boot"},"start on system boot"),".")),(0,r.kt)("p",null,"Systemd was specifically developed to serve the purpose of stopping services, dependency checking and recovery of failed services. You can have your host start, stop, enable, check the status, and generally manage a container as a Systemd Service."),(0,r.kt)("h3",{id:"create-the-systemd-service-unit"},"Create the Systemd Service Unit"),(0,r.kt)("p",null,"We are going to create the unit configuration file in the /etc/systemd/system/ directory. The Service Unit is going to be named as ",(0,r.kt)("inlineCode",{parentName:"p"},"docker-lightning.service"),". To create the file run the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo touch /etc/systemd/system/docker-lightning.service\n")),(0,r.kt)("p",null,"Open the file in your favorite text editor and populate with the content found here:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\nAfter=docker.service\nRequires=docker.service\n\n[Service]\nRestart=always\nRestartSec=5\nTimeoutStartSec=0\nExecStartPre=-/usr/bin/docker kill lightning-cli\nExecStartPre=-/usr/bin/docker rm lightning-cli\nExecStartPre=/usr/bin/docker pull ghcr.io/fleek-network/lightning:latest\nExecStart=/usr/bin/docker run -p 4200-4299:4200-4299 -p 4300-4399:4300-4399 --mount type=bind,source=/home/skywalker/.lightning,target=/root/.lightning --name lightning-cli ghcr.io/fleek-network/lightning:latest\nExecStop=/usr/bin/docker stop\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\n\n[Install]\nWantedBy=multi-user.target\n")),(0,r.kt)("p",null,"Once the file is saved, change the file permissions by running the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo chmod 644 /etc/systemd/system/docker-lightning.service\n")),(0,r.kt)("p",null,"Next, reload the Systemctl Daemon:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,r.kt)("p",null,"Enable the service on startup when the system boots:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl enable docker-lightning.service\n")),(0,r.kt)("p",null,"As a result, we are now able to run our containers as a Systemd service. For this, read the document ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install#use-systemctl-to-manage-systemd-service"},"manage systemd service")," to find more about how to control the service."),(0,r.kt)("h2",{id:"viewing-logs"},"Viewing logs"),(0,r.kt)("p",null,"To view the logs of a Docker container in real time, use the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker logs -f lightning-cli\n")),(0,r.kt)("p",null,"If you have wrapped the ",(0,r.kt)("a",{parentName:"p",href:"#run-the-docker-container-as-systemd-service"},"docker container as a systemd service"),", you can use the same commands found when installed natively, such as:"),(0,r.kt)("p",null,"For standard output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"tail -f /var/log/lightning/output.log\n")),(0,r.kt)("p",null,"Or, the standard error:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"tail -f /var/log/lightning/diagnostic.log\n")),(0,r.kt)("p",null,"Learn more about how to ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/analyzing-logs"},"analyze log messages"),"."),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Containers are a way to have a self-contained environment that includes all necessary dependencies, libraries, software, amongst others required to run an application."),(0,r.kt)("p",null,"Fleek Network's Lightning is developed with ",(0,r.kt)("a",{parentName:"p",href:"https://www.rust-lang.org/"},"Rust"),", a general-purpose programming language, that requires several dependencies and libraries to compile the project. Some of these libraries are not installed by default and require some troubleshooting for the end user. ",(0,r.kt)("a",{parentName:"p",href:"https://www.docker.com/"},"Docker")," provides us with containers, self-containing all the required libraries for the purpose of running Lightning, our application."),(0,r.kt)("p",null,"We guided you through the initial installation steps, and how to build a ",(0,r.kt)("a",{parentName:"p",href:"https://www.docker.com/"},"Docker")," image, which then's used to Docker run a container. Plus, provided lower-level commands, to help you understand other present or advanced use-cases, and also at higher level, offerring simple utility methods."),(0,r.kt)("p",null,"While we do our best to provide the clearest instructions, there's always space for improvement, therefore feel free to make any contributions by messaging us on our ",(0,r.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"Discord")," or by opening a ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network"},"PR")," in any of our repositories."),(0,r.kt)("p",null,"Discover more about the project by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"watching/contributing on Github"),", following us on ",(0,r.kt)("a",{parentName:"p",href:"https://twitter.com/fleek_net"},"Twitter"),", and joining ",(0,r.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"our community Discord")," for all the best updates!"),(0,r.kt)(o.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}g.isMDXComponent=!0},6733:(e,t,n)=>{n.d(t,{ZP:()=>l});var a=n(7462),r=(n(7294),n(3905));const o={toc:[]},i="wrapper";function l(e){let{components:t,...n}=e;return(0,r.kt)(i,(0,a.Z)({},o,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"We recommend creating a ",(0,r.kt)("inlineCode",{parentName:"p"},"non-root")," user with administrative privileges. It'll allow us to install any system requirements."),(0,r.kt)("p",null,"You can create a new user and add to the ",(0,r.kt)("strong",{parentName:"p"},"sudo")," group by running:"),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"For our example, we'll be using the name ",(0,r.kt)("inlineCode",{parentName:"p"},"lgtn")," but you can pick whichever you'd like. If you already have a ",(0,r.kt)("strong",{parentName:"p"},"sudoer")," account, you can skip this step.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo adduser lgtn\n")),(0,r.kt)("p",null,"After completing the ",(0,r.kt)("inlineCode",{parentName:"p"},"adduser")," steps, execute the ",(0,r.kt)("inlineCode",{parentName:"p"},"usermod")," to add the ",(0,r.kt)("inlineCode",{parentName:"p"},"user")," to the ",(0,r.kt)("strong",{parentName:"p"},"sudo")," group, as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo usermod -aG sudo lgtn\n")),(0,r.kt)("p",null,"Switch to the new ",(0,r.kt)("strong",{parentName:"p"},"user")," by using the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"su lgtn\n")),(0,r.kt)("p",null,"Change the directory to the new user's home, as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cd /home/lgtn\n")))}l.isMDXComponent=!0},2915:(e,t,n)=>{n.d(t,{ZP:()=>l});var a=n(7462),r=(n(7294),n(3905));const o={toc:[]},i="wrapper";function l(e){let{components:t,...n}=e;return(0,r.kt)(i,(0,a.Z)({},o,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"You have several ways of doing this:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},"Clone via HTTPS"),(0,r.kt)("li",{parentName:"ul"},"Clone via SSH"),(0,r.kt)("li",{parentName:"ul"},"Download via Github CLI"),(0,r.kt)("li",{parentName:"ul"},"Download the ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/fleek-network/lightning/archive/refs/heads/main.zip"},"zip package")," from the repository")),(0,r.kt)("p",{parentName:"admonition"},"We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this.\nAlthough, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it ",(0,r.kt)("a",{parentName:"p",href:"https://docs.github.com/en/authentication/connecting-to-github-with-ssh"},"here"),"."),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git \n")),(0,r.kt)("p",{parentName:"admonition"},"At time of writing, we are checking the branch name ",(0,r.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1")," that corresponds to the testnet phase.\nHere's an example of what it'd look like when sticking to the recommended path location:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning\n"))))}l.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>r});var a=n(7294);const r=e=>{let{image:t,name:n,title:r,url:o,communityMember:i=!1}=e;return a.createElement("section",{className:"author_card"},a.createElement("div",null,a.createElement("span",{className:"avatar"},a.createElement("a",{href:o,target:"_blank",alt:n},a.createElement("img",{src:t,alt:n}))),a.createElement("div",null,a.createElement("span",{className:"name"},a.createElement("a",{href:o,target:"_blank",alt:n},n)),a.createElement("span",{className:"title"},r),a.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",a.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}},8597:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/running-a-node-in-docker-cc0a5b3fda558b4b6dd40022fe5dd09f.png"}}]); \ No newline at end of file diff --git a/assets/js/4c9535f7.1505dcc3.js b/assets/js/4c9535f7.1505dcc3.js deleted file mode 100644 index 7e6e58d68..000000000 --- a/assets/js/4c9535f7.1505dcc3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[6296],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=c(n),h=r,m=d["".concat(s,".").concat(h)]||d[h]||p[h]||o;return n?a.createElement(m,i(i({ref:t},u),{},{components:n})):a.createElement(m,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:r,i[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>g,frontMatter:()=>s,metadata:()=>u,toc:()=>p});var a=n(7462),r=(n(7294),n(3905)),o=n(3872),i=n(2915),l=n(6733);const s={title:"Running a node in Docker",hide_title:!0,slug:"running-a-node-in-docker",image:"./assets/running-a-node-in-docker.png?202311181211",date:new Date("2023-09-18T17:00:00.000Z"),description:"A guide on how to run Fleek Network's node in a Docker container",category:"Tutorial",tags:["guide","docker","container"]},c=void 0,u={unversionedId:"Node Operators/running-a-node-in-docker",id:"Node Operators/running-a-node-in-docker",title:"Running a node in Docker",description:"A guide on how to run Fleek Network's node in a Docker container",source:"@site/guides/Node Operators/running-a-node-in-docker.md",sourceDirName:"Node Operators",slug:"/Node Operators/running-a-node-in-docker",permalink:"/guides/Node Operators/running-a-node-in-docker",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/guides/Node Operators/running-a-node-in-docker.md",tags:[{label:"guide",permalink:"/guides/tags/guide"},{label:"docker",permalink:"/guides/tags/docker"},{label:"container",permalink:"/guides/tags/container"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Running a node in Docker",hide_title:!0,slug:"running-a-node-in-docker",image:"./assets/running-a-node-in-docker.png?202311181211",date:"2023-09-18T17:00:00.000Z",description:"A guide on how to run Fleek Network's node in a Docker container",category:"Tutorial",tags:["guide","docker","container"]},sidebar:"defaultSidebar",previous:{title:"Managing the keystore",permalink:"/guides/Node Operators/managing-the-keystore"},next:{title:"Transfering setup ownership",permalink:"/guides/Node Operators/transfering-setup-ownership"}},d={image:n(8597).Z},p=[{value:"Introduction",id:"introduction",level:2},{value:"Pre-requisites",id:"pre-requisites",level:2},{value:"For the impatient",id:"for-the-impatient",level:2},{value:"Pull and run image",id:"pull-and-run-image",level:3},{value:"Setup",id:"setup",level:2},{value:"Requirements",id:"requirements",level:3},{value:"Create a user",id:"create-a-user",level:3},{value:"Lightning CLI source code",id:"lightning-cli-source-code",level:3},{value:"Change directory to Lightning source code",id:"change-directory-to-lightning-source-code",level:3},{value:"Install Docker",id:"install-docker",level:3},{value:"Create the Docker image",id:"create-the-docker-image",level:3},{value:"Build the Docker image",id:"build-the-docker-image",level:3},{value:"Docker Container",id:"docker-container",level:2},{value:"Generate keys",id:"generate-keys",level:2},{value:"Run the Docker Container as Systemd Service",id:"run-the-docker-container-as-systemd-service",level:2},{value:"Create the Systemd Service Unit",id:"create-the-systemd-service-unit",level:3},{value:"Viewing logs",id:"viewing-logs",level:2},{value:"Conclusion",id:"conclusion",level:2}],h={toc:p},m="wrapper";function g(e){let{components:t,...s}=e;return(0,r.kt)(m,(0,a.Z)({},h,s,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Running a node in Docker",src:n(8597).Z,width:"1450",height:"816"})),(0,r.kt)("h2",{id:"introduction"},"Introduction"),(0,r.kt)("p",null,"Our ",(0,r.kt)("a",{parentName:"p",href:"https://www.docker.com/"},"Docker")," ",(0,r.kt)("a",{parentName:"p",href:"https://docs.docker.com/engine/reference/commandline/images/"},"image")," provides all the requirements to have Fleek Network running quickly and the following guide will provide you a quick reference to get you started with Docker. "),(0,r.kt)("p",null,"Alternatively, if you need a deep dive into Docker, check the official getting started ",(0,r.kt)("a",{parentName:"p",href:"https://docs.docker.com/get-started/"},"here"),"."),(0,r.kt)("p",null,"TL;DR If you have Docker experience then you'll find our ",(0,r.kt)("a",{parentName:"p",href:"#for-the-impatient"},"for the impatient")," sufficient to get started."),(0,r.kt)("h2",{id:"pre-requisites"},"Pre-requisites"),(0,r.kt)("p",null,"To follow the guide, you will need the following:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Familiarity with the command-line interface"),(0,r.kt)("li",{parentName:"ul"},"Git")),(0,r.kt)("h2",{id:"for-the-impatient"},"For the impatient"),(0,r.kt)("p",null,"Building a Docker image requires some effort and some of our users might find it easier to pull our ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning/pkgs/container/lightning"},"latest image")," for quick access to Lightning CLI, which doesn't require them to build from source."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"The Docker Container image for Lightning is located at ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning/pkgs/container/lightning"},"https://github.com/fleek-network/lightning/pkgs/container/lightning"),".")),(0,r.kt)("h3",{id:"pull-and-run-image"},"Pull and run image"),(0,r.kt)("p",null,"You can pull an run the Lightning pre-built Docker image from our GitHub and run the Docker container quickly by executing the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run \\\n -p 4230:4230 \\\n -p 4200:4200 \\\n -p 6969:6969 \\\n -p 18000:18000 \\\n -p 18101:18101 \\\n -p 18102:18102 \\\n --mount type=bind,source=$HOME/.lightning,target=/root/.lightning \\\n --name lightning-cli \\\n -it ghcr.io/fleek-network/lightning:latest\n")),(0,r.kt)("p",null,"Keys have to be generated when launching the service. On Docker run, if the ",(0,r.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/managing-the-keystore"},"keystore")," is not found, the keys are automatically generated and stored in the Docker host's ",(0,r.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore")," directory. To learn more about how to manage the keystore, visit the ",(0,r.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/managing-the-keystore"},"managing keystore")," section."),(0,r.kt)("admonition",{title:"warning",type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"The Docker image is tied to a CPU architecture, make sure that you have verified the ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/requirements#specs"},"required")," specifications to run the container successfully.")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"The command has a list of ports ",(0,r.kt)("inlineCode",{parentName:"p"},"-p")," values that map ports in the container on the Docker host. While we try to keep the information across our documentation in sync with the latest changes or requirements e.g. port number changes, make sure that you check the section ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/requirements#ports"},"ports")," to find the latest updates.")),(0,r.kt)("h2",{id:"setup"},"Setup"),(0,r.kt)("h3",{id:"requirements"},"Requirements"),(0,r.kt)("p",null,"To follow the guide successfully, a good amount of memory and disk space is necessary to run Docker. The main reason for our use-case is that your host machine requires a generous amount of memory and disk space, for the containers."),(0,r.kt)("p",null,"For this guide, we used a server with the 4vCPU, 32\xa0GB ram memory and 20 GB disk space specifications. Learn more about the recommended specifications ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/requirements"},"here"),"."),(0,r.kt)("h3",{id:"create-a-user"},"Create a user"),(0,r.kt)(l.ZP,{mdxType:"CreateAUser"}),(0,r.kt)("h3",{id:"lightning-cli-source-code"},"Lightning CLI source code"),(0,r.kt)("p",null,"Start by cloning the repository located at ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"https://github.com/fleek-network/lightning"),"."),(0,r.kt)(i.ZP,{mdxType:"GitCloneOptions"}),(0,r.kt)("h3",{id:"change-directory-to-lightning-source-code"},"Change directory to Lightning source code"),(0,r.kt)("p",null,"If you have cloned the project correctly, you should ",(0,r.kt)("inlineCode",{parentName:"p"},"change directory")," to the project source code directory which by default is ",(0,r.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,r.kt)("p",null,"At time of writing, this is how the project root looks like (e.g. use the ",(0,r.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Ls"},"ls")," to see the list):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},".\n\u251c\u2500\u2500 CODE_OF_CONDUCT.md\n\u251c\u2500\u2500 CONTRIBUTING.md\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 Dockerfile\n\u251c\u2500\u2500 LICENSE\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 codecov.yml\n\u251c\u2500\u2500 core\n\u251c\u2500\u2500 docs\n\u251c\u2500\u2500 etc\n\u251c\u2500\u2500 lib\n\u251c\u2500\u2500 rust-toolchain\n\u251c\u2500\u2500 rustfmt.toml\n\u251c\u2500\u2500 services\n\u2514\u2500\u2500 target\n")),(0,r.kt)("h3",{id:"install-docker"},"Install Docker"),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"To keep our guide short, we're using Ubuntu Linux. You'll have to make the required tweaks for your preferred Linux Distro. Find the list of support operating systems ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"here"),".")),(0,r.kt)("p",null,"First, update the existing list of packages:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt update\n")),(0,r.kt)("p",null,"Next, install the required packages to let apt use packages over HTTPS:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt install apt-transport-https ca-certificates software-properties-common\n")),(0,r.kt)("p",null,"Add the GPG key for the official Docker repository to your system:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -\n")),(0,r.kt)("p",null,"Add the Docker repository to apt sources and update the package database with the Docker packages from the new added repository:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable"\n')),(0,r.kt)("p",null,"Set to install from the Docker repo instead of the default Ubuntu repo:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"apt-cache policy docker-ce\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"docker-ce:\n Installed: (none)\n Candidate: 5:24.0.6-1~ubuntu.22.04~jammy\n Version table:\n 5:24.0.6-1~ubuntu.22.04~jammy 500\n 500 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages\n 5:24.0.6-1~ubuntu.22.04~jammy 500\n")),(0,r.kt)("p",null,"Finally, install Docker:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt install docker-ce\n")),(0,r.kt)("p",null,"Once complete you should be able to run it via the CLI, as such:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"docker -v\n")),(0,r.kt)("p",null,"Here's the output (versions might differ a bit from the time of writing):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"Docker version 24.0.6, build ed223bc\n")),(0,r.kt)("p",null,"The following command's output will indicate if Docker's working correctly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run hello-world\n")),(0,r.kt)("p",null,"Here's an example of the output you'll find us \"Hello from Docker!\":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'Hello from Docker!\nThis message shows that your installation appears to be working correctly.\n\nTo generate this message, Docker took the following steps:\n 1. The Docker client contacted the Docker daemon.\n 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.\n (amd64)\n 3. The Docker daemon created a new container from that image which runs the\n executable that produces the output you are currently reading.\n 4. The Docker daemon streamed that output to the Docker client, which sent it\n to your terminal.\n\nTo try something more ambitious, you can run an Ubuntu container with:\n $ docker run -it ubuntu bash\n\nShare images, automate workflows, and more with a free Docker ID:\n https://hub.docker.com/\n\nFor more examples and ideas, visit:\n https://docs.docker.com/get-started/\n')),(0,r.kt)("p",null,"Run all the commands above in your terminal, to confirm everything's working before proceeding to the next steps."),(0,r.kt)("h3",{id:"create-the-docker-image"},"Create the Docker image"),(0,r.kt)("p",null,"A Docker image is a read-only template with instructions for creating a Docker container, like a template. Docker images also act as a starting point when using Docker. "),(0,r.kt)("p",null,'The starting point for our use-case is a Dockerfile, where all those "template instructions" are declared.'),(0,r.kt)("p",null,"A ",(0,r.kt)("a",{parentName:"p",href:"https://raw.githubusercontent.com/fleek-network/lightning/main/Dockerfile"},"Dockerfile")," should exist in the repository source code, so make sure you have ",(0,r.kt)("a",{parentName:"p",href:"#change-directory-to-lightning-source-code"},"chage directory to the lightning source code")," to find it."),(0,r.kt)("h3",{id:"build-the-docker-image"},"Build the Docker image"),(0,r.kt)("p",null,"Build the image named as ",(0,r.kt)("inlineCode",{parentName:"p"},"lightning")," from our Dockerfile:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker build -t lightning -f ./Dockerfile .\n")),(0,r.kt)("p",null,"The build process takes awhile and you have to wait for completion. "),(0,r.kt)("p",null,"The output should be similar to:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"[+] Building 1.2s (16/16) FINISHED docker:default\n => [internal] load build definition from Dockerfile 0.0s\n => => transferring dockerfile: 990B 0.0s\n => [internal] load .dockerignore 0.0s\n => => transferring context: 2B 0.0s\n => [internal] load metadata for docker.io/library/debian:bullseye-slim 0.6s\n => [internal] load metadata for docker.io/library/rust:latest 0.9s\n => [stage-1 1/3] FROM docker.io/library/debian:bullseye-slim@sha256:3bc5e94a0e8329c102203c3f5f26fd67835f0c81633dd6949de0557867a87fac 0.0s\n => [builder 1/7] FROM docker.io/library/rust:latest@sha256:8a4ca3ca75afbc97bcf5362e9a694fe049d15734fbbaf82b8b7e224616c1254b 0.0s\n => [internal] load build context 0.3s\n => => transferring context: 948.93kB 0.3s\n => CACHED [stage-1 2/3] RUN DEBIAN_FRONTEND=noninteractive apt-get update -yq && DEBIAN_FRONTEND=noninteractive apt-get install -yq libs 0.0s\n => CACHED [builder 2/7] WORKDIR /lightning 0.0s\n => CACHED [builder 3/7] RUN apt-get update 0.0s\n => CACHED [builder 4/7] RUN apt-get install -y build-essential cmake clang pkg-config libssl-dev gcc protobuf-comp 0.0s\n => CACHED [builder 5/7] RUN --mount=type=cache,target=/usr/local/cargo/registry cargo install cargo-strip 0.0s\n => CACHED [builder 6/7] COPY . . 0.0s\n => CACHED [builder 7/7] RUN --mount=type=cache,target=/usr/local/cargo/registry --mount=type=cache,target=/lightning/target cargo buil 0.0s\n => CACHED [stage-1 3/3] COPY --from=builder /lightning/target/release/lightning-node /usr/local/bin/lgtn 0.0s\n => exporting to image 0.0s\n => => exporting layers 0.0s\n => => writing image sha256:e8e5ed19f59c3cc6a9add5bdb578c464904e9789d5f386cc4af81044c062d998 0.0s\n => => naming to docker.io/library/lightning\n")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"The Docker image is only required to be built once and/or, when changes are pulled from the remote repository, or specific versions you might be interested in. Otherwise, you're not required to build it everytime to run the node. If you'd like to learn how to update the Lightning CLI, find our references ",(0,r.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/update-cli-from-source-code"},"here"),".")),(0,r.kt)("admonition",{type:"caution"},(0,r.kt)("p",{parentName:"admonition"},"If you don't update your source code and binary build often, you won't have the latest changes, which should happen frequently to take advandate of all the ongoing development. This is quite important to understand, as it causes confusion to some users. The Lightning application at time of writing does not update automatically.")),(0,r.kt)("h2",{id:"docker-container"},"Docker Container"),(0,r.kt)("p",null,"A container is what's originated from the image we discussed in the section ",(0,r.kt)("a",{parentName:"p",href:"#build-the-docker-image"},"build the docker image"),", it is a runnable instance of an image. We can create, start, stop, move, or delete a container using the Docker API or CLI."),(0,r.kt)("p",null,"Following up, we'll learn how to run the Docker container that includes our Lightning CLI program, built from our Dockerfile."),(0,r.kt)("p",null,"Once the ",(0,r.kt)("a",{parentName:"p",href:"#build-the-docker-image"},"Docker image")," is ready, run the container based on the image ",(0,r.kt)("inlineCode",{parentName:"p"},"lightning"),". Effectively running the Fleek Network Lighthing node process:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run \\\n -p 4230:4230 \\\n -p 4200:4200 \\\n -p 6969:6969 \\\n -p 18000:18000 \\\n -p 18101:18101 \\\n -p 18102:18102 \\\n --mount type=bind,source=$HOME/.lightning,target=/root/.lightning \\\n --name lightning-cli \\\n -it lightning\n")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Notice that the command arguments we pass are for the flag's ",(0,r.kt)("inlineCode",{parentName:"p"},"-p")," port numbers, ",(0,r.kt)("inlineCode",{parentName:"p"},"-v")," to bind mount a location in your host to a container path (useful to persist your configuration files, e.g. keystore), ",(0,r.kt)("inlineCode",{parentName:"p"},"--name")," to make it easier to identify, ",(0,r.kt)("inlineCode",{parentName:"p"},"-it")," to make it interactive (e.g. presents output to the terminal), and the image name we ",(0,r.kt)("a",{parentName:"p",href:"#build-the-docker-image"},"built earlier"),".")),(0,r.kt)("p",null,'The output would look as the following, showing the error message "Node is not whitelisted" (this error message is due to the testnet phase that requires nodes to be whitelisted to run successfully):'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"thread 'main' panicked at 'Node is not whitelisted. Please join the Fleek Discord to get invited.', core/cli/src/testnet_sync.rs:45:9\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n/root/init: line 7: 7 Aborted (core dumped) lgtn run\n")),(0,r.kt)("p",null,"Keys have to be generated when launching the service. On Docker run, if the ",(0,r.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/managing-the-keystore"},"keystore")," is not found, the keys are automatically generated and stored in the Docker host's ",(0,r.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore")," directory."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Have in mind that the ",(0,r.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml")," is where the keystore location paths are configured, which default value is in the user ",(0,r.kt)("inlineCode",{parentName:"p"},"$HOME")," path. The users who customize or modify the default location, need to apply the required customizations. To learn more about how to manage the keystore, visit the ",(0,r.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/managing-the-keystore"},"managing keystore")," section.")),(0,r.kt)("h2",{id:"generate-keys"},"Generate keys"),(0,r.kt)("p",null,"Execute the ",(0,r.kt)("inlineCode",{parentName:"p"},"keys generate")," command on the container ",(0,r.kt)("inlineCode",{parentName:"p"},"lightning-cli"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker exec -it lightning-cli lgtn keys generate\n")),(0,r.kt)("p",null,"We've bound the host path ",(0,r.kt)("inlineCode",{parentName:"p"},"~/.lightning")," into the container ",(0,r.kt)("inlineCode",{parentName:"p"},"/root/.lightning"),"."),(0,r.kt)("p",null,"You can list the contents of the ",(0,r.kt)("inlineCode",{parentName:"p"},"~/.lightning"),", where you should find the ",(0,r.kt)("inlineCode",{parentName:"p"},"config.toml")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"keystore"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},".\n..\nconfig.toml\nkeystore\n")),(0,r.kt)("p",null,"You only have to run the ",(0,r.kt)("inlineCode",{parentName:"p"},"keys generate")," once from your host."),(0,r.kt)("p",null,"Finaly, you can start the Fleek Network node by running the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker start lightning-cli\n")),(0,r.kt)("h2",{id:"run-the-docker-container-as-systemd-service"},"Run the Docker Container as Systemd Service"),(0,r.kt)("p",null,"In this section we\u2019ll cover how to wrap a Docker Container as a Systemd Service without the need for third party tools or complex commands. Some reasons include, minimizing the dependency on the Docker Daemon as we can move to a ",(0,r.kt)("a",{parentName:"p",href:"https://opencontainers.org/"},"OCI complaint solution")," other that Docker at anytime, or the fact we recommend Systemd Service Units and Systemctl to control the Service in our ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install"},"Native install")," that most users are familiar."),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"Docker recommends using their cross-platform built-in restart policy for running a Container as a Service. For that, configure your Docker service to ",(0,r.kt)("a",{parentName:"p",href:"https://docs.docker.com/install/linux/linux-postinstall/#configure-docker-to-start-on-boot"},"start on system boot"),".")),(0,r.kt)("p",null,"Systemd was specifically developed to serve the purpose of stopping services, dependency checking and recovery of failed services. You can have your host start, stop, enable, check the status, and generally manage a container as a Systemd Service."),(0,r.kt)("h3",{id:"create-the-systemd-service-unit"},"Create the Systemd Service Unit"),(0,r.kt)("p",null,"We are going to create the unit configuration file in the /etc/systemd/system/ directory. The Service Unit is going to be named as ",(0,r.kt)("inlineCode",{parentName:"p"},"docker-lightning.service"),". To create the file run the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo touch /etc/systemd/system/docker-lightning.service\n")),(0,r.kt)("p",null,"Open the file in your favorite text editor and populate with the content found here:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\nAfter=docker.service\nRequires=docker.service\n\n[Service]\nRestart=always\nRestartSec=5\nTimeoutStartSec=0\nExecStartPre=-/usr/bin/docker kill lightning-cli\nExecStartPre=-/usr/bin/docker rm lightning-cli\nExecStartPre=/usr/bin/docker pull ghcr.io/fleek-network/lightning:latest\nExecStart=/usr/bin/docker run -p 4230:4230 -p 4200:4200 -p 6969:6969 -p 18000:18000 -p 18101:18101 -p 18102:18102 --mount type=bind,source=/home/skywalker/.lightning,target=/root/.lightning --name lightning-cli ghcr.io/fleek-network/lightning:latest\nExecStop=/usr/bin/docker stop\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\n\n[Install]\nWantedBy=multi-user.target\n")),(0,r.kt)("p",null,"Once the file is saved, change the file permissions by running the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo chmod 644 /etc/systemd/system/docker-lightning.service\n")),(0,r.kt)("p",null,"Next, reload the Systemctl Daemon:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,r.kt)("p",null,"Enable the service on startup when the system boots:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl enable docker-lightning.service\n")),(0,r.kt)("p",null,"As a result, we are now able to run our containers as a Systemd service. For this, read the document ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/install#use-systemctl-to-manage-systemd-service"},"manage systemd service")," to find more about how to control the service."),(0,r.kt)("h2",{id:"viewing-logs"},"Viewing logs"),(0,r.kt)("p",null,"To view the logs of a Docker container in real time, use the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker logs -f lightning-cli\n")),(0,r.kt)("p",null,"If you have wrapped the ",(0,r.kt)("a",{parentName:"p",href:"#run-the-docker-container-as-systemd-service"},"docker container as a systemd service"),", you can use the same commands found when installed natively, such as:"),(0,r.kt)("p",null,"For standard output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"tail -f /var/log/lightning/output.log\n")),(0,r.kt)("p",null,"Or, the standard error:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"tail -f /var/log/lightning/diagnostic.log\n")),(0,r.kt)("p",null,"Learn more about how to ",(0,r.kt)("a",{parentName:"p",href:"/docs/node/analyzing-logs"},"analyze log messages"),"."),(0,r.kt)("h2",{id:"conclusion"},"Conclusion"),(0,r.kt)("p",null,"Containers are a way to have a self-contained environment that includes all necessary dependencies, libraries, software, amongst others required to run an application."),(0,r.kt)("p",null,"Fleek Network's Lightning is developed with ",(0,r.kt)("a",{parentName:"p",href:"https://www.rust-lang.org/"},"Rust"),", a general-purpose programming language, that requires several dependencies and libraries to compile the project. Some of these libraries are not installed by default and require some troubleshooting for the end user. ",(0,r.kt)("a",{parentName:"p",href:"https://www.docker.com/"},"Docker")," provides us with containers, self-containing all the required libraries for the purpose of running Lightning, our application."),(0,r.kt)("p",null,"We guided you through the initial installation steps, and how to build a ",(0,r.kt)("a",{parentName:"p",href:"https://www.docker.com/"},"Docker")," image, which then's used to Docker run a container. Plus, provided lower-level commands, to help you understand other present or advanced use-cases, and also at higher level, offerring simple utility methods."),(0,r.kt)("p",null,"While we do our best to provide the clearest instructions, there's always space for improvement, therefore feel free to make any contributions by messaging us on our ",(0,r.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"Discord")," or by opening a ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network"},"PR")," in any of our repositories."),(0,r.kt)("p",null,"Discover more about the project by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"watching/contributing on Github"),", following us on ",(0,r.kt)("a",{parentName:"p",href:"https://twitter.com/fleek_net"},"Twitter"),", and joining ",(0,r.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"our community Discord")," for all the best updates!"),(0,r.kt)(o.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}g.isMDXComponent=!0},6733:(e,t,n)=>{n.d(t,{ZP:()=>l});var a=n(7462),r=(n(7294),n(3905));const o={toc:[]},i="wrapper";function l(e){let{components:t,...n}=e;return(0,r.kt)(i,(0,a.Z)({},o,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"We recommend creating a ",(0,r.kt)("inlineCode",{parentName:"p"},"non-root")," user with administrative privileges. It'll allow us to install any system requirements."),(0,r.kt)("p",null,"You can create a new user and add to the ",(0,r.kt)("strong",{parentName:"p"},"sudo")," group by running:"),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"For our example, we'll be using the name ",(0,r.kt)("inlineCode",{parentName:"p"},"lgtn")," but you can pick whichever you'd like. If you already have a ",(0,r.kt)("strong",{parentName:"p"},"sudoer")," account, you can skip this step.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo adduser lgtn\n")),(0,r.kt)("p",null,"After completing the ",(0,r.kt)("inlineCode",{parentName:"p"},"adduser")," steps, execute the ",(0,r.kt)("inlineCode",{parentName:"p"},"usermod")," to add the ",(0,r.kt)("inlineCode",{parentName:"p"},"user")," to the ",(0,r.kt)("strong",{parentName:"p"},"sudo")," group, as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"sudo usermod -aG sudo lgtn\n")),(0,r.kt)("p",null,"Switch to the new ",(0,r.kt)("strong",{parentName:"p"},"user")," by using the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"su lgtn\n")),(0,r.kt)("p",null,"Change the directory to the new user's home, as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"cd /home/lgtn\n")))}l.isMDXComponent=!0},2915:(e,t,n)=>{n.d(t,{ZP:()=>l});var a=n(7462),r=(n(7294),n(3905));const o={toc:[]},i="wrapper";function l(e){let{components:t,...n}=e;return(0,r.kt)(i,(0,a.Z)({},o,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"You have several ways of doing this:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},"Clone via HTTPS"),(0,r.kt)("li",{parentName:"ul"},"Clone via SSH"),(0,r.kt)("li",{parentName:"ul"},"Download via Github CLI"),(0,r.kt)("li",{parentName:"ul"},"Download the ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/fleek-network/lightning/archive/refs/heads/main.zip"},"zip package")," from the repository")),(0,r.kt)("p",{parentName:"admonition"},"We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this.\nAlthough, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it ",(0,r.kt)("a",{parentName:"p",href:"https://docs.github.com/en/authentication/connecting-to-github-with-ssh"},"here"),"."),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git \n")),(0,r.kt)("p",{parentName:"admonition"},"At time of writing, we are checking the branch name ",(0,r.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1")," that corresponds to the testnet phase.\nHere's an example of what it'd look like when sticking to the recommended path location:"),(0,r.kt)("pre",{parentName:"admonition"},(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning\n"))))}l.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>r});var a=n(7294);const r=e=>{let{image:t,name:n,title:r,url:o,communityMember:i=!1}=e;return a.createElement("section",{className:"author_card"},a.createElement("div",null,a.createElement("span",{className:"avatar"},a.createElement("a",{href:o,target:"_blank",alt:n},a.createElement("img",{src:t,alt:n}))),a.createElement("div",null,a.createElement("span",{className:"name"},a.createElement("a",{href:o,target:"_blank",alt:n},n)),a.createElement("span",{className:"title"},r),a.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",a.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}},8597:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/running-a-node-in-docker-cc0a5b3fda558b4b6dd40022fe5dd09f.png"}}]); \ No newline at end of file diff --git a/assets/js/4d7007b2.6418c206.js b/assets/js/4d7007b2.bc866e91.js similarity index 98% rename from assets/js/4d7007b2.6418c206.js rename to assets/js/4d7007b2.bc866e91.js index 1824ea07c..7e007f6af 100644 --- a/assets/js/4d7007b2.6418c206.js +++ b/assets/js/4d7007b2.bc866e91.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[6272],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(7294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},f="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),f=l(r),d=o,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||a;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[f]="string"==typeof e?e:o,i[1]=c;for(var l=2;l{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var n=r(7462),o=(r(7294),r(3905));const a=r.p+"assets/images/banner-references-a0368a847f1d60e338779105f44a9e9a.png",i={title:"About references",hide_title:!0,sidebar_position:1,tags:["References","Help"]},c=void 0,s={unversionedId:"index",id:"index",title:"About references",description:"The references provide concise instructions to interface with the system, broken down into commands or small pieces for quick reference.",source:"@site/references/index.md",sourceDirName:".",slug:"/",permalink:"/references/",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/index.md",tags:[{label:"References",permalink:"/references/tags/references"},{label:"Help",permalink:"/references/tags/help"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",sidebarPosition:1,frontMatter:{title:"About references",hide_title:!0,sidebar_position:1,tags:["References","Help"]},sidebar:"defaultSidebar",next:{title:"Build and run in Docker",permalink:"/references/Docker/build-and-run-in-docker"}},l={},p=[],f={toc:p},u="wrapper";function d(e){let{components:t,...r}=e;return(0,o.kt)(u,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("img",{className:"banner",src:a}),(0,o.kt)("p",null,"The references provide concise instructions to interface with the system, broken down into commands or small pieces for quick reference."),(0,o.kt)("p",null,"It differs from ",(0,o.kt)("a",{parentName:"p",href:"/guides"},"Guides")," which is more descriptive or verbose when providing instructions and how-to's."),(0,o.kt)("p",null,"To start, find references by consulting the available categories to locate the appropriate content on the sidebar. Our references are also available as a result when using the search feature located at the very top of the documentation site."))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[6272],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(7294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},f="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),f=l(r),d=o,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||a;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[f]="string"==typeof e?e:o,i[1]=c;for(var l=2;l{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var n=r(7462),o=(r(7294),r(3905));const a=r.p+"assets/images/banner-references-a0368a847f1d60e338779105f44a9e9a.png",i={title:"About references",hide_title:!0,sidebar_position:1,tags:["References","Help"]},c=void 0,s={unversionedId:"index",id:"index",title:"About references",description:"The references provide concise instructions to interface with the system, broken down into commands or small pieces for quick reference.",source:"@site/references/index.md",sourceDirName:".",slug:"/",permalink:"/references/",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/index.md",tags:[{label:"References",permalink:"/references/tags/references"},{label:"Help",permalink:"/references/tags/help"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",sidebarPosition:1,frontMatter:{title:"About references",hide_title:!0,sidebar_position:1,tags:["References","Help"]},sidebar:"defaultSidebar",next:{title:"Build and run in Docker",permalink:"/references/Docker/build-and-run-in-docker"}},l={},p=[],f={toc:p},u="wrapper";function d(e){let{components:t,...r}=e;return(0,o.kt)(u,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("img",{className:"banner",src:a}),(0,o.kt)("p",null,"The references provide concise instructions to interface with the system, broken down into commands or small pieces for quick reference."),(0,o.kt)("p",null,"It differs from ",(0,o.kt)("a",{parentName:"p",href:"/guides"},"Guides")," which is more descriptive or verbose when providing instructions and how-to's."),(0,o.kt)("p",null,"To start, find references by consulting the available categories to locate the appropriate content on the sidebar. Our references are also available as a result when using the search feature located at the very top of the documentation site."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/51d5b592.ef253045.js b/assets/js/51d5b592.e890f6e2.js similarity index 88% rename from assets/js/51d5b592.ef253045.js rename to assets/js/51d5b592.e890f6e2.js index 4305fa40a..6670c971c 100644 --- a/assets/js/51d5b592.ef253045.js +++ b/assets/js/51d5b592.e890f6e2.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1984],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(n),h=o,m=c["".concat(s,".").concat(h)]||c[h]||d[h]||i;return n?a.createElement(m,r(r({ref:t},u),{},{components:n})):a.createElement(m,r({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,r=new Array(i);r[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:o,r[1]=l;for(var p=2;p{n.d(t,{ZP:()=>l});var a=n(7462),o=(n(7294),n(3905));const i={toc:[]},r="wrapper";function l(e){let{components:t,...n}=e;return(0,o.kt)(r,(0,a.Z)({},i,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"We recommend creating a ",(0,o.kt)("inlineCode",{parentName:"p"},"non-root")," user with administrative privileges. It'll allow us to install any system requirements."),(0,o.kt)("p",null,"You can create a new user and add to the ",(0,o.kt)("strong",{parentName:"p"},"sudo")," group by running:"),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"For our example, we'll be using the name ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," but you can pick whichever you'd like. If you already have a ",(0,o.kt)("strong",{parentName:"p"},"sudoer")," account, you can skip this step.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo adduser lgtn\n")),(0,o.kt)("p",null,"After completing the ",(0,o.kt)("inlineCode",{parentName:"p"},"adduser")," steps, execute the ",(0,o.kt)("inlineCode",{parentName:"p"},"usermod")," to add the ",(0,o.kt)("inlineCode",{parentName:"p"},"user")," to the ",(0,o.kt)("strong",{parentName:"p"},"sudo")," group, as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo usermod -aG sudo lgtn\n")),(0,o.kt)("p",null,"Switch to the new ",(0,o.kt)("strong",{parentName:"p"},"user")," by using the command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"su lgtn\n")),(0,o.kt)("p",null,"Change the directory to the new user's home, as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cd /home/lgtn\n")))}l.isMDXComponent=!0},2915:(e,t,n)=>{n.d(t,{ZP:()=>l});var a=n(7462),o=(n(7294),n(3905));const i={toc:[]},r="wrapper";function l(e){let{components:t,...n}=e;return(0,o.kt)(r,(0,a.Z)({},i,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"You have several ways of doing this:"),(0,o.kt)("ul",{parentName:"admonition"},(0,o.kt)("li",{parentName:"ul"},"Clone via HTTPS"),(0,o.kt)("li",{parentName:"ul"},"Clone via SSH"),(0,o.kt)("li",{parentName:"ul"},"Download via Github CLI"),(0,o.kt)("li",{parentName:"ul"},"Download the ",(0,o.kt)("a",{parentName:"li",href:"https://github.com/fleek-network/lightning/archive/refs/heads/main.zip"},"zip package")," from the repository")),(0,o.kt)("p",{parentName:"admonition"},"We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this.\nAlthough, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it ",(0,o.kt)("a",{parentName:"p",href:"https://docs.github.com/en/authentication/connecting-to-github-with-ssh"},"here"),"."),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git \n")),(0,o.kt)("p",{parentName:"admonition"},"At time of writing, we are checking the branch name ",(0,o.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1")," that corresponds to the testnet phase.\nHere's an example of what it'd look like when sticking to the recommended path location:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning\n"))))}l.isMDXComponent=!0},3813:(e,t,n)=>{n.d(t,{ZP:()=>l});var a=n(7462),o=(n(7294),n(3905));const i={toc:[]},r="wrapper";function l(e){let{components:t,...n}=e;return(0,o.kt)(r,(0,a.Z)({},i,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The flag ",(0,o.kt)("inlineCode",{parentName:"p"},"-c")," in the ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning.service")," ",(0,o.kt)("strong",{parentName:"p"},"ExecStart"),", is to provide the toml configuration file path e.g. defaults to ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml"),". This is to avoid the path being determined dynamically (given path base ~ or $HOME), as users might control the systemctl service as a ",(0,o.kt)("strong",{parentName:"p"},"user")," or ",(0,o.kt)("strong",{parentName:"p"},"sudoer"),". For example, a ",(0,o.kt)("strong",{parentName:"p"},"sudoer")," would have the ",(0,o.kt)("strong",{parentName:"p"},"configuration")," set to ",(0,o.kt)("inlineCode",{parentName:"p"},"/root/.lightning/config.toml")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/username/.lightning/config.toml")," depending on using ",(0,o.kt)("strong",{parentName:"p"},"sudo")," which might cause some confusion to some users.")))}l.isMDXComponent=!0},2300:(e,t,n)=>{n.d(t,{ZP:()=>l});var a=n(7462),o=(n(7294),n(3905));const i={toc:[]},r="wrapper";function l(e){let{components:t,...n}=e;return(0,o.kt)(r,(0,a.Z)({},i,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"You should be following the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user-1"},"create a user")," recommendation. For our example, we have the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn"),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"If you have chosen a different username, replace ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," by the correct username you have selected.")),(0,o.kt)("p",null,"In the ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")," you'll find some and more of the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,o.kt)("p",null,"Find and replace all instances of ",(0,o.kt)("inlineCode",{parentName:"p"},"~")," in the config file ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/config.toml"),". Here's an example using ",(0,o.kt)("inlineCode",{parentName:"p"},"sed"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"\n')),(0,o.kt)("admonition",{type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"The ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")," example below is a shorter version of what you'll encounter, yours might look different. We do this to keep the guide simple to read. Do not copy and replace with the version demonstrated here.")),(0,o.kt)("p",null,"Once changed, all the instances of ",(0,o.kt)("inlineCode",{parentName:"p"},"~/")," should be replaced by your user path e.g. ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn/"),". For our example, the output would look like the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "/home/lgtn/.lightning/data/app_db"\n\n[consensus]\nstore_path = "/home/lgtn/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "/home/lgtn/.lightning/blockstore"\n\n[resolver]\nstore_path = "/home/lgtn/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"\nnode_key_path = "/home/lgtn/.lightning/keystore/node.pem"\n')))}l.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(7294);const o=e=>{let{image:t,name:n,title:o,url:i,communityMember:r=!1}=e;return a.createElement("section",{className:"author_card"},a.createElement("div",null,a.createElement("span",{className:"avatar"},a.createElement("a",{href:i,target:"_blank",alt:n},a.createElement("img",{src:t,alt:n}))),a.createElement("div",null,a.createElement("span",{className:"name"},a.createElement("a",{href:i,target:"_blank",alt:n},n)),a.createElement("span",{className:"title"},o),a.createElement("span",{className:"discord"},r?"Join our community on":"Got questions? Find us on"," ",a.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}},7183:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>h,contentTitle:()=>c,default:()=>f,frontMatter:()=>u,metadata:()=>d,toc:()=>m});var a=n(7462),o=(n(7294),n(3905)),i=n(3872),r=n(2915),l=n(6733),s=n(2300),p=n(3813);const u={title:"Install",hide_title:!0,slug:"install",date:new Date("2023-08-21T23:00:00.000Z"),canonical:"",description:"The Fleek Network Lightning CLI installation walkthrough",category:"Tutorial",tags:["CDN","Guide","Getting Started","Fleek Network","Rust dependencies","compile","build","wizard","manual"]},c=void 0,d={unversionedId:"node/install",id:"node/install",title:"Install",description:"The Fleek Network Lightning CLI installation walkthrough",source:"@site/docs/node/install.md",sourceDirName:"node",slug:"/node/install",permalink:"/docs/node/install",draft:!1,tags:[{label:"CDN",permalink:"/docs/tags/cdn"},{label:"Guide",permalink:"/docs/tags/guide"},{label:"Getting Started",permalink:"/docs/tags/getting-started"},{label:"Fleek Network",permalink:"/docs/tags/fleek-network"},{label:"Rust dependencies",permalink:"/docs/tags/rust-dependencies"},{label:"compile",permalink:"/docs/tags/compile"},{label:"build",permalink:"/docs/tags/build"},{label:"wizard",permalink:"/docs/tags/wizard"},{label:"manual",permalink:"/docs/tags/manual"}],version:"current",frontMatter:{title:"Install",hide_title:!0,slug:"install",date:"2023-08-21T23:00:00.000Z",canonical:"",description:"The Fleek Network Lightning CLI installation walkthrough",category:"Tutorial",tags:["CDN","Guide","Getting Started","Fleek Network","Rust dependencies","compile","build","wizard","manual"]},sidebar:"docs",previous:{title:"Testnet onboarding",permalink:"/docs/node/testnet-onboarding"},next:{title:"Health check",permalink:"/docs/node/health-check"}},h={},m=[{value:"Assisted installer",id:"assisted-installer",level:2},{value:"Prerequesites",id:"prerequesites",level:3},{value:"Connect to your server",id:"connect-to-your-server",level:3},{value:"Create a user",id:"create-a-user",level:3},{value:"Run the script for a quick install",id:"run-the-script-for-a-quick-install",level:3},{value:"About the process",id:"about-the-process",level:3},{value:"Manual installation",id:"manual-installation",level:2},{value:"Prerequisites",id:"prerequisites",level:3},{value:"Create a user",id:"create-a-user-1",level:3},{value:"Install Rust with Rustup tool",id:"install-rust-with-rustup-tool",level:3},{value:"Lightning installer rust dependencies",id:"lightning-installer-rust-dependencies",level:3},{value:"Linux dependencies",id:"linux-dependencies",level:3},{value:"Installing Lightning CLI",id:"installing-lightning-cli",level:3},{value:"Key generator",id:"key-generator",level:3},{value:"Set user path in config.toml",id:"set-user-path-in-configtoml",level:3},{value:"Set testnet in config.toml",id:"set-testnet-in-configtoml",level:3},{value:"Start the node",id:"start-the-node",level:3},{value:"Systemd Service Setup",id:"systemd-service-setup",level:3},{value:"Docker installation",id:"docker-installation",level:2},{value:"Quick pull and run",id:"quick-pull-and-run",level:3},{value:"Build from source",id:"build-from-source",level:3},{value:"Docker Container as a Systemd Service",id:"docker-container-as-a-systemd-service",level:3}],g={toc:m},k="wrapper";function f(e){let{components:t,...n}=e;return(0,o.kt)(k,(0,a.Z)({},g,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This section describes how to install the Fleek Network Lightning on supported operating systems. The installation can be made quicker by running the ",(0,o.kt)("a",{parentName:"p",href:"#assisted-installer"},"assisted installer")," or by following the ",(0,o.kt)("a",{parentName:"p",href:"#manual-installation"},"manual installation")," if you want a bit more control."),(0,o.kt)("admonition",{title:"Warning",type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"If you'd like to participate in the ",(0,o.kt)("a",{parentName:"p",href:"/docs/roadmap"},"alpha Testnet"),", you have to go through the onboarding process. Check the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements"},"requirements")," and find the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/testnet-onboarding"},"onboarding instructions")," to enable you to proceed and ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install"},"install")," a network node successfully.")),(0,o.kt)("h2",{id:"assisted-installer"},"Assisted installer"),(0,o.kt)("p",null,"The assisted installer is a script written in ",(0,o.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Bash_(Unix_shell)"},"Bash")," (Unix shell) that is available as a curl command line."),(0,o.kt)("h3",{id:"prerequesites"},"Prerequesites"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"A basic knowledge of command line interface (CLI)"),(0,o.kt)("li",{parentName:"ul"},"A ",(0,o.kt)("a",{parentName:"li",href:"/docs/node/requirements#server"},"supported")," Linux server")),(0,o.kt)("h3",{id:"connect-to-your-server"},"Connect to your server"),(0,o.kt)("p",null,"Connect to the Linux server where the Node's going to be installed via SSH by opening a shell session there."),(0,o.kt)("p",null,"If you have set up a public SSH key for the machine, connecting to the server should be as simple as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"ssh @\n")),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"Check the cloud provider for instructions to understand how to setup an ssh connection and connect to it remotely. Some other users might have local access to a ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"supported")," Linux server. To keep this guide short, we'll assume you've rented a VPS from a cloud provider.")),(0,o.kt)("h3",{id:"create-a-user"},"Create a user"),(0,o.kt)(l.ZP,{mdxType:"CreateAUser"}),(0,o.kt)("h3",{id:"run-the-script-for-a-quick-install"},"Run the script for a quick install"),(0,o.kt)("p",null,"Copy and paste it to the server host terminal and execute it to launch the assisted installation process, as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"curl https://get.fleek.network | bash\n")),(0,o.kt)("p",null,"On success, you should be greeted by the following welcome screen:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'\u2b50\ufe0f Fleek Network Lightning CLI installer \u2b50\ufe0f\n\n zeeeeee-\n z$$$$$$"\n d$$$$$$"\n d$$$$$P\n d$$$$$P\n $$$$$$"\n .$$$$$$"\n .$$$$$$"\n 4$$$$$$$$$$$$$"\n z$$$$$$$$$$$$$"\n """""""3$$$$$"\n z$$$$P\n d$$$$"\n .$$$$$"\n z$$$$$"\n z$$$$P\n d$$$$$$$$$$"\n *******$$$"\n .$$$"\n .$$"\n 4$P"\n z$"\n zP\n z"\n/\n\n\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605 \ud83c\udf0d Website https://fleek.network\n\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605 \ud83d\udcda Documentation https://docs.fleek.network\n\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605 \ud83d\udcbe Git repository https://github.com/fleek-network/lightning\n\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605 \ud83e\udd16 Discord https://discord.gg/fleekxyz\n\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605 \ud83d\udc24 Twitter https://twitter.com/fleek_net\n\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605 \ud83c\udfa8 Ascii art by https://www.asciiart.eu\n\n...\n\nRemaining output omitted for brevity, you\'ll not see this text line\n')),(0,o.kt)("p",null,"Follow the installation wizard to have the Fleek Network Lightning CLI and service installed on the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements"},"supported server"),"."),(0,o.kt)("p",null,"After creating the service file, you should reload the Systemd process, to apply the newly created service. You can do this by executing:"),(0,o.kt)("p",null,"After creating the service, launch the service by executing the following command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl start lightning.service\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To learn more about Systemctl commands, visit the section ",(0,o.kt)("a",{parentName:"p",href:"#use-systemctl-to-manage-systemd-service"},"Use Systemctl to manage the Lightning Service"))),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Find the timeline of events for the Lightning service by checking the log files. Learn about it in the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/analyzing-logs"},"Log Messages"),".")),(0,o.kt)("p",null,"Once the installation is complete, do a health check! Check the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/health-check"},"Health Check")," to learn how to do a node health checkup."),(0,o.kt)("h3",{id:"about-the-process"},"About the process"),(0,o.kt)("p",null,"The installation process is open source and transparent. The source is available in the ",(0,o.kt)("a",{parentName:"p",href:"https://get.fleek.network"},"get.fleek.network")," or the origin repository ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/get.fleek.network"},"here"),"."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},'"Get Fleek Network" is an attempt to make our software more accessible. By providing scripts to automate the installation process of our software, we believe that it can help improve the onboarding experience of our users.')),(0,o.kt)("p",null,"The installer assists the node operator by automating the Lightning CLI build from the open-source code and setting up the system service. A node operator should use the assisted installer to ease onboarding, reduce repetition,"),(0,o.kt)("p",null,"At a high level, the installer will:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Install required dependencies, e.g. rust toolchain"),(0,o.kt)("li",{parentName:"ul"},"Pull the source code from the origin ",(0,o.kt)("a",{parentName:"li",href:"https://github.com/fleek-network/lightning"},"repository")),(0,o.kt)("li",{parentName:"ul"},"Build the binary, e.g. a ",(0,o.kt)("inlineCode",{parentName:"li"},"lightning CLI")," (lgtn) is compiled from source code"),(0,o.kt)("li",{parentName:"ul"},"Setup a ",(0,o.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Systemd"},"Systemd")," service named lightning"),(0,o.kt)("li",{parentName:"ul"},"Provide instructions to launch, stop the Fleek network via the Systemd lightning service")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Remember that if you use the assisted installer, you won't have to do the ",(0,o.kt)("a",{parentName:"p",href:"#manual-installation"},"manual installation")," process as described in the next section. On success, the assisted installer should provide the same result as following the manual instructions.")),(0,o.kt)("h2",{id:"manual-installation"},"Manual installation"),(0,o.kt)("p",null,"The following section will walk through the dependencies and Rust installation process for Linux. If you're on Windows, we recommend to setup ",(0,o.kt)("a",{parentName:"p",href:"https://learn.microsoft.com/en-us/windows/wsl/install"},"Windows Subsystem Linux"),", reading the ",(0,o.kt)("a",{parentName:"p",href:"https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-10#1-overview"},"Ubuntu tutorial")," or picking another ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"supported distro"),". The WSL will let you use Linux applications, utilities and bash command tools you'll find in the tutorial."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"We're only supporting Linux operating system (server edition). Find the list of supported OS ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"here"),".")),(0,o.kt)("h3",{id:"prerequisites"},"Prerequisites"),(0,o.kt)("p",null,"To follow the guide, you will need the following:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Familiarity with the command-line interface"),(0,o.kt)("li",{parentName:"ul"},"Git")),(0,o.kt)("p",null,"You're required to have some experience with the command-line interface and have Git installed; Also, you should be happy to troubleshoot, since versions might differ from the time of writing and reading. Most times, a simple web search provides the best answers."),(0,o.kt)("p",null,"If you don't have Git installed, learn more about it and the instructions by reading the ",(0,o.kt)("a",{parentName:"p",href:"https://git-scm.com/book/en/v2"},"Git documentation"),"."),(0,o.kt)("h3",{id:"create-a-user-1"},"Create a user"),(0,o.kt)(l.ZP,{mdxType:"CreateAUser"}),(0,o.kt)("h3",{id:"install-rust-with-rustup-tool"},"Install Rust with Rustup tool"),(0,o.kt)("p",null,"Visit the ",(0,o.kt)("a",{parentName:"p",href:"https://www.rust-lang.org/"},"Rust website")," getting started guide, to find, copy and run the ",(0,o.kt)("a",{parentName:"p",href:"https://rustup.rs/"},"Rustup tool")," for installation and version management."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},(0,o.kt)("a",{parentName:"p",href:"https://curl.se/"},"curl")," is an application that is generally available in most OS, if missing install it. Find more ",(0,o.kt)("a",{parentName:"p",href:"https://curl.se/"},"here"),".")),(0,o.kt)("p",null,"Alternatively, if you have installed Rust in the past, you may want to update it \ud83d\udc4c."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"rustup update\n")),(0,o.kt)("p",null,"During the installation process, if asked about preferences, select the default option!"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"You can uninstall at any time with rustup self uninstall and\nthese changes will be reverted.\n\nCurrent installation options:\n\n\n default host triple: x86_64-unknown-linux-gnu\n default toolchain: stable (default)\n profile: default\n modify PATH variable: yes\n\n1) Proceed with installation (default)\n2) Customize installation\n3) Cancel installation\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Once complete, you'll have to restart your current shell or reload the \"PATH\" environment variable to include Cargo's bin directory ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME/.cargo/bin"),'. This is required to let you use "cargo" command globally.')),(0,o.kt)("p",null,"To configure your current shell, run:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'source "$HOME/.cargo/env"\n')),(0,o.kt)("p",null,"From then on, the latest version of Cargo (Rust's build and package manager tool) should be installed. Learn more about Cargo, ",(0,o.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/cargo/index.html"},"here"),"."),(0,o.kt)("p",null,"Check the ",(0,o.kt)("inlineCode",{parentName:"p"},"version")," to confirm's working correctly:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cargo --version\n")),(0,o.kt)("p",null,"Here's the output we got (beware that our version might differ to yours, it's expected \ud83d\ude05)."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cargo 1.65.0 (4bc8f24d3 2022-10-20)\n")),(0,o.kt)("h3",{id:"lightning-installer-rust-dependencies"},"Lightning installer rust dependencies"),(0,o.kt)("p",null,"Rustup subcommands deal with ",(0,o.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/rustup/concepts/toolchains.html"},"toolchains"),", a collection of programs required to compile a Rust application."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"rustup toolchain list\n")),(0,o.kt)("p",null,"For example, on Linux Ubuntu we generally have it set to the default:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"stable-x86_64-unknown-linux-gnu (default)\n")),(0,o.kt)("p",null,"While on macOS:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"stable-x86_64-apple-darwin (default)\n")),(0,o.kt)("p",null,"Make sure you have Rustup set to the desired toolchain as default if required \ud83d\udc81\u200d\u2640\ufe0f!"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"rustup default \n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Rust compilation is long and compiler caching can help speed things up immensely. The Lightning CLI project can be used to reduce the perceived compilation times.")),(0,o.kt)("h3",{id:"linux-dependencies"},"Linux dependencies"),(0,o.kt)("p",null,"On Linux (we'll stick with Ubuntu as the Linux distro example), start by updating the package information in the source list and then upgrade all the installed packages with the latest versions (do the equivalent for your Linux distro), as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get update\nsudo apt-get upgrade\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"You can optionally pass the ",(0,o.kt)("inlineCode",{parentName:"p"},"y")," flag to skip any user prompts e.g. ",(0,o.kt)("inlineCode",{parentName:"p"},"sudo apt-get update -y")," to any remaining apt-get commands.")),(0,o.kt)("p",null,"Install the build-essentials packages, necessary for compiling general software and for our use-case Lightning CLI."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get install build-essential\n")),(0,o.kt)("p",null,"Followed by the required tools to compile the application (",(0,o.kt)("a",{parentName:"p",href:"https://cmake.org/"},"cmake"),", ",(0,o.kt)("a",{parentName:"p",href:"https://clang.llvm.org/"},"clang"),", ",(0,o.kt)("a",{parentName:"p",href:"https://www.freedesktop.org/wiki/Software/pkg-config/"},"pkg-config")," and ",(0,o.kt)("a",{parentName:"p",href:"https://packages.debian.org/sid/libssl-dev"},"libssl-dev "),")."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get install cmake clang pkg-config libssl-dev gcc-multilib\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"For Debian, you should install ",(0,o.kt)("inlineCode",{parentName:"p"},"gcc"),", as follows:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get update\nsudo apt-get install gcc\n"))),(0,o.kt)("p",null,"Now install the ",(0,o.kt)("a",{parentName:"p",href:"https://grpc.io/docs/protoc-installation/"},"Protobufer Compiler"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get install protobuf-compiler\n")),(0,o.kt)("p",null,"Ensure the compiler version is 3+"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"protoc --version\n")),(0,o.kt)("h3",{id:"installing-lightning-cli"},"Installing Lightning CLI"),(0,o.kt)("p",null,"If you haven't already, clone the Fleek Network's Lightning repository to your machine."),(0,o.kt)(r.ZP,{mdxType:"GitCloneOptions"}),(0,o.kt)("p",null,"When git clone completes \ud83d\udc4d, ",(0,o.kt)("inlineCode",{parentName:"p"},"change directory")," to the project directory e.g. we cloned to the default name ",(0,o.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The ",(0,o.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME/fleek-network/lightning")," directory is the default or recommended location to store the repository. If you like to follow conventions, then is best to stick with the recommendation, to avoid confusion and make it easier to follow our documentation.")),(0,o.kt)("p",null,"If you list (",(0,o.kt)("inlineCode",{parentName:"p"},"ls"),") the files in the directory, it should be similar to:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},".\n\u251c\u2500\u2500 CODE_OF_CONDUCT.md\n\u251c\u2500\u2500 CONTRIBUTING.md\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 LICENSE\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 codecov.yml\n\u251c\u2500\u2500 core\n\u251c\u2500\u2500 docs\n\u251c\u2500\u2500 lib\n\u251c\u2500\u2500 lightning.toml\n\u251c\u2500\u2500 rust-toolchain\n\u251c\u2500\u2500 rustfmt.toml\n\u251c\u2500\u2500 services\n\u2514\u2500\u2500 target\n")),(0,o.kt)("p",null,"At this point, you should be able to run the ",(0,o.kt)("inlineCode",{parentName:"p"},"install")," command successfully."),(0,o.kt)("admonition",{type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"If you already had Rust installed, or the project before, and skipped instructions directly here, there might be case where you get errors. So, make sure to clear your work directory:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cargo clean\ncargo update\n")),(0,o.kt)("p",null,"Start the ",(0,o.kt)("inlineCode",{parentName:"p"},"install")," process by running the command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cargo +stable build --release\n")),(0,o.kt)("p",null,"The installation process is long, as it compiles the application binary for us from the source code."),(0,o.kt)("p",null,"\ud83c\udf08 Here's the output when successful! Note, that the output might differ slightly from time of writing."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"}," Finished release [optimized] target(s) in 11m 22s\n Installing /root/.cargo/bin/lightning\n Installed package `lightning v0.1.0 (/crates/lightning)` (executable `lightning`)\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Once Rust generates the binary ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning-node"),", you can find it in the project root ",(0,o.kt)("inlineCode",{parentName:"p"},"target")," directory. Depending on the usage of ",(0,o.kt)("inlineCode",{parentName:"p"},"+stable")," flag, the binary should be located at ",(0,o.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/target/debug/lightning-node")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/target/release/lightning-node"),".")),(0,o.kt)("p",null,"You can create an ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," symbolic link to ",(0,o.kt)("inlineCode",{parentName:"p"},"/usr/local/bin")," to make it available globally."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sudo ln -s "$HOME/fleek-network/lightning/target/release/lightning-node" /usr/local/bin/lgtn\n')),(0,o.kt)("p",null,"After completing, you'll have the ability to type ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," to execute the binary anywhere for your user account. Other users might find it better to copy or create an ",(0,o.kt)("inlineCode",{parentName:"p"},"alias")," instead."),(0,o.kt)("p",null,"Run the ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn help")," sub-command as a checkup:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"Usage: lightning-node [OPTIONS] \n\nCommands:\n run Start the node\n keys Handle keys\n print-config Print the loaded configuration\n help Print this message or the help of the given subcommand(s)\n\nOptions:\n -c, --config Path to the toml configuration file [default: lightning.toml]\n --with-mock-consensus Determines that we should be using the mock consensus backend\n -v... Increases the level of verbosity (the max level is -vvv)\n --log-location Print code location on console logs\n -h, --help Print help\n -V, --version Print version\n")),(0,o.kt)("admonition",{type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"Beware that your output might differ a bit, as ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"Lightning"),' is in constant development. Note that you\'ll have to "re-install" every time you want to pull updates from the source repository, as the update at the time of writing is done manually and not automatically.')),(0,o.kt)("h3",{id:"key-generator"},"Key generator"),(0,o.kt)("p",null,"Before starting the node, you should generate a public and private key."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn keys generate\n")),(0,o.kt)("p",null,"The keys will be generated and placed under the system directory ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/keystore"),". The ",(0,o.kt)("inlineCode",{parentName:"p"},"private")," key is the user's responsibility and no one else can generate or recover it for you, including Fleek Network or any team member. Your keys, your responsibility!"),(0,o.kt)("h3",{id:"set-user-path-in-configtoml"},"Set user path in config.toml"),(0,o.kt)(s.ZP,{mdxType:"SetUserPathInConfigToml"}),(0,o.kt)("h3",{id:"set-testnet-in-configtoml"},"Set testnet in config.toml"),(0,o.kt)("p",null,"Set the testnet attribute to ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," in the ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")," located in the path ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'[application]\ndb_path = "~/.lightning/data/app_data"\nmode = "Prod"\nstorage = "RocksDb"\ntestnet = true\n\n...\n')),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The configuration file should have more content, which was omitted here to keep it short and to the point. You're interested in the ",(0,o.kt)("inlineCode",{parentName:"p"},"testnet")," property name only.")),(0,o.kt)("h3",{id:"start-the-node"},"Start the node"),(0,o.kt)("admonition",{title:"Warning",type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"To participate in the ",(0,o.kt)("a",{parentName:"p",href:"/docs/roadmap"},"alpha Testnet"),", you have to through the onboarding process. Make sure you request access by following the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/testnet-onboarding"},"onboarding instructions"),". If you fail to enable your node for testnet, it'll not run!")),(0,o.kt)("p",null,"To start the node, you should execute the sub-command ",(0,o.kt)("inlineCode",{parentName:"p"},"run"),". Noteworthy that while it launches the node, you're recommended to set up a systemd service to run it for a long period."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn run\n")),(0,o.kt)("admonition",{title:"WARNING",type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"We recommend setting up the process as a systemd service, as it's a long-running process. Instructions to setup a systemd service are available in the section ",(0,o.kt)("a",{parentName:"p",href:"#systemd-service-setup"},"Systemd Service Setup"),".")),(0,o.kt)("p",null,"Great! You have successfully installed all the required packages, and libraries and have compiled and installed lightning. Check the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/health-check"},"Health Check")," to learn how to do a node health checkup."),(0,o.kt)("h3",{id:"systemd-service-setup"},"Systemd Service Setup"),(0,o.kt)("p",null,"Create a new Systemd service file:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo touch /etc/systemd/system/lightning.service\n")),(0,o.kt)("p",null,"Open the file and put the following content:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home/lgtn/.lightning/config.toml run\nExecStop=killall lgtn\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,o.kt)("admonition",{type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"Notice that we're using ",(0,o.kt)("inlineCode",{parentName:"p"},"lgnt")," as the username. If you have a different custom username change it accordingly. Beware that we've recommended using a ",(0,o.kt)("inlineCode",{parentName:"p"},"non-root")," user, as described in the section ",(0,o.kt)("a",{parentName:"p",href:"#create-a-user-1"},"create a user"),".")),(0,o.kt)(p.ZP,{mdxType:"NoteExecStartFlagCConfigPath"}),(0,o.kt)("p",null,"Change the file permissions for the service:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo chmod 644 /etc/systemd/system/lightning.service\n")),(0,o.kt)("p",null,"After creating the service file, you should reload the Systemd process, to apply the newly created service. You can do this by executing:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,o.kt)("p",null,"To start the service at boot, use the enable command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl enable lightning.service\n")),(0,o.kt)("p",null,"Create the directory where the log message will be stored, as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo mkdir -p /var/log/lightning\n")),(0,o.kt)("p",null,"You may want to create empty placeholders for the stdout and stderr log files:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo touch /var/log/lightning/output.log\nsudo touch /var/log/lightning/diagnostic.log\n")),(0,o.kt)("admonition",{title:"WARNING",type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"We're assuming that you've ",(0,o.kt)("a",{parentName:"p",href:"#create-a-user-1"},"created a new user")," and can start the service operating without ",(0,o.kt)("strong",{parentName:"p"},"sudo"),".")),(0,o.kt)("p",null,"Start the service by:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl start lightning.service\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Find the timeline of events for the Lightning service by checking the log files. Learn about it in the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/analyzing-logs"},"Log Messages"),".")),(0,o.kt)("p",null,"To learn more, visit the section ",(0,o.kt)("a",{parentName:"p",href:"#use-systemctl-to-manage-systemd-service"},"Use Systemctl to manage the Lightning Service")),(0,o.kt)("h2",{id:"docker-installation"},"Docker installation"),(0,o.kt)("p",null,"In this section we'll describe how to run a Fleek Network Lightning Node as a Docker Service. We're going to assume that you have Docker installed and running. If you need help to install Docker, check the guide ",(0,o.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/running-a-node-in-docker"},"running a node in docker"),"."),(0,o.kt)("p",null,"a) We can ",(0,o.kt)("a",{parentName:"p",href:"#quick-pull-and-run"},"easily pull and run")," the Lightning Docker image from our registry to run the Docker Container quickly."),(0,o.kt)("p",null,"b) ",(0,o.kt)("a",{parentName:"p",href:"#build-from-source"},"Build the Docker image")," from the repository source code"),(0,o.kt)("p",null,"Optionally, ",(0,o.kt)("a",{parentName:"p",href:"#docker-container-as-a-systemd-service"},"wrap the Docker Container as a Systemd Service"),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The Docker images are built for particular CPU architectures (x64) and as declared in the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements/#specs"},"requirements"),", we're mainly supporting ",(0,o.kt)("inlineCode",{parentName:"p"},"GenuineIntel"),", as there has been reports of failure to build and run the binary on AMD. If you're running on a ",(0,o.kt)("inlineCode",{parentName:"p"},"AuthenticAMD"),", provide us feedback on our ",(0,o.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"Discord"),".")),(0,o.kt)("h3",{id:"quick-pull-and-run"},"Quick pull and run"),(0,o.kt)("p",null,"You can pull an run the Lightning pre-built Docker image from our GitHub and run the Docker container quickly by executing the following command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run \\\n -p 4230:4230 \\\n -p 4200:4200 \\\n -p 6969:6969 \\\n -p 18000:18000 \\\n -p 18101:18101 \\\n -p 18102:18102 \\\n --mount type=bind,source=$HOME/.lightning,target=/root/.lightning \\\n --name lightning-node \\\n -it ghcr.io/fleek-network/lightning:latest\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The command has a list of ports ",(0,o.kt)("inlineCode",{parentName:"p"},"-p")," values that map ports in the container on the Docker host. While we try to keep the information across our documentation in sync with the latest changes or requirements e.g. port number changes, make sure that you check the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements#ports"},"ports")," to find the latest updates.")),(0,o.kt)("h3",{id:"build-from-source"},"Build from source"),(0,o.kt)("p",null,"Clone the repository located at ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"https://github.com/fleek-network/lightning"),"."),(0,o.kt)(r.ZP,{mdxType:"GitCloneOptions"}),(0,o.kt)("p",null,"Change directory to the project source code directory, e.g. the default ",(0,o.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,o.kt)("p",null,"Build the image named as ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning")," from our Dockerfile:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker build -t lightning -f ./Dockerfile .\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Take note of the Docker image name ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning"),", as that's the name we'll use and pass to the ",(0,o.kt)("inlineCode",{parentName:"p"},"Docker run")," to be successful. You can name it differently if that's your preference.")),(0,o.kt)("p",null,"Once the image is built, you can launch the Docker Container with a ",(0,o.kt)("inlineCode",{parentName:"p"},"--name")," such as ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning-node")," from the ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning")," image we just created by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run \\\n -p 4230:4230 \\\n -p 4200:4200 \\\n -p 6969:6969 \\\n -p 18000:18000 \\\n -p 18101:18101 \\\n -p 18102:18102 \\\n --mount type=bind,source=$HOME/.lightning,target=/root/.lightning \\\n --name lightning-node \\\n -it lightning\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The command has a list of ports ",(0,o.kt)("inlineCode",{parentName:"p"},"-p")," values that map ports in the container on the Docker host. While we try to keep the information across our documentation in sync with the latest changes or requirements e.g. port number changes, make sure that you check the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements#ports"},"ports")," to find the latest updates.")),(0,o.kt)("p",null,"If a ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning")," directory or ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/keystore")," doesn't exist, one is created for you on ",(0,o.kt)("inlineCode",{parentName:"p"},"docker run"),". You'll need to have the directory populated with the ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"keystore")," if you want to use a particular identity. Learn more about managing the keystore ",(0,o.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/managing-the-keystore"},"here"),"."),(0,o.kt)("h3",{id:"docker-container-as-a-systemd-service"},"Docker Container as a Systemd Service"),(0,o.kt)("p",null,"Create a unit configuration file:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo touch /etc/systemd/system/docker-lightning.service\n")),(0,o.kt)("p",null,"Open the ",(0,o.kt)("inlineCode",{parentName:"p"},"docker-lightning.service")," file in your favourite text editor and put the content:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\nAfter=docker.service\nRequires=docker.service\n\n[Service]\nRestart=always\nRestartSec=5\nTimeoutStartSec=0\nExecStartPre=-/usr/bin/docker kill lightning-node\nExecStartPre=-/usr/bin/docker rm lightning-node\nExecStartPre=/usr/bin/docker pull ghcr.io/fleek-network/lightning:latest\nExecStart=/usr/bin/docker run -p 4230:4230 -p 4200:4200 -p 6969:6969 -p 18000:18000 -p 18101:18101 -p 18102:18102 --mount type=bind,source=/home/skywalker/.lightning,target=/root/.lightning --name lightning-node ghcr.io/fleek-network/lightning:latest\nExecStop=/usr/bin/docker stop\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\n\n[Install]\nWantedBy=multi-user.target\n")),(0,o.kt)("p",null,"Change the file permissions by running the command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo chmod 644 /etc/systemd/system/docker-lightning.service\n")),(0,o.kt)("p",null,"Next, reload the Systemctl Daemon:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,o.kt)("p",null,"Enable the service on startup when the system boots:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl enable docker-lightning.service\n")),(0,o.kt)("p",null,"Learn how to manage the Systemd Service by reading the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/systemd-service"},"systemd service"),"."),(0,o.kt)(i.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}f.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1984],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(n),h=o,m=c["".concat(s,".").concat(h)]||c[h]||d[h]||i;return n?a.createElement(m,r(r({ref:t},u),{},{components:n})):a.createElement(m,r({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,r=new Array(i);r[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:o,r[1]=l;for(var p=2;p{n.d(t,{ZP:()=>l});var a=n(7462),o=(n(7294),n(3905));const i={toc:[]},r="wrapper";function l(e){let{components:t,...n}=e;return(0,o.kt)(r,(0,a.Z)({},i,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"We recommend creating a ",(0,o.kt)("inlineCode",{parentName:"p"},"non-root")," user with administrative privileges. It'll allow us to install any system requirements."),(0,o.kt)("p",null,"You can create a new user and add to the ",(0,o.kt)("strong",{parentName:"p"},"sudo")," group by running:"),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"For our example, we'll be using the name ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," but you can pick whichever you'd like. If you already have a ",(0,o.kt)("strong",{parentName:"p"},"sudoer")," account, you can skip this step.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo adduser lgtn\n")),(0,o.kt)("p",null,"After completing the ",(0,o.kt)("inlineCode",{parentName:"p"},"adduser")," steps, execute the ",(0,o.kt)("inlineCode",{parentName:"p"},"usermod")," to add the ",(0,o.kt)("inlineCode",{parentName:"p"},"user")," to the ",(0,o.kt)("strong",{parentName:"p"},"sudo")," group, as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo usermod -aG sudo lgtn\n")),(0,o.kt)("p",null,"Switch to the new ",(0,o.kt)("strong",{parentName:"p"},"user")," by using the command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"su lgtn\n")),(0,o.kt)("p",null,"Change the directory to the new user's home, as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cd /home/lgtn\n")))}l.isMDXComponent=!0},2915:(e,t,n)=>{n.d(t,{ZP:()=>l});var a=n(7462),o=(n(7294),n(3905));const i={toc:[]},r="wrapper";function l(e){let{components:t,...n}=e;return(0,o.kt)(r,(0,a.Z)({},i,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"You have several ways of doing this:"),(0,o.kt)("ul",{parentName:"admonition"},(0,o.kt)("li",{parentName:"ul"},"Clone via HTTPS"),(0,o.kt)("li",{parentName:"ul"},"Clone via SSH"),(0,o.kt)("li",{parentName:"ul"},"Download via Github CLI"),(0,o.kt)("li",{parentName:"ul"},"Download the ",(0,o.kt)("a",{parentName:"li",href:"https://github.com/fleek-network/lightning/archive/refs/heads/main.zip"},"zip package")," from the repository")),(0,o.kt)("p",{parentName:"admonition"},"We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this.\nAlthough, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it ",(0,o.kt)("a",{parentName:"p",href:"https://docs.github.com/en/authentication/connecting-to-github-with-ssh"},"here"),"."),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git \n")),(0,o.kt)("p",{parentName:"admonition"},"At time of writing, we are checking the branch name ",(0,o.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1")," that corresponds to the testnet phase.\nHere's an example of what it'd look like when sticking to the recommended path location:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning\n"))))}l.isMDXComponent=!0},3813:(e,t,n)=>{n.d(t,{ZP:()=>l});var a=n(7462),o=(n(7294),n(3905));const i={toc:[]},r="wrapper";function l(e){let{components:t,...n}=e;return(0,o.kt)(r,(0,a.Z)({},i,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The flag ",(0,o.kt)("inlineCode",{parentName:"p"},"-c")," in the ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning.service")," ",(0,o.kt)("strong",{parentName:"p"},"ExecStart"),", is to provide the toml configuration file path e.g. defaults to ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml"),". This is to avoid the path being determined dynamically (given path base ~ or $HOME), as users might control the systemctl service as a ",(0,o.kt)("strong",{parentName:"p"},"user")," or ",(0,o.kt)("strong",{parentName:"p"},"sudoer"),". For example, a ",(0,o.kt)("strong",{parentName:"p"},"sudoer")," would have the ",(0,o.kt)("strong",{parentName:"p"},"configuration")," set to ",(0,o.kt)("inlineCode",{parentName:"p"},"/root/.lightning/config.toml")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/username/.lightning/config.toml")," depending on using ",(0,o.kt)("strong",{parentName:"p"},"sudo")," which might cause some confusion to some users.")))}l.isMDXComponent=!0},2300:(e,t,n)=>{n.d(t,{ZP:()=>l});var a=n(7462),o=(n(7294),n(3905));const i={toc:[]},r="wrapper";function l(e){let{components:t,...n}=e;return(0,o.kt)(r,(0,a.Z)({},i,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"You should be following the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user-1"},"create a user")," recommendation. For our example, we have the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn"),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"If you have chosen a different username, replace ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," by the correct username you have selected.")),(0,o.kt)("p",null,"In the ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")," you'll find some and more of the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,o.kt)("p",null,"Find and replace all instances of ",(0,o.kt)("inlineCode",{parentName:"p"},"~")," in the config file ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/config.toml"),". Here's an example using ",(0,o.kt)("inlineCode",{parentName:"p"},"sed"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"\n')),(0,o.kt)("admonition",{type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"The ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")," example below is a shorter version of what you'll encounter, yours might look different. We do this to keep the guide simple to read. Do not copy and replace with the version demonstrated here.")),(0,o.kt)("p",null,"Once changed, all the instances of ",(0,o.kt)("inlineCode",{parentName:"p"},"~/")," should be replaced by your user path e.g. ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn/"),". For our example, the output would look like the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "/home/lgtn/.lightning/data/app_db"\n\n[consensus]\nstore_path = "/home/lgtn/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "/home/lgtn/.lightning/blockstore"\n\n[resolver]\nstore_path = "/home/lgtn/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"\nnode_key_path = "/home/lgtn/.lightning/keystore/node.pem"\n')))}l.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(7294);const o=e=>{let{image:t,name:n,title:o,url:i,communityMember:r=!1}=e;return a.createElement("section",{className:"author_card"},a.createElement("div",null,a.createElement("span",{className:"avatar"},a.createElement("a",{href:i,target:"_blank",alt:n},a.createElement("img",{src:t,alt:n}))),a.createElement("div",null,a.createElement("span",{className:"name"},a.createElement("a",{href:i,target:"_blank",alt:n},n)),a.createElement("span",{className:"title"},o),a.createElement("span",{className:"discord"},r?"Join our community on":"Got questions? Find us on"," ",a.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}},7183:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>h,contentTitle:()=>c,default:()=>f,frontMatter:()=>u,metadata:()=>d,toc:()=>m});var a=n(7462),o=(n(7294),n(3905)),i=n(3872),r=n(2915),l=n(6733),s=n(2300),p=n(3813);const u={title:"Install",hide_title:!0,slug:"install",date:new Date("2023-08-21T23:00:00.000Z"),canonical:"",description:"The Fleek Network Lightning CLI installation walkthrough",category:"Tutorial",tags:["CDN","Guide","Getting Started","Fleek Network","Rust dependencies","compile","build","wizard","manual"]},c=void 0,d={unversionedId:"node/install",id:"node/install",title:"Install",description:"The Fleek Network Lightning CLI installation walkthrough",source:"@site/docs/node/install.md",sourceDirName:"node",slug:"/node/install",permalink:"/docs/node/install",draft:!1,tags:[{label:"CDN",permalink:"/docs/tags/cdn"},{label:"Guide",permalink:"/docs/tags/guide"},{label:"Getting Started",permalink:"/docs/tags/getting-started"},{label:"Fleek Network",permalink:"/docs/tags/fleek-network"},{label:"Rust dependencies",permalink:"/docs/tags/rust-dependencies"},{label:"compile",permalink:"/docs/tags/compile"},{label:"build",permalink:"/docs/tags/build"},{label:"wizard",permalink:"/docs/tags/wizard"},{label:"manual",permalink:"/docs/tags/manual"}],version:"current",frontMatter:{title:"Install",hide_title:!0,slug:"install",date:"2023-08-21T23:00:00.000Z",canonical:"",description:"The Fleek Network Lightning CLI installation walkthrough",category:"Tutorial",tags:["CDN","Guide","Getting Started","Fleek Network","Rust dependencies","compile","build","wizard","manual"]},sidebar:"docs",previous:{title:"Testnet onboarding",permalink:"/docs/node/testnet-onboarding"},next:{title:"Health check",permalink:"/docs/node/health-check"}},h={},m=[{value:"Assisted installer",id:"assisted-installer",level:2},{value:"Prerequesites",id:"prerequesites",level:3},{value:"Connect to your server",id:"connect-to-your-server",level:3},{value:"Create a user",id:"create-a-user",level:3},{value:"Run the script for a quick install",id:"run-the-script-for-a-quick-install",level:3},{value:"About the process",id:"about-the-process",level:3},{value:"Manual installation",id:"manual-installation",level:2},{value:"Prerequisites",id:"prerequisites",level:3},{value:"Create a user",id:"create-a-user-1",level:3},{value:"Install Rust with Rustup tool",id:"install-rust-with-rustup-tool",level:3},{value:"Lightning installer rust dependencies",id:"lightning-installer-rust-dependencies",level:3},{value:"Linux dependencies",id:"linux-dependencies",level:3},{value:"Installing Lightning CLI",id:"installing-lightning-cli",level:3},{value:"Key generator",id:"key-generator",level:3},{value:"Set user path in config.toml",id:"set-user-path-in-configtoml",level:3},{value:"Set testnet in config.toml",id:"set-testnet-in-configtoml",level:3},{value:"Start the node",id:"start-the-node",level:3},{value:"Systemd Service Setup",id:"systemd-service-setup",level:3},{value:"Docker installation",id:"docker-installation",level:2},{value:"Quick pull and run",id:"quick-pull-and-run",level:3},{value:"Build from source",id:"build-from-source",level:3},{value:"Docker Container as a Systemd Service",id:"docker-container-as-a-systemd-service",level:3}],g={toc:m},k="wrapper";function f(e){let{components:t,...n}=e;return(0,o.kt)(k,(0,a.Z)({},g,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This section describes how to install the Fleek Network Lightning on supported operating systems. The installation can be made quicker by running the ",(0,o.kt)("a",{parentName:"p",href:"#assisted-installer"},"assisted installer")," or by following the ",(0,o.kt)("a",{parentName:"p",href:"#manual-installation"},"manual installation")," if you want a bit more control."),(0,o.kt)("admonition",{title:"Warning",type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"If you'd like to participate in the ",(0,o.kt)("a",{parentName:"p",href:"/docs/roadmap"},"alpha Testnet"),", you have to go through the onboarding process. Check the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements"},"requirements")," and find the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/testnet-onboarding"},"onboarding instructions")," to enable you to proceed and ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install"},"install")," a network node successfully.")),(0,o.kt)("h2",{id:"assisted-installer"},"Assisted installer"),(0,o.kt)("p",null,"The assisted installer is a script written in ",(0,o.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Bash_(Unix_shell)"},"Bash")," (Unix shell) that is available as a curl command line."),(0,o.kt)("h3",{id:"prerequesites"},"Prerequesites"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"A basic knowledge of command line interface (CLI)"),(0,o.kt)("li",{parentName:"ul"},"A ",(0,o.kt)("a",{parentName:"li",href:"/docs/node/requirements#server"},"supported")," Linux server")),(0,o.kt)("h3",{id:"connect-to-your-server"},"Connect to your server"),(0,o.kt)("p",null,"Connect to the Linux server where the Node's going to be installed via SSH by opening a shell session there."),(0,o.kt)("p",null,"If you have set up a public SSH key for the machine, connecting to the server should be as simple as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"ssh @\n")),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"Check the cloud provider for instructions to understand how to setup an ssh connection and connect to it remotely. Some other users might have local access to a ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"supported")," Linux server. To keep this guide short, we'll assume you've rented a VPS from a cloud provider.")),(0,o.kt)("h3",{id:"create-a-user"},"Create a user"),(0,o.kt)(l.ZP,{mdxType:"CreateAUser"}),(0,o.kt)("h3",{id:"run-the-script-for-a-quick-install"},"Run the script for a quick install"),(0,o.kt)("p",null,"Copy and paste it to the server host terminal and execute it to launch the assisted installation process, as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"curl https://get.fleek.network | bash\n")),(0,o.kt)("p",null,"On success, you should be greeted by the following welcome screen:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'\u2b50\ufe0f Fleek Network Lightning CLI installer \u2b50\ufe0f\n\n zeeeeee-\n z$$$$$$"\n d$$$$$$"\n d$$$$$P\n d$$$$$P\n $$$$$$"\n .$$$$$$"\n .$$$$$$"\n 4$$$$$$$$$$$$$"\n z$$$$$$$$$$$$$"\n """""""3$$$$$"\n z$$$$P\n d$$$$"\n .$$$$$"\n z$$$$$"\n z$$$$P\n d$$$$$$$$$$"\n *******$$$"\n .$$$"\n .$$"\n 4$P"\n z$"\n zP\n z"\n/\n\n\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605 \ud83c\udf0d Website https://fleek.network\n\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605 \ud83d\udcda Documentation https://docs.fleek.network\n\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605 \ud83d\udcbe Git repository https://github.com/fleek-network/lightning\n\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605 \ud83e\udd16 Discord https://discord.gg/fleekxyz\n\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605 \ud83d\udc24 Twitter https://twitter.com/fleek_net\n\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605\u2605 \ud83c\udfa8 Ascii art by https://www.asciiart.eu\n\n...\n\nRemaining output omitted for brevity, you\'ll not see this text line\n')),(0,o.kt)("p",null,"Follow the installation wizard to have the Fleek Network Lightning CLI and service installed on the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements"},"supported server"),"."),(0,o.kt)("p",null,"After creating the service file, you should reload the Systemd process, to apply the newly created service. You can do this by executing:"),(0,o.kt)("p",null,"After creating the service, launch the service by executing the following command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl start lightning.service\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To learn more about Systemctl commands, visit the section ",(0,o.kt)("a",{parentName:"p",href:"#use-systemctl-to-manage-systemd-service"},"Use Systemctl to manage the Lightning Service"))),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Find the timeline of events for the Lightning service by checking the log files. Learn about it in the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/analyzing-logs"},"Log Messages"),".")),(0,o.kt)("p",null,"Once the installation is complete, do a health check! Check the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/health-check"},"Health Check")," to learn how to do a node health checkup."),(0,o.kt)("h3",{id:"about-the-process"},"About the process"),(0,o.kt)("p",null,"The installation process is open source and transparent. The source is available in the ",(0,o.kt)("a",{parentName:"p",href:"https://get.fleek.network"},"get.fleek.network")," or the origin repository ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/get.fleek.network"},"here"),"."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},'"Get Fleek Network" is an attempt to make our software more accessible. By providing scripts to automate the installation process of our software, we believe that it can help improve the onboarding experience of our users.')),(0,o.kt)("p",null,"The installer assists the node operator by automating the Lightning CLI build from the open-source code and setting up the system service. A node operator should use the assisted installer to ease onboarding, reduce repetition,"),(0,o.kt)("p",null,"At a high level, the installer will:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Install required dependencies, e.g. rust toolchain"),(0,o.kt)("li",{parentName:"ul"},"Pull the source code from the origin ",(0,o.kt)("a",{parentName:"li",href:"https://github.com/fleek-network/lightning"},"repository")),(0,o.kt)("li",{parentName:"ul"},"Build the binary, e.g. a ",(0,o.kt)("inlineCode",{parentName:"li"},"lightning CLI")," (lgtn) is compiled from source code"),(0,o.kt)("li",{parentName:"ul"},"Setup a ",(0,o.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Systemd"},"Systemd")," service named lightning"),(0,o.kt)("li",{parentName:"ul"},"Provide instructions to launch, stop the Fleek network via the Systemd lightning service")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Remember that if you use the assisted installer, you won't have to do the ",(0,o.kt)("a",{parentName:"p",href:"#manual-installation"},"manual installation")," process as described in the next section. On success, the assisted installer should provide the same result as following the manual instructions.")),(0,o.kt)("h2",{id:"manual-installation"},"Manual installation"),(0,o.kt)("p",null,"The following section will walk through the dependencies and Rust installation process for Linux. If you're on Windows, we recommend to setup ",(0,o.kt)("a",{parentName:"p",href:"https://learn.microsoft.com/en-us/windows/wsl/install"},"Windows Subsystem Linux"),", reading the ",(0,o.kt)("a",{parentName:"p",href:"https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-10#1-overview"},"Ubuntu tutorial")," or picking another ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"supported distro"),". The WSL will let you use Linux applications, utilities and bash command tools you'll find in the tutorial."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"We're only supporting Linux operating system (server edition). Find the list of supported OS ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"here"),".")),(0,o.kt)("h3",{id:"prerequisites"},"Prerequisites"),(0,o.kt)("p",null,"To follow the guide, you will need the following:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Familiarity with the command-line interface"),(0,o.kt)("li",{parentName:"ul"},"Git")),(0,o.kt)("p",null,"You're required to have some experience with the command-line interface and have Git installed; Also, you should be happy to troubleshoot, since versions might differ from the time of writing and reading. Most times, a simple web search provides the best answers."),(0,o.kt)("p",null,"If you don't have Git installed, learn more about it and the instructions by reading the ",(0,o.kt)("a",{parentName:"p",href:"https://git-scm.com/book/en/v2"},"Git documentation"),"."),(0,o.kt)("h3",{id:"create-a-user-1"},"Create a user"),(0,o.kt)(l.ZP,{mdxType:"CreateAUser"}),(0,o.kt)("h3",{id:"install-rust-with-rustup-tool"},"Install Rust with Rustup tool"),(0,o.kt)("p",null,"Visit the ",(0,o.kt)("a",{parentName:"p",href:"https://www.rust-lang.org/"},"Rust website")," getting started guide, to find, copy and run the ",(0,o.kt)("a",{parentName:"p",href:"https://rustup.rs/"},"Rustup tool")," for installation and version management."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},(0,o.kt)("a",{parentName:"p",href:"https://curl.se/"},"curl")," is an application that is generally available in most OS, if missing install it. Find more ",(0,o.kt)("a",{parentName:"p",href:"https://curl.se/"},"here"),".")),(0,o.kt)("p",null,"Alternatively, if you have installed Rust in the past, you may want to update it \ud83d\udc4c."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"rustup update\n")),(0,o.kt)("p",null,"During the installation process, if asked about preferences, select the default option!"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"You can uninstall at any time with rustup self uninstall and\nthese changes will be reverted.\n\nCurrent installation options:\n\n\n default host triple: x86_64-unknown-linux-gnu\n default toolchain: stable (default)\n profile: default\n modify PATH variable: yes\n\n1) Proceed with installation (default)\n2) Customize installation\n3) Cancel installation\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Once complete, you'll have to restart your current shell or reload the \"PATH\" environment variable to include Cargo's bin directory ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME/.cargo/bin"),'. This is required to let you use "cargo" command globally.')),(0,o.kt)("p",null,"To configure your current shell, run:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'source "$HOME/.cargo/env"\n')),(0,o.kt)("p",null,"From then on, the latest version of Cargo (Rust's build and package manager tool) should be installed. Learn more about Cargo, ",(0,o.kt)("a",{parentName:"p",href:"https://doc.rust-lang.org/cargo/index.html"},"here"),"."),(0,o.kt)("p",null,"Check the ",(0,o.kt)("inlineCode",{parentName:"p"},"version")," to confirm's working correctly:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cargo --version\n")),(0,o.kt)("p",null,"Here's the output we got (beware that our version might differ to yours, it's expected \ud83d\ude05)."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cargo 1.65.0 (4bc8f24d3 2022-10-20)\n")),(0,o.kt)("h3",{id:"lightning-installer-rust-dependencies"},"Lightning installer rust dependencies"),(0,o.kt)("p",null,"Rustup subcommands deal with ",(0,o.kt)("a",{parentName:"p",href:"https://rust-lang.github.io/rustup/concepts/toolchains.html"},"toolchains"),", a collection of programs required to compile a Rust application."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"rustup toolchain list\n")),(0,o.kt)("p",null,"For example, on Linux Ubuntu we generally have it set to the default:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"stable-x86_64-unknown-linux-gnu (default)\n")),(0,o.kt)("p",null,"While on macOS:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"stable-x86_64-apple-darwin (default)\n")),(0,o.kt)("p",null,"Make sure you have Rustup set to the desired toolchain as default if required \ud83d\udc81\u200d\u2640\ufe0f!"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"rustup default \n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Rust compilation is long and compiler caching can help speed things up immensely. The Lightning CLI project can be used to reduce the perceived compilation times.")),(0,o.kt)("h3",{id:"linux-dependencies"},"Linux dependencies"),(0,o.kt)("p",null,"On Linux (we'll stick with Ubuntu as the Linux distro example), start by updating the package information in the source list and then upgrade all the installed packages with the latest versions (do the equivalent for your Linux distro), as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get update\nsudo apt-get upgrade\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"You can optionally pass the ",(0,o.kt)("inlineCode",{parentName:"p"},"y")," flag to skip any user prompts e.g. ",(0,o.kt)("inlineCode",{parentName:"p"},"sudo apt-get update -y")," to any remaining apt-get commands.")),(0,o.kt)("p",null,"Install the build-essentials packages, necessary for compiling general software and for our use-case Lightning CLI."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get install build-essential\n")),(0,o.kt)("p",null,"Followed by the required tools to compile the application (",(0,o.kt)("a",{parentName:"p",href:"https://cmake.org/"},"cmake"),", ",(0,o.kt)("a",{parentName:"p",href:"https://clang.llvm.org/"},"clang"),", ",(0,o.kt)("a",{parentName:"p",href:"https://www.freedesktop.org/wiki/Software/pkg-config/"},"pkg-config")," and ",(0,o.kt)("a",{parentName:"p",href:"https://packages.debian.org/sid/libssl-dev"},"libssl-dev "),")."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get install cmake clang pkg-config libssl-dev gcc-multilib\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"For Debian, you should install ",(0,o.kt)("inlineCode",{parentName:"p"},"gcc"),", as follows:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get update\nsudo apt-get install gcc\n"))),(0,o.kt)("p",null,"Now install the ",(0,o.kt)("a",{parentName:"p",href:"https://grpc.io/docs/protoc-installation/"},"Protobufer Compiler"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get install protobuf-compiler\n")),(0,o.kt)("p",null,"Ensure the compiler version is 3+"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"protoc --version\n")),(0,o.kt)("h3",{id:"installing-lightning-cli"},"Installing Lightning CLI"),(0,o.kt)("p",null,"If you haven't already, clone the Fleek Network's Lightning repository to your machine."),(0,o.kt)(r.ZP,{mdxType:"GitCloneOptions"}),(0,o.kt)("p",null,"When git clone completes \ud83d\udc4d, ",(0,o.kt)("inlineCode",{parentName:"p"},"change directory")," to the project directory e.g. we cloned to the default name ",(0,o.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The ",(0,o.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME/fleek-network/lightning")," directory is the default or recommended location to store the repository. If you like to follow conventions, then is best to stick with the recommendation, to avoid confusion and make it easier to follow our documentation.")),(0,o.kt)("p",null,"If you list (",(0,o.kt)("inlineCode",{parentName:"p"},"ls"),") the files in the directory, it should be similar to:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},".\n\u251c\u2500\u2500 CODE_OF_CONDUCT.md\n\u251c\u2500\u2500 CONTRIBUTING.md\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u251c\u2500\u2500 LICENSE\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 codecov.yml\n\u251c\u2500\u2500 core\n\u251c\u2500\u2500 docs\n\u251c\u2500\u2500 lib\n\u251c\u2500\u2500 lightning.toml\n\u251c\u2500\u2500 rust-toolchain\n\u251c\u2500\u2500 rustfmt.toml\n\u251c\u2500\u2500 services\n\u2514\u2500\u2500 target\n")),(0,o.kt)("p",null,"At this point, you should be able to run the ",(0,o.kt)("inlineCode",{parentName:"p"},"install")," command successfully."),(0,o.kt)("admonition",{type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"If you already had Rust installed, or the project before, and skipped instructions directly here, there might be case where you get errors. So, make sure to clear your work directory:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cargo clean\ncargo update\n")),(0,o.kt)("p",null,"Start the ",(0,o.kt)("inlineCode",{parentName:"p"},"install")," process by running the command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cargo +stable build --release\n")),(0,o.kt)("p",null,"The installation process is long, as it compiles the application binary for us from the source code."),(0,o.kt)("p",null,"\ud83c\udf08 Here's the output when successful! Note, that the output might differ slightly from time of writing."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"}," Finished release [optimized] target(s) in 11m 22s\n Installing /root/.cargo/bin/lightning\n Installed package `lightning v0.1.0 (/crates/lightning)` (executable `lightning`)\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Once Rust generates the binary ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning-node"),", you can find it in the project root ",(0,o.kt)("inlineCode",{parentName:"p"},"target")," directory. Depending on the usage of ",(0,o.kt)("inlineCode",{parentName:"p"},"+stable")," flag, the binary should be located at ",(0,o.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/target/debug/lightning-node")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/target/release/lightning-node"),".")),(0,o.kt)("p",null,"You can create an ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," symbolic link to ",(0,o.kt)("inlineCode",{parentName:"p"},"/usr/local/bin")," to make it available globally."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sudo ln -s "$HOME/fleek-network/lightning/target/release/lightning-node" /usr/local/bin/lgtn\n')),(0,o.kt)("p",null,"After completing, you'll have the ability to type ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," to execute the binary anywhere for your user account. Other users might find it better to copy or create an ",(0,o.kt)("inlineCode",{parentName:"p"},"alias")," instead."),(0,o.kt)("p",null,"Run the ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn help")," sub-command as a checkup:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"Usage: lightning-node [OPTIONS] \n\nCommands:\n run Start the node\n keys Handle keys\n print-config Print the loaded configuration\n help Print this message or the help of the given subcommand(s)\n\nOptions:\n -c, --config Path to the toml configuration file [default: lightning.toml]\n --with-mock-consensus Determines that we should be using the mock consensus backend\n -v... Increases the level of verbosity (the max level is -vvv)\n --log-location Print code location on console logs\n -h, --help Print help\n -V, --version Print version\n")),(0,o.kt)("admonition",{type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"Beware that your output might differ a bit, as ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"Lightning"),' is in constant development. Note that you\'ll have to "re-install" every time you want to pull updates from the source repository, as the update at the time of writing is done manually and not automatically.')),(0,o.kt)("h3",{id:"key-generator"},"Key generator"),(0,o.kt)("p",null,"Before starting the node, you should generate a public and private key."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn keys generate\n")),(0,o.kt)("p",null,"The keys will be generated and placed under the system directory ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/keystore"),". The ",(0,o.kt)("inlineCode",{parentName:"p"},"private")," key is the user's responsibility and no one else can generate or recover it for you, including Fleek Network or any team member. Your keys, your responsibility!"),(0,o.kt)("h3",{id:"set-user-path-in-configtoml"},"Set user path in config.toml"),(0,o.kt)(s.ZP,{mdxType:"SetUserPathInConfigToml"}),(0,o.kt)("h3",{id:"set-testnet-in-configtoml"},"Set testnet in config.toml"),(0,o.kt)("p",null,"Set the testnet attribute to ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," in the ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")," located in the path ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'[application]\ndb_path = "~/.lightning/data/app_data"\nmode = "Prod"\nstorage = "RocksDb"\ntestnet = true\n\n...\n')),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The configuration file should have more content, which was omitted here to keep it short and to the point. You're interested in the ",(0,o.kt)("inlineCode",{parentName:"p"},"testnet")," property name only.")),(0,o.kt)("h3",{id:"start-the-node"},"Start the node"),(0,o.kt)("admonition",{title:"Warning",type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"To participate in the ",(0,o.kt)("a",{parentName:"p",href:"/docs/roadmap"},"alpha Testnet"),", you have to through the onboarding process. Make sure you request access by following the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/testnet-onboarding"},"onboarding instructions"),". If you fail to enable your node for testnet, it'll not run!")),(0,o.kt)("p",null,"To start the node, you should execute the sub-command ",(0,o.kt)("inlineCode",{parentName:"p"},"run"),". Noteworthy that while it launches the node, you're recommended to set up a systemd service to run it for a long period."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn run\n")),(0,o.kt)("admonition",{title:"WARNING",type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"We recommend setting up the process as a systemd service, as it's a long-running process. Instructions to setup a systemd service are available in the section ",(0,o.kt)("a",{parentName:"p",href:"#systemd-service-setup"},"Systemd Service Setup"),".")),(0,o.kt)("p",null,"Great! You have successfully installed all the required packages, and libraries and have compiled and installed lightning. Check the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/health-check"},"Health Check")," to learn how to do a node health checkup."),(0,o.kt)("h3",{id:"systemd-service-setup"},"Systemd Service Setup"),(0,o.kt)("p",null,"Create a new Systemd service file:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo touch /etc/systemd/system/lightning.service\n")),(0,o.kt)("p",null,"Open the file and put the following content:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home/lgtn/.lightning/config.toml run\nExecStop=killall lgtn\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,o.kt)("admonition",{type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"Notice that we're using ",(0,o.kt)("inlineCode",{parentName:"p"},"lgnt")," as the username. If you have a different custom username change it accordingly. Beware that we've recommended using a ",(0,o.kt)("inlineCode",{parentName:"p"},"non-root")," user, as described in the section ",(0,o.kt)("a",{parentName:"p",href:"#create-a-user-1"},"create a user"),".")),(0,o.kt)(p.ZP,{mdxType:"NoteExecStartFlagCConfigPath"}),(0,o.kt)("p",null,"Change the file permissions for the service:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo chmod 644 /etc/systemd/system/lightning.service\n")),(0,o.kt)("p",null,"After creating the service file, you should reload the Systemd process, to apply the newly created service. You can do this by executing:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,o.kt)("p",null,"To start the service at boot, use the enable command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl enable lightning.service\n")),(0,o.kt)("p",null,"Create the directory where the log message will be stored, as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo mkdir -p /var/log/lightning\n")),(0,o.kt)("p",null,"You may want to create empty placeholders for the stdout and stderr log files:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo touch /var/log/lightning/output.log\nsudo touch /var/log/lightning/diagnostic.log\n")),(0,o.kt)("admonition",{title:"WARNING",type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"We're assuming that you've ",(0,o.kt)("a",{parentName:"p",href:"#create-a-user-1"},"created a new user")," and can start the service operating without ",(0,o.kt)("strong",{parentName:"p"},"sudo"),".")),(0,o.kt)("p",null,"Start the service by:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl start lightning.service\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Find the timeline of events for the Lightning service by checking the log files. Learn about it in the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/analyzing-logs"},"Log Messages"),".")),(0,o.kt)("p",null,"To learn more, visit the section ",(0,o.kt)("a",{parentName:"p",href:"#use-systemctl-to-manage-systemd-service"},"Use Systemctl to manage the Lightning Service")),(0,o.kt)("h2",{id:"docker-installation"},"Docker installation"),(0,o.kt)("p",null,"In this section we'll describe how to run a Fleek Network Lightning Node as a Docker Service. We're going to assume that you have Docker installed and running. If you need help to install Docker, check the guide ",(0,o.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/running-a-node-in-docker"},"running a node in docker"),"."),(0,o.kt)("p",null,"a) We can ",(0,o.kt)("a",{parentName:"p",href:"#quick-pull-and-run"},"easily pull and run")," the Lightning Docker image from our registry to run the Docker Container quickly."),(0,o.kt)("p",null,"b) ",(0,o.kt)("a",{parentName:"p",href:"#build-from-source"},"Build the Docker image")," from the repository source code"),(0,o.kt)("p",null,"Optionally, ",(0,o.kt)("a",{parentName:"p",href:"#docker-container-as-a-systemd-service"},"wrap the Docker Container as a Systemd Service"),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The Docker images are built for particular CPU architectures (x64) and as declared in the ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements/#specs"},"requirements"),", we're mainly supporting ",(0,o.kt)("inlineCode",{parentName:"p"},"GenuineIntel"),", as there has been reports of failure to build and run the binary on AMD. If you're running on a ",(0,o.kt)("inlineCode",{parentName:"p"},"AuthenticAMD"),", provide us feedback on our ",(0,o.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"Discord"),".")),(0,o.kt)("h3",{id:"quick-pull-and-run"},"Quick pull and run"),(0,o.kt)("p",null,"You can pull an run the Lightning pre-built Docker image from our GitHub and run the Docker container quickly by executing the following command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run \\\n -p 4200-4299:4200-4299 \\\n -p 4300-4399:4300-4399 \\\n --mount type=bind,source=$HOME/.lightning,target=/root/.lightning \\\n --name lightning-node \\\n -it ghcr.io/fleek-network/lightning:latest\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The command has a list of ports ",(0,o.kt)("inlineCode",{parentName:"p"},"-p")," values that map ports in the container on the Docker host. While we try to keep the information across our documentation in sync with the latest changes or requirements e.g. port number changes, make sure that you check the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements#ports"},"ports")," to find the latest updates.")),(0,o.kt)("h3",{id:"build-from-source"},"Build from source"),(0,o.kt)("p",null,"Clone the repository located at ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"https://github.com/fleek-network/lightning"),"."),(0,o.kt)(r.ZP,{mdxType:"GitCloneOptions"}),(0,o.kt)("p",null,"Change directory to the project source code directory, e.g. the default ",(0,o.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,o.kt)("p",null,"Build the image named as ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning")," from our Dockerfile:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker build -t lightning -f ./Dockerfile .\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Take note of the Docker image name ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning"),", as that's the name we'll use and pass to the ",(0,o.kt)("inlineCode",{parentName:"p"},"Docker run")," to be successful. You can name it differently if that's your preference.")),(0,o.kt)("p",null,"Once the image is built, you can launch the Docker Container with a ",(0,o.kt)("inlineCode",{parentName:"p"},"--name")," such as ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning-node")," from the ",(0,o.kt)("inlineCode",{parentName:"p"},"lightning")," image we just created by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run \\\n -p 4200-4299:4200-4299 \\\n -p 4300-4399:4300-4399 \\\n --mount type=bind,source=$HOME/.lightning,target=/root/.lightning \\\n --name lightning-node \\\n -it lightning\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The command has a list of ports ",(0,o.kt)("inlineCode",{parentName:"p"},"-p")," values that map ports in the container on the Docker host. While we try to keep the information across our documentation in sync with the latest changes or requirements e.g. port number changes, make sure that you check the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/requirements#ports"},"ports")," to find the latest updates.")),(0,o.kt)("p",null,"If a ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning")," directory or ",(0,o.kt)("inlineCode",{parentName:"p"},"~/.lightning/keystore")," doesn't exist, one is created for you on ",(0,o.kt)("inlineCode",{parentName:"p"},"docker run"),". You'll need to have the directory populated with the ",(0,o.kt)("inlineCode",{parentName:"p"},"config.toml")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"keystore")," if you want to use a particular identity. Learn more about managing the keystore ",(0,o.kt)("a",{parentName:"p",href:"/guides/Node%20Operators/managing-the-keystore"},"here"),"."),(0,o.kt)("h3",{id:"docker-container-as-a-systemd-service"},"Docker Container as a Systemd Service"),(0,o.kt)("p",null,"Create a unit configuration file:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo touch /etc/systemd/system/docker-lightning.service\n")),(0,o.kt)("p",null,"Open the ",(0,o.kt)("inlineCode",{parentName:"p"},"docker-lightning.service")," file in your favourite text editor and put the content:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\nAfter=docker.service\nRequires=docker.service\n\n[Service]\nRestart=always\nRestartSec=5\nTimeoutStartSec=0\nExecStartPre=-/usr/bin/docker kill lightning-node\nExecStartPre=-/usr/bin/docker rm lightning-node\nExecStartPre=/usr/bin/docker pull ghcr.io/fleek-network/lightning:latest\nExecStart=/usr/bin/docker run -p 4200-4299:4200-4299 -p 4300-4399:4300-4399 --mount type=bind,source=/home/skywalker/.lightning,target=/root/.lightning --name lightning-node ghcr.io/fleek-network/lightning:latest\nExecStop=/usr/bin/docker stop\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\n\n[Install]\nWantedBy=multi-user.target\n")),(0,o.kt)("p",null,"Change the file permissions by running the command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo chmod 644 /etc/systemd/system/docker-lightning.service\n")),(0,o.kt)("p",null,"Next, reload the Systemctl Daemon:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,o.kt)("p",null,"Enable the service on startup when the system boots:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl enable docker-lightning.service\n")),(0,o.kt)("p",null,"Learn how to manage the Systemd Service by reading the section ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/systemd-service"},"systemd service"),"."),(0,o.kt)(i.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5437f376.426b68ec.js b/assets/js/5437f376.7410f8c6.js similarity index 99% rename from assets/js/5437f376.426b68ec.js rename to assets/js/5437f376.7410f8c6.js index e9183c6b0..56401634c 100644 --- a/assets/js/5437f376.426b68ec.js +++ b/assets/js/5437f376.7410f8c6.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[909],{3905:(e,t,n)=>{n.d(t,{Zo:()=>h,kt:()=>m});var i=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},h=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},c=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,h=s(e,["components","mdxType","originalType","parentName"]),d=p(n),c=a,m=d["".concat(l,".").concat(c)]||d[c]||u[c]||o;return n?i.createElement(m,r(r({ref:t},h),{},{components:n})):i.createElement(m,r({ref:t},h))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=c;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[d]="string"==typeof e?e:a,r[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>c,frontMatter:()=>r,metadata:()=>l,toc:()=>h});var i=n(7462),a=(n(7294),n(3905)),o=n(3872);const r={title:"Managing the keystore",hide_title:!0,slug:"managing-the-keystore",date:new Date("2023-11-14T12:00:00.000Z"),image:"./assets/managing-the-keystore.png?202311181211",description:"The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you\u2019re migrating to",category:"Tutorial",tags:["guide","keystore","public keys","private keys","keys"]},s=void 0,l={unversionedId:"Node Operators/managing-the-keystore",id:"Node Operators/managing-the-keystore",title:"Managing the keystore",description:"The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you\u2019re migrating to",source:"@site/guides/Node Operators/managing-the-keystore.md",sourceDirName:"Node Operators",slug:"/Node Operators/managing-the-keystore",permalink:"/guides/Node Operators/managing-the-keystore",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/guides/Node Operators/managing-the-keystore.md",tags:[{label:"guide",permalink:"/guides/tags/guide"},{label:"keystore",permalink:"/guides/tags/keystore"},{label:"public keys",permalink:"/guides/tags/public-keys"},{label:"private keys",permalink:"/guides/tags/private-keys"},{label:"keys",permalink:"/guides/tags/keys"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Managing the keystore",hide_title:!0,slug:"managing-the-keystore",date:"2023-11-14T12:00:00.000Z",image:"./assets/managing-the-keystore.png?202311181211",description:"The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you\u2019re migrating to",category:"Tutorial",tags:["guide","keystore","public keys","private keys","keys"]},sidebar:"defaultSidebar",previous:{title:"Getting Started",permalink:"/guides/Node Operators/getting-started"},next:{title:"Running a node in Docker",permalink:"/guides/Node Operators/running-a-node-in-docker"}},p={image:n(4350).Z},h=[{value:"Introduction",id:"introduction",level:2},{value:"Pre-requisites",id:"pre-requisites",level:2},{value:"Configuration file",id:"configuration-file",level:2},{value:"Locating the file",id:"locating-the-file",level:3},{value:"Configuration sections",id:"configuration-sections",level:3},{value:"Type of keys",id:"type-of-keys",level:3},{value:"Key privacy",id:"key-privacy",level:3},{value:"Identity selection",id:"identity-selection",level:3},{value:"Backing up the keystore",id:"backing-up-the-keystore",level:2},{value:"Lower security",id:"lower-security",level:3},{value:"Higher security",id:"higher-security",level:3},{value:"Storage",id:"storage",level:3},{value:"Loading keys on runtime",id:"loading-keys-on-runtime",level:2},{value:"Conclusion",id:"conclusion",level:2}],d={toc:h},u="wrapper";function c(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,i.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"Managing the keystore",src:n(4350).Z,width:"1450",height:"816"})),(0,a.kt)("h2",{id:"introduction"},"Introduction"),(0,a.kt)("p",null,"Fleek Network incentivizes participation by rewarding its node providers. A node is identifiable by an identity, which the reward mechanism uses to identify the node to reward it."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"At time of writing the rewards mechanism hasn't yet been introduced, read the ",(0,a.kt)("a",{parentName:"p",href:"https://blog.fleek.network/post/fleek-network-testnet-plans"},"testnet plans")," to get a high level perspective over the plans. A token and economics paper should be released in the future.")),(0,a.kt)("p",null,"We'll use the term identity to describe the key store declared in the configuration, in our case ",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail"},"PEM")," files. The content of the PEM files and the file itself should be kept secret."),(0,a.kt)("p",null,"The key store is in the file system and the location is defined in the Fleek Network ",(0,a.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml"),", as a private key stored in an identity named PEM file (by default ",(0,a.kt)("inlineCode",{parentName:"p"},"consensus.pem")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"node.pem"),"). It's essential to understand this, as you may want to copy the identity to a new server setup, to persist the identity accross to the new server setup."),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"Security is achieved by issuing users private cryptographic keys. Only the holder of the private key has access to sensitive information, such as an identity, which relates to reputation, rewards, etc. The security of the private key is the responsibility of the user. Unfortunately, Fleek Network is unable to help you regain access to your private key if you've lost or failed to secure it. The private keys are your responsibility.")),(0,a.kt)("p",null,"The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"supported system")," you're migrating to."),(0,a.kt)("h2",{id:"pre-requisites"},"Pre-requisites"),(0,a.kt)("p",null,"To follow the guide, you will need the following:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Familiarity with the command-line interface"),(0,a.kt)("li",{parentName:"ul"},"A basic understanding of ",(0,a.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Public-key_cryptography"},"how public key cryptography works"))),(0,a.kt)("h2",{id:"configuration-file"},"Configuration file"),(0,a.kt)("h3",{id:"locating-the-file"},"Locating the file"),(0,a.kt)("p",null,"The Lightning CLI has a configuration file in the home directory of the user, which by default is located in the path ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"~/.lightning")," under the name ",(0,a.kt)("inlineCode",{parentName:"p"},"config.toml"),". It's generally described as ",(0,a.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"The tilde in ",(0,a.kt)("inlineCode",{parentName:"p"},"~/.lightning")," represents ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME")," which is simpler, but we'll use ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME")," to make it easy to follow.")),(0,a.kt)("p",null,"If you're following the install recommendations you should be logged in with a ",(0,a.kt)("strong",{parentName:"p"},"sudoer")," account. For our guide, let's imagine that the ",(0,a.kt)("strong",{parentName:"p"},"sudoer")," username we are logged in with is ",(0,a.kt)("strong",{parentName:"p"},"lgtn"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"The word ",(0,a.kt)("strong",{parentName:"p"},"sudo"),' is the abbreviation of the term "super user do". As the name suggests, it is the privilege that a super user, such as an administrator has to do whatever it wants in the system. A super user can be an administrator, like the ',(0,a.kt)("strong",{parentName:"p"},"root")," or what we described here as a user in the group ",(0,a.kt)("strong",{parentName:"p"},"sudo")," aka ",(0,a.kt)("strong",{parentName:"p"},"sudoer"),".")),(0,a.kt)("p",null,"If you are logged in with a username, that'd be:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"/home//.lightning/config.toml\n")),(0,a.kt)("p",null,"For our example for user ",(0,a.kt)("inlineCode",{parentName:"p"},"lgtn")," that is:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"/home/lgtn/.lightning/config.toml\n")),(0,a.kt)("p",null,"If you log in with another user, let's say ",(0,a.kt)("inlineCode",{parentName:"p"},"fleek")," it'd be:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"/home/fleek/.lightning/config.toml\n")),(0,a.kt)("p",null,"At any time, you can check which user you are logged in with by running the command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"whoami\n")),(0,a.kt)("p",null,"Here's an example of our user ",(0,a.kt)("inlineCode",{parentName:"p"},"lgtn"),", which for the command above outputs:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"To switch to a particular user, you can run the command ",(0,a.kt)("inlineCode",{parentName:"p"},"su ")," e.g. for the user ",(0,a.kt)("strong",{parentName:"p"},"lgtn")," we would execute the command ",(0,a.kt)("inlineCode",{parentName:"p"},"su lgtn"),".")),(0,a.kt)("p",null,"Now that you know where to locate the configuration file for any given user you are logged in with, learn about the ",(0,a.kt)("a",{parentName:"p",href:"#configuration-sections"},"Configuration sections"),"."),(0,a.kt)("h3",{id:"configuration-sections"},"Configuration sections"),(0,a.kt)("p",null,"The Fleek Network node configuration settings are located in the path ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml"),", and it's organized by configuration sections."),(0,a.kt)("p",null,"At the time of writing, we have a TOML file with sections. Here are some examples amongst others:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"application"),(0,a.kt)("li",{parentName:"ul"},"origin-ipfs"),(0,a.kt)("li",{parentName:"ul"},"rpc"),(0,a.kt)("li",{parentName:"ul"},"signer")),(0,a.kt)("p",null,"Each of the sections holds several property names and values. If you are accustomed to the ",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/JSON"},"JSON")," or ",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/YAML"},"YAML")," formats, you'll find the TOML format a bit similar (if you'd like to learn more about the TOML file format, read about it ",(0,a.kt)("a",{parentName:"p",href:"https://toml.io/en/"},"here"),")."),(0,a.kt)("p",null,"By default, and at time of writing the Lightning CLI configuration file (config.toml) is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'[BLANK]\n\n[application]\ndb_path = "/home/lgtn/.lightning/data/app_db"\nmode = "Prod"\nstorage = "RocksDb"\ntestnet = true\n\n[blockserver]\naddress = "0.0.0.0:4211"\n\n[broadcast]\naddress = "0.0.0.0:4200"\n\n[consensus]\nstore_path = "/home/lgtn/.lightning/data/narwhal_store"\n\n[dht]\naddress = "0.0.0.0:8101"\nbootstrappers = []\n\n[fetcher]\n\n[fsstore]\nroot = "/home/lgtn/.lightning/blockstore"\n\n[[handshake.transport]]\nsignal_address = "0.0.0.0:4210"\ntype = "WebRTC"\n\n[[handshake.worker]]\ntype = "AsyncWorker"\n\n[[handshake.worker]]\ntype = "AsyncWorker"\n\n[[handshake.worker]]\ntype = "AsyncWorker"\n\n[[handshake.worker]]\ntype = "AsyncWorker"\n\n[[origin-ipfs.gateways]]\nauthority = "ipfs.io"\nprotocol = "Https"\n\n[[origin-ipfs.gateways]]\nauthority = "fleek.ipfs.io"\nprotocol = "Https"\n\n[[origin-ipfs.gateways]]\nauthority = "ipfs.runfission.com"\nprotocol = "Https"\n\n[rep-collector]\nreporter_buffer_size = 5\n\n[resolver]\nstore_path = "/home/lgtn/.lightning/data/resolver_store"\n\n[rpc]\naddr = "0.0.0.0"\nport = 4230\n\n[service-executor]\nservices = [0, 1]\n\n[signer]\nconsensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"\nnode_key_path = "/home/lgtn/.lightning/keystore/node.pem"\n\n[topology]\ntesting_min_nodes = 9\ntesting_target_k = 8\n')),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"Beware that the configuration file might look a bit different depending on the version you're running and the current development features in place by the Fleek Network core team. You shouldn't copy the example above and replace with yours, as this only servers for illustrative purposes.")),(0,a.kt)("p",null,"Some advanced use cases might require dealing with the host and port number binding, depending on the service provider's needs and customization. We'll keep things simple and assume the default settings."),(0,a.kt)("p",null,"In this guide, we are interested in the ",(0,a.kt)("inlineCode",{parentName:"p"},"[signer]")," section settings for the ",(0,a.kt)("inlineCode",{parentName:"p"},"consensus_key_path")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"node_key_path")," which by default is set to ",(0,a.kt)("inlineCode",{parentName:"p"},"~/.lightning/keystore"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"The identity is a text description for the Keystore and at the time of writing we have not yet implemented multiple identity management via the CLI. Thereupon, the identity value serves to find the filename match in the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore_path"),". This might change as we progress with development. Check the ",(0,a.kt)("a",{parentName:"p",href:"#identity-selection"},"Identity selection")," to learn more about it!")),(0,a.kt)("h3",{id:"type-of-keys"},"Type of keys"),(0,a.kt)("p",null,"There are three types of keys related to the identity of a node and the account ownership. The keys are based in public-key cryptography, or asymmetric cryptography where each key pair consists of a public key and a corresponding private key. The keys are described in the section ",(0,a.kt)("a",{parentName:"p",href:"/docs/learn/the-network/#identity-on-the-fleek-network"},"identity on the Fleek Network")," as follows:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"A Node key (ConsensusPublicKey) is ",(0,a.kt)("a",{parentName:"p",href:"https://electriccoin.co/blog/new-snark-curve/"},"BLS12-381")," which facilitates the consensus algorithm or persistence of state, resilience and fault tolerance. Has multi-signature support, the ability to aggregate many signatures into one used for consensus committee when signing certificates")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"A Node Networking key (NodePublicKey) is ",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/EdDSA"},"Ed25519")," used for the speed and performance of the network communications")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"Account Owner keys are based on ",(0,a.kt)("a",{parentName:"p",href:"https://www.secg.org/sec2-v2.pdf"},"secp256k1"),", which corresponds to an Ethereum Address"))),(0,a.kt)("p",null,"For instance, a public key is open to anybody to see, and it represents a unique node identifier in the Fleek Network, a bit like a passport number. On the other hand, the private key is secret, and the operator is responsible to store it privately."),(0,a.kt)("p",null,"The Fleek Network relies on cryptography, thus the Fleek Network team and anybody can access, compromise or manipulate the secrets of an identity. On the other hand, the public key can be used by anyone, Fleek Network included, to identify a node or send rewards to the address without jeopardizing identity security."),(0,a.kt)("p",null,"To learn more about the identities on the Fleek Network ",(0,a.kt)("a",{parentName:"p",href:"/docs/learn/the-network/#identity-on-the-fleek-network"},"here"),"."),(0,a.kt)("h3",{id:"key-privacy"},"Key privacy"),(0,a.kt)("p",null,"If you don\u2019t keep your private keys secret, you'll have your node compromised."),(0,a.kt)("p",null,"Here are a few examples of what you should not do:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Share the ",(0,a.kt)("inlineCode",{parentName:"li"},"$HOME/.lightning/keystore")," directory file content publicly"),(0,a.kt)("li",{parentName:"ul"},"Track the ",(0,a.kt)("inlineCode",{parentName:"li"},"$HOME/.lightning/keystore")," directory files in a version control repository e.g. git"),(0,a.kt)("li",{parentName:"ul"},'Have poor "rights" permissions in UNIX systems e.g. everyone can read, delete, modify ',(0,a.kt)("inlineCode",{parentName:"li"},"$HOME/.lightning")),(0,a.kt)("li",{parentName:"ul"},"Allow anyone to access the node provider physically without any access control to the operating and file systems e.g. a VPS provider"),(0,a.kt)("li",{parentName:"ul"},"Get rid of a hard drive unformatted or blind erased by selling to somebody or dumping in the bin, which contains ",(0,a.kt)("inlineCode",{parentName:"li"},"$HOME/.lightning/keystore"))),(0,a.kt)("p",null,"There are many other ways of getting compromised, but hopefully, the ones put above give you a good starter into the subject."),(0,a.kt)("p",null,"Remember, the node provider is the only one responsible when managing the key store. Neither Fleek Network nor the most sophisticated AI system presently can compromise the cryptography in use to help you out. You are fully responsible for securing and retaining your private keys."),(0,a.kt)("h3",{id:"identity-selection"},"Identity selection"),(0,a.kt)("p",null,"Multiple identity management is yet to be implemented but in any case, some users might find it trivial to keep multiple identities and switch between them referencing them by name. The following section is not advocating this approach but sharing some approaches that can help certain use-cases."),(0,a.kt)("p",null,"Let's suppose that we've recently moved to a new server setup and copied our previous server keystore keys as ",(0,a.kt)("inlineCode",{parentName:"p"},"consensus.pem")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"node.pem")," and renamed the ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore/*.pem")," to ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore/new-*.pem"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"We are using a wildcard ",(0,a.kt)("inlineCode",{parentName:"p"},"*")," to reduce verbosity. The wildcard means as replacement for all the filenames encountered in the path and extension without having to name them individually as we know they are ",(0,a.kt)("inlineCode",{parentName:"p"},"consensus.pem")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"node.pem"),".")),(0,a.kt)("p",null,"To illustrate this scenario, here's an example of how our ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore")," directory could look like:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},".\n\u251c\u2500\u2500 new-consensus.pem\n\u251c\u2500\u2500 new-node.pem\n\u2514\u2500\u2500 old-consensus.pem\n\u2514\u2500\u2500 old-node.pem\n\n0 directories, 4 file\n")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"old-*.pem")," files are the original key store and ",(0,a.kt)("inlineCode",{parentName:"p"},"new-*.pem")," could correspond to the new identity created while setting up the node in the new server."),(0,a.kt)("p",null,"Since we have ",(0,a.kt)("inlineCode",{parentName:"p"},"[signer]")," set to the default values, in particular:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[signer]\nconsensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"\nnode_key_path = "/home/lgtn/.lightning/keystore/node.pem"\n')),(0,a.kt)("p",null,"We'd be required to change and switch to the preferred keys. The identity is switch to the provided values once the node is restarted. Thus, we can switch to any identity by changing the ",(0,a.kt)("inlineCode",{parentName:"p"},"[signer]")," ",(0,a.kt)("inlineCode",{parentName:"p"},"consensus_key_path")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"node_key_path")," pathname values anytime as long we restart the server successfully."),(0,a.kt)("p",null,"To verify which keys are loaded by the Lightning CLI run the command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn keys show\n")),(0,a.kt)("p",null,"You'd find the public keys in the output, which can be used for comparision and should be different everytime the configuration changes and reloaded. Here's an example of the output:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"Node Public Key: RwPpr35H5AAfWwSDFxwYuJv5TA8PWUd2pdBg+UKsORc=\nConsensus Public Key: s36g09qQzaaOJxi0UZDRCXj3HUUWjaGiYrQV6Ylo9Ih6jMvrnxM5s1OpBnsEj5R1AVYcuxlnVR+oyEjgJ3WpI5LOHSN1Q6Zur33vka3IachBEIKIbsiXMJW16vu4n4bG\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"The PEM files can be named as you wish, but by default we like to keep it sound to avoid confusion and make it as clear as possible.")),(0,a.kt)("h2",{id:"backing-up-the-keystore"},"Backing up the keystore"),(0,a.kt)("p",null,"When dealing with Fleek Network it's crucial to always be aware of the identity. You should backup private keys in case the unexpected happens, as it's impossible to recover the identity in any other way, including the core team, any other person or system."),(0,a.kt)("p",null,"Backing up your keystore pem files are crucial to ensure the safety and accessibility of your identity on the Fleek Network. For example, if your ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning")," is deleted you'll still be able to restore it if you have backed it up properly."),(0,a.kt)("p",null,"There are many ways to make identity backups, each with its own benefits and drawbacks. At risk of oversimplifying, we'll focus on a simple manual approach to expose some principles you should have awareness."),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"The security is never stronger than its weakest link, and it is very likely that the weakest link is not the method itself. It's pointless to encrypt the backup archive with sophisticated methods when the passphrase is weak or of an easy guess.")),(0,a.kt)("p",null,"None of the methods described here are being endorsed by the Fleek Network team use the knowledge provided here for educational purposes only and at your own risk."),(0,a.kt)("h3",{id:"lower-security"},"Lower security"),(0,a.kt)("p",null,"If you opt for the lowest level of security, you can use zip and unzip. The man page of zip described the encryption algorithm used to be weaker than PGP."),(0,a.kt)("p",null,"To zip and encrypto the ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore")," directory run:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"# It'll prompt for password (remember)\nzip --encrypt -r keystore.zip.enc $HOME/.lightning/keystore\n")),(0,a.kt)("p",null,"To unzip and decrypt the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.zip.enc"),", you'd run:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"# It'll prompt for password (recall)\nunzip keystore.zip.enc -d $HOME/.lightning/keystore\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"We provide the unzip destiny target to the flag ",(0,a.kt)("inlineCode",{parentName:"p"},"-d"),". The unzip process outputs the files onto the desired location ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore"),", thus overriding any contents. If you have any files in the destiny target directory it'll be overriden, effectively replacing with the output of the unzipped directory content, so make sure you backup any files as required.")),(0,a.kt)("h3",{id:"higher-security"},"Higher security"),(0,a.kt)("p",null,"Create a ",(0,a.kt)("inlineCode",{parentName:"p"},"Tar")," archive, which will contain the target directory, files and the Tar stores all of the relative paths in the tarball itself."),(0,a.kt)("p",null,"Create a ",(0,a.kt)("inlineCode",{parentName:"p"},"tarbar")," by executing:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'tar -cf "keystore.tar" $HOME/.lightning/keystore\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.tar")," should be in the current work directory."),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"gpg")," with the ",(0,a.kt)("a",{parentName:"p",href:"https://www.gnupg.org/gph/en/manual/x110.html"},"symmetric option"),", it creates the keys for that file and request a password to protect them. If you are familiar with asymmetric ",(0,a.kt)("inlineCode",{parentName:"p"},"gpg"),", it's similar, but it's not signed with your public key or such."),(0,a.kt)("p",null,"The encryption command is:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo gpg -a --symmetric --cipher-algo AES256 keystore.tar\n")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.tar.asc")," should be in the current work directory."),(0,a.kt)("p",null,"To decrypt the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.tar.asc")," file, enter:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo gpg -a --output keystore.tar --decrypt keystore.tar.asc\n")),(0,a.kt)("p",null,"To extract the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.tar")," is simple, but be aware that it unarchives with the original directory structure, which might be a bit confusing. So, we'll create a new temporary directory for our example that will use to extract to."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"mkdir $HOME/tar_keystore_extract\n")),(0,a.kt)("p",null,"Now, run the command to extract to the target directory, as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"tar -xf keystore.tar -C $HOME/tar_keystore_extract\n")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"/home//.lightning/keystore")," should be in the ",(0,a.kt)("inlineCode",{parentName:"p"},"tar_keystore_extract")," directory where you'll find the PEM files."),(0,a.kt)("h3",{id:"storage"},"Storage"),(0,a.kt)("p",null,"The backup archive should only be accessible by yourself. If you decided to store it in a cloud storage provider, be aware of increased security risks. Cloud storage is convenient, but it ultimately puts data into the hands of others. If you're not particularly concerned, or have confidence about the encryption of the files, then that's at your own risk. But it's recommended to store in a physical hard drive that remains disconnected from computers and network devices."),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"If you use cloud storage to store your sensitive data, encryption should be your first line of defense. Encrypting files before uploading them to the cloud is crucial to reduce others from accessing information without your permissions and knowledge.")),(0,a.kt)("p",null,"Remember that the security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only."),(0,a.kt)("h2",{id:"loading-keys-on-runtime"},"Loading keys on runtime"),(0,a.kt)("p",null,"As described in the section ",(0,a.kt)("a",{parentName:"p",href:"#configuration-file"},"configuration files")," the default location of the ",(0,a.kt)("inlineCode",{parentName:"p"},".lightning")," system configuration directory is ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml")," holds the information of where the Lightning CLI node process should pull the keystore pem files. The location of the pem files can be placed anywhere the node process has permissions to read."),(0,a.kt)("p",null,"When unarchiving the backup files, the keystore directory or pem files should be placed in the directory declared in the ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml"),". That is if the location is the one specified on the runtime\u2013the command declared to launch and run the lightning service, that has the optional ",(0,a.kt)("inlineCode",{parentName:"p"},"-c")," configuration flag that takes any custom location which overrides the default ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml"),"."),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"On runtime, the Lightning service can have specified a configuration file in any readable location. If a configuration pathname isn't passed, it'll default to the ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml"),". It's important to understand this to avoid confusion."),(0,a.kt)("p",{parentName:"admonition"},"The service that starts with:"),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn -c /root/custom-configuration.toml run\n")),(0,a.kt)("p",{parentName:"admonition"},"Can have complete different settings from any of the following:"),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn -c /home/lgtn/.lightning/config.toml run\n")),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn -c ~/.lightning/config.toml run\n")),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn run\n")),(0,a.kt)("p",{parentName:"admonition"},"Due to the fact that any of the fails above might contain different settings declared in the file body.")),(0,a.kt)("p",null,"For instance, we can imagine a scenario where our service is started with the command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn -c /home/lgtn/.lightning/config.toml run\n")),(0,a.kt)("p",null,"Where the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore")," is placed under the parent directory ",(0,a.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/"),". Resulting in the configuration file have the following settings for the hypothetical username ",(0,a.kt)("inlineCode",{parentName:"p"},"lgtn"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'[signer]\nconsensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"\nnode_key_path = "/home/lgtn/.lightning/keystore/node.pem"\n')),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"On the ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/install"},"install instructions")," provided by the documentation, a ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/install#systemd-service-setup"},"Systemd service unit")," is recommended to allow the user control the Lightning service via systemctl. The Systemd service unit file should contain the recommended usage of ",(0,a.kt)("inlineCode",{parentName:"p"},"-c")," configuration. If you have followed the recommendations it should be familiar.")),(0,a.kt)("h2",{id:"conclusion"},"Conclusion"),(0,a.kt)("p",null,"We've walked through most basics of where the configuration file is located, the configuration settings we use to set up and run the node, the different configuration sections we have, and most importantly the identity section."),(0,a.kt)("p",null,"Additionally, a brief guide on the ",(0,a.kt)("a",{parentName:"p",href:"#identity"},"identity"),", more specifically an introduction to the ",(0,a.kt)("a",{parentName:"p",href:"#type-of-keys"},"type of keys")," and ",(0,a.kt)("a",{parentName:"p",href:"#key-privacy"},"key privacy"),", which we find important to understand for anyone seriously interested in running a node by hinting into some system administration and security principles."),(0,a.kt)("p",null,"Separately, at risk of oversimpliying provided a brief introduction into the backup of the keystore directory."),(0,a.kt)("p",null,"In the future, we'll introduce more advanced topics that will help you improve the knowledge you get from this, but we are glad that you followed this guide and got some comprehension to help you manage the key store."),(0,a.kt)("p",null,"While we do our best to provide the clearest instructions, there's always space for improvement, therefore feel free to make any contributions by messaging us on our ",(0,a.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"Discord")," or by opening a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/fleek-network"},"PR")," in any of our repositories."),(0,a.kt)("p",null,"Discover more about the project by ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"watching/contributing on Github"),", following us on ",(0,a.kt)("a",{parentName:"p",href:"https://twitter.com/fleek_net"},"Twitter"),", and joining ",(0,a.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"our community Discord")," for all the best updates!"),(0,a.kt)(o.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}c.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(7294);const a=e=>{let{image:t,name:n,title:a,url:o,communityMember:r=!1}=e;return i.createElement("section",{className:"author_card"},i.createElement("div",null,i.createElement("span",{className:"avatar"},i.createElement("a",{href:o,target:"_blank",alt:n},i.createElement("img",{src:t,alt:n}))),i.createElement("div",null,i.createElement("span",{className:"name"},i.createElement("a",{href:o,target:"_blank",alt:n},n)),i.createElement("span",{className:"title"},a),i.createElement("span",{className:"discord"},r?"Join our community on":"Got questions? Find us on"," ",i.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}},4350:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/managing-the-keystore-fe4cdb19d2f59c54bcf864b0e069b535.png"}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[909],{3905:(e,t,n)=>{n.d(t,{Zo:()=>h,kt:()=>m});var i=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},h=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},c=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,h=s(e,["components","mdxType","originalType","parentName"]),d=p(n),c=a,m=d["".concat(l,".").concat(c)]||d[c]||u[c]||o;return n?i.createElement(m,r(r({ref:t},h),{},{components:n})):i.createElement(m,r({ref:t},h))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=c;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[d]="string"==typeof e?e:a,r[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>c,frontMatter:()=>r,metadata:()=>l,toc:()=>h});var i=n(7462),a=(n(7294),n(3905)),o=n(3872);const r={title:"Managing the keystore",hide_title:!0,slug:"managing-the-keystore",date:new Date("2023-11-14T12:00:00.000Z"),image:"./assets/managing-the-keystore.png?202311181211",description:"The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you\u2019re migrating to",category:"Tutorial",tags:["guide","keystore","public keys","private keys","keys"]},s=void 0,l={unversionedId:"Node Operators/managing-the-keystore",id:"Node Operators/managing-the-keystore",title:"Managing the keystore",description:"The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you\u2019re migrating to",source:"@site/guides/Node Operators/managing-the-keystore.md",sourceDirName:"Node Operators",slug:"/Node Operators/managing-the-keystore",permalink:"/guides/Node Operators/managing-the-keystore",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/guides/Node Operators/managing-the-keystore.md",tags:[{label:"guide",permalink:"/guides/tags/guide"},{label:"keystore",permalink:"/guides/tags/keystore"},{label:"public keys",permalink:"/guides/tags/public-keys"},{label:"private keys",permalink:"/guides/tags/private-keys"},{label:"keys",permalink:"/guides/tags/keys"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Managing the keystore",hide_title:!0,slug:"managing-the-keystore",date:"2023-11-14T12:00:00.000Z",image:"./assets/managing-the-keystore.png?202311181211",description:"The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you\u2019re migrating to",category:"Tutorial",tags:["guide","keystore","public keys","private keys","keys"]},sidebar:"defaultSidebar",previous:{title:"Getting Started",permalink:"/guides/Node Operators/getting-started"},next:{title:"Running a node in Docker",permalink:"/guides/Node Operators/running-a-node-in-docker"}},p={image:n(4350).Z},h=[{value:"Introduction",id:"introduction",level:2},{value:"Pre-requisites",id:"pre-requisites",level:2},{value:"Configuration file",id:"configuration-file",level:2},{value:"Locating the file",id:"locating-the-file",level:3},{value:"Configuration sections",id:"configuration-sections",level:3},{value:"Type of keys",id:"type-of-keys",level:3},{value:"Key privacy",id:"key-privacy",level:3},{value:"Identity selection",id:"identity-selection",level:3},{value:"Backing up the keystore",id:"backing-up-the-keystore",level:2},{value:"Lower security",id:"lower-security",level:3},{value:"Higher security",id:"higher-security",level:3},{value:"Storage",id:"storage",level:3},{value:"Loading keys on runtime",id:"loading-keys-on-runtime",level:2},{value:"Conclusion",id:"conclusion",level:2}],d={toc:h},u="wrapper";function c(e){let{components:t,...r}=e;return(0,a.kt)(u,(0,i.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"Managing the keystore",src:n(4350).Z,width:"1450",height:"816"})),(0,a.kt)("h2",{id:"introduction"},"Introduction"),(0,a.kt)("p",null,"Fleek Network incentivizes participation by rewarding its node providers. A node is identifiable by an identity, which the reward mechanism uses to identify the node to reward it."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"At time of writing the rewards mechanism hasn't yet been introduced, read the ",(0,a.kt)("a",{parentName:"p",href:"https://blog.fleek.network/post/fleek-network-testnet-plans"},"testnet plans")," to get a high level perspective over the plans. A token and economics paper should be released in the future.")),(0,a.kt)("p",null,"We'll use the term identity to describe the key store declared in the configuration, in our case ",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail"},"PEM")," files. The content of the PEM files and the file itself should be kept secret."),(0,a.kt)("p",null,"The key store is in the file system and the location is defined in the Fleek Network ",(0,a.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml"),", as a private key stored in an identity named PEM file (by default ",(0,a.kt)("inlineCode",{parentName:"p"},"consensus.pem")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"node.pem"),"). It's essential to understand this, as you may want to copy the identity to a new server setup, to persist the identity accross to the new server setup."),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"Security is achieved by issuing users private cryptographic keys. Only the holder of the private key has access to sensitive information, such as an identity, which relates to reputation, rewards, etc. The security of the private key is the responsibility of the user. Unfortunately, Fleek Network is unable to help you regain access to your private key if you've lost or failed to secure it. The private keys are your responsibility.")),(0,a.kt)("p",null,"The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"supported system")," you're migrating to."),(0,a.kt)("h2",{id:"pre-requisites"},"Pre-requisites"),(0,a.kt)("p",null,"To follow the guide, you will need the following:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Familiarity with the command-line interface"),(0,a.kt)("li",{parentName:"ul"},"A basic understanding of ",(0,a.kt)("a",{parentName:"li",href:"https://en.wikipedia.org/wiki/Public-key_cryptography"},"how public key cryptography works"))),(0,a.kt)("h2",{id:"configuration-file"},"Configuration file"),(0,a.kt)("h3",{id:"locating-the-file"},"Locating the file"),(0,a.kt)("p",null,"The Lightning CLI has a configuration file in the home directory of the user, which by default is located in the path ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"~/.lightning")," under the name ",(0,a.kt)("inlineCode",{parentName:"p"},"config.toml"),". It's generally described as ",(0,a.kt)("inlineCode",{parentName:"p"},"~/.lightning/config.toml"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"The tilde in ",(0,a.kt)("inlineCode",{parentName:"p"},"~/.lightning")," represents ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME")," which is simpler, but we'll use ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME")," to make it easy to follow.")),(0,a.kt)("p",null,"If you're following the install recommendations you should be logged in with a ",(0,a.kt)("strong",{parentName:"p"},"sudoer")," account. For our guide, let's imagine that the ",(0,a.kt)("strong",{parentName:"p"},"sudoer")," username we are logged in with is ",(0,a.kt)("strong",{parentName:"p"},"lgtn"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"The word ",(0,a.kt)("strong",{parentName:"p"},"sudo"),' is the abbreviation of the term "super user do". As the name suggests, it is the privilege that a super user, such as an administrator has to do whatever it wants in the system. A super user can be an administrator, like the ',(0,a.kt)("strong",{parentName:"p"},"root")," or what we described here as a user in the group ",(0,a.kt)("strong",{parentName:"p"},"sudo")," aka ",(0,a.kt)("strong",{parentName:"p"},"sudoer"),".")),(0,a.kt)("p",null,"If you are logged in with a username, that'd be:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"/home//.lightning/config.toml\n")),(0,a.kt)("p",null,"For our example for user ",(0,a.kt)("inlineCode",{parentName:"p"},"lgtn")," that is:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"/home/lgtn/.lightning/config.toml\n")),(0,a.kt)("p",null,"If you log in with another user, let's say ",(0,a.kt)("inlineCode",{parentName:"p"},"fleek")," it'd be:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"/home/fleek/.lightning/config.toml\n")),(0,a.kt)("p",null,"At any time, you can check which user you are logged in with by running the command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"whoami\n")),(0,a.kt)("p",null,"Here's an example of our user ",(0,a.kt)("inlineCode",{parentName:"p"},"lgtn"),", which for the command above outputs:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"To switch to a particular user, you can run the command ",(0,a.kt)("inlineCode",{parentName:"p"},"su ")," e.g. for the user ",(0,a.kt)("strong",{parentName:"p"},"lgtn")," we would execute the command ",(0,a.kt)("inlineCode",{parentName:"p"},"su lgtn"),".")),(0,a.kt)("p",null,"Now that you know where to locate the configuration file for any given user you are logged in with, learn about the ",(0,a.kt)("a",{parentName:"p",href:"#configuration-sections"},"Configuration sections"),"."),(0,a.kt)("h3",{id:"configuration-sections"},"Configuration sections"),(0,a.kt)("p",null,"The Fleek Network node configuration settings are located in the path ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml"),", and it's organized by configuration sections."),(0,a.kt)("p",null,"At the time of writing, we have a TOML file with sections. Here are some examples amongst others:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"application"),(0,a.kt)("li",{parentName:"ul"},"origin-ipfs"),(0,a.kt)("li",{parentName:"ul"},"rpc"),(0,a.kt)("li",{parentName:"ul"},"signer")),(0,a.kt)("p",null,"Each of the sections holds several property names and values. If you are accustomed to the ",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/JSON"},"JSON")," or ",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/YAML"},"YAML")," formats, you'll find the TOML format a bit similar (if you'd like to learn more about the TOML file format, read about it ",(0,a.kt)("a",{parentName:"p",href:"https://toml.io/en/"},"here"),")."),(0,a.kt)("p",null,"By default, and at time of writing the Lightning CLI configuration file (config.toml) is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'[BLANK]\n\n[application]\ndb_path = "/home/lgtn/.lightning/data/app_db"\nmode = "Prod"\nstorage = "RocksDb"\ntestnet = true\n\n[blockserver]\naddress = "0.0.0.0:4211"\n\n[broadcast]\naddress = "0.0.0.0:4200"\n\n[consensus]\nstore_path = "/home/lgtn/.lightning/data/narwhal_store"\n\n[dht]\naddress = "0.0.0.0:8101"\nbootstrappers = []\n\n[fetcher]\n\n[fsstore]\nroot = "/home/lgtn/.lightning/blockstore"\n\n[[handshake.transport]]\nsignal_address = "0.0.0.0:4210"\ntype = "WebRTC"\n\n[[handshake.worker]]\ntype = "AsyncWorker"\n\n[[handshake.worker]]\ntype = "AsyncWorker"\n\n[[handshake.worker]]\ntype = "AsyncWorker"\n\n[[handshake.worker]]\ntype = "AsyncWorker"\n\n[[origin-ipfs.gateways]]\nauthority = "ipfs.io"\nprotocol = "Https"\n\n[[origin-ipfs.gateways]]\nauthority = "fleek.ipfs.io"\nprotocol = "Https"\n\n[[origin-ipfs.gateways]]\nauthority = "ipfs.runfission.com"\nprotocol = "Https"\n\n[rep-collector]\nreporter_buffer_size = 5\n\n[resolver]\nstore_path = "/home/lgtn/.lightning/data/resolver_store"\n\n[rpc]\naddr = "0.0.0.0"\nport = 4230\n\n[service-executor]\nservices = [0, 1]\n\n[signer]\nconsensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"\nnode_key_path = "/home/lgtn/.lightning/keystore/node.pem"\n\n[topology]\ntesting_min_nodes = 9\ntesting_target_k = 8\n')),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"Beware that the configuration file might look a bit different depending on the version you're running and the current development features in place by the Fleek Network core team. You shouldn't copy the example above and replace with yours, as this only servers for illustrative purposes.")),(0,a.kt)("p",null,"Some advanced use cases might require dealing with the host and port number binding, depending on the service provider's needs and customization. We'll keep things simple and assume the default settings."),(0,a.kt)("p",null,"In this guide, we are interested in the ",(0,a.kt)("inlineCode",{parentName:"p"},"[signer]")," section settings for the ",(0,a.kt)("inlineCode",{parentName:"p"},"consensus_key_path")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"node_key_path")," which by default is set to ",(0,a.kt)("inlineCode",{parentName:"p"},"~/.lightning/keystore"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"The identity is a text description for the Keystore and at the time of writing we have not yet implemented multiple identity management via the CLI. Thereupon, the identity value serves to find the filename match in the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore_path"),". This might change as we progress with development. Check the ",(0,a.kt)("a",{parentName:"p",href:"#identity-selection"},"Identity selection")," to learn more about it!")),(0,a.kt)("h3",{id:"type-of-keys"},"Type of keys"),(0,a.kt)("p",null,"There are three types of keys related to the identity of a node and the account ownership. The keys are based in public-key cryptography, or asymmetric cryptography where each key pair consists of a public key and a corresponding private key. The keys are described in the section ",(0,a.kt)("a",{parentName:"p",href:"/docs/learn/the-network/#identity-on-the-fleek-network"},"identity on the Fleek Network")," as follows:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"A Node key (ConsensusPublicKey) is ",(0,a.kt)("a",{parentName:"p",href:"https://electriccoin.co/blog/new-snark-curve/"},"BLS12-381")," which facilitates the consensus algorithm or persistence of state, resilience and fault tolerance. Has multi-signature support, the ability to aggregate many signatures into one used for consensus committee when signing certificates")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"A Node Networking key (NodePublicKey) is ",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/EdDSA"},"Ed25519")," used for the speed and performance of the network communications")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},"Account Owner keys are based on ",(0,a.kt)("a",{parentName:"p",href:"https://www.secg.org/sec2-v2.pdf"},"secp256k1"),", which corresponds to an Ethereum Address"))),(0,a.kt)("p",null,"For instance, a public key is open to anybody to see, and it represents a unique node identifier in the Fleek Network, a bit like a passport number. On the other hand, the private key is secret, and the operator is responsible to store it privately."),(0,a.kt)("p",null,"The Fleek Network relies on cryptography, thus the Fleek Network team and anybody can access, compromise or manipulate the secrets of an identity. On the other hand, the public key can be used by anyone, Fleek Network included, to identify a node or send rewards to the address without jeopardizing identity security."),(0,a.kt)("p",null,"To learn more about the identities on the Fleek Network ",(0,a.kt)("a",{parentName:"p",href:"/docs/learn/the-network/#identity-on-the-fleek-network"},"here"),"."),(0,a.kt)("h3",{id:"key-privacy"},"Key privacy"),(0,a.kt)("p",null,"If you don\u2019t keep your private keys secret, you'll have your node compromised."),(0,a.kt)("p",null,"Here are a few examples of what you should not do:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Share the ",(0,a.kt)("inlineCode",{parentName:"li"},"$HOME/.lightning/keystore")," directory file content publicly"),(0,a.kt)("li",{parentName:"ul"},"Track the ",(0,a.kt)("inlineCode",{parentName:"li"},"$HOME/.lightning/keystore")," directory files in a version control repository e.g. git"),(0,a.kt)("li",{parentName:"ul"},'Have poor "rights" permissions in UNIX systems e.g. everyone can read, delete, modify ',(0,a.kt)("inlineCode",{parentName:"li"},"$HOME/.lightning")),(0,a.kt)("li",{parentName:"ul"},"Allow anyone to access the node provider physically without any access control to the operating and file systems e.g. a VPS provider"),(0,a.kt)("li",{parentName:"ul"},"Get rid of a hard drive unformatted or blind erased by selling to somebody or dumping in the bin, which contains ",(0,a.kt)("inlineCode",{parentName:"li"},"$HOME/.lightning/keystore"))),(0,a.kt)("p",null,"There are many other ways of getting compromised, but hopefully, the ones put above give you a good starter into the subject."),(0,a.kt)("p",null,"Remember, the node provider is the only one responsible when managing the key store. Neither Fleek Network nor the most sophisticated AI system presently can compromise the cryptography in use to help you out. You are fully responsible for securing and retaining your private keys."),(0,a.kt)("h3",{id:"identity-selection"},"Identity selection"),(0,a.kt)("p",null,"Multiple identity management is yet to be implemented but in any case, some users might find it trivial to keep multiple identities and switch between them referencing them by name. The following section is not advocating this approach but sharing some approaches that can help certain use-cases."),(0,a.kt)("p",null,"Let's suppose that we've recently moved to a new server setup and copied our previous server keystore keys as ",(0,a.kt)("inlineCode",{parentName:"p"},"consensus.pem")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"node.pem")," and renamed the ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore/*.pem")," to ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore/new-*.pem"),"."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"We are using a wildcard ",(0,a.kt)("inlineCode",{parentName:"p"},"*")," to reduce verbosity. The wildcard means as replacement for all the filenames encountered in the path and extension without having to name them individually as we know they are ",(0,a.kt)("inlineCode",{parentName:"p"},"consensus.pem")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"node.pem"),".")),(0,a.kt)("p",null,"To illustrate this scenario, here's an example of how our ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore")," directory could look like:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},".\n\u251c\u2500\u2500 new-consensus.pem\n\u251c\u2500\u2500 new-node.pem\n\u2514\u2500\u2500 old-consensus.pem\n\u2514\u2500\u2500 old-node.pem\n\n0 directories, 4 file\n")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"old-*.pem")," files are the original key store and ",(0,a.kt)("inlineCode",{parentName:"p"},"new-*.pem")," could correspond to the new identity created while setting up the node in the new server."),(0,a.kt)("p",null,"Since we have ",(0,a.kt)("inlineCode",{parentName:"p"},"[signer]")," set to the default values, in particular:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-toml"},'[signer]\nconsensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"\nnode_key_path = "/home/lgtn/.lightning/keystore/node.pem"\n')),(0,a.kt)("p",null,"We'd be required to change and switch to the preferred keys. The identity is switch to the provided values once the node is restarted. Thus, we can switch to any identity by changing the ",(0,a.kt)("inlineCode",{parentName:"p"},"[signer]")," ",(0,a.kt)("inlineCode",{parentName:"p"},"consensus_key_path")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"node_key_path")," pathname values anytime as long we restart the server successfully."),(0,a.kt)("p",null,"To verify which keys are loaded by the Lightning CLI run the command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn keys show\n")),(0,a.kt)("p",null,"You'd find the public keys in the output, which can be used for comparision and should be different everytime the configuration changes and reloaded. Here's an example of the output:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"Node Public Key: RwPpr35H5AAfWwSDFxwYuJv5TA8PWUd2pdBg+UKsORc=\nConsensus Public Key: s36g09qQzaaOJxi0UZDRCXj3HUUWjaGiYrQV6Ylo9Ih6jMvrnxM5s1OpBnsEj5R1AVYcuxlnVR+oyEjgJ3WpI5LOHSN1Q6Zur33vka3IachBEIKIbsiXMJW16vu4n4bG\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"The PEM files can be named as you wish, but by default we like to keep it sound to avoid confusion and make it as clear as possible.")),(0,a.kt)("h2",{id:"backing-up-the-keystore"},"Backing up the keystore"),(0,a.kt)("p",null,"When dealing with Fleek Network it's crucial to always be aware of the identity. You should backup private keys in case the unexpected happens, as it's impossible to recover the identity in any other way, including the core team, any other person or system."),(0,a.kt)("p",null,"Backing up your keystore pem files are crucial to ensure the safety and accessibility of your identity on the Fleek Network. For example, if your ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning")," is deleted you'll still be able to restore it if you have backed it up properly."),(0,a.kt)("p",null,"There are many ways to make identity backups, each with its own benefits and drawbacks. At risk of oversimplifying, we'll focus on a simple manual approach to expose some principles you should have awareness."),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"The security is never stronger than its weakest link, and it is very likely that the weakest link is not the method itself. It's pointless to encrypt the backup archive with sophisticated methods when the passphrase is weak or of an easy guess.")),(0,a.kt)("p",null,"None of the methods described here are being endorsed by the Fleek Network team use the knowledge provided here for educational purposes only and at your own risk."),(0,a.kt)("h3",{id:"lower-security"},"Lower security"),(0,a.kt)("p",null,"If you opt for the lowest level of security, you can use zip and unzip. The man page of zip described the encryption algorithm used to be weaker than PGP."),(0,a.kt)("p",null,"To zip and encrypto the ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore")," directory run:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"# It'll prompt for password (remember)\nzip --encrypt -r keystore.zip.enc $HOME/.lightning/keystore\n")),(0,a.kt)("p",null,"To unzip and decrypt the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.zip.enc"),", you'd run:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"# It'll prompt for password (recall)\nunzip keystore.zip.enc -d $HOME/.lightning/keystore\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"We provide the unzip destiny target to the flag ",(0,a.kt)("inlineCode",{parentName:"p"},"-d"),". The unzip process outputs the files onto the desired location ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/keystore"),", thus overriding any contents. If you have any files in the destiny target directory it'll be overriden, effectively replacing with the output of the unzipped directory content, so make sure you backup any files as required.")),(0,a.kt)("h3",{id:"higher-security"},"Higher security"),(0,a.kt)("p",null,"Create a ",(0,a.kt)("inlineCode",{parentName:"p"},"Tar")," archive, which will contain the target directory, files and the Tar stores all of the relative paths in the tarball itself."),(0,a.kt)("p",null,"Create a ",(0,a.kt)("inlineCode",{parentName:"p"},"tarbar")," by executing:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'tar -cf "keystore.tar" $HOME/.lightning/keystore\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.tar")," should be in the current work directory."),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"gpg")," with the ",(0,a.kt)("a",{parentName:"p",href:"https://www.gnupg.org/gph/en/manual/x110.html"},"symmetric option"),", it creates the keys for that file and request a password to protect them. If you are familiar with asymmetric ",(0,a.kt)("inlineCode",{parentName:"p"},"gpg"),", it's similar, but it's not signed with your public key or such."),(0,a.kt)("p",null,"The encryption command is:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo gpg -a --symmetric --cipher-algo AES256 keystore.tar\n")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.tar.asc")," should be in the current work directory."),(0,a.kt)("p",null,"To decrypt the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.tar.asc")," file, enter:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo gpg -a --output keystore.tar --decrypt keystore.tar.asc\n")),(0,a.kt)("p",null,"To extract the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore.tar")," is simple, but be aware that it unarchives with the original directory structure, which might be a bit confusing. So, we'll create a new temporary directory for our example that will use to extract to."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"mkdir $HOME/tar_keystore_extract\n")),(0,a.kt)("p",null,"Now, run the command to extract to the target directory, as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"tar -xf keystore.tar -C $HOME/tar_keystore_extract\n")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"/home//.lightning/keystore")," should be in the ",(0,a.kt)("inlineCode",{parentName:"p"},"tar_keystore_extract")," directory where you'll find the PEM files."),(0,a.kt)("h3",{id:"storage"},"Storage"),(0,a.kt)("p",null,"The backup archive should only be accessible by yourself. If you decided to store it in a cloud storage provider, be aware of increased security risks. Cloud storage is convenient, but it ultimately puts data into the hands of others. If you're not particularly concerned, or have confidence about the encryption of the files, then that's at your own risk. But it's recommended to store in a physical hard drive that remains disconnected from computers and network devices."),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"If you use cloud storage to store your sensitive data, encryption should be your first line of defense. Encrypting files before uploading them to the cloud is crucial to reduce others from accessing information without your permissions and knowledge.")),(0,a.kt)("p",null,"Remember that the security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only."),(0,a.kt)("h2",{id:"loading-keys-on-runtime"},"Loading keys on runtime"),(0,a.kt)("p",null,"As described in the section ",(0,a.kt)("a",{parentName:"p",href:"#configuration-file"},"configuration files")," the default location of the ",(0,a.kt)("inlineCode",{parentName:"p"},".lightning")," system configuration directory is ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml")," holds the information of where the Lightning CLI node process should pull the keystore pem files. The location of the pem files can be placed anywhere the node process has permissions to read."),(0,a.kt)("p",null,"When unarchiving the backup files, the keystore directory or pem files should be placed in the directory declared in the ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml"),". That is if the location is the one specified on the runtime\u2013the command declared to launch and run the lightning service, that has the optional ",(0,a.kt)("inlineCode",{parentName:"p"},"-c")," configuration flag that takes any custom location which overrides the default ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml"),"."),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"On runtime, the Lightning service can have specified a configuration file in any readable location. If a configuration pathname isn't passed, it'll default to the ",(0,a.kt)("inlineCode",{parentName:"p"},"$HOME/.lightning/config.toml"),". It's important to understand this to avoid confusion."),(0,a.kt)("p",{parentName:"admonition"},"The service that starts with:"),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn -c /root/custom-configuration.toml run\n")),(0,a.kt)("p",{parentName:"admonition"},"Can have complete different settings from any of the following:"),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn -c /home/lgtn/.lightning/config.toml run\n")),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn -c ~/.lightning/config.toml run\n")),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn run\n")),(0,a.kt)("p",{parentName:"admonition"},"Due to the fact that any of the fails above might contain different settings declared in the file body.")),(0,a.kt)("p",null,"For instance, we can imagine a scenario where our service is started with the command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn -c /home/lgtn/.lightning/config.toml run\n")),(0,a.kt)("p",null,"Where the ",(0,a.kt)("inlineCode",{parentName:"p"},"keystore")," is placed under the parent directory ",(0,a.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/"),". Resulting in the configuration file have the following settings for the hypothetical username ",(0,a.kt)("inlineCode",{parentName:"p"},"lgtn"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'[signer]\nconsensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"\nnode_key_path = "/home/lgtn/.lightning/keystore/node.pem"\n')),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"On the ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/install"},"install instructions")," provided by the documentation, a ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/install#systemd-service-setup"},"Systemd service unit")," is recommended to allow the user control the Lightning service via systemctl. The Systemd service unit file should contain the recommended usage of ",(0,a.kt)("inlineCode",{parentName:"p"},"-c")," configuration. If you have followed the recommendations it should be familiar.")),(0,a.kt)("h2",{id:"conclusion"},"Conclusion"),(0,a.kt)("p",null,"We've walked through most basics of where the configuration file is located, the configuration settings we use to set up and run the node, the different configuration sections we have, and most importantly the identity section."),(0,a.kt)("p",null,"Additionally, a brief guide on the ",(0,a.kt)("a",{parentName:"p",href:"#identity"},"identity"),", more specifically an introduction to the ",(0,a.kt)("a",{parentName:"p",href:"#type-of-keys"},"type of keys")," and ",(0,a.kt)("a",{parentName:"p",href:"#key-privacy"},"key privacy"),", which we find important to understand for anyone seriously interested in running a node by hinting into some system administration and security principles."),(0,a.kt)("p",null,"Separately, at risk of oversimpliying provided a brief introduction into the backup of the keystore directory."),(0,a.kt)("p",null,"In the future, we'll introduce more advanced topics that will help you improve the knowledge you get from this, but we are glad that you followed this guide and got some comprehension to help you manage the key store."),(0,a.kt)("p",null,"While we do our best to provide the clearest instructions, there's always space for improvement, therefore feel free to make any contributions by messaging us on our ",(0,a.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"Discord")," or by opening a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/fleek-network"},"PR")," in any of our repositories."),(0,a.kt)("p",null,"Discover more about the project by ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"watching/contributing on Github"),", following us on ",(0,a.kt)("a",{parentName:"p",href:"https://twitter.com/fleek_net"},"Twitter"),", and joining ",(0,a.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"our community Discord")," for all the best updates!"),(0,a.kt)(o.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}c.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>a});var i=n(7294);const a=e=>{let{image:t,name:n,title:a,url:o,communityMember:r=!1}=e;return i.createElement("section",{className:"author_card"},i.createElement("div",null,i.createElement("span",{className:"avatar"},i.createElement("a",{href:o,target:"_blank",alt:n},i.createElement("img",{src:t,alt:n}))),i.createElement("div",null,i.createElement("span",{className:"name"},i.createElement("a",{href:o,target:"_blank",alt:n},n)),i.createElement("span",{className:"title"},a),i.createElement("span",{className:"discord"},r?"Join our community on":"Got questions? Find us on"," ",i.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}},4350:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/managing-the-keystore-fe4cdb19d2f59c54bcf864b0e069b535.png"}}]); \ No newline at end of file diff --git a/assets/js/5b6134d1.bd33ad36.js b/assets/js/5b6134d1.d8e23f3c.js similarity index 99% rename from assets/js/5b6134d1.bd33ad36.js rename to assets/js/5b6134d1.d8e23f3c.js index 6f696fabb..3bbcf7c3c 100644 --- a/assets/js/5b6134d1.bd33ad36.js +++ b/assets/js/5b6134d1.d8e23f3c.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[9752],{3905:(e,t,n)=>{n.d(t,{Zo:()=>h,kt:()=>c});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},h=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},g=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,h=s(e,["components","mdxType","originalType","parentName"]),d=p(n),g=o,c=d["".concat(l,".").concat(g)]||d[g]||u[g]||a;return n?r.createElement(c,i(i({ref:t},h),{},{components:n})):r.createElement(c,i({ref:t},h))}));function c(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=g;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[d]="string"==typeof e?e:o,i[1]=s;for(var p=2;p{n.d(t,{ZP:()=>s});var r=n(7462),o=(n(7294),n(3905));const a={toc:[]},i="wrapper";function s(e){let{components:t,...n}=e;return(0,o.kt)(i,(0,r.Z)({},a,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"In the ",(0,o.kt)("inlineCode",{parentName:"p"},"/home//.lightning/config.toml")," you'll find some and more of the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The configuration properties and values presented above are a shorter version of what you'll find on your ",(0,o.kt)("strong",{parentName:"p"},"configuration.toml"),". We keep it short to make it easier to follow, do not copy and paste.")),(0,o.kt)("p",null,"Find and replace all instances of ~ in the config file ",(0,o.kt)("inlineCode",{parentName:"p"},"/home//.lightning/config.toml"),". "),(0,o.kt)("p",null,"Here's an example of how to do it using ",(0,o.kt)("strong",{parentName:"p"},"sed"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home//.lightning|g" "/home//.lightning/config.toml"\n')),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Replace the ",(0,o.kt)("inlineCode",{parentName:"p"},"")," with your username. For example, if you have followed the recommendation to ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user"},"create a user")," it would look like ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/config.toml")," for the username ",(0,o.kt)("strong",{parentName:"p"},"lgtn"),".")),(0,o.kt)("p",null,"For example, if your username is ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," that'd look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"\n')),(0,o.kt)("p",null,"Once modified, you can run a ",(0,o.kt)("inlineCode",{parentName:"p"},"cat")," to see the content of the files to confirm it has been updated."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cat /home/lgtn/.lightning/config.toml\n")),(0,o.kt)("p",null,"For our example where we opted in for the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," that would look like:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,o.kt)("admonition",{title:"Warning",type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"Bear in mind that we are keeping the content of the file short to make it easier to read and follow. The content of your configuration file should look slightly different, amongst these it should contain other properties and values. You should not copy and replace the content of your files with the ones presented here.")))}s.isMDXComponent=!0},5852:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>h,contentTitle:()=>l,default:()=>c,frontMatter:()=>s,metadata:()=>p,toc:()=>d});var r=n(7462),o=(n(7294),n(3905)),a=n(3872),i=n(3242);const s={title:"File permissions and Ownership",slug:"file-permissions-and-ownership",hide_title:!0,tags:["ownership","file permissions","sudoer","root"]},l=void 0,p={unversionedId:"Lightning CLI/file-permissions-and-ownership",id:"Lightning CLI/file-permissions-and-ownership",title:"File permissions and Ownership",description:"Ownership",source:"@site/references/Lightning CLI/file-permissions-and-ownership.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/file-permissions-and-ownership",permalink:"/references/Lightning CLI/file-permissions-and-ownership",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/file-permissions-and-ownership.md",tags:[{label:"ownership",permalink:"/references/tags/ownership"},{label:"file permissions",permalink:"/references/tags/file-permissions"},{label:"sudoer",permalink:"/references/tags/sudoer"},{label:"root",permalink:"/references/tags/root"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"File permissions and Ownership",slug:"file-permissions-and-ownership",hide_title:!0,tags:["ownership","file permissions","sudoer","root"]},sidebar:"defaultSidebar",previous:{title:"Error linking with cc",permalink:"/references/Lightning CLI/error-linking-with-cc-failed-exist-status-1"},next:{title:"Keys not found",permalink:"/references/Lightning CLI/keys-not-found"}},h={},d=[{value:"Ownership",id:"ownership",level:2},{value:"Using sudo to delegate permissions",id:"using-sudo-to-delegate-permissions",level:2},{value:"User $HOME directory",id:"user-home-directory",level:2},{value:"Set the locations of the user paths",id:"set-the-locations-of-the-user-paths",level:2},{value:"Set the configuration flag -c on the service unit file",id:"set-the-configuration-flag--c-on-the-service-unit-file",level:2}],u={toc:d},g="wrapper";function c(e){let{components:t,...n}=e;return(0,o.kt)(g,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"ownership"},"Ownership"),(0,o.kt)("p",null,"The user who installs the Fleek Network Lightning CLI matters, as it can own or delegate ownership of the dependencies and applications being installed."),(0,o.kt)("p",null,"For example, if you have followed the install document recommendations and have:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Created a user ",(0,o.kt)("strong",{parentName:"li"},"lgtn")),(0,o.kt)("li",{parentName:"ul"},"Switched to the user ",(0,o.kt)("strong",{parentName:"li"},"lgtn")),(0,o.kt)("li",{parentName:"ul"},"Executed the installation process as ",(0,o.kt)("strong",{parentName:"li"},"lgtn")," ")),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The username can be anything, we are using the term ",(0,o.kt)("strong",{parentName:"p"},"lgtn")," as the example provided throughout our documentation. Select your username in accordance to your preferences.")),(0,o.kt)("p",null,"You'll find that it owns the following directories under the user home (/home/lgtn):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"drwxr-x--- 6 lgtn lgtn 4096 Sep 12 10:27 .\ndrwxr-xr-x 3 root root 4096 Sep 11 12:28 ..\ndrwxrwxr-x 5 lgtn lgtn 4096 Sep 11 12:29 .cargo\ndrwxrwxr-x 5 lgtn lgtn 4096 Sep 11 15:25 .lightning\ndrwxrwxr-x 6 lgtn lgtn 4096 Sep 11 12:29 .rustup\ndrwxrwxr-x 3 lgtn lgtn 4096 Sep 11 12:28 fleek-network\n")),(0,o.kt)("p",null,"Above, we have the listing properties set as ",(0,o.kt)("strong",{parentName:"p"},"drwxrwxr-x")," and the ownership ",(0,o.kt)("strong",{parentName:"p"},"lgtn:lgtn"),"."),(0,o.kt)("p",null,"On the other hand, if you have done the installation process as ",(0,o.kt)("strong",{parentName:"p"},"root")," superuser, you'll find that:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"The location of the directories and files goes under the ",(0,o.kt)("inlineCode",{parentName:"li"},"/root")," pathname"),(0,o.kt)("li",{parentName:"ul"},"The ownership is set to ",(0,o.kt)("strong",{parentName:"li"},"root:root"))),(0,o.kt)("p",null,"Learn more about ",(0,o.kt)("a",{parentName:"p",href:"https://www.linuxfoundation.org/blog/blog/classic-sysadmin-understanding-linux-file-permissions"},"file permissions")," from the ",(0,o.kt)("a",{parentName:"p",href:"https://www.linuxfoundation.org/"},"Linux Foundation"),"."),(0,o.kt)("p",null,"To learn more about file permission on Linux, read the ",(0,o.kt)("a",{parentName:"p",href:"https://www.linuxfoundation.org/blog/blog/classic-sysadmin-understanding-linux-file-permissions"},"Understanding Linux File Permissions"),"."),(0,o.kt)("h2",{id:"using-sudo-to-delegate-permissions"},"Using sudo to delegate permissions"),(0,o.kt)("p",null,"Consider file ownership and permissions to understand where the keystore is located. Take close attention when executing commands as an admin\u2013with or without ",(0,o.kt)("strong",{parentName:"p"},"super user")," (root) or ",(0,o.kt)("strong",{parentName:"p"},"sudo"),"."),(0,o.kt)("p",null,"If a command is executed without ",(0,o.kt)("strong",{parentName:"p"},"sudo")," then the generated output goes onto the ",(0,o.kt)("strong",{parentName:"p"},"user")," home."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn keys generate\n")),(0,o.kt)("p",null,"Resulting in having the ",(0,o.kt)("strong",{parentName:"p"},"keystore")," saved onto ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/username/.lightning/keystore"),"."),(0,o.kt)("p",null,"On the other hand, if a command is executed with ",(0,o.kt)("strong",{parentName:"p"},"sudo")," then the generated output is delegated to ",(0,o.kt)("strong",{parentName:"p"},"root")," directory."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo lgtn keys generate\n")),(0,o.kt)("p",null,"Resulting in having the ",(0,o.kt)("strong",{parentName:"p"},"keystore")," saved onto ",(0,o.kt)("inlineCode",{parentName:"p"},"/root/.lightning/keystore"),"."),(0,o.kt)("h2",{id:"user-home-directory"},"User $HOME directory"),(0,o.kt)("p",null,"The home directory is a directory that contains the personal files of a particular user of the system. On Linux, the ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME")," environment variable is set by the login program, which sets the user `$HOME`` accordingly. A user's home goes by the username, the user who's logged in."),(0,o.kt)("p",null,"For this reason, a user can change to the home directory by executing:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cd $HOME\n")),(0,o.kt)("p",null,"A shorthand allows a user to refer to their home directory simply as ",(0,o.kt)("inlineCode",{parentName:"p"},"~")," (tilde), as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"We can find that the HOME or ~ (tilde) is highly dependent on the user who's logged in. Since we know that the user might delegate to ",(0,o.kt)("strong",{parentName:"p"},"root")," by the usage of ",(0,o.kt)("strong",{parentName:"p"},"sudo"),", this can help troubleshoot and explain the location of our files e.g. the keystore. In the section ",(0,o.kt)("a",{parentName:"p",href:"#set-the-locations-of-the-user-paths"},"Set the locations of the user paths"),", we learn how to define the location of our user configuration paths to avoid confusion. By doing it we ensure that when running the service, the service picks the correct configuration paths for our user.")),(0,o.kt)("p",null,"To learn more about the user $HOME directory read the wikipedia ",(0,o.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Home_directory"},"Home directory")," document."),(0,o.kt)("h2",{id:"set-the-locations-of-the-user-paths"},"Set the locations of the user paths"),(0,o.kt)(i.ZP,{mdxType:"FindAndReplaceConfigWithUserPaths"}),(0,o.kt)("h2",{id:"set-the-configuration-flag--c-on-the-service-unit-file"},"Set the configuration flag -c on the service unit file"),(0,o.kt)("p",null,"The following section assumes that a System service unit has been declared, and you're using systemctl to control the service, as described in our ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#systemd-service-setup"},"Systemd Service Setup")," install section."),(0,o.kt)("p",null,"Open and edit the ",(0,o.kt)("strong",{parentName:"p"},"/etc/systemd/system/lightning.service")," file."),(0,o.kt)("p",null,"1) Replace ",(0,o.kt)("inlineCode",{parentName:"p"},"")," with YOUR username. For example, in the documentation we use the username ",(0,o.kt)("strong",{parentName:"p"},"lgtn"),", which means we'd replace ",(0,o.kt)("inlineCode",{parentName:"p"},"")," with ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn"),"."),(0,o.kt)("p",null,"2) Make sure that the ExecStart is set correctly, including the ",(0,o.kt)("inlineCode",{parentName:"p"},"-c")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home//.lightning/config.toml run\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,o.kt)("p",null,"For our example, as the username ",(0,o.kt)("strong",{parentName:"p"},"lgtn")," it would look like:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home/lgtn/.lightning/config.toml run\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,o.kt)("p",null,"When complete make sure the file is saved and the systemctl daemon is reloaded, as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,o.kt)("p",null,"Consequently, when a user manages the service via the systemctl, the Lightning CLI process will read the configuration file settings provided above. It includes the location of the user preferences, such as the keystore location amongst others, preventing confusion regardless of ",(0,o.kt)("strong",{parentName:"p"},"root")," delegation."),(0,o.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}c.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(7294);const o=e=>{let{image:t,name:n,title:o,url:a,communityMember:i=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:a,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:a,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},o),r.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[9752],{3905:(e,t,n)=>{n.d(t,{Zo:()=>h,kt:()=>c});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},h=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},g=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,h=s(e,["components","mdxType","originalType","parentName"]),d=p(n),g=o,c=d["".concat(l,".").concat(g)]||d[g]||u[g]||a;return n?r.createElement(c,i(i({ref:t},h),{},{components:n})):r.createElement(c,i({ref:t},h))}));function c(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=g;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[d]="string"==typeof e?e:o,i[1]=s;for(var p=2;p{n.d(t,{ZP:()=>s});var r=n(7462),o=(n(7294),n(3905));const a={toc:[]},i="wrapper";function s(e){let{components:t,...n}=e;return(0,o.kt)(i,(0,r.Z)({},a,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"In the ",(0,o.kt)("inlineCode",{parentName:"p"},"/home//.lightning/config.toml")," you'll find some and more of the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The configuration properties and values presented above are a shorter version of what you'll find on your ",(0,o.kt)("strong",{parentName:"p"},"configuration.toml"),". We keep it short to make it easier to follow, do not copy and paste.")),(0,o.kt)("p",null,"Find and replace all instances of ~ in the config file ",(0,o.kt)("inlineCode",{parentName:"p"},"/home//.lightning/config.toml"),". "),(0,o.kt)("p",null,"Here's an example of how to do it using ",(0,o.kt)("strong",{parentName:"p"},"sed"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home//.lightning|g" "/home//.lightning/config.toml"\n')),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Replace the ",(0,o.kt)("inlineCode",{parentName:"p"},"")," with your username. For example, if you have followed the recommendation to ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#create-a-user"},"create a user")," it would look like ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/lgtn/.lightning/config.toml")," for the username ",(0,o.kt)("strong",{parentName:"p"},"lgtn"),".")),(0,o.kt)("p",null,"For example, if your username is ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," that'd look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"\n')),(0,o.kt)("p",null,"Once modified, you can run a ",(0,o.kt)("inlineCode",{parentName:"p"},"cat")," to see the content of the files to confirm it has been updated."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cat /home/lgtn/.lightning/config.toml\n")),(0,o.kt)("p",null,"For our example where we opted in for the username ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn")," that would look like:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[BLANK]\n\n[application]\ndb_path = "~/.lightning/data/app_db"\n\n[consensus]\nstore_path = "~/.lightning/data/narwhal_store"\n\n[fsstore]\nroot = "~/.lightning/blockstore"\n\n[resolver]\nstore_path = "~/.lightning/data/resolver_store"\n\n[signer]\nconsensus_key_path = "~/.lightning/keystore/consensus.pem"\nnode_key_path = "~/.lightning/keystore/node.pem"\n')),(0,o.kt)("admonition",{title:"Warning",type:"caution"},(0,o.kt)("p",{parentName:"admonition"},"Bear in mind that we are keeping the content of the file short to make it easier to read and follow. The content of your configuration file should look slightly different, amongst these it should contain other properties and values. You should not copy and replace the content of your files with the ones presented here.")))}s.isMDXComponent=!0},5852:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>h,contentTitle:()=>l,default:()=>c,frontMatter:()=>s,metadata:()=>p,toc:()=>d});var r=n(7462),o=(n(7294),n(3905)),a=n(3872),i=n(3242);const s={title:"File permissions and Ownership",slug:"file-permissions-and-ownership",hide_title:!0,tags:["ownership","file permissions","sudoer","root"]},l=void 0,p={unversionedId:"Lightning CLI/file-permissions-and-ownership",id:"Lightning CLI/file-permissions-and-ownership",title:"File permissions and Ownership",description:"Ownership",source:"@site/references/Lightning CLI/file-permissions-and-ownership.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/file-permissions-and-ownership",permalink:"/references/Lightning CLI/file-permissions-and-ownership",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/file-permissions-and-ownership.md",tags:[{label:"ownership",permalink:"/references/tags/ownership"},{label:"file permissions",permalink:"/references/tags/file-permissions"},{label:"sudoer",permalink:"/references/tags/sudoer"},{label:"root",permalink:"/references/tags/root"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"File permissions and Ownership",slug:"file-permissions-and-ownership",hide_title:!0,tags:["ownership","file permissions","sudoer","root"]},sidebar:"defaultSidebar",previous:{title:"Error linking with cc",permalink:"/references/Lightning CLI/error-linking-with-cc-failed-exist-status-1"},next:{title:"Keys not found",permalink:"/references/Lightning CLI/keys-not-found"}},h={},d=[{value:"Ownership",id:"ownership",level:2},{value:"Using sudo to delegate permissions",id:"using-sudo-to-delegate-permissions",level:2},{value:"User $HOME directory",id:"user-home-directory",level:2},{value:"Set the locations of the user paths",id:"set-the-locations-of-the-user-paths",level:2},{value:"Set the configuration flag -c on the service unit file",id:"set-the-configuration-flag--c-on-the-service-unit-file",level:2}],u={toc:d},g="wrapper";function c(e){let{components:t,...n}=e;return(0,o.kt)(g,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"ownership"},"Ownership"),(0,o.kt)("p",null,"The user who installs the Fleek Network Lightning CLI matters, as it can own or delegate ownership of the dependencies and applications being installed."),(0,o.kt)("p",null,"For example, if you have followed the install document recommendations and have:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Created a user ",(0,o.kt)("strong",{parentName:"li"},"lgtn")),(0,o.kt)("li",{parentName:"ul"},"Switched to the user ",(0,o.kt)("strong",{parentName:"li"},"lgtn")),(0,o.kt)("li",{parentName:"ul"},"Executed the installation process as ",(0,o.kt)("strong",{parentName:"li"},"lgtn")," ")),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"The username can be anything, we are using the term ",(0,o.kt)("strong",{parentName:"p"},"lgtn")," as the example provided throughout our documentation. Select your username in accordance to your preferences.")),(0,o.kt)("p",null,"You'll find that it owns the following directories under the user home (/home/lgtn):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"drwxr-x--- 6 lgtn lgtn 4096 Sep 12 10:27 .\ndrwxr-xr-x 3 root root 4096 Sep 11 12:28 ..\ndrwxrwxr-x 5 lgtn lgtn 4096 Sep 11 12:29 .cargo\ndrwxrwxr-x 5 lgtn lgtn 4096 Sep 11 15:25 .lightning\ndrwxrwxr-x 6 lgtn lgtn 4096 Sep 11 12:29 .rustup\ndrwxrwxr-x 3 lgtn lgtn 4096 Sep 11 12:28 fleek-network\n")),(0,o.kt)("p",null,"Above, we have the listing properties set as ",(0,o.kt)("strong",{parentName:"p"},"drwxrwxr-x")," and the ownership ",(0,o.kt)("strong",{parentName:"p"},"lgtn:lgtn"),"."),(0,o.kt)("p",null,"On the other hand, if you have done the installation process as ",(0,o.kt)("strong",{parentName:"p"},"root")," superuser, you'll find that:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"The location of the directories and files goes under the ",(0,o.kt)("inlineCode",{parentName:"li"},"/root")," pathname"),(0,o.kt)("li",{parentName:"ul"},"The ownership is set to ",(0,o.kt)("strong",{parentName:"li"},"root:root"))),(0,o.kt)("p",null,"Learn more about ",(0,o.kt)("a",{parentName:"p",href:"https://www.linuxfoundation.org/blog/blog/classic-sysadmin-understanding-linux-file-permissions"},"file permissions")," from the ",(0,o.kt)("a",{parentName:"p",href:"https://www.linuxfoundation.org/"},"Linux Foundation"),"."),(0,o.kt)("p",null,"To learn more about file permission on Linux, read the ",(0,o.kt)("a",{parentName:"p",href:"https://www.linuxfoundation.org/blog/blog/classic-sysadmin-understanding-linux-file-permissions"},"Understanding Linux File Permissions"),"."),(0,o.kt)("h2",{id:"using-sudo-to-delegate-permissions"},"Using sudo to delegate permissions"),(0,o.kt)("p",null,"Consider file ownership and permissions to understand where the keystore is located. Take close attention when executing commands as an admin\u2013with or without ",(0,o.kt)("strong",{parentName:"p"},"super user")," (root) or ",(0,o.kt)("strong",{parentName:"p"},"sudo"),"."),(0,o.kt)("p",null,"If a command is executed without ",(0,o.kt)("strong",{parentName:"p"},"sudo")," then the generated output goes onto the ",(0,o.kt)("strong",{parentName:"p"},"user")," home."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"lgtn keys generate\n")),(0,o.kt)("p",null,"Resulting in having the ",(0,o.kt)("strong",{parentName:"p"},"keystore")," saved onto ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/username/.lightning/keystore"),"."),(0,o.kt)("p",null,"On the other hand, if a command is executed with ",(0,o.kt)("strong",{parentName:"p"},"sudo")," then the generated output is delegated to ",(0,o.kt)("strong",{parentName:"p"},"root")," directory."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo lgtn keys generate\n")),(0,o.kt)("p",null,"Resulting in having the ",(0,o.kt)("strong",{parentName:"p"},"keystore")," saved onto ",(0,o.kt)("inlineCode",{parentName:"p"},"/root/.lightning/keystore"),"."),(0,o.kt)("h2",{id:"user-home-directory"},"User $HOME directory"),(0,o.kt)("p",null,"The home directory is a directory that contains the personal files of a particular user of the system. On Linux, the ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME")," environment variable is set by the login program, which sets the user `$HOME`` accordingly. A user's home goes by the username, the user who's logged in."),(0,o.kt)("p",null,"For this reason, a user can change to the home directory by executing:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cd $HOME\n")),(0,o.kt)("p",null,"A shorthand allows a user to refer to their home directory simply as ",(0,o.kt)("inlineCode",{parentName:"p"},"~")," (tilde), as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~\n")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"We can find that the HOME or ~ (tilde) is highly dependent on the user who's logged in. Since we know that the user might delegate to ",(0,o.kt)("strong",{parentName:"p"},"root")," by the usage of ",(0,o.kt)("strong",{parentName:"p"},"sudo"),", this can help troubleshoot and explain the location of our files e.g. the keystore. In the section ",(0,o.kt)("a",{parentName:"p",href:"#set-the-locations-of-the-user-paths"},"Set the locations of the user paths"),", we learn how to define the location of our user configuration paths to avoid confusion. By doing it we ensure that when running the service, the service picks the correct configuration paths for our user.")),(0,o.kt)("p",null,"To learn more about the user $HOME directory read the wikipedia ",(0,o.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Home_directory"},"Home directory")," document."),(0,o.kt)("h2",{id:"set-the-locations-of-the-user-paths"},"Set the locations of the user paths"),(0,o.kt)(i.ZP,{mdxType:"FindAndReplaceConfigWithUserPaths"}),(0,o.kt)("h2",{id:"set-the-configuration-flag--c-on-the-service-unit-file"},"Set the configuration flag -c on the service unit file"),(0,o.kt)("p",null,"The following section assumes that a System service unit has been declared, and you're using systemctl to control the service, as described in our ",(0,o.kt)("a",{parentName:"p",href:"/docs/node/install#systemd-service-setup"},"Systemd Service Setup")," install section."),(0,o.kt)("p",null,"Open and edit the ",(0,o.kt)("strong",{parentName:"p"},"/etc/systemd/system/lightning.service")," file."),(0,o.kt)("p",null,"1) Replace ",(0,o.kt)("inlineCode",{parentName:"p"},"")," with YOUR username. For example, in the documentation we use the username ",(0,o.kt)("strong",{parentName:"p"},"lgtn"),", which means we'd replace ",(0,o.kt)("inlineCode",{parentName:"p"},"")," with ",(0,o.kt)("inlineCode",{parentName:"p"},"lgtn"),"."),(0,o.kt)("p",null,"2) Make sure that the ExecStart is set correctly, including the ",(0,o.kt)("inlineCode",{parentName:"p"},"-c")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home//.lightning/config.toml run\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,o.kt)("p",null,"For our example, as the username ",(0,o.kt)("strong",{parentName:"p"},"lgtn")," it would look like:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home/lgtn/.lightning/config.toml run\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,o.kt)("p",null,"When complete make sure the file is saved and the systemctl daemon is reloaded, as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,o.kt)("p",null,"Consequently, when a user manages the service via the systemctl, the Lightning CLI process will read the configuration file settings provided above. It includes the location of the user preferences, such as the keystore location amongst others, preventing confusion regardless of ",(0,o.kt)("strong",{parentName:"p"},"root")," delegation."),(0,o.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}c.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(7294);const o=e=>{let{image:t,name:n,title:o,url:a,communityMember:i=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:a,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:a,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},o),r.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file diff --git a/assets/js/5bc389a1.0b96f914.js b/assets/js/5bc389a1.3fe4b2bd.js similarity index 99% rename from assets/js/5bc389a1.0b96f914.js rename to assets/js/5bc389a1.3fe4b2bd.js index 7ef7c07a9..f06519e18 100644 --- a/assets/js/5bc389a1.0b96f914.js +++ b/assets/js/5bc389a1.3fe4b2bd.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[9829],{3905:(e,t,n)=>{n.d(t,{Zo:()=>h,kt:()=>g});var a=n(7294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},h=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,h=l(e,["components","mdxType","originalType","parentName"]),u=c(n),d=i,g=u["".concat(s,".").concat(d)]||u[d]||p[d]||o;return n?a.createElement(g,r(r({ref:t},h),{},{components:n})):a.createElement(g,r({ref:t},h))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:i,r[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>h,default:()=>k,frontMatter:()=>c,metadata:()=>u,toc:()=>d});var a=n(7462),i=(n(7294),n(3905)),o=n(3872);const r={toc:[]},l="wrapper";function s(e){let{components:t,...n}=e;return(0,i.kt)(l,(0,a.Z)({},r,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("admonition",{type:"warning"},(0,i.kt)("p",{parentName:"admonition"},"During testnet phase, you have to checkout to the testnet branch. For example, the first testnet branch name was ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning/tree/testnet-alpha-1"},"testnet-alpha-1")," that you would have to be checked in order to run a node successfully. A list of the active branches can be found at anytime in the GitHub repository ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning/branches"},"active branches"),". While we try our best to update documentation, guides, instructions or any other written content during development, there might be breaking changes that might take some time to reflect in our documents. To avoid disappointment, check into the correct branch or contribute by getting in touch with us, or sending a PR in the relevant context, thank you!")))}s.isMDXComponent=!0;const c={title:"Updating Lightning",hide_title:!0,slug:"updating-lightning",date:new Date("2023-09-19T12:00:00.000Z"),image:"./assets/updating-lightning.png?202309191740",description:"A step-by-step guide to update the Lightning CLI from source code and Service setup",category:"Tutorial",tags:["update","rebuild","guide","setup","configuration"]},h=void 0,u={unversionedId:"Node Operators/updating-lightning",id:"Node Operators/updating-lightning",title:"Updating Lightning",description:"A step-by-step guide to update the Lightning CLI from source code and Service setup",source:"@site/guides/Node Operators/updating-lightning.md",sourceDirName:"Node Operators",slug:"/Node Operators/updating-lightning",permalink:"/guides/Node Operators/updating-lightning",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/guides/Node Operators/updating-lightning.md",tags:[{label:"update",permalink:"/guides/tags/update"},{label:"rebuild",permalink:"/guides/tags/rebuild"},{label:"guide",permalink:"/guides/tags/guide"},{label:"setup",permalink:"/guides/tags/setup"},{label:"configuration",permalink:"/guides/tags/configuration"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Updating Lightning",hide_title:!0,slug:"updating-lightning",date:"2023-09-19T12:00:00.000Z",image:"./assets/updating-lightning.png?202309191740",description:"A step-by-step guide to update the Lightning CLI from source code and Service setup",category:"Tutorial",tags:["update","rebuild","guide","setup","configuration"]},sidebar:"defaultSidebar",previous:{title:"Transfering setup ownership",permalink:"/guides/Node Operators/transfering-setup-ownership"}},p={image:n(2913).Z},d=[{value:"Introduction",id:"introduction",level:2},{value:"Pre-requisites",id:"pre-requisites",level:2},{value:"Pulling the latest changes",id:"pulling-the-latest-changes",level:2},{value:"Switch to installer username",id:"switch-to-installer-username",level:3},{value:"Change directory to the source code",id:"change-directory-to-the-source-code",level:3},{value:"Checkout to branch",id:"checkout-to-branch",level:3},{value:"Pull the latest changes",id:"pull-the-latest-changes",level:3},{value:"Build the binary from the source code",id:"build-the-binary-from-the-source-code",level:2},{value:"Checkup the symlink setup",id:"checkup-the-symlink-setup",level:2},{value:"Systemd service",id:"systemd-service",level:2},{value:"Verify the setup",id:"verify-the-setup",level:3},{value:"Launching the node as a systemd service",id:"launching-the-node-as-a-systemd-service",level:3},{value:"Health check",id:"health-check",level:2},{value:"Conclusion",id:"conclusion",level:2}],g={toc:d},m="wrapper";function k(e){let{components:t,...r}=e;return(0,i.kt)(m,(0,a.Z)({},g,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Update Lightning",src:n(2913).Z,width:"1450",height:"816"})),(0,i.kt)("h2",{id:"introduction"},"Introduction"),(0,i.kt)("p",null,"Fleek Network's Lightning source code is updated frequently and thus keeping up with changes can be a bit of a chore and especially difficult for users who are trying to have it compiled for the first time, or updating the Lightning CLI binary for their operating systems. While we should have stable releases in the future, at the current phase of development, there's a requirement to follow the contributions directly in the repository: checking in and out, the commits you're interested in running."),(0,i.kt)("p",null,"In the following guide, we\u2019ll have a simple look into how to pull changes and update Lightning CLI on Linux, which we stick with Ubuntu for simplicity but should be easily transferrable to your ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"supported OS"),". "),(0,i.kt)("h2",{id:"pre-requisites"},"Pre-requisites"),(0,i.kt)("p",null,"To follow the guide, you will need the following:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Familiarity with the command-line interface"),(0,i.kt)("li",{parentName:"ul"},"Some experience with Git"),(0,i.kt)("li",{parentName:"ul"},"Have installed and set up the Lightning CLI and service")),(0,i.kt)("h2",{id:"pulling-the-latest-changes"},"Pulling the latest changes"),(0,i.kt)("p",null,"Check the latest contributions pushed to the Lightning CLI ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning/commits/main"},"main branch"),", it'll give you clarity on what's been committed into the source code. Therefore, find out about new features, fixes, improvements, etc by looking directly into the repository history."),(0,i.kt)("h3",{id:"switch-to-installer-username"},"Switch to installer username"),(0,i.kt)("p",null,"First, switch to the username you've used to install and setup Fleek Network Lightning."),(0,i.kt)("p",null,"To switch to the username you've used throughout the installation process do:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"su \n")),(0,i.kt)("p",null,"For example, if you used the username ",(0,i.kt)("inlineCode",{parentName:"p"},"lgtn")," it'll look like the following command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"su lgtn\n")),(0,i.kt)("h3",{id:"change-directory-to-the-source-code"},"Change directory to the source code"),(0,i.kt)("p",null,"Next, ",(0,i.kt)("inlineCode",{parentName:"p"},"change directory")," to the Lightning directory in your file system. "),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"The tild ",(0,i.kt)("inlineCode",{parentName:"p"},"~")," means user $HOME, thus you have to be logged in with the correct user as requested in the ",(0,i.kt)("a",{parentName:"p",href:"#switch-to-installer-username"},"installer username")," step.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"cd \n")),(0,i.kt)("p",null,"If you have installed it via the recommended instructions, then the default location where the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"source code")," is stored should be ",(0,i.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning"),". Otherwise, if you opted-in for a custom location then look into your notes before proceeding."),(0,i.kt)("p",null,"For example, it'd look like the following command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,i.kt)("h3",{id:"checkout-to-branch"},"Checkout to branch"),(0,i.kt)("p",null,"Make sure that you are checked in to the correct branch. For example, if that'd be the first testnet phase it'd be called ",(0,i.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git checkout \n")),(0,i.kt)("p",null,"Here's an example of how the command would look like for the main default branch with corresponding name ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git checkout main\n")),(0,i.kt)(s,{mdxType:"CheckoutCommitWarning"}),(0,i.kt)("p",null,"Here's an example of how the command would look like for the branch name ",(0,i.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git checkout testnet-alpha-1\n")),(0,i.kt)("h3",{id:"pull-the-latest-changes"},"Pull the latest changes"),(0,i.kt)("p",null,"The syntax to pull the latest commits is the following:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git pull \n")),(0,i.kt)("p",null,"The git pull command is used to fetch and merge changes from the remote repository to the local repository. Here we're pulling from remote named ",(0,i.kt)("inlineCode",{parentName:"p"},"origin")," and branch ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),". "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git pull origin main\n")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"If you've made any changes in the local repository directory, clear them to prevent being blocked. As ",(0,i.kt)("inlineCode",{parentName:"p"},"git")," is a ",(0,i.kt)("inlineCode",{parentName:"p"},"version control")," program that looks for changes and will ask you to do something about it to prevent losing data. Most readers can disregard changes if not contributing to the development by simply ",(0,i.kt)("a",{parentName:"p",href:"https://git-scm.com/docs/git-stash"},"stashing")," or resetting the changes."),(0,i.kt)("p",{parentName:"admonition"},"A quick way to clean is to ",(0,i.kt)("inlineCode",{parentName:"p"},"stash")," the changes, for example:"),(0,i.kt)("pre",{parentName:"admonition"},(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git stash \n"))),(0,i.kt)("p",null,"You can check yourself, as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git remote -v\n")),(0,i.kt)("p",null,"Our output clearly describes what ",(0,i.kt)("inlineCode",{parentName:"p"},"origin")," is tracking."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"origin git@github.com:fleek-network/lightning.git (fetch)\norigin git@github.com:fleek-network/lightning.git (push)\n")),(0,i.kt)("p",null,"Alternatively, you can stash and pull, to reset the repository to the origin."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git fetch origin \ngit reset --hard origin/\ngit clean -f\n")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"With ",(0,i.kt)("inlineCode",{parentName:"p"},"git")," you can point to any point in the repository history, there might be lots of reasons you'd want to check into a certain commit or branch, e.g. if you encounter bugs and need to revert to a previous commit or version. That being said, we welcome all kinds of contributions, such as simply reporting bugs. To report issues in our repository visit the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning/issues"},"issues")," page to help us improve.")),(0,i.kt)("p",null,"Here's the output we got after the git pull:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"remote: Enumerating objects: 437, done.\nremote: Counting objects: 100% (437/437), done.\nremote: Compressing objects: 100% (205/205), done.\nremote: Total 397 (delta 242), reused 334 (delta 181), pack-reused 0\nReceiving objects: 100% (397/397), 214.68 KiB | 4.77 MiB/s, done.\nResolving deltas: 100% (242/242), completed with 29 local objects.\nFrom https://github.com/fleek-network/lightning\n * branch main -> FETCH_HEAD\n 12b2647..998108d main -> origin/main\nUpdating 12b2647..998108d\nFast-forward\n .dockerignore | 6 -\n .gitignore | 2 +\n Cargo.lock | 782 +++++++----------------\n Cargo.toml | 2 +-\n core/application/src/state.rs | 12 +-\n core/cli/Cargo.toml | 47 ++\n core/cli/readme.md | 59 ++\n core/cli/src/args.rs | 63 ++\n core/cli/src/cli.rs | 136 ++++\n core/cli/src/commands/dev.rs | 112 ++++\n core/cli/src/commands/key.rs | 92 +++\n\n ...\n")),(0,i.kt)("p",null,"When your local version of the repository, is up-to-date with the remote repository, you'd get:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"From https://github.com/fleek-network/lightning\n * branch main -> FETCH_HEAD\nAlready up to date.\n")),(0,i.kt)("p",null,'A "already up to date" message means that you have the latest version of the source code and can proceed with compiling the binary process from the source code to override the ',(0,i.kt)("inlineCode",{parentName:"p"},"Lightning CLI")," version you're on. You can also make any other setup changes that might find necessary. Some changes might be related to the recommended setup of Systemd Service that helps control the Fleek Network Lightning Node binary process, etc."),(0,i.kt)("h2",{id:"build-the-binary-from-the-source-code"},"Build the binary from the source code"),(0,i.kt)("p",null,"We're assuming that your system setup hasn't changed, such as Rust toolchain still being installed and setup correctly in the system and any other required dependencies. If you have made changes to your system and need to revisit the setup instructions, check our install document ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/install"},"here"),"."),(0,i.kt)("p",null,"First, switch the user and change directory to the Lightning directory in your file system as described in ",(0,i.kt)("a",{parentName:"p",href:"#switch-to-installer-username"},"switch to installer username")," ",(0,i.kt)("a",{parentName:"p",href:"#change-directory-to-the-source-code"},"change directory to the source code")," sections."),(0,i.kt)("p",null,"Recall the command from our install document or getting started guide? As you probably guessed, you need to execute the rust cargo build command. But firstly, we are going to clean and update the Rust package manager, as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"cargo clean\ncargo update\n")),(0,i.kt)("p",null,"Next, execute the build command to compile the Fleek Network Lightning CLI binary."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"cargo +stable build --release\n")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"The build command uses the Rust compiler, which might take a while depending on how speedy the host machine is capable.")),(0,i.kt)("p",null,"Once the Rust compiler completes, the generated binary will be available in the source code project directory. "),(0,i.kt)("p",null,"If you have stick with the default recommendation, that'll be at ",(0,i.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/target/release/lightning-node"),"."),(0,i.kt)("h2",{id:"checkup-the-symlink-setup"},"Checkup the symlink setup"),(0,i.kt)("p",null,"During the original install and setup process, a symbolic link (symlink) was created linking the generated binary file located in ",(0,i.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/target/release/lightning-node")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"/usr/local/bin/lgtn"),". By placing the symlink in the the default installation location of the user, the executable application is available globally as ",(0,i.kt)("inlineCode",{parentName:"p"},"lgtn"),"."),(0,i.kt)("p",null,"You can see the full absolute path of the symlink and verify if setup correctly by running:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"readlink -f \n")),(0,i.kt)("p",null,"If you have followed the recommended name, the symbolic link should be called ",(0,i.kt)("inlineCode",{parentName:"p"},"lgtn"),", short version for ",(0,i.kt)("inlineCode",{parentName:"p"},"lightning"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"readlink -f lgtn\n")),(0,i.kt)("p",null,"Here's an example where we find the symlink ",(0,i.kt)("inlineCode",{parentName:"p"},"lgtn")," pointing to the absolute path where our source code and originated built binary is located, as described in the ",(0,i.kt)("a",{parentName:"p",href:"#build-the-binary-from-the-source-code"},"build the binary from the source code")," section."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"/home//fleek-network/lightning/target/release/lightning-node\n")),(0,i.kt)("p",null,"Alternatively, you can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"ls")," command to identify the symlink."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"ls -la $(which lgtn)\n")),(0,i.kt)("p",null,"If you find an error, it's very likely that a symlink is not setup. You can revisit the ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/install"},"installation")," to learn, or execute the command to link the build binary to the user default install location:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},'sudo ln -s "~/fleek-network/lightning/target/release/lightning-node" /usr/local/bin/lgtn\n')),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"Make sure that the paths provided to the command ",(0,i.kt)("inlineCode",{parentName:"p"},"ln")," are correct. If you are using customized pathnames or switched to a different username other than the one used for installation it has to change accordingly.")),(0,i.kt)("h2",{id:"systemd-service"},"Systemd service"),(0,i.kt)("p",null,"It's highly recommended to use systemd to manage the Fleek Network service for node operators. Systemd is a system and service manager for Linux operating systems that provides a consistent way to manage system services across various distributions."),(0,i.kt)("h3",{id:"verify-the-setup"},"Verify the setup"),(0,i.kt)("p",null,"The recommended setup is to wrap the Lightning binary process as a Systemd service, as instructed in the ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/install"},"install")," section."),(0,i.kt)("p",null,"If you have followed the recommendations, you should have the service file called ",(0,i.kt)("inlineCode",{parentName:"p"},"ligthning.service")," in the path ",(0,i.kt)("inlineCode",{parentName:"p"},"/etc/systemd/system/lightning.service"),"."),(0,i.kt)("p",null,"The content of ",(0,i.kt)("inlineCode",{parentName:"p"},"lightning.service")," should have some or more of the following properties and values:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home/lgtn/.lightning/config.toml run\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,i.kt)("p",null,"Every time the file is modified, the Systemd process should be reloaded. You can do this by executing:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,i.kt)("p",null,"To learn more about how to create a Systemd service read the ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/install#manual-installation"},"manual installation")," document that illustrates the steps required in greater detail."),(0,i.kt)("h3",{id:"launching-the-node-as-a-systemd-service"},"Launching the node as a systemd service"),(0,i.kt)("p",null,"After completing all the steps and checkups mentioned throughout the guide, you should have the Fleek Network Lightning Service ready to go."),(0,i.kt)("p",null,"To launch the service, execute the following command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl start lightning.service\n")),(0,i.kt)("p",null,"To learn more about how to use Systemctl to manage the Lightning service, read the document ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/install#use-systemctl-to-manage-systemd-service"},"here"),"."),(0,i.kt)("h2",{id:"health-check"},"Health check"),(0,i.kt)("p",null,"First, complete all the steps and checkups mentioned throught the guide and once the Node process is running perform a health check."),(0,i.kt)("p",null,"To run a quick health checkup, send a GET request to ",(0,i.kt)("inlineCode",{parentName:"p"},"/health")," endpoint of the RPC on ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/requirements#ports"},"port")," 4230."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},'curl -w "\\p" localhost:4230/health\n')),(0,i.kt)("p",null,"If successful, you should get the response ",(0,i.kt)("inlineCode",{parentName:"p"},"running and staked"),", as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"running and staked\n")),(0,i.kt)("p",null,"If you'd like to learn more about health check, visit the section ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/health-check"},"health check")," of our documentation."),(0,i.kt)("h2",{id:"conclusion"},"Conclusion"),(0,i.kt)("p",null,"The Fleek Network's Ursa CLI is in constant development, there are frequent changes that can introduce features, fixes, and performance improvements, but also breaking changes that in some cases require you to add, including new libraries or packages in your operating system."),(0,i.kt)("p",null,"In the current phase of development, a proper software release cycle for the updates is still in development, thus we pick changes from the source repository to build the Lightning application."),(0,i.kt)("p",null,"We have looked into how to pull the changes via Git, and discussed that contributions can introduce new requirements to the host operating system that leads to updates or changes in the documentation\u2013mentioning how hard it is to keep in sync. Explained how to look into the contributions to understand the nature of the change and get hints about new features."),(0,i.kt)("p",null,"To complete, provided a step-by-step walkthrough the installation and setup process for the Fleek Network Lightning CLI and Systemd service."),(0,i.kt)("p",null,"Discover more about the project by ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"watching/contributing on GitHub"),", following us on ",(0,i.kt)("a",{parentName:"p",href:"https://twitter.com/fleek_net"},"Twitter"),", and joining ",(0,i.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"our community Discord")," for any updates."),(0,i.kt)(o.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}k.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>i});var a=n(7294);const i=e=>{let{image:t,name:n,title:i,url:o,communityMember:r=!1}=e;return a.createElement("section",{className:"author_card"},a.createElement("div",null,a.createElement("span",{className:"avatar"},a.createElement("a",{href:o,target:"_blank",alt:n},a.createElement("img",{src:t,alt:n}))),a.createElement("div",null,a.createElement("span",{className:"name"},a.createElement("a",{href:o,target:"_blank",alt:n},n)),a.createElement("span",{className:"title"},i),a.createElement("span",{className:"discord"},r?"Join our community on":"Got questions? Find us on"," ",a.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}},2913:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/updating-lightning-e5c2633345bdcc0db715dd87b269b25b.png"}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[9829],{3905:(e,t,n)=>{n.d(t,{Zo:()=>h,kt:()=>g});var a=n(7294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},h=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,h=l(e,["components","mdxType","originalType","parentName"]),u=c(n),d=i,g=u["".concat(s,".").concat(d)]||u[d]||p[d]||o;return n?a.createElement(g,r(r({ref:t},h),{},{components:n})):a.createElement(g,r({ref:t},h))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:i,r[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>h,default:()=>k,frontMatter:()=>c,metadata:()=>u,toc:()=>d});var a=n(7462),i=(n(7294),n(3905)),o=n(3872);const r={toc:[]},l="wrapper";function s(e){let{components:t,...n}=e;return(0,i.kt)(l,(0,a.Z)({},r,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("admonition",{type:"warning"},(0,i.kt)("p",{parentName:"admonition"},"During testnet phase, you have to checkout to the testnet branch. For example, the first testnet branch name was ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning/tree/testnet-alpha-1"},"testnet-alpha-1")," that you would have to be checked in order to run a node successfully. A list of the active branches can be found at anytime in the GitHub repository ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning/branches"},"active branches"),". While we try our best to update documentation, guides, instructions or any other written content during development, there might be breaking changes that might take some time to reflect in our documents. To avoid disappointment, check into the correct branch or contribute by getting in touch with us, or sending a PR in the relevant context, thank you!")))}s.isMDXComponent=!0;const c={title:"Updating Lightning",hide_title:!0,slug:"updating-lightning",date:new Date("2023-09-19T12:00:00.000Z"),image:"./assets/updating-lightning.png?202309191740",description:"A step-by-step guide to update the Lightning CLI from source code and Service setup",category:"Tutorial",tags:["update","rebuild","guide","setup","configuration"]},h=void 0,u={unversionedId:"Node Operators/updating-lightning",id:"Node Operators/updating-lightning",title:"Updating Lightning",description:"A step-by-step guide to update the Lightning CLI from source code and Service setup",source:"@site/guides/Node Operators/updating-lightning.md",sourceDirName:"Node Operators",slug:"/Node Operators/updating-lightning",permalink:"/guides/Node Operators/updating-lightning",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/guides/Node Operators/updating-lightning.md",tags:[{label:"update",permalink:"/guides/tags/update"},{label:"rebuild",permalink:"/guides/tags/rebuild"},{label:"guide",permalink:"/guides/tags/guide"},{label:"setup",permalink:"/guides/tags/setup"},{label:"configuration",permalink:"/guides/tags/configuration"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Updating Lightning",hide_title:!0,slug:"updating-lightning",date:"2023-09-19T12:00:00.000Z",image:"./assets/updating-lightning.png?202309191740",description:"A step-by-step guide to update the Lightning CLI from source code and Service setup",category:"Tutorial",tags:["update","rebuild","guide","setup","configuration"]},sidebar:"defaultSidebar",previous:{title:"Transfering setup ownership",permalink:"/guides/Node Operators/transfering-setup-ownership"}},p={image:n(2913).Z},d=[{value:"Introduction",id:"introduction",level:2},{value:"Pre-requisites",id:"pre-requisites",level:2},{value:"Pulling the latest changes",id:"pulling-the-latest-changes",level:2},{value:"Switch to installer username",id:"switch-to-installer-username",level:3},{value:"Change directory to the source code",id:"change-directory-to-the-source-code",level:3},{value:"Checkout to branch",id:"checkout-to-branch",level:3},{value:"Pull the latest changes",id:"pull-the-latest-changes",level:3},{value:"Build the binary from the source code",id:"build-the-binary-from-the-source-code",level:2},{value:"Checkup the symlink setup",id:"checkup-the-symlink-setup",level:2},{value:"Systemd service",id:"systemd-service",level:2},{value:"Verify the setup",id:"verify-the-setup",level:3},{value:"Launching the node as a systemd service",id:"launching-the-node-as-a-systemd-service",level:3},{value:"Health check",id:"health-check",level:2},{value:"Conclusion",id:"conclusion",level:2}],g={toc:d},m="wrapper";function k(e){let{components:t,...r}=e;return(0,i.kt)(m,(0,a.Z)({},g,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"Update Lightning",src:n(2913).Z,width:"1450",height:"816"})),(0,i.kt)("h2",{id:"introduction"},"Introduction"),(0,i.kt)("p",null,"Fleek Network's Lightning source code is updated frequently and thus keeping up with changes can be a bit of a chore and especially difficult for users who are trying to have it compiled for the first time, or updating the Lightning CLI binary for their operating systems. While we should have stable releases in the future, at the current phase of development, there's a requirement to follow the contributions directly in the repository: checking in and out, the commits you're interested in running."),(0,i.kt)("p",null,"In the following guide, we\u2019ll have a simple look into how to pull changes and update Lightning CLI on Linux, which we stick with Ubuntu for simplicity but should be easily transferrable to your ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"supported OS"),". "),(0,i.kt)("h2",{id:"pre-requisites"},"Pre-requisites"),(0,i.kt)("p",null,"To follow the guide, you will need the following:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Familiarity with the command-line interface"),(0,i.kt)("li",{parentName:"ul"},"Some experience with Git"),(0,i.kt)("li",{parentName:"ul"},"Have installed and set up the Lightning CLI and service")),(0,i.kt)("h2",{id:"pulling-the-latest-changes"},"Pulling the latest changes"),(0,i.kt)("p",null,"Check the latest contributions pushed to the Lightning CLI ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning/commits/main"},"main branch"),", it'll give you clarity on what's been committed into the source code. Therefore, find out about new features, fixes, improvements, etc by looking directly into the repository history."),(0,i.kt)("h3",{id:"switch-to-installer-username"},"Switch to installer username"),(0,i.kt)("p",null,"First, switch to the username you've used to install and setup Fleek Network Lightning."),(0,i.kt)("p",null,"To switch to the username you've used throughout the installation process do:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"su \n")),(0,i.kt)("p",null,"For example, if you used the username ",(0,i.kt)("inlineCode",{parentName:"p"},"lgtn")," it'll look like the following command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"su lgtn\n")),(0,i.kt)("h3",{id:"change-directory-to-the-source-code"},"Change directory to the source code"),(0,i.kt)("p",null,"Next, ",(0,i.kt)("inlineCode",{parentName:"p"},"change directory")," to the Lightning directory in your file system. "),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"The tild ",(0,i.kt)("inlineCode",{parentName:"p"},"~")," means user $HOME, thus you have to be logged in with the correct user as requested in the ",(0,i.kt)("a",{parentName:"p",href:"#switch-to-installer-username"},"installer username")," step.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"cd \n")),(0,i.kt)("p",null,"If you have installed it via the recommended instructions, then the default location where the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"source code")," is stored should be ",(0,i.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning"),". Otherwise, if you opted-in for a custom location then look into your notes before proceeding."),(0,i.kt)("p",null,"For example, it'd look like the following command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,i.kt)("h3",{id:"checkout-to-branch"},"Checkout to branch"),(0,i.kt)("p",null,"Make sure that you are checked in to the correct branch. For example, if that'd be the first testnet phase it'd be called ",(0,i.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git checkout \n")),(0,i.kt)("p",null,"Here's an example of how the command would look like for the main default branch with corresponding name ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git checkout main\n")),(0,i.kt)(s,{mdxType:"CheckoutCommitWarning"}),(0,i.kt)("p",null,"Here's an example of how the command would look like for the branch name ",(0,i.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git checkout testnet-alpha-1\n")),(0,i.kt)("h3",{id:"pull-the-latest-changes"},"Pull the latest changes"),(0,i.kt)("p",null,"The syntax to pull the latest commits is the following:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git pull \n")),(0,i.kt)("p",null,"The git pull command is used to fetch and merge changes from the remote repository to the local repository. Here we're pulling from remote named ",(0,i.kt)("inlineCode",{parentName:"p"},"origin")," and branch ",(0,i.kt)("inlineCode",{parentName:"p"},"main"),". "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git pull origin main\n")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"If you've made any changes in the local repository directory, clear them to prevent being blocked. As ",(0,i.kt)("inlineCode",{parentName:"p"},"git")," is a ",(0,i.kt)("inlineCode",{parentName:"p"},"version control")," program that looks for changes and will ask you to do something about it to prevent losing data. Most readers can disregard changes if not contributing to the development by simply ",(0,i.kt)("a",{parentName:"p",href:"https://git-scm.com/docs/git-stash"},"stashing")," or resetting the changes."),(0,i.kt)("p",{parentName:"admonition"},"A quick way to clean is to ",(0,i.kt)("inlineCode",{parentName:"p"},"stash")," the changes, for example:"),(0,i.kt)("pre",{parentName:"admonition"},(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git stash \n"))),(0,i.kt)("p",null,"You can check yourself, as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git remote -v\n")),(0,i.kt)("p",null,"Our output clearly describes what ",(0,i.kt)("inlineCode",{parentName:"p"},"origin")," is tracking."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"origin git@github.com:fleek-network/lightning.git (fetch)\norigin git@github.com:fleek-network/lightning.git (push)\n")),(0,i.kt)("p",null,"Alternatively, you can stash and pull, to reset the repository to the origin."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"git fetch origin \ngit reset --hard origin/\ngit clean -f\n")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"With ",(0,i.kt)("inlineCode",{parentName:"p"},"git")," you can point to any point in the repository history, there might be lots of reasons you'd want to check into a certain commit or branch, e.g. if you encounter bugs and need to revert to a previous commit or version. That being said, we welcome all kinds of contributions, such as simply reporting bugs. To report issues in our repository visit the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning/issues"},"issues")," page to help us improve.")),(0,i.kt)("p",null,"Here's the output we got after the git pull:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"remote: Enumerating objects: 437, done.\nremote: Counting objects: 100% (437/437), done.\nremote: Compressing objects: 100% (205/205), done.\nremote: Total 397 (delta 242), reused 334 (delta 181), pack-reused 0\nReceiving objects: 100% (397/397), 214.68 KiB | 4.77 MiB/s, done.\nResolving deltas: 100% (242/242), completed with 29 local objects.\nFrom https://github.com/fleek-network/lightning\n * branch main -> FETCH_HEAD\n 12b2647..998108d main -> origin/main\nUpdating 12b2647..998108d\nFast-forward\n .dockerignore | 6 -\n .gitignore | 2 +\n Cargo.lock | 782 +++++++----------------\n Cargo.toml | 2 +-\n core/application/src/state.rs | 12 +-\n core/cli/Cargo.toml | 47 ++\n core/cli/readme.md | 59 ++\n core/cli/src/args.rs | 63 ++\n core/cli/src/cli.rs | 136 ++++\n core/cli/src/commands/dev.rs | 112 ++++\n core/cli/src/commands/key.rs | 92 +++\n\n ...\n")),(0,i.kt)("p",null,"When your local version of the repository, is up-to-date with the remote repository, you'd get:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"From https://github.com/fleek-network/lightning\n * branch main -> FETCH_HEAD\nAlready up to date.\n")),(0,i.kt)("p",null,'A "already up to date" message means that you have the latest version of the source code and can proceed with compiling the binary process from the source code to override the ',(0,i.kt)("inlineCode",{parentName:"p"},"Lightning CLI")," version you're on. You can also make any other setup changes that might find necessary. Some changes might be related to the recommended setup of Systemd Service that helps control the Fleek Network Lightning Node binary process, etc."),(0,i.kt)("h2",{id:"build-the-binary-from-the-source-code"},"Build the binary from the source code"),(0,i.kt)("p",null,"We're assuming that your system setup hasn't changed, such as Rust toolchain still being installed and setup correctly in the system and any other required dependencies. If you have made changes to your system and need to revisit the setup instructions, check our install document ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/install"},"here"),"."),(0,i.kt)("p",null,"First, switch the user and change directory to the Lightning directory in your file system as described in ",(0,i.kt)("a",{parentName:"p",href:"#switch-to-installer-username"},"switch to installer username")," ",(0,i.kt)("a",{parentName:"p",href:"#change-directory-to-the-source-code"},"change directory to the source code")," sections."),(0,i.kt)("p",null,"Recall the command from our install document or getting started guide? As you probably guessed, you need to execute the rust cargo build command. But firstly, we are going to clean and update the Rust package manager, as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"cargo clean\ncargo update\n")),(0,i.kt)("p",null,"Next, execute the build command to compile the Fleek Network Lightning CLI binary."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"cargo +stable build --release\n")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"The build command uses the Rust compiler, which might take a while depending on how speedy the host machine is capable.")),(0,i.kt)("p",null,"Once the Rust compiler completes, the generated binary will be available in the source code project directory. "),(0,i.kt)("p",null,"If you have stick with the default recommendation, that'll be at ",(0,i.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/target/release/lightning-node"),"."),(0,i.kt)("h2",{id:"checkup-the-symlink-setup"},"Checkup the symlink setup"),(0,i.kt)("p",null,"During the original install and setup process, a symbolic link (symlink) was created linking the generated binary file located in ",(0,i.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/target/release/lightning-node")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"/usr/local/bin/lgtn"),". By placing the symlink in the the default installation location of the user, the executable application is available globally as ",(0,i.kt)("inlineCode",{parentName:"p"},"lgtn"),"."),(0,i.kt)("p",null,"You can see the full absolute path of the symlink and verify if setup correctly by running:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"readlink -f \n")),(0,i.kt)("p",null,"If you have followed the recommended name, the symbolic link should be called ",(0,i.kt)("inlineCode",{parentName:"p"},"lgtn"),", short version for ",(0,i.kt)("inlineCode",{parentName:"p"},"lightning"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"readlink -f lgtn\n")),(0,i.kt)("p",null,"Here's an example where we find the symlink ",(0,i.kt)("inlineCode",{parentName:"p"},"lgtn")," pointing to the absolute path where our source code and originated built binary is located, as described in the ",(0,i.kt)("a",{parentName:"p",href:"#build-the-binary-from-the-source-code"},"build the binary from the source code")," section."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"/home//fleek-network/lightning/target/release/lightning-node\n")),(0,i.kt)("p",null,"Alternatively, you can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"ls")," command to identify the symlink."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"ls -la $(which lgtn)\n")),(0,i.kt)("p",null,"If you find an error, it's very likely that a symlink is not setup. You can revisit the ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/install"},"installation")," to learn, or execute the command to link the build binary to the user default install location:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},'sudo ln -s "~/fleek-network/lightning/target/release/lightning-node" /usr/local/bin/lgtn\n')),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"Make sure that the paths provided to the command ",(0,i.kt)("inlineCode",{parentName:"p"},"ln")," are correct. If you are using customized pathnames or switched to a different username other than the one used for installation it has to change accordingly.")),(0,i.kt)("h2",{id:"systemd-service"},"Systemd service"),(0,i.kt)("p",null,"It's highly recommended to use systemd to manage the Fleek Network service for node operators. Systemd is a system and service manager for Linux operating systems that provides a consistent way to manage system services across various distributions."),(0,i.kt)("h3",{id:"verify-the-setup"},"Verify the setup"),(0,i.kt)("p",null,"The recommended setup is to wrap the Lightning binary process as a Systemd service, as instructed in the ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/install"},"install")," section."),(0,i.kt)("p",null,"If you have followed the recommendations, you should have the service file called ",(0,i.kt)("inlineCode",{parentName:"p"},"ligthning.service")," in the path ",(0,i.kt)("inlineCode",{parentName:"p"},"/etc/systemd/system/lightning.service"),"."),(0,i.kt)("p",null,"The content of ",(0,i.kt)("inlineCode",{parentName:"p"},"lightning.service")," should have some or more of the following properties and values:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"[Unit]\nDescription=Fleek Network Node lightning service\n\n[Service]\nType=simple\nMemoryHigh=32G\nRestartSec=15s\nRestart=always\nExecStart=lgtn -c /home/lgtn/.lightning/config.toml run\nStandardOutput=append:/var/log/lightning/output.log\nStandardError=append:/var/log/lightning/diagnostic.log\nEnvironment=TMPDIR=/var/tmp\n\n[Install]\nWantedBy=multi-user.target\n")),(0,i.kt)("p",null,"Every time the file is modified, the Systemd process should be reloaded. You can do this by executing:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,i.kt)("p",null,"To learn more about how to create a Systemd service read the ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/install#manual-installation"},"manual installation")," document that illustrates the steps required in greater detail."),(0,i.kt)("h3",{id:"launching-the-node-as-a-systemd-service"},"Launching the node as a systemd service"),(0,i.kt)("p",null,"After completing all the steps and checkups mentioned throughout the guide, you should have the Fleek Network Lightning Service ready to go."),(0,i.kt)("p",null,"To launch the service, execute the following command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl start lightning.service\n")),(0,i.kt)("p",null,"To learn more about how to use Systemctl to manage the Lightning service, read the document ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/install#use-systemctl-to-manage-systemd-service"},"here"),"."),(0,i.kt)("h2",{id:"health-check"},"Health check"),(0,i.kt)("p",null,"First, complete all the steps and checkups mentioned throught the guide and once the Node process is running perform a health check."),(0,i.kt)("p",null,"To run a quick health checkup, send a GET request to ",(0,i.kt)("inlineCode",{parentName:"p"},"/health")," endpoint of the RPC on ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/requirements#ports"},"port")," 4230."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},'curl -w "\\p" localhost:4230/health\n')),(0,i.kt)("p",null,"If successful, you should get the response ",(0,i.kt)("inlineCode",{parentName:"p"},"running and staked"),", as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"running and staked\n")),(0,i.kt)("p",null,"If you'd like to learn more about health check, visit the section ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/health-check"},"health check")," of our documentation."),(0,i.kt)("h2",{id:"conclusion"},"Conclusion"),(0,i.kt)("p",null,"The Fleek Network's Ursa CLI is in constant development, there are frequent changes that can introduce features, fixes, and performance improvements, but also breaking changes that in some cases require you to add, including new libraries or packages in your operating system."),(0,i.kt)("p",null,"In the current phase of development, a proper software release cycle for the updates is still in development, thus we pick changes from the source repository to build the Lightning application."),(0,i.kt)("p",null,"We have looked into how to pull the changes via Git, and discussed that contributions can introduce new requirements to the host operating system that leads to updates or changes in the documentation\u2013mentioning how hard it is to keep in sync. Explained how to look into the contributions to understand the nature of the change and get hints about new features."),(0,i.kt)("p",null,"To complete, provided a step-by-step walkthrough the installation and setup process for the Fleek Network Lightning CLI and Systemd service."),(0,i.kt)("p",null,"Discover more about the project by ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"watching/contributing on GitHub"),", following us on ",(0,i.kt)("a",{parentName:"p",href:"https://twitter.com/fleek_net"},"Twitter"),", and joining ",(0,i.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"our community Discord")," for any updates."),(0,i.kt)(o.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}k.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>i});var a=n(7294);const i=e=>{let{image:t,name:n,title:i,url:o,communityMember:r=!1}=e;return a.createElement("section",{className:"author_card"},a.createElement("div",null,a.createElement("span",{className:"avatar"},a.createElement("a",{href:o,target:"_blank",alt:n},a.createElement("img",{src:t,alt:n}))),a.createElement("div",null,a.createElement("span",{className:"name"},a.createElement("a",{href:o,target:"_blank",alt:n},n)),a.createElement("span",{className:"title"},i),a.createElement("span",{className:"discord"},r?"Join our community on":"Got questions? Find us on"," ",a.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}},2913:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/updating-lightning-e5c2633345bdcc0db715dd87b269b25b.png"}}]); \ No newline at end of file diff --git a/assets/js/6be32138.c839bfac.js b/assets/js/6be32138.ee48b118.js similarity index 99% rename from assets/js/6be32138.c839bfac.js rename to assets/js/6be32138.ee48b118.js index 1f41699a2..ae597a1c3 100644 --- a/assets/js/6be32138.c839bfac.js +++ b/assets/js/6be32138.ee48b118.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[3396],{3905:(e,t,i)=>{i.d(t,{Zo:()=>h,kt:()=>f});var o=i(7294);function n(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function r(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,o)}return i}function a(e){for(var t=1;t=0||(n[i]=e[i]);return n}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}var s=o.createContext({}),c=function(e){var t=o.useContext(s),i=t;return e&&(i="function"==typeof e?e(t):a(a({},t),e)),i},h=function(e){var t=c(e.components);return o.createElement(s.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var i=e.components,n=e.mdxType,r=e.originalType,s=e.parentName,h=l(e,["components","mdxType","originalType","parentName"]),p=c(i),u=n,f=p["".concat(s,".").concat(u)]||p[u]||m[u]||r;return i?o.createElement(f,a(a({ref:t},h),{},{components:i})):o.createElement(f,a({ref:t},h))}));function f(e,t){var i=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var r=i.length,a=new Array(r);a[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[p]="string"==typeof e?e:n,a[1]=l;for(var c=2;c{i.r(t),i.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>m,frontMatter:()=>r,metadata:()=>l,toc:()=>c});var o=i(7462),n=(i(7294),i(3905));const r={title:"Bloom Filters and Cuckoo Filters for Cache Summarization",description:"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.",slug:"bloom-and-cuckoo-filters-for-cache-summarization",image:"./assets/bloom-cuckoo/bloom.png?202301181528",authors:{name:"Matthias Wright",title:"Software Engineer",url:"https://github.com/matthias-wright",image_url:"https://github.com/matthias-wright.png"},tags:["fleek network","blog","engineering","content routing"]},a=void 0,l={permalink:"/blog/bloom-and-cuckoo-filters-for-cache-summarization",source:"@site/blog/bloom-and-cuckoo-filters-for-cache-summarization.md",title:"Bloom Filters and Cuckoo Filters for Cache Summarization",description:"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.",date:"2023-10-20T15:50:16.000Z",formattedDate:"October 20, 2023",tags:[{label:"fleek network",permalink:"/blog/tags/fleek-network"},{label:"blog",permalink:"/blog/tags/blog"},{label:"engineering",permalink:"/blog/tags/engineering"},{label:"content routing",permalink:"/blog/tags/content-routing"}],readingTime:10.37,hasTruncateMarker:!0,authors:[{name:"Matthias Wright",title:"Software Engineer",url:"https://github.com/matthias-wright",image_url:"https://github.com/matthias-wright.png",imageURL:"https://github.com/matthias-wright.png"}],frontMatter:{title:"Bloom Filters and Cuckoo Filters for Cache Summarization",description:"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.",slug:"bloom-and-cuckoo-filters-for-cache-summarization",image:"./assets/bloom-cuckoo/bloom.png?202301181528",authors:{name:"Matthias Wright",title:"Software Engineer",url:"https://github.com/matthias-wright",image_url:"https://github.com/matthias-wright.png",imageURL:"https://github.com/matthias-wright.png"},tags:["fleek network","blog","engineering","content routing"]}},s={image:i(4221).Z,authorsImageUrls:[void 0]},c=[{value:"Background",id:"background",level:2},{value:"Bloom Filters",id:"bloom-filters",level:2},{value:"Cuckoo Filters",id:"cuckoo-filters",level:2},{value:"Benchmarking",id:"benchmarking",level:2},{value:"Experimental Setup",id:"experimental-setup",level:2},{value:"Memory Footprint",id:"memory-footprint",level:2},{value:"Lookup Performance",id:"lookup-performance",level:2},{value:"Insertion Performance",id:"insertion-performance",level:2},{value:"Capacity and Scaling",id:"capacity-and-scaling",level:2},{value:"Other Filters",id:"other-filters",level:2},{value:"Conclusion",id:"conclusion",level:2},{value:"References",id:"references",level:3}],h={toc:c},p="wrapper";function m(e){let{components:t,...r}=e;return(0,n.kt)(p,(0,o.Z)({},h,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"Disclaimer: This is not a general comparison between Bloom filters and Cuckoo filters. This blog post summarizes some of the experiments we conducted to decide whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters, for a specific use case."),(0,n.kt)("h2",{id:"background"},"Background"),(0,n.kt)("p",null,"Nodes on Fleek Network currently use Counting Bloom filters to summarize their cached content. These cache summaries are exchanged with other nodes in order to facilitate content routing."),(0,n.kt)("p",null,"If a particular node does not store a requested piece of content, it can use the Bloom filters that it received from its peers to check if a peer stores the requested content."),(0,n.kt)("p",null,"We are using Counting Bloom filters rather than regular Bloom filters because we need to be able to remove elements from the filter to support cache eviction."),(0,n.kt)("h2",{id:"bloom-filters"},"Bloom Filters"),(0,n.kt)("p",null,"A Bloom filter is a space-efficient probabilistic data structure that can be used to perform approximate set membership queries.\nThe answer to an approximate set membership query is not ",(0,n.kt)("inlineCode",{parentName:"p"},"no")," or ",(0,n.kt)("inlineCode",{parentName:"p"},"yes,")," but rather ",(0,n.kt)("inlineCode",{parentName:"p"},"no")," or ",(0,n.kt)("inlineCode",{parentName:"p"},"probably.")," This ",(0,n.kt)("inlineCode",{parentName:"p"},"probably")," is quantified with the false positive rate. "),(0,n.kt)("p",null,"One of the convenient features of Bloom filters is that they can be configured to have a specific false positive rate.\nOf course, there is a tradeoff here; the lower the false positive rate, the larger the memory footprint. Bloom filters support two operations: ",(0,n.kt)("inlineCode",{parentName:"p"},"insert")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"contains.")," "),(0,n.kt)("p",null,"A Bloom filter is represented by an array of m bits together with k independent hash functions. To insert an element into the filter, it is hashed with each of the k hash functions.\nThe resulting hashes are interpreted as integers (modulo m) to obtain k array positions. The bits at these positions are then set to 1 (if there aren't already 1).",(0,n.kt)("br",{parentName:"p"}),"\n","To check whether or not an element is contained in the filter, the element is hashed k times with the different hash functions."),(0,n.kt)("p",null,"If all bits at the resulting array positions are 1, the element is assumed to be present. If any of the k bits are zero, we can be certain that the queried element is not present in the set."),(0,n.kt)("p",null,"However, even if all bits are 1, it might still be the case that the bits were set by a combination of other elements. This is where the aforementioned false positive rate comes into play. "),(0,n.kt)("p",null,"Since we also need a ",(0,n.kt)("inlineCode",{parentName:"p"},"remove")," operation for our use case, we have been using Counting Bloom filters, a variant of Bloom filters.\nCounting Bloom filters retain most of the properties that regular Bloom filters have. The ",(0,n.kt)("inlineCode",{parentName:"p"},"remove")," operation comes at the cost of an increased memory footprint."),(0,n.kt)("p",null,"Each position in the array is no longer a single bit but a group of bits representing a counter.\nWhenever an element is inserted into the filter, the counters for all k positions are incremented by 1. To remove an element, we decrement the counters."),(0,n.kt)("h2",{id:"cuckoo-filters"},"Cuckoo Filters"),(0,n.kt)("p",null,"Bloom filters are the most known members of a class of data structures called Approximate Membership Query Filters (AMQ Filters).\nA relatively recent addition to this class is the Cuckoo filter ","[1]",". Cuckoo filters share many similarities with Bloom filters, especially Counting Bloom filters."),(0,n.kt)("p",null,"They are space-efficient and can be used for approximate set membership queries. Cuckoo filters also support the operations ",(0,n.kt)("inlineCode",{parentName:"p"},"insert,")," ",(0,n.kt)("inlineCode",{parentName:"p"},"contains,")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"remove,")," and have configurable false positive rates. "),(0,n.kt)("p",null,"Cuckoo filters are based on Cuckoo hash tables ","[2]"," and leverage an optimization called partial-key cuckoo hashing. A basic Cuckoo hash table consists of an array of buckets.\nWe determine two candidate buckets for each element using two different hash functions, h1 and h2. "),(0,n.kt)("p",null,"The ",(0,n.kt)("inlineCode",{parentName:"p"},"contains")," operation will check if either bucket contains the element.\nFor insertion, if either bucket is empty, the element will be inserted into the empty bucket."),(0,n.kt)("p",null,"If neither bucket is empty, one of the buckets is selected, and the existing element is removed and inserted into its alternate location.\nThis may trigger another relocation if the alternate location is not empty. "),(0,n.kt)("p",null,"Although the insertion operation may perform a sequence of relocations, the amortized runtime is O(1). "),(0,n.kt)("p",null,"Most implementations of Cuckoo hash tables and, consequently, Cuckoo filters will use buckets that can hold multiple elements, as proposed in ","[3]","."),(0,n.kt)("p",null,"For Cuckoo filters, the hash table size is reduced by only storing fingerprints - a bit string calculated from an element's hash - rather than key-value pairs."),(0,n.kt)("p",null,"The fingerprint size is derived from the desired false positive rate.",(0,n.kt)("br",{parentName:"p"}),"\n","A problem that arises is that, to relocate existing fingerprints using the Cuckoo hashing approach described above, we need the original hash from which the fingerprint was derived."),(0,n.kt)("p",null,"Of course, we could store this hash somewhere, but the whole point of using fingerprints is to reduce the memory footprint of the filter."),(0,n.kt)("p",null,"The solution to this predicament is the aforementioned partial-key cuckoo hashing, a technique for determining an element's alternate location using only its fingerprint.",(0,n.kt)("br",{parentName:"p"}),"\n","For a given element x, the two candidate buckets are computed as follows: "),(0,n.kt)("p",null,(0,n.kt)("img",{src:i(9440).Z,width:"1324",height:"194"})),(0,n.kt)("p",null,"An important property of this technique is that h1(x) can also be computed from h2(x) and the fingerprint."),(0,n.kt)("h2",{id:"benchmarking"},"Benchmarking"),(0,n.kt)("p",null,"As this post mentioned, we are not aiming for a general comparison of Counting Bloom and Cuckoo filters."),(0,n.kt)("p",null,"Instead, we want to determine which filter suits our specific use case better. The two main properties we are looking for are space efficiency and lookup performance. "),(0,n.kt)("p",null,"Space efficiency is important because nodes frequently update their cache and have to communicate these changes with their peers. These messages should take up as little bandwidth as possible."),(0,n.kt)("p",null,"Lookup speed is also important because Fleek Network aims to serve user requests as quickly as possible. Checking whether a peer has some content stored in their cache summary should not be a bottleneck. "),(0,n.kt)("h2",{id:"experimental-setup"},"Experimental Setup"),(0,n.kt)("p",null,"We are using our own Counting Bloom filter ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/ursa/blob/483f4d56cbaa5e83182454d2c1db6f6af7c54912/crates/ursa-network/src/utils/bloom_filter.rs#L11"},"implementation")," and ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/sile/scalable_cuckoo_filter?gh"},"scalable cuckoo filter")," Cuckoo filter implementation in Rust, the ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/efficient/cuckoofilter?gh"},"original cuckoofilter")," implementation is in C++. All experiments were performed on a Linux machine with 16 GB RAM and an Intel Core i7 (10th Gen). Whenever the experiment is probabilistic, we repeat the experiment 20 times and report the mean and standard deviation."),(0,n.kt)("h2",{id:"memory-footprint"},"Memory Footprint"),(0,n.kt)("p",null,"For both Counting Bloom filters and Cuckoo filters, the memory footprint is determined by two factors: the filter's capacity and the desired false positive rate. In the first experiment, we examine the impact that\nthese factors have on the memory footprint. "),(0,n.kt)("p",null,"To this end, we fix the false positive rate and initialize the filters with capacities ranging from 100K to 1M. The result is shown in Fig. 1.\nThe size of Bloom filters scales linearly with the capacity. Cuckoo filters are more space-efficient. This result is consistent with the experiments reported in ","[1]","."),(0,n.kt)("p",null,(0,n.kt)("img",{src:i(5441).Z,width:"640",height:"480"})),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Figure 1: We fix the false positive rate and initialize the filters with capacities ranging from 100K to 1M. The y-axis shows the size of the filters in Megabytes.")),(0,n.kt)("p",null,"Next, we fix the capacity and initialize the filters with false positive rates ranging from 0.0001 to 0.5. Fig. 2 shows that Cuckoo filters are more space-efficient."),(0,n.kt)("p",null,"The gap between Counting Bloom filters and Cuckoo filters grows as the false positive rate decreases. This is also consistent with experiments in ","[1]","."),(0,n.kt)("p",null,(0,n.kt)("img",{src:i(9844).Z,width:"640",height:"480"})),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Figure 2: We fix the capacity and initialize the filters with false positive rates ranging from 0.0001 to 0.5. The y-axis shows the size of the filters in Megabytes.")),(0,n.kt)("h2",{id:"lookup-performance"},"Lookup Performance"),(0,n.kt)("p",null,"We first add elements to both filters until the capacity is reached. We then measure the lookup performance for different ratios of positive and negative lookups."),(0,n.kt)("p",null,"A positive lookup is for an existing element, and a negative lookup is for an element not contained in the filter. We perform 100K lookups for each ratio and report the average lookup duration and standard deviation. "),(0,n.kt)("p",null,"Fig. 3 shows the results. Bloom filters perform slightly better on average than Cuckoo filters. This result is inconsistent with ","[1]",",\nwhere Cuckoo filters were reported to have a better lookup performance than Bloom filters. It should be noted here that the authors in ","[1]"," use the original C++ Cuckoo filter implementation and their own unreleased Bloom filter implementation. In contrast, we use a Rust Cuckoo filter implementation and our Bloom filter implementation. We cannot easily determine the reason for this discrepancy."),(0,n.kt)("p",null,"However, the performance difference is negligible."),(0,n.kt)("p",null,(0,n.kt)("img",{src:i(8915).Z,width:"640",height:"480"})),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Figure 3: Lookup performance for different ratios of positive and negative lookups. For example, ratio 0.25 indicates that 25% of lookups are positive and 75% are negative.\nThe shaded region indicates the standard deviation.")),(0,n.kt)("h2",{id:"insertion-performance"},"Insertion Performance"),(0,n.kt)("p",null,"Less critical than lookup performance but still important for our purposes is insertion performance. We measure how the insertion performance varies for different occupancy levels.\nFig. 4 shows the results. The insertion performance is constant across all levels of occupancy for Bloom filters."),(0,n.kt)("p",null,"For Cuckoo filters, the performance decreases as the filter becomes fuller because more relocations are required. In Fig. 4, the performance for Bloom filters is not constant. It quickly increases and then remains constant. This can be explained by CPU caching. "),(0,n.kt)("p",null,(0,n.kt)("img",{src:i(989).Z,width:"640",height:"480"})),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Figure 4: Insertion performance for different occupancy levels. The shaded region indicates the standard deviation.")),(0,n.kt)("h2",{id:"capacity-and-scaling"},"Capacity and Scaling"),(0,n.kt)("p",null,"We have mentioned the capacity of a filter several times now. An interesting case is what happens when a filter's capacity is exceeded.\nBloom filters and Cuckoo filters behave differently in this scenario."),(0,n.kt)("p",null,"For Bloom filters, the ",(0,n.kt)("inlineCode",{parentName:"p"},"insertion")," operation always succeeds. However, the false positive rate will rapidly increase as we exceed the filter's capacity. While Bloom filters fail silently, Cuckoo filters are more explicit. Most implementations have a maximum number of\nrelocations that will be performed for an insertion. The ",(0,n.kt)("inlineCode",{parentName:"p"},"insertion")," operation will return an error if more relocations are required. "),(0,n.kt)("p",null,"For both filters, we can avoid this problem by simply initializing the filter with a sufficiently large capacity. However, this will increase the memory footprint of the filter."),(0,n.kt)("p",null,"Furthermore, it is difficult to predict how many elements a node on Fleek Network will cache. It is also likely that the number of cached elements will greatly vary for different nodes. "),(0,n.kt)("p",null,"Fortunately, a variant of Bloom filters called Scalable Bloom Filters ","[4]"," can adapt dynamically to the number of elements stored while guaranteeing a maximum false positive rate."),(0,n.kt)("p",null,"The proposed technique is also applicable to Cuckoo filters."),(0,n.kt)("h2",{id:"other-filters"},"Other Filters"),(0,n.kt)("p",null,"While we only looked at Bloom filters and Cuckoo filters, there are other AMQ filters that we want to mention here briefly:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"Quotient filters ","[5, 6]",": Compact hash tables that support insertion, lookup, and deletion. Less space-efficient than Bloom filters and Cuckoo filters. ")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"XOR filters ","[7]",": More space-efficient than Bloom filters and Cuckoo filters. However, they are static, meaning the filter has to be rebuilt if additional elements are added. "))),(0,n.kt)("h2",{id:"conclusion"},"Conclusion"),(0,n.kt)("p",null,"We examined whether Counting Bloom filters or Cuckoo filters are more suitable for summarizing caches on Fleek Network. Cuckoo filters are more space-efficient, especially for lower false positive rates. Bloom filters have a slightly better insertion and lookup performance for the implementations we tested."),(0,n.kt)("p",null,"Both filters can be adapted to grow and shrink in size dynamically. Since the difference in insertion and lookup performance is negligible while Cuckoo filters are significantly more space-efficient, we favor Cuckoo filters for our use case. "),(0,n.kt)("h3",{id:"references"},"References"),(0,n.kt)("p",null,"[1]"," Bin Fan, Dave G. Andersen, Michael Kaminsky, and Michael D. Mitzenmacher. Cuckoo Filter: Practically Better Than Bloom.\nIn Proceedings of the 10th ACM International Conference on emerging Networking Experiments and Technologies (CoNEXT 14). Association for Computing Machinery, New York, NY, USA, pp. 75-88, 2014. "),(0,n.kt)("p",null,"[2]"," Rasmus Pagha and Flemming Friche Rodler. Cuckoo hashing. Journal of Algorithms, 51(2), pp. 122-144, 2004. "),(0,n.kt)("p",null,"[3]"," Martin Dietzfelbinger and Christoph Weidling. Balanced Allocation and Dictionaries with Tightly Packed Constant Size Bins. Theoretical Computer Science, 380(1), pp. 47-68, 2007. "),(0,n.kt)("p",null,"[4]"," Paulo S. Almeida, Carlos Baquero, Nuno Pregui\xe7a, and David Hutchison. Scalable Bloom Filters. Information Processing Letters, 101(6), pp. 255-261, 2007. "),(0,n.kt)("p",null,"[5]"," John G. Cleary. Compact hash tables using bidirectional linear probing. IEEE Transactions on Computers. 33(9), pp. 828-834, 1984. "),(0,n.kt)("p",null,"[6]"," Anna Pagh, Rasmus Pagh, and S. Srinivasa Rao. An optimal Bloom filter replacement. Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 823-829, 2005. "),(0,n.kt)("p",null,"[7]"," Thomas Mueller Graf and Daniel Lemire. Xor Filters: Faster and Smaller Than Bloom and Cuckoo Filters. ACM Journal of Experimental Algorithmics. 25, pp. 1-16, 2020."))}m.isMDXComponent=!0},4221:(e,t,i)=>{i.d(t,{Z:()=>o});const o=i.p+"assets/images/bloom-79da0db687b4fb2060758838b9c44513.png"},5441:(e,t,i)=>{i.d(t,{Z:()=>o});const o=i.p+"assets/images/capacity-size-5c2576bd69db0e5b510781e7cc1c5257.png"},9844:(e,t,i)=>{i.d(t,{Z:()=>o});const o=i.p+"assets/images/fp-rate-size-fbb54b2450b4a91e28c97d8adf0253e8.png"},989:(e,t,i)=>{i.d(t,{Z:()=>o});const o=i.p+"assets/images/insert-3ff48d4c63724adcf399f81b29607691.png"},8915:(e,t,i)=>{i.d(t,{Z:()=>o});const o=i.p+"assets/images/lookup-e36011237d8602b5f6c36fe5dd145bf5.png"},9440:(e,t,i)=>{i.d(t,{Z:()=>o});const o=i.p+"assets/images/math-formul-a247d4df475b26b1e7cbb2acfc0ab8c2.png"}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[3396],{3905:(e,t,i)=>{i.d(t,{Zo:()=>h,kt:()=>f});var o=i(7294);function n(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function r(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,o)}return i}function a(e){for(var t=1;t=0||(n[i]=e[i]);return n}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}var s=o.createContext({}),c=function(e){var t=o.useContext(s),i=t;return e&&(i="function"==typeof e?e(t):a(a({},t),e)),i},h=function(e){var t=c(e.components);return o.createElement(s.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var i=e.components,n=e.mdxType,r=e.originalType,s=e.parentName,h=l(e,["components","mdxType","originalType","parentName"]),p=c(i),u=n,f=p["".concat(s,".").concat(u)]||p[u]||m[u]||r;return i?o.createElement(f,a(a({ref:t},h),{},{components:i})):o.createElement(f,a({ref:t},h))}));function f(e,t){var i=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var r=i.length,a=new Array(r);a[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[p]="string"==typeof e?e:n,a[1]=l;for(var c=2;c{i.r(t),i.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>m,frontMatter:()=>r,metadata:()=>l,toc:()=>c});var o=i(7462),n=(i(7294),i(3905));const r={title:"Bloom Filters and Cuckoo Filters for Cache Summarization",description:"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.",slug:"bloom-and-cuckoo-filters-for-cache-summarization",image:"./assets/bloom-cuckoo/bloom.png?202301181528",authors:{name:"Matthias Wright",title:"Software Engineer",url:"https://github.com/matthias-wright",image_url:"https://github.com/matthias-wright.png"},tags:["fleek network","blog","engineering","content routing"]},a=void 0,l={permalink:"/blog/bloom-and-cuckoo-filters-for-cache-summarization",source:"@site/blog/bloom-and-cuckoo-filters-for-cache-summarization.md",title:"Bloom Filters and Cuckoo Filters for Cache Summarization",description:"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.",date:"2023-10-20T16:26:18.000Z",formattedDate:"October 20, 2023",tags:[{label:"fleek network",permalink:"/blog/tags/fleek-network"},{label:"blog",permalink:"/blog/tags/blog"},{label:"engineering",permalink:"/blog/tags/engineering"},{label:"content routing",permalink:"/blog/tags/content-routing"}],readingTime:10.37,hasTruncateMarker:!0,authors:[{name:"Matthias Wright",title:"Software Engineer",url:"https://github.com/matthias-wright",image_url:"https://github.com/matthias-wright.png",imageURL:"https://github.com/matthias-wright.png"}],frontMatter:{title:"Bloom Filters and Cuckoo Filters for Cache Summarization",description:"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.",slug:"bloom-and-cuckoo-filters-for-cache-summarization",image:"./assets/bloom-cuckoo/bloom.png?202301181528",authors:{name:"Matthias Wright",title:"Software Engineer",url:"https://github.com/matthias-wright",image_url:"https://github.com/matthias-wright.png",imageURL:"https://github.com/matthias-wright.png"},tags:["fleek network","blog","engineering","content routing"]}},s={image:i(4221).Z,authorsImageUrls:[void 0]},c=[{value:"Background",id:"background",level:2},{value:"Bloom Filters",id:"bloom-filters",level:2},{value:"Cuckoo Filters",id:"cuckoo-filters",level:2},{value:"Benchmarking",id:"benchmarking",level:2},{value:"Experimental Setup",id:"experimental-setup",level:2},{value:"Memory Footprint",id:"memory-footprint",level:2},{value:"Lookup Performance",id:"lookup-performance",level:2},{value:"Insertion Performance",id:"insertion-performance",level:2},{value:"Capacity and Scaling",id:"capacity-and-scaling",level:2},{value:"Other Filters",id:"other-filters",level:2},{value:"Conclusion",id:"conclusion",level:2},{value:"References",id:"references",level:3}],h={toc:c},p="wrapper";function m(e){let{components:t,...r}=e;return(0,n.kt)(p,(0,o.Z)({},h,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"Disclaimer: This is not a general comparison between Bloom filters and Cuckoo filters. This blog post summarizes some of the experiments we conducted to decide whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters, for a specific use case."),(0,n.kt)("h2",{id:"background"},"Background"),(0,n.kt)("p",null,"Nodes on Fleek Network currently use Counting Bloom filters to summarize their cached content. These cache summaries are exchanged with other nodes in order to facilitate content routing."),(0,n.kt)("p",null,"If a particular node does not store a requested piece of content, it can use the Bloom filters that it received from its peers to check if a peer stores the requested content."),(0,n.kt)("p",null,"We are using Counting Bloom filters rather than regular Bloom filters because we need to be able to remove elements from the filter to support cache eviction."),(0,n.kt)("h2",{id:"bloom-filters"},"Bloom Filters"),(0,n.kt)("p",null,"A Bloom filter is a space-efficient probabilistic data structure that can be used to perform approximate set membership queries.\nThe answer to an approximate set membership query is not ",(0,n.kt)("inlineCode",{parentName:"p"},"no")," or ",(0,n.kt)("inlineCode",{parentName:"p"},"yes,")," but rather ",(0,n.kt)("inlineCode",{parentName:"p"},"no")," or ",(0,n.kt)("inlineCode",{parentName:"p"},"probably.")," This ",(0,n.kt)("inlineCode",{parentName:"p"},"probably")," is quantified with the false positive rate. "),(0,n.kt)("p",null,"One of the convenient features of Bloom filters is that they can be configured to have a specific false positive rate.\nOf course, there is a tradeoff here; the lower the false positive rate, the larger the memory footprint. Bloom filters support two operations: ",(0,n.kt)("inlineCode",{parentName:"p"},"insert")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"contains.")," "),(0,n.kt)("p",null,"A Bloom filter is represented by an array of m bits together with k independent hash functions. To insert an element into the filter, it is hashed with each of the k hash functions.\nThe resulting hashes are interpreted as integers (modulo m) to obtain k array positions. The bits at these positions are then set to 1 (if there aren't already 1).",(0,n.kt)("br",{parentName:"p"}),"\n","To check whether or not an element is contained in the filter, the element is hashed k times with the different hash functions."),(0,n.kt)("p",null,"If all bits at the resulting array positions are 1, the element is assumed to be present. If any of the k bits are zero, we can be certain that the queried element is not present in the set."),(0,n.kt)("p",null,"However, even if all bits are 1, it might still be the case that the bits were set by a combination of other elements. This is where the aforementioned false positive rate comes into play. "),(0,n.kt)("p",null,"Since we also need a ",(0,n.kt)("inlineCode",{parentName:"p"},"remove")," operation for our use case, we have been using Counting Bloom filters, a variant of Bloom filters.\nCounting Bloom filters retain most of the properties that regular Bloom filters have. The ",(0,n.kt)("inlineCode",{parentName:"p"},"remove")," operation comes at the cost of an increased memory footprint."),(0,n.kt)("p",null,"Each position in the array is no longer a single bit but a group of bits representing a counter.\nWhenever an element is inserted into the filter, the counters for all k positions are incremented by 1. To remove an element, we decrement the counters."),(0,n.kt)("h2",{id:"cuckoo-filters"},"Cuckoo Filters"),(0,n.kt)("p",null,"Bloom filters are the most known members of a class of data structures called Approximate Membership Query Filters (AMQ Filters).\nA relatively recent addition to this class is the Cuckoo filter ","[1]",". Cuckoo filters share many similarities with Bloom filters, especially Counting Bloom filters."),(0,n.kt)("p",null,"They are space-efficient and can be used for approximate set membership queries. Cuckoo filters also support the operations ",(0,n.kt)("inlineCode",{parentName:"p"},"insert,")," ",(0,n.kt)("inlineCode",{parentName:"p"},"contains,")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"remove,")," and have configurable false positive rates. "),(0,n.kt)("p",null,"Cuckoo filters are based on Cuckoo hash tables ","[2]"," and leverage an optimization called partial-key cuckoo hashing. A basic Cuckoo hash table consists of an array of buckets.\nWe determine two candidate buckets for each element using two different hash functions, h1 and h2. "),(0,n.kt)("p",null,"The ",(0,n.kt)("inlineCode",{parentName:"p"},"contains")," operation will check if either bucket contains the element.\nFor insertion, if either bucket is empty, the element will be inserted into the empty bucket."),(0,n.kt)("p",null,"If neither bucket is empty, one of the buckets is selected, and the existing element is removed and inserted into its alternate location.\nThis may trigger another relocation if the alternate location is not empty. "),(0,n.kt)("p",null,"Although the insertion operation may perform a sequence of relocations, the amortized runtime is O(1). "),(0,n.kt)("p",null,"Most implementations of Cuckoo hash tables and, consequently, Cuckoo filters will use buckets that can hold multiple elements, as proposed in ","[3]","."),(0,n.kt)("p",null,"For Cuckoo filters, the hash table size is reduced by only storing fingerprints - a bit string calculated from an element's hash - rather than key-value pairs."),(0,n.kt)("p",null,"The fingerprint size is derived from the desired false positive rate.",(0,n.kt)("br",{parentName:"p"}),"\n","A problem that arises is that, to relocate existing fingerprints using the Cuckoo hashing approach described above, we need the original hash from which the fingerprint was derived."),(0,n.kt)("p",null,"Of course, we could store this hash somewhere, but the whole point of using fingerprints is to reduce the memory footprint of the filter."),(0,n.kt)("p",null,"The solution to this predicament is the aforementioned partial-key cuckoo hashing, a technique for determining an element's alternate location using only its fingerprint.",(0,n.kt)("br",{parentName:"p"}),"\n","For a given element x, the two candidate buckets are computed as follows: "),(0,n.kt)("p",null,(0,n.kt)("img",{src:i(9440).Z,width:"1324",height:"194"})),(0,n.kt)("p",null,"An important property of this technique is that h1(x) can also be computed from h2(x) and the fingerprint."),(0,n.kt)("h2",{id:"benchmarking"},"Benchmarking"),(0,n.kt)("p",null,"As this post mentioned, we are not aiming for a general comparison of Counting Bloom and Cuckoo filters."),(0,n.kt)("p",null,"Instead, we want to determine which filter suits our specific use case better. The two main properties we are looking for are space efficiency and lookup performance. "),(0,n.kt)("p",null,"Space efficiency is important because nodes frequently update their cache and have to communicate these changes with their peers. These messages should take up as little bandwidth as possible."),(0,n.kt)("p",null,"Lookup speed is also important because Fleek Network aims to serve user requests as quickly as possible. Checking whether a peer has some content stored in their cache summary should not be a bottleneck. "),(0,n.kt)("h2",{id:"experimental-setup"},"Experimental Setup"),(0,n.kt)("p",null,"We are using our own Counting Bloom filter ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/ursa/blob/483f4d56cbaa5e83182454d2c1db6f6af7c54912/crates/ursa-network/src/utils/bloom_filter.rs#L11"},"implementation")," and ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/sile/scalable_cuckoo_filter?gh"},"scalable cuckoo filter")," Cuckoo filter implementation in Rust, the ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/efficient/cuckoofilter?gh"},"original cuckoofilter")," implementation is in C++. All experiments were performed on a Linux machine with 16 GB RAM and an Intel Core i7 (10th Gen). Whenever the experiment is probabilistic, we repeat the experiment 20 times and report the mean and standard deviation."),(0,n.kt)("h2",{id:"memory-footprint"},"Memory Footprint"),(0,n.kt)("p",null,"For both Counting Bloom filters and Cuckoo filters, the memory footprint is determined by two factors: the filter's capacity and the desired false positive rate. In the first experiment, we examine the impact that\nthese factors have on the memory footprint. "),(0,n.kt)("p",null,"To this end, we fix the false positive rate and initialize the filters with capacities ranging from 100K to 1M. The result is shown in Fig. 1.\nThe size of Bloom filters scales linearly with the capacity. Cuckoo filters are more space-efficient. This result is consistent with the experiments reported in ","[1]","."),(0,n.kt)("p",null,(0,n.kt)("img",{src:i(5441).Z,width:"640",height:"480"})),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Figure 1: We fix the false positive rate and initialize the filters with capacities ranging from 100K to 1M. The y-axis shows the size of the filters in Megabytes.")),(0,n.kt)("p",null,"Next, we fix the capacity and initialize the filters with false positive rates ranging from 0.0001 to 0.5. Fig. 2 shows that Cuckoo filters are more space-efficient."),(0,n.kt)("p",null,"The gap between Counting Bloom filters and Cuckoo filters grows as the false positive rate decreases. This is also consistent with experiments in ","[1]","."),(0,n.kt)("p",null,(0,n.kt)("img",{src:i(9844).Z,width:"640",height:"480"})),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Figure 2: We fix the capacity and initialize the filters with false positive rates ranging from 0.0001 to 0.5. The y-axis shows the size of the filters in Megabytes.")),(0,n.kt)("h2",{id:"lookup-performance"},"Lookup Performance"),(0,n.kt)("p",null,"We first add elements to both filters until the capacity is reached. We then measure the lookup performance for different ratios of positive and negative lookups."),(0,n.kt)("p",null,"A positive lookup is for an existing element, and a negative lookup is for an element not contained in the filter. We perform 100K lookups for each ratio and report the average lookup duration and standard deviation. "),(0,n.kt)("p",null,"Fig. 3 shows the results. Bloom filters perform slightly better on average than Cuckoo filters. This result is inconsistent with ","[1]",",\nwhere Cuckoo filters were reported to have a better lookup performance than Bloom filters. It should be noted here that the authors in ","[1]"," use the original C++ Cuckoo filter implementation and their own unreleased Bloom filter implementation. In contrast, we use a Rust Cuckoo filter implementation and our Bloom filter implementation. We cannot easily determine the reason for this discrepancy."),(0,n.kt)("p",null,"However, the performance difference is negligible."),(0,n.kt)("p",null,(0,n.kt)("img",{src:i(8915).Z,width:"640",height:"480"})),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Figure 3: Lookup performance for different ratios of positive and negative lookups. For example, ratio 0.25 indicates that 25% of lookups are positive and 75% are negative.\nThe shaded region indicates the standard deviation.")),(0,n.kt)("h2",{id:"insertion-performance"},"Insertion Performance"),(0,n.kt)("p",null,"Less critical than lookup performance but still important for our purposes is insertion performance. We measure how the insertion performance varies for different occupancy levels.\nFig. 4 shows the results. The insertion performance is constant across all levels of occupancy for Bloom filters."),(0,n.kt)("p",null,"For Cuckoo filters, the performance decreases as the filter becomes fuller because more relocations are required. In Fig. 4, the performance for Bloom filters is not constant. It quickly increases and then remains constant. This can be explained by CPU caching. "),(0,n.kt)("p",null,(0,n.kt)("img",{src:i(989).Z,width:"640",height:"480"})),(0,n.kt)("blockquote",null,(0,n.kt)("p",{parentName:"blockquote"},"Figure 4: Insertion performance for different occupancy levels. The shaded region indicates the standard deviation.")),(0,n.kt)("h2",{id:"capacity-and-scaling"},"Capacity and Scaling"),(0,n.kt)("p",null,"We have mentioned the capacity of a filter several times now. An interesting case is what happens when a filter's capacity is exceeded.\nBloom filters and Cuckoo filters behave differently in this scenario."),(0,n.kt)("p",null,"For Bloom filters, the ",(0,n.kt)("inlineCode",{parentName:"p"},"insertion")," operation always succeeds. However, the false positive rate will rapidly increase as we exceed the filter's capacity. While Bloom filters fail silently, Cuckoo filters are more explicit. Most implementations have a maximum number of\nrelocations that will be performed for an insertion. The ",(0,n.kt)("inlineCode",{parentName:"p"},"insertion")," operation will return an error if more relocations are required. "),(0,n.kt)("p",null,"For both filters, we can avoid this problem by simply initializing the filter with a sufficiently large capacity. However, this will increase the memory footprint of the filter."),(0,n.kt)("p",null,"Furthermore, it is difficult to predict how many elements a node on Fleek Network will cache. It is also likely that the number of cached elements will greatly vary for different nodes. "),(0,n.kt)("p",null,"Fortunately, a variant of Bloom filters called Scalable Bloom Filters ","[4]"," can adapt dynamically to the number of elements stored while guaranteeing a maximum false positive rate."),(0,n.kt)("p",null,"The proposed technique is also applicable to Cuckoo filters."),(0,n.kt)("h2",{id:"other-filters"},"Other Filters"),(0,n.kt)("p",null,"While we only looked at Bloom filters and Cuckoo filters, there are other AMQ filters that we want to mention here briefly:"),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"Quotient filters ","[5, 6]",": Compact hash tables that support insertion, lookup, and deletion. Less space-efficient than Bloom filters and Cuckoo filters. ")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("p",{parentName:"li"},"XOR filters ","[7]",": More space-efficient than Bloom filters and Cuckoo filters. However, they are static, meaning the filter has to be rebuilt if additional elements are added. "))),(0,n.kt)("h2",{id:"conclusion"},"Conclusion"),(0,n.kt)("p",null,"We examined whether Counting Bloom filters or Cuckoo filters are more suitable for summarizing caches on Fleek Network. Cuckoo filters are more space-efficient, especially for lower false positive rates. Bloom filters have a slightly better insertion and lookup performance for the implementations we tested."),(0,n.kt)("p",null,"Both filters can be adapted to grow and shrink in size dynamically. Since the difference in insertion and lookup performance is negligible while Cuckoo filters are significantly more space-efficient, we favor Cuckoo filters for our use case. "),(0,n.kt)("h3",{id:"references"},"References"),(0,n.kt)("p",null,"[1]"," Bin Fan, Dave G. Andersen, Michael Kaminsky, and Michael D. Mitzenmacher. Cuckoo Filter: Practically Better Than Bloom.\nIn Proceedings of the 10th ACM International Conference on emerging Networking Experiments and Technologies (CoNEXT 14). Association for Computing Machinery, New York, NY, USA, pp. 75-88, 2014. "),(0,n.kt)("p",null,"[2]"," Rasmus Pagha and Flemming Friche Rodler. Cuckoo hashing. Journal of Algorithms, 51(2), pp. 122-144, 2004. "),(0,n.kt)("p",null,"[3]"," Martin Dietzfelbinger and Christoph Weidling. Balanced Allocation and Dictionaries with Tightly Packed Constant Size Bins. Theoretical Computer Science, 380(1), pp. 47-68, 2007. "),(0,n.kt)("p",null,"[4]"," Paulo S. Almeida, Carlos Baquero, Nuno Pregui\xe7a, and David Hutchison. Scalable Bloom Filters. Information Processing Letters, 101(6), pp. 255-261, 2007. "),(0,n.kt)("p",null,"[5]"," John G. Cleary. Compact hash tables using bidirectional linear probing. IEEE Transactions on Computers. 33(9), pp. 828-834, 1984. "),(0,n.kt)("p",null,"[6]"," Anna Pagh, Rasmus Pagh, and S. Srinivasa Rao. An optimal Bloom filter replacement. Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 823-829, 2005. "),(0,n.kt)("p",null,"[7]"," Thomas Mueller Graf and Daniel Lemire. Xor Filters: Faster and Smaller Than Bloom and Cuckoo Filters. ACM Journal of Experimental Algorithmics. 25, pp. 1-16, 2020."))}m.isMDXComponent=!0},4221:(e,t,i)=>{i.d(t,{Z:()=>o});const o=i.p+"assets/images/bloom-79da0db687b4fb2060758838b9c44513.png"},5441:(e,t,i)=>{i.d(t,{Z:()=>o});const o=i.p+"assets/images/capacity-size-5c2576bd69db0e5b510781e7cc1c5257.png"},9844:(e,t,i)=>{i.d(t,{Z:()=>o});const o=i.p+"assets/images/fp-rate-size-fbb54b2450b4a91e28c97d8adf0253e8.png"},989:(e,t,i)=>{i.d(t,{Z:()=>o});const o=i.p+"assets/images/insert-3ff48d4c63724adcf399f81b29607691.png"},8915:(e,t,i)=>{i.d(t,{Z:()=>o});const o=i.p+"assets/images/lookup-e36011237d8602b5f6c36fe5dd145bf5.png"},9440:(e,t,i)=>{i.d(t,{Z:()=>o});const o=i.p+"assets/images/math-formul-a247d4df475b26b1e7cbb2acfc0ab8c2.png"}}]); \ No newline at end of file diff --git a/assets/js/7aefc753.5dcd8f5d.js b/assets/js/7aefc753.695b86b0.js similarity index 99% rename from assets/js/7aefc753.5dcd8f5d.js rename to assets/js/7aefc753.695b86b0.js index e02b673c1..1d0de9759 100644 --- a/assets/js/7aefc753.5dcd8f5d.js +++ b/assets/js/7aefc753.695b86b0.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1251],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>g});var r=n(7294);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,l=e.mdxType,a=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),m=c(n),u=l,g=m["".concat(s,".").concat(u)]||m[u]||d[u]||a;return n?r.createElement(g,i(i({ref:t},p),{},{components:n})):r.createElement(g,i({ref:t},p))}));function g(e,t){var n=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var a=n.length,i=new Array(a);i[0]=u;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[m]="string"==typeof e?e:l,i[1]=o;for(var c=2;c{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(7462),l=(n(7294),n(3905)),a=n(3872);const i={title:"Uninstall Lightning Node",slug:"uninstall-lightning-node",hide_title:!0,tags:["References","Help","Uninstall","Remove","Delete","Clear","Clean"]},o=void 0,s={unversionedId:"Lightning CLI/uninstall-lightning-node",id:"Lightning CLI/uninstall-lightning-node",title:"Uninstall Lightning Node",description:"Remove symLink",source:"@site/references/Lightning CLI/uninstall-lightning-node.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/uninstall-lightning-node",permalink:"/references/Lightning CLI/uninstall-lightning-node",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/uninstall-lightning-node.md",tags:[{label:"References",permalink:"/references/tags/references"},{label:"Help",permalink:"/references/tags/help"},{label:"Uninstall",permalink:"/references/tags/uninstall"},{label:"Remove",permalink:"/references/tags/remove"},{label:"Delete",permalink:"/references/tags/delete"},{label:"Clear",permalink:"/references/tags/clear"},{label:"Clean",permalink:"/references/tags/clean"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Uninstall Lightning Node",slug:"uninstall-lightning-node",hide_title:!0,tags:["References","Help","Uninstall","Remove","Delete","Clear","Clean"]},sidebar:"defaultSidebar",previous:{title:"Permission denied (os error 13)",permalink:"/references/Lightning CLI/permission-denied-os-error-13"},next:{title:"Update CLI from source code",permalink:"/references/Lightning CLI/update-cli-from-source-code"}},c={},p=[{value:"Remove symLink",id:"remove-symlink",level:2},{value:"Delete the local source code",id:"delete-the-local-source-code",level:2},{value:"Disable the systemd service",id:"disable-the-systemd-service",level:2},{value:"Clear the lightning config directory",id:"clear-the-lightning-config-directory",level:2},{value:"Uninstall Cargo and Rust",id:"uninstall-cargo-and-rust",level:2}],m={toc:p},d="wrapper";function u(e){let{components:t,...n}=e;return(0,l.kt)(d,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h2",{id:"remove-symlink"},"Remove symLink"),(0,l.kt)("p",null,"To remove a symbolic link, use either the rm or unlink command followed by the name of the symlink as an argument. Here's an example with ",(0,l.kt)("inlineCode",{parentName:"p"},"unlink"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"unlink /usr/local/bin/lgtn\n")),(0,l.kt)("h2",{id:"delete-the-local-source-code"},"Delete the local source code"),(0,l.kt)("p",null,"Delete the local source code which was copied from the remote ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"repository"),". You can delete it recursively by:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"rm -r ~/fleek-network/lightning\n")),(0,l.kt)("p",null,"\ud83d\udca1 Use the flag ",(0,l.kt)("inlineCode",{parentName:"p"},"f")," to force remove by skipping any prompts, e.g. ",(0,l.kt)("inlineCode",{parentName:"p"},"rm -rf ")),(0,l.kt)("admonition",{type:"note"},(0,l.kt)("p",{parentName:"admonition"},"The default install location is ",(0,l.kt)("inlineCode",{parentName:"p"},"$HOME/fleek-network/lightning"),". If you have selected a different location to store the repository, change the target path.")),(0,l.kt)("h2",{id:"disable-the-systemd-service"},"Disable the systemd service"),(0,l.kt)("p",null,"To disable the Fleek Network Lightning Systemd's service, start by stopping the service."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl stop lightning.service\n")),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"You can replace ",(0,l.kt)("inlineCode",{parentName:"p"},"lightning.service")," by ",(0,l.kt)("inlineCode",{parentName:"p"},"lightning"),".")),(0,l.kt)("p",null,"Disable the lightning service"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl disable lightning.service\n")),(0,l.kt)("p",null,"If you have used the recommended procedures in the ",(0,l.kt)("a",{parentName:"p",href:"/docs/node/install"},"install")," documentation you'll have to remove the Systemd unit (file that defines the service)."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"rm /etc/systemd/system/lightning.service\n")),(0,l.kt)("p",null,"Reload the Systemd service daemon"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,l.kt)("h2",{id:"clear-the-lightning-config-directory"},"Clear the lightning config directory"),(0,l.kt)("p",null,"The Fleek Network lightning config directory is where the configuration, keystore\u2013the location where your private key is hosted\u2013and other system files are stored."),(0,l.kt)("admonition",{title:"WARNING",type:"caution"},(0,l.kt)("p",{parentName:"admonition"},"Make sure to back up any sensitive data, such as the keystore (private keys), as you won't be able to recover the keys by any other means. If you have any funds associated with it, it'll be lost forever. The Fleek Network team or anyone else will not be able to help recover keys. Your keys, your responsibility.")),(0,l.kt)("p",null,"Alternatively, instead of deleting you can move the files to a custom directory name such as",(0,l.kt)("inlineCode",{parentName:"p"},".lightning.backupDATESTAMP"),", e.g. the example below we've used the date ",(0,l.kt)("inlineCode",{parentName:"p"},"2023-09-06-1205")," as that was the time this text was written:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"mv ~/.lightning ~/.lightning.backup202309061205\n")),(0,l.kt)("p",null,"To clear the lightning config directory remove any files recursively by running the following command:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"rm -r ~/.lightning/*\n")),(0,l.kt)("p",null,"\ud83d\udca1 Use the flag ",(0,l.kt)("inlineCode",{parentName:"p"},"f")," to force remove by skipping any prompts, e.g. ",(0,l.kt)("inlineCode",{parentName:"p"},"rm -rf /*")),(0,l.kt)("p",null,"Alternatively, delete the ",(0,l.kt)("inlineCode",{parentName:"p"},"~/.lightning")," directory:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"rm -r ~/.lightning\n")),(0,l.kt)("h2",{id:"uninstall-cargo-and-rust"},"Uninstall Cargo and Rust"),(0,l.kt)("p",null,"To uninstall rustc, rustup and cargo run the following command:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"rustup self uninstall\n")),(0,l.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}u.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>l});var r=n(7294);const l=e=>{let{image:t,name:n,title:l,url:a,communityMember:i=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:a,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:a,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},l),r.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1251],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>g});var r=n(7294);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,l=e.mdxType,a=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),m=c(n),u=l,g=m["".concat(s,".").concat(u)]||m[u]||d[u]||a;return n?r.createElement(g,i(i({ref:t},p),{},{components:n})):r.createElement(g,i({ref:t},p))}));function g(e,t){var n=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var a=n.length,i=new Array(a);i[0]=u;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[m]="string"==typeof e?e:l,i[1]=o;for(var c=2;c{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(7462),l=(n(7294),n(3905)),a=n(3872);const i={title:"Uninstall Lightning Node",slug:"uninstall-lightning-node",hide_title:!0,tags:["References","Help","Uninstall","Remove","Delete","Clear","Clean"]},o=void 0,s={unversionedId:"Lightning CLI/uninstall-lightning-node",id:"Lightning CLI/uninstall-lightning-node",title:"Uninstall Lightning Node",description:"Remove symLink",source:"@site/references/Lightning CLI/uninstall-lightning-node.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/uninstall-lightning-node",permalink:"/references/Lightning CLI/uninstall-lightning-node",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/uninstall-lightning-node.md",tags:[{label:"References",permalink:"/references/tags/references"},{label:"Help",permalink:"/references/tags/help"},{label:"Uninstall",permalink:"/references/tags/uninstall"},{label:"Remove",permalink:"/references/tags/remove"},{label:"Delete",permalink:"/references/tags/delete"},{label:"Clear",permalink:"/references/tags/clear"},{label:"Clean",permalink:"/references/tags/clean"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Uninstall Lightning Node",slug:"uninstall-lightning-node",hide_title:!0,tags:["References","Help","Uninstall","Remove","Delete","Clear","Clean"]},sidebar:"defaultSidebar",previous:{title:"Permission denied (os error 13)",permalink:"/references/Lightning CLI/permission-denied-os-error-13"},next:{title:"Update CLI from source code",permalink:"/references/Lightning CLI/update-cli-from-source-code"}},c={},p=[{value:"Remove symLink",id:"remove-symlink",level:2},{value:"Delete the local source code",id:"delete-the-local-source-code",level:2},{value:"Disable the systemd service",id:"disable-the-systemd-service",level:2},{value:"Clear the lightning config directory",id:"clear-the-lightning-config-directory",level:2},{value:"Uninstall Cargo and Rust",id:"uninstall-cargo-and-rust",level:2}],m={toc:p},d="wrapper";function u(e){let{components:t,...n}=e;return(0,l.kt)(d,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h2",{id:"remove-symlink"},"Remove symLink"),(0,l.kt)("p",null,"To remove a symbolic link, use either the rm or unlink command followed by the name of the symlink as an argument. Here's an example with ",(0,l.kt)("inlineCode",{parentName:"p"},"unlink"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"unlink /usr/local/bin/lgtn\n")),(0,l.kt)("h2",{id:"delete-the-local-source-code"},"Delete the local source code"),(0,l.kt)("p",null,"Delete the local source code which was copied from the remote ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/fleek-network/lightning"},"repository"),". You can delete it recursively by:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"rm -r ~/fleek-network/lightning\n")),(0,l.kt)("p",null,"\ud83d\udca1 Use the flag ",(0,l.kt)("inlineCode",{parentName:"p"},"f")," to force remove by skipping any prompts, e.g. ",(0,l.kt)("inlineCode",{parentName:"p"},"rm -rf ")),(0,l.kt)("admonition",{type:"note"},(0,l.kt)("p",{parentName:"admonition"},"The default install location is ",(0,l.kt)("inlineCode",{parentName:"p"},"$HOME/fleek-network/lightning"),". If you have selected a different location to store the repository, change the target path.")),(0,l.kt)("h2",{id:"disable-the-systemd-service"},"Disable the systemd service"),(0,l.kt)("p",null,"To disable the Fleek Network Lightning Systemd's service, start by stopping the service."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl stop lightning.service\n")),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"You can replace ",(0,l.kt)("inlineCode",{parentName:"p"},"lightning.service")," by ",(0,l.kt)("inlineCode",{parentName:"p"},"lightning"),".")),(0,l.kt)("p",null,"Disable the lightning service"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl disable lightning.service\n")),(0,l.kt)("p",null,"If you have used the recommended procedures in the ",(0,l.kt)("a",{parentName:"p",href:"/docs/node/install"},"install")," documentation you'll have to remove the Systemd unit (file that defines the service)."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"rm /etc/systemd/system/lightning.service\n")),(0,l.kt)("p",null,"Reload the Systemd service daemon"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,l.kt)("h2",{id:"clear-the-lightning-config-directory"},"Clear the lightning config directory"),(0,l.kt)("p",null,"The Fleek Network lightning config directory is where the configuration, keystore\u2013the location where your private key is hosted\u2013and other system files are stored."),(0,l.kt)("admonition",{title:"WARNING",type:"caution"},(0,l.kt)("p",{parentName:"admonition"},"Make sure to back up any sensitive data, such as the keystore (private keys), as you won't be able to recover the keys by any other means. If you have any funds associated with it, it'll be lost forever. The Fleek Network team or anyone else will not be able to help recover keys. Your keys, your responsibility.")),(0,l.kt)("p",null,"Alternatively, instead of deleting you can move the files to a custom directory name such as",(0,l.kt)("inlineCode",{parentName:"p"},".lightning.backupDATESTAMP"),", e.g. the example below we've used the date ",(0,l.kt)("inlineCode",{parentName:"p"},"2023-09-06-1205")," as that was the time this text was written:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"mv ~/.lightning ~/.lightning.backup202309061205\n")),(0,l.kt)("p",null,"To clear the lightning config directory remove any files recursively by running the following command:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"rm -r ~/.lightning/*\n")),(0,l.kt)("p",null,"\ud83d\udca1 Use the flag ",(0,l.kt)("inlineCode",{parentName:"p"},"f")," to force remove by skipping any prompts, e.g. ",(0,l.kt)("inlineCode",{parentName:"p"},"rm -rf /*")),(0,l.kt)("p",null,"Alternatively, delete the ",(0,l.kt)("inlineCode",{parentName:"p"},"~/.lightning")," directory:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"rm -r ~/.lightning\n")),(0,l.kt)("h2",{id:"uninstall-cargo-and-rust"},"Uninstall Cargo and Rust"),(0,l.kt)("p",null,"To uninstall rustc, rustup and cargo run the following command:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"rustup self uninstall\n")),(0,l.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}u.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>l});var r=n(7294);const l=e=>{let{image:t,name:n,title:l,url:a,communityMember:i=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:a,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:a,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},l),r.createElement("span",{className:"discord"},i?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file diff --git a/assets/js/8a92e787.a803ca01.js b/assets/js/8a92e787.8a1b5d51.js similarity index 99% rename from assets/js/8a92e787.a803ca01.js rename to assets/js/8a92e787.8a1b5d51.js index d4d34801f..2bad8b43a 100644 --- a/assets/js/8a92e787.a803ca01.js +++ b/assets/js/8a92e787.8a1b5d51.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[2517],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(7294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var c=r.createContext({}),i=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=i(e.components);return r.createElement(c.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},g=r.forwardRef((function(e,t){var n=e.components,s=e.mdxType,a=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=i(n),g=s,m=d["".concat(c,".").concat(g)]||d[g]||p[g]||a;return n?r.createElement(m,o(o({ref:t},u),{},{components:n})):r.createElement(m,o({ref:t},u))}));function m(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var a=n.length,o=new Array(a);o[0]=g;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[d]="string"==typeof e?e:s,o[1]=l;for(var i=2;i{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>g,frontMatter:()=>o,metadata:()=>c,toc:()=>u});var r=n(7462),s=(n(7294),n(3905)),a=n(3872);const o={title:"Shutting down persistance",slug:"shutting-down-persistance",hide_title:!0,tags:["reference","shutdown","frozen","idle","service error","systemctl","systemd"]},l=void 0,c={unversionedId:"Systemd/shutting-down-persistance",id:"Systemd/shutting-down-persistance",title:"Shutting down persistance",description:"Systemd Service as frozen or idle",source:"@site/references/Systemd/shutting-down-persistance.md",sourceDirName:"Systemd",slug:"/Systemd/shutting-down-persistance",permalink:"/references/Systemd/shutting-down-persistance",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Systemd/shutting-down-persistance.md",tags:[{label:"reference",permalink:"/references/tags/reference"},{label:"shutdown",permalink:"/references/tags/shutdown"},{label:"frozen",permalink:"/references/tags/frozen"},{label:"idle",permalink:"/references/tags/idle"},{label:"service error",permalink:"/references/tags/service-error"},{label:"systemctl",permalink:"/references/tags/systemctl"},{label:"systemd",permalink:"/references/tags/systemd"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Shutting down persistance",slug:"shutting-down-persistance",hide_title:!0,tags:["reference","shutdown","frozen","idle","service error","systemctl","systemd"]},sidebar:"defaultSidebar",previous:{title:"Service keeps running after shutdown",permalink:"/references/Systemd/service-keeps-running-after-shutdown"},next:{title:"User service",permalink:"/references/Systemd/user-service"}},i={},u=[{value:"Systemd Service as frozen or idle",id:"systemd-service-as-frozen-or-idle",level:2}],d={toc:u},p="wrapper";function g(e){let{components:t,...n}=e;return(0,s.kt)(p,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("h2",{id:"systemd-service-as-frozen-or-idle"},"Systemd Service as frozen or idle"),(0,s.kt)("p",null,"If you have a ",(0,s.kt)("inlineCode",{parentName:"p"},"Shutting node down")," message on the service log, the process is likely failing to respond to Systemd shut down command by failing to terminate all the child processes that were started by the service."),(0,s.kt)("p",null,"The logs should be similar to the following:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"2023-09-11 18:02:07 | ERROR | lightning_consensus::consensus - core/consensus/src/consensus.rs:371 - node: XsE9KtedDRUGv22MLHvy8qcc52QsWGWJYY1LBnWhglg=\n2023-09-11 18:02:07 | ERROR | lightning_consensus::consensus - core/consensus/src/consensus.rs:371 - node: zBmZaycvQsdFRfe0p5Rig/KgyYPD4yNKQTPDo7JrugM=\n2023-09-11 18:02:07 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:373 - ##################\n2023-09-11 18:02:07 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:374 - ********************************\nRPC server starting up\nlistening on 0.0.0.0:4230\nShutting node down.\nShutting node down.\nShutting node down.\nShutting node down.\nShutting node down.\n")),(0,s.kt)("p",null,"To resolve this issue, start by executing a new ",(0,s.kt)("inlineCode",{parentName:"p"},"shutdown")," command as follows:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl stop lightning\n")),(0,s.kt)("p",null,"If you need to delegate to root, then use the ",(0,s.kt)("strong",{parentName:"p"},"sudo")," keyword, as follows:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl stop lightning\n")),(0,s.kt)("p",null,"Once completed, clear the logs to avoid confusion as the log aggregates messages past and current."),(0,s.kt)("p",null,"Delete all the log files (output.log and diagnostic.log) by running:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"sudo rm -f /var/log/lightning/*.log\n")),(0,s.kt)("p",null,"Launch the service:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl start lightning\n")),(0,s.kt)("p",null,"If you need to delegate to root, then use the ",(0,s.kt)("strong",{parentName:"p"},"sudo")," keyword, as follows:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl start lightning\n")),(0,s.kt)("p",null,"You can watch the log output of the service by running:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"tail -f /var/log/lightning/output.log\n")),(0,s.kt)("p",null,"The output should be similar to:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"2023-09-12 13:53:51 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:373 - ##################\n2023-09-12 13:53:51 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:374 - ********************************\n")),(0,s.kt)("p",null,"Alternatively, you can watch the diagnostic.log"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"tail -f /var/log/lightning/diagnostic.log\n")),(0,s.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}g.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>s});var r=n(7294);const s=e=>{let{image:t,name:n,title:s,url:a,communityMember:o=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:a,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:a,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},s),r.createElement("span",{className:"discord"},o?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[2517],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(7294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var c=r.createContext({}),i=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=i(e.components);return r.createElement(c.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},g=r.forwardRef((function(e,t){var n=e.components,s=e.mdxType,a=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=i(n),g=s,m=d["".concat(c,".").concat(g)]||d[g]||p[g]||a;return n?r.createElement(m,o(o({ref:t},u),{},{components:n})):r.createElement(m,o({ref:t},u))}));function m(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var a=n.length,o=new Array(a);o[0]=g;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[d]="string"==typeof e?e:s,o[1]=l;for(var i=2;i{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>g,frontMatter:()=>o,metadata:()=>c,toc:()=>u});var r=n(7462),s=(n(7294),n(3905)),a=n(3872);const o={title:"Shutting down persistance",slug:"shutting-down-persistance",hide_title:!0,tags:["reference","shutdown","frozen","idle","service error","systemctl","systemd"]},l=void 0,c={unversionedId:"Systemd/shutting-down-persistance",id:"Systemd/shutting-down-persistance",title:"Shutting down persistance",description:"Systemd Service as frozen or idle",source:"@site/references/Systemd/shutting-down-persistance.md",sourceDirName:"Systemd",slug:"/Systemd/shutting-down-persistance",permalink:"/references/Systemd/shutting-down-persistance",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Systemd/shutting-down-persistance.md",tags:[{label:"reference",permalink:"/references/tags/reference"},{label:"shutdown",permalink:"/references/tags/shutdown"},{label:"frozen",permalink:"/references/tags/frozen"},{label:"idle",permalink:"/references/tags/idle"},{label:"service error",permalink:"/references/tags/service-error"},{label:"systemctl",permalink:"/references/tags/systemctl"},{label:"systemd",permalink:"/references/tags/systemd"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Shutting down persistance",slug:"shutting-down-persistance",hide_title:!0,tags:["reference","shutdown","frozen","idle","service error","systemctl","systemd"]},sidebar:"defaultSidebar",previous:{title:"Service keeps running after shutdown",permalink:"/references/Systemd/service-keeps-running-after-shutdown"},next:{title:"User service",permalink:"/references/Systemd/user-service"}},i={},u=[{value:"Systemd Service as frozen or idle",id:"systemd-service-as-frozen-or-idle",level:2}],d={toc:u},p="wrapper";function g(e){let{components:t,...n}=e;return(0,s.kt)(p,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("h2",{id:"systemd-service-as-frozen-or-idle"},"Systemd Service as frozen or idle"),(0,s.kt)("p",null,"If you have a ",(0,s.kt)("inlineCode",{parentName:"p"},"Shutting node down")," message on the service log, the process is likely failing to respond to Systemd shut down command by failing to terminate all the child processes that were started by the service."),(0,s.kt)("p",null,"The logs should be similar to the following:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"2023-09-11 18:02:07 | ERROR | lightning_consensus::consensus - core/consensus/src/consensus.rs:371 - node: XsE9KtedDRUGv22MLHvy8qcc52QsWGWJYY1LBnWhglg=\n2023-09-11 18:02:07 | ERROR | lightning_consensus::consensus - core/consensus/src/consensus.rs:371 - node: zBmZaycvQsdFRfe0p5Rig/KgyYPD4yNKQTPDo7JrugM=\n2023-09-11 18:02:07 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:373 - ##################\n2023-09-11 18:02:07 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:374 - ********************************\nRPC server starting up\nlistening on 0.0.0.0:4230\nShutting node down.\nShutting node down.\nShutting node down.\nShutting node down.\nShutting node down.\n")),(0,s.kt)("p",null,"To resolve this issue, start by executing a new ",(0,s.kt)("inlineCode",{parentName:"p"},"shutdown")," command as follows:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl stop lightning\n")),(0,s.kt)("p",null,"If you need to delegate to root, then use the ",(0,s.kt)("strong",{parentName:"p"},"sudo")," keyword, as follows:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl stop lightning\n")),(0,s.kt)("p",null,"Once completed, clear the logs to avoid confusion as the log aggregates messages past and current."),(0,s.kt)("p",null,"Delete all the log files (output.log and diagnostic.log) by running:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"sudo rm -f /var/log/lightning/*.log\n")),(0,s.kt)("p",null,"Launch the service:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl start lightning\n")),(0,s.kt)("p",null,"If you need to delegate to root, then use the ",(0,s.kt)("strong",{parentName:"p"},"sudo")," keyword, as follows:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl start lightning\n")),(0,s.kt)("p",null,"You can watch the log output of the service by running:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"tail -f /var/log/lightning/output.log\n")),(0,s.kt)("p",null,"The output should be similar to:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"2023-09-12 13:53:51 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:373 - ##################\n2023-09-12 13:53:51 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:374 - ********************************\n")),(0,s.kt)("p",null,"Alternatively, you can watch the diagnostic.log"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"tail -f /var/log/lightning/diagnostic.log\n")),(0,s.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}g.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>s});var r=n(7294);const s=e=>{let{image:t,name:n,title:s,url:a,communityMember:o=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:a,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:a,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},s),r.createElement("span",{className:"discord"},o?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file diff --git a/assets/js/98f9308d.8dde6aa3.js b/assets/js/98f9308d.b6142649.js similarity index 99% rename from assets/js/98f9308d.8dde6aa3.js rename to assets/js/98f9308d.b6142649.js index 16384dec9..8ba250111 100644 --- a/assets/js/98f9308d.8dde6aa3.js +++ b/assets/js/98f9308d.b6142649.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1025],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(7294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,a=e.originalType,i=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),d=c(r),m=s,f=d["".concat(i,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function f(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var a=r.length,l=new Array(a);l[0]=m;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[d]="string"==typeof e?e:s,l[1]=o;for(var c=2;c{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>i,toc:()=>p});var n=r(7462),s=(r(7294),r(3905)),a=r(3872);const l={title:"Service keeps running after shutdown",slug:"service-keeps-running-after-shutdown",hide_title:!0,tags:["reference","shutdown","systemctl","systemd","pkill","process"]},o=void 0,i={unversionedId:"Systemd/service-keeps-running-after-shutdown",id:"Systemd/service-keeps-running-after-shutdown",title:"Service keeps running after shutdown",description:"Stop the service",source:"@site/references/Systemd/service-keeps-running-after-shutdown.md",sourceDirName:"Systemd",slug:"/Systemd/service-keeps-running-after-shutdown",permalink:"/references/Systemd/service-keeps-running-after-shutdown",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Systemd/service-keeps-running-after-shutdown.md",tags:[{label:"reference",permalink:"/references/tags/reference"},{label:"shutdown",permalink:"/references/tags/shutdown"},{label:"systemctl",permalink:"/references/tags/systemctl"},{label:"systemd",permalink:"/references/tags/systemd"},{label:"pkill",permalink:"/references/tags/pkill"},{label:"process",permalink:"/references/tags/process"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Service keeps running after shutdown",slug:"service-keeps-running-after-shutdown",hide_title:!0,tags:["reference","shutdown","systemctl","systemd","pkill","process"]},sidebar:"defaultSidebar",previous:{title:"Update CLI from source code",permalink:"/references/Lightning CLI/update-cli-from-source-code"},next:{title:"Shutting down persistance",permalink:"/references/Systemd/shutting-down-persistance"}},c={},p=[{value:"Stop the service",id:"stop-the-service",level:2},{value:"Kill the process by name",id:"kill-the-process-by-name",level:2}],d={toc:p},u="wrapper";function m(e){let{components:t,...r}=e;return(0,s.kt)(u,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("h2",{id:"stop-the-service"},"Stop the service"),(0,s.kt)("p",null,"The ",(0,s.kt)("a",{parentName:"p",href:"/docs/node/systemd-service"},"Systemd service")," section tells how to stop the service, as follows:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl stop lightning\n")),(0,s.kt)("p",null,"Although, the service is set to restart on failure after a few seconds."),(0,s.kt)("h2",{id:"kill-the-process-by-name"},"Kill the process by name"),(0,s.kt)("p",null,"Force stop a process by name with the command ",(0,s.kt)("inlineCode",{parentName:"p"},"pkill"),"."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"pkill -f \n")),(0,s.kt)("p",null,"If you've followed the recommended settings, or used the assisted installer the process should be called ",(0,s.kt)("inlineCode",{parentName:"p"},"lgtn"),"."),(0,s.kt)("p",null,"A Systemd service is managed by ",(0,s.kt)("a",{parentName:"p",href:"/docs/node/systemd-service"},"Systemctl"),", to start, stop, to get status or restart. The service controls the Lightning CLI service, that for our convenience named as ",(0,s.kt)("inlineCode",{parentName:"p"},"lgtn"),"\u2013short for lightning. If you haven't followed the recommended settings and have a custom set up, you need to use the custom details you have defined."),(0,s.kt)("p",null,"To force stop the service ",(0,s.kt)("inlineCode",{parentName:"p"},"lgtn")," execute the command:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"sudo killall lgtn\n")),(0,s.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}m.isMDXComponent=!0},3872:(e,t,r)=>{r.d(t,{Z:()=>s});var n=r(7294);const s=e=>{let{image:t,name:r,title:s,url:a,communityMember:l=!1}=e;return n.createElement("section",{className:"author_card"},n.createElement("div",null,n.createElement("span",{className:"avatar"},n.createElement("a",{href:a,target:"_blank",alt:r},n.createElement("img",{src:t,alt:r}))),n.createElement("div",null,n.createElement("span",{className:"name"},n.createElement("a",{href:a,target:"_blank",alt:r},r)),n.createElement("span",{className:"title"},s),n.createElement("span",{className:"discord"},l?"Join our community on":"Got questions? Find us on"," ",n.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1025],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(7294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,a=e.originalType,i=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),d=c(r),m=s,f=d["".concat(i,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function f(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var a=r.length,l=new Array(a);l[0]=m;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[d]="string"==typeof e?e:s,l[1]=o;for(var c=2;c{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>i,toc:()=>p});var n=r(7462),s=(r(7294),r(3905)),a=r(3872);const l={title:"Service keeps running after shutdown",slug:"service-keeps-running-after-shutdown",hide_title:!0,tags:["reference","shutdown","systemctl","systemd","pkill","process"]},o=void 0,i={unversionedId:"Systemd/service-keeps-running-after-shutdown",id:"Systemd/service-keeps-running-after-shutdown",title:"Service keeps running after shutdown",description:"Stop the service",source:"@site/references/Systemd/service-keeps-running-after-shutdown.md",sourceDirName:"Systemd",slug:"/Systemd/service-keeps-running-after-shutdown",permalink:"/references/Systemd/service-keeps-running-after-shutdown",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Systemd/service-keeps-running-after-shutdown.md",tags:[{label:"reference",permalink:"/references/tags/reference"},{label:"shutdown",permalink:"/references/tags/shutdown"},{label:"systemctl",permalink:"/references/tags/systemctl"},{label:"systemd",permalink:"/references/tags/systemd"},{label:"pkill",permalink:"/references/tags/pkill"},{label:"process",permalink:"/references/tags/process"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Service keeps running after shutdown",slug:"service-keeps-running-after-shutdown",hide_title:!0,tags:["reference","shutdown","systemctl","systemd","pkill","process"]},sidebar:"defaultSidebar",previous:{title:"Update CLI from source code",permalink:"/references/Lightning CLI/update-cli-from-source-code"},next:{title:"Shutting down persistance",permalink:"/references/Systemd/shutting-down-persistance"}},c={},p=[{value:"Stop the service",id:"stop-the-service",level:2},{value:"Kill the process by name",id:"kill-the-process-by-name",level:2}],d={toc:p},u="wrapper";function m(e){let{components:t,...r}=e;return(0,s.kt)(u,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("h2",{id:"stop-the-service"},"Stop the service"),(0,s.kt)("p",null,"The ",(0,s.kt)("a",{parentName:"p",href:"/docs/node/systemd-service"},"Systemd service")," section tells how to stop the service, as follows:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl stop lightning\n")),(0,s.kt)("p",null,"Although, the service is set to restart on failure after a few seconds."),(0,s.kt)("h2",{id:"kill-the-process-by-name"},"Kill the process by name"),(0,s.kt)("p",null,"Force stop a process by name with the command ",(0,s.kt)("inlineCode",{parentName:"p"},"pkill"),"."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"pkill -f \n")),(0,s.kt)("p",null,"If you've followed the recommended settings, or used the assisted installer the process should be called ",(0,s.kt)("inlineCode",{parentName:"p"},"lgtn"),"."),(0,s.kt)("p",null,"A Systemd service is managed by ",(0,s.kt)("a",{parentName:"p",href:"/docs/node/systemd-service"},"Systemctl"),", to start, stop, to get status or restart. The service controls the Lightning CLI service, that for our convenience named as ",(0,s.kt)("inlineCode",{parentName:"p"},"lgtn"),"\u2013short for lightning. If you haven't followed the recommended settings and have a custom set up, you need to use the custom details you have defined."),(0,s.kt)("p",null,"To force stop the service ",(0,s.kt)("inlineCode",{parentName:"p"},"lgtn")," execute the command:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-sh"},"sudo killall lgtn\n")),(0,s.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}m.isMDXComponent=!0},3872:(e,t,r)=>{r.d(t,{Z:()=>s});var n=r(7294);const s=e=>{let{image:t,name:r,title:s,url:a,communityMember:l=!1}=e;return n.createElement("section",{className:"author_card"},n.createElement("div",null,n.createElement("span",{className:"avatar"},n.createElement("a",{href:a,target:"_blank",alt:r},n.createElement("img",{src:t,alt:r}))),n.createElement("div",null,n.createElement("span",{className:"name"},n.createElement("a",{href:a,target:"_blank",alt:r},r)),n.createElement("span",{className:"title"},s),n.createElement("span",{className:"discord"},l?"Join our community on":"Got questions? Find us on"," ",n.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file diff --git a/assets/js/b2f554cd.89e02325.js b/assets/js/b2f554cd.26978dab.js similarity index 99% rename from assets/js/b2f554cd.89e02325.js rename to assets/js/b2f554cd.26978dab.js index c19d1a65c..c44ecfa49 100644 --- a/assets/js/b2f554cd.89e02325.js +++ b/assets/js/b2f554cd.26978dab.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1477],{10:e=>{e.exports=JSON.parse('{"blogPosts":[{"id":"bloom-and-cuckoo-filters-for-cache-summarization","metadata":{"permalink":"/blog/bloom-and-cuckoo-filters-for-cache-summarization","source":"@site/blog/bloom-and-cuckoo-filters-for-cache-summarization.md","title":"Bloom Filters and Cuckoo Filters for Cache Summarization","description":"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.","date":"2023-10-20T15:50:16.000Z","formattedDate":"October 20, 2023","tags":[{"label":"fleek network","permalink":"/blog/tags/fleek-network"},{"label":"blog","permalink":"/blog/tags/blog"},{"label":"engineering","permalink":"/blog/tags/engineering"},{"label":"content routing","permalink":"/blog/tags/content-routing"}],"readingTime":10.37,"hasTruncateMarker":true,"authors":[{"name":"Matthias Wright","title":"Software Engineer","url":"https://github.com/matthias-wright","image_url":"https://github.com/matthias-wright.png","imageURL":"https://github.com/matthias-wright.png"}],"frontMatter":{"title":"Bloom Filters and Cuckoo Filters for Cache Summarization","description":"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.","slug":"bloom-and-cuckoo-filters-for-cache-summarization","image":"./assets/bloom-cuckoo/bloom.png?202301181528","authors":{"name":"Matthias Wright","title":"Software Engineer","url":"https://github.com/matthias-wright","image_url":"https://github.com/matthias-wright.png","imageURL":"https://github.com/matthias-wright.png"},"tags":["fleek network","blog","engineering","content routing"]}},"content":"Disclaimer: This is not a general comparison between Bloom filters and Cuckoo filters. This blog post summarizes some of the experiments we conducted to decide whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters, for a specific use case.\\n\\n\x3c!--truncate--\x3e\\n\\n## Background\\n\\nNodes on Fleek Network currently use Counting Bloom filters to summarize their cached content. These cache summaries are exchanged with other nodes in order to facilitate content routing.\\n\\nIf a particular node does not store a requested piece of content, it can use the Bloom filters that it received from its peers to check if a peer stores the requested content.\\n\\nWe are using Counting Bloom filters rather than regular Bloom filters because we need to be able to remove elements from the filter to support cache eviction.\\n\\n## Bloom Filters\\n\\nA Bloom filter is a space-efficient probabilistic data structure that can be used to perform approximate set membership queries.\\nThe answer to an approximate set membership query is not `no` or `yes,` but rather `no` or `probably.` This `probably` is quantified with the false positive rate. \\n\\nOne of the convenient features of Bloom filters is that they can be configured to have a specific false positive rate.\\nOf course, there is a tradeoff here; the lower the false positive rate, the larger the memory footprint. Bloom filters support two operations: `insert` and `contains.` \\n\\nA Bloom filter is represented by an array of m bits together with k independent hash functions. To insert an element into the filter, it is hashed with each of the k hash functions.\\nThe resulting hashes are interpreted as integers (modulo m) to obtain k array positions. The bits at these positions are then set to 1 (if there aren\'t already 1). \\nTo check whether or not an element is contained in the filter, the element is hashed k times with the different hash functions.\\n\\nIf all bits at the resulting array positions are 1, the element is assumed to be present. If any of the k bits are zero, we can be certain that the queried element is not present in the set.\\n\\nHowever, even if all bits are 1, it might still be the case that the bits were set by a combination of other elements. This is where the aforementioned false positive rate comes into play. \\n\\nSince we also need a `remove` operation for our use case, we have been using Counting Bloom filters, a variant of Bloom filters.\\nCounting Bloom filters retain most of the properties that regular Bloom filters have. The `remove` operation comes at the cost of an increased memory footprint.\\n\\nEach position in the array is no longer a single bit but a group of bits representing a counter.\\nWhenever an element is inserted into the filter, the counters for all k positions are incremented by 1. To remove an element, we decrement the counters.\\n\\n## Cuckoo Filters\\n\\nBloom filters are the most known members of a class of data structures called Approximate Membership Query Filters (AMQ Filters).\\nA relatively recent addition to this class is the Cuckoo filter [1]. Cuckoo filters share many similarities with Bloom filters, especially Counting Bloom filters.\\n\\nThey are space-efficient and can be used for approximate set membership queries. Cuckoo filters also support the operations `insert,` `contains,` and `remove,` and have configurable false positive rates. \\n\\nCuckoo filters are based on Cuckoo hash tables [2] and leverage an optimization called partial-key cuckoo hashing. A basic Cuckoo hash table consists of an array of buckets.\\nWe determine two candidate buckets for each element using two different hash functions, h1 and h2. \\n\\nThe `contains` operation will check if either bucket contains the element.\\nFor insertion, if either bucket is empty, the element will be inserted into the empty bucket.\\n\\nIf neither bucket is empty, one of the buckets is selected, and the existing element is removed and inserted into its alternate location.\\nThis may trigger another relocation if the alternate location is not empty. \\n\\nAlthough the insertion operation may perform a sequence of relocations, the amortized runtime is O(1). \\n\\nMost implementations of Cuckoo hash tables and, consequently, Cuckoo filters will use buckets that can hold multiple elements, as proposed in [3].\\n\\nFor Cuckoo filters, the hash table size is reduced by only storing fingerprints - a bit string calculated from an element\'s hash - rather than key-value pairs.\\n\\nThe fingerprint size is derived from the desired false positive rate. \\nA problem that arises is that, to relocate existing fingerprints using the Cuckoo hashing approach described above, we need the original hash from which the fingerprint was derived.\\n\\nOf course, we could store this hash somewhere, but the whole point of using fingerprints is to reduce the memory footprint of the filter.\\n\\nThe solution to this predicament is the aforementioned partial-key cuckoo hashing, a technique for determining an element\'s alternate location using only its fingerprint. \\nFor a given element x, the two candidate buckets are computed as follows: \\n\\n\\n\x3c!-- \\nTODO: Install math forms renderer, till then use img\\n\\n$h_1(x) = \\\\text{hash}(x)$\\n\\n$h_2(x) = h_1(x) \\\\oplus \\\\text{hash}(\\\\text{fingerprint}(x))$\\n--\x3e\\n\\n![](./assets/bloom-cuckoo/math-formul.png?202301181528)\\n\\nAn important property of this technique is that h1(x) can also be computed from h2(x) and the fingerprint.\\n\\n## Benchmarking\\n\\nAs this post mentioned, we are not aiming for a general comparison of Counting Bloom and Cuckoo filters.\\n\\nInstead, we want to determine which filter suits our specific use case better. The two main properties we are looking for are space efficiency and lookup performance. \\n\\nSpace efficiency is important because nodes frequently update their cache and have to communicate these changes with their peers. These messages should take up as little bandwidth as possible.\\n\\nLookup speed is also important because Fleek Network aims to serve user requests as quickly as possible. Checking whether a peer has some content stored in their cache summary should not be a bottleneck. \\n\\n## Experimental Setup\\n\\nWe are using our own Counting Bloom filter [implementation](https://github.com/fleek-network/ursa/blob/483f4d56cbaa5e83182454d2c1db6f6af7c54912/crates/ursa-network/src/utils/bloom_filter.rs#L11) and [scalable cuckoo filter](https://github.com/sile/scalable_cuckoo_filter?gh) Cuckoo filter implementation in Rust, the [original cuckoofilter](https://github.com/efficient/cuckoofilter?gh) implementation is in C++. All experiments were performed on a Linux machine with 16 GB RAM and an Intel Core i7 (10th Gen). Whenever the experiment is probabilistic, we repeat the experiment 20 times and report the mean and standard deviation.\\n\\n## Memory Footprint\\n\\nFor both Counting Bloom filters and Cuckoo filters, the memory footprint is determined by two factors: the filter\'s capacity and the desired false positive rate. In the first experiment, we examine the impact that\\nthese factors have on the memory footprint. \\n\\nTo this end, we fix the false positive rate and initialize the filters with capacities ranging from 100K to 1M. The result is shown in Fig. 1. \\nThe size of Bloom filters scales linearly with the capacity. Cuckoo filters are more space-efficient. This result is consistent with the experiments reported in [1].\\n\\n![](./assets/bloom-cuckoo/capacity-size.png?202301121718)\\n\\n> Figure 1: We fix the false positive rate and initialize the filters with capacities ranging from 100K to 1M. The y-axis shows the size of the filters in Megabytes.\\n\\nNext, we fix the capacity and initialize the filters with false positive rates ranging from 0.0001 to 0.5. Fig. 2 shows that Cuckoo filters are more space-efficient.\\n\\nThe gap between Counting Bloom filters and Cuckoo filters grows as the false positive rate decreases. This is also consistent with experiments in [1].\\n\\n![](./assets/bloom-cuckoo/fp-rate-size.png?202301121718)\\n\\n> Figure 2: We fix the capacity and initialize the filters with false positive rates ranging from 0.0001 to 0.5. The y-axis shows the size of the filters in Megabytes.\\n\\n## Lookup Performance\\n\\nWe first add elements to both filters until the capacity is reached. We then measure the lookup performance for different ratios of positive and negative lookups.\\n\\nA positive lookup is for an existing element, and a negative lookup is for an element not contained in the filter. We perform 100K lookups for each ratio and report the average lookup duration and standard deviation. \\n\\nFig. 3 shows the results. Bloom filters perform slightly better on average than Cuckoo filters. This result is inconsistent with [1],\\nwhere Cuckoo filters were reported to have a better lookup performance than Bloom filters. It should be noted here that the authors in [1] use the original C++ Cuckoo filter implementation and their own unreleased Bloom filter implementation. In contrast, we use a Rust Cuckoo filter implementation and our Bloom filter implementation. We cannot easily determine the reason for this discrepancy.\\n\\nHowever, the performance difference is negligible.\\n\\n![](./assets/bloom-cuckoo/lookup.png?202301121718)\\n\\n> Figure 3: Lookup performance for different ratios of positive and negative lookups. For example, ratio 0.25 indicates that 25% of lookups are positive and 75% are negative.\\nThe shaded region indicates the standard deviation.\\n\\n## Insertion Performance\\n\\nLess critical than lookup performance but still important for our purposes is insertion performance. We measure how the insertion performance varies for different occupancy levels.\\nFig. 4 shows the results. The insertion performance is constant across all levels of occupancy for Bloom filters.\\n\\nFor Cuckoo filters, the performance decreases as the filter becomes fuller because more relocations are required. In Fig. 4, the performance for Bloom filters is not constant. It quickly increases and then remains constant. This can be explained by CPU caching. \\n\\n![](./assets/bloom-cuckoo/insert.png?202301121718)\\n\\n> Figure 4: Insertion performance for different occupancy levels. The shaded region indicates the standard deviation.\\n\\n## Capacity and Scaling\\n\\nWe have mentioned the capacity of a filter several times now. An interesting case is what happens when a filter\'s capacity is exceeded.\\nBloom filters and Cuckoo filters behave differently in this scenario.\\n\\nFor Bloom filters, the `insertion` operation always succeeds. However, the false positive rate will rapidly increase as we exceed the filter\'s capacity. While Bloom filters fail silently, Cuckoo filters are more explicit. Most implementations have a maximum number of\\nrelocations that will be performed for an insertion. The `insertion` operation will return an error if more relocations are required. \\n\\nFor both filters, we can avoid this problem by simply initializing the filter with a sufficiently large capacity. However, this will increase the memory footprint of the filter.\\n\\nFurthermore, it is difficult to predict how many elements a node on Fleek Network will cache. It is also likely that the number of cached elements will greatly vary for different nodes. \\n\\nFortunately, a variant of Bloom filters called Scalable Bloom Filters [4] can adapt dynamically to the number of elements stored while guaranteeing a maximum false positive rate.\\n\\nThe proposed technique is also applicable to Cuckoo filters.\\n\\n## Other Filters\\n\\nWhile we only looked at Bloom filters and Cuckoo filters, there are other AMQ filters that we want to mention here briefly:\\n\\n* Quotient filters [5, 6]: Compact hash tables that support insertion, lookup, and deletion. Less space-efficient than Bloom filters and Cuckoo filters. \\n\\n* XOR filters [7]: More space-efficient than Bloom filters and Cuckoo filters. However, they are static, meaning the filter has to be rebuilt if additional elements are added. \\n\\n## Conclusion\\n\\nWe examined whether Counting Bloom filters or Cuckoo filters are more suitable for summarizing caches on Fleek Network. Cuckoo filters are more space-efficient, especially for lower false positive rates. Bloom filters have a slightly better insertion and lookup performance for the implementations we tested.\\n\\nBoth filters can be adapted to grow and shrink in size dynamically. Since the difference in insertion and lookup performance is negligible while Cuckoo filters are significantly more space-efficient, we favor Cuckoo filters for our use case. \\n\\n### References\\n\\n[1] Bin Fan, Dave G. Andersen, Michael Kaminsky, and Michael D. Mitzenmacher. Cuckoo Filter: Practically Better Than Bloom.\\nIn Proceedings of the 10th ACM International Conference on emerging Networking Experiments and Technologies (CoNEXT 14). Association for Computing Machinery, New York, NY, USA, pp. 75-88, 2014. \\n\\n[2] Rasmus Pagha and Flemming Friche Rodler. Cuckoo hashing. Journal of Algorithms, 51(2), pp. 122-144, 2004. \\n\\n[3] Martin Dietzfelbinger and Christoph Weidling. Balanced Allocation and Dictionaries with Tightly Packed Constant Size Bins. Theoretical Computer Science, 380(1), pp. 47-68, 2007. \\n\\n[4] Paulo S. Almeida, Carlos Baquero, Nuno Pregui\xe7a, and David Hutchison. Scalable Bloom Filters. Information Processing Letters, 101(6), pp. 255-261, 2007. \\n\\n[5] John G. Cleary. Compact hash tables using bidirectional linear probing. IEEE Transactions on Computers. 33(9), pp. 828-834, 1984. \\n\\n[6] Anna Pagh, Rasmus Pagh, and S. Srinivasa Rao. An optimal Bloom filter replacement. Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 823-829, 2005. \\n \\n[7] Thomas Mueller Graf and Daniel Lemire. Xor Filters: Faster and Smaller Than Bloom and Cuckoo Filters. ACM Journal of Experimental Algorithmics. 25, pp. 1-16, 2020."}]}')}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1477],{10:e=>{e.exports=JSON.parse('{"blogPosts":[{"id":"bloom-and-cuckoo-filters-for-cache-summarization","metadata":{"permalink":"/blog/bloom-and-cuckoo-filters-for-cache-summarization","source":"@site/blog/bloom-and-cuckoo-filters-for-cache-summarization.md","title":"Bloom Filters and Cuckoo Filters for Cache Summarization","description":"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.","date":"2023-10-20T16:26:18.000Z","formattedDate":"October 20, 2023","tags":[{"label":"fleek network","permalink":"/blog/tags/fleek-network"},{"label":"blog","permalink":"/blog/tags/blog"},{"label":"engineering","permalink":"/blog/tags/engineering"},{"label":"content routing","permalink":"/blog/tags/content-routing"}],"readingTime":10.37,"hasTruncateMarker":true,"authors":[{"name":"Matthias Wright","title":"Software Engineer","url":"https://github.com/matthias-wright","image_url":"https://github.com/matthias-wright.png","imageURL":"https://github.com/matthias-wright.png"}],"frontMatter":{"title":"Bloom Filters and Cuckoo Filters for Cache Summarization","description":"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.","slug":"bloom-and-cuckoo-filters-for-cache-summarization","image":"./assets/bloom-cuckoo/bloom.png?202301181528","authors":{"name":"Matthias Wright","title":"Software Engineer","url":"https://github.com/matthias-wright","image_url":"https://github.com/matthias-wright.png","imageURL":"https://github.com/matthias-wright.png"},"tags":["fleek network","blog","engineering","content routing"]}},"content":"Disclaimer: This is not a general comparison between Bloom filters and Cuckoo filters. This blog post summarizes some of the experiments we conducted to decide whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters, for a specific use case.\\n\\n\x3c!--truncate--\x3e\\n\\n## Background\\n\\nNodes on Fleek Network currently use Counting Bloom filters to summarize their cached content. These cache summaries are exchanged with other nodes in order to facilitate content routing.\\n\\nIf a particular node does not store a requested piece of content, it can use the Bloom filters that it received from its peers to check if a peer stores the requested content.\\n\\nWe are using Counting Bloom filters rather than regular Bloom filters because we need to be able to remove elements from the filter to support cache eviction.\\n\\n## Bloom Filters\\n\\nA Bloom filter is a space-efficient probabilistic data structure that can be used to perform approximate set membership queries.\\nThe answer to an approximate set membership query is not `no` or `yes,` but rather `no` or `probably.` This `probably` is quantified with the false positive rate. \\n\\nOne of the convenient features of Bloom filters is that they can be configured to have a specific false positive rate.\\nOf course, there is a tradeoff here; the lower the false positive rate, the larger the memory footprint. Bloom filters support two operations: `insert` and `contains.` \\n\\nA Bloom filter is represented by an array of m bits together with k independent hash functions. To insert an element into the filter, it is hashed with each of the k hash functions.\\nThe resulting hashes are interpreted as integers (modulo m) to obtain k array positions. The bits at these positions are then set to 1 (if there aren\'t already 1). \\nTo check whether or not an element is contained in the filter, the element is hashed k times with the different hash functions.\\n\\nIf all bits at the resulting array positions are 1, the element is assumed to be present. If any of the k bits are zero, we can be certain that the queried element is not present in the set.\\n\\nHowever, even if all bits are 1, it might still be the case that the bits were set by a combination of other elements. This is where the aforementioned false positive rate comes into play. \\n\\nSince we also need a `remove` operation for our use case, we have been using Counting Bloom filters, a variant of Bloom filters.\\nCounting Bloom filters retain most of the properties that regular Bloom filters have. The `remove` operation comes at the cost of an increased memory footprint.\\n\\nEach position in the array is no longer a single bit but a group of bits representing a counter.\\nWhenever an element is inserted into the filter, the counters for all k positions are incremented by 1. To remove an element, we decrement the counters.\\n\\n## Cuckoo Filters\\n\\nBloom filters are the most known members of a class of data structures called Approximate Membership Query Filters (AMQ Filters).\\nA relatively recent addition to this class is the Cuckoo filter [1]. Cuckoo filters share many similarities with Bloom filters, especially Counting Bloom filters.\\n\\nThey are space-efficient and can be used for approximate set membership queries. Cuckoo filters also support the operations `insert,` `contains,` and `remove,` and have configurable false positive rates. \\n\\nCuckoo filters are based on Cuckoo hash tables [2] and leverage an optimization called partial-key cuckoo hashing. A basic Cuckoo hash table consists of an array of buckets.\\nWe determine two candidate buckets for each element using two different hash functions, h1 and h2. \\n\\nThe `contains` operation will check if either bucket contains the element.\\nFor insertion, if either bucket is empty, the element will be inserted into the empty bucket.\\n\\nIf neither bucket is empty, one of the buckets is selected, and the existing element is removed and inserted into its alternate location.\\nThis may trigger another relocation if the alternate location is not empty. \\n\\nAlthough the insertion operation may perform a sequence of relocations, the amortized runtime is O(1). \\n\\nMost implementations of Cuckoo hash tables and, consequently, Cuckoo filters will use buckets that can hold multiple elements, as proposed in [3].\\n\\nFor Cuckoo filters, the hash table size is reduced by only storing fingerprints - a bit string calculated from an element\'s hash - rather than key-value pairs.\\n\\nThe fingerprint size is derived from the desired false positive rate. \\nA problem that arises is that, to relocate existing fingerprints using the Cuckoo hashing approach described above, we need the original hash from which the fingerprint was derived.\\n\\nOf course, we could store this hash somewhere, but the whole point of using fingerprints is to reduce the memory footprint of the filter.\\n\\nThe solution to this predicament is the aforementioned partial-key cuckoo hashing, a technique for determining an element\'s alternate location using only its fingerprint. \\nFor a given element x, the two candidate buckets are computed as follows: \\n\\n\\n\x3c!-- \\nTODO: Install math forms renderer, till then use img\\n\\n$h_1(x) = \\\\text{hash}(x)$\\n\\n$h_2(x) = h_1(x) \\\\oplus \\\\text{hash}(\\\\text{fingerprint}(x))$\\n--\x3e\\n\\n![](./assets/bloom-cuckoo/math-formul.png?202301181528)\\n\\nAn important property of this technique is that h1(x) can also be computed from h2(x) and the fingerprint.\\n\\n## Benchmarking\\n\\nAs this post mentioned, we are not aiming for a general comparison of Counting Bloom and Cuckoo filters.\\n\\nInstead, we want to determine which filter suits our specific use case better. The two main properties we are looking for are space efficiency and lookup performance. \\n\\nSpace efficiency is important because nodes frequently update their cache and have to communicate these changes with their peers. These messages should take up as little bandwidth as possible.\\n\\nLookup speed is also important because Fleek Network aims to serve user requests as quickly as possible. Checking whether a peer has some content stored in their cache summary should not be a bottleneck. \\n\\n## Experimental Setup\\n\\nWe are using our own Counting Bloom filter [implementation](https://github.com/fleek-network/ursa/blob/483f4d56cbaa5e83182454d2c1db6f6af7c54912/crates/ursa-network/src/utils/bloom_filter.rs#L11) and [scalable cuckoo filter](https://github.com/sile/scalable_cuckoo_filter?gh) Cuckoo filter implementation in Rust, the [original cuckoofilter](https://github.com/efficient/cuckoofilter?gh) implementation is in C++. All experiments were performed on a Linux machine with 16 GB RAM and an Intel Core i7 (10th Gen). Whenever the experiment is probabilistic, we repeat the experiment 20 times and report the mean and standard deviation.\\n\\n## Memory Footprint\\n\\nFor both Counting Bloom filters and Cuckoo filters, the memory footprint is determined by two factors: the filter\'s capacity and the desired false positive rate. In the first experiment, we examine the impact that\\nthese factors have on the memory footprint. \\n\\nTo this end, we fix the false positive rate and initialize the filters with capacities ranging from 100K to 1M. The result is shown in Fig. 1. \\nThe size of Bloom filters scales linearly with the capacity. Cuckoo filters are more space-efficient. This result is consistent with the experiments reported in [1].\\n\\n![](./assets/bloom-cuckoo/capacity-size.png?202301121718)\\n\\n> Figure 1: We fix the false positive rate and initialize the filters with capacities ranging from 100K to 1M. The y-axis shows the size of the filters in Megabytes.\\n\\nNext, we fix the capacity and initialize the filters with false positive rates ranging from 0.0001 to 0.5. Fig. 2 shows that Cuckoo filters are more space-efficient.\\n\\nThe gap between Counting Bloom filters and Cuckoo filters grows as the false positive rate decreases. This is also consistent with experiments in [1].\\n\\n![](./assets/bloom-cuckoo/fp-rate-size.png?202301121718)\\n\\n> Figure 2: We fix the capacity and initialize the filters with false positive rates ranging from 0.0001 to 0.5. The y-axis shows the size of the filters in Megabytes.\\n\\n## Lookup Performance\\n\\nWe first add elements to both filters until the capacity is reached. We then measure the lookup performance for different ratios of positive and negative lookups.\\n\\nA positive lookup is for an existing element, and a negative lookup is for an element not contained in the filter. We perform 100K lookups for each ratio and report the average lookup duration and standard deviation. \\n\\nFig. 3 shows the results. Bloom filters perform slightly better on average than Cuckoo filters. This result is inconsistent with [1],\\nwhere Cuckoo filters were reported to have a better lookup performance than Bloom filters. It should be noted here that the authors in [1] use the original C++ Cuckoo filter implementation and their own unreleased Bloom filter implementation. In contrast, we use a Rust Cuckoo filter implementation and our Bloom filter implementation. We cannot easily determine the reason for this discrepancy.\\n\\nHowever, the performance difference is negligible.\\n\\n![](./assets/bloom-cuckoo/lookup.png?202301121718)\\n\\n> Figure 3: Lookup performance for different ratios of positive and negative lookups. For example, ratio 0.25 indicates that 25% of lookups are positive and 75% are negative.\\nThe shaded region indicates the standard deviation.\\n\\n## Insertion Performance\\n\\nLess critical than lookup performance but still important for our purposes is insertion performance. We measure how the insertion performance varies for different occupancy levels.\\nFig. 4 shows the results. The insertion performance is constant across all levels of occupancy for Bloom filters.\\n\\nFor Cuckoo filters, the performance decreases as the filter becomes fuller because more relocations are required. In Fig. 4, the performance for Bloom filters is not constant. It quickly increases and then remains constant. This can be explained by CPU caching. \\n\\n![](./assets/bloom-cuckoo/insert.png?202301121718)\\n\\n> Figure 4: Insertion performance for different occupancy levels. The shaded region indicates the standard deviation.\\n\\n## Capacity and Scaling\\n\\nWe have mentioned the capacity of a filter several times now. An interesting case is what happens when a filter\'s capacity is exceeded.\\nBloom filters and Cuckoo filters behave differently in this scenario.\\n\\nFor Bloom filters, the `insertion` operation always succeeds. However, the false positive rate will rapidly increase as we exceed the filter\'s capacity. While Bloom filters fail silently, Cuckoo filters are more explicit. Most implementations have a maximum number of\\nrelocations that will be performed for an insertion. The `insertion` operation will return an error if more relocations are required. \\n\\nFor both filters, we can avoid this problem by simply initializing the filter with a sufficiently large capacity. However, this will increase the memory footprint of the filter.\\n\\nFurthermore, it is difficult to predict how many elements a node on Fleek Network will cache. It is also likely that the number of cached elements will greatly vary for different nodes. \\n\\nFortunately, a variant of Bloom filters called Scalable Bloom Filters [4] can adapt dynamically to the number of elements stored while guaranteeing a maximum false positive rate.\\n\\nThe proposed technique is also applicable to Cuckoo filters.\\n\\n## Other Filters\\n\\nWhile we only looked at Bloom filters and Cuckoo filters, there are other AMQ filters that we want to mention here briefly:\\n\\n* Quotient filters [5, 6]: Compact hash tables that support insertion, lookup, and deletion. Less space-efficient than Bloom filters and Cuckoo filters. \\n\\n* XOR filters [7]: More space-efficient than Bloom filters and Cuckoo filters. However, they are static, meaning the filter has to be rebuilt if additional elements are added. \\n\\n## Conclusion\\n\\nWe examined whether Counting Bloom filters or Cuckoo filters are more suitable for summarizing caches on Fleek Network. Cuckoo filters are more space-efficient, especially for lower false positive rates. Bloom filters have a slightly better insertion and lookup performance for the implementations we tested.\\n\\nBoth filters can be adapted to grow and shrink in size dynamically. Since the difference in insertion and lookup performance is negligible while Cuckoo filters are significantly more space-efficient, we favor Cuckoo filters for our use case. \\n\\n### References\\n\\n[1] Bin Fan, Dave G. Andersen, Michael Kaminsky, and Michael D. Mitzenmacher. Cuckoo Filter: Practically Better Than Bloom.\\nIn Proceedings of the 10th ACM International Conference on emerging Networking Experiments and Technologies (CoNEXT 14). Association for Computing Machinery, New York, NY, USA, pp. 75-88, 2014. \\n\\n[2] Rasmus Pagha and Flemming Friche Rodler. Cuckoo hashing. Journal of Algorithms, 51(2), pp. 122-144, 2004. \\n\\n[3] Martin Dietzfelbinger and Christoph Weidling. Balanced Allocation and Dictionaries with Tightly Packed Constant Size Bins. Theoretical Computer Science, 380(1), pp. 47-68, 2007. \\n\\n[4] Paulo S. Almeida, Carlos Baquero, Nuno Pregui\xe7a, and David Hutchison. Scalable Bloom Filters. Information Processing Letters, 101(6), pp. 255-261, 2007. \\n\\n[5] John G. Cleary. Compact hash tables using bidirectional linear probing. IEEE Transactions on Computers. 33(9), pp. 828-834, 1984. \\n\\n[6] Anna Pagh, Rasmus Pagh, and S. Srinivasa Rao. An optimal Bloom filter replacement. Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 823-829, 2005. \\n \\n[7] Thomas Mueller Graf and Daniel Lemire. Xor Filters: Faster and Smaller Than Bloom and Cuckoo Filters. ACM Journal of Experimental Algorithmics. 25, pp. 1-16, 2020."}]}')}}]); \ No newline at end of file diff --git a/assets/js/b35f1b7f.5506d9ad.js b/assets/js/b35f1b7f.902fd0cd.js similarity index 99% rename from assets/js/b35f1b7f.5506d9ad.js rename to assets/js/b35f1b7f.902fd0cd.js index d3c744dc1..c491f30da 100644 --- a/assets/js/b35f1b7f.5506d9ad.js +++ b/assets/js/b35f1b7f.902fd0cd.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[7706],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>h});var s=r(7294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}function l(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var o=s.createContext({}),u=function(e){var t=s.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=u(e.components);return s.createElement(o.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return s.createElement(s.Fragment,{},t)}},d=s.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,o=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=u(r),d=n,h=p["".concat(o,".").concat(d)]||p[d]||m[d]||a;return r?s.createElement(h,l(l({ref:t},c),{},{components:r})):s.createElement(h,l({ref:t},c))}));function h(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,l=new Array(a);l[0]=d;var i={};for(var o in t)hasOwnProperty.call(t,o)&&(i[o]=t[o]);i.originalType=e,i[p]="string"==typeof e?e:n,l[1]=i;for(var u=2;u{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>c});var s=r(7462),n=(r(7294),r(3905)),a=r(3872);const l={title:"User service",slug:"user-service",hide_title:!0,tags:["references","help","user service","unit","systemctl","systemd"]},i=void 0,o={unversionedId:"Systemd/user-service",id:"Systemd/user-service",title:"User service",description:"A user should have the ability to run a Systemd user service unit without having to use sudo to control it.",source:"@site/references/Systemd/user-service.md",sourceDirName:"Systemd",slug:"/Systemd/user-service",permalink:"/references/Systemd/user-service",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Systemd/user-service.md",tags:[{label:"references",permalink:"/references/tags/references"},{label:"help",permalink:"/references/tags/help"},{label:"user service",permalink:"/references/tags/user-service"},{label:"unit",permalink:"/references/tags/unit"},{label:"systemctl",permalink:"/references/tags/systemctl"},{label:"systemd",permalink:"/references/tags/systemd"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"User service",slug:"user-service",hide_title:!0,tags:["references","help","user service","unit","systemctl","systemd"]},sidebar:"defaultSidebar",previous:{title:"Shutting down persistance",permalink:"/references/Systemd/shutting-down-persistance"}},u={},c=[{value:"Check --user support",id:"check---user-support",level:2},{value:"Put the service unit in the user service",id:"put-the-service-unit-in-the-user-service",level:2},{value:"Systemd service control as --user",id:"systemd-service-control-as---user",level:2},{value:"Problem statement",id:"problem-statement",level:2}],p={toc:c},m="wrapper";function d(e){let{components:t,...r}=e;return(0,n.kt)(m,(0,s.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"A user should have the ability to run a Systemd user service unit without having to use ",(0,n.kt)("inlineCode",{parentName:"p"},"sudo")," to control it."),(0,n.kt)("h2",{id:"check---user-support"},"Check ",(0,n.kt)("inlineCode",{parentName:"h2"},"--user")," support"),(0,n.kt)("p",null,"Use the ",(0,n.kt)("inlineCode",{parentName:"p"},"--user")," flag when getting the list of unit files."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user list-unit-files\n")),(0,n.kt)("p",null,"It should return a list of unit files."),(0,n.kt)("h2",{id:"put-the-service-unit-in-the-user-service"},"Put the service unit in the user service"),(0,n.kt)("p",null,"Create the Systemd user units directory:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"sudo mkdir -p /etc/systemd/system/user\n")),(0,n.kt)("p",null,"Move the ",(0,n.kt)("inlineCode",{parentName:"p"},"lightning.service")," to the system user unit service directory:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"mv /etc/systemd/system/lightning.service /etc/systemd/system/user/lightning.service\n")),(0,n.kt)("p",null,"Check the ",(0,n.kt)("strong",{parentName:"p"},"Load path when running in user mode (--user)")," in ",(0,n.kt)("a",{parentName:"p",href:"https://www.freedesktop.org/software/systemd/man/systemd.unit.html"},"Systemd unit")," for other alternative user paths, or to understand how it works to customize your server accordingly."),(0,n.kt)("p",null,"##\xa0Reload daemon"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,n.kt)("h2",{id:"systemd-service-control-as---user"},"Systemd service control as ",(0,n.kt)("inlineCode",{parentName:"h2"},"--user")),(0,n.kt)("p",null,"Reload the Systemctl daemon by executing the command:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user daemon-reload\n")),(0,n.kt)("p",null,"Enable the service for starting up on system boot:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user enable lightning.service\n")),(0,n.kt)("p",null,"Start the service by:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user start lightning\n")),(0,n.kt)("p",null,"Stop the service by:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user stop lightning\n")),(0,n.kt)("p",null,"Restart the service by:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user restart lightning\n")),(0,n.kt)("p",null,"Check the service status by:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user status lightning.service\n")),(0,n.kt)("h2",{id:"problem-statement"},"Problem statement"),(0,n.kt)("p",null,"On tests done in a DigitalOcean Ubuntu 22.x, we had set up user-level services which were operated with ",(0,n.kt)("inlineCode",{parentName:"p"},"--user"),". When the commands were executed as ",(0,n.kt)("inlineCode",{parentName:"p"},"--user")," it failed with:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"Failed to connect to bus: Operation not permitted (consider using --machine=@.host --user to connect to bus of other user)\n")),(0,n.kt)("p",null,"The user should be able to operate as user, it shouldn't be required to connect on behalf of other users. This means that even for a simple command, such as to retrieve the list of unit files:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user list-unit-files\n")),(0,n.kt)("p",null,"We'd get the error:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"Failed to connect to bus: Operation not permitted (consider using --machine=@.host --user to connect to bus of other user)\n")),(0,n.kt)("p",null,"For any of the supported user unit locations e.g. $HOME/.config/systemd/user as documented in ",(0,n.kt)("a",{parentName:"p",href:"https://www.freedesktop.org/software/systemd/man/systemd.unit.html"},"Systemd unit documentation"),", the result is the error above."),(0,n.kt)("p",null,"This is related to the load paths when running in user mode (--user), as described in the discussion ",(0,n.kt)("a",{parentName:"p",href:"https://unix.stackexchange.com/questions/224992/where-do-i-put-my-systemd-unit-file/367237#367237"},"here"),"."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"User-dependent")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"$XDG_CONFIG_HOME/systemd/user")," User configuration (only used when $XDG_CONFIG_HOME is set)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"$HOME/.config/systemd/user")," User configuration (only used when $XDG_CONFIG_HOME is not set)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"$XDG_RUNTIME_DIR/systemd/user")," Runtime units (only used when $XDG_RUNTIME_DIR is set)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"$XDG_DATA_HOME/systemd/user")," Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is set)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"$HOME/.local/share/systemd/user")," Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is not set)"),(0,n.kt)("p",null,"For example, if we check the ",(0,n.kt)("inlineCode",{parentName:"p"},"$XDG_RUNTIME_DIR")," in a DigitalOcean box, we get the following output:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"/run/user/0\n")),(0,n.kt)("p",null,"For this reason and to provide support for a wider audience of users and systems, we've stuck to sudo to execute the service, but this should not be a requirement and is not recommended."),(0,n.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}d.isMDXComponent=!0},3872:(e,t,r)=>{r.d(t,{Z:()=>n});var s=r(7294);const n=e=>{let{image:t,name:r,title:n,url:a,communityMember:l=!1}=e;return s.createElement("section",{className:"author_card"},s.createElement("div",null,s.createElement("span",{className:"avatar"},s.createElement("a",{href:a,target:"_blank",alt:r},s.createElement("img",{src:t,alt:r}))),s.createElement("div",null,s.createElement("span",{className:"name"},s.createElement("a",{href:a,target:"_blank",alt:r},r)),s.createElement("span",{className:"title"},n),s.createElement("span",{className:"discord"},l?"Join our community on":"Got questions? Find us on"," ",s.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[7706],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>h});var s=r(7294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}function l(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var o=s.createContext({}),u=function(e){var t=s.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=u(e.components);return s.createElement(o.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return s.createElement(s.Fragment,{},t)}},d=s.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,o=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=u(r),d=n,h=p["".concat(o,".").concat(d)]||p[d]||m[d]||a;return r?s.createElement(h,l(l({ref:t},c),{},{components:r})):s.createElement(h,l({ref:t},c))}));function h(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,l=new Array(a);l[0]=d;var i={};for(var o in t)hasOwnProperty.call(t,o)&&(i[o]=t[o]);i.originalType=e,i[p]="string"==typeof e?e:n,l[1]=i;for(var u=2;u{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>c});var s=r(7462),n=(r(7294),r(3905)),a=r(3872);const l={title:"User service",slug:"user-service",hide_title:!0,tags:["references","help","user service","unit","systemctl","systemd"]},i=void 0,o={unversionedId:"Systemd/user-service",id:"Systemd/user-service",title:"User service",description:"A user should have the ability to run a Systemd user service unit without having to use sudo to control it.",source:"@site/references/Systemd/user-service.md",sourceDirName:"Systemd",slug:"/Systemd/user-service",permalink:"/references/Systemd/user-service",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Systemd/user-service.md",tags:[{label:"references",permalink:"/references/tags/references"},{label:"help",permalink:"/references/tags/help"},{label:"user service",permalink:"/references/tags/user-service"},{label:"unit",permalink:"/references/tags/unit"},{label:"systemctl",permalink:"/references/tags/systemctl"},{label:"systemd",permalink:"/references/tags/systemd"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"User service",slug:"user-service",hide_title:!0,tags:["references","help","user service","unit","systemctl","systemd"]},sidebar:"defaultSidebar",previous:{title:"Shutting down persistance",permalink:"/references/Systemd/shutting-down-persistance"}},u={},c=[{value:"Check --user support",id:"check---user-support",level:2},{value:"Put the service unit in the user service",id:"put-the-service-unit-in-the-user-service",level:2},{value:"Systemd service control as --user",id:"systemd-service-control-as---user",level:2},{value:"Problem statement",id:"problem-statement",level:2}],p={toc:c},m="wrapper";function d(e){let{components:t,...r}=e;return(0,n.kt)(m,(0,s.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"A user should have the ability to run a Systemd user service unit without having to use ",(0,n.kt)("inlineCode",{parentName:"p"},"sudo")," to control it."),(0,n.kt)("h2",{id:"check---user-support"},"Check ",(0,n.kt)("inlineCode",{parentName:"h2"},"--user")," support"),(0,n.kt)("p",null,"Use the ",(0,n.kt)("inlineCode",{parentName:"p"},"--user")," flag when getting the list of unit files."),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user list-unit-files\n")),(0,n.kt)("p",null,"It should return a list of unit files."),(0,n.kt)("h2",{id:"put-the-service-unit-in-the-user-service"},"Put the service unit in the user service"),(0,n.kt)("p",null,"Create the Systemd user units directory:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"sudo mkdir -p /etc/systemd/system/user\n")),(0,n.kt)("p",null,"Move the ",(0,n.kt)("inlineCode",{parentName:"p"},"lightning.service")," to the system user unit service directory:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"mv /etc/systemd/system/lightning.service /etc/systemd/system/user/lightning.service\n")),(0,n.kt)("p",null,"Check the ",(0,n.kt)("strong",{parentName:"p"},"Load path when running in user mode (--user)")," in ",(0,n.kt)("a",{parentName:"p",href:"https://www.freedesktop.org/software/systemd/man/systemd.unit.html"},"Systemd unit")," for other alternative user paths, or to understand how it works to customize your server accordingly."),(0,n.kt)("p",null,"##\xa0Reload daemon"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"sudo systemctl daemon-reload\n")),(0,n.kt)("h2",{id:"systemd-service-control-as---user"},"Systemd service control as ",(0,n.kt)("inlineCode",{parentName:"h2"},"--user")),(0,n.kt)("p",null,"Reload the Systemctl daemon by executing the command:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user daemon-reload\n")),(0,n.kt)("p",null,"Enable the service for starting up on system boot:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user enable lightning.service\n")),(0,n.kt)("p",null,"Start the service by:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user start lightning\n")),(0,n.kt)("p",null,"Stop the service by:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user stop lightning\n")),(0,n.kt)("p",null,"Restart the service by:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user restart lightning\n")),(0,n.kt)("p",null,"Check the service status by:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user status lightning.service\n")),(0,n.kt)("h2",{id:"problem-statement"},"Problem statement"),(0,n.kt)("p",null,"On tests done in a DigitalOcean Ubuntu 22.x, we had set up user-level services which were operated with ",(0,n.kt)("inlineCode",{parentName:"p"},"--user"),". When the commands were executed as ",(0,n.kt)("inlineCode",{parentName:"p"},"--user")," it failed with:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"Failed to connect to bus: Operation not permitted (consider using --machine=@.host --user to connect to bus of other user)\n")),(0,n.kt)("p",null,"The user should be able to operate as user, it shouldn't be required to connect on behalf of other users. This means that even for a simple command, such as to retrieve the list of unit files:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"systemctl --user list-unit-files\n")),(0,n.kt)("p",null,"We'd get the error:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"Failed to connect to bus: Operation not permitted (consider using --machine=@.host --user to connect to bus of other user)\n")),(0,n.kt)("p",null,"For any of the supported user unit locations e.g. $HOME/.config/systemd/user as documented in ",(0,n.kt)("a",{parentName:"p",href:"https://www.freedesktop.org/software/systemd/man/systemd.unit.html"},"Systemd unit documentation"),", the result is the error above."),(0,n.kt)("p",null,"This is related to the load paths when running in user mode (--user), as described in the discussion ",(0,n.kt)("a",{parentName:"p",href:"https://unix.stackexchange.com/questions/224992/where-do-i-put-my-systemd-unit-file/367237#367237"},"here"),"."),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"User-dependent")),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"$XDG_CONFIG_HOME/systemd/user")," User configuration (only used when $XDG_CONFIG_HOME is set)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"$HOME/.config/systemd/user")," User configuration (only used when $XDG_CONFIG_HOME is not set)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"$XDG_RUNTIME_DIR/systemd/user")," Runtime units (only used when $XDG_RUNTIME_DIR is set)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"$XDG_DATA_HOME/systemd/user")," Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is set)"),(0,n.kt)("p",null,(0,n.kt)("strong",{parentName:"p"},"$HOME/.local/share/systemd/user")," Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is not set)"),(0,n.kt)("p",null,"For example, if we check the ",(0,n.kt)("inlineCode",{parentName:"p"},"$XDG_RUNTIME_DIR")," in a DigitalOcean box, we get the following output:"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-sh"},"/run/user/0\n")),(0,n.kt)("p",null,"For this reason and to provide support for a wider audience of users and systems, we've stuck to sudo to execute the service, but this should not be a requirement and is not recommended."),(0,n.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}d.isMDXComponent=!0},3872:(e,t,r)=>{r.d(t,{Z:()=>n});var s=r(7294);const n=e=>{let{image:t,name:r,title:n,url:a,communityMember:l=!1}=e;return s.createElement("section",{className:"author_card"},s.createElement("div",null,s.createElement("span",{className:"avatar"},s.createElement("a",{href:a,target:"_blank",alt:r},s.createElement("img",{src:t,alt:r}))),s.createElement("div",null,s.createElement("span",{className:"name"},s.createElement("a",{href:a,target:"_blank",alt:r},r)),s.createElement("span",{className:"title"},n),s.createElement("span",{className:"discord"},l?"Join our community on":"Got questions? Find us on"," ",s.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file diff --git a/assets/js/d1b78a4d.e12e16bb.js b/assets/js/d1b78a4d.b9f410cf.js similarity index 98% rename from assets/js/d1b78a4d.e12e16bb.js rename to assets/js/d1b78a4d.b9f410cf.js index 8d24c2188..0a263d7cd 100644 --- a/assets/js/d1b78a4d.e12e16bb.js +++ b/assets/js/d1b78a4d.b9f410cf.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[3023],{3905:(e,t,r)=>{r.d(t,{Zo:()=>m,kt:()=>f});var o=r(7294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function a(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var c=o.createContext({}),s=function(e){var t=o.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},m=function(e){var t=s(e.components);return o.createElement(c.Provider,{value:t},e.children)},u="mdxType",g={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},p=o.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,c=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),u=s(r),p=n,f=u["".concat(c,".").concat(p)]||u[p]||g[p]||i;return r?o.createElement(f,a(a({ref:t},m),{},{components:r})):o.createElement(f,a({ref:t},m))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,a=new Array(i);a[0]=p;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[u]="string"==typeof e?e:n,a[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>g,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var o=r(7462),n=(r(7294),r(3905));const i={title:"Bloom Filters and Cuckoo Filters for Cache Summarization",description:"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.",slug:"bloom-and-cuckoo-filters-for-cache-summarization",image:"./assets/bloom-cuckoo/bloom.png?202301181528",authors:{name:"Matthias Wright",title:"Software Engineer",url:"https://github.com/matthias-wright",image_url:"https://github.com/matthias-wright.png"},tags:["fleek network","blog","engineering","content routing"]},a=void 0,l={permalink:"/blog/bloom-and-cuckoo-filters-for-cache-summarization",source:"@site/blog/bloom-and-cuckoo-filters-for-cache-summarization.md",title:"Bloom Filters and Cuckoo Filters for Cache Summarization",description:"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.",date:"2023-10-20T15:50:16.000Z",formattedDate:"October 20, 2023",tags:[{label:"fleek network",permalink:"/blog/tags/fleek-network"},{label:"blog",permalink:"/blog/tags/blog"},{label:"engineering",permalink:"/blog/tags/engineering"},{label:"content routing",permalink:"/blog/tags/content-routing"}],readingTime:10.37,hasTruncateMarker:!0,authors:[{name:"Matthias Wright",title:"Software Engineer",url:"https://github.com/matthias-wright",image_url:"https://github.com/matthias-wright.png",imageURL:"https://github.com/matthias-wright.png"}],frontMatter:{title:"Bloom Filters and Cuckoo Filters for Cache Summarization",description:"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.",slug:"bloom-and-cuckoo-filters-for-cache-summarization",image:"./assets/bloom-cuckoo/bloom.png?202301181528",authors:{name:"Matthias Wright",title:"Software Engineer",url:"https://github.com/matthias-wright",image_url:"https://github.com/matthias-wright.png",imageURL:"https://github.com/matthias-wright.png"},tags:["fleek network","blog","engineering","content routing"]}},c={image:r(4221).Z,authorsImageUrls:[void 0]},s=[],m={toc:s},u="wrapper";function g(e){let{components:t,...r}=e;return(0,n.kt)(u,(0,o.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"Disclaimer: This is not a general comparison between Bloom filters and Cuckoo filters. This blog post summarizes some of the experiments we conducted to decide whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters, for a specific use case."))}g.isMDXComponent=!0},4221:(e,t,r)=>{r.d(t,{Z:()=>o});const o=r.p+"assets/images/bloom-79da0db687b4fb2060758838b9c44513.png"}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[3023],{3905:(e,t,r)=>{r.d(t,{Zo:()=>m,kt:()=>f});var o=r(7294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function a(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var c=o.createContext({}),s=function(e){var t=o.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},m=function(e){var t=s(e.components);return o.createElement(c.Provider,{value:t},e.children)},u="mdxType",g={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},p=o.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,c=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),u=s(r),p=n,f=u["".concat(c,".").concat(p)]||u[p]||g[p]||i;return r?o.createElement(f,a(a({ref:t},m),{},{components:r})):o.createElement(f,a({ref:t},m))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,a=new Array(i);a[0]=p;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[u]="string"==typeof e?e:n,a[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>g,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var o=r(7462),n=(r(7294),r(3905));const i={title:"Bloom Filters and Cuckoo Filters for Cache Summarization",description:"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.",slug:"bloom-and-cuckoo-filters-for-cache-summarization",image:"./assets/bloom-cuckoo/bloom.png?202301181528",authors:{name:"Matthias Wright",title:"Software Engineer",url:"https://github.com/matthias-wright",image_url:"https://github.com/matthias-wright.png"},tags:["fleek network","blog","engineering","content routing"]},a=void 0,l={permalink:"/blog/bloom-and-cuckoo-filters-for-cache-summarization",source:"@site/blog/bloom-and-cuckoo-filters-for-cache-summarization.md",title:"Bloom Filters and Cuckoo Filters for Cache Summarization",description:"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.",date:"2023-10-20T16:26:18.000Z",formattedDate:"October 20, 2023",tags:[{label:"fleek network",permalink:"/blog/tags/fleek-network"},{label:"blog",permalink:"/blog/tags/blog"},{label:"engineering",permalink:"/blog/tags/engineering"},{label:"content routing",permalink:"/blog/tags/content-routing"}],readingTime:10.37,hasTruncateMarker:!0,authors:[{name:"Matthias Wright",title:"Software Engineer",url:"https://github.com/matthias-wright",image_url:"https://github.com/matthias-wright.png",imageURL:"https://github.com/matthias-wright.png"}],frontMatter:{title:"Bloom Filters and Cuckoo Filters for Cache Summarization",description:"Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.",slug:"bloom-and-cuckoo-filters-for-cache-summarization",image:"./assets/bloom-cuckoo/bloom.png?202301181528",authors:{name:"Matthias Wright",title:"Software Engineer",url:"https://github.com/matthias-wright",image_url:"https://github.com/matthias-wright.png",imageURL:"https://github.com/matthias-wright.png"},tags:["fleek network","blog","engineering","content routing"]}},c={image:r(4221).Z,authorsImageUrls:[void 0]},s=[],m={toc:s},u="wrapper";function g(e){let{components:t,...r}=e;return(0,n.kt)(u,(0,o.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"Disclaimer: This is not a general comparison between Bloom filters and Cuckoo filters. This blog post summarizes some of the experiments we conducted to decide whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters, for a specific use case."))}g.isMDXComponent=!0},4221:(e,t,r)=>{r.d(t,{Z:()=>o});const o=r.p+"assets/images/bloom-79da0db687b4fb2060758838b9c44513.png"}}]); \ No newline at end of file diff --git a/assets/js/d23df0ea.a6176b99.js b/assets/js/d23df0ea.a1dd5725.js similarity index 99% rename from assets/js/d23df0ea.a6176b99.js rename to assets/js/d23df0ea.a1dd5725.js index 6a8837f3f..7a3eb751c 100644 --- a/assets/js/d23df0ea.a6176b99.js +++ b/assets/js/d23df0ea.a1dd5725.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[5548],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=s(n),k=a,m=u["".concat(c,".").concat(k)]||u[k]||p[k]||o;return n?r.createElement(m,l(l({ref:t},d),{},{components:n})):r.createElement(m,l({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=k;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[u]="string"==typeof e?e:a,l[1]=i;for(var s=2;s{n.d(t,{ZP:()=>i});var r=n(7462),a=(n(7294),n(3905));const o={toc:[]},l="wrapper";function i(e){let{components:t,...n}=e;return(0,a.kt)(l,(0,r.Z)({},o,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"You have several ways of doing this:"),(0,a.kt)("ul",{parentName:"admonition"},(0,a.kt)("li",{parentName:"ul"},"Clone via HTTPS"),(0,a.kt)("li",{parentName:"ul"},"Clone via SSH"),(0,a.kt)("li",{parentName:"ul"},"Download via Github CLI"),(0,a.kt)("li",{parentName:"ul"},"Download the ",(0,a.kt)("a",{parentName:"li",href:"https://github.com/fleek-network/lightning/archive/refs/heads/main.zip"},"zip package")," from the repository")),(0,a.kt)("p",{parentName:"admonition"},"We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this.\nAlthough, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it ",(0,a.kt)("a",{parentName:"p",href:"https://docs.github.com/en/authentication/connecting-to-github-with-ssh"},"here"),"."),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git \n")),(0,a.kt)("p",{parentName:"admonition"},"At time of writing, we are checking the branch name ",(0,a.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1")," that corresponds to the testnet phase.\nHere's an example of what it'd look like when sticking to the recommended path location:"),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning\n"))))}i.isMDXComponent=!0},2321:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var r=n(7462),a=(n(7294),n(3905)),o=n(3872),l=n(2915);const i={title:"Build and run in Docker",slug:"build-and-run-in-docker",hide_title:!0,tags:["references","help","docker","build","image","container"]},c=void 0,s={unversionedId:"Docker/build-and-run-in-docker",id:"Docker/build-and-run-in-docker",title:"Build and run in Docker",description:"Clone the source code locally",source:"@site/references/Docker/build-and-run-in-docker.md",sourceDirName:"Docker",slug:"/Docker/build-and-run-in-docker",permalink:"/references/Docker/build-and-run-in-docker",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Docker/build-and-run-in-docker.md",tags:[{label:"references",permalink:"/references/tags/references"},{label:"help",permalink:"/references/tags/help"},{label:"docker",permalink:"/references/tags/docker"},{label:"build",permalink:"/references/tags/build"},{label:"image",permalink:"/references/tags/image"},{label:"container",permalink:"/references/tags/container"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Build and run in Docker",slug:"build-and-run-in-docker",hide_title:!0,tags:["references","help","docker","build","image","container"]},sidebar:"defaultSidebar",previous:{title:"About references",permalink:"/references/"},next:{title:"Error building on ARM64",permalink:"/references/Lightning CLI/error-building-on-arm64"}},d={},u=[{value:"Clone the source code locally",id:"clone-the-source-code-locally",level:2},{value:"Change directory to Lightning source code",id:"change-directory-to-lightning-source-code",level:2},{value:"Install Docker",id:"install-docker",level:2},{value:"Docker setup verification",id:"docker-setup-verification",level:2},{value:"Check the Dockerfile",id:"check-the-dockerfile",level:2},{value:"Build the Docker image",id:"build-the-docker-image",level:2},{value:"Generate keys",id:"generate-keys",level:2},{value:"Docker Container",id:"docker-container",level:2},{value:"View logs",id:"view-logs",level:2}],p={toc:u},k="wrapper";function m(e){let{components:t,...n}=e;return(0,a.kt)(k,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"clone-the-source-code-locally"},"Clone the source code locally"),(0,a.kt)(l.ZP,{mdxType:"GitCloneOptions"}),(0,a.kt)("h2",{id:"change-directory-to-lightning-source-code"},"Change directory to Lightning source code"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,a.kt)("h2",{id:"install-docker"},"Install Docker"),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"We're using Ubuntu Linux. You'll have to make the required tweaks for your preferred Linux Distro. Find the list of support operating systems ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"here"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt update\n")),(0,a.kt)("p",null,"Next, install the required packages to let apt use packages over HTTPS:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt install \\\n apt-transport-https \\\n ca-certificates \\\n software-properties-common\n")),(0,a.kt)("p",null,"Add the GPG key for the official Docker repository to your system:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -\n")),(0,a.kt)("p",null,"Add the Docker repository to apt sources and update the package database with the Docker packages from the new added repository:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable"\n')),(0,a.kt)("p",null,"Set to install from the Docker repo instead of the default Ubuntu repo:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"apt-cache policy docker-ce\n")),(0,a.kt)("p",null,"Finally, install Docker:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt install docker-ce\n")),(0,a.kt)("p",null,"Once complete you should be able to run it via the CLI, as such:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"docker -v\n")),(0,a.kt)("p",null,"Here's the output (versions might differ a bit from the time of writing):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"Docker version 24.0.6, build ed223bc\n")),(0,a.kt)("h2",{id:"docker-setup-verification"},"Docker setup verification"),(0,a.kt)("p",null,"The following command's output will indicate if Docker's working correctly:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run hello-world\n")),(0,a.kt)("p",null,'You should get a "Hello from Docker!".'),(0,a.kt)("h2",{id:"check-the-dockerfile"},"Check the Dockerfile"),(0,a.kt)("p",null,"You should have ",(0,a.kt)("a",{parentName:"p",href:"#change-directory-to-lightning-source-code"},"changed directory")," to the projecto directory."),(0,a.kt)("p",null,"If you run a ",(0,a.kt)("inlineCode",{parentName:"p"},"cat Dockerfile"),", you should have content similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"FROM rust:latest as builder\nARG PROFILE=release\nWORKDIR /lightning\n\nRUN apt-get update\nRUN apt-get install -y \\\n build-essential \\\n cmake \\\n clang \\\n pkg-config \\\n libssl-dev \\\n gcc \\\n protobuf-compiler\n\n...\n")),(0,a.kt)("h2",{id:"build-the-docker-image"},"Build the Docker image"),(0,a.kt)("p",null,"Build the image named as ",(0,a.kt)("inlineCode",{parentName:"p"},"lightning")," from our Dockerfile:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker build -t lightning -f ./Dockerfile .\n")),(0,a.kt)("h2",{id:"generate-keys"},"Generate keys"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker exec -it lightning-node lgtn keys generate\n")),(0,a.kt)("h2",{id:"docker-container"},"Docker Container"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run \\\n -p 4230:4230 \\\n -p 4200:4200 \\\n -p 6969:6969 \\\n -p 18000:18000 \\\n -p 18101:18101 \\\n -p 18102:18102 \\\n -v $HOME/.lightning/:/root/.lightning/:rw \\\n --name lightning-node \\\n -it lightning\n")),(0,a.kt)("h2",{id:"view-logs"},"View logs"),(0,a.kt)("p",null,"To view the logs of a Docker container in real time, use the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker logs -f lightning-node\n")),(0,a.kt)(o.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}m.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(7294);const a=e=>{let{image:t,name:n,title:a,url:o,communityMember:l=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:o,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:o,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},a),r.createElement("span",{className:"discord"},l?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[5548],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=s(n),k=a,m=u["".concat(c,".").concat(k)]||u[k]||p[k]||o;return n?r.createElement(m,l(l({ref:t},d),{},{components:n})):r.createElement(m,l({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=k;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[u]="string"==typeof e?e:a,l[1]=i;for(var s=2;s{n.d(t,{ZP:()=>i});var r=n(7462),a=(n(7294),n(3905));const o={toc:[]},l="wrapper";function i(e){let{components:t,...n}=e;return(0,a.kt)(l,(0,r.Z)({},o,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"You have several ways of doing this:"),(0,a.kt)("ul",{parentName:"admonition"},(0,a.kt)("li",{parentName:"ul"},"Clone via HTTPS"),(0,a.kt)("li",{parentName:"ul"},"Clone via SSH"),(0,a.kt)("li",{parentName:"ul"},"Download via Github CLI"),(0,a.kt)("li",{parentName:"ul"},"Download the ",(0,a.kt)("a",{parentName:"li",href:"https://github.com/fleek-network/lightning/archive/refs/heads/main.zip"},"zip package")," from the repository")),(0,a.kt)("p",{parentName:"admonition"},"We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this.\nAlthough, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it ",(0,a.kt)("a",{parentName:"p",href:"https://docs.github.com/en/authentication/connecting-to-github-with-ssh"},"here"),"."),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git \n")),(0,a.kt)("p",{parentName:"admonition"},"At time of writing, we are checking the branch name ",(0,a.kt)("inlineCode",{parentName:"p"},"testnet-alpha-1")," that corresponds to the testnet phase.\nHere's an example of what it'd look like when sticking to the recommended path location:"),(0,a.kt)("pre",{parentName:"admonition"},(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning\n"))))}i.isMDXComponent=!0},2321:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var r=n(7462),a=(n(7294),n(3905)),o=n(3872),l=n(2915);const i={title:"Build and run in Docker",slug:"build-and-run-in-docker",hide_title:!0,tags:["references","help","docker","build","image","container"]},c=void 0,s={unversionedId:"Docker/build-and-run-in-docker",id:"Docker/build-and-run-in-docker",title:"Build and run in Docker",description:"Clone the source code locally",source:"@site/references/Docker/build-and-run-in-docker.md",sourceDirName:"Docker",slug:"/Docker/build-and-run-in-docker",permalink:"/references/Docker/build-and-run-in-docker",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Docker/build-and-run-in-docker.md",tags:[{label:"references",permalink:"/references/tags/references"},{label:"help",permalink:"/references/tags/help"},{label:"docker",permalink:"/references/tags/docker"},{label:"build",permalink:"/references/tags/build"},{label:"image",permalink:"/references/tags/image"},{label:"container",permalink:"/references/tags/container"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Build and run in Docker",slug:"build-and-run-in-docker",hide_title:!0,tags:["references","help","docker","build","image","container"]},sidebar:"defaultSidebar",previous:{title:"About references",permalink:"/references/"},next:{title:"Error building on ARM64",permalink:"/references/Lightning CLI/error-building-on-arm64"}},d={},u=[{value:"Clone the source code locally",id:"clone-the-source-code-locally",level:2},{value:"Change directory to Lightning source code",id:"change-directory-to-lightning-source-code",level:2},{value:"Install Docker",id:"install-docker",level:2},{value:"Docker setup verification",id:"docker-setup-verification",level:2},{value:"Check the Dockerfile",id:"check-the-dockerfile",level:2},{value:"Build the Docker image",id:"build-the-docker-image",level:2},{value:"Generate keys",id:"generate-keys",level:2},{value:"Docker Container",id:"docker-container",level:2},{value:"View logs",id:"view-logs",level:2}],p={toc:u},k="wrapper";function m(e){let{components:t,...n}=e;return(0,a.kt)(k,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"clone-the-source-code-locally"},"Clone the source code locally"),(0,a.kt)(l.ZP,{mdxType:"GitCloneOptions"}),(0,a.kt)("h2",{id:"change-directory-to-lightning-source-code"},"Change directory to Lightning source code"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"cd ~/fleek-network/lightning\n")),(0,a.kt)("h2",{id:"install-docker"},"Install Docker"),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"We're using Ubuntu Linux. You'll have to make the required tweaks for your preferred Linux Distro. Find the list of support operating systems ",(0,a.kt)("a",{parentName:"p",href:"/docs/node/requirements#server"},"here"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt update\n")),(0,a.kt)("p",null,"Next, install the required packages to let apt use packages over HTTPS:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt install \\\n apt-transport-https \\\n ca-certificates \\\n software-properties-common\n")),(0,a.kt)("p",null,"Add the GPG key for the official Docker repository to your system:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -\n")),(0,a.kt)("p",null,"Add the Docker repository to apt sources and update the package database with the Docker packages from the new added repository:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable"\n')),(0,a.kt)("p",null,"Set to install from the Docker repo instead of the default Ubuntu repo:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"apt-cache policy docker-ce\n")),(0,a.kt)("p",null,"Finally, install Docker:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt install docker-ce\n")),(0,a.kt)("p",null,"Once complete you should be able to run it via the CLI, as such:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"docker -v\n")),(0,a.kt)("p",null,"Here's the output (versions might differ a bit from the time of writing):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"Docker version 24.0.6, build ed223bc\n")),(0,a.kt)("h2",{id:"docker-setup-verification"},"Docker setup verification"),(0,a.kt)("p",null,"The following command's output will indicate if Docker's working correctly:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run hello-world\n")),(0,a.kt)("p",null,'You should get a "Hello from Docker!".'),(0,a.kt)("h2",{id:"check-the-dockerfile"},"Check the Dockerfile"),(0,a.kt)("p",null,"You should have ",(0,a.kt)("a",{parentName:"p",href:"#change-directory-to-lightning-source-code"},"changed directory")," to the projecto directory."),(0,a.kt)("p",null,"If you run a ",(0,a.kt)("inlineCode",{parentName:"p"},"cat Dockerfile"),", you should have content similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"FROM rust:latest as builder\nARG PROFILE=release\nWORKDIR /lightning\n\nRUN apt-get update\nRUN apt-get install -y \\\n build-essential \\\n cmake \\\n clang \\\n pkg-config \\\n libssl-dev \\\n gcc \\\n protobuf-compiler\n\n...\n")),(0,a.kt)("h2",{id:"build-the-docker-image"},"Build the Docker image"),(0,a.kt)("p",null,"Build the image named as ",(0,a.kt)("inlineCode",{parentName:"p"},"lightning")," from our Dockerfile:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker build -t lightning -f ./Dockerfile .\n")),(0,a.kt)("h2",{id:"generate-keys"},"Generate keys"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker exec -it lightning-node lgtn keys generate\n")),(0,a.kt)("h2",{id:"docker-container"},"Docker Container"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker run \\\n -p 4230:4230 \\\n -p 4200:4200 \\\n -p 6969:6969 \\\n -p 18000:18000 \\\n -p 18101:18101 \\\n -p 18102:18102 \\\n -v $HOME/.lightning/:/root/.lightning/:rw \\\n --name lightning-node \\\n -it lightning\n")),(0,a.kt)("h2",{id:"view-logs"},"View logs"),(0,a.kt)("p",null,"To view the logs of a Docker container in real time, use the following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"sudo docker logs -f lightning-node\n")),(0,a.kt)(o.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}m.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(7294);const a=e=>{let{image:t,name:n,title:a,url:o,communityMember:l=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:o,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:o,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},a),r.createElement("span",{className:"discord"},l?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file diff --git a/assets/js/d7d81bf6.9e13fcfa.js b/assets/js/d7d81bf6.4a15a96e.js similarity index 99% rename from assets/js/d7d81bf6.9e13fcfa.js rename to assets/js/d7d81bf6.4a15a96e.js index 841af0f45..50c79805f 100644 --- a/assets/js/d7d81bf6.9e13fcfa.js +++ b/assets/js/d7d81bf6.4a15a96e.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[2918],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>g});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),c=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=c(e.components);return r.createElement(s.Provider,{value:n},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),p=c(t),m=a,g=p["".concat(s,".").concat(m)]||p[m]||d[m]||i;return t?r.createElement(g,l(l({ref:n},u),{},{components:t})):r.createElement(g,l({ref:n},u))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,l=new Array(i);l[0]=m;var o={};for(var s in n)hasOwnProperty.call(n,s)&&(o[s]=n[s]);o.originalType=e,o[p]="string"==typeof e?e:a,l[1]=o;for(var c=2;c{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var r=t(7462),a=(t(7294),t(3905)),i=t(3872);const l={title:"Error building on ARM64",slug:"error-building-on-arm64",hide_title:!0,tags:["references","help","fix"]},o=void 0,s={unversionedId:"Lightning CLI/error-building-on-arm64",id:"Lightning CLI/error-building-on-arm64",title:"Error building on ARM64",description:"Building on the ARM64 (aarch64)",source:"@site/references/Lightning CLI/error-building-on-arm64.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/error-building-on-arm64",permalink:"/references/Lightning CLI/error-building-on-arm64",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/error-building-on-arm64.md",tags:[{label:"references",permalink:"/references/tags/references"},{label:"help",permalink:"/references/tags/help"},{label:"fix",permalink:"/references/tags/fix"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Error building on ARM64",slug:"error-building-on-arm64",hide_title:!0,tags:["references","help","fix"]},sidebar:"defaultSidebar",previous:{title:"Build and run in Docker",permalink:"/references/Docker/build-and-run-in-docker"},next:{title:"Error linking with cc",permalink:"/references/Lightning CLI/error-linking-with-cc-failed-exist-status-1"}},c={},u=[{value:"Building on the ARM64 (aarch64)",id:"building-on-the-arm64-aarch64",level:2}],p={toc:u},d="wrapper";function m(e){let{components:n,...t}=e;return(0,a.kt)(d,(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"building-on-the-arm64-aarch64"},"Building on the ARM64 (aarch64)"),(0,a.kt)("p",null,"ARM64 platform has its own specifics, and currently consists of requiring ",(0,a.kt)("inlineCode",{parentName:"p"},"gcc"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"sudo apt install gcc\n")),(0,a.kt)("p",null,"On cargo build, the error ",(0,a.kt)("inlineCode",{parentName:"p"},"error: linking with "),"cc",(0,a.kt)("inlineCode",{parentName:"p"}," failed: exit status: 1")," occurs, as demonstrated in the output below:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"error: linking with `cc` failed: exit status: 1\n# ... wall of text\n# ... the key error is \u21b4\n= note: /usr/bin/ld: /home/ubuntu/fleek-network/lightning/target/release/deps/libblake3-a927e9b36d695ff0.rlib(blake3-a927e9b36d695ff0.blake3.91a53ea05847a7a5-cgu.0.rcgu.o): in function `blake3_compress_in_place_portable':\n /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/blake3-1.4.1/src/ffi_neon.rs:45: multiple definition of `blake3_compress_in_place_portable'; /home/ubuntu/fleek-network/lightning/target/release/deps/libfleek_blake3-990c4c0cfb4eaa87.rlib(fleek_blake3-990c4c0cfb4eaa87.fleek_blake3.4f11e9370af31773-cgu.0.rcgu.o):/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fleek-blake3-1.4.1/src/ffi_neon.rs:45: first defined here\n")),(0,a.kt)("p",null,"As a result of the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/ryssroad/fleek-aarch64-build"},"research")," by the community member ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/ryssroad"},"ryssroad"),", the following solution was shared."),(0,a.kt)("p",null,"Open the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo.toml")," file in ",(0,a.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/Cargo.toml")," and find the ",(0,a.kt)("inlineCode",{parentName:"p"},"lto")," key."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lto = true\n")),(0,a.kt)("p",null,"Change the ",(0,a.kt)("inlineCode",{parentName:"p"},"lto")," key value from ",(0,a.kt)("inlineCode",{parentName:"p"},"true")," to ",(0,a.kt)("inlineCode",{parentName:"p"},"thin"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'...\n[profile.release]\n# currently enabled, may increase build time, but runtime faster, can set to `"thin"`.\nlto = "thin"\n')),(0,a.kt)("p",null,"Set ",(0,a.kt)("inlineCode",{parentName:"p"},"RUSTFLAGS")," on build, as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},'RUSTFLAGS="-Clink-arg=-Wl,--allow-multiple-definition" cargo +stable build --release \n')),(0,a.kt)("p",null,"Once the build completes, you should find the generated binary ",(0,a.kt)("inlineCode",{parentName:"p"},"lightning-node")," under the directory ",(0,a.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/target/release/lightning-node"),"."),(0,a.kt)("p",null,"As an example, execute:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"~/fleek-network/lightning/target/release/lightning-node help\n")),(0,a.kt)("p",null,"To find the help output:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"Usage: lightning-node [OPTIONS] \n\nCommands:\n run Start the node\n keys Handle keys\n print-config Print the loaded configuration\n help Print this message or the help of the given subcommand(s)\n\nOptions:\n -c, --config Path to the toml configuration file [default: ~/.lightning/config.toml]\n --with-mock-consensus Determines that we should be using the mock consensus backend\n -v... Increases the level of verbosity (the max level is -vvv)\n --log-location Print code location on console logs\n -h, --help Print help\n -V, --version Print version\n")),(0,a.kt)(i.Z,{name:"Road aka @road",image:"https://github.com/ryssroad.png",title:"Community member",url:"https://github.com/ryssroad",communityMember:"true",mdxType:"Author"}))}m.isMDXComponent=!0},3872:(e,n,t)=>{t.d(n,{Z:()=>a});var r=t(7294);const a=e=>{let{image:n,name:t,title:a,url:i,communityMember:l=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:i,target:"_blank",alt:t},r.createElement("img",{src:n,alt:t}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:i,target:"_blank",alt:t},t)),r.createElement("span",{className:"title"},a),r.createElement("span",{className:"discord"},l?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[2918],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>g});var r=t(7294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),c=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=c(e.components);return r.createElement(s.Provider,{value:n},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),p=c(t),m=a,g=p["".concat(s,".").concat(m)]||p[m]||d[m]||i;return t?r.createElement(g,l(l({ref:n},u),{},{components:t})):r.createElement(g,l({ref:n},u))}));function g(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,l=new Array(i);l[0]=m;var o={};for(var s in n)hasOwnProperty.call(n,s)&&(o[s]=n[s]);o.originalType=e,o[p]="string"==typeof e?e:a,l[1]=o;for(var c=2;c{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var r=t(7462),a=(t(7294),t(3905)),i=t(3872);const l={title:"Error building on ARM64",slug:"error-building-on-arm64",hide_title:!0,tags:["references","help","fix"]},o=void 0,s={unversionedId:"Lightning CLI/error-building-on-arm64",id:"Lightning CLI/error-building-on-arm64",title:"Error building on ARM64",description:"Building on the ARM64 (aarch64)",source:"@site/references/Lightning CLI/error-building-on-arm64.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/error-building-on-arm64",permalink:"/references/Lightning CLI/error-building-on-arm64",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/error-building-on-arm64.md",tags:[{label:"references",permalink:"/references/tags/references"},{label:"help",permalink:"/references/tags/help"},{label:"fix",permalink:"/references/tags/fix"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Error building on ARM64",slug:"error-building-on-arm64",hide_title:!0,tags:["references","help","fix"]},sidebar:"defaultSidebar",previous:{title:"Build and run in Docker",permalink:"/references/Docker/build-and-run-in-docker"},next:{title:"Error linking with cc",permalink:"/references/Lightning CLI/error-linking-with-cc-failed-exist-status-1"}},c={},u=[{value:"Building on the ARM64 (aarch64)",id:"building-on-the-arm64-aarch64",level:2}],p={toc:u},d="wrapper";function m(e){let{components:n,...t}=e;return(0,a.kt)(d,(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"building-on-the-arm64-aarch64"},"Building on the ARM64 (aarch64)"),(0,a.kt)("p",null,"ARM64 platform has its own specifics, and currently consists of requiring ",(0,a.kt)("inlineCode",{parentName:"p"},"gcc"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"sudo apt install gcc\n")),(0,a.kt)("p",null,"On cargo build, the error ",(0,a.kt)("inlineCode",{parentName:"p"},"error: linking with "),"cc",(0,a.kt)("inlineCode",{parentName:"p"}," failed: exit status: 1")," occurs, as demonstrated in the output below:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"error: linking with `cc` failed: exit status: 1\n# ... wall of text\n# ... the key error is \u21b4\n= note: /usr/bin/ld: /home/ubuntu/fleek-network/lightning/target/release/deps/libblake3-a927e9b36d695ff0.rlib(blake3-a927e9b36d695ff0.blake3.91a53ea05847a7a5-cgu.0.rcgu.o): in function `blake3_compress_in_place_portable':\n /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/blake3-1.4.1/src/ffi_neon.rs:45: multiple definition of `blake3_compress_in_place_portable'; /home/ubuntu/fleek-network/lightning/target/release/deps/libfleek_blake3-990c4c0cfb4eaa87.rlib(fleek_blake3-990c4c0cfb4eaa87.fleek_blake3.4f11e9370af31773-cgu.0.rcgu.o):/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fleek-blake3-1.4.1/src/ffi_neon.rs:45: first defined here\n")),(0,a.kt)("p",null,"As a result of the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/ryssroad/fleek-aarch64-build"},"research")," by the community member ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/ryssroad"},"ryssroad"),", the following solution was shared."),(0,a.kt)("p",null,"Open the ",(0,a.kt)("inlineCode",{parentName:"p"},"cargo.toml")," file in ",(0,a.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/Cargo.toml")," and find the ",(0,a.kt)("inlineCode",{parentName:"p"},"lto")," key."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"lto = true\n")),(0,a.kt)("p",null,"Change the ",(0,a.kt)("inlineCode",{parentName:"p"},"lto")," key value from ",(0,a.kt)("inlineCode",{parentName:"p"},"true")," to ",(0,a.kt)("inlineCode",{parentName:"p"},"thin"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},'...\n[profile.release]\n# currently enabled, may increase build time, but runtime faster, can set to `"thin"`.\nlto = "thin"\n')),(0,a.kt)("p",null,"Set ",(0,a.kt)("inlineCode",{parentName:"p"},"RUSTFLAGS")," on build, as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},'RUSTFLAGS="-Clink-arg=-Wl,--allow-multiple-definition" cargo +stable build --release \n')),(0,a.kt)("p",null,"Once the build completes, you should find the generated binary ",(0,a.kt)("inlineCode",{parentName:"p"},"lightning-node")," under the directory ",(0,a.kt)("inlineCode",{parentName:"p"},"~/fleek-network/lightning/target/release/lightning-node"),"."),(0,a.kt)("p",null,"As an example, execute:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"~/fleek-network/lightning/target/release/lightning-node help\n")),(0,a.kt)("p",null,"To find the help output:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-sh"},"Usage: lightning-node [OPTIONS] \n\nCommands:\n run Start the node\n keys Handle keys\n print-config Print the loaded configuration\n help Print this message or the help of the given subcommand(s)\n\nOptions:\n -c, --config Path to the toml configuration file [default: ~/.lightning/config.toml]\n --with-mock-consensus Determines that we should be using the mock consensus backend\n -v... Increases the level of verbosity (the max level is -vvv)\n --log-location Print code location on console logs\n -h, --help Print help\n -V, --version Print version\n")),(0,a.kt)(i.Z,{name:"Road aka @road",image:"https://github.com/ryssroad.png",title:"Community member",url:"https://github.com/ryssroad",communityMember:"true",mdxType:"Author"}))}m.isMDXComponent=!0},3872:(e,n,t)=>{t.d(n,{Z:()=>a});var r=t(7294);const a=e=>{let{image:n,name:t,title:a,url:i,communityMember:l=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:i,target:"_blank",alt:t},r.createElement("img",{src:n,alt:t}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:i,target:"_blank",alt:t},t)),r.createElement("span",{className:"title"},a),r.createElement("span",{className:"discord"},l?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file diff --git a/assets/js/d8be0e5a.5b73083f.js b/assets/js/d8be0e5a.683fe5b5.js similarity index 99% rename from assets/js/d8be0e5a.5b73083f.js rename to assets/js/d8be0e5a.683fe5b5.js index 80b6ecae9..df8e587a5 100644 --- a/assets/js/d8be0e5a.5b73083f.js +++ b/assets/js/d8be0e5a.683fe5b5.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1706],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(7294);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),u=c(r),m=i,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function f(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,l=new Array(a);l[0]=m;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[u]="string"==typeof e?e:i,l[1]=o;for(var c=2;c{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>p});var n=r(7462),i=(r(7294),r(3905)),a=r(3872);const l={title:"Error linking with cc",slug:"error-linking-with-cc-failed-exist-status-1",hide_title:!0,tags:["references","help","update","upgrade","fix"]},o=void 0,s={unversionedId:"Lightning CLI/error-linking-with-cc-failed",id:"Lightning CLI/error-linking-with-cc-failed",title:"Error linking with cc",description:"Check if CPU is supported",source:"@site/references/Lightning CLI/error-linking-with-cc-failed.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/error-linking-with-cc-failed-exist-status-1",permalink:"/references/Lightning CLI/error-linking-with-cc-failed-exist-status-1",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/error-linking-with-cc-failed.md",tags:[{label:"references",permalink:"/references/tags/references"},{label:"help",permalink:"/references/tags/help"},{label:"update",permalink:"/references/tags/update"},{label:"upgrade",permalink:"/references/tags/upgrade"},{label:"fix",permalink:"/references/tags/fix"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Error linking with cc",slug:"error-linking-with-cc-failed-exist-status-1",hide_title:!0,tags:["references","help","update","upgrade","fix"]},sidebar:"defaultSidebar",previous:{title:"Error building on ARM64",permalink:"/references/Lightning CLI/error-building-on-arm64"},next:{title:"File permissions and Ownership",permalink:"/references/Lightning CLI/file-permissions-and-ownership"}},c={},p=[{value:"Check if CPU is supported",id:"check-if-cpu-is-supported",level:2},{value:"Linking with cc error",id:"linking-with-cc-error",level:2},{value:"Update",id:"update",level:2},{value:"Install gcc:",id:"install-gcc",level:2},{value:"Remove previous installation files",id:"remove-previous-installation-files",level:2},{value:"Run the installation script",id:"run-the-installation-script",level:2}],u={toc:p},d="wrapper";function m(e){let{components:t,...r}=e;return(0,i.kt)(d,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h2",{id:"check-if-cpu-is-supported"},"Check if CPU is supported"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"uname -i\n")),(0,i.kt)("admonition",{title:"WARNING",type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"Given the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.fleek.network/docs/node/requirements/#specs"},"CPU requirements"),", currently we're mainly supporting ",(0,i.kt)("inlineCode",{parentName:"p"},"GenuineIntel")," and there have been reports of failure to build the binary on ",(0,i.kt)("inlineCode",{parentName:"p"},"AMD"),". The ",(0,i.kt)("inlineCode",{parentName:"p"},"ARM64")," is a different architecture, thus not supported, but there has been some community contributions in that regard, find it in the reference ",(0,i.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/error-building-on-arm64"},"error building on ARM64"),"."),(0,i.kt)("p",{parentName:"admonition"},"Any contribution or feedback to provide support is appreciated. Feel free to let us know on our ",(0,i.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"Discord channel"),".")),(0,i.kt)("h2",{id:"linking-with-cc-error"},"Linking with cc error"),(0,i.kt)("p",null,"A user who finds the error ",(0,i.kt)("inlineCode",{parentName:"p"},"linking with cc failed"),", will have to install the required dependencies."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"error: linking with `cc` failed: exit status: 1\nerror: could not compile `fleek-service-ping-example` (lib) due to previous error\n")),(0,i.kt)("h2",{id:"update"},"Update"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get update\n")),(0,i.kt)("h2",{id:"install-gcc"},"Install ",(0,i.kt)("inlineCode",{parentName:"h2"},"gcc"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get install gcc\n")),(0,i.kt)("h2",{id:"remove-previous-installation-files"},"Remove previous installation files"),(0,i.kt)("p",null,"You can re-run the installation process. If you are using the assisted installer, it'll complain that the source code directory already exists. Since you've probably cloned the source code repository locally, you'll have to remove it manually. If you need help, find the instructions in the ",(0,i.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/uninstall-lightning-node"},"reference"),"."),(0,i.kt)("h2",{id:"run-the-installation-script"},"Run the installation script"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"curl https://get.fleek.network | bash\n")),(0,i.kt)("p",null,"Alternatively, read the ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/install#manual-installation"},"manual installation instructions")," for more information."),(0,i.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}m.isMDXComponent=!0},3872:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(7294);const i=e=>{let{image:t,name:r,title:i,url:a,communityMember:l=!1}=e;return n.createElement("section",{className:"author_card"},n.createElement("div",null,n.createElement("span",{className:"avatar"},n.createElement("a",{href:a,target:"_blank",alt:r},n.createElement("img",{src:t,alt:r}))),n.createElement("div",null,n.createElement("span",{className:"name"},n.createElement("a",{href:a,target:"_blank",alt:r},r)),n.createElement("span",{className:"title"},i),n.createElement("span",{className:"discord"},l?"Join our community on":"Got questions? Find us on"," ",n.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[1706],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(7294);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),u=c(r),m=i,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function f(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,l=new Array(a);l[0]=m;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[u]="string"==typeof e?e:i,l[1]=o;for(var c=2;c{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>p});var n=r(7462),i=(r(7294),r(3905)),a=r(3872);const l={title:"Error linking with cc",slug:"error-linking-with-cc-failed-exist-status-1",hide_title:!0,tags:["references","help","update","upgrade","fix"]},o=void 0,s={unversionedId:"Lightning CLI/error-linking-with-cc-failed",id:"Lightning CLI/error-linking-with-cc-failed",title:"Error linking with cc",description:"Check if CPU is supported",source:"@site/references/Lightning CLI/error-linking-with-cc-failed.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/error-linking-with-cc-failed-exist-status-1",permalink:"/references/Lightning CLI/error-linking-with-cc-failed-exist-status-1",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/error-linking-with-cc-failed.md",tags:[{label:"references",permalink:"/references/tags/references"},{label:"help",permalink:"/references/tags/help"},{label:"update",permalink:"/references/tags/update"},{label:"upgrade",permalink:"/references/tags/upgrade"},{label:"fix",permalink:"/references/tags/fix"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Error linking with cc",slug:"error-linking-with-cc-failed-exist-status-1",hide_title:!0,tags:["references","help","update","upgrade","fix"]},sidebar:"defaultSidebar",previous:{title:"Error building on ARM64",permalink:"/references/Lightning CLI/error-building-on-arm64"},next:{title:"File permissions and Ownership",permalink:"/references/Lightning CLI/file-permissions-and-ownership"}},c={},p=[{value:"Check if CPU is supported",id:"check-if-cpu-is-supported",level:2},{value:"Linking with cc error",id:"linking-with-cc-error",level:2},{value:"Update",id:"update",level:2},{value:"Install gcc:",id:"install-gcc",level:2},{value:"Remove previous installation files",id:"remove-previous-installation-files",level:2},{value:"Run the installation script",id:"run-the-installation-script",level:2}],u={toc:p},d="wrapper";function m(e){let{components:t,...r}=e;return(0,i.kt)(d,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h2",{id:"check-if-cpu-is-supported"},"Check if CPU is supported"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"uname -i\n")),(0,i.kt)("admonition",{title:"WARNING",type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"Given the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.fleek.network/docs/node/requirements/#specs"},"CPU requirements"),", currently we're mainly supporting ",(0,i.kt)("inlineCode",{parentName:"p"},"GenuineIntel")," and there have been reports of failure to build the binary on ",(0,i.kt)("inlineCode",{parentName:"p"},"AMD"),". The ",(0,i.kt)("inlineCode",{parentName:"p"},"ARM64")," is a different architecture, thus not supported, but there has been some community contributions in that regard, find it in the reference ",(0,i.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/error-building-on-arm64"},"error building on ARM64"),"."),(0,i.kt)("p",{parentName:"admonition"},"Any contribution or feedback to provide support is appreciated. Feel free to let us know on our ",(0,i.kt)("a",{parentName:"p",href:"https://discord.gg/fleekxyz"},"Discord channel"),".")),(0,i.kt)("h2",{id:"linking-with-cc-error"},"Linking with cc error"),(0,i.kt)("p",null,"A user who finds the error ",(0,i.kt)("inlineCode",{parentName:"p"},"linking with cc failed"),", will have to install the required dependencies."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"error: linking with `cc` failed: exit status: 1\nerror: could not compile `fleek-service-ping-example` (lib) due to previous error\n")),(0,i.kt)("h2",{id:"update"},"Update"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get update\n")),(0,i.kt)("h2",{id:"install-gcc"},"Install ",(0,i.kt)("inlineCode",{parentName:"h2"},"gcc"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"sudo apt-get install gcc\n")),(0,i.kt)("h2",{id:"remove-previous-installation-files"},"Remove previous installation files"),(0,i.kt)("p",null,"You can re-run the installation process. If you are using the assisted installer, it'll complain that the source code directory already exists. Since you've probably cloned the source code repository locally, you'll have to remove it manually. If you need help, find the instructions in the ",(0,i.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/uninstall-lightning-node"},"reference"),"."),(0,i.kt)("h2",{id:"run-the-installation-script"},"Run the installation script"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sh"},"curl https://get.fleek.network | bash\n")),(0,i.kt)("p",null,"Alternatively, read the ",(0,i.kt)("a",{parentName:"p",href:"/docs/node/install#manual-installation"},"manual installation instructions")," for more information."),(0,i.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}m.isMDXComponent=!0},3872:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(7294);const i=e=>{let{image:t,name:r,title:i,url:a,communityMember:l=!1}=e;return n.createElement("section",{className:"author_card"},n.createElement("div",null,n.createElement("span",{className:"avatar"},n.createElement("a",{href:a,target:"_blank",alt:r},n.createElement("img",{src:t,alt:r}))),n.createElement("div",null,n.createElement("span",{className:"name"},n.createElement("a",{href:a,target:"_blank",alt:r},r)),n.createElement("span",{className:"title"},i),n.createElement("span",{className:"discord"},l?"Join our community on":"Got questions? Find us on"," ",n.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file diff --git a/assets/js/fd2b74dc.550c03dc.js b/assets/js/fd2b74dc.711c1116.js similarity index 98% rename from assets/js/fd2b74dc.550c03dc.js rename to assets/js/fd2b74dc.711c1116.js index ce0be646a..66f2d1bea 100644 --- a/assets/js/fd2b74dc.550c03dc.js +++ b/assets/js/fd2b74dc.711c1116.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[4846],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),m=o,f=p["".concat(l,".").concat(m)]||p[m]||u[m]||a;return n?r.createElement(f,s(s({ref:t},d),{},{components:n})):r.createElement(f,s({ref:t},d))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=m;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[p]="string"==typeof e?e:o,s[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var r=n(7462),o=(n(7294),n(3905)),a=n(3872);const s={title:"Keys not found",slug:"keys-not-found",hide_title:!0,tags:["keystore","lost keys","ownership","file permissions"]},i=void 0,l={unversionedId:"Lightning CLI/keys-not-found",id:"Lightning CLI/keys-not-found",title:"Keys not found",description:"Node key does not exist",source:"@site/references/Lightning CLI/keys-not-found.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/keys-not-found",permalink:"/references/Lightning CLI/keys-not-found",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/keys-not-found.md",tags:[{label:"keystore",permalink:"/references/tags/keystore"},{label:"lost keys",permalink:"/references/tags/lost-keys"},{label:"ownership",permalink:"/references/tags/ownership"},{label:"file permissions",permalink:"/references/tags/file-permissions"}],version:"current",lastUpdatedAt:1697817016,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Keys not found",slug:"keys-not-found",hide_title:!0,tags:["keystore","lost keys","ownership","file permissions"]},sidebar:"defaultSidebar",previous:{title:"File permissions and Ownership",permalink:"/references/Lightning CLI/file-permissions-and-ownership"},next:{title:"Backing up the keystore",permalink:"/references/Lightning CLI/backing-up-the-keystore"}},c={},d=[{value:"Node key does not exist",id:"node-key-does-not-exist",level:2}],p={toc:d},u="wrapper";function m(e){let{components:t,...n}=e;return(0,o.kt)(u,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"node-key-does-not-exist"},"Node key does not exist"),(0,o.kt)("p",null,'When watching the Fleek Network Lightning service log output, you find the "Node key does not exist" message placed recursively. As follows:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"thread 'main' panicked at 'Node key does not exist. Use CLI to generate keys.', core/node/src/testnet_sync.rs:126:9\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\nthread 'main' panicked at 'Node key does not exist. Use CLI to generate keys.', core/node/src/testnet_sync.rs:126:9\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n")),(0,o.kt)("p",null,"If you haven't deleted the keystore and can locate it, it's due to how the service is being run. As a user can delegate (sudo) the execution of the process to ",(0,o.kt)("strong",{parentName:"p"},"root"),", the location of the keystore differs on runtime."),(0,o.kt)("p",null,"To learn more about how file permissions and ownership work, you're advised to read the reference document ",(0,o.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/file-permissions-and-ownership"},"here"),"."),(0,o.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}m.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(7294);const o=e=>{let{image:t,name:n,title:o,url:a,communityMember:s=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:a,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:a,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},o),r.createElement("span",{className:"discord"},s?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocta=self.webpackChunkdocta||[]).push([[4846],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),m=o,f=p["".concat(l,".").concat(m)]||p[m]||u[m]||a;return n?r.createElement(f,s(s({ref:t},d),{},{components:n})):r.createElement(f,s({ref:t},d))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=m;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[p]="string"==typeof e?e:o,s[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var r=n(7462),o=(n(7294),n(3905)),a=n(3872);const s={title:"Keys not found",slug:"keys-not-found",hide_title:!0,tags:["keystore","lost keys","ownership","file permissions"]},i=void 0,l={unversionedId:"Lightning CLI/keys-not-found",id:"Lightning CLI/keys-not-found",title:"Keys not found",description:"Node key does not exist",source:"@site/references/Lightning CLI/keys-not-found.md",sourceDirName:"Lightning CLI",slug:"/Lightning CLI/keys-not-found",permalink:"/references/Lightning CLI/keys-not-found",draft:!1,editUrl:"https://github.com/fleek-network/fleek-network-docs/edit/main/references/Lightning CLI/keys-not-found.md",tags:[{label:"keystore",permalink:"/references/tags/keystore"},{label:"lost keys",permalink:"/references/tags/lost-keys"},{label:"ownership",permalink:"/references/tags/ownership"},{label:"file permissions",permalink:"/references/tags/file-permissions"}],version:"current",lastUpdatedAt:1697819178,formattedLastUpdatedAt:"Oct 20, 2023",frontMatter:{title:"Keys not found",slug:"keys-not-found",hide_title:!0,tags:["keystore","lost keys","ownership","file permissions"]},sidebar:"defaultSidebar",previous:{title:"File permissions and Ownership",permalink:"/references/Lightning CLI/file-permissions-and-ownership"},next:{title:"Backing up the keystore",permalink:"/references/Lightning CLI/backing-up-the-keystore"}},c={},d=[{value:"Node key does not exist",id:"node-key-does-not-exist",level:2}],p={toc:d},u="wrapper";function m(e){let{components:t,...n}=e;return(0,o.kt)(u,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"node-key-does-not-exist"},"Node key does not exist"),(0,o.kt)("p",null,'When watching the Fleek Network Lightning service log output, you find the "Node key does not exist" message placed recursively. As follows:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"thread 'main' panicked at 'Node key does not exist. Use CLI to generate keys.', core/node/src/testnet_sync.rs:126:9\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\nthread 'main' panicked at 'Node key does not exist. Use CLI to generate keys.', core/node/src/testnet_sync.rs:126:9\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n")),(0,o.kt)("p",null,"If you haven't deleted the keystore and can locate it, it's due to how the service is being run. As a user can delegate (sudo) the execution of the process to ",(0,o.kt)("strong",{parentName:"p"},"root"),", the location of the keystore differs on runtime."),(0,o.kt)("p",null,"To learn more about how file permissions and ownership work, you're advised to read the reference document ",(0,o.kt)("a",{parentName:"p",href:"/references/Lightning%20CLI/file-permissions-and-ownership"},"here"),"."),(0,o.kt)(a.Z,{name:"Helder Oliveira",image:"https://github.com/heldrida.png",title:"Software Developer + DX",url:"https://github.com/heldrida",mdxType:"Author"}))}m.isMDXComponent=!0},3872:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(7294);const o=e=>{let{image:t,name:n,title:o,url:a,communityMember:s=!1}=e;return r.createElement("section",{className:"author_card"},r.createElement("div",null,r.createElement("span",{className:"avatar"},r.createElement("a",{href:a,target:"_blank",alt:n},r.createElement("img",{src:t,alt:n}))),r.createElement("div",null,r.createElement("span",{className:"name"},r.createElement("a",{href:a,target:"_blank",alt:n},n)),r.createElement("span",{className:"title"},o),r.createElement("span",{className:"discord"},s?"Join our community on":"Got questions? Find us on"," ",r.createElement("a",{href:"https://discord.gg/fleekxyz",target:"_blank"},"discord!")))))}}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.395a551d.js b/assets/js/runtime~main.fa9eda83.js similarity index 90% rename from assets/js/runtime~main.395a551d.js rename to assets/js/runtime~main.fa9eda83.js index 95113f03f..fdb23d4b1 100644 --- a/assets/js/runtime~main.395a551d.js +++ b/assets/js/runtime~main.fa9eda83.js @@ -1 +1 @@ -(()=>{"use strict";var e,f,a,d,c,b={},t={};function r(e){var f=t[e];if(void 0!==f)return f.exports;var a=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.m=b,r.c=t,e=[],r.O=(f,a,d,c)=>{if(!a){var b=1/0;for(i=0;i=c)&&Object.keys(r.O).every((e=>r.O[e](a[o])))?a.splice(o--,1):(t=!1,c0&&e[i-1][2]>c;i--)e[i]=e[i-1];e[i]=[a,d,c]},r.n=e=>{var f=e&&e.__esModule?()=>e.default:()=>e;return r.d(f,{a:f}),f},a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,d){if(1&d&&(e=this(e)),8&d)return e;if("object"==typeof e&&e){if(4&d&&e.__esModule)return e;if(16&d&&"function"==typeof e.then)return e}var c=Object.create(null);r.r(c);var b={};f=f||[null,a({}),a([]),a(a)];for(var t=2&d&&e;"object"==typeof t&&!~f.indexOf(t);t=a(t))Object.getOwnPropertyNames(t).forEach((f=>b[f]=()=>e[f]));return b.default=()=>e,r.d(c,b),c},r.d=(e,f)=>{for(var a in f)r.o(f,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:f[a]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((f,a)=>(r.f[a](e,f),f)),[])),r.u=e=>"assets/js/"+({4:"779cc1e8",11:"3a6297ac",53:"935f2afb",71:"51f2bfad",173:"48e81e49",327:"b696d13b",373:"9f1c3232",382:"8def2dd5",387:"7ceaa645",402:"49b5e83d",469:"3b168dbd",533:"b2b675dd",551:"b4f44b9b",554:"7aba1839",555:"433ff3d6",572:"caaedc90",659:"5d08f08d",663:"0ea1f268",706:"719c0fd7",747:"155c1e74",801:"631037e5",814:"95f4d37c",909:"5437f376",920:"b8c37621",982:"f3d7f34e",1025:"98f9308d",1138:"64d03520",1251:"7aefc753",1263:"74ec46b4",1345:"c3f5dd14",1354:"ceabd901",1474:"75d8af72",1476:"b9b7817e",1477:"b2f554cd",1498:"29b62a39",1510:"29b83576",1517:"166b5465",1563:"39e94577",1611:"fa7546af",1706:"d8be0e5a",1713:"a7023ddc",1771:"564044f9",1837:"ce321ae3",1984:"51d5b592",2023:"d464210a",2027:"d1d29319",2114:"b5954e33",2126:"b40daf0f",2170:"02f62b30",2214:"399f21a8",2235:"3290fbc2",2240:"469c924f",2260:"4035650f",2386:"93df2695",2421:"86c3bd1d",2450:"e6a08407",2501:"5559e604",2517:"8a92e787",2535:"814f3328",2702:"1c14429f",2800:"4247aede",2908:"48857ff6",2918:"d7d81bf6",3012:"aa81941d",3023:"d1b78a4d",3089:"a6aa9e1f",3116:"4061bfd3",3189:"2adfdcac",3218:"6ccb158e",3236:"cc9d5bf1",3237:"1df93b7f",3336:"84cbd6c9",3343:"09ac38f0",3396:"6be32138",3503:"af6a11bf",3608:"9e4087bc",3707:"f02c0d6e",3719:"f41bce02",3751:"3720c009",3863:"53ca291c",4013:"01a85c17",4034:"ec98ad91",4063:"44969bae",4121:"55960ee5",4327:"07f20919",4356:"a9a76bf7",4402:"40aeb86f",4451:"3f3a03c1",4508:"35a7e2bf",4530:"2218035b",4537:"21f2cabf",4541:"da8f35c6",4556:"68b99ecd",4679:"6e965365",4708:"e10957d6",4713:"9f7d0305",4749:"616ee580",4785:"b03a0ac1",4788:"f6807fb4",4819:"85d6e74d",4826:"50f02954",4846:"fd2b74dc",4888:"f50a4147",4939:"b8466c91",5049:"9cc140f3",5075:"0dffb83e",5081:"4beaa780",5094:"763344b9",5120:"ffcb1b32",5136:"6cbb3cde",5204:"45ac3af8",5318:"581d5240",5347:"f9537533",5466:"43ee1886",5522:"8428fe34",5530:"d16f6fc6",5548:"d23df0ea",5602:"35230925",5649:"7b667a7f",5844:"ad04e600",5888:"da002ab0",6074:"a771de40",6103:"ccc49370",6272:"4d7007b2",6296:"4c9535f7",6310:"cc8e0b88",6353:"7b9de75f",6362:"749619b5",6410:"514cab6e",6461:"f4fd4511",6476:"5a9491fe",6577:"965d240c",6601:"179183ba",6669:"3f90f51b",6696:"45e1a117",6699:"9bd69ffc",6788:"187c6361",6798:"fa69a7f4",6854:"8cf21e85",6926:"27528755",6939:"f3f8ecb0",6971:"c377a04b",6980:"b02525a9",7091:"e91f52c1",7136:"a13e0645",7147:"2730e145",7249:"153c226b",7310:"ffc337e7",7400:"2ddc9f52",7536:"6f8964f3",7563:"c222de09",7649:"0359c679",7706:"b35f1b7f",7796:"a50e2e4f",7804:"ecfddbd4",7813:"933a69d3",7918:"17896441",7920:"1a4e3797",8005:"82893666",8059:"84e08f43",8132:"2e0a4d25",8256:"79055aff",8318:"9bca08cf",8427:"143de299",8567:"5ef0bdde",8578:"445e9e2a",8610:"6875c492",8644:"dc2776f2",8747:"39574d2e",8754:"bea6e15b",8934:"0fbdd4ac",8942:"5ec90731",9021:"2baa5a9a",9062:"7b788087",9188:"bd59af11",9267:"08dd5264",9316:"180ee354",9320:"665f164c",9335:"00309d1b",9336:"3f0cec70",9395:"ce4635d7",9511:"4c027320",9513:"4a821728",9514:"1be78505",9649:"90decb6d",9707:"dd97a9bc",9743:"fcc63351",9752:"5b6134d1",9804:"5d38c936",9829:"5bc389a1",9847:"45c86e35",9854:"1d8a5d15",9924:"df203c0f",9981:"ae013ba6",9995:"e331fbd7"}[e]||e)+"."+{4:"bbdd63a1",11:"b4ac4739",53:"98ab07d7",71:"77ca8786",173:"381d2121",327:"1c632dae",373:"1cf2e42e",382:"46757c8d",387:"ac1d6308",402:"31ceddd4",469:"cd5b76ca",533:"3685267b",551:"24b75469",554:"091e2e6b",555:"d3c847c3",572:"7e4aa2bd",659:"f603dcc9",663:"ae7f79cc",706:"9b552829",747:"42f49a8c",801:"85b42d25",814:"7715ba3a",909:"426b68ec",920:"03680a1b",982:"6e44c2a3",1025:"8dde6aa3",1138:"0c257146",1251:"5dcd8f5d",1263:"45c490ed",1345:"c34d5bde",1354:"affbfa3f",1426:"58a14d8a",1474:"de071f8d",1476:"e3235f46",1477:"89e02325",1498:"80ee5756",1510:"6072e2a5",1517:"2fd54cee",1563:"fb5615ec",1611:"b7f84265",1706:"5b73083f",1713:"e95d897a",1771:"91e85ef3",1837:"bd881c9e",1984:"ef253045",2023:"31238def",2027:"ebda8846",2114:"0de601d3",2126:"f8f42c37",2170:"11304d9c",2214:"90418f6a",2235:"83ee952a",2240:"1b5727ea",2260:"c73efbe4",2386:"12f4ff8d",2421:"e7c31aca",2450:"0cbe1c20",2501:"2c5aa46d",2517:"a803ca01",2535:"d24f5f57",2702:"1c39ae8b",2800:"b2010ed6",2908:"d7494b7e",2918:"9e13fcfa",3012:"9d9f9412",3023:"e12e16bb",3089:"28469447",3116:"29aa95b8",3189:"a382b418",3218:"491e356f",3236:"8bf22a24",3237:"4902629f",3336:"7b2ad79f",3343:"e1a56ba9",3396:"c839bfac",3503:"833de94d",3608:"a9c67174",3707:"a8b752d8",3719:"82543bf2",3751:"a4574b8c",3863:"82f62613",4013:"7d963c01",4034:"08a89d13",4063:"7e6abc6e",4121:"25a73679",4327:"ff3964a2",4356:"5c10b5a8",4402:"13d479d3",4451:"c14b64e9",4508:"e661e27e",4530:"a68c5f9c",4537:"2938f388",4541:"faa1df34",4556:"3b517092",4679:"5f94f0a6",4708:"c579463f",4713:"7388f64a",4749:"e30472b0",4785:"7c16d2b5",4788:"5389a650",4819:"6280433f",4826:"171a32d5",4846:"550c03dc",4888:"103a0c55",4939:"eed55eb6",4972:"0a28dda3",5049:"46c0f2b1",5075:"d0cc566b",5081:"28992a2f",5094:"ca82c87e",5120:"d819dc1a",5136:"6db4a7cc",5204:"59f3bef9",5318:"60a712c5",5347:"a14c1c41",5466:"331e3119",5522:"0509f320",5530:"a492f280",5548:"a6176b99",5602:"29f648b5",5649:"ae55a2ab",5844:"4cda4442",5888:"79cb2336",6048:"a0d2f860",6074:"71ea664a",6103:"084c8d77",6272:"6418c206",6296:"1505dcc3",6310:"61c83c7a",6353:"0ebd6f32",6362:"778e9505",6410:"e8c2eaad",6461:"1869451f",6476:"195d2f1b",6577:"50abd3fb",6601:"be6e6772",6669:"2d2941a9",6696:"149c1b9d",6699:"df99b872",6788:"b8c530ea",6798:"4d6b19e6",6854:"eb0c3500",6926:"a604f963",6939:"c4976496",6945:"bd8076fe",6971:"a63d0c15",6980:"456b9285",7091:"e63d5f81",7136:"b94fc59c",7147:"653238d1",7249:"d148cb4c",7310:"dce1780a",7400:"80c52109",7536:"0f47a8ee",7563:"ec3d20c2",7649:"33816ca2",7706:"5506d9ad",7796:"1318cb1d",7804:"f15998ec",7813:"580d79a0",7918:"1c8df702",7920:"3c1887b3",8005:"f3b79821",8059:"e19511bc",8105:"7cae6d1f",8132:"00fdda3c",8256:"6c794010",8318:"cbc2db42",8427:"c3fedd0b",8567:"fbb18141",8578:"cd1e4df3",8610:"bfbc1fdc",8644:"224fc2b8",8747:"a089ce5c",8754:"5e98adf3",8894:"62e3afaa",8934:"fde097b1",8942:"f6a49b70",9021:"4b0721ba",9062:"328863f6",9188:"470c9730",9267:"a583e0ee",9316:"4835f795",9320:"dd89595f",9335:"9a24e38b",9336:"f407843f",9395:"d356d916",9511:"0ae961df",9513:"447bd46f",9514:"b4afe812",9649:"9b736857",9707:"d4d26cd8",9743:"75cdda8a",9752:"bd33ad36",9804:"8764d96d",9829:"0b96f914",9847:"7db05553",9854:"892ac60d",9924:"8ad14275",9981:"782396fa",9995:"8617ba2c"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,f)=>Object.prototype.hasOwnProperty.call(e,f),d={},c="docta:",r.l=(e,f,a,b)=>{if(d[e])d[e].push(f);else{var t,o;if(void 0!==a)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var c=d[e];if(delete d[e],t.parentNode&&t.parentNode.removeChild(t),c&&c.forEach((e=>e(a))),f)return f(a)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/",r.gca=function(e){return e={17896441:"7918",27528755:"6926",35230925:"5602",82893666:"8005","779cc1e8":"4","3a6297ac":"11","935f2afb":"53","51f2bfad":"71","48e81e49":"173",b696d13b:"327","9f1c3232":"373","8def2dd5":"382","7ceaa645":"387","49b5e83d":"402","3b168dbd":"469",b2b675dd:"533",b4f44b9b:"551","7aba1839":"554","433ff3d6":"555",caaedc90:"572","5d08f08d":"659","0ea1f268":"663","719c0fd7":"706","155c1e74":"747","631037e5":"801","95f4d37c":"814","5437f376":"909",b8c37621:"920",f3d7f34e:"982","98f9308d":"1025","64d03520":"1138","7aefc753":"1251","74ec46b4":"1263",c3f5dd14:"1345",ceabd901:"1354","75d8af72":"1474",b9b7817e:"1476",b2f554cd:"1477","29b62a39":"1498","29b83576":"1510","166b5465":"1517","39e94577":"1563",fa7546af:"1611",d8be0e5a:"1706",a7023ddc:"1713","564044f9":"1771",ce321ae3:"1837","51d5b592":"1984",d464210a:"2023",d1d29319:"2027",b5954e33:"2114",b40daf0f:"2126","02f62b30":"2170","399f21a8":"2214","3290fbc2":"2235","469c924f":"2240","4035650f":"2260","93df2695":"2386","86c3bd1d":"2421",e6a08407:"2450","5559e604":"2501","8a92e787":"2517","814f3328":"2535","1c14429f":"2702","4247aede":"2800","48857ff6":"2908",d7d81bf6:"2918",aa81941d:"3012",d1b78a4d:"3023",a6aa9e1f:"3089","4061bfd3":"3116","2adfdcac":"3189","6ccb158e":"3218",cc9d5bf1:"3236","1df93b7f":"3237","84cbd6c9":"3336","09ac38f0":"3343","6be32138":"3396",af6a11bf:"3503","9e4087bc":"3608",f02c0d6e:"3707",f41bce02:"3719","3720c009":"3751","53ca291c":"3863","01a85c17":"4013",ec98ad91:"4034","44969bae":"4063","55960ee5":"4121","07f20919":"4327",a9a76bf7:"4356","40aeb86f":"4402","3f3a03c1":"4451","35a7e2bf":"4508","2218035b":"4530","21f2cabf":"4537",da8f35c6:"4541","68b99ecd":"4556","6e965365":"4679",e10957d6:"4708","9f7d0305":"4713","616ee580":"4749",b03a0ac1:"4785",f6807fb4:"4788","85d6e74d":"4819","50f02954":"4826",fd2b74dc:"4846",f50a4147:"4888",b8466c91:"4939","9cc140f3":"5049","0dffb83e":"5075","4beaa780":"5081","763344b9":"5094",ffcb1b32:"5120","6cbb3cde":"5136","45ac3af8":"5204","581d5240":"5318",f9537533:"5347","43ee1886":"5466","8428fe34":"5522",d16f6fc6:"5530",d23df0ea:"5548","7b667a7f":"5649",ad04e600:"5844",da002ab0:"5888",a771de40:"6074",ccc49370:"6103","4d7007b2":"6272","4c9535f7":"6296",cc8e0b88:"6310","7b9de75f":"6353","749619b5":"6362","514cab6e":"6410",f4fd4511:"6461","5a9491fe":"6476","965d240c":"6577","179183ba":"6601","3f90f51b":"6669","45e1a117":"6696","9bd69ffc":"6699","187c6361":"6788",fa69a7f4:"6798","8cf21e85":"6854",f3f8ecb0:"6939",c377a04b:"6971",b02525a9:"6980",e91f52c1:"7091",a13e0645:"7136","2730e145":"7147","153c226b":"7249",ffc337e7:"7310","2ddc9f52":"7400","6f8964f3":"7536",c222de09:"7563","0359c679":"7649",b35f1b7f:"7706",a50e2e4f:"7796",ecfddbd4:"7804","933a69d3":"7813","1a4e3797":"7920","84e08f43":"8059","2e0a4d25":"8132","79055aff":"8256","9bca08cf":"8318","143de299":"8427","5ef0bdde":"8567","445e9e2a":"8578","6875c492":"8610",dc2776f2:"8644","39574d2e":"8747",bea6e15b:"8754","0fbdd4ac":"8934","5ec90731":"8942","2baa5a9a":"9021","7b788087":"9062",bd59af11:"9188","08dd5264":"9267","180ee354":"9316","665f164c":"9320","00309d1b":"9335","3f0cec70":"9336",ce4635d7:"9395","4c027320":"9511","4a821728":"9513","1be78505":"9514","90decb6d":"9649",dd97a9bc:"9707",fcc63351:"9743","5b6134d1":"9752","5d38c936":"9804","5bc389a1":"9829","45c86e35":"9847","1d8a5d15":"9854",df203c0f:"9924",ae013ba6:"9981",e331fbd7:"9995"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(f,a)=>{var d=r.o(e,f)?e[f]:void 0;if(0!==d)if(d)a.push(d[2]);else if(/^(1303|532)$/.test(f))e[f]=0;else{var c=new Promise(((a,c)=>d=e[f]=[a,c]));a.push(d[2]=c);var b=r.p+r.u(f),t=new Error;r.l(b,(a=>{if(r.o(e,f)&&(0!==(d=e[f])&&(e[f]=void 0),d)){var c=a&&("load"===a.type?"missing":a.type),b=a&&a.target&&a.target.src;t.message="Loading chunk "+f+" failed.\n("+c+": "+b+")",t.name="ChunkLoadError",t.type=c,t.request=b,d[1](t)}}),"chunk-"+f,f)}},r.O.j=f=>0===e[f];var f=(f,a)=>{var d,c,b=a[0],t=a[1],o=a[2],n=0;if(b.some((f=>0!==e[f]))){for(d in t)r.o(t,d)&&(r.m[d]=t[d]);if(o)var i=o(r)}for(f&&f(a);n{"use strict";var e,f,a,d,c,b={},t={};function r(e){var f=t[e];if(void 0!==f)return f.exports;var a=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.m=b,r.c=t,e=[],r.O=(f,a,d,c)=>{if(!a){var b=1/0;for(i=0;i=c)&&Object.keys(r.O).every((e=>r.O[e](a[o])))?a.splice(o--,1):(t=!1,c0&&e[i-1][2]>c;i--)e[i]=e[i-1];e[i]=[a,d,c]},r.n=e=>{var f=e&&e.__esModule?()=>e.default:()=>e;return r.d(f,{a:f}),f},a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,d){if(1&d&&(e=this(e)),8&d)return e;if("object"==typeof e&&e){if(4&d&&e.__esModule)return e;if(16&d&&"function"==typeof e.then)return e}var c=Object.create(null);r.r(c);var b={};f=f||[null,a({}),a([]),a(a)];for(var t=2&d&&e;"object"==typeof t&&!~f.indexOf(t);t=a(t))Object.getOwnPropertyNames(t).forEach((f=>b[f]=()=>e[f]));return b.default=()=>e,r.d(c,b),c},r.d=(e,f)=>{for(var a in f)r.o(f,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:f[a]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((f,a)=>(r.f[a](e,f),f)),[])),r.u=e=>"assets/js/"+({4:"779cc1e8",11:"3a6297ac",53:"935f2afb",71:"51f2bfad",173:"48e81e49",327:"b696d13b",373:"9f1c3232",382:"8def2dd5",387:"7ceaa645",402:"49b5e83d",469:"3b168dbd",533:"b2b675dd",551:"b4f44b9b",554:"7aba1839",555:"433ff3d6",572:"caaedc90",659:"5d08f08d",663:"0ea1f268",706:"719c0fd7",747:"155c1e74",801:"631037e5",814:"95f4d37c",909:"5437f376",920:"b8c37621",982:"f3d7f34e",1025:"98f9308d",1138:"64d03520",1251:"7aefc753",1263:"74ec46b4",1345:"c3f5dd14",1354:"ceabd901",1474:"75d8af72",1476:"b9b7817e",1477:"b2f554cd",1498:"29b62a39",1510:"29b83576",1517:"166b5465",1563:"39e94577",1611:"fa7546af",1706:"d8be0e5a",1713:"a7023ddc",1771:"564044f9",1837:"ce321ae3",1984:"51d5b592",2023:"d464210a",2027:"d1d29319",2114:"b5954e33",2126:"b40daf0f",2170:"02f62b30",2214:"399f21a8",2235:"3290fbc2",2240:"469c924f",2260:"4035650f",2386:"93df2695",2421:"86c3bd1d",2450:"e6a08407",2501:"5559e604",2517:"8a92e787",2535:"814f3328",2702:"1c14429f",2800:"4247aede",2908:"48857ff6",2918:"d7d81bf6",3012:"aa81941d",3023:"d1b78a4d",3089:"a6aa9e1f",3116:"4061bfd3",3189:"2adfdcac",3218:"6ccb158e",3236:"cc9d5bf1",3237:"1df93b7f",3336:"84cbd6c9",3343:"09ac38f0",3396:"6be32138",3503:"af6a11bf",3608:"9e4087bc",3707:"f02c0d6e",3719:"f41bce02",3751:"3720c009",3863:"53ca291c",4013:"01a85c17",4034:"ec98ad91",4063:"44969bae",4121:"55960ee5",4327:"07f20919",4356:"a9a76bf7",4402:"40aeb86f",4451:"3f3a03c1",4508:"35a7e2bf",4530:"2218035b",4537:"21f2cabf",4541:"da8f35c6",4556:"68b99ecd",4679:"6e965365",4708:"e10957d6",4713:"9f7d0305",4749:"616ee580",4785:"b03a0ac1",4788:"f6807fb4",4819:"85d6e74d",4826:"50f02954",4846:"fd2b74dc",4888:"f50a4147",4939:"b8466c91",5049:"9cc140f3",5075:"0dffb83e",5081:"4beaa780",5094:"763344b9",5120:"ffcb1b32",5136:"6cbb3cde",5204:"45ac3af8",5318:"581d5240",5347:"f9537533",5466:"43ee1886",5522:"8428fe34",5530:"d16f6fc6",5548:"d23df0ea",5602:"35230925",5649:"7b667a7f",5844:"ad04e600",5888:"da002ab0",6074:"a771de40",6103:"ccc49370",6272:"4d7007b2",6296:"4c9535f7",6310:"cc8e0b88",6353:"7b9de75f",6362:"749619b5",6410:"514cab6e",6461:"f4fd4511",6476:"5a9491fe",6577:"965d240c",6601:"179183ba",6669:"3f90f51b",6696:"45e1a117",6699:"9bd69ffc",6788:"187c6361",6798:"fa69a7f4",6854:"8cf21e85",6926:"27528755",6939:"f3f8ecb0",6971:"c377a04b",6980:"b02525a9",7091:"e91f52c1",7136:"a13e0645",7147:"2730e145",7249:"153c226b",7310:"ffc337e7",7400:"2ddc9f52",7536:"6f8964f3",7563:"c222de09",7649:"0359c679",7706:"b35f1b7f",7796:"a50e2e4f",7804:"ecfddbd4",7813:"933a69d3",7918:"17896441",7920:"1a4e3797",8005:"82893666",8059:"84e08f43",8132:"2e0a4d25",8256:"79055aff",8318:"9bca08cf",8427:"143de299",8567:"5ef0bdde",8578:"445e9e2a",8610:"6875c492",8644:"dc2776f2",8747:"39574d2e",8754:"bea6e15b",8934:"0fbdd4ac",8942:"5ec90731",9021:"2baa5a9a",9062:"7b788087",9188:"bd59af11",9267:"08dd5264",9316:"180ee354",9320:"665f164c",9335:"00309d1b",9336:"3f0cec70",9395:"ce4635d7",9511:"4c027320",9513:"4a821728",9514:"1be78505",9649:"90decb6d",9707:"dd97a9bc",9743:"fcc63351",9752:"5b6134d1",9804:"5d38c936",9829:"5bc389a1",9847:"45c86e35",9854:"1d8a5d15",9924:"df203c0f",9981:"ae013ba6",9995:"e331fbd7"}[e]||e)+"."+{4:"bbdd63a1",11:"b4ac4739",53:"98ab07d7",71:"77ca8786",173:"381d2121",327:"1c632dae",373:"1cf2e42e",382:"46757c8d",387:"ac1d6308",402:"31ceddd4",469:"cd5b76ca",533:"3685267b",551:"24b75469",554:"091e2e6b",555:"d3c847c3",572:"7e4aa2bd",659:"f603dcc9",663:"ae7f79cc",706:"9b552829",747:"42f49a8c",801:"85b42d25",814:"7715ba3a",909:"7410f8c6",920:"03680a1b",982:"6e44c2a3",1025:"b6142649",1138:"0c257146",1251:"695b86b0",1263:"45c490ed",1345:"c34d5bde",1354:"affbfa3f",1426:"58a14d8a",1474:"de071f8d",1476:"e3235f46",1477:"26978dab",1498:"c0bf41f4",1510:"507a0b0b",1517:"2fd54cee",1563:"fb5615ec",1611:"b7f84265",1706:"683fe5b5",1713:"e95d897a",1771:"91e85ef3",1837:"bd881c9e",1984:"e890f6e2",2023:"31238def",2027:"ebda8846",2114:"0de601d3",2126:"f8f42c37",2170:"11304d9c",2214:"90418f6a",2235:"83ee952a",2240:"1b5727ea",2260:"c73efbe4",2386:"12f4ff8d",2421:"e7c31aca",2450:"0cbe1c20",2501:"2c5aa46d",2517:"8a1b5d51",2535:"d24f5f57",2702:"8304ed86",2800:"b2010ed6",2908:"d7494b7e",2918:"4a15a96e",3012:"9d9f9412",3023:"b9f410cf",3089:"28469447",3116:"29aa95b8",3189:"a382b418",3218:"491e356f",3236:"8bf22a24",3237:"4902629f",3336:"7b2ad79f",3343:"e1a56ba9",3396:"ee48b118",3503:"833de94d",3608:"a9c67174",3707:"a8b752d8",3719:"82543bf2",3751:"a4574b8c",3863:"82f62613",4013:"7d963c01",4034:"08a89d13",4063:"7e6abc6e",4121:"25a73679",4327:"ff3964a2",4356:"5c10b5a8",4402:"c592360f",4451:"c14b64e9",4508:"e661e27e",4530:"a68c5f9c",4537:"2938f388",4541:"faa1df34",4556:"3b517092",4679:"5f94f0a6",4708:"c579463f",4713:"7388f64a",4749:"e30472b0",4785:"7c16d2b5",4788:"5389a650",4819:"6280433f",4826:"171a32d5",4846:"711c1116",4888:"103a0c55",4939:"eed55eb6",4972:"0a28dda3",5049:"46c0f2b1",5075:"d0cc566b",5081:"28992a2f",5094:"ca82c87e",5120:"d819dc1a",5136:"6db4a7cc",5204:"59f3bef9",5318:"60a712c5",5347:"a14c1c41",5466:"331e3119",5522:"0509f320",5530:"a492f280",5548:"a1dd5725",5602:"29f648b5",5649:"ae55a2ab",5844:"4cda4442",5888:"79cb2336",6048:"a0d2f860",6074:"71ea664a",6103:"084c8d77",6272:"bc866e91",6296:"07ee15ee",6310:"61c83c7a",6353:"0ebd6f32",6362:"778e9505",6410:"e8c2eaad",6461:"1869451f",6476:"195d2f1b",6577:"50abd3fb",6601:"be6e6772",6669:"2d2941a9",6696:"149c1b9d",6699:"df99b872",6788:"b8c530ea",6798:"4d6b19e6",6854:"eb0c3500",6926:"a604f963",6939:"c4976496",6945:"bd8076fe",6971:"a63d0c15",6980:"456b9285",7091:"e63d5f81",7136:"b94fc59c",7147:"43b66d7d",7249:"d148cb4c",7310:"dce1780a",7400:"80c52109",7536:"0f47a8ee",7563:"ec3d20c2",7649:"33816ca2",7706:"902fd0cd",7796:"1318cb1d",7804:"f15998ec",7813:"580d79a0",7918:"1c8df702",7920:"3c1887b3",8005:"f3b79821",8059:"e19511bc",8105:"7cae6d1f",8132:"00fdda3c",8256:"6c794010",8318:"cbc2db42",8427:"c3fedd0b",8567:"fbb18141",8578:"f5d9aefe",8610:"bfbc1fdc",8644:"224fc2b8",8747:"a089ce5c",8754:"5e98adf3",8894:"62e3afaa",8934:"fde097b1",8942:"f6a49b70",9021:"4b0721ba",9062:"328863f6",9188:"470c9730",9267:"a583e0ee",9316:"4835f795",9320:"dd89595f",9335:"9a24e38b",9336:"f407843f",9395:"d356d916",9511:"0ae961df",9513:"447bd46f",9514:"b4afe812",9649:"9b736857",9707:"d4d26cd8",9743:"75cdda8a",9752:"d8e23f3c",9804:"8764d96d",9829:"3fe4b2bd",9847:"7db05553",9854:"007acdee",9924:"8ad14275",9981:"782396fa",9995:"8617ba2c"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,f)=>Object.prototype.hasOwnProperty.call(e,f),d={},c="docta:",r.l=(e,f,a,b)=>{if(d[e])d[e].push(f);else{var t,o;if(void 0!==a)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var c=d[e];if(delete d[e],t.parentNode&&t.parentNode.removeChild(t),c&&c.forEach((e=>e(a))),f)return f(a)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/",r.gca=function(e){return e={17896441:"7918",27528755:"6926",35230925:"5602",82893666:"8005","779cc1e8":"4","3a6297ac":"11","935f2afb":"53","51f2bfad":"71","48e81e49":"173",b696d13b:"327","9f1c3232":"373","8def2dd5":"382","7ceaa645":"387","49b5e83d":"402","3b168dbd":"469",b2b675dd:"533",b4f44b9b:"551","7aba1839":"554","433ff3d6":"555",caaedc90:"572","5d08f08d":"659","0ea1f268":"663","719c0fd7":"706","155c1e74":"747","631037e5":"801","95f4d37c":"814","5437f376":"909",b8c37621:"920",f3d7f34e:"982","98f9308d":"1025","64d03520":"1138","7aefc753":"1251","74ec46b4":"1263",c3f5dd14:"1345",ceabd901:"1354","75d8af72":"1474",b9b7817e:"1476",b2f554cd:"1477","29b62a39":"1498","29b83576":"1510","166b5465":"1517","39e94577":"1563",fa7546af:"1611",d8be0e5a:"1706",a7023ddc:"1713","564044f9":"1771",ce321ae3:"1837","51d5b592":"1984",d464210a:"2023",d1d29319:"2027",b5954e33:"2114",b40daf0f:"2126","02f62b30":"2170","399f21a8":"2214","3290fbc2":"2235","469c924f":"2240","4035650f":"2260","93df2695":"2386","86c3bd1d":"2421",e6a08407:"2450","5559e604":"2501","8a92e787":"2517","814f3328":"2535","1c14429f":"2702","4247aede":"2800","48857ff6":"2908",d7d81bf6:"2918",aa81941d:"3012",d1b78a4d:"3023",a6aa9e1f:"3089","4061bfd3":"3116","2adfdcac":"3189","6ccb158e":"3218",cc9d5bf1:"3236","1df93b7f":"3237","84cbd6c9":"3336","09ac38f0":"3343","6be32138":"3396",af6a11bf:"3503","9e4087bc":"3608",f02c0d6e:"3707",f41bce02:"3719","3720c009":"3751","53ca291c":"3863","01a85c17":"4013",ec98ad91:"4034","44969bae":"4063","55960ee5":"4121","07f20919":"4327",a9a76bf7:"4356","40aeb86f":"4402","3f3a03c1":"4451","35a7e2bf":"4508","2218035b":"4530","21f2cabf":"4537",da8f35c6:"4541","68b99ecd":"4556","6e965365":"4679",e10957d6:"4708","9f7d0305":"4713","616ee580":"4749",b03a0ac1:"4785",f6807fb4:"4788","85d6e74d":"4819","50f02954":"4826",fd2b74dc:"4846",f50a4147:"4888",b8466c91:"4939","9cc140f3":"5049","0dffb83e":"5075","4beaa780":"5081","763344b9":"5094",ffcb1b32:"5120","6cbb3cde":"5136","45ac3af8":"5204","581d5240":"5318",f9537533:"5347","43ee1886":"5466","8428fe34":"5522",d16f6fc6:"5530",d23df0ea:"5548","7b667a7f":"5649",ad04e600:"5844",da002ab0:"5888",a771de40:"6074",ccc49370:"6103","4d7007b2":"6272","4c9535f7":"6296",cc8e0b88:"6310","7b9de75f":"6353","749619b5":"6362","514cab6e":"6410",f4fd4511:"6461","5a9491fe":"6476","965d240c":"6577","179183ba":"6601","3f90f51b":"6669","45e1a117":"6696","9bd69ffc":"6699","187c6361":"6788",fa69a7f4:"6798","8cf21e85":"6854",f3f8ecb0:"6939",c377a04b:"6971",b02525a9:"6980",e91f52c1:"7091",a13e0645:"7136","2730e145":"7147","153c226b":"7249",ffc337e7:"7310","2ddc9f52":"7400","6f8964f3":"7536",c222de09:"7563","0359c679":"7649",b35f1b7f:"7706",a50e2e4f:"7796",ecfddbd4:"7804","933a69d3":"7813","1a4e3797":"7920","84e08f43":"8059","2e0a4d25":"8132","79055aff":"8256","9bca08cf":"8318","143de299":"8427","5ef0bdde":"8567","445e9e2a":"8578","6875c492":"8610",dc2776f2:"8644","39574d2e":"8747",bea6e15b:"8754","0fbdd4ac":"8934","5ec90731":"8942","2baa5a9a":"9021","7b788087":"9062",bd59af11:"9188","08dd5264":"9267","180ee354":"9316","665f164c":"9320","00309d1b":"9335","3f0cec70":"9336",ce4635d7:"9395","4c027320":"9511","4a821728":"9513","1be78505":"9514","90decb6d":"9649",dd97a9bc:"9707",fcc63351:"9743","5b6134d1":"9752","5d38c936":"9804","5bc389a1":"9829","45c86e35":"9847","1d8a5d15":"9854",df203c0f:"9924",ae013ba6:"9981",e331fbd7:"9995"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(f,a)=>{var d=r.o(e,f)?e[f]:void 0;if(0!==d)if(d)a.push(d[2]);else if(/^(1303|532)$/.test(f))e[f]=0;else{var c=new Promise(((a,c)=>d=e[f]=[a,c]));a.push(d[2]=c);var b=r.p+r.u(f),t=new Error;r.l(b,(a=>{if(r.o(e,f)&&(0!==(d=e[f])&&(e[f]=void 0),d)){var c=a&&("load"===a.type?"missing":a.type),b=a&&a.target&&a.target.src;t.message="Loading chunk "+f+" failed.\n("+c+": "+b+")",t.name="ChunkLoadError",t.type=c,t.request=b,d[1](t)}}),"chunk-"+f,f)}},r.O.j=f=>0===e[f];var f=(f,a)=>{var d,c,b=a[0],t=a[1],o=a[2],n=0;if(b.some((f=>0!==e[f]))){for(d in t)r.o(t,d)&&(r.m[d]=t[d]);if(o)var i=o(r)}for(f&&f(a);n - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/blog/atom.xml b/blog/atom.xml index 72ab5c9c8..df81072d0 100644 --- a/blog/atom.xml +++ b/blog/atom.xml @@ -2,7 +2,7 @@ https://docs.fleek.network/blog Fleek Network Docs | Decentralized Edge Platform Blog - 2023-10-20T15:50:16.000Z + 2023-10-20T16:26:18.000Z https://github.com/jpmonette/feed Fleek Network Docs | Decentralized Edge Platform Blog @@ -12,7 +12,7 @@ <![CDATA[Bloom Filters and Cuckoo Filters for Cache Summarization]]> https://docs.fleek.network/blog/bloom-and-cuckoo-filters-for-cache-summarization - 2023-10-20T15:50:16.000Z + 2023-10-20T16:26:18.000Z Disclaimer: This is not a general comparison between Bloom filters and Cuckoo filters. This blog post summarizes some of the experiments we conducted to decide whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters, for a specific use case.

Background

Nodes on Fleek Network currently use Counting Bloom filters to summarize their cached content. These cache summaries are exchanged with other nodes in order to facilitate content routing.

If a particular node does not store a requested piece of content, it can use the Bloom filters that it received from its peers to check if a peer stores the requested content.

We are using Counting Bloom filters rather than regular Bloom filters because we need to be able to remove elements from the filter to support cache eviction.

Bloom Filters

A Bloom filter is a space-efficient probabilistic data structure that can be used to perform approximate set membership queries. The answer to an approximate set membership query is not no or yes, but rather no or probably. This probably is quantified with the false positive rate.

One of the convenient features of Bloom filters is that they can be configured to have a specific false positive rate. diff --git a/blog/bloom-and-cuckoo-filters-for-cache-summarization/index.html b/blog/bloom-and-cuckoo-filters-for-cache-summarization/index.html index 52f83dee1..d9fece2b8 100644 --- a/blog/bloom-and-cuckoo-filters-for-cache-summarization/index.html +++ b/blog/bloom-and-cuckoo-filters-for-cache-summarization/index.html @@ -3,7 +3,7 @@ -Bloom Filters and Cuckoo Filters for Cache Summarization | Fleek Network Docs | Decentralized Edge Platform +Bloom Filters and Cuckoo Filters for Cache Summarization | Fleek Network Docs | Decentralized Edge Platform @@ -13,14 +13,14 @@ - +

-

Bloom Filters and Cuckoo Filters for Cache Summarization

· 11 min read
Matthias Wright

Disclaimer: This is not a general comparison between Bloom filters and Cuckoo filters. This blog post summarizes some of the experiments we conducted to decide whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters, for a specific use case.

Background

Nodes on Fleek Network currently use Counting Bloom filters to summarize their cached content. These cache summaries are exchanged with other nodes in order to facilitate content routing.

If a particular node does not store a requested piece of content, it can use the Bloom filters that it received from its peers to check if a peer stores the requested content.

We are using Counting Bloom filters rather than regular Bloom filters because we need to be able to remove elements from the filter to support cache eviction.

Bloom Filters

A Bloom filter is a space-efficient probabilistic data structure that can be used to perform approximate set membership queries. +

Bloom Filters and Cuckoo Filters for Cache Summarization

· 11 min read
Matthias Wright

Disclaimer: This is not a general comparison between Bloom filters and Cuckoo filters. This blog post summarizes some of the experiments we conducted to decide whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters, for a specific use case.

Background

Nodes on Fleek Network currently use Counting Bloom filters to summarize their cached content. These cache summaries are exchanged with other nodes in order to facilitate content routing.

If a particular node does not store a requested piece of content, it can use the Bloom filters that it received from its peers to check if a peer stores the requested content.

We are using Counting Bloom filters rather than regular Bloom filters because we need to be able to remove elements from the filter to support cache eviction.

Bloom Filters

A Bloom filter is a space-efficient probabilistic data structure that can be used to perform approximate set membership queries. The answer to an approximate set membership query is not no or yes, but rather no or probably. This probably is quantified with the false positive rate.

One of the convenient features of Bloom filters is that they can be configured to have a specific false positive rate. Of course, there is a tradeoff here; the lower the false positive rate, the larger the memory footprint. Bloom filters support two operations: insert and contains.

A Bloom filter is represented by an array of m bits together with k independent hash functions. To insert an element into the filter, it is hashed with each of the k hash functions. The resulting hashes are interpreted as integers (modulo m) to obtain k array positions. The bits at these positions are then set to 1 (if there aren't already 1).
@@ -41,7 +41,7 @@ Bloom filters and Cuckoo filters behave differently in this scenario.

For Bloom filters, the insertion operation always succeeds. However, the false positive rate will rapidly increase as we exceed the filter's capacity. While Bloom filters fail silently, Cuckoo filters are more explicit. Most implementations have a maximum number of relocations that will be performed for an insertion. The insertion operation will return an error if more relocations are required.

For both filters, we can avoid this problem by simply initializing the filter with a sufficiently large capacity. However, this will increase the memory footprint of the filter.

Furthermore, it is difficult to predict how many elements a node on Fleek Network will cache. It is also likely that the number of cached elements will greatly vary for different nodes.

Fortunately, a variant of Bloom filters called Scalable Bloom Filters [4] can adapt dynamically to the number of elements stored while guaranteeing a maximum false positive rate.

The proposed technique is also applicable to Cuckoo filters.

Other Filters

While we only looked at Bloom filters and Cuckoo filters, there are other AMQ filters that we want to mention here briefly:

  • Quotient filters [5, 6]: Compact hash tables that support insertion, lookup, and deletion. Less space-efficient than Bloom filters and Cuckoo filters.

  • XOR filters [7]: More space-efficient than Bloom filters and Cuckoo filters. However, they are static, meaning the filter has to be rebuilt if additional elements are added.

Conclusion

We examined whether Counting Bloom filters or Cuckoo filters are more suitable for summarizing caches on Fleek Network. Cuckoo filters are more space-efficient, especially for lower false positive rates. Bloom filters have a slightly better insertion and lookup performance for the implementations we tested.

Both filters can be adapted to grow and shrink in size dynamically. Since the difference in insertion and lookup performance is negligible while Cuckoo filters are significantly more space-efficient, we favor Cuckoo filters for our use case.

References

[1] Bin Fan, Dave G. Andersen, Michael Kaminsky, and Michael D. Mitzenmacher. Cuckoo Filter: Practically Better Than Bloom. In Proceedings of the 10th ACM International Conference on emerging Networking Experiments and Technologies (CoNEXT 14). Association for Computing Machinery, New York, NY, USA, pp. 75-88, 2014.

[2] Rasmus Pagha and Flemming Friche Rodler. Cuckoo hashing. Journal of Algorithms, 51(2), pp. 122-144, 2004.

[3] Martin Dietzfelbinger and Christoph Weidling. Balanced Allocation and Dictionaries with Tightly Packed Constant Size Bins. Theoretical Computer Science, 380(1), pp. 47-68, 2007.

[4] Paulo S. Almeida, Carlos Baquero, Nuno Preguiça, and David Hutchison. Scalable Bloom Filters. Information Processing Letters, 101(6), pp. 255-261, 2007.

[5] John G. Cleary. Compact hash tables using bidirectional linear probing. IEEE Transactions on Computers. 33(9), pp. 828-834, 1984.

[6] Anna Pagh, Rasmus Pagh, and S. Srinivasa Rao. An optimal Bloom filter replacement. Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 823-829, 2005.

[7] Thomas Mueller Graf and Daniel Lemire. Xor Filters: Faster and Smaller Than Bloom and Cuckoo Filters. ACM Journal of Experimental Algorithmics. 25, pp. 1-16, 2020.

- + \ No newline at end of file diff --git a/blog/feed.json b/blog/feed.json index 1f55ffc9c..99c55d70d 100644 --- a/blog/feed.json +++ b/blog/feed.json @@ -10,7 +10,7 @@ "url": "https://docs.fleek.network/blog/bloom-and-cuckoo-filters-for-cache-summarization", "title": "Bloom Filters and Cuckoo Filters for Cache Summarization", "summary": "Summary of our experiment informing whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters.", - "date_modified": "2023-10-20T15:50:16.000Z", + "date_modified": "2023-10-20T16:26:18.000Z", "author": { "name": "Matthias Wright", "url": "https://github.com/matthias-wright" diff --git a/blog/index.html b/blog/index.html index 77d06eecd..f5a6a1c42 100644 --- a/blog/index.html +++ b/blog/index.html @@ -13,15 +13,15 @@ - +
-
- +
+ \ No newline at end of file diff --git a/blog/rss.xml b/blog/rss.xml index d258a4522..c6b36ee34 100644 --- a/blog/rss.xml +++ b/blog/rss.xml @@ -4,7 +4,7 @@ Fleek Network Docs | Decentralized Edge Platform Blog https://docs.fleek.network/blog Fleek Network Docs | Decentralized Edge Platform Blog - Fri, 20 Oct 2023 15:50:16 GMT + Fri, 20 Oct 2023 16:26:18 GMT https://validator.w3.org/feed/docs/rss2.html https://github.com/jpmonette/feed en @@ -13,7 +13,7 @@ <![CDATA[Bloom Filters and Cuckoo Filters for Cache Summarization]]> https://docs.fleek.network/blog/bloom-and-cuckoo-filters-for-cache-summarization https://docs.fleek.network/blog/bloom-and-cuckoo-filters-for-cache-summarization - Fri, 20 Oct 2023 15:50:16 GMT + Fri, 20 Oct 2023 16:26:18 GMT Disclaimer: This is not a general comparison between Bloom filters and Cuckoo filters. This blog post summarizes some of the experiments we conducted to decide whether or not we should replace our implementation of Counting Bloom filters with Cuckoo filters, for a specific use case.

Background

Nodes on Fleek Network currently use Counting Bloom filters to summarize their cached content. These cache summaries are exchanged with other nodes in order to facilitate content routing.

If a particular node does not store a requested piece of content, it can use the Bloom filters that it received from its peers to check if a peer stores the requested content.

We are using Counting Bloom filters rather than regular Bloom filters because we need to be able to remove elements from the filter to support cache eviction.

Bloom Filters

A Bloom filter is a space-efficient probabilistic data structure that can be used to perform approximate set membership queries. The answer to an approximate set membership query is not no or yes, but rather no or probably. This probably is quantified with the false positive rate.

One of the convenient features of Bloom filters is that they can be configured to have a specific false positive rate. diff --git a/blog/tags/blog/index.html b/blog/tags/blog/index.html index a538c12dc..d43f0e046 100644 --- a/blog/tags/blog/index.html +++ b/blog/tags/blog/index.html @@ -13,15 +13,15 @@ - +

-

One post tagged with "blog"

View All Tags
- +

One post tagged with "blog"

View All Tags
+ \ No newline at end of file diff --git a/blog/tags/content-routing/index.html b/blog/tags/content-routing/index.html index 1c53cf2d7..e796d805f 100644 --- a/blog/tags/content-routing/index.html +++ b/blog/tags/content-routing/index.html @@ -13,15 +13,15 @@ - +
-

One post tagged with "content routing"

View All Tags
- +

One post tagged with "content routing"

View All Tags
+ \ No newline at end of file diff --git a/blog/tags/engineering/index.html b/blog/tags/engineering/index.html index 62fcde1ff..fa6c73ef5 100644 --- a/blog/tags/engineering/index.html +++ b/blog/tags/engineering/index.html @@ -13,15 +13,15 @@ - +
-

One post tagged with "engineering"

View All Tags
- +

One post tagged with "engineering"

View All Tags
+ \ No newline at end of file diff --git a/blog/tags/fleek-network/index.html b/blog/tags/fleek-network/index.html index 598aa4503..0504065d9 100644 --- a/blog/tags/fleek-network/index.html +++ b/blog/tags/fleek-network/index.html @@ -13,15 +13,15 @@ - +
-

One post tagged with "fleek network"

View All Tags
- +

One post tagged with "fleek network"

View All Tags
+ \ No newline at end of file diff --git a/blog/tags/index.html b/blog/tags/index.html index 54bda3499..dc1d88330 100644 --- a/blog/tags/index.html +++ b/blog/tags/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/Open-source/code-of-conduct/index.html b/docs/Open-source/code-of-conduct/index.html index 64165e888..632717237 100644 --- a/docs/Open-source/code-of-conduct/index.html +++ b/docs/Open-source/code-of-conduct/index.html @@ -13,7 +13,7 @@ - + @@ -48,7 +48,7 @@ 1.4 and 2.0, and was generated by contributing-gen.

- + \ No newline at end of file diff --git a/docs/Open-source/contributing/index.html b/docs/Open-source/contributing/index.html index 991e92972..bc203f2d7 100644 --- a/docs/Open-source/contributing/index.html +++ b/docs/Open-source/contributing/index.html @@ -13,7 +13,7 @@ - + @@ -24,7 +24,7 @@ Lightning Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to dev@fleek.network.

I Have a Question

info

If you want to ask a question, we assume that you have read the available Documentation.

Before you ask a question, it is best to search for existing Issues that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.

If you then still feel the need to ask a question and need clarification, we recommend the following:

  • Open an Issue.
  • Provide as much context as you can about what you're running into.
  • Provide project and platform versions (rust, cargo, etc), depending on what seems relevant.

We will then take care of the issue as soon as possible.

I Want To Contribute

Legal Notice

When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.

Reporting Bugs

Before Submitting a Bug Report

A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.

  • Make sure that you are using the latest version.
  • Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the documentation. If you are looking for support, you might want to check this section).
  • To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the bug tracker.
  • Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue.
  • Collect information about the bug:
    • Stack trace (Traceback)
    • OS, Platform and Version (Linux, macOS, x86, ARM)
    • Version of the compiler, SDK, runtime environment, package manager, depending on what seems relevant.
    • Possibly your input and the output
    • Can you reliably reproduce the issue? And can you also reproduce it with older versions?

How Do I Submit a Good Bug Report?

info

You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to dev@fleek.network.

If you run into an issue with the project:

  • Open an Issue. (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
  • Explain the behavior you would expect and the actual behavior.
  • Please provide as much context as possible and describe the reproduction steps that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
  • Provide the information you collected in the previous section.

Once it's filed:

  • The project team will label the issue accordingly.
  • A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as needs-repro. Bugs with the needs-repro tag will not be addressed until they are reproduced.
  • If the team is able to reproduce the issue, it will be marked needs-fix, as well as possibly other tags (such as critical), and the issue will be left to be implemented by someone.

Suggesting Enhancements

This section guides you through submitting an enhancement suggestion for Lightning, including completely new features and minor improvements to existing functionality. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.

Before Submitting an Enhancement

  • Make sure that you are using the latest version.
  • Read the documentation carefully and find out if the functionality is already covered, maybe by an individual configuration.
  • Perform a search to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
  • Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.

How Do I Submit a Good Enhancement Suggestion?

Enhancement suggestions are tracked as GitHub issues.

  • Use a clear and descriptive title for the issue to identify the suggestion.
  • Provide a step-by-step description of the suggested enhancement in as many details as possible.
  • Describe the current behavior and explain which behavior you expected to see instead and why. At this point you can also tell which alternatives do not work for you.
  • Explain why this enhancement would be useful to most Lightning users. You may also want to point out the other projects that solved it better and which could serve as inspiration.

Workflow

The project is under heavy development to release the first version of the node and launch the testnet. Until then, the core team will be working from the main branch. PRs will be reviewed and treated case by case but the core team will commit directly to main for now.

Join The Project Team

Please visit our Discord to get in touch with us.

Attribution

This guide is based on the contributing-gen. Make your own!

- + \ No newline at end of file diff --git a/docs/Open-source/index.html b/docs/Open-source/index.html index 95a3d3459..1f5ab5e39 100644 --- a/docs/Open-source/index.html +++ b/docs/Open-source/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@
- + \ No newline at end of file diff --git a/docs/Open-source/repositories/index.html b/docs/Open-source/repositories/index.html index 53765be25..24b9fb600 100644 --- a/docs/Open-source/repositories/index.html +++ b/docs/Open-source/repositories/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

Repositories

The Fleek Network's repositories contain a collection of source code, libraries, and other software artifacts that are used to build and maintain our products collaboratively.

These repositories are carefully managed and versioned to ensure that developers can easily collaborate and work together on code changes. They are also regularly audited to ensure that only high-quality software is included and that security vulnerabilities are quickly identified and addressed.

Overall, our open-source repositories are an essential part of our development process and help us deliver reliable and secure products to our community.

Find all our repositories on Github

- + \ No newline at end of file diff --git a/docs/develop/client/index.html b/docs/develop/client/index.html index 852907d59..4db64e137 100644 --- a/docs/develop/client/index.html +++ b/docs/develop/client/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/develop/json-rpc/index.html b/docs/develop/json-rpc/index.html index 03bc2a1f8..a7419d969 100644 --- a/docs/develop/json-rpc/index.html +++ b/docs/develop/json-rpc/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/develop/overview/index.html b/docs/develop/overview/index.html index cf56268a7..fb4aa236c 100644 --- a/docs/develop/overview/index.html +++ b/docs/develop/overview/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

Overview

Developers can create and utilize a multitude of Edge Services that inherit cryptographic and economically secured infrastructure. On top of geographic coverage guarantees, predictable costs and performance across all services running on the network.

- + \ No newline at end of file diff --git a/docs/develop/service-development/index.html b/docs/develop/service-development/index.html index 3109fc68a..3de82abb9 100644 --- a/docs/develop/service-development/index.html +++ b/docs/develop/service-development/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index f80c955d1..17bd78744 100644 --- a/docs/index.html +++ b/docs/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

Fleek Network is an open-source Edge Computing Platform to accelerate the development and execution of decentralized Web Services.

The system builds on a distributed network of nodes, where services run within a fair and incentivized ecosystem constituted by an open community of developers and operators who can operate nodes, build services that use the network’s resources, or consume Fleek Network services on the Edge.

Applications, platforms and protocols build and utilize decentralized services on Fleek Network to optimize performance and reduce dependency on centralized cloud providers. Developers can build faster and launch better products by offloading parts of the stack to the Edge to focus on core features.

tip

To participate in the alpha Testnet, you can begin by setting up and running nodes. Check the requirements and find the onboarding instructions to enable you to install a network node successfully.

info

The Fleek Network's documentation is organized as follows:

Documentation brief breakdown of the Fleek Network.

Engineering offers a deeper look into how our engineering team works, research, and technology behind Fleek Network.

Guides provide step-by-step instructions for performing specific tasks.

References section provides short materials for Fleek Network command-line interfaces (CLIs), and application programming interfaces (APIs) for managing the resources and development. It is assumed that you already have a basic understanding of important concepts.

Roadmap

We aim to bring computation to where demand is. You can find Fleek Network's public roadmap here.

Need help?

Be part of a community! Join the Fleek Network discord if you want to ask a question, require help or exchange ideas.

Found an issue?

Issues can be reported in the correspondent repositories here and any other reports by messaging us on discord.

- + \ No newline at end of file diff --git a/docs/learn/delivery-acknowledgements/index.html b/docs/learn/delivery-acknowledgements/index.html index cdfe22423..adf9b11bd 100644 --- a/docs/learn/delivery-acknowledgements/index.html +++ b/docs/learn/delivery-acknowledgements/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

Overview

When a client signs a message, it creates a Delivery Acknowledgement that confirms a successful service computation delivery by a node. This process ensures the immutability and integrity of the message (the client cannot change or reverse it) and also includes metadata about the commodities consumed by the node during the service execution. This metadata helps in calculating the reward that the node will receive.

info

The Narwhal and Bullshark consensus primary transaction is the order of batched Delivery Acknowledgements. Every time a node serves a request, it gathers Delivery Acknowledgements that, upon submission, reward the node at the end of an epoch (which is approximately 24 hours).

To claim the reward and other fees, nodes can add received Delivery Acknowledgements to a local pool and periodically submit them in batches to reach a consensus. This process also ensures consistent updates to the client's balance in stable coin.

The amounts deducted from all clients during an epoch, move to a payout pool which is distributed fairly to node account owners based on the work performed in the epoch.

For a more in-depth dive into Delivery Acknowledgements-related topics, it's advised to read the whitepaper. Also, a holistic version of the Network is available on our documentation site.

SNARKs (Non-interactive zero-knowledge proofs)

SNARKs is an acronym that stands for Succinct Non-interactive Argument of Knowledge. A SNARK is a cryptographic proof that allows one party to prove to another that it knows a secret without revealing the secret itself.

It's a product of encryption that makes direct communication between a prover and verifier needless, effectively removing any intermediaries.

note

A SNARK is a cryptographic proof that is utilized as an optimization for Delivery Acknowledgements. It's not a requirement to understand Delivery Acknowledgements. However, an important implementation detail for performance and message handling.

The periodic submission of Delivery Acknowledgements, allows us to leverage SNARK proofs recursively, aggregating many of these Delivery Acknowledgements. By batching, we lower the expenses associated with networking and computing power which would've been much higher if verified individually.

Optimization

The Fleek Network uses Narwhal as a DAG-mempool for transaction ordering (as total ordering or linear order) and Bullshark as the consensus engine.

tip

Read The Consensus Algorithm section, to learn more about Narwhal and Bullshark. Alternatively, check the whitepaper for more detailed information.

Total ordering is performed by a committee-based approach. The committee is formed from a subset of any valid staked node at the end of every epoch (about 24 hours). Integrity is met due to the node rotation that occurs at each period, reducing risks associated with nodes being compromised and affecting the committee's purity.

Since the number of Delivery Acknowledgements can be considerably high, only a few of these are handled by consensus. It rolls up the head and tail from the batch list and leverages Zero-Knowledge proofs recursively to validate them. By rolling up a smaller footprint, it optimizes data and network performance without compromising the security of the protocol.

In summary, a subset of Nodes forms a new committee at each Epoch, that does the transaction ordering of the workload computed and submitted by the remaining nodes performantly and securely.

Node vs. Client Process Flow

The process by which Delivery Acknowledgement works is that a node starts by sending an encrypted request to a client and once received, a signed Delivery Acknowledgement attests to it.

Upon Delivery Acknowledgment, the node should transmit an encryption key.

If a node fails to send a key after the client signs the Delivery Acknowledgement, the committee safeguards the user request interest by sending a valid rebuilt key back.

As a consequence of malicious behavior, the committee has the node slashed by the protocol-slashing mechanism penalizing dishonest participation while allowing the request flow to run smoothly for the betterment of the end-user experience.

note

The process ensures that nodes get paid for work performed and clients get the requests fulfilled. It helps achieve decentralization and trustworthiness as the process applies to any sort of client-server communication, such as Gateways. Also, considering the impact this might have on the network, a node encryption key response has a small impact performance of 300 milliseconds (0.3ms) of latency.

Content and Streaming Verifiability

A Delivery Acknowledgement message signing is deterministic, completely dependent on its inputs and the sequence of the instructions fulfilled which are strictly validated.

Thus, the entire network operates based on content addressing based on Blake3 hashing for efficient content identification and streaming verifiability. This ensures that the hash being requested is the one being served.

Learn more about it in the Content Addressing section.

Delivery Acknowledgement Customization

A Service can have a custom configuration to specify how Delivery Acknowledgements should behave or work. Patterns and conventions should be expected to emerge from the Service builder community and best practices.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- + \ No newline at end of file diff --git a/docs/learn/developers/index.html b/docs/learn/developers/index.html index fa2241259..039297431 100644 --- a/docs/learn/developers/index.html +++ b/docs/learn/developers/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

Developers

info

This documentation is currently placeholder as the team prepares for an early testnet release around the month of August, where full documentation for node runners and services will release.

Developer in Fleek Network - Current State

As a developer, you will be able to build or use services running on Fleek Network's decentralized edge infrastructure.

This will be possible after our initial Testnet rollouts in August, and after we publish our Service Development Kit (SDK) for service development. Currently, we are finalizing the core developments of the protocol and setting the foundations for the testnet release.

How can you Start Getting Involved Today?

  1. Get familiar with the project with our Whitepaper.
  2. Review our open-source codebase on Github.
  3. Learn about services in Fleek Network.
  4. Want to run a node? Join our community in Discord to get updates when possible.
  5. Or sign up to the newsletter on our website for updates.
- + \ No newline at end of file diff --git a/docs/learn/introduction/index.html b/docs/learn/introduction/index.html index 20c896136..53f9bdc7d 100644 --- a/docs/learn/introduction/index.html +++ b/docs/learn/introduction/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

Introduction

The Core of Fleek Network offers a foundational layer to enable developers to build and deploy Edge Services efficiently. It abstracts away the development complexities of consensus, cryptography, storage and peer-to-peer networking, etc, to simplify things conceptually. It frees developers and teams to focus on what matters the most to reach business goals.

In contrast, end users have access to network services on the edge, that provide different kinds of computation and data processing features.

We'll take a brief look into why does it exist, how does it work, and learn about services, amongst other topics.

tip

For a deep dive into Fleek Network, check the whitepaper section.

Why does it exist?

Many Web3 products rely on the conventional models of centralized cloud infrastructure, due to the lack of corresponding alternatives.

Some of the most popular Web3 products rely on content delivery and edge computing provided by the monopolized cloud market. Unlike a decentralized system, the opposite is more vulnerable to attacks, as computation and data can be easily manipulated to suit the monopoly's business goals.

Meanwhile, blockchain technology has paved the way for a new era of decentralized cloud computing and data storage, offering a sustainable alternative to traditional centralized architectures.

The Fleek Network provides the alternative, paving the way to a decentralized edge computing future that is secure, transparent and accessible to everybody in the world.

Motivation

The Fleek Network team was motivated to create a decentralized Edge Platform due to the current infrastructure trends, user concerns and demands. The modern web is shifting from the cloud to the edge, which is a reflection of the internet's growing user base and the need for low latency for users worldwide.

This development is a crucial and necessary step towards significantly enhancing the reliability, efficiency, and decentralization of Web3 applications and platforms, such as the next iteration of the Fleek platform.

How does it work?

When a client requests a service, the protocol determines the best route to the nodes where the service replicas and workload are allocated.

Once the computation is successful, the data streaming routes to the client. On-client request fulfillment, a proof of delivery is generated containing cryptographically secured metadata about the original request, any parts involved and the resources consumed.

The Delivery Acknowledgements are stored locally in the participating node memory pools, rolled up to the protocol consensus consistently throughout the epoch (about 24h). This agreement is formed by a random committee of any healthy Nodes that use the information provided to reward the Nodes fairly.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- + \ No newline at end of file diff --git a/docs/learn/services/index.html b/docs/learn/services/index.html index 7fb8ee41f..47ff92368 100644 --- a/docs/learn/services/index.html +++ b/docs/learn/services/index.html @@ -13,7 +13,7 @@ - + @@ -22,7 +22,7 @@

Overview

A Fleek Network Service is a modular application that runs on nodes and allows users to perform well-defined functions or some specific tasks. Services are scalable and performant due to edge computation and networking features provided by the core principles of the network.

As a permissionless system, services are built by developers who are free to build and deploy them to run on the decentralized edge platform. Applications can be of any kind but are generally described as web services. These are cryptographically secure and run within a fair economically incentivized model. The services are hosted in user-managed resources and are highly available to customers and end-users in exchange for rewards.

A Service Development Toolkit (SDK) facilitates access to core APIs and resources for developers. Services run in a sandboxed environment (unable to access the host's processes, hardware and kernel directly) and are restricted to specific features such as cryptography, networking and storage. The service implementation source code is fully managed by the author(s), owner(s) and development team(s).

info

At an early stage, core services are statically linked to the node's binary process (Lightning). In the future, the Fleek Network protocol aims to load services dynamically.

Service Development Toolkit (SDK)

The Service Development Toolkit (SDK) abstracts the core protocol features, including the communication with the middleware which is done through an Inter-Process Communication (IPC) system. Any system-level programming language, such as C/C++, Go or Rust can establish a communication channel with the middleware. By using the toolkit, a Service builder accelerates the development process e.g. effectively enables nodes to generate Delivery Acknowledgements (SNARKs) that prove work completion which is used to determine rewards, along with other cryptographic commitments.

info

As discussed in The Network section, Delivery Acknowledgements include metadata about the commodities consumed by a node while executing or running a service. It also contains cryptographically secured metadata that are tamper-proof and used to determine the reward attributed to a node.

A commitment ensures clients receive the correct work output that is being requested, such as content, a computed response, etc. In addition to preventing malicious services from coercing a node into making false commitments. Likewise, the commitments generated by a node determine the bandwidth and computation served, amongst other commodities.

Handshake

The Handshake component is the entry point to external communications with a node. It enables clients to establish an encrypted communication session with the node and interact with services over a secure transport layer (TLS+TCP or QUIC). On establishing a client and node connection, public keys are exchanged and a lane is negotiated for the session. A Handshake is required for a client to access and interact with a service.

Service geographic distribution

The network takes care of infrastructure coverage, scalability, and incentivizing edge nodes to run services. It employs a range of algorithms to assign edge nodes in each geographic region to handle the work for each service, guaranteeing the most efficient route. Additionally, when a service experiences a surge in demand and scales up, any unused services are automatically downscaled. By dynamically allocating resources, it eliminates unnecessary resource usage and allows efficient garbage collection. All of this is achieved while maintaining optimal levels of trust, security, infrastructure coverage, and performance guarantees.

Resources as commodities

The hardware resources used by a service are packaged and measured as commodities. Includes things like bandwidth and CPU, along with their respective commodities such as GB(s) and CPU cycles. Delivery Acknowledgements detail the commodities used by a node during service execution. The data is used to reward the node based on the current pricing of those commodities set by the network governance.

Use-cases

Building on Fleek Network's Decentralized Edge Infrastructure unlocks various opportunities and advantages for Service builders, that empower them to implement most of the following concepts.

Traditional Services

Edge Functions

Edge computing comes in many flavors, and Fleek Network can support many serverless or edge computing functions. For example, low-cost computation for JavaScript functions, Lambda, runtimes or Cloudflare Workers-like computing. Can also perform deterministic computation, consensus-based computation, ZK-computation, and EVM computation. The network is non-opinionated and enables developers to refine their computing service in great detail.

SSR/ISR

One applied edge compute use-case that can be built is Server-side Rendering (SSR) or Incremental Static Regeneration Service (ISR) on top of a container/serverless engine. Given the granularity of content verification within the core's hashing, streaming of particular pieces of data can be optimized and parallelized across multiple nodes. Such as chunking pages of static sites and regenerating only where needed.

Hosting

Web3 apps are generally composed of a backend and a frontend stack. The backends are considerably decentralized but often have the client-side facing interface hosted into a central cloud provider. Given the desirability of content delivery acceleration services for a snappy user experience, that end customers demand. The Fleek Network takes a big step forward on this topic, as services can leverage the block store and content addressability (IPFS) for an application host provider.

As we have today with user stories like S3 or Netlify, a service can use Fleek Network as a storage layer for static sites. Similarly, a CDN or SSR can complement static site hosting by accelerating and dynamically computing user needs. In consequence, the reward mechanism would distribute rewards fairly to every actor in the computation and fulfillment of paying customers for these requests, e.g. service builder, node operator, etc.

CDN

A decentralized CDN is a big missing piece in the Web3 infra stack. Every protocol, middleware, service, and app can benefit from content acceleration. Today most projects use popular CDNs in front of their stacks for optimization and performance improvement e.g. availability and latency. A decentralized CDN built on Fleek Network can gain great notoriety in the blockchain and Web3 development communities, due to its benefits and principles, without sacrificing performance and cost of integration.

The dCDN service can cache content based on the user request and popularity, and put it in the speediest location based on the network reputation system, computation and routing response timings. Conceptually similar to a traditional CDN, but abstracting the geo-location that is usually specified by user-selected zones.

tip

While the network does not possess a specific concept of geography, it gains an implicit understanding of geographical proximity through the data it collects on latency and hop counts between nodes, which is a part of the reputation system.

Learn more about how Fleek Network behaves by reading the whitepaper.

Container Orchestration

A decentralized orchestration service built on a content-addressable edge network can bring benefits in performance and delivery. A service could utilize the native content-addressing and Blake3 hashing and verified data streaming to partition large container image files and serve them at scale in a multi-region environment.

Fleek Network can act as a p2p CDN, serving container chunks in a parallelized, verified, and performant way–without sacrificing decentralization. Similar to concepts that can be found in Docker image hosting, Docker Swarm clustering, etc.

CRDT Databases

Database services in a decentralized edge platform with a content addressable core can benefit from the network's data deduplication and integrity characteristics.

Particularly a CRDT database service could be built to converge data from multiple edge locations replicas. Given all data is content-addressed, unique content hashes allow for easy differentiation and verification as the data is replicated.

Web3 Services

Blockchain Snapshots

Interchain synchronization of a full-node history is CPU-intensive. Can take hours, days or weeks depending on blockchain technology. On Fleek Network's core, the internal blockchain is based on content addressability which stores snapshots of the state HEAD. It utilizes decentralized content acceleration for node entire-state synchronization for higher speed.

A service can be built that does a similar process for any chain. By automating snapshot storage timely and in-synchronization to the chain HEAD. It can deliver an entire state to a node rapidly.

Decentralized IPFS Pinning

All content on the Fleek Network is content addressed and referred to by the CID, which mapping of the CID to the origin is stored in perpetuity. Coupled with the built-in file system interlinked to decentralized storage protocols such as Arweave and Filecoin, an IPFS pinning service can be built. A pinning service for IPFS that provides the user experience we are accustomed to, but using decentralized infrastructure, which today's IPFS pinning services fail to offer.

Worth mentioning that an IPFS pinning service as such, would be cheaper and provide better availability, performance and security guarantees. For example, as the network stores the CID-to-origin mapping in perpetuity, even if an IPFS file is lost it can be easily retrieved if there's at least one origin.

VM's (EVM, zkVM's, etc.)

A service that deploys a virtual machine, such as many zk-VMs, or the EVM can be built and deployed to Fleek Network. It can provide compute in the zk-VM and provide the zk-SNARK from the node, proving the correctness of the response. In addition, the network routing can ensure that the zk-VM computation is happening in the closest proximity to the client based on latency and other network factors.

Ephemeral Rollups

The Fleek Network can be utilized as a short-term service platform for a variety of applications or side-chaining that compute state and roll it up to a smart contract. An NFT minting or game event that occurs during a short period, can roll up state to a smart contract after the event time elapses.

To help users mitigate gas costs and feeds while providing instant finality throughout an event. Consequently, roll-ups would run on a decentralized network, that is fault-resistant and highly performant.

Proof Generation

As a result of the rise of Zero-Knowledge proofs (SNARKs, STARKs) for performance and cost-efficient proof generation, there are benefits for computing them closer to end-users and in a decentralized manner which Fleek Network Edge Network entails.

For example, a hypothetical Groth16 service can read parameters from configuration files in a file system and generate a proof based on public user custom parameters.

Alternative Sequencers

As encountered by most sequencers that post transactions to Layer-1 settlement contracts (which are mostly done over centralized processes), Layer-2 networks bypass these by posting them manually. This causes long finalization times and a reduction in block speeds on Layer-1, which is contrary to what users are familiar with and find ordinary on Layer-2.

In Fleek Network, a service builder can offer an alternative to a Layer-2 sequencer, that is decentralized and more reliable by batching and posting to Layer-1 settlement contracts. With equivalent Layer-2 settlement times.

An additional benefit can be enabling end-user gasless transaction submissions by disregarding a Layer-2 gas token to submit transactions to Layer-1.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- + \ No newline at end of file diff --git a/docs/learn/the-network/index.html b/docs/learn/the-network/index.html index 9005259ff..c90d53472 100644 --- a/docs/learn/the-network/index.html +++ b/docs/learn/the-network/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

Protocol

The Fleek Network is designed to deliver computation cheaper, faster and more efficiently than existing cloud providers by allowing anyone to offer computer resources for rewards. Including, secured information about who requested it on the network.

The Fleek Network is a proof-of-stake protocol, that takes advantage of Ethereum for staking, payments, governance and other economic features.

This is achieved by a combination of SNARKs (Succinct Non-interactive Argument of Knowledge), Narwhal and Bullshark consensus, including other cryptographic and economic guarantees to achieve a trustless decentralized and long-term sustainable environment.

It's important to keep track of these components to ensure that the system is running fairly. The protocol holds the state for the following:

  • Token Balances
  • Staking details
  • The Node Reputation
  • Data on how much work a Node has performed in a given epoch

As a decentralized network, the state of these is replicated across all of the distributed nodes in the network by forming a blockchain, in which consensus on transactions transmutes to the final immutable state.

The Consensus algorithm

Narwhal and Bullshark, are high-performant mempool and consensus engines by Mysten Labs. The Fleek Network uses Narwhal as a DAG-mempool for transaction ordering (as total ordering or linear order) and Bullshark as the consensus engine.

note

The primary transactions being ordered by the consensus algorithm is the batch of Delivery Acknowledgements stored in a local list of transactions before commitment to the blockchain (memory pool).

The Narwhal algorithm is based on the separation between the dissemination and transaction ordering to achieve high throughput in the blockchain system. The protocol achieves reliable dissemination and storage of causal histories of transactions. Narwhal tolerates an asynchronous network and maintains high performance despite failures.

Bullshark is a zero-message overhead consensus algorithm that handles transactions that require total ordering (linear ordering), and synchronization of the transactions between nodes and the global network state.

To put it simply, where Narwhal ensures data is submitted to consensus, Bullshark sorts out the order of the data.

Total ordering

Total ordering is performed by a committee-based approach. The committee is formed from a subset of any valid staked Node at the end of every epoch (about 24 hours). The integrity is met due to the Node rotation that occurs at each period, reducing risks associated with Nodes being compromised and affecting the committee purity. In summary, a subset of Nodes forms a new committee at each Epoch, that does the transaction ordering of the workload computed and submitted by the remaining Nodes.

The Edge Network

Edge computing is about processing data at the closest point of interaction, while cloud computing is about processing data in a data center.

Instead of resolving requests in the cloud, where roundtrip times are noticeable due to latency, the processing of requests is done at your closest convenience, which means getting you a quicker response and a better user experience.

Fleek Network's Edge computing is computing that's done at the speediest location to the user. Provided by Network Nodes that are favorably dispersed and operated by a diverse community.

The community members host and operate the Network Nodes, which form the Edge Platform, and contribute to an autonomous and decentralized network of web services.

Some of the resources provided by the network nodes are:

  • Disk Storage
  • Processing power (CPU Units)
  • Network bandwidth

The Edge Network aims to provide computational resources where a user most needs them.

Incentives and rewards

Fleek Network issues FLK–an ERC-20 fungible token created using the Ethereum Blockchain–which Node operators must stake to perform work on the network. On the other hand, developers and clients use stablecoins in a fair exchange for the commodities and resources consumed on the network.

warning

A Node Operator has to stake FLK to have a node participate in the Network. A node without FLK staken is referred to as a stakeless node. A stakeless node cannot contribute or participate in the network, as there would be no way to punish them for malicious behavior. Thus, all fully operational nodes in the network, without exception, have a stake.

A node is a process that runs on a machine that provides resources to the network. The resources are packaged as commodities. For instance:

  • Availability / Up-time
  • Bandwidth
  • CPU

These commodities are exchanged fairly and pricing is decided by the ecosystem and network governance. To ensure a stable and predictable income stream, the rewards awarded to Node Operators are predetermined at a stable rate (USD).

Service providers are rewarded in many ways, for instance, by fulfilling cache requests per bandwidth, and sharing cached data with other peers–as an incentive for a shared economy, therefore the more bandwidth served, the more tokens received.

When an epoch ends, which is about 24 hours, the rewards from all submitted Delivery Acknowledgements are distributed to the edge nodes.

Delivery Acknowledgements (SNARKs)

A Delivery Acknowledgement is a signed message by a client attesting that a node has successfully delivered a task to the client. These acknowledgements are instantly finalized locally and irreversible by the client.

The Delivery Acknowledgements are cryptographically secured and tamper-proof, meaning that the transaction contains irrefutable details about all parts involved in the transaction.

A Delivery Acknowledgement includes metadata about the commodities consumed by a node while executing or running a service. Also contains metadata that is used to determine the reward attributed to a Node.

tip

A Node provides the computational resources to the network and keeps track of doings in a list of Delivery Acknowledgements, on which the rewards' mechanism is based at the end of each Epoch (about 24 hours).

Finally, Delivery Acknowledgements are gathered and batched by nodes before being submitted to the core protocol and committee as described in the consensus section.

To learn more, visit the section Delivery Acknowledgements.

Reputation system

The Fleek Network has a reputation system where nodes rate each other. The ratings are collected timely and an aggregation algorithm calculates the overall rate for each node at the end of every epoch.

Noteworthy, any reputation system that depends on players attributing rates to each other can be exploited. For prevention, a custom version of the EigenTrust algorithm is used to reduce dishonest and incorrect measurements.

Some other procedures where a node is rated are on the interactions between nodes while servicing. Meaning that a node earns a rate per service interaction.

The information is replicated across the network securely and cannot be tampered with and is a valuable and reliable source of knowledge for optimization tasks.

A few optimization tasks include:

  • Optimizing the network flow
  • Assigning services to nodes
  • Determining proximity

The reputation system is used to determine the service routing and work allocation.

Actors and their roles

The Fleek Network is a system where actors play important roles, namely:

  • Client
  • Developer
  • End-user
  • Node Operator

Each of these users has a huge role in contributing and participating in the network. They make it possible and lively by requesting resources, through usage, payments or by simply being a plain member of the community.

Client

The Client is a user that consumes data from the network, for instance:

  • A developer interested in using the CDN in an application
  • A media publisher wanting to accelerate access to media assets
  • A system administrator looking for instructions to troubleshoot the client library
  • A Solutions Architect looking for a quick overview of an alternative service for a centralized provider
  • Instructions to install and use the client library
  • A Web developer looking to decentralize an API service

A client is a paying customer for the commodities and resources consumed on the network, e.g. a CDN service customer who pays for bandwidth use, etc.

This type of user can:

  • Top up the account to have enough credit to exchange for service
  • Check the balance
  • Check the cost(s) of the service(s)
  • Many others (relative to the service offering that might be of a third-party provider)

Developer

The Developer is a knowledgeable user that enables the business logic and end-to-end experience to the end-user through applications or services. Take, for example:

  • Protocol development contributor
  • Service creator
  • Client library user
  • Contributions to the client libraries and tools
  • The library method and parameters references
  • Versions and features support

A developer is often described as a builder who enables the end-to-end experience in the Fleek Network. A builder that can work at the Service provider level, protocol development, core contributor and, amongst others, at a higher level, such as providing support and integrations of services in applications or third-party systems.

End-user

An End-user is someone to whom the data or computation output is ultimately delivered, amongst others:

  • Static assets, such as images rendered on a website
  • Image optimization output for a very particular size request
  • Server-side rendering
  • Data response provided via HTTP Gateway or RPC

The service outputs are for the end-user, but payment for the service is the responsibility of the client that manages the application or service the end-user interacts with.

Node operator

A Node Operator is a kind of system administrator who builds, configures, installs or maintains a node(s) in a server. To mention a few use cases:

  • Builds the node binary from source-code
  • Updates the source-code repository, which node is built on
  • Runs the installation wizard to setup a node
  • Installs the node manually
  • Configures the node
  • Secures the server

The Fleek Network works as a distributed system of nodes where each node operates and contributes to the system’s overall health and functionality with computational resources by network operation demand.

Nodes are set up to run on servers by operators. Operators are system administrators who build, configure, install and maintain the nodes in a server. Generally, a node is installed and runs on a computer or virtual private server (VPS) lent by a cloud service provider.

info

A server is a computer machine where a Node runs and can be located anywhere in the world.

The Node Operator is a critical system actor that is incentivized to manage one or many nodes. Ultimately making the Fleek Network what is about, a decentralized orchestration layer and infrastructure.

Any individual who's interested in learning can become a Node Operator by reading the documentation, or content made available by the network core team and community.

Multi-Service Support

The Fleek Network provides a base layer as the foundation of many Services. Simplicity at its core, it handles Proof-of-delivery and other client-node exchanges, such as user balance and rewards.

It's designed to allow anyone to create and deploy a custom service to the network, without the need for anyone's permission. The protocol slashing mechanisms help deter malicious behavior and penalize dishonest participants while allowing the service, a modular unit, to operate at maximum availability and performance.

Within a diverse ecosystem where node operators are free to choose which services to run, e.g. an operator might find popular services more appealing economically. Thus, the network is nonhomogenous, made up of different types of resource servers, requirements and services.

Abstraction and build blocks

Abstraction is conceptually useful in decentralized and distributed web service development because of how incredibly complex it can become and the speed at which developers have to react to the outside world. The core team put most of the complexity into well-defined building blocks.

The building blocks provide you with enough level of detail that the modern developer experience demands but with cryptographic, economical and security assurances for confident service development, amongst others.

The Fleek Network implementation is open source and freely available for consultation and contribution when more detail or refinement is required by the community and other observers.

Modular architecture

Lightning is the repository name containing the Fleek multi-service Edge Network implementation.

The project aims to provide a higher focus on engineering productivity from the get-go, an improvement over the original Ursa implementation, which was exclusively focused on CDN, one of many services Lightning offers support.

info

Lightning is the open-source Rust implementation of Fleek Network. The repository contains the source code for the implementation of Fleek Network at https://github.com/fleek-network/lightning.

Some of the main differences from Ursa’s implementation are:

  • The dynamic service loading approach
  • Decoupling of the network's core from the service implementation
  • Higher-level architecture that makes it easier to maintain and within reach of external contributors.

Lightning’s development approach is more open, which allows the community to build services and also helps the core team work on other features or services in parallel.

Repository

The repository contains the source code for the implementation of the Fleek Network and is located at https://github.com/fleek-network/lightning, a private repository that will go public after the whitepaper announcement and roadmap.

Directory structure

There are three top-level directories, namely lib, core and services.

Lib - These are open-source libraries created to help tackle the project features and packaged with a friendly license in the Rust ecosystem (MIT, Apache).

Core - The primary protocol implementation, where node crate contains the essential feature set or base functionality. Includes the interfaces crate, where the top-down specification of the project is located.

Services - A Service is a business logic provider built with the SDK (Service Development Kit). A service is decoupled from the core of the network and loaded dynamically [1] during the runtime using FFI (foreigner function interface).

draco
├── lib
│ ├── affair
│ ├── atomo
│ └── blake3-tree
├── core
│ ├── node
│ ├── interfaces
│ ├── application
│ ├── blockstore
│ ├── consensus
│ ├── handshake
│ ├── identity
│ ├── origin-arweave
│ ├── origin-filecoin
│ ├── origin-ipfs
│ ├── pod
│ ├── reputation
│ ├── rpc
│ └── sdk
└── services
└── cdn

Interfaces

The design pattern adopted for this software is highly inspired by the Object-Oriented model described by Alan Kay, which may be a bit different from OOP which grew to fame due to Java.

In a nutshell, this is similar to the same idea, and we represent different units of computation and process as objects that communicate with each other by message passing.

Identity on the Fleek Network

The identity on the Fleek Network is issued and controlled by individuals, which means that there aren't any central entities that issue, manage or control it for you. An identity is created without permission from anyone, and stored securely and privately.

caution

Security is achieved by issuing users private cryptographic keys. Only the holder of the private key has access to sensitive information, such as an identity, which relates to reputation, rewards, etc. The security of the private key is the responsibility of the user. Unfortunately, Fleek Network is unable to help you regain access to your private key if you've lost or failed to secure it. The private keys are your responsibility.

The types of Identities found in the Fleek Network are used for:

  • Node (for BFT DAG consensus)
  • Node Network (for fast communication signatures)
  • Account Owner (any actor holding a balance on Fleek Network)

The Public-key cryptography used in the network identities are the following curves:

  • BLS12-381 is a pairing-friendly elliptic curve construction from the BLS family
  • Ed25519 is the EdDSA signature scheme using SHA-512 (SHA-2) and Curve25519
  • Secp256k1 is the Elliptic Curve Digital Signature Algorithm (ECDSA) used by Bitcoin and Ethereum

The identities are associated with the elliptic curves as follows:

  • A Node key (ConsensusPublicKey) is BLS12-381 which facilitates the consensus algorithm or persistence of state, resilience and fault tolerance. Has multi-signature support, the ability to aggregate many signatures into one used for consensus committee when signing certificates
  • A Node Networking key (NodePublicKey) is Ed25519 used for the speed and performance of the network communications
  • Account Owner keys are based on secp256k1, which corresponds to an Ethereum Address

Transactions can be signed by the Account Owner—an Ethereum key (secp256k1) owned by the user on an external wallet and initially required to bridge assets from L2—and Node identities

Node Networking with Narwhal utilizes the Node Network key (Ed25519) is much more efficient when dealing with a single signature instead of aggregated signatures.

Content addressability and verifiability

The way content is distributed, handled and stored defines how trustworthy's a protocol. Some of the primitives to achieve it has roots in linked data, immutability, verification and the semantic web.

On Fleek Network, you either hint about data packed into a format called a Content Archive (CAR) or an existing CID of a CAR file—which hash addresses are unique and universally addressable. The network never stores data, only a cache layer to existing storage as origins. For example, on HTTP PUT we're just telling the network that there's some origin it should care about and cache.

Some of the principles that help us provide guarantees to end-users require a high ability for content verification, as a consequence, the immutability of files is critical to the system.

info

To emphasize, immutability means the state of not changing, or being unable to change!

Immutability

Fleek Network deals with files in a manner where the content determines the address in which the user of the system can locate and verify it unquestionably. This is possible due to cryptography, in which the same data always produces the same hash deterministically.

  • A file whose content determines the hash, but is also impossible to invert it
  • Unable to reconstruct data from a hash
  • It's unique, not two files produce the same file or content
  • Any change in the content should always generate a completely different hash

In retrospect, what we have on the web today are files accessible via a URL address and the problem with this approach is that the content is not intrinsically tight to the address e.g. the content can change and the URL remains the same. That is the problematic way we access files on the web today, which we call "Location addressing", and the way we solve it for the web of tomorrow is called "Content addressing".

Content addressing

Content addressing is where we use a hash to access the content, and it allows us to verify that the content we received is the content we asked for. For this, we use a special hash called CID (Content Identifier), a cryptography hash function that maps input of arbitrary size to the output of a fixed size—the content identifiers are short, regardless of the size of the content, and the address does not tell us where the content is stored.

The entire network operates based on content addressing based on Blake3 hashing for efficient content identification and streaming verifiability.

info

The CID is a sort of string-like binary that is human-friendlier in comparison to the underlying binary, which is way longer.

info

Caching and deduplication are possible due to the immutability of content e.g. if content changes, let's say that an image has some new detail, the files share many of the same bytes. The amount of data we have to transfer to fetch is minimum, we'd only pull the difference. In today's web, we'd have to transfer both files in full, which is a worse path on resource allocation and performance.

Hash functions

The hash function for creating CIDs uses sha-256, but there is support for other hashing algorithms, such as sha1 (used by Git), sha2-256, sha3-255, blake2b-160, blake3, etc. Some older algorithms are proven not to be collision-free, so if algorithms can break, we have to switch the hash algorithm we use in the future! The problem with this switching of algorithms is the need to find a future-proof way of identifying the hash functions used to generate the hash, as well as the hash name.

Multihash is a protocol that comes into play to provide us with valuable metadata for future-proofing. In an attempt to summarize it, it's the composition of a hash placed at the end, a prefix, as a number to identify the algorithm used, and a number, to identify the hash name. Therefore, we'd start raising some questions. Without it, how would we get the data back without the ability to identify how it was encoded? Some users could use cbor, protocol buffers, json, etc, and there might be plenty of good reasons why for those choices. Maybe it's a compact binary encoding that is very efficient for storage, easy to work with, etc.

What's important is that it is the user's choice and why IPLD becomes useful for Fleek Network's use cases. A system for understanding and working with data that is made of a data model, codecs, tools for linking, and then a handful of other powerful features that help us develop a decentralized application.

Interplanetary linked data (IPLD)

Interplanetary linked data (IPLD) provides us with all the metadata prefixes to soothe the system needs, and provides us with the data model of the content-addressable web, as discussed earlier. IPLD is a set of conventions for creating decentralized data structures that are universally addressable and linkable.

A Distributed Hash Table (DHT) enables the network to store an IPLD or flexible mapping from any "immutable data pointer", such as a CID to its corresponding Blake3 hash. As mentioned in the Content Addressing section, the network operates over Blake3 hashing for efficient content handling.

info

These addressable and linkable data structures will allow us to do for data what URLs and links did for HTML web pages (Quote from IPLD).

Content Addressable aRchive (CAR)

The core of Fleek Network understands the IPLD CAR Content Addressable aRchive, which unpacks and traverses to cache individual files. The archive's content is hashed as Blake3, which Fleek Network uses to address all data coming and going into the network, regardless of their origin.

warning

Despite handling IPLD CAR files, it serves raw archive content to the client. In other words, if a request for a complete CAR came through a gateway, the gateway (as a client) would have to build the file from the streamed data before sending it as a response to the end user.

info

The ordering of blocks in a CAR is random, e.g. two different CAR files storing the same content. This causes the need to traverse the archive (DAG-PB/UnixFS) to store the CAR blocks as individual content.

HTTP PUT Request Origin

An Origin is a location where content originates from. In the context of Fleek Network, the origin has to be supported for the data retrieval to function, some examples of what will be supported are Arweave, Filecoin and IPFS. For instance, the first supported storage is IPFS and a user of Fleek Network should have the data pinned for IPFS somewhere to have it cached by the Fleek Network CDN service on an HTTP PUT request.

info

A Client-side library can provide helpers to upload to some origin, such as IPFS and call the HTTP PUT for the origin.

Binary process

The Fleek Network binary process is the program that's been compiled down to machine code that the computer's processor can understand and execute. The project source code repository from which the binary is compiled is called Lightning. Most node operators set up the nodes by running the install wizard, others do it manually. When a node operator runs a node, it means that the binary process is launched in the node operator's computer. It runs as a separate instance in memory, with its own set of resources and permissions. The Fleek Network binary is an essential component that contributes to the network formation, distribution and decentralization. It runs on a supported Linux operating system, enabling users to run a wide variety of computing services and perform complex tasks.

Ports

Amongst other resources, ports play the role of managing and organizing network traffic. The ports initiate and terminate network connections crucial for the node to operate in the Fleek Network. The operating system should have the ports enabled and open for the node to run successfully.

We reserve the following top level ranges:

  • TCP: 4200-4299
  • UDP: 4300-4399

Each service in the node has 10 ports reserved within each range.

note

For node operators, they can either choose to individually open up the assigned ports, or just open the top level ranges, at their discretion. But we reserve the full ranges for future use, so they should avoid any port conflicts with other software running on the node.

tip

For the Node Operators who opt to run the get.fleek.network assisted installer, the ports are verified if in use.

The Node process requires the following ports:

Connection Pool (4x00-4x09)

  • Netkit QUIC: 4300 (UDP)

Consensus (4x10-4x19)

  • Mempool: 4210 (TCP)
  • Primary: 4310 (UDP)
  • Worker: 4311 (UDP)

Handshake (4x20-4x29)

  • HTTP: 4220 (TCP)
  • TCP: 4221 (TCP)
  • WebRTC: 4320 (UDP)
  • WebTransport: 4321 (UDP)

RPC (4x30-4x39)

  • HTTP: 4230 (TCP)
  • WebSocket / WebTransport?

DHT (4x40-4x49)

  • UDP: 4340 (UDP)

Broadcast

  • Uses connection pool

Blockstore Server

  • Uses connection pool
required

The ports should be freed before launching the node process. Any blockers or firewalls should be configured to enable the ports.

JSON-RPC Interface

A JSON-RPC (JavaScript Object Notation Remote Procedure Call) is a protocol that enables communication between client and server applications. The Fleek Network JSON-RPC API enables JSON-RPC interaction with Fleek Network Node.

Fleek Network JSON-RPC API reference documentation is available at https://fleek-network.github.io/lightning/api-documentation.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- + \ No newline at end of file diff --git a/docs/learn/token-and-economics/index.html b/docs/learn/token-and-economics/index.html index c4920952e..694b76bd1 100644 --- a/docs/learn/token-and-economics/index.html +++ b/docs/learn/token-and-economics/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

Overview

The Fleek Network runs on an incentivized economy model that rewards node operators who provide resources that form the network. Currently, the economic model is to be considered a first draft, subject to change based on the data and feedback collected throughout all phases of testnet. The purpose of sharing a first draft is to provide clarity to prospective node operators and developers interested in participating in any pre-mainnet activities. You can find the complete breakdown of this information in this article

The Utility Token

Fleek Network has a utility token named FLK, an ERC-20 token issued on Ethereum (L1). The Fleek Network interacts with it as native to the protocol, given that the token intent is user accessibility and familiarity, making the interactions in the system as frictionless as possible. To accomplish this, the network has a Proof-of-Consensus bridge that facilitates entry and exit from Fleek Network—a Zero Knowledge Proof (ZKP) bridge that enables token retrieval.

Stable token for payments

The primary income for Account Holders is derived from a set of stable cryptocurrencies, which are easily tradable and highly liquid. For example, node operators receive rewards from stable coins (USD rate), ensuring a stable and predictable income stream. Note, that the network employs an inflationary mechanism, providing additional rewards for stakeholders via the minting of FLK tokens.

Resource Pricing

To start, Fleek Network only plans to charge for bandwidth and CPU cycles consumed. Pricing will be set at the network level, and resources will be priced and paid for in USD-denominated stablecoins. The exact pricing methodology will be determined and finalized throughout the testnet phases based on different factors. Those factors include:

  • Cost data the Foundation collects from node operators during testnet
  • The final specs of the SDK (which will determine what data the protocol can verifiably collect from nodes and reliably charge for)

Please be aware, there will be no fees paid during any of the testnet phases, the above is solely for illustrative purposes to give nodes a better understanding of the current thinking and what the process to finalize resource pricing might look like. We will work collaboratively with node operators throughout testnet to fairly determine resource pricing to ensure appropriate node incentivization while offering competitive pricing to developers.

It’s also important to note that node operators are independent of the Foundation, the network, and each other. They are responsible for managing their own economics, including any taxes payable in any jurisdiction relevant to them due to their participation in the network.


The FLK Token:

FLK is a staking token that is an integral part of the Fleek Network. Nodes running the Fleek Network client software are required to obtain and stake FLK in order to participate in the network and to have the opportunity to earn fees for providing work. Below is some high-level information on the anticipated characteristics of the FLK token:

  • Stake amount per node is set/managed at the protocol level, and consistent across all nodes
  • Work is allocated based on location (latency) and reputation (performance)
  • Resources on the network are priced and paid by users in USD denominated stablecoins
    • Pricing of resources happens at the network level.
  • Nodes only receive rewards related to work they perform, based on resources used/consumed (including FLK rewards)
  • FLK rewards are paid out per epoch (~24 hours). The FLK reward pool for each epoch is split proportionally between nodes who performed work during that epoch, calculated by the amount of USD revenue each node earned compared to the total revenue earned during that epoch.
  • 20% of the total FLK token supply is set aside for staking/rewards. The actual rate of rewards/inflation will be algorithmically controlled and updated based on network usage and other factors such as the market price of FLK.

DISCLAIMER: All information in this post about the FLK token and other elements of the Fleek Network is being provided solely for informational purposes and does not constitute an offer to sell FLK tokens, or a request for such offers, in any jurisdiction. There are currently no plans to sell FLK tokens. If FLK tokens do become available, you should not rely on the information in this blog post in making purchasing decisions, as the blog post was not prepared for that purpose and there will be important additional information to consider. In addition, we will likely publish further blog posts with updated information about the platform launch.

ALTHOUGH THERE ARE NO PLANS TO SELL FLK TOKENS AT THIS TIME, FOR THE AVOIDANCE OF DOUBT, IF FLK TOKENS EVER WERE TO BE SOLD, THEY WOULD BE OFFERED FOR SALE ONLY OUTSIDE OF THE UNITED STATES TO NON‐U.S. PERSONS, PURSUANT TO THE PROVISIONS OF REGULATION S OF THE U.S. SECURITIES ACT OF 1933, AS AMENDED (THE “SECURITIES ACT”). THE OFFER AND SALE OF FLK TOKENS WILL NOT BE REGISTERED UNDER THE SECURITIES ACT, AND MAY NOT BE OFFERED OR SOLD IN THE UNITED STATES ABSENT REGISTRATION OR AN APPLICABLE EXEMPTION FROM THE REGISTRATION REQUIREMENTS.

Algorithmic Economic System

The TLDR of the current implementation being discussed is that the network will handle the economic system/inflation algorithmically, using a concept we are calling NME, which stands for [N]et present value (npv) [M]arket price [E]quillibrium.

The algorithmic economic system has several goals, listed below in order of priority:

  • Provide an opportunity for receiving consistent blended earnings to node operators based on their work in most market conditions
    • “Blended” means taking into account both the USD stable coin fees that nodes are earning, and the FLK rewards they are earning (including factoring in the time-weighted average market price of FLK).
    • This means if network usage/revenue increases, FLK rewards will likely decrease, and vice versa. This also means that if the time-weighted average market price of FLK increases, nodes should reasonably expect that the amount of FLK rewards will decrease, but the value of FLK rewards received (in USD terms) will remain approximately the same.
  • Don’t overcompensate nodes, especially in times of market volatility
    • If the market price of FLK deviates from the NPV calculated in-protocol based on time-weighted average protocol-level revenue, nodes should reasonably expect that FLK rewards by number would be reduced.
  • Keep the network economy in equilibrium in most market conditions
  • Provide better incentives to node operators that are long-term aligned

The algorithm driving the above system will run autonomously in-protocol. However, we anticipate that certain parameters of the algorithm may be treated as parameters that can be adjusted/updated with a network governance proposal, as needed. We currently anticipate that the parameters that can be adjusted will be:

  • Maximum FLK inflation/reward rate
  • Resource pricing (bandwidth, compute, etc.)
  • Average cost of running a node
  • Target node margin rate
  • Stake amount (# of FLK) per node
  • Discount rate
  • Time-weighted average market price of FLK
  • Maximum stake lock time
  • Stake lock multiplier

Protocol-Owned Liquidity

In addition to the in-protocol algorithmic network economic system, the DAO/protocol will also manage 5% of the FLK token supply, which we anticipate will be set aside specifically to allow the community to take certain actions intended to provide long-term benefits to the network’s ecosystem and to help maintain the intended balance in the network economy. It will behave based on predetermined conditions and rules that are publicly auditable. The high level function would be the following:

  • Set limit asks to sell tranches of FLK tokens at different price levels in the event of a market price increase that deviates from NPV
  • Set limit buys to buy FLK tokens in the event of a price decrease where market price is lower than the current NPV

Benefits:

  • Helps keep the economic system in equilibrium by using protocol-owned FLK inventory to absorb volatility
  • Generates additional revenue for the protocol by capturing fees related to these activities
  • Provides better liquidity for node operators who might want to liquidate a portion of their FLK rewards
  • Smooths out volatility/price changes in periods of extreme market fear/greed

FLK Token Distribution

The following is an initial rough draft of the potential FLK token distribution, subject to adjustments or revisions.

Overall Distribution

OverallPercentage (%)
Community66%
Core Contributors (current and future)17%
Backers/Node operators17%
Total100%

Community Distribution

Community memberPercentage (%)
Staking and rewards20%
Ecosystem funds (Airdrop, grants, etc)20%
DAO10%
Foundation10%
Protocol Owned Liquidity5%
Pre-Mainnet Community1%
Total66%
- + \ No newline at end of file diff --git a/docs/node/analyzing-logs/index.html b/docs/node/analyzing-logs/index.html index 0eda2614e..c1f3cd182 100644 --- a/docs/node/analyzing-logs/index.html +++ b/docs/node/analyzing-logs/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

Analyzing Logs

The service logs provide a timeline of events for the Lightning service that is valuable for troubleshooting when encountering issues–when issues arise, analyzing log files is the first thing a node operator needs to do.

If you've installed the Node via the assisted installer, the logs are set up for you automatically. Otherwise, you have to follow the instructions provided in the manual installation section.

Log types

Standard out and standard error are two data streams created when we launch the Lightning process, on Lightning process activity we redirect the data streams to files as follows:

Standard output - The text output from the service process is put in /var/log/lightning/output.log

Standard error - The error messages from the service process are put in /var/log/lightning/diagnostic.log

tip

By convention, most of the log files create on Linux are found under the directory /var/log/, a standard area where system messages are logged and recorded.

Because normal output and error messages have their own channel, they can be handled independently of one another. Thus, we keep this in separate files that aggregate the output messages emitted by the Lightning process.

Watch logs

The log files can be monitored in real-time for diagnosis and troubleshooting purposes and the tail command is the most basic way for this purpose.

You can watch the node standard output (stdout) by running the command:

tail -f /var/log/lightning/output.log

Or, watch the standard error (stderr) for node diagnostics by running the command:

tail -f /var/log/lightning/diagnostic.log
tip

If you are controlling the Docker Container as a Systemd Service (Systemctl to start, stop or check the status) then the standard out (stdout) and standard error (stderr) logs are available as /var/log/lightning/*.log.

In any case, you can use the Docker command to analyze the logs. If you have stick with the default naming conventions it'd look like:

sudo docker logs -f lightning-node
Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- + \ No newline at end of file diff --git a/docs/node/configuration/index.html b/docs/node/configuration/index.html index a3361ac7e..d82fa2f69 100644 --- a/docs/node/configuration/index.html +++ b/docs/node/configuration/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/node/diagnostics/index.html b/docs/node/diagnostics/index.html index 4e79b89da..367bca569 100644 --- a/docs/node/diagnostics/index.html +++ b/docs/node/diagnostics/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/node/health-check/index.html b/docs/node/health-check/index.html index 28ecead6b..4c9b189fe 100644 --- a/docs/node/health-check/index.html +++ b/docs/node/health-check/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

TL;DR: Run the command

A script is available to do and provide a health check overview:

curl -sS https://get.fleek.network/healthcheck | bash

Overview

In network applications, a health check is a process of verifying the overall health and availability of a service. It usually involves sending a request to a specific endpoint of a service and receiving a response indicating the status. The response includes information about the status of the service, or any errors or warnings if not healthy. This helps developers, node operators, and system administrators identify and resolve issues that may affect the network, node performance and availability.

A Node operator or system administrator can communicate with the node to confirm the status at any time.

tip

We're using cURL, for the examples, thus make sure that you have it installed on your operating system.

Quick health check

Run a quick health check by sending a GET request to /health endpoint of RPC on port 4230.

curl -w "\p" localhost:4230/health

If successful, you should get the response running and staked, as follows:

running and staked

If you get an error, then it means that your node is not healthy.

JSON-RPC Health check

We'll send a request to the JSON RPC flk_ping method. Execute the following command:

$ curl -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"method": "flk_ping",
"params": [],
"id": 1
}' http://127.0.0.1:4230/rpc/v0

If the request is successful, you should get the result pong as follows:

{
"jsonrpc": "2.0",
"result": "pong",
"id": 1
}

Any other response, such as errors determine that the node is not healthy.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- + \ No newline at end of file diff --git a/docs/node/install/index.html b/docs/node/install/index.html index d12c8c53d..c02e41fb2 100644 --- a/docs/node/install/index.html +++ b/docs/node/install/index.html @@ -13,7 +13,7 @@ - + @@ -22,10 +22,10 @@

This section describes how to install the Fleek Network Lightning on supported operating systems. The installation can be made quicker by running the assisted installer or by following the manual installation if you want a bit more control.

Warning

If you'd like to participate in the alpha Testnet, you have to go through the onboarding process. Check the requirements and find the onboarding instructions to enable you to proceed and install a network node successfully.

Assisted installer

The assisted installer is a script written in Bash (Unix shell) that is available as a curl command line.

Prerequesites

  • A basic knowledge of command line interface (CLI)
  • A supported Linux server

Connect to your server

Connect to the Linux server where the Node's going to be installed via SSH by opening a shell session there.

If you have set up a public SSH key for the machine, connecting to the server should be as simple as:

ssh <USERNAME>@<REMOTE_HOST>
info

Check the cloud provider for instructions to understand how to setup an ssh connection and connect to it remotely. Some other users might have local access to a supported Linux server. To keep this guide short, we'll assume you've rented a VPS from a cloud provider.

Create a user

We recommend creating a non-root user with administrative privileges. It'll allow us to install any system requirements.

You can create a new user and add to the sudo group by running:

tip

For our example, we'll be using the name lgtn but you can pick whichever you'd like. If you already have a sudoer account, you can skip this step.

sudo adduser lgtn

After completing the adduser steps, execute the usermod to add the user to the sudo group, as follows:

sudo usermod -aG sudo lgtn

Switch to the new user by using the command:

su lgtn

Change the directory to the new user's home, as follows:

cd /home/lgtn

Run the script for a quick install

Copy and paste it to the server host terminal and execute it to launch the assisted installation process, as follows:

curl https://get.fleek.network | bash

On success, you should be greeted by the following welcome screen:

⭐️ Fleek Network Lightning CLI installer ⭐️

zeeeeee-
z$$$$$$"
d$$$$$$"
d$$$$$P
d$$$$$P
$$$$$$"
.$$$$$$"
.$$$$$$"
4$$$$$$$$$$$$$"
z$$$$$$$$$$$$$"
"""""""3$$$$$"
z$$$$P
d$$$$"
.$$$$$"
z$$$$$"
z$$$$P
d$$$$$$$$$$"
*******$$$"
.$$$"
.$$"
4$P"
z$"
zP
z"
/

★★★★★★★★★ 🌍 Website https://fleek.network
★★★★★★★★★ 📚 Documentation https://docs.fleek.network
★★★★★★★★★ 💾 Git repository https://github.com/fleek-network/lightning
★★★★★★★★★ 🤖 Discord https://discord.gg/fleekxyz
★★★★★★★★★ 🐤 Twitter https://twitter.com/fleek_net
★★★★★★★★★ 🎨 Ascii art by https://www.asciiart.eu

...

Remaining output omitted for brevity, you'll not see this text line

Follow the installation wizard to have the Fleek Network Lightning CLI and service installed on the supported server.

After creating the service file, you should reload the Systemd process, to apply the newly created service. You can do this by executing:

After creating the service, launch the service by executing the following command:

sudo systemctl start lightning.service
tip

To learn more about Systemctl commands, visit the section Use Systemctl to manage the Lightning Service

tip

Find the timeline of events for the Lightning service by checking the log files. Learn about it in the section Log Messages.

Once the installation is complete, do a health check! Check the section Health Check to learn how to do a node health checkup.

About the process

The installation process is open source and transparent. The source is available in the get.fleek.network or the origin repository here.

info

"Get Fleek Network" is an attempt to make our software more accessible. By providing scripts to automate the installation process of our software, we believe that it can help improve the onboarding experience of our users.

The installer assists the node operator by automating the Lightning CLI build from the open-source code and setting up the system service. A node operator should use the assisted installer to ease onboarding, reduce repetition,

At a high level, the installer will:

  • Install required dependencies, e.g. rust toolchain
  • Pull the source code from the origin repository
  • Build the binary, e.g. a lightning CLI (lgtn) is compiled from source code
  • Setup a Systemd service named lightning
  • Provide instructions to launch, stop the Fleek network via the Systemd lightning service
tip

Remember that if you use the assisted installer, you won't have to do the manual installation process as described in the next section. On success, the assisted installer should provide the same result as following the manual instructions.

Manual installation

The following section will walk through the dependencies and Rust installation process for Linux. If you're on Windows, we recommend to setup Windows Subsystem Linux, reading the Ubuntu tutorial or picking another supported distro. The WSL will let you use Linux applications, utilities and bash command tools you'll find in the tutorial.

tip

We're only supporting Linux operating system (server edition). Find the list of supported OS here.

Prerequisites

To follow the guide, you will need the following:

  • Familiarity with the command-line interface
  • Git

You're required to have some experience with the command-line interface and have Git installed; Also, you should be happy to troubleshoot, since versions might differ from the time of writing and reading. Most times, a simple web search provides the best answers.

If you don't have Git installed, learn more about it and the instructions by reading the Git documentation.

Create a user

We recommend creating a non-root user with administrative privileges. It'll allow us to install any system requirements.

You can create a new user and add to the sudo group by running:

tip

For our example, we'll be using the name lgtn but you can pick whichever you'd like. If you already have a sudoer account, you can skip this step.

sudo adduser lgtn

After completing the adduser steps, execute the usermod to add the user to the sudo group, as follows:

sudo usermod -aG sudo lgtn

Switch to the new user by using the command:

su lgtn

Change the directory to the new user's home, as follows:

cd /home/lgtn

Install Rust with Rustup tool

Visit the Rust website getting started guide, to find, copy and run the Rustup tool for installation and version management.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
tip

curl is an application that is generally available in most OS, if missing install it. Find more here.

Alternatively, if you have installed Rust in the past, you may want to update it 👌.

rustup update

During the installation process, if asked about preferences, select the default option!

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


default host triple: x86_64-unknown-linux-gnu
default toolchain: stable (default)
profile: default
modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
tip

Once complete, you'll have to restart your current shell or reload the "PATH" environment variable to include Cargo's bin directory $HOME/.cargo/bin. This is required to let you use "cargo" command globally.

To configure your current shell, run:

source "$HOME/.cargo/env"

From then on, the latest version of Cargo (Rust's build and package manager tool) should be installed. Learn more about Cargo, here.

Check the version to confirm's working correctly:

cargo --version

Here's the output we got (beware that our version might differ to yours, it's expected 😅).

cargo 1.65.0 (4bc8f24d3 2022-10-20)

Lightning installer rust dependencies

Rustup subcommands deal with toolchains, a collection of programs required to compile a Rust application.

rustup toolchain list

For example, on Linux Ubuntu we generally have it set to the default:

stable-x86_64-unknown-linux-gnu (default)

While on macOS:

stable-x86_64-apple-darwin (default)

Make sure you have Rustup set to the desired toolchain as default if required 💁‍♀️!

rustup default <TOOLCHAIN-LIST-NAME>
tip

Rust compilation is long and compiler caching can help speed things up immensely. The Lightning CLI project can be used to reduce the perceived compilation times.

Linux dependencies

On Linux (we'll stick with Ubuntu as the Linux distro example), start by updating the package information in the source list and then upgrade all the installed packages with the latest versions (do the equivalent for your Linux distro), as follows:

sudo apt-get update
sudo apt-get upgrade
tip

You can optionally pass the y flag to skip any user prompts e.g. sudo apt-get update -y to any remaining apt-get commands.

Install the build-essentials packages, necessary for compiling general software and for our use-case Lightning CLI.

sudo apt-get install build-essential

Followed by the required tools to compile the application (cmake, clang, pkg-config and libssl-dev ).

sudo apt-get install cmake clang pkg-config libssl-dev gcc-multilib
tip

For Debian, you should install gcc, as follows:

sudo apt-get update
sudo apt-get install gcc

Now install the Protobufer Compiler.

sudo apt-get install protobuf-compiler

Ensure the compiler version is 3+

protoc --version

Installing Lightning CLI

If you haven't already, clone the Fleek Network's Lightning repository to your machine.

tip

You have several ways of doing this:

  • Clone via HTTPS
  • Clone via SSH
  • Download via Github CLI
  • Download the zip package from the repository

We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this. Although, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it here.

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git <DIRECTORY-NAME>

At time of writing, we are checking the branch name testnet-alpha-1 that corresponds to the testnet phase. -Here's an example of what it'd look like when sticking to the recommended path location:

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning

When git clone completes 👍, change directory to the project directory e.g. we cloned to the default name ~/fleek-network/lightning:

cd ~/fleek-network/lightning
note

The ~/fleek-network/lightning or $HOME/fleek-network/lightning directory is the default or recommended location to store the repository. If you like to follow conventions, then is best to stick with the recommendation, to avoid confusion and make it easier to follow our documentation.

If you list (ls) the files in the directory, it should be similar to:

.
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Cargo.lock
├── Cargo.toml
├── LICENSE
├── README.md
├── codecov.yml
├── core
├── docs
├── lib
├── lightning.toml
├── rust-toolchain
├── rustfmt.toml
├── services
└── target

At this point, you should be able to run the install command successfully.

caution

If you already had Rust installed, or the project before, and skipped instructions directly here, there might be case where you get errors. So, make sure to clear your work directory:

cargo clean
cargo update

Start the install process by running the command:

cargo +stable build --release

The installation process is long, as it compiles the application binary for us from the source code.

🌈 Here's the output when successful! Note, that the output might differ slightly from time of writing.

    Finished release [optimized] target(s) in 11m 22s
Installing /root/.cargo/bin/lightning
Installed package `lightning v0.1.0 (/crates/lightning)` (executable `lightning`)
tip

Once Rust generates the binary lightning-node, you can find it in the project root target directory. Depending on the usage of +stable flag, the binary should be located at ~/fleek-network/lightning/target/debug/lightning-node or ~/fleek-network/lightning/target/release/lightning-node.

You can create an lgtn symbolic link to /usr/local/bin to make it available globally.

sudo ln -s "$HOME/fleek-network/lightning/target/release/lightning-node" /usr/local/bin/lgtn

After completing, you'll have the ability to type lgtn to execute the binary anywhere for your user account. Other users might find it better to copy or create an alias instead.

Run the lgtn help sub-command as a checkup:

Usage: lightning-node [OPTIONS] <COMMAND>

Commands:
run Start the node
keys Handle keys
print-config Print the loaded configuration
help Print this message or the help of the given subcommand(s)

Options:
-c, --config <CONFIG> Path to the toml configuration file [default: lightning.toml]
--with-mock-consensus Determines that we should be using the mock consensus backend
-v... Increases the level of verbosity (the max level is -vvv)
--log-location Print code location on console logs
-h, --help Print help
-V, --version Print version
caution

Beware that your output might differ a bit, as Lightning is in constant development. Note that you'll have to "re-install" every time you want to pull updates from the source repository, as the update at the time of writing is done manually and not automatically.

Key generator

Before starting the node, you should generate a public and private key.

lgtn keys generate

The keys will be generated and placed under the system directory ~/.lightning/keystore. The private key is the user's responsibility and no one else can generate or recover it for you, including Fleek Network or any team member. Your keys, your responsibility!

Set user path in config.toml

You should be following the create a user recommendation. For our example, we have the username lgtn.

tip

If you have chosen a different username, replace lgtn by the correct username you have selected.

In the config.toml you'll find some and more of the following:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"

Find and replace all instances of ~ in the config file /home/lgtn/.lightning/config.toml. Here's an example using sed:

sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"
caution

The config.toml example below is a shorter version of what you'll encounter, yours might look different. We do this to keep the guide simple to read. Do not copy and replace with the version demonstrated here.

Once changed, all the instances of ~/ should be replaced by your user path e.g. /home/lgtn/. For our example, the output would look like the following:

[BLANK]

[application]
db_path = "/home/lgtn/.lightning/data/app_db"

[consensus]
store_path = "/home/lgtn/.lightning/data/narwhal_store"

[fsstore]
root = "/home/lgtn/.lightning/blockstore"

[resolver]
store_path = "/home/lgtn/.lightning/data/resolver_store"

[signer]
consensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"
node_key_path = "/home/lgtn/.lightning/keystore/node.pem"

Set testnet in config.toml

Set the testnet attribute to true in the config.toml located in the path ~/.lightning/config.toml.

[application]
db_path = "~/.lightning/data/app_data"
mode = "Prod"
storage = "RocksDb"
testnet = true

...
tip

The configuration file should have more content, which was omitted here to keep it short and to the point. You're interested in the testnet property name only.

Start the node

Warning

To participate in the alpha Testnet, you have to through the onboarding process. Make sure you request access by following the onboarding instructions. If you fail to enable your node for testnet, it'll not run!

To start the node, you should execute the sub-command run. Noteworthy that while it launches the node, you're recommended to set up a systemd service to run it for a long period.

lgtn run
WARNING

We recommend setting up the process as a systemd service, as it's a long-running process. Instructions to setup a systemd service are available in the section Systemd Service Setup.

Great! You have successfully installed all the required packages, and libraries and have compiled and installed lightning. Check the section Health Check to learn how to do a node health checkup.

Systemd Service Setup

Create a new Systemd service file:

sudo touch /etc/systemd/system/lightning.service

Open the file and put the following content:

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/lgtn/.lightning/config.toml run
ExecStop=killall lgtn
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp

[Install]
WantedBy=multi-user.target
caution

Notice that we're using lgnt as the username. If you have a different custom username change it accordingly. Beware that we've recommended using a non-root user, as described in the section create a user.

note

The flag -c in the lightning.service ExecStart, is to provide the toml configuration file path e.g. defaults to ~/.lightning/config.toml. This is to avoid the path being determined dynamically (given path base ~ or $HOME), as users might control the systemctl service as a user or sudoer. For example, a sudoer would have the configuration set to /root/.lightning/config.toml or /home/username/.lightning/config.toml depending on using sudo which might cause some confusion to some users.

Change the file permissions for the service:

sudo chmod 644 /etc/systemd/system/lightning.service

After creating the service file, you should reload the Systemd process, to apply the newly created service. You can do this by executing:

sudo systemctl daemon-reload

To start the service at boot, use the enable command:

sudo systemctl enable lightning.service

Create the directory where the log message will be stored, as follows:

sudo mkdir -p /var/log/lightning

You may want to create empty placeholders for the stdout and stderr log files:

sudo touch /var/log/lightning/output.log
sudo touch /var/log/lightning/diagnostic.log
WARNING

We're assuming that you've created a new user and can start the service operating without sudo.

Start the service by:

sudo systemctl start lightning.service
tip

Find the timeline of events for the Lightning service by checking the log files. Learn about it in the section Log Messages.

To learn more, visit the section Use Systemctl to manage the Lightning Service

Docker installation

In this section we'll describe how to run a Fleek Network Lightning Node as a Docker Service. We're going to assume that you have Docker installed and running. If you need help to install Docker, check the guide running a node in docker.

a) We can easily pull and run the Lightning Docker image from our registry to run the Docker Container quickly.

b) Build the Docker image from the repository source code

Optionally, wrap the Docker Container as a Systemd Service.

tip

The Docker images are built for particular CPU architectures (x64) and as declared in the requirements, we're mainly supporting GenuineIntel, as there has been reports of failure to build and run the binary on AMD. If you're running on a AuthenticAMD, provide us feedback on our Discord.

Quick pull and run

You can pull an run the Lightning pre-built Docker image from our GitHub and run the Docker container quickly by executing the following command:

sudo docker run \
-p 4230:4230 \
-p 4200:4200 \
-p 6969:6969 \
-p 18000:18000 \
-p 18101:18101 \
-p 18102:18102 \
--mount type=bind,source=$HOME/.lightning,target=/root/.lightning \
--name lightning-node \
-it ghcr.io/fleek-network/lightning:latest
tip

The command has a list of ports -p values that map ports in the container on the Docker host. While we try to keep the information across our documentation in sync with the latest changes or requirements e.g. port number changes, make sure that you check the section ports to find the latest updates.

Build from source

Clone the repository located at https://github.com/fleek-network/lightning.

tip

You have several ways of doing this:

  • Clone via HTTPS
  • Clone via SSH
  • Download via Github CLI
  • Download the zip package from the repository

We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this. +Here's an example of what it'd look like when sticking to the recommended path location:

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning

When git clone completes 👍, change directory to the project directory e.g. we cloned to the default name ~/fleek-network/lightning:

cd ~/fleek-network/lightning
note

The ~/fleek-network/lightning or $HOME/fleek-network/lightning directory is the default or recommended location to store the repository. If you like to follow conventions, then is best to stick with the recommendation, to avoid confusion and make it easier to follow our documentation.

If you list (ls) the files in the directory, it should be similar to:

.
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Cargo.lock
├── Cargo.toml
├── LICENSE
├── README.md
├── codecov.yml
├── core
├── docs
├── lib
├── lightning.toml
├── rust-toolchain
├── rustfmt.toml
├── services
└── target

At this point, you should be able to run the install command successfully.

caution

If you already had Rust installed, or the project before, and skipped instructions directly here, there might be case where you get errors. So, make sure to clear your work directory:

cargo clean
cargo update

Start the install process by running the command:

cargo +stable build --release

The installation process is long, as it compiles the application binary for us from the source code.

🌈 Here's the output when successful! Note, that the output might differ slightly from time of writing.

    Finished release [optimized] target(s) in 11m 22s
Installing /root/.cargo/bin/lightning
Installed package `lightning v0.1.0 (/crates/lightning)` (executable `lightning`)
tip

Once Rust generates the binary lightning-node, you can find it in the project root target directory. Depending on the usage of +stable flag, the binary should be located at ~/fleek-network/lightning/target/debug/lightning-node or ~/fleek-network/lightning/target/release/lightning-node.

You can create an lgtn symbolic link to /usr/local/bin to make it available globally.

sudo ln -s "$HOME/fleek-network/lightning/target/release/lightning-node" /usr/local/bin/lgtn

After completing, you'll have the ability to type lgtn to execute the binary anywhere for your user account. Other users might find it better to copy or create an alias instead.

Run the lgtn help sub-command as a checkup:

Usage: lightning-node [OPTIONS] <COMMAND>

Commands:
run Start the node
keys Handle keys
print-config Print the loaded configuration
help Print this message or the help of the given subcommand(s)

Options:
-c, --config <CONFIG> Path to the toml configuration file [default: lightning.toml]
--with-mock-consensus Determines that we should be using the mock consensus backend
-v... Increases the level of verbosity (the max level is -vvv)
--log-location Print code location on console logs
-h, --help Print help
-V, --version Print version
caution

Beware that your output might differ a bit, as Lightning is in constant development. Note that you'll have to "re-install" every time you want to pull updates from the source repository, as the update at the time of writing is done manually and not automatically.

Key generator

Before starting the node, you should generate a public and private key.

lgtn keys generate

The keys will be generated and placed under the system directory ~/.lightning/keystore. The private key is the user's responsibility and no one else can generate or recover it for you, including Fleek Network or any team member. Your keys, your responsibility!

Set user path in config.toml

You should be following the create a user recommendation. For our example, we have the username lgtn.

tip

If you have chosen a different username, replace lgtn by the correct username you have selected.

In the config.toml you'll find some and more of the following:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"

Find and replace all instances of ~ in the config file /home/lgtn/.lightning/config.toml. Here's an example using sed:

sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"
caution

The config.toml example below is a shorter version of what you'll encounter, yours might look different. We do this to keep the guide simple to read. Do not copy and replace with the version demonstrated here.

Once changed, all the instances of ~/ should be replaced by your user path e.g. /home/lgtn/. For our example, the output would look like the following:

[BLANK]

[application]
db_path = "/home/lgtn/.lightning/data/app_db"

[consensus]
store_path = "/home/lgtn/.lightning/data/narwhal_store"

[fsstore]
root = "/home/lgtn/.lightning/blockstore"

[resolver]
store_path = "/home/lgtn/.lightning/data/resolver_store"

[signer]
consensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"
node_key_path = "/home/lgtn/.lightning/keystore/node.pem"

Set testnet in config.toml

Set the testnet attribute to true in the config.toml located in the path ~/.lightning/config.toml.

[application]
db_path = "~/.lightning/data/app_data"
mode = "Prod"
storage = "RocksDb"
testnet = true

...
tip

The configuration file should have more content, which was omitted here to keep it short and to the point. You're interested in the testnet property name only.

Start the node

Warning

To participate in the alpha Testnet, you have to through the onboarding process. Make sure you request access by following the onboarding instructions. If you fail to enable your node for testnet, it'll not run!

To start the node, you should execute the sub-command run. Noteworthy that while it launches the node, you're recommended to set up a systemd service to run it for a long period.

lgtn run
WARNING

We recommend setting up the process as a systemd service, as it's a long-running process. Instructions to setup a systemd service are available in the section Systemd Service Setup.

Great! You have successfully installed all the required packages, and libraries and have compiled and installed lightning. Check the section Health Check to learn how to do a node health checkup.

Systemd Service Setup

Create a new Systemd service file:

sudo touch /etc/systemd/system/lightning.service

Open the file and put the following content:

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/lgtn/.lightning/config.toml run
ExecStop=killall lgtn
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp

[Install]
WantedBy=multi-user.target
caution

Notice that we're using lgnt as the username. If you have a different custom username change it accordingly. Beware that we've recommended using a non-root user, as described in the section create a user.

note

The flag -c in the lightning.service ExecStart, is to provide the toml configuration file path e.g. defaults to ~/.lightning/config.toml. This is to avoid the path being determined dynamically (given path base ~ or $HOME), as users might control the systemctl service as a user or sudoer. For example, a sudoer would have the configuration set to /root/.lightning/config.toml or /home/username/.lightning/config.toml depending on using sudo which might cause some confusion to some users.

Change the file permissions for the service:

sudo chmod 644 /etc/systemd/system/lightning.service

After creating the service file, you should reload the Systemd process, to apply the newly created service. You can do this by executing:

sudo systemctl daemon-reload

To start the service at boot, use the enable command:

sudo systemctl enable lightning.service

Create the directory where the log message will be stored, as follows:

sudo mkdir -p /var/log/lightning

You may want to create empty placeholders for the stdout and stderr log files:

sudo touch /var/log/lightning/output.log
sudo touch /var/log/lightning/diagnostic.log
WARNING

We're assuming that you've created a new user and can start the service operating without sudo.

Start the service by:

sudo systemctl start lightning.service
tip

Find the timeline of events for the Lightning service by checking the log files. Learn about it in the section Log Messages.

To learn more, visit the section Use Systemctl to manage the Lightning Service

Docker installation

In this section we'll describe how to run a Fleek Network Lightning Node as a Docker Service. We're going to assume that you have Docker installed and running. If you need help to install Docker, check the guide running a node in docker.

a) We can easily pull and run the Lightning Docker image from our registry to run the Docker Container quickly.

b) Build the Docker image from the repository source code

Optionally, wrap the Docker Container as a Systemd Service.

tip

The Docker images are built for particular CPU architectures (x64) and as declared in the requirements, we're mainly supporting GenuineIntel, as there has been reports of failure to build and run the binary on AMD. If you're running on a AuthenticAMD, provide us feedback on our Discord.

Quick pull and run

You can pull an run the Lightning pre-built Docker image from our GitHub and run the Docker container quickly by executing the following command:

sudo docker run \
-p 4200-4299:4200-4299 \
-p 4300-4399:4300-4399 \
--mount type=bind,source=$HOME/.lightning,target=/root/.lightning \
--name lightning-node \
-it ghcr.io/fleek-network/lightning:latest
tip

The command has a list of ports -p values that map ports in the container on the Docker host. While we try to keep the information across our documentation in sync with the latest changes or requirements e.g. port number changes, make sure that you check the section ports to find the latest updates.

Build from source

Clone the repository located at https://github.com/fleek-network/lightning.

tip

You have several ways of doing this:

  • Clone via HTTPS
  • Clone via SSH
  • Download via Github CLI
  • Download the zip package from the repository

We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this. Although, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it here.

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git <DIRECTORY-NAME>

At time of writing, we are checking the branch name testnet-alpha-1 that corresponds to the testnet phase. -Here's an example of what it'd look like when sticking to the recommended path location:

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning

Change directory to the project source code directory, e.g. the default ~/fleek-network/lightning.

cd ~/fleek-network/lightning

Build the image named as lightning from our Dockerfile:

sudo docker build -t lightning -f ./Dockerfile .
tip

Take note of the Docker image name lightning, as that's the name we'll use and pass to the Docker run to be successful. You can name it differently if that's your preference.

Once the image is built, you can launch the Docker Container with a --name such as lightning-node from the lightning image we just created by running:

sudo docker run \
-p 4230:4230 \
-p 4200:4200 \
-p 6969:6969 \
-p 18000:18000 \
-p 18101:18101 \
-p 18102:18102 \
--mount type=bind,source=$HOME/.lightning,target=/root/.lightning \
--name lightning-node \
-it lightning
tip

The command has a list of ports -p values that map ports in the container on the Docker host. While we try to keep the information across our documentation in sync with the latest changes or requirements e.g. port number changes, make sure that you check the section ports to find the latest updates.

If a ~/.lightning directory or ~/.lightning/keystore doesn't exist, one is created for you on docker run. You'll need to have the directory populated with the config.toml and keystore if you want to use a particular identity. Learn more about managing the keystore here.

Docker Container as a Systemd Service

Create a unit configuration file:

sudo touch /etc/systemd/system/docker-lightning.service

Open the docker-lightning.service file in your favourite text editor and put the content:

[Unit]
Description=Fleek Network Node lightning service
After=docker.service
Requires=docker.service

[Service]
Restart=always
RestartSec=5
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill lightning-node
ExecStartPre=-/usr/bin/docker rm lightning-node
ExecStartPre=/usr/bin/docker pull ghcr.io/fleek-network/lightning:latest
ExecStart=/usr/bin/docker run -p 4230:4230 -p 4200:4200 -p 6969:6969 -p 18000:18000 -p 18101:18101 -p 18102:18102 --mount type=bind,source=/home/skywalker/.lightning,target=/root/.lightning --name lightning-node ghcr.io/fleek-network/lightning:latest
ExecStop=/usr/bin/docker stop
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log

[Install]
WantedBy=multi-user.target

Change the file permissions by running the command:

sudo chmod 644 /etc/systemd/system/docker-lightning.service

Next, reload the Systemctl Daemon:

sudo systemctl daemon-reload

Enable the service on startup when the system boots:

sudo systemctl enable docker-lightning.service

Learn how to manage the Systemd Service by reading the section systemd service.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +Here's an example of what it'd look like when sticking to the recommended path location:

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning

Change directory to the project source code directory, e.g. the default ~/fleek-network/lightning.

cd ~/fleek-network/lightning

Build the image named as lightning from our Dockerfile:

sudo docker build -t lightning -f ./Dockerfile .
tip

Take note of the Docker image name lightning, as that's the name we'll use and pass to the Docker run to be successful. You can name it differently if that's your preference.

Once the image is built, you can launch the Docker Container with a --name such as lightning-node from the lightning image we just created by running:

sudo docker run \
-p 4200-4299:4200-4299 \
-p 4300-4399:4300-4399 \
--mount type=bind,source=$HOME/.lightning,target=/root/.lightning \
--name lightning-node \
-it lightning
tip

The command has a list of ports -p values that map ports in the container on the Docker host. While we try to keep the information across our documentation in sync with the latest changes or requirements e.g. port number changes, make sure that you check the section ports to find the latest updates.

If a ~/.lightning directory or ~/.lightning/keystore doesn't exist, one is created for you on docker run. You'll need to have the directory populated with the config.toml and keystore if you want to use a particular identity. Learn more about managing the keystore here.

Docker Container as a Systemd Service

Create a unit configuration file:

sudo touch /etc/systemd/system/docker-lightning.service

Open the docker-lightning.service file in your favourite text editor and put the content:

[Unit]
Description=Fleek Network Node lightning service
After=docker.service
Requires=docker.service

[Service]
Restart=always
RestartSec=5
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill lightning-node
ExecStartPre=-/usr/bin/docker rm lightning-node
ExecStartPre=/usr/bin/docker pull ghcr.io/fleek-network/lightning:latest
ExecStart=/usr/bin/docker run -p 4200-4299:4200-4299 -p 4300-4399:4300-4399 --mount type=bind,source=/home/skywalker/.lightning,target=/root/.lightning --name lightning-node ghcr.io/fleek-network/lightning:latest
ExecStop=/usr/bin/docker stop
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log

[Install]
WantedBy=multi-user.target

Change the file permissions by running the command:

sudo chmod 644 /etc/systemd/system/docker-lightning.service

Next, reload the Systemctl Daemon:

sudo systemctl daemon-reload

Enable the service on startup when the system boots:

sudo systemctl enable docker-lightning.service

Learn how to manage the Systemd Service by reading the section systemd service.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/docs/node/overview/index.html b/docs/node/overview/index.html index 7e989a1ed..ad6e17acc 100644 --- a/docs/node/overview/index.html +++ b/docs/node/overview/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

Overview

This section provides instructions to help you build a Fleek Network Node, it's aimed at everybody willing to learn and cultivate knowledge as a node operator.

tip

To participate in the alpha Testnet, you can begin by setting up and running nodes. Check the requirements and find the onboarding instructions to enable you to install a network node successfully.

Node operator


A Node Operator is represented as a system administrator who builds, installs or maintains one or many nodes in a server or more.

Anyone willing to learn can become a Node operator, which will be enabled to set up and run a Node on their own at any time without the need for anyone's permission.

Amongst others, the use cases we try to cover are:

  • Server requirements
  • Installing the Node easily with the installation wizard
  • Building a Node binary from source code
  • Configuring the Node
  • Securing the server and identity
  • Updating the Node
  • Learning to troubleshoot
  • Learning how to analyze the node process log messages
tip

While we do our best to provide the clearest instructions, there's always space for improvement, therefore feel free to make any contributions by messaging us on our discord or by opening a PR in any of our repositories.

Ready? Start by checking the server requirements

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- + \ No newline at end of file diff --git a/docs/node/requirements/index.html b/docs/node/requirements/index.html index e0ac34258..6fa6a5556 100644 --- a/docs/node/requirements/index.html +++ b/docs/node/requirements/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

Requirements

This section provides the requirements for the server specifications on which the Fleek Network Node can be installed and run.

warning

Only 64-bits distributions are supported. Do not try to install it on a 32-bits operating system!

Server


The Fleek Network node binary is only supported by a Linux server. Currently, we are only providing support for the following distros:

  • Debian (>= 11)
  • Ubuntu (>= 22.04 LTS)
tip

Support for other OS will be made available soon, e.g. CentOS and Fedora. Feel free to test running on older versions, but we reduce the number of versions to ease support and keep instructions less verbose, which should be easily translatable to your preferred OS Distro and Version. Any contributions to provide support for your favorite distro are welcomed! Feel free to open a PR in our repositories.

Because of the use of Linux containerization technology, other operating systems, such as FreeBSD, OpenBSD, MacOS, Windows and others are not supported.

If you don’t have a server or a spare machine, keep reading as we'll give you some hints on how to rent one, although we are not affiliated with any provider.

Ports

Amongst other resources, ports play the role of managing and organizing network traffic. The ports initiate and terminate network connections crucial for the node to operate in the Fleek Network. The operating system should have the ports enabled and open for the node to run successfully.

We reserve the following top level ranges:

  • TCP: 4200-4299
  • UDP: 4300-4399

Each service in the node has 10 ports reserved within each range.

note

For node operators, they can either choose to individually open up the assigned ports, or just open the top level ranges, at their discretion. But we reserve the full ranges for future use, so they should avoid any port conflicts with other software running on the node.

tip

For the Node Operators who opt to run the get.fleek.network assisted installer, the ports are verified if in use.

The Node process requires the following ports:

Connection Pool (4x00-4x09)

  • Netkit QUIC: 4300 (UDP)

Consensus (4x10-4x19)

  • Mempool: 4210 (TCP)
  • Primary: 4310 (UDP)
  • Worker: 4311 (UDP)

Handshake (4x20-4x29)

  • HTTP: 4220 (TCP)
  • TCP: 4221 (TCP)
  • WebRTC: 4320 (UDP)
  • WebTransport: 4321 (UDP)

RPC (4x30-4x39)

  • HTTP: 4230 (TCP)
  • WebSocket / WebTransport?

DHT (4x40-4x49)

  • UDP: 4340 (UDP)

Broadcast

  • Uses connection pool

Blockstore Server

  • Uses connection pool
required

The ports should be freed before launching the node process. Any blockers or firewalls should be configured to enable the ports.

Specs


The recommended number of CPU cores is a minimum of 4 with a minimum CPU speed of 2.0 GHz. The Fleek Network node binary is only supported on CPUs that adhere to the x86_64 architecture (64-bit).

A minimum of 32 GB of memory (RAM) is required and a reasonable amount of disk space for the installation and running processes, which at the minimum should be around 20 GB.

note

We're mainly supporting GenuineIntel and there have been reports of failure to build the binary on AMD. The ARM64 is a different architecture, thus not supported, but there has been some community contributions in that regard, find it in the reference error building on ARM64.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- + \ No newline at end of file diff --git a/docs/node/systemd-service/index.html b/docs/node/systemd-service/index.html index a2cae8643..fb2569600 100644 --- a/docs/node/systemd-service/index.html +++ b/docs/node/systemd-service/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

Systemd Service

In this section we describe how to enable, disable, start, stop the Systemd Service.

The service is set up by the assisted installer automatically, or manually as described in the manual installation and docker install.

Reload the daemon

Reload the Systemctl daemon by executing the command:

sudo systemctl daemon-reload

Enable

Enable the service for starting up on system boot:

sudo systemctl enable lightning.service
tip

If you have installed or set up the Service as a Docker Container, prefix the service name with docker-.

sudo systemctl enable docker-lightning
caution

You shouldn't have prefixed the systemctl command with sudo when start/stop/status the service. Due to some VPS providers modifying the operating system, we had to present the examples prefixed with sudo for the wider audience. If you'd like to learn more about controlling Systemd services as a user check the reference Systemd user-service.

Disable

Disable the service for starting up on system boot:

sudo systemctl disable lightning.service
tip

If you have installed or setup the Service as a Docker Container, prefix the service name with docker-.

sudo systemctl disable docker-lightning

Start

Start the service by:

sudo systemctl start lightning.service
tip

When naming the service, the *.service can be omitted. For this reason the command can be typed as follows:

sudo systemctl start lightning
tip

If you have installed or set up the Service as a Docker Container, prefix the service name with docker-.

sudo systemctl start docker-lightning

Stop

Stop the service by:

sudo systemctl stop lightning
tip

If you have installed or set up the Service as a Docker Container, prefix the service name with docker-.

sudo systemctl stop docker-lightning

Restart

Restart the service by:

sudo systemctl restart lightning
tip

If you have installed or set up the Service as a Docker Container, prefix the service name with docker-.

sudo systemctl restart docker-lightning

Status

Check the service status by:

sudo systemctl status lightning.service
tip

If you have installed or set up the Service as a Docker Container, prefix the service name with docker-.

sudo systemctl status docker-lightning
Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- + \ No newline at end of file diff --git a/docs/node/testnet-onboarding/index.html b/docs/node/testnet-onboarding/index.html index 39dc5cd44..8704adca0 100644 --- a/docs/node/testnet-onboarding/index.html +++ b/docs/node/testnet-onboarding/index.html @@ -13,7 +13,7 @@ - + @@ -22,7 +22,7 @@

Testnet Phase {1}:

Following the successful completion of Fleek Network Testnet Phase {0}, the core development team has been actively implementing the next set of core protocol functionalities, which include services, the reward's system, the broadcaster/synchronizer, as well as all identified improvements and fixes found during that phase.

Prerequesites

The Testnet Phase {1} is open to everybody. Everyone's free to join the Testnet Phase {1}, regardless of whether they have participated in any prior testnet phase or filled any forms.

The Fleek team cares about user experience and provides documentation and tools (whichever's your preference) to onboard easily and quickly. However, the Node operator's server should have the minimum requirements to set up and run a Fleek Network node.

To join, you will have to follow the steps below:

1) Install the Fleek Network Lightning CLI latest version

Once Fleek launches the Testnet Phase {1}, you have to install or update the Lightning CLI binary to the latest version. The instructions are available here where you can use an assisted installer or install it manually by following the documentation. If you already have it installed, use the update reference provided here or if you prefer a more step-by-step approach use the provided guide.

Warning

The Testnet Phase {1} version should only be available after the Testnet Phase {1} is ready and announced. Since we work transparently (open-source) some users rush to install things on their own assumptions, misaligned, which causes them confusion. The Fleek Network core team is required to provide all the changes, features and tests before announcing publicly that the testnet phase is ready. Otherwise, you'll be running the process prematurely, be patient to avoid disappointment please!

2) Set up the Metamask browser extension

Open the Metamask settings, located in the drop-down (top-right menu options). Set the following property values:

  • Network Name: Fleek Network Testnet
  • RPC URL: https://rpc.testnet.fleek.network/rpc/v0
  • Chain ID: 59330
  • Currency symbol: tFLK
note

Testnet FLK on testnets are supposed to have no real value. Since you need Testnet FLK to actually interact with Fleek Network, users get Testnet FLK for free from the faucet. For clarity and simplicity we'll refer to Testnet FLK as tFLK.

3) Visit the faucet website

Before proceeding, make sure to have the Fleek Network selected as the metamask network. Once confirmed, visit the Faucet website

4) Connect wallet

In the Faucet website, you have to click the Connect Wallet.

5) Mint tFLK

Once Connect Wallet is ready, proceed to Mint tFLK and wait until the balance of the account in your Metamask increases. You need to have tFLK before proceeding. Be patient.

6) Stake tFLK

Once tFLK balance is available, click in the Stake button. You'll be required to provided the following details from your node:

  • Node Public Key
  • Consensus Public Key
  • Server IP Address

You can get the details quickly by running the node details script in the terminal connected to your machine or server where the node is set up and running, as follows:

curl https://get.fleek.network/node_details | bash

The response should include the following details:

🤖 Your server details are the following

The Node Public Key is <NODE PUBLIC KEY>
The Consensus Public Key is <CONSENSUS PUBLIC KEY>
The Node Server IP address is <SERVER IP ADDRESS>
warning

The output above is an example, you'll not find the actual text <NODE PUBLIC KEY>, <CONSENSUS PUBLIC KEY> but the text values (string of bits), or <SERVER IP ADDRESS> where instead you'll find a numerical ip address. Make sure that you copy and paste the correct values otherwise the transaction will fail!

7) Confirm the transaction on metamask

It is important to note that when transacting through Metamask, a warning message might pop up regarding gas costs, but rest assured that there won't be any deductions from your wallet balance.

You'll have to wait for Metamask to confirm the transaction, which Metamask should take about 10 seconds to confirm. Although, the transaction takes under a second.

Important to note that in Testnet Phase {1} the Epoch is set to about 30 minutes. This is the average period you'll have to wait to see any meaningful logs.

8) Start the Node

Visit the section Systemd Service to learn how to enable, disable, start, stop the Systemd Service.

note

The Systemd Service is setup automatically by the assisted installer, manually if you have followed the instructions provided, or the docker install. If you have a custom set up, you'll have to do the equivalent to start the node as described in the section Systemd Service.

Make sure you do a quick healthcheck:

curl https://get.fleek.network/healthcheck | bash

To learn more about healchecks read the section here.

9) Confirm Node Stake

To confirm the Node Staked amount, you can run the node details script to get the information. The node details output will only show staked information if available, if it doesn't show staked information it means that your Node is not properly staked.

Check the Node stake by running the following command in the machine or server where the node is set up:

curl https://get.fleek.network/node_details | bash

Alternatively, the Stake amount can be verified by querying the RPC-JSON API method flk_get_node_info.

Troubleshooting

The Node fails to run after successfully stake and run? Or the Core team network restart announcement?

The Fleek Network core team might have to restart the network, for any development purposes or required updates during the Testnet Phase {1}. If you've done this process before and is running into issues, you'll have to go into the Metamask advance settings (Metamask → Settings → Advanced) and click Clear activity and nonce data or Clear Local data. After doing this Metamask will clear the cache.

Node details don't show staked amount?

If you have staked successfully and the transaction details in the Metamask wallet is confirmed, but the node details script or the RPC-JSON API method flk_get_node_info shows an empty result, do the following:

Metamask:

  • Copy the Account address at the very top of your Metamask home
  • Copy the Transaction ID by clicking in the tFLK transaction → Copy Transaction ID at the very top
  • Copy the Activity log details of the transaction

Server where the Node is set up:

  • Copy the Node Public Key
  • Copy the Server IP Address
tip

You can get the Node Public Key and Server IP Address quick by using the node details script described in the section.

Report to us by sharing the details about via our discord troubleshooting channel.

- + \ No newline at end of file diff --git a/docs/roadmap/index.html b/docs/roadmap/index.html index 115ebf448..4ba135737 100644 --- a/docs/roadmap/index.html +++ b/docs/roadmap/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

Roadmap

Introduction

Instead of restricting our network architecture/capabilities to a CDN service, Fleek Network's core was redesigned to support a fully decentralized edge platform upon which many edge services e.g. CDN, serverless functions, amongst others, can be built. The new architecture separates each aspect of the network (blockchain - edge infrastructure - services) so that anyone can build new edge services on Fleek Network.

Several milestones were completed toward our next early Testnet goal: the whitepaper was launched, and the Github repo was published.

For a complete description of our testnet plans, road to mainnet, and testnet participation initiatives, read the following blog post.

Current state: Road to Testnet

Our current roadmap on the road to an early testnet stands as follows, currently in *Phase {0}:

Phases 0 to 5

Fleek Network will utilize a multi-phase approach to rolling out mainnet. The current high-level plan, set out below, depends on a variety of factors and may change in response to development timelines and/or data/feedback collected throughout the different phases.

  • Phase 0 (September 5th): Node Rollout
    • Initial network and node testing (performance, hardware specs, clustering, costs, metrics, etc.)
  • Phase 1 (mid-late September): SDK/Service Rollout
    • Introduce the SDK and test the building and utilizing of services on the network, as well as some optimizations based on Phase 0.
  • Phase 2 (October): Initial Economics Rollout
    • Introduce and test a more concrete version of the economic algorithm, including staking, pricing, and other elements/situations using test (valueless) tokens, as well as some optimizations based on Phase 1.
  • Phase 3 (November): Layer 2 Contracts Rollout
    • Introduce a test version of the aspects of the protocol that will live on an Ethereum L2 (staking, deposit and token contracts, communication between L2/FN, etc).
  • Phase 4 (December): Final Rollout
    • Introduce the final form of the first generation of the network, based on all data/feedback and optimizations throughout all the phases, and allow testing of what a realistic mainnet environment will be like.
  • Phase 5 (Q1 2024): Mainnet Launch

The goals for all stages involve completing and revising the following:

  • Network performance
  • Hardware/node specs
  • Sandboxing of services
  • Packaging and pricing of initial network resources/commodities
  • Parameters related to the FLK token
  • Security testing/auditing
  • Criteria for allocation of pre-mainnet community tokens

Mainnet

The mainnet release of Fleek Network will come with the arrival of a stable and end-to-end tested version of the protocol. Details on the transition to mainnet will be discussed later in the future.

We will continue to update this roadmap in the short and long term to reflect the different stages the network goes through.

- + \ No newline at end of file diff --git a/docs/tags/about/index.html b/docs/tags/about/index.html index ae9e28b3e..200691a2e 100644 --- a/docs/tags/about/index.html +++ b/docs/tags/about/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "about"

View All Tags

Introduction

Introduction to Fleek Network, a decentralized edge network. Learn its purpose, operation, and approach towards a decentralized infrastructure layer.

- + \ No newline at end of file diff --git a/docs/tags/algorithms/index.html b/docs/tags/algorithms/index.html index 8663e63f8..e5bcd0fe1 100644 --- a/docs/tags/algorithms/index.html +++ b/docs/tags/algorithms/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "algorithms"

View All Tags

The Network

Explore Fleek Network’s core protocol, its architecture, and unique characteristics as a decentralized edge network.

- + \ No newline at end of file diff --git a/docs/tags/architecture/index.html b/docs/tags/architecture/index.html index ffe90d02a..daef33fa8 100644 --- a/docs/tags/architecture/index.html +++ b/docs/tags/architecture/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "architecture"

View All Tags

The Network

Explore Fleek Network’s core protocol, its architecture, and unique characteristics as a decentralized edge network.

- + \ No newline at end of file diff --git a/docs/tags/awards/index.html b/docs/tags/awards/index.html index 69be1e11c..04ec0adad 100644 --- a/docs/tags/awards/index.html +++ b/docs/tags/awards/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "awards"

View All Tags

Token and economics

Explore the preliminary breakdown of the Fleek Network's FLK token distribution, its integral role in node operations, the balance of economic incentives, and potential adjustments in pre-mainnet phases.

- + \ No newline at end of file diff --git a/docs/tags/build/index.html b/docs/tags/build/index.html index eb7163f62..d2e8797fd 100644 --- a/docs/tags/build/index.html +++ b/docs/tags/build/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

2 docs tagged with "build"

View All Tags

Install

The Fleek Network Lightning CLI installation walkthrough

Overview

Learn about server requirements, installation, configuration, and more. Become a Node Operator and contribute to the network's growth.

- + \ No newline at end of file diff --git a/docs/tags/cdn/index.html b/docs/tags/cdn/index.html index 2a622bdee..89b7db2b5 100644 --- a/docs/tags/cdn/index.html +++ b/docs/tags/cdn/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

4 docs tagged with "CDN"

View All Tags

Developers

Join Fleek Network as a developer. Dive into our Whitepaper, Github, and SDK details. Stay updated with our newsletter and Discord community.

Install

The Fleek Network Lightning CLI installation walkthrough

Services

Discover Fleek Network Services, modular software powered with the enhanced scalability and performance of edge networks.

Whitepaper

Fleek Network's whitepaper and codebase.

- + \ No newline at end of file diff --git a/docs/tags/client/index.html b/docs/tags/client/index.html index 30dd3a42e..37efad8c2 100644 --- a/docs/tags/client/index.html +++ b/docs/tags/client/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/code-of-conduct/index.html b/docs/tags/code-of-conduct/index.html index a1a450716..1d0fba1ef 100644 --- a/docs/tags/code-of-conduct/index.html +++ b/docs/tags/code-of-conduct/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/codebase/index.html b/docs/tags/codebase/index.html index 8f831cf02..23b1f533a 100644 --- a/docs/tags/codebase/index.html +++ b/docs/tags/codebase/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/compile/index.html b/docs/tags/compile/index.html index 7625b0f3d..a743a54e2 100644 --- a/docs/tags/compile/index.html +++ b/docs/tags/compile/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "compile"

View All Tags

Install

The Fleek Network Lightning CLI installation walkthrough

- + \ No newline at end of file diff --git a/docs/tags/configuration/index.html b/docs/tags/configuration/index.html index b5332dbbb..1995d987a 100644 --- a/docs/tags/configuration/index.html +++ b/docs/tags/configuration/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/consensus/index.html b/docs/tags/consensus/index.html index ff7dcd9f7..b1b1e8b6c 100644 --- a/docs/tags/consensus/index.html +++ b/docs/tags/consensus/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "consensus"

View All Tags

The Network

Explore Fleek Network’s core protocol, its architecture, and unique characteristics as a decentralized edge network.

- + \ No newline at end of file diff --git a/docs/tags/contribute/index.html b/docs/tags/contribute/index.html index 67b9eea59..9b3ffe3e5 100644 --- a/docs/tags/contribute/index.html +++ b/docs/tags/contribute/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/control/index.html b/docs/tags/control/index.html index c1dd952e2..3689440be 100644 --- a/docs/tags/control/index.html +++ b/docs/tags/control/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/decentralization/index.html b/docs/tags/decentralization/index.html index 512d7a707..1e154bd5a 100644 --- a/docs/tags/decentralization/index.html +++ b/docs/tags/decentralization/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "decentralization"

View All Tags

The Network

Explore Fleek Network’s core protocol, its architecture, and unique characteristics as a decentralized edge network.

- + \ No newline at end of file diff --git a/docs/tags/develop/index.html b/docs/tags/develop/index.html index 8fd8d2c95..9290abcd9 100644 --- a/docs/tags/develop/index.html +++ b/docs/tags/develop/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

2 docs tagged with "develop"

View All Tags

Overview

Developers can create and utilize a multitude of Edge Services that inherit cryptographic and economically secured infrastructure. On top of geographic coverage guarantees, predictable costs and performance across all services running on the network.

Services

Discover Fleek Network Services, modular software powered with the enhanced scalability and performance of edge networks.

- + \ No newline at end of file diff --git a/docs/tags/diagnostic/index.html b/docs/tags/diagnostic/index.html index a0f596a2f..42520b818 100644 --- a/docs/tags/diagnostic/index.html +++ b/docs/tags/diagnostic/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/diagnostics/index.html b/docs/tags/diagnostics/index.html index 5d2812d84..12f43f613 100644 --- a/docs/tags/diagnostics/index.html +++ b/docs/tags/diagnostics/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/economics/index.html b/docs/tags/economics/index.html index 12fc677c4..c2a6130ac 100644 --- a/docs/tags/economics/index.html +++ b/docs/tags/economics/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "economics"

View All Tags

Token and economics

Explore the preliminary breakdown of the Fleek Network's FLK token distribution, its integral role in node operations, the balance of economic incentives, and potential adjustments in pre-mainnet phases.

- + \ No newline at end of file diff --git a/docs/tags/edge-network/index.html b/docs/tags/edge-network/index.html index 103a0d7e1..113dae27b 100644 --- a/docs/tags/edge-network/index.html +++ b/docs/tags/edge-network/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/edge-platform/index.html b/docs/tags/edge-platform/index.html index e3316b002..d57be7de2 100644 --- a/docs/tags/edge-platform/index.html +++ b/docs/tags/edge-platform/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

4 docs tagged with "Edge Platform"

View All Tags

About

Welcome to the documentation site for Fleek Network, the decentralized content and application layer built on established decentralized storage protocols combined with high-speed caching and an effective delivery layer.

Developers

Join Fleek Network as a developer. Dive into our Whitepaper, Github, and SDK details. Stay updated with our newsletter and Discord community.

Services

Discover Fleek Network Services, modular software powered with the enhanced scalability and performance of edge networks.

Whitepaper

Fleek Network's whitepaper and codebase.

- + \ No newline at end of file diff --git a/docs/tags/fleek-network/index.html b/docs/tags/fleek-network/index.html index 367680839..881715115 100644 --- a/docs/tags/fleek-network/index.html +++ b/docs/tags/fleek-network/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

7 docs tagged with "Fleek Network"

View All Tags

About

Welcome to the documentation site for Fleek Network, the decentralized content and application layer built on established decentralized storage protocols combined with high-speed caching and an effective delivery layer.

Developers

Join Fleek Network as a developer. Dive into our Whitepaper, Github, and SDK details. Stay updated with our newsletter and Discord community.

Install

The Fleek Network Lightning CLI installation walkthrough

Introduction

Introduction to Fleek Network, a decentralized edge network. Learn its purpose, operation, and approach towards a decentralized infrastructure layer.

Roadmap

Fleek Network's high-level roadmap per stage. Devnet, Testnet, and Mainnet.

Whitepaper

Fleek Network's whitepaper and codebase.

- + \ No newline at end of file diff --git a/docs/tags/getting-started/index.html b/docs/tags/getting-started/index.html index 799467ede..623ab49a6 100644 --- a/docs/tags/getting-started/index.html +++ b/docs/tags/getting-started/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

2 docs tagged with "Getting Started"

View All Tags

Install

The Fleek Network Lightning CLI installation walkthrough

Testnet onboarding

Join Fleek's Testnet onboarding, follow Discord instructions to install and verify your node. Check live updates, attend community calls, and ensure node is setup correctly.

- + \ No newline at end of file diff --git a/docs/tags/git/index.html b/docs/tags/git/index.html index d92683445..970b9af60 100644 --- a/docs/tags/git/index.html +++ b/docs/tags/git/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/guide/index.html b/docs/tags/guide/index.html index 34d7df884..3f520f923 100644 --- a/docs/tags/guide/index.html +++ b/docs/tags/guide/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

4 docs tagged with "Guide"

View All Tags

About

Welcome to the documentation site for Fleek Network, the decentralized content and application layer built on established decentralized storage protocols combined with high-speed caching and an effective delivery layer.

Developers

Join Fleek Network as a developer. Dive into our Whitepaper, Github, and SDK details. Stay updated with our newsletter and Discord community.

Install

The Fleek Network Lightning CLI installation walkthrough

Services

Discover Fleek Network Services, modular software powered with the enhanced scalability and performance of edge networks.

- + \ No newline at end of file diff --git a/docs/tags/healthcheck/index.html b/docs/tags/healthcheck/index.html index b31f3a020..c07eff8fc 100644 --- a/docs/tags/healthcheck/index.html +++ b/docs/tags/healthcheck/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/incentives/index.html b/docs/tags/incentives/index.html index 68f8b3856..356d9f36b 100644 --- a/docs/tags/incentives/index.html +++ b/docs/tags/incentives/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "incentives"

View All Tags

Token and economics

Explore the preliminary breakdown of the Fleek Network's FLK token distribution, its integral role in node operations, the balance of economic incentives, and potential adjustments in pre-mainnet phases.

- + \ No newline at end of file diff --git a/docs/tags/index.html b/docs/tags/index.html index f3b34d10a..b22741a53 100644 --- a/docs/tags/index.html +++ b/docs/tags/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/learn/index.html b/docs/tags/learn/index.html index 3dece386e..a35bb27d8 100644 --- a/docs/tags/learn/index.html +++ b/docs/tags/learn/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

4 docs tagged with "Learn"

View All Tags

About

Welcome to the documentation site for Fleek Network, the decentralized content and application layer built on established decentralized storage protocols combined with high-speed caching and an effective delivery layer.

Developers

Join Fleek Network as a developer. Dive into our Whitepaper, Github, and SDK details. Stay updated with our newsletter and Discord community.

Introduction

Introduction to Fleek Network, a decentralized edge network. Learn its purpose, operation, and approach towards a decentralized infrastructure layer.

Services

Discover Fleek Network Services, modular software powered with the enhanced scalability and performance of edge networks.

- + \ No newline at end of file diff --git a/docs/tags/logs/index.html b/docs/tags/logs/index.html index 948cffae3..719fa3dcb 100644 --- a/docs/tags/logs/index.html +++ b/docs/tags/logs/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/manage/index.html b/docs/tags/manage/index.html index 1976e2106..dc6a68372 100644 --- a/docs/tags/manage/index.html +++ b/docs/tags/manage/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/manual/index.html b/docs/tags/manual/index.html index 0fa7b37f4..5a0d5abdf 100644 --- a/docs/tags/manual/index.html +++ b/docs/tags/manual/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "manual"

View All Tags

Install

The Fleek Network Lightning CLI installation walkthrough

- + \ No newline at end of file diff --git a/docs/tags/node-status/index.html b/docs/tags/node-status/index.html index 0441418b1..d30481ac3 100644 --- a/docs/tags/node-status/index.html +++ b/docs/tags/node-status/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/onboarding/index.html b/docs/tags/onboarding/index.html index 93c8d2cab..c09d4db5a 100644 --- a/docs/tags/onboarding/index.html +++ b/docs/tags/onboarding/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "onboarding"

View All Tags

Testnet onboarding

Join Fleek's Testnet onboarding, follow Discord instructions to install and verify your node. Check live updates, attend community calls, and ensure node is setup correctly.

- + \ No newline at end of file diff --git a/docs/tags/open-source/index.html b/docs/tags/open-source/index.html index 9cb4dee1f..582a409cf 100644 --- a/docs/tags/open-source/index.html +++ b/docs/tags/open-source/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/permissionless/index.html b/docs/tags/permissionless/index.html index 5d0eca68f..c246c2139 100644 --- a/docs/tags/permissionless/index.html +++ b/docs/tags/permissionless/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "permissionless"

View All Tags

The Network

Explore Fleek Network’s core protocol, its architecture, and unique characteristics as a decentralized edge network.

- + \ No newline at end of file diff --git a/docs/tags/phases/index.html b/docs/tags/phases/index.html index d2b37c4c9..be8eed69e 100644 --- a/docs/tags/phases/index.html +++ b/docs/tags/phases/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "phases"

View All Tags

Testnet onboarding

Join Fleek's Testnet onboarding, follow Discord instructions to install and verify your node. Check live updates, attend community calls, and ensure node is setup correctly.

- + \ No newline at end of file diff --git a/docs/tags/pledge/index.html b/docs/tags/pledge/index.html index b728febf9..385e7f0c5 100644 --- a/docs/tags/pledge/index.html +++ b/docs/tags/pledge/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/ports/index.html b/docs/tags/ports/index.html index cf56c2767..6af107e01 100644 --- a/docs/tags/ports/index.html +++ b/docs/tags/ports/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "ports"

View All Tags

The Network

Explore Fleek Network’s core protocol, its architecture, and unique characteristics as a decentralized edge network.

- + \ No newline at end of file diff --git a/docs/tags/protocol/index.html b/docs/tags/protocol/index.html index 16c0494bf..41d9c2d39 100644 --- a/docs/tags/protocol/index.html +++ b/docs/tags/protocol/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "protocol"

View All Tags

The Network

Explore Fleek Network’s core protocol, its architecture, and unique characteristics as a decentralized edge network.

- + \ No newline at end of file diff --git a/docs/tags/repository/index.html b/docs/tags/repository/index.html index 44f89ce1b..070e9c2ed 100644 --- a/docs/tags/repository/index.html +++ b/docs/tags/repository/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/reputation/index.html b/docs/tags/reputation/index.html index c01a524b7..6c563118b 100644 --- a/docs/tags/reputation/index.html +++ b/docs/tags/reputation/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "reputation"

View All Tags

The Network

Explore Fleek Network’s core protocol, its architecture, and unique characteristics as a decentralized edge network.

- + \ No newline at end of file diff --git a/docs/tags/requirements/index.html b/docs/tags/requirements/index.html index 880f74271..19c300199 100644 --- a/docs/tags/requirements/index.html +++ b/docs/tags/requirements/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "requirements"

View All Tags

Requirements

The requirements for the server specifications on which the Fleek Network Node can be installed and run.

- + \ No newline at end of file diff --git a/docs/tags/rewards/index.html b/docs/tags/rewards/index.html index de1aebbaa..9bf986539 100644 --- a/docs/tags/rewards/index.html +++ b/docs/tags/rewards/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "rewards"

View All Tags

Token and economics

Explore the preliminary breakdown of the Fleek Network's FLK token distribution, its integral role in node operations, the balance of economic incentives, and potential adjustments in pre-mainnet phases.

- + \ No newline at end of file diff --git a/docs/tags/roadmap/index.html b/docs/tags/roadmap/index.html index 37dedc93f..4d39714a0 100644 --- a/docs/tags/roadmap/index.html +++ b/docs/tags/roadmap/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "Roadmap"

View All Tags

Roadmap

Fleek Network's high-level roadmap per stage. Devnet, Testnet, and Mainnet.

- + \ No newline at end of file diff --git a/docs/tags/rpc/index.html b/docs/tags/rpc/index.html index 55dd61cdf..eb8a012b0 100644 --- a/docs/tags/rpc/index.html +++ b/docs/tags/rpc/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "rpc"

View All Tags

The Network

Explore Fleek Network’s core protocol, its architecture, and unique characteristics as a decentralized edge network.

- + \ No newline at end of file diff --git a/docs/tags/rust-dependencies/index.html b/docs/tags/rust-dependencies/index.html index fda4d9a7a..73c142fab 100644 --- a/docs/tags/rust-dependencies/index.html +++ b/docs/tags/rust-dependencies/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "Rust dependencies"

View All Tags

Install

The Fleek Network Lightning CLI installation walkthrough

- + \ No newline at end of file diff --git a/docs/tags/sdk/index.html b/docs/tags/sdk/index.html index 3da799e3b..ff7d5fe8d 100644 --- a/docs/tags/sdk/index.html +++ b/docs/tags/sdk/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "sdk"

View All Tags

Services

Discover Fleek Network Services, modular software powered with the enhanced scalability and performance of edge networks.

- + \ No newline at end of file diff --git a/docs/tags/server/index.html b/docs/tags/server/index.html index b47b544bd..58bdf5fc9 100644 --- a/docs/tags/server/index.html +++ b/docs/tags/server/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "server"

View All Tags

Requirements

The requirements for the server specifications on which the Fleek Network Node can be installed and run.

- + \ No newline at end of file diff --git a/docs/tags/services/index.html b/docs/tags/services/index.html index de67c050d..0a7def5d2 100644 --- a/docs/tags/services/index.html +++ b/docs/tags/services/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "services"

View All Tags

Services

Discover Fleek Network Services, modular software powered with the enhanced scalability and performance of edge networks.

- + \ No newline at end of file diff --git a/docs/tags/snarks/index.html b/docs/tags/snarks/index.html index c8cb173ec..fc07a5dc2 100644 --- a/docs/tags/snarks/index.html +++ b/docs/tags/snarks/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

2 docs tagged with "snarks"

View All Tags

Delivery Acknowledgements

Dive into Fleek Network's Delivery Acknowledgements, immutable proofs of service delivery, and understand the role of SNARKs in them.

The Network

Explore Fleek Network’s core protocol, its architecture, and unique characteristics as a decentralized edge network.

- + \ No newline at end of file diff --git a/docs/tags/standards/index.html b/docs/tags/standards/index.html index 31944b805..e716debc6 100644 --- a/docs/tags/standards/index.html +++ b/docs/tags/standards/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/systemctl/index.html b/docs/tags/systemctl/index.html index 7ea9f29cf..88ad4641a 100644 --- a/docs/tags/systemctl/index.html +++ b/docs/tags/systemctl/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/systemd/index.html b/docs/tags/systemd/index.html index 9a409e051..3e63d2c9d 100644 --- a/docs/tags/systemd/index.html +++ b/docs/tags/systemd/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/testnet/index.html b/docs/tags/testnet/index.html index bffd0b0f7..6a869b494 100644 --- a/docs/tags/testnet/index.html +++ b/docs/tags/testnet/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "testnet"

View All Tags

Testnet onboarding

Join Fleek's Testnet onboarding, follow Discord instructions to install and verify your node. Check live updates, attend community calls, and ensure node is setup correctly.

- + \ No newline at end of file diff --git a/docs/tags/token/index.html b/docs/tags/token/index.html index 511754e48..7d7f62d5e 100644 --- a/docs/tags/token/index.html +++ b/docs/tags/token/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "token"

View All Tags

Token and economics

Explore the preliminary breakdown of the Fleek Network's FLK token distribution, its integral role in node operations, the balance of economic incentives, and potential adjustments in pre-mainnet phases.

- + \ No newline at end of file diff --git a/docs/tags/tokenomics/index.html b/docs/tags/tokenomics/index.html index e02bb2425..c93b747bb 100644 --- a/docs/tags/tokenomics/index.html +++ b/docs/tags/tokenomics/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "tokenomics"

View All Tags

Token and economics

Explore the preliminary breakdown of the Fleek Network's FLK token distribution, its integral role in node operations, the balance of economic incentives, and potential adjustments in pre-mainnet phases.

- + \ No newline at end of file diff --git a/docs/tags/toolkit/index.html b/docs/tags/toolkit/index.html index 54b217202..28228c27e 100644 --- a/docs/tags/toolkit/index.html +++ b/docs/tags/toolkit/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "toolkit"

View All Tags

Services

Discover Fleek Network Services, modular software powered with the enhanced scalability and performance of edge networks.

- + \ No newline at end of file diff --git a/docs/tags/verification/index.html b/docs/tags/verification/index.html index 989e4b8d1..b90fca647 100644 --- a/docs/tags/verification/index.html +++ b/docs/tags/verification/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/docs/tags/whitepaper/index.html b/docs/tags/whitepaper/index.html index a65919bc0..b7a4e4acb 100644 --- a/docs/tags/whitepaper/index.html +++ b/docs/tags/whitepaper/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

2 docs tagged with "whitepaper"

View All Tags

Introduction

Introduction to Fleek Network, a decentralized edge network. Learn its purpose, operation, and approach towards a decentralized infrastructure layer.

Whitepaper

Fleek Network's whitepaper and codebase.

- + \ No newline at end of file diff --git a/docs/tags/wizard/index.html b/docs/tags/wizard/index.html index 3e36fb8f0..0ddc29a1b 100644 --- a/docs/tags/wizard/index.html +++ b/docs/tags/wizard/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "wizard"

View All Tags

Install

The Fleek Network Lightning CLI installation walkthrough

- + \ No newline at end of file diff --git a/docs/whitepaper/index.html b/docs/whitepaper/index.html index e6c8e040c..130a1efeb 100644 --- a/docs/whitepaper/index.html +++ b/docs/whitepaper/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

This section provides in-depth documentation and materials about the Fleek Network technology stack.

Whitepaper

The whitepaper outlines the technology that makes the Fleek Network Edge Computing Platform possible. It illustrates the foundation that makes it possible to reimagine the user experience for Decentralized Web Services and how to develop a fairer economy and ecosystem in collaboration with humans.

The latest whitepaper is available on this page, and it describes the protocol architecture, general operation, and characteristics.

- + \ No newline at end of file diff --git a/guides/Node Operators/getting-started/index.html b/guides/Node Operators/getting-started/index.html index 42d45be0e..e0f5585f1 100644 --- a/guides/Node Operators/getting-started/index.html +++ b/guides/Node Operators/getting-started/index.html @@ -13,7 +13,7 @@ - + @@ -22,8 +22,8 @@

Getting started guide

Introduction

For this guide, we’ll have a simple look into how Fleek Network works in its current development phase and briefly share some of the core concepts like spinning up a node.

For those seeking advanced knowledge:

tip

If you find any typos in our documentation, feel free to provide us feedback or contribute by opening a PR in our repository here.

Pre-requisites

To follow the guide, you will need the following:

  • Familiarity with the command-line interface
  • Git

Need a quick Fleek Network TL;DR?

Fleek Network is an open-source edge computing platform to accelerate the development and execution of the next generation of web services.

The system is built on a distributed network of nodes, where services run within a fair and incentivized ecosystem constituted by an open community of developers and operators. It relies on blockchain technology at its core, allowing governance and token rewards as incentives for participation in serving the network.

Made by an open community that's free to operate nodes or build services without the need for approvals, permissions, or intermediaries. Or simply, consume Fleek Network resources on demand, from anywhere, provided by services running on the edge.

Applications, platforms and protocols build and utilize decentralized services on the Fleek Network to optimize performance and reduce dependency on typical centralized cloud providers and corporate infrastructure.

Developers can build faster and launch better products by offloading parts of the development stack to the edge to focus on core features for the value proposition of the services being developed.

To get started, install a Network Node in a supported Linux server, such as Debian or Ubuntu (latest) by utilizing our simple assisted installer to help onboard as quickly as possible.

tip

Our network is open to everyone, so you're more than welcome to join us anytime without any restrictions, permission or formalities. We'd be happy to have you as part of our community!

Once connected to the server, open a terminal window and execute the following command:

curl https://get.fleek.network | bash

Follow the install assistant recommendations to have the node ready without hassle and as quickly as possible.

Why is Fleek Network needed?

Web3 products typically rely on centralized cloud infrastructure, which is vulnerable to attacks as computation and data can be easily manipulated to suit business goals. However, blockchain technology has paved the way for a new era of decentralized cloud computing and data storage. The Fleek Network offers a sustainable alternative to traditional centralized architectures, providing a secure, transparent, and accessible decentralized edge computing future for everyone.

How Does Fleek Network Work?

When a client requests a service, the protocol determines the best route to the nodes where the service replicas and workload are allocated.

Once the computation is successful, the data streaming routes to the client. On-client request fulfillment, a proof of delivery is generated containing cryptographically secured metadata about the original request, any parts involved and the resources consumed.

The Delivery Acknowledgements are stored locally in the participating node memory pools, rolled up to the protocol consensus consistently throughout the Epoch. This agreement is formed by a random committee of any healthy Nodes that use the information provided to reward the Nodes fairly.

Running a Node

A Fleek Network node can be built and run on your machine. It’s an open-source project and is open for contributions.

The project is written with Rust, a general-purpose programming language that you need to have installed in advance to be able to follow the current guide.

tip

To set up Rust, packages and library dependencies can be tricky. The quickest is to visit the rustup.rs. Alternatively, if you haven't already, the build section has a manual installation document to help.

Clone the source code

We’ll clone the repository locally, build it and interact with the node through the binary or the HTTP JSON-RPC API with a client like cURL, but you can use a GUI (Postman, Insomnia, amongst others) if you prefer.

note

The ~/fleek-network/lightning or $HOME/fleek-network/lightning directory is the default or recommended location to store the repository. If you like to follow conventions, then is best to stick with the recommendation, to avoid confusion and make it easier to follow our documentation.

Start by cloning the repository located at https://github.com/fleek-network/lightning

tip

You have several ways of doing this:

  • Clone via HTTPS
  • Clone via SSH
  • Download via Github CLI
  • Download the zip package from the repository

We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this. Although, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it here.

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git <DIRECTORY-NAME>

At time of writing, we are checking the branch name testnet-alpha-1 that corresponds to the testnet phase. -Here's an example of what it'd look like when sticking to the recommended path location:

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning

Once the git clone completes, you’ll have the latest version at the time of cloning. You should use git to fetch or pull the latest versions consequently.

Dependencies

Install the required dependencies necessary for compiling general software and for our use-case Lightning CLI.

sudo apt-get install \
build-essential \
clang \
pkg-config \
libssl-dev \
gcc-multilib \
protobuf-compiler

Build

Start by changing the directory to the project directory where the source code is stored. If you have followed the recommended location that'll be ~/fleek-network/lightning, as follows:

cd ~/fleek-network/lightning

Run the Rust package manager clean and update commands.

cargo clean
cargo update

Next, execute the build command to compile the Fleek Network Lightning CLI binary.

cargo +stable build --release
tip

The build command uses the Rust compiler, which might take a while depending on how speedy the host machine is capable.

Once the Rust compiler completes, the generated binary will be available in the source code project directory. If you stick with the default, that'll look like ~/fleek-network/lightning/target/debug/lightning-node.

To avoid having to specify the pathname every time, create a symbolic link to keep it short. Here we'll name the process as the global lgtn:

sudo ln -s "~/fleek-network/lightning/target/debug/lightning-node" /usr/local/bin/lgtn

Run the CLI with the flag version to confirm it's available globally.

lgtn --version

The output should look like:

Usage: lgtn [OPTIONS] <COMMAND>

Commands:
run Start the node
keys Handle keys
print-config Print the loaded configuration
dev-init-only Initialize the node without starting it
dev-dump-graph Dump the infusion graph of the node instance
help Print this message or the help of the given subcommand(s)

Options:
-c, --config <CONFIG> Path to the toml configuration file [default: ~/.lightning/config.toml]
--with-mock-consensus Determines that we should be using the mock consensus backend
-v... Increases the level of verbosity (the max level is -vvv)
--log-location Print code location on console logs
-h, --help Print help
-V, --version Print version

Node Launch

After building, the node can be launched by running the subcommand run:

lgtn run
tip

It's highly recommend to use systemd to manage the Fleek Network service for node operators. Systemd is a system and service manager for Linux operating systems that provides a consistent way to manage system services across various distributions.

Learn how to create a new Systemd service in the manual installation document.

Health check

It's important for Node operators to regularly check on the health of their resources to make sure everything is running smoothly. By doing this, they can get helpful feedback and know for sure if their Node is up and running. Some experienced node operators even automate this process using cronjobs and get reports sent to them via email or other custom methods.

curl -w "\n" localhost:4230/health

If everything goes well, the response should be:

OK

Alternatively, use the JSON-RPC method flk_ping:

curl -s \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "flk_ping",
"params": [],
"id": 1
}' \
localhost:4230/rpc/v0

Which response should return the key result with value pong:

{
"jsonrpc": "2.0",
"result": "pong",
"id": 1
}

Next steps

While you can run the Network Node as described here, it's required to set up the Network Node correctly and securely! It requires some degree of patience, knowledge and time to go through our guides, but we'll provide some guides and references to help you manage your network node server!

To avoid having to go through all the steps manually, we recommend reading our assisted installer document for quick onboarding.

Conclusion

We introduced Fleek Network as an open-source edge computing platform to help us accelerate the development and execution of the next generation of web services.

We have learned a bit about the importance of a decentralized edge computing network to reach and fulfill the future of computation and how the Fleek Network protocol works succinctly.

Furthermore, we guide you through a step-by-step installation of the network node process, where we pull the source code, build the binary and launch the service.

Finally, we do a quick health check to confirm the status of our node.

Discover more about the project by watching/contributing on GitHub, following us on Twitter, and joining our community Discord for any updates.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +Here's an example of what it'd look like when sticking to the recommended path location:

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning

Once the git clone completes, you’ll have the latest version at the time of cloning. You should use git to fetch or pull the latest versions consequently.

Dependencies

Install the required dependencies necessary for compiling general software and for our use-case Lightning CLI.

sudo apt-get install \
build-essential \
clang \
pkg-config \
libssl-dev \
gcc-multilib \
protobuf-compiler

Build

Start by changing the directory to the project directory where the source code is stored. If you have followed the recommended location that'll be ~/fleek-network/lightning, as follows:

cd ~/fleek-network/lightning

Run the Rust package manager clean and update commands.

cargo clean
cargo update

Next, execute the build command to compile the Fleek Network Lightning CLI binary.

cargo +stable build --release
tip

The build command uses the Rust compiler, which might take a while depending on how speedy the host machine is capable.

Once the Rust compiler completes, the generated binary will be available in the source code project directory. If you stick with the default, that'll look like ~/fleek-network/lightning/target/debug/lightning-node.

To avoid having to specify the pathname every time, create a symbolic link to keep it short. Here we'll name the process as the global lgtn:

sudo ln -s "~/fleek-network/lightning/target/debug/lightning-node" /usr/local/bin/lgtn

Run the CLI with the flag version to confirm it's available globally.

lgtn --version

The output should look like:

Usage: lgtn [OPTIONS] <COMMAND>

Commands:
run Start the node
keys Handle keys
print-config Print the loaded configuration
dev-init-only Initialize the node without starting it
dev-dump-graph Dump the infusion graph of the node instance
help Print this message or the help of the given subcommand(s)

Options:
-c, --config <CONFIG> Path to the toml configuration file [default: ~/.lightning/config.toml]
--with-mock-consensus Determines that we should be using the mock consensus backend
-v... Increases the level of verbosity (the max level is -vvv)
--log-location Print code location on console logs
-h, --help Print help
-V, --version Print version

Node Launch

After building, the node can be launched by running the subcommand run:

lgtn run
tip

It's highly recommend to use systemd to manage the Fleek Network service for node operators. Systemd is a system and service manager for Linux operating systems that provides a consistent way to manage system services across various distributions.

Learn how to create a new Systemd service in the manual installation document.

Health check

It's important for Node operators to regularly check on the health of their resources to make sure everything is running smoothly. By doing this, they can get helpful feedback and know for sure if their Node is up and running. Some experienced node operators even automate this process using cronjobs and get reports sent to them via email or other custom methods.

curl -w "\n" localhost:4230/health

If everything goes well, the response should be:

OK

Alternatively, use the JSON-RPC method flk_ping:

curl -s \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "flk_ping",
"params": [],
"id": 1
}' \
localhost:4230/rpc/v0

Which response should return the key result with value pong:

{
"jsonrpc": "2.0",
"result": "pong",
"id": 1
}

Next steps

While you can run the Network Node as described here, it's required to set up the Network Node correctly and securely! It requires some degree of patience, knowledge and time to go through our guides, but we'll provide some guides and references to help you manage your network node server!

To avoid having to go through all the steps manually, we recommend reading our assisted installer document for quick onboarding.

Conclusion

We introduced Fleek Network as an open-source edge computing platform to help us accelerate the development and execution of the next generation of web services.

We have learned a bit about the importance of a decentralized edge computing network to reach and fulfill the future of computation and how the Fleek Network protocol works succinctly.

Furthermore, we guide you through a step-by-step installation of the network node process, where we pull the source code, build the binary and launch the service.

Finally, we do a quick health check to confirm the status of our node.

Discover more about the project by watching/contributing on GitHub, following us on Twitter, and joining our community Discord for any updates.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/guides/Node Operators/managing-the-keystore/index.html b/guides/Node Operators/managing-the-keystore/index.html index cd5ead4c7..f8259fb63 100644 --- a/guides/Node Operators/managing-the-keystore/index.html +++ b/guides/Node Operators/managing-the-keystore/index.html @@ -13,15 +13,15 @@ - +
-

Managing the keystore

Introduction

Fleek Network incentivizes participation by rewarding its node providers. A node is identifiable by an identity, which the reward mechanism uses to identify the node to reward it.

info

At time of writing the rewards mechanism hasn't yet been introduced, read the testnet plans to get a high level perspective over the plans. A token and economics paper should be released in the future.

We'll use the term identity to describe the key store declared in the configuration, in our case PEM files. The content of the PEM files and the file itself should be kept secret.

The key store is in the file system and the location is defined in the Fleek Network ~/.lightning/config.toml, as a private key stored in an identity named PEM file (by default consensus.pem and node.pem). It's essential to understand this, as you may want to copy the identity to a new server setup, to persist the identity accross to the new server setup.

caution

Security is achieved by issuing users private cryptographic keys. Only the holder of the private key has access to sensitive information, such as an identity, which relates to reputation, rewards, etc. The security of the private key is the responsibility of the user. Unfortunately, Fleek Network is unable to help you regain access to your private key if you've lost or failed to secure it. The private keys are your responsibility.

The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you're migrating to.

Pre-requisites

To follow the guide, you will need the following:

Configuration file

Locating the file

The Lightning CLI has a configuration file in the home directory of the user, which by default is located in the path $HOME/.lightning or ~/.lightning under the name config.toml. It's generally described as ~/.lightning/config.toml.

tip

The tilde in ~/.lightning represents $HOME which is simpler, but we'll use $HOME to make it easy to follow.

If you're following the install recommendations you should be logged in with a sudoer account. For our guide, let's imagine that the sudoer username we are logged in with is lgtn.

tip

The word sudo is the abbreviation of the term "super user do". As the name suggests, it is the privilege that a super user, such as an administrator has to do whatever it wants in the system. A super user can be an administrator, like the root or what we described here as a user in the group sudo aka sudoer.

If you are logged in with a username, that'd be:

/home/<USERNAME>/.lightning/config.toml

For our example for user lgtn that is:

/home/lgtn/.lightning/config.toml

If you log in with another user, let's say fleek it'd be:

/home/fleek/.lightning/config.toml

At any time, you can check which user you are logged in with by running the command:

whoami

Here's an example of our user lgtn, which for the command above outputs:

lgtn
tip

To switch to a particular user, you can run the command su <USERNAME> e.g. for the user lgtn we would execute the command su lgtn.

Now that you know where to locate the configuration file for any given user you are logged in with, learn about the Configuration sections.

Configuration sections

The Fleek Network node configuration settings are located in the path $HOME/.lightning/config.toml, and it's organized by configuration sections.

At the time of writing, we have a TOML file with sections. Here are some examples amongst others:

  • application
  • origin-ipfs
  • rpc
  • signer

Each of the sections holds several property names and values. If you are accustomed to the JSON or YAML formats, you'll find the TOML format a bit similar (if you'd like to learn more about the TOML file format, read about it here).

By default, and at time of writing the Lightning CLI configuration file (config.toml) is similar to:

[BLANK]

[application]
db_path = "/home/lgtn/.lightning/data/app_db"
mode = "Prod"
storage = "RocksDb"
testnet = true

[blockserver]
address = "0.0.0.0:4211"

[broadcast]
address = "0.0.0.0:4200"

[consensus]
store_path = "/home/lgtn/.lightning/data/narwhal_store"

[dht]
address = "0.0.0.0:8101"
bootstrappers = []

[fetcher]

[fsstore]
root = "/home/lgtn/.lightning/blockstore"

[[handshake.transport]]
signal_address = "0.0.0.0:4210"
type = "WebRTC"

[[handshake.worker]]
type = "AsyncWorker"

[[handshake.worker]]
type = "AsyncWorker"

[[handshake.worker]]
type = "AsyncWorker"

[[handshake.worker]]
type = "AsyncWorker"

[[origin-ipfs.gateways]]
authority = "ipfs.io"
protocol = "Https"

[[origin-ipfs.gateways]]
authority = "fleek.ipfs.io"
protocol = "Https"

[[origin-ipfs.gateways]]
authority = "ipfs.runfission.com"
protocol = "Https"

[rep-collector]
reporter_buffer_size = 5

[resolver]
store_path = "/home/lgtn/.lightning/data/resolver_store"

[rpc]
addr = "0.0.0.0"
port = 4230

[service-executor]
services = [0, 1]

[signer]
consensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"
node_key_path = "/home/lgtn/.lightning/keystore/node.pem"

[topology]
testing_min_nodes = 9
testing_target_k = 8
tip

Beware that the configuration file might look a bit different depending on the version you're running and the current development features in place by the Fleek Network core team. You shouldn't copy the example above and replace with yours, as this only servers for illustrative purposes.

Some advanced use cases might require dealing with the host and port number binding, depending on the service provider's needs and customization. We'll keep things simple and assume the default settings.

In this guide, we are interested in the [signer] section settings for the consensus_key_path and node_key_path which by default is set to ~/.lightning/keystore.

tip

The identity is a text description for the Keystore and at the time of writing we have not yet implemented multiple identity management via the CLI. Thereupon, the identity value serves to find the filename match in the keystore_path. This might change as we progress with development. Check the Identity selection to learn more about it!

Type of keys

There are three types of keys related to the identity of a node and the account ownership. The keys are based in public-key cryptography, or asymmetric cryptography where each key pair consists of a public key and a corresponding private key. The keys are described in the section identity on the Fleek Network as follows:

  • A Node key (ConsensusPublicKey) is BLS12-381 which facilitates the consensus algorithm or persistence of state, resilience and fault tolerance. Has multi-signature support, the ability to aggregate many signatures into one used for consensus committee when signing certificates

  • A Node Networking key (NodePublicKey) is Ed25519 used for the speed and performance of the network communications

  • Account Owner keys are based on secp256k1, which corresponds to an Ethereum Address

For instance, a public key is open to anybody to see, and it represents a unique node identifier in the Fleek Network, a bit like a passport number. On the other hand, the private key is secret, and the operator is responsible to store it privately.

The Fleek Network relies on cryptography, thus the Fleek Network team and anybody can access, compromise or manipulate the secrets of an identity. On the other hand, the public key can be used by anyone, Fleek Network included, to identify a node or send rewards to the address without jeopardizing identity security.

To learn more about the identities on the Fleek Network here.

Key privacy

If you don’t keep your private keys secret, you'll have your node compromised.

Here are a few examples of what you should not do:

  • Share the $HOME/.lightning/keystore directory file content publicly
  • Track the $HOME/.lightning/keystore directory files in a version control repository e.g. git
  • Have poor "rights" permissions in UNIX systems e.g. everyone can read, delete, modify $HOME/.lightning
  • Allow anyone to access the node provider physically without any access control to the operating and file systems e.g. a VPS provider
  • Get rid of a hard drive unformatted or blind erased by selling to somebody or dumping in the bin, which contains $HOME/.lightning/keystore

There are many other ways of getting compromised, but hopefully, the ones put above give you a good starter into the subject.

Remember, the node provider is the only one responsible when managing the key store. Neither Fleek Network nor the most sophisticated AI system presently can compromise the cryptography in use to help you out. You are fully responsible for securing and retaining your private keys.

Identity selection

Multiple identity management is yet to be implemented but in any case, some users might find it trivial to keep multiple identities and switch between them referencing them by name. The following section is not advocating this approach but sharing some approaches that can help certain use-cases.

Let's suppose that we've recently moved to a new server setup and copied our previous server keystore keys as consensus.pem and node.pem and renamed the $HOME/.lightning/keystore/*.pem to $HOME/.lightning/keystore/new-*.pem.

tip

We are using a wildcard * to reduce verbosity. The wildcard means as replacement for all the filenames encountered in the path and extension without having to name them individually as we know they are consensus.pem and node.pem.

To illustrate this scenario, here's an example of how our $HOME/.lightning/keystore directory could look like:

.
├── new-consensus.pem
├── new-node.pem
└── old-consensus.pem
└── old-node.pem

0 directories, 4 file

The old-*.pem files are the original key store and new-*.pem could correspond to the new identity created while setting up the node in the new server.

Since we have [signer] set to the default values, in particular:

[signer]
consensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"
node_key_path = "/home/lgtn/.lightning/keystore/node.pem"

We'd be required to change and switch to the preferred keys. The identity is switch to the provided values once the node is restarted. Thus, we can switch to any identity by changing the [signer] consensus_key_path and node_key_path pathname values anytime as long we restart the server successfully.

To verify which keys are loaded by the Lightning CLI run the command:

lgtn keys show

You'd find the public keys in the output, which can be used for comparision and should be different everytime the configuration changes and reloaded. Here's an example of the output:

Node Public Key: RwPpr35H5AAfWwSDFxwYuJv5TA8PWUd2pdBg+UKsORc=
Consensus Public Key: s36g09qQzaaOJxi0UZDRCXj3HUUWjaGiYrQV6Ylo9Ih6jMvrnxM5s1OpBnsEj5R1AVYcuxlnVR+oyEjgJ3WpI5LOHSN1Q6Zur33vka3IachBEIKIbsiXMJW16vu4n4bG
tip

The PEM files can be named as you wish, but by default we like to keep it sound to avoid confusion and make it as clear as possible.

Backing up the keystore

When dealing with Fleek Network it's crucial to always be aware of the identity. You should backup private keys in case the unexpected happens, as it's impossible to recover the identity in any other way, including the core team, any other person or system.

Backing up your keystore pem files are crucial to ensure the safety and accessibility of your identity on the Fleek Network. For example, if your $HOME/.lightning is deleted you'll still be able to restore it if you have backed it up properly.

There are many ways to make identity backups, each with its own benefits and drawbacks. At risk of oversimplifying, we'll focus on a simple manual approach to expose some principles you should have awareness.

caution

The security is never stronger than its weakest link, and it is very likely that the weakest link is not the method itself. It's pointless to encrypt the backup archive with sophisticated methods when the passphrase is weak or of an easy guess.

None of the methods described here are being endorsed by the Fleek Network team use the knowledge provided here for educational purposes only and at your own risk.

Lower security

If you opt for the lowest level of security, you can use zip and unzip. The man page of zip described the encryption algorithm used to be weaker than PGP.

To zip and encrypto the $HOME/.lightning/keystore directory run:

# It'll prompt for password (remember)
zip --encrypt -r keystore.zip.enc $HOME/.lightning/keystore

To unzip and decrypt the keystore.zip.enc, you'd run:

# It'll prompt for password (recall)
unzip keystore.zip.enc -d $HOME/.lightning/keystore
tip

We provide the unzip destiny target to the flag -d. The unzip process outputs the files onto the desired location $HOME/.lightning/keystore, thus overriding any contents. If you have any files in the destiny target directory it'll be overriden, effectively replacing with the output of the unzipped directory content, so make sure you backup any files as required.

Higher security

Create a Tar archive, which will contain the target directory, files and the Tar stores all of the relative paths in the tarball itself.

Create a tarbar by executing:

tar -cf "keystore.tar" $HOME/.lightning/keystore

The keystore.tar should be in the current work directory.

Use gpg with the symmetric option, it creates the keys for that file and request a password to protect them. If you are familiar with asymmetric gpg, it's similar, but it's not signed with your public key or such.

The encryption command is:

sudo gpg -a --symmetric --cipher-algo AES256 keystore.tar

The keystore.tar.asc should be in the current work directory.

To decrypt the keystore.tar.asc file, enter:

sudo gpg -a --output keystore.tar --decrypt keystore.tar.asc

To extract the keystore.tar is simple, but be aware that it unarchives with the original directory structure, which might be a bit confusing. So, we'll create a new temporary directory for our example that will use to extract to.

mkdir $HOME/tar_keystore_extract

Now, run the command to extract to the target directory, as follows:

tar -xf keystore.tar -C $HOME/tar_keystore_extract

The /home/<username>/.lightning/keystore should be in the tar_keystore_extract directory where you'll find the PEM files.

Storage

The backup archive should only be accessible by yourself. If you decided to store it in a cloud storage provider, be aware of increased security risks. Cloud storage is convenient, but it ultimately puts data into the hands of others. If you're not particularly concerned, or have confidence about the encryption of the files, then that's at your own risk. But it's recommended to store in a physical hard drive that remains disconnected from computers and network devices.

caution

If you use cloud storage to store your sensitive data, encryption should be your first line of defense. Encrypting files before uploading them to the cloud is crucial to reduce others from accessing information without your permissions and knowledge.

Remember that the security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.

Loading keys on runtime

As described in the section configuration files the default location of the .lightning system configuration directory is $HOME/.lightning.

The $HOME/.lightning/config.toml holds the information of where the Lightning CLI node process should pull the keystore pem files. The location of the pem files can be placed anywhere the node process has permissions to read.

When unarchiving the backup files, the keystore directory or pem files should be placed in the directory declared in the $HOME/.lightning/config.toml. That is if the location is the one specified on the runtime–the command declared to launch and run the lightning service, that has the optional -c configuration flag that takes any custom location which overrides the default $HOME/.lightning/config.toml.

caution

On runtime, the Lightning service can have specified a configuration file in any readable location. If a configuration pathname isn't passed, it'll default to the $HOME/.lightning/config.toml. It's important to understand this to avoid confusion.

The service that starts with:

lgtn -c /root/custom-configuration.toml run

Can have complete different settings from any of the following:

lgtn -c /home/lgtn/.lightning/config.toml run
lgtn -c ~/.lightning/config.toml run
lgtn run

Due to the fact that any of the fails above might contain different settings declared in the file body.

For instance, we can imagine a scenario where our service is started with the command:

lgtn -c /home/lgtn/.lightning/config.toml run

Where the keystore is placed under the parent directory /home/lgtn/.lightning/. Resulting in the configuration file have the following settings for the hypothetical username lgtn:

[signer]
consensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"
node_key_path = "/home/lgtn/.lightning/keystore/node.pem"
tip

On the install instructions provided by the documentation, a Systemd service unit is recommended to allow the user control the Lightning service via systemctl. The Systemd service unit file should contain the recommended usage of -c configuration. If you have followed the recommendations it should be familiar.

Conclusion

We've walked through most basics of where the configuration file is located, the configuration settings we use to set up and run the node, the different configuration sections we have, and most importantly the identity section.

Additionally, a brief guide on the identity, more specifically an introduction to the type of keys and key privacy, which we find important to understand for anyone seriously interested in running a node by hinting into some system administration and security principles.

Separately, at risk of oversimpliying provided a brief introduction into the backup of the keystore directory.

In the future, we'll introduce more advanced topics that will help you improve the knowledge you get from this, but we are glad that you followed this guide and got some comprehension to help you manage the key store.

While we do our best to provide the clearest instructions, there's always space for improvement, therefore feel free to make any contributions by messaging us on our Discord or by opening a PR in any of our repositories.

Discover more about the project by watching/contributing on Github, following us on Twitter, and joining our community Discord for all the best updates!

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +

Managing the keystore

Introduction

Fleek Network incentivizes participation by rewarding its node providers. A node is identifiable by an identity, which the reward mechanism uses to identify the node to reward it.

info

At time of writing the rewards mechanism hasn't yet been introduced, read the testnet plans to get a high level perspective over the plans. A token and economics paper should be released in the future.

We'll use the term identity to describe the key store declared in the configuration, in our case PEM files. The content of the PEM files and the file itself should be kept secret.

The key store is in the file system and the location is defined in the Fleek Network ~/.lightning/config.toml, as a private key stored in an identity named PEM file (by default consensus.pem and node.pem). It's essential to understand this, as you may want to copy the identity to a new server setup, to persist the identity accross to the new server setup.

caution

Security is achieved by issuing users private cryptographic keys. Only the holder of the private key has access to sensitive information, such as an identity, which relates to reputation, rewards, etc. The security of the private key is the responsibility of the user. Unfortunately, Fleek Network is unable to help you regain access to your private key if you've lost or failed to secure it. The private keys are your responsibility.

The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you're migrating to.

Pre-requisites

To follow the guide, you will need the following:

Configuration file

Locating the file

The Lightning CLI has a configuration file in the home directory of the user, which by default is located in the path $HOME/.lightning or ~/.lightning under the name config.toml. It's generally described as ~/.lightning/config.toml.

tip

The tilde in ~/.lightning represents $HOME which is simpler, but we'll use $HOME to make it easy to follow.

If you're following the install recommendations you should be logged in with a sudoer account. For our guide, let's imagine that the sudoer username we are logged in with is lgtn.

tip

The word sudo is the abbreviation of the term "super user do". As the name suggests, it is the privilege that a super user, such as an administrator has to do whatever it wants in the system. A super user can be an administrator, like the root or what we described here as a user in the group sudo aka sudoer.

If you are logged in with a username, that'd be:

/home/<USERNAME>/.lightning/config.toml

For our example for user lgtn that is:

/home/lgtn/.lightning/config.toml

If you log in with another user, let's say fleek it'd be:

/home/fleek/.lightning/config.toml

At any time, you can check which user you are logged in with by running the command:

whoami

Here's an example of our user lgtn, which for the command above outputs:

lgtn
tip

To switch to a particular user, you can run the command su <USERNAME> e.g. for the user lgtn we would execute the command su lgtn.

Now that you know where to locate the configuration file for any given user you are logged in with, learn about the Configuration sections.

Configuration sections

The Fleek Network node configuration settings are located in the path $HOME/.lightning/config.toml, and it's organized by configuration sections.

At the time of writing, we have a TOML file with sections. Here are some examples amongst others:

  • application
  • origin-ipfs
  • rpc
  • signer

Each of the sections holds several property names and values. If you are accustomed to the JSON or YAML formats, you'll find the TOML format a bit similar (if you'd like to learn more about the TOML file format, read about it here).

By default, and at time of writing the Lightning CLI configuration file (config.toml) is similar to:

[BLANK]

[application]
db_path = "/home/lgtn/.lightning/data/app_db"
mode = "Prod"
storage = "RocksDb"
testnet = true

[blockserver]
address = "0.0.0.0:4211"

[broadcast]
address = "0.0.0.0:4200"

[consensus]
store_path = "/home/lgtn/.lightning/data/narwhal_store"

[dht]
address = "0.0.0.0:8101"
bootstrappers = []

[fetcher]

[fsstore]
root = "/home/lgtn/.lightning/blockstore"

[[handshake.transport]]
signal_address = "0.0.0.0:4210"
type = "WebRTC"

[[handshake.worker]]
type = "AsyncWorker"

[[handshake.worker]]
type = "AsyncWorker"

[[handshake.worker]]
type = "AsyncWorker"

[[handshake.worker]]
type = "AsyncWorker"

[[origin-ipfs.gateways]]
authority = "ipfs.io"
protocol = "Https"

[[origin-ipfs.gateways]]
authority = "fleek.ipfs.io"
protocol = "Https"

[[origin-ipfs.gateways]]
authority = "ipfs.runfission.com"
protocol = "Https"

[rep-collector]
reporter_buffer_size = 5

[resolver]
store_path = "/home/lgtn/.lightning/data/resolver_store"

[rpc]
addr = "0.0.0.0"
port = 4230

[service-executor]
services = [0, 1]

[signer]
consensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"
node_key_path = "/home/lgtn/.lightning/keystore/node.pem"

[topology]
testing_min_nodes = 9
testing_target_k = 8
tip

Beware that the configuration file might look a bit different depending on the version you're running and the current development features in place by the Fleek Network core team. You shouldn't copy the example above and replace with yours, as this only servers for illustrative purposes.

Some advanced use cases might require dealing with the host and port number binding, depending on the service provider's needs and customization. We'll keep things simple and assume the default settings.

In this guide, we are interested in the [signer] section settings for the consensus_key_path and node_key_path which by default is set to ~/.lightning/keystore.

tip

The identity is a text description for the Keystore and at the time of writing we have not yet implemented multiple identity management via the CLI. Thereupon, the identity value serves to find the filename match in the keystore_path. This might change as we progress with development. Check the Identity selection to learn more about it!

Type of keys

There are three types of keys related to the identity of a node and the account ownership. The keys are based in public-key cryptography, or asymmetric cryptography where each key pair consists of a public key and a corresponding private key. The keys are described in the section identity on the Fleek Network as follows:

  • A Node key (ConsensusPublicKey) is BLS12-381 which facilitates the consensus algorithm or persistence of state, resilience and fault tolerance. Has multi-signature support, the ability to aggregate many signatures into one used for consensus committee when signing certificates

  • A Node Networking key (NodePublicKey) is Ed25519 used for the speed and performance of the network communications

  • Account Owner keys are based on secp256k1, which corresponds to an Ethereum Address

For instance, a public key is open to anybody to see, and it represents a unique node identifier in the Fleek Network, a bit like a passport number. On the other hand, the private key is secret, and the operator is responsible to store it privately.

The Fleek Network relies on cryptography, thus the Fleek Network team and anybody can access, compromise or manipulate the secrets of an identity. On the other hand, the public key can be used by anyone, Fleek Network included, to identify a node or send rewards to the address without jeopardizing identity security.

To learn more about the identities on the Fleek Network here.

Key privacy

If you don’t keep your private keys secret, you'll have your node compromised.

Here are a few examples of what you should not do:

  • Share the $HOME/.lightning/keystore directory file content publicly
  • Track the $HOME/.lightning/keystore directory files in a version control repository e.g. git
  • Have poor "rights" permissions in UNIX systems e.g. everyone can read, delete, modify $HOME/.lightning
  • Allow anyone to access the node provider physically without any access control to the operating and file systems e.g. a VPS provider
  • Get rid of a hard drive unformatted or blind erased by selling to somebody or dumping in the bin, which contains $HOME/.lightning/keystore

There are many other ways of getting compromised, but hopefully, the ones put above give you a good starter into the subject.

Remember, the node provider is the only one responsible when managing the key store. Neither Fleek Network nor the most sophisticated AI system presently can compromise the cryptography in use to help you out. You are fully responsible for securing and retaining your private keys.

Identity selection

Multiple identity management is yet to be implemented but in any case, some users might find it trivial to keep multiple identities and switch between them referencing them by name. The following section is not advocating this approach but sharing some approaches that can help certain use-cases.

Let's suppose that we've recently moved to a new server setup and copied our previous server keystore keys as consensus.pem and node.pem and renamed the $HOME/.lightning/keystore/*.pem to $HOME/.lightning/keystore/new-*.pem.

tip

We are using a wildcard * to reduce verbosity. The wildcard means as replacement for all the filenames encountered in the path and extension without having to name them individually as we know they are consensus.pem and node.pem.

To illustrate this scenario, here's an example of how our $HOME/.lightning/keystore directory could look like:

.
├── new-consensus.pem
├── new-node.pem
└── old-consensus.pem
└── old-node.pem

0 directories, 4 file

The old-*.pem files are the original key store and new-*.pem could correspond to the new identity created while setting up the node in the new server.

Since we have [signer] set to the default values, in particular:

[signer]
consensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"
node_key_path = "/home/lgtn/.lightning/keystore/node.pem"

We'd be required to change and switch to the preferred keys. The identity is switch to the provided values once the node is restarted. Thus, we can switch to any identity by changing the [signer] consensus_key_path and node_key_path pathname values anytime as long we restart the server successfully.

To verify which keys are loaded by the Lightning CLI run the command:

lgtn keys show

You'd find the public keys in the output, which can be used for comparision and should be different everytime the configuration changes and reloaded. Here's an example of the output:

Node Public Key: RwPpr35H5AAfWwSDFxwYuJv5TA8PWUd2pdBg+UKsORc=
Consensus Public Key: s36g09qQzaaOJxi0UZDRCXj3HUUWjaGiYrQV6Ylo9Ih6jMvrnxM5s1OpBnsEj5R1AVYcuxlnVR+oyEjgJ3WpI5LOHSN1Q6Zur33vka3IachBEIKIbsiXMJW16vu4n4bG
tip

The PEM files can be named as you wish, but by default we like to keep it sound to avoid confusion and make it as clear as possible.

Backing up the keystore

When dealing with Fleek Network it's crucial to always be aware of the identity. You should backup private keys in case the unexpected happens, as it's impossible to recover the identity in any other way, including the core team, any other person or system.

Backing up your keystore pem files are crucial to ensure the safety and accessibility of your identity on the Fleek Network. For example, if your $HOME/.lightning is deleted you'll still be able to restore it if you have backed it up properly.

There are many ways to make identity backups, each with its own benefits and drawbacks. At risk of oversimplifying, we'll focus on a simple manual approach to expose some principles you should have awareness.

caution

The security is never stronger than its weakest link, and it is very likely that the weakest link is not the method itself. It's pointless to encrypt the backup archive with sophisticated methods when the passphrase is weak or of an easy guess.

None of the methods described here are being endorsed by the Fleek Network team use the knowledge provided here for educational purposes only and at your own risk.

Lower security

If you opt for the lowest level of security, you can use zip and unzip. The man page of zip described the encryption algorithm used to be weaker than PGP.

To zip and encrypto the $HOME/.lightning/keystore directory run:

# It'll prompt for password (remember)
zip --encrypt -r keystore.zip.enc $HOME/.lightning/keystore

To unzip and decrypt the keystore.zip.enc, you'd run:

# It'll prompt for password (recall)
unzip keystore.zip.enc -d $HOME/.lightning/keystore
tip

We provide the unzip destiny target to the flag -d. The unzip process outputs the files onto the desired location $HOME/.lightning/keystore, thus overriding any contents. If you have any files in the destiny target directory it'll be overriden, effectively replacing with the output of the unzipped directory content, so make sure you backup any files as required.

Higher security

Create a Tar archive, which will contain the target directory, files and the Tar stores all of the relative paths in the tarball itself.

Create a tarbar by executing:

tar -cf "keystore.tar" $HOME/.lightning/keystore

The keystore.tar should be in the current work directory.

Use gpg with the symmetric option, it creates the keys for that file and request a password to protect them. If you are familiar with asymmetric gpg, it's similar, but it's not signed with your public key or such.

The encryption command is:

sudo gpg -a --symmetric --cipher-algo AES256 keystore.tar

The keystore.tar.asc should be in the current work directory.

To decrypt the keystore.tar.asc file, enter:

sudo gpg -a --output keystore.tar --decrypt keystore.tar.asc

To extract the keystore.tar is simple, but be aware that it unarchives with the original directory structure, which might be a bit confusing. So, we'll create a new temporary directory for our example that will use to extract to.

mkdir $HOME/tar_keystore_extract

Now, run the command to extract to the target directory, as follows:

tar -xf keystore.tar -C $HOME/tar_keystore_extract

The /home/<username>/.lightning/keystore should be in the tar_keystore_extract directory where you'll find the PEM files.

Storage

The backup archive should only be accessible by yourself. If you decided to store it in a cloud storage provider, be aware of increased security risks. Cloud storage is convenient, but it ultimately puts data into the hands of others. If you're not particularly concerned, or have confidence about the encryption of the files, then that's at your own risk. But it's recommended to store in a physical hard drive that remains disconnected from computers and network devices.

caution

If you use cloud storage to store your sensitive data, encryption should be your first line of defense. Encrypting files before uploading them to the cloud is crucial to reduce others from accessing information without your permissions and knowledge.

Remember that the security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.

Loading keys on runtime

As described in the section configuration files the default location of the .lightning system configuration directory is $HOME/.lightning.

The $HOME/.lightning/config.toml holds the information of where the Lightning CLI node process should pull the keystore pem files. The location of the pem files can be placed anywhere the node process has permissions to read.

When unarchiving the backup files, the keystore directory or pem files should be placed in the directory declared in the $HOME/.lightning/config.toml. That is if the location is the one specified on the runtime–the command declared to launch and run the lightning service, that has the optional -c configuration flag that takes any custom location which overrides the default $HOME/.lightning/config.toml.

caution

On runtime, the Lightning service can have specified a configuration file in any readable location. If a configuration pathname isn't passed, it'll default to the $HOME/.lightning/config.toml. It's important to understand this to avoid confusion.

The service that starts with:

lgtn -c /root/custom-configuration.toml run

Can have complete different settings from any of the following:

lgtn -c /home/lgtn/.lightning/config.toml run
lgtn -c ~/.lightning/config.toml run
lgtn run

Due to the fact that any of the fails above might contain different settings declared in the file body.

For instance, we can imagine a scenario where our service is started with the command:

lgtn -c /home/lgtn/.lightning/config.toml run

Where the keystore is placed under the parent directory /home/lgtn/.lightning/. Resulting in the configuration file have the following settings for the hypothetical username lgtn:

[signer]
consensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"
node_key_path = "/home/lgtn/.lightning/keystore/node.pem"
tip

On the install instructions provided by the documentation, a Systemd service unit is recommended to allow the user control the Lightning service via systemctl. The Systemd service unit file should contain the recommended usage of -c configuration. If you have followed the recommendations it should be familiar.

Conclusion

We've walked through most basics of where the configuration file is located, the configuration settings we use to set up and run the node, the different configuration sections we have, and most importantly the identity section.

Additionally, a brief guide on the identity, more specifically an introduction to the type of keys and key privacy, which we find important to understand for anyone seriously interested in running a node by hinting into some system administration and security principles.

Separately, at risk of oversimpliying provided a brief introduction into the backup of the keystore directory.

In the future, we'll introduce more advanced topics that will help you improve the knowledge you get from this, but we are glad that you followed this guide and got some comprehension to help you manage the key store.

While we do our best to provide the clearest instructions, there's always space for improvement, therefore feel free to make any contributions by messaging us on our Discord or by opening a PR in any of our repositories.

Discover more about the project by watching/contributing on Github, following us on Twitter, and joining our community Discord for all the best updates!

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/guides/Node Operators/running-a-node-in-docker/index.html b/guides/Node Operators/running-a-node-in-docker/index.html index 7a7b0dfdb..afefa976d 100644 --- a/guides/Node Operators/running-a-node-in-docker/index.html +++ b/guides/Node Operators/running-a-node-in-docker/index.html @@ -13,17 +13,17 @@ - +
-

Running a node in Docker

Introduction

Our Docker image provides all the requirements to have Fleek Network running quickly and the following guide will provide you a quick reference to get you started with Docker.

Alternatively, if you need a deep dive into Docker, check the official getting started here.

TL;DR If you have Docker experience then you'll find our for the impatient sufficient to get started.

Pre-requisites

To follow the guide, you will need the following:

  • Familiarity with the command-line interface
  • Git

For the impatient

Building a Docker image requires some effort and some of our users might find it easier to pull our latest image for quick access to Lightning CLI, which doesn't require them to build from source.

tip

The Docker Container image for Lightning is located at https://github.com/fleek-network/lightning/pkgs/container/lightning.

Pull and run image

You can pull an run the Lightning pre-built Docker image from our GitHub and run the Docker container quickly by executing the following command:

sudo docker run \
-p 4230:4230 \
-p 4200:4200 \
-p 6969:6969 \
-p 18000:18000 \
-p 18101:18101 \
-p 18102:18102 \
--mount type=bind,source=$HOME/.lightning,target=/root/.lightning \
--name lightning-cli \
-it ghcr.io/fleek-network/lightning:latest

Keys have to be generated when launching the service. On Docker run, if the keystore is not found, the keys are automatically generated and stored in the Docker host's $HOME/.lightning/keystore directory. To learn more about how to manage the keystore, visit the managing keystore section.

warning

The Docker image is tied to a CPU architecture, make sure that you have verified the required specifications to run the container successfully.

tip

The command has a list of ports -p values that map ports in the container on the Docker host. While we try to keep the information across our documentation in sync with the latest changes or requirements e.g. port number changes, make sure that you check the section ports to find the latest updates.

Setup

Requirements

To follow the guide successfully, a good amount of memory and disk space is necessary to run Docker. The main reason for our use-case is that your host machine requires a generous amount of memory and disk space, for the containers.

For this guide, we used a server with the 4vCPU, 32 GB ram memory and 20 GB disk space specifications. Learn more about the recommended specifications here.

Create a user

We recommend creating a non-root user with administrative privileges. It'll allow us to install any system requirements.

You can create a new user and add to the sudo group by running:

tip

For our example, we'll be using the name lgtn but you can pick whichever you'd like. If you already have a sudoer account, you can skip this step.

sudo adduser lgtn

After completing the adduser steps, execute the usermod to add the user to the sudo group, as follows:

sudo usermod -aG sudo lgtn

Switch to the new user by using the command:

su lgtn

Change the directory to the new user's home, as follows:

cd /home/lgtn

Lightning CLI source code

Start by cloning the repository located at https://github.com/fleek-network/lightning.

tip

You have several ways of doing this:

  • Clone via HTTPS
  • Clone via SSH
  • Download via Github CLI
  • Download the zip package from the repository

We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this. +

Running a node in Docker

Introduction

Our Docker image provides all the requirements to have Fleek Network running quickly and the following guide will provide you a quick reference to get you started with Docker.

Alternatively, if you need a deep dive into Docker, check the official getting started here.

TL;DR If you have Docker experience then you'll find our for the impatient sufficient to get started.

Pre-requisites

To follow the guide, you will need the following:

  • Familiarity with the command-line interface
  • Git

For the impatient

Building a Docker image requires some effort and some of our users might find it easier to pull our latest image for quick access to Lightning CLI, which doesn't require them to build from source.

tip

The Docker Container image for Lightning is located at https://github.com/fleek-network/lightning/pkgs/container/lightning.

Pull and run image

You can pull an run the Lightning pre-built Docker image from our GitHub and run the Docker container quickly by executing the following command:

sudo docker run \
-p 4200-4299:4200-4299 \
-p 4300-4399:4300-4399 \
--mount type=bind,source=$HOME/.lightning,target=/root/.lightning \
--name lightning-cli \
-it ghcr.io/fleek-network/lightning:latest

Keys have to be generated when launching the service. On Docker run, if the keystore is not found, the keys are automatically generated and stored in the Docker host's $HOME/.lightning/keystore directory. To learn more about how to manage the keystore, visit the managing keystore section.

warning

The Docker image is tied to a CPU architecture, make sure that you have verified the required specifications to run the container successfully.

tip

The command has a list of ports -p values that map ports in the container on the Docker host. While we try to keep the information across our documentation in sync with the latest changes or requirements e.g. port number changes, make sure that you check the section ports to find the latest updates.

Setup

Requirements

To follow the guide successfully, a good amount of memory and disk space is necessary to run Docker. The main reason for our use-case is that your host machine requires a generous amount of memory and disk space, for the containers.

For this guide, we used a server with the 4vCPU, 32 GB ram memory and 20 GB disk space specifications. Learn more about the recommended specifications here.

Create a user

We recommend creating a non-root user with administrative privileges. It'll allow us to install any system requirements.

You can create a new user and add to the sudo group by running:

tip

For our example, we'll be using the name lgtn but you can pick whichever you'd like. If you already have a sudoer account, you can skip this step.

sudo adduser lgtn

After completing the adduser steps, execute the usermod to add the user to the sudo group, as follows:

sudo usermod -aG sudo lgtn

Switch to the new user by using the command:

su lgtn

Change the directory to the new user's home, as follows:

cd /home/lgtn

Lightning CLI source code

Start by cloning the repository located at https://github.com/fleek-network/lightning.

tip

You have several ways of doing this:

  • Clone via HTTPS
  • Clone via SSH
  • Download via Github CLI
  • Download the zip package from the repository

We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this. Although, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it here.

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git <DIRECTORY-NAME>

At time of writing, we are checking the branch name testnet-alpha-1 that corresponds to the testnet phase. -Here's an example of what it'd look like when sticking to the recommended path location:

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning

Change directory to Lightning source code

If you have cloned the project correctly, you should change directory to the project source code directory which by default is ~/fleek-network/lightning.

cd ~/fleek-network/lightning

At time of writing, this is how the project root looks like (e.g. use the ls to see the list):

.
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Cargo.lock
├── Cargo.toml
├── Dockerfile
├── LICENSE
├── README.md
├── codecov.yml
├── core
├── docs
├── etc
├── lib
├── rust-toolchain
├── rustfmt.toml
├── services
└── target

Install Docker

tip

To keep our guide short, we're using Ubuntu Linux. You'll have to make the required tweaks for your preferred Linux Distro. Find the list of support operating systems here.

First, update the existing list of packages:

sudo apt update

Next, install the required packages to let apt use packages over HTTPS:

sudo apt install apt-transport-https ca-certificates software-properties-common

Add the GPG key for the official Docker repository to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the Docker repository to apt sources and update the package database with the Docker packages from the new added repository:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable"

Set to install from the Docker repo instead of the default Ubuntu repo:

apt-cache policy docker-ce
docker-ce:
Installed: (none)
Candidate: 5:24.0.6-1~ubuntu.22.04~jammy
Version table:
5:24.0.6-1~ubuntu.22.04~jammy 500
500 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
5:24.0.6-1~ubuntu.22.04~jammy 500

Finally, install Docker:

sudo apt install docker-ce

Once complete you should be able to run it via the CLI, as such:

docker -v

Here's the output (versions might differ a bit from the time of writing):

Docker version 24.0.6, build ed223bc

The following command's output will indicate if Docker's working correctly:

sudo docker run hello-world

Here's an example of the output you'll find us "Hello from Docker!":

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

Run all the commands above in your terminal, to confirm everything's working before proceeding to the next steps.

Create the Docker image

A Docker image is a read-only template with instructions for creating a Docker container, like a template. Docker images also act as a starting point when using Docker.

The starting point for our use-case is a Dockerfile, where all those "template instructions" are declared.

A Dockerfile should exist in the repository source code, so make sure you have chage directory to the lightning source code to find it.

Build the Docker image

Build the image named as lightning from our Dockerfile:

sudo docker build -t lightning -f ./Dockerfile .

The build process takes awhile and you have to wait for completion.

The output should be similar to:

[+] Building 1.2s (16/16) FINISHED                                                                                                     docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 990B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/debian:bullseye-slim 0.6s
=> [internal] load metadata for docker.io/library/rust:latest 0.9s
=> [stage-1 1/3] FROM docker.io/library/debian:bullseye-slim@sha256:3bc5e94a0e8329c102203c3f5f26fd67835f0c81633dd6949de0557867a87fac 0.0s
=> [builder 1/7] FROM docker.io/library/rust:latest@sha256:8a4ca3ca75afbc97bcf5362e9a694fe049d15734fbbaf82b8b7e224616c1254b 0.0s
=> [internal] load build context 0.3s
=> => transferring context: 948.93kB 0.3s
=> CACHED [stage-1 2/3] RUN DEBIAN_FRONTEND=noninteractive apt-get update -yq && DEBIAN_FRONTEND=noninteractive apt-get install -yq libs 0.0s
=> CACHED [builder 2/7] WORKDIR /lightning 0.0s
=> CACHED [builder 3/7] RUN apt-get update 0.0s
=> CACHED [builder 4/7] RUN apt-get install -y build-essential cmake clang pkg-config libssl-dev gcc protobuf-comp 0.0s
=> CACHED [builder 5/7] RUN --mount=type=cache,target=/usr/local/cargo/registry cargo install cargo-strip 0.0s
=> CACHED [builder 6/7] COPY . . 0.0s
=> CACHED [builder 7/7] RUN --mount=type=cache,target=/usr/local/cargo/registry --mount=type=cache,target=/lightning/target cargo buil 0.0s
=> CACHED [stage-1 3/3] COPY --from=builder /lightning/target/release/lightning-node /usr/local/bin/lgtn 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:e8e5ed19f59c3cc6a9add5bdb578c464904e9789d5f386cc4af81044c062d998 0.0s
=> => naming to docker.io/library/lightning
tip

The Docker image is only required to be built once and/or, when changes are pulled from the remote repository, or specific versions you might be interested in. Otherwise, you're not required to build it everytime to run the node. If you'd like to learn how to update the Lightning CLI, find our references here.

caution

If you don't update your source code and binary build often, you won't have the latest changes, which should happen frequently to take advandate of all the ongoing development. This is quite important to understand, as it causes confusion to some users. The Lightning application at time of writing does not update automatically.

Docker Container

A container is what's originated from the image we discussed in the section build the docker image, it is a runnable instance of an image. We can create, start, stop, move, or delete a container using the Docker API or CLI.

Following up, we'll learn how to run the Docker container that includes our Lightning CLI program, built from our Dockerfile.

Once the Docker image is ready, run the container based on the image lightning. Effectively running the Fleek Network Lighthing node process:

sudo docker run \
-p 4230:4230 \
-p 4200:4200 \
-p 6969:6969 \
-p 18000:18000 \
-p 18101:18101 \
-p 18102:18102 \
--mount type=bind,source=$HOME/.lightning,target=/root/.lightning \
--name lightning-cli \
-it lightning
tip

Notice that the command arguments we pass are for the flag's -p port numbers, -v to bind mount a location in your host to a container path (useful to persist your configuration files, e.g. keystore), --name to make it easier to identify, -it to make it interactive (e.g. presents output to the terminal), and the image name we built earlier.

The output would look as the following, showing the error message "Node is not whitelisted" (this error message is due to the testnet phase that requires nodes to be whitelisted to run successfully):

thread 'main' panicked at 'Node is not whitelisted. Please join the Fleek Discord to get invited.', core/cli/src/testnet_sync.rs:45:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
/root/init: line 7: 7 Aborted (core dumped) lgtn run

Keys have to be generated when launching the service. On Docker run, if the keystore is not found, the keys are automatically generated and stored in the Docker host's $HOME/.lightning/keystore directory.

tip

Have in mind that the $HOME/.lightning/config.toml is where the keystore location paths are configured, which default value is in the user $HOME path. The users who customize or modify the default location, need to apply the required customizations. To learn more about how to manage the keystore, visit the managing keystore section.

Generate keys

Execute the keys generate command on the container lightning-cli:

sudo docker exec -it lightning-cli lgtn keys generate

We've bound the host path ~/.lightning into the container /root/.lightning.

You can list the contents of the ~/.lightning, where you should find the config.toml and keystore:

.
..
config.toml
keystore

You only have to run the keys generate once from your host.

Finaly, you can start the Fleek Network node by running the command:

sudo docker start lightning-cli

Run the Docker Container as Systemd Service

In this section we’ll cover how to wrap a Docker Container as a Systemd Service without the need for third party tools or complex commands. Some reasons include, minimizing the dependency on the Docker Daemon as we can move to a OCI complaint solution other that Docker at anytime, or the fact we recommend Systemd Service Units and Systemctl to control the Service in our Native install that most users are familiar.

tip

Docker recommends using their cross-platform built-in restart policy for running a Container as a Service. For that, configure your Docker service to start on system boot.

Systemd was specifically developed to serve the purpose of stopping services, dependency checking and recovery of failed services. You can have your host start, stop, enable, check the status, and generally manage a container as a Systemd Service.

Create the Systemd Service Unit

We are going to create the unit configuration file in the /etc/systemd/system/ directory. The Service Unit is going to be named as docker-lightning.service. To create the file run the following command:

sudo touch /etc/systemd/system/docker-lightning.service

Open the file in your favorite text editor and populate with the content found here:

[Unit]
Description=Fleek Network Node lightning service
After=docker.service
Requires=docker.service

[Service]
Restart=always
RestartSec=5
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill lightning-cli
ExecStartPre=-/usr/bin/docker rm lightning-cli
ExecStartPre=/usr/bin/docker pull ghcr.io/fleek-network/lightning:latest
ExecStart=/usr/bin/docker run -p 4230:4230 -p 4200:4200 -p 6969:6969 -p 18000:18000 -p 18101:18101 -p 18102:18102 --mount type=bind,source=/home/skywalker/.lightning,target=/root/.lightning --name lightning-cli ghcr.io/fleek-network/lightning:latest
ExecStop=/usr/bin/docker stop
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log

[Install]
WantedBy=multi-user.target

Once the file is saved, change the file permissions by running the command:

sudo chmod 644 /etc/systemd/system/docker-lightning.service

Next, reload the Systemctl Daemon:

sudo systemctl daemon-reload

Enable the service on startup when the system boots:

sudo systemctl enable docker-lightning.service

As a result, we are now able to run our containers as a Systemd service. For this, read the document manage systemd service to find more about how to control the service.

Viewing logs

To view the logs of a Docker container in real time, use the following command:

sudo docker logs -f lightning-cli

If you have wrapped the docker container as a systemd service, you can use the same commands found when installed natively, such as:

For standard output:

tail -f /var/log/lightning/output.log

Or, the standard error:

tail -f /var/log/lightning/diagnostic.log

Learn more about how to analyze log messages.

Conclusion

Containers are a way to have a self-contained environment that includes all necessary dependencies, libraries, software, amongst others required to run an application.

Fleek Network's Lightning is developed with Rust, a general-purpose programming language, that requires several dependencies and libraries to compile the project. Some of these libraries are not installed by default and require some troubleshooting for the end user. Docker provides us with containers, self-containing all the required libraries for the purpose of running Lightning, our application.

We guided you through the initial installation steps, and how to build a Docker image, which then's used to Docker run a container. Plus, provided lower-level commands, to help you understand other present or advanced use-cases, and also at higher level, offerring simple utility methods.

While we do our best to provide the clearest instructions, there's always space for improvement, therefore feel free to make any contributions by messaging us on our Discord or by opening a PR in any of our repositories.

Discover more about the project by watching/contributing on Github, following us on Twitter, and joining our community Discord for all the best updates!

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +Here's an example of what it'd look like when sticking to the recommended path location:

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning

Change directory to Lightning source code

If you have cloned the project correctly, you should change directory to the project source code directory which by default is ~/fleek-network/lightning.

cd ~/fleek-network/lightning

At time of writing, this is how the project root looks like (e.g. use the ls to see the list):

.
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Cargo.lock
├── Cargo.toml
├── Dockerfile
├── LICENSE
├── README.md
├── codecov.yml
├── core
├── docs
├── etc
├── lib
├── rust-toolchain
├── rustfmt.toml
├── services
└── target

Install Docker

tip

To keep our guide short, we're using Ubuntu Linux. You'll have to make the required tweaks for your preferred Linux Distro. Find the list of support operating systems here.

First, update the existing list of packages:

sudo apt update

Next, install the required packages to let apt use packages over HTTPS:

sudo apt install apt-transport-https ca-certificates software-properties-common

Add the GPG key for the official Docker repository to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the Docker repository to apt sources and update the package database with the Docker packages from the new added repository:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable"

Set to install from the Docker repo instead of the default Ubuntu repo:

apt-cache policy docker-ce
docker-ce:
Installed: (none)
Candidate: 5:24.0.6-1~ubuntu.22.04~jammy
Version table:
5:24.0.6-1~ubuntu.22.04~jammy 500
500 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages
5:24.0.6-1~ubuntu.22.04~jammy 500

Finally, install Docker:

sudo apt install docker-ce

Once complete you should be able to run it via the CLI, as such:

docker -v

Here's the output (versions might differ a bit from the time of writing):

Docker version 24.0.6, build ed223bc

The following command's output will indicate if Docker's working correctly:

sudo docker run hello-world

Here's an example of the output you'll find us "Hello from Docker!":

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

Run all the commands above in your terminal, to confirm everything's working before proceeding to the next steps.

Create the Docker image

A Docker image is a read-only template with instructions for creating a Docker container, like a template. Docker images also act as a starting point when using Docker.

The starting point for our use-case is a Dockerfile, where all those "template instructions" are declared.

A Dockerfile should exist in the repository source code, so make sure you have chage directory to the lightning source code to find it.

Build the Docker image

Build the image named as lightning from our Dockerfile:

sudo docker build -t lightning -f ./Dockerfile .

The build process takes awhile and you have to wait for completion.

The output should be similar to:

[+] Building 1.2s (16/16) FINISHED                                                                                                     docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 990B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/debian:bullseye-slim 0.6s
=> [internal] load metadata for docker.io/library/rust:latest 0.9s
=> [stage-1 1/3] FROM docker.io/library/debian:bullseye-slim@sha256:3bc5e94a0e8329c102203c3f5f26fd67835f0c81633dd6949de0557867a87fac 0.0s
=> [builder 1/7] FROM docker.io/library/rust:latest@sha256:8a4ca3ca75afbc97bcf5362e9a694fe049d15734fbbaf82b8b7e224616c1254b 0.0s
=> [internal] load build context 0.3s
=> => transferring context: 948.93kB 0.3s
=> CACHED [stage-1 2/3] RUN DEBIAN_FRONTEND=noninteractive apt-get update -yq && DEBIAN_FRONTEND=noninteractive apt-get install -yq libs 0.0s
=> CACHED [builder 2/7] WORKDIR /lightning 0.0s
=> CACHED [builder 3/7] RUN apt-get update 0.0s
=> CACHED [builder 4/7] RUN apt-get install -y build-essential cmake clang pkg-config libssl-dev gcc protobuf-comp 0.0s
=> CACHED [builder 5/7] RUN --mount=type=cache,target=/usr/local/cargo/registry cargo install cargo-strip 0.0s
=> CACHED [builder 6/7] COPY . . 0.0s
=> CACHED [builder 7/7] RUN --mount=type=cache,target=/usr/local/cargo/registry --mount=type=cache,target=/lightning/target cargo buil 0.0s
=> CACHED [stage-1 3/3] COPY --from=builder /lightning/target/release/lightning-node /usr/local/bin/lgtn 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:e8e5ed19f59c3cc6a9add5bdb578c464904e9789d5f386cc4af81044c062d998 0.0s
=> => naming to docker.io/library/lightning
tip

The Docker image is only required to be built once and/or, when changes are pulled from the remote repository, or specific versions you might be interested in. Otherwise, you're not required to build it everytime to run the node. If you'd like to learn how to update the Lightning CLI, find our references here.

caution

If you don't update your source code and binary build often, you won't have the latest changes, which should happen frequently to take advandate of all the ongoing development. This is quite important to understand, as it causes confusion to some users. The Lightning application at time of writing does not update automatically.

Docker Container

A container is what's originated from the image we discussed in the section build the docker image, it is a runnable instance of an image. We can create, start, stop, move, or delete a container using the Docker API or CLI.

Following up, we'll learn how to run the Docker container that includes our Lightning CLI program, built from our Dockerfile.

Once the Docker image is ready, run the container based on the image lightning. Effectively running the Fleek Network Lighthing node process:

sudo docker run \
-p 4200-4299:4200-4299 \
-p 4300-4399:4300-4399 \
--mount type=bind,source=$HOME/.lightning,target=/root/.lightning \
--name lightning-cli \
-it lightning
tip

Notice that the command arguments we pass are for the flag's -p port numbers, -v to bind mount a location in your host to a container path (useful to persist your configuration files, e.g. keystore), --name to make it easier to identify, -it to make it interactive (e.g. presents output to the terminal), and the image name we built earlier.

The output would look as the following, showing the error message "Node is not whitelisted" (this error message is due to the testnet phase that requires nodes to be whitelisted to run successfully):

thread 'main' panicked at 'Node is not whitelisted. Please join the Fleek Discord to get invited.', core/cli/src/testnet_sync.rs:45:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
/root/init: line 7: 7 Aborted (core dumped) lgtn run

Keys have to be generated when launching the service. On Docker run, if the keystore is not found, the keys are automatically generated and stored in the Docker host's $HOME/.lightning/keystore directory.

tip

Have in mind that the $HOME/.lightning/config.toml is where the keystore location paths are configured, which default value is in the user $HOME path. The users who customize or modify the default location, need to apply the required customizations. To learn more about how to manage the keystore, visit the managing keystore section.

Generate keys

Execute the keys generate command on the container lightning-cli:

sudo docker exec -it lightning-cli lgtn keys generate

We've bound the host path ~/.lightning into the container /root/.lightning.

You can list the contents of the ~/.lightning, where you should find the config.toml and keystore:

.
..
config.toml
keystore

You only have to run the keys generate once from your host.

Finaly, you can start the Fleek Network node by running the command:

sudo docker start lightning-cli

Run the Docker Container as Systemd Service

In this section we’ll cover how to wrap a Docker Container as a Systemd Service without the need for third party tools or complex commands. Some reasons include, minimizing the dependency on the Docker Daemon as we can move to a OCI complaint solution other that Docker at anytime, or the fact we recommend Systemd Service Units and Systemctl to control the Service in our Native install that most users are familiar.

tip

Docker recommends using their cross-platform built-in restart policy for running a Container as a Service. For that, configure your Docker service to start on system boot.

Systemd was specifically developed to serve the purpose of stopping services, dependency checking and recovery of failed services. You can have your host start, stop, enable, check the status, and generally manage a container as a Systemd Service.

Create the Systemd Service Unit

We are going to create the unit configuration file in the /etc/systemd/system/ directory. The Service Unit is going to be named as docker-lightning.service. To create the file run the following command:

sudo touch /etc/systemd/system/docker-lightning.service

Open the file in your favorite text editor and populate with the content found here:

[Unit]
Description=Fleek Network Node lightning service
After=docker.service
Requires=docker.service

[Service]
Restart=always
RestartSec=5
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill lightning-cli
ExecStartPre=-/usr/bin/docker rm lightning-cli
ExecStartPre=/usr/bin/docker pull ghcr.io/fleek-network/lightning:latest
ExecStart=/usr/bin/docker run -p 4200-4299:4200-4299 -p 4300-4399:4300-4399 --mount type=bind,source=/home/skywalker/.lightning,target=/root/.lightning --name lightning-cli ghcr.io/fleek-network/lightning:latest
ExecStop=/usr/bin/docker stop
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log

[Install]
WantedBy=multi-user.target

Once the file is saved, change the file permissions by running the command:

sudo chmod 644 /etc/systemd/system/docker-lightning.service

Next, reload the Systemctl Daemon:

sudo systemctl daemon-reload

Enable the service on startup when the system boots:

sudo systemctl enable docker-lightning.service

As a result, we are now able to run our containers as a Systemd service. For this, read the document manage systemd service to find more about how to control the service.

Viewing logs

To view the logs of a Docker container in real time, use the following command:

sudo docker logs -f lightning-cli

If you have wrapped the docker container as a systemd service, you can use the same commands found when installed natively, such as:

For standard output:

tail -f /var/log/lightning/output.log

Or, the standard error:

tail -f /var/log/lightning/diagnostic.log

Learn more about how to analyze log messages.

Conclusion

Containers are a way to have a self-contained environment that includes all necessary dependencies, libraries, software, amongst others required to run an application.

Fleek Network's Lightning is developed with Rust, a general-purpose programming language, that requires several dependencies and libraries to compile the project. Some of these libraries are not installed by default and require some troubleshooting for the end user. Docker provides us with containers, self-containing all the required libraries for the purpose of running Lightning, our application.

We guided you through the initial installation steps, and how to build a Docker image, which then's used to Docker run a container. Plus, provided lower-level commands, to help you understand other present or advanced use-cases, and also at higher level, offerring simple utility methods.

While we do our best to provide the clearest instructions, there's always space for improvement, therefore feel free to make any contributions by messaging us on our Discord or by opening a PR in any of our repositories.

Discover more about the project by watching/contributing on Github, following us on Twitter, and joining our community Discord for all the best updates!

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/guides/Node Operators/transfering-setup-ownership/index.html b/guides/Node Operators/transfering-setup-ownership/index.html index b08a1deb4..37fba7f3b 100644 --- a/guides/Node Operators/transfering-setup-ownership/index.html +++ b/guides/Node Operators/transfering-setup-ownership/index.html @@ -13,15 +13,15 @@ - +
-

Transfering setup ownership

TL;DR

tip

The step-by-step instructions provided in the guide should be simple to follow, but the process is also available as an automated script from our familiar get.fleek.network tool.

To use the automated script execute the following command in your server terminal and follow the instructions:

curl -sS https://get.fleek.network/transfer_system_user_setup_ownership | bash

We try to make the auomated scripts as useful as possible, but it's impossible to fit every single use-case. So, if you find any isses or have feedback to help us improve message us through our Discord.

Introduction

Our Lightning CLI and Node process is run by a user, that has some sort of permissions–some users run it as a super user (root) which is questionable as root privileges are not a necessary good. We'll look into how to create a user to manage and control the Fleek Network Lightning CLI and Systemd unit service. Also, presents the concept of file permissions and ownership which is crucial in preventing private or sensitive data from being exposed to dodgy actors.

Let's discuss the topic and open up a few ideas to help us improve the security of our server.

Pre-requisites

To follow the guide, you will need the following:

  • Familiarity with the command-line interface
  • Have installed and set up the Lightning CLI and service

Ownership of Lightning CLI files

The user who installs the Lightning CLI and sets the Service takes an important role that determines the location of the configuration files, the setup, and how the Systemd service is managed or controlled.

Our install document recommends creating a user and switching to the user to set up the service. You shouldn't want installed applications to run with elevated privileges. Applications are meant to be run with non-administrative privileges. If an application requires higher privileges, the administrator, such as a sudoer should be able to elevate it. An application that has full access and control of a system can modify it in harmful ways, e.g. compromise the private keys.

For our guide, we'll illustrate the process of migration from a super user (root) to another user (sudo). The knowledge should be easily appliable for any other user-to-user migration. We stick with root user for simplicity and because that's the most common use case.

tip

A reference document about File permissions and ownership is available that explains how it works practically, by showcasing how the process can be started, how the node process locates the Keystore, etc.

Systemd Service

In systemd, a unit refers to any resource that the system knows how to operate on and manage. This is the primary object that the systemd tools know how to deal with. These resources are defined using configuration files called unit files.

The recommended installation process features a systemd.service which is a resource that the system knows how to operate and manage by an administrator user.

tip

When using a Systemd service to run a process, it operates comparably to running it directly. The key difference is that Systemd keeps track of all the processes and threads that are spawned. This means that when a service is stopped using systemctl, such as the Fleek Network Lightning Node service, all the child processes that were started by the service are also terminated. Additionally, by utilizing Systemd, a user can run the process in the background and configure it to start automatically on system startup.

If you have followed the installation recommendations, find the systemd service unit in the location /etc/systemd/system/lightning.service (we are using Ubuntu Linux as an example to keep it short).

Make sure that you have set up a Systemd unit service, as recommended during the installation as this guide assumes you have one setup.

Stop the service

Before we proceed with any changes required for the migration, you'll have to stop the lightning.service.

systemctl stop lightning
note

For this guide, we are assuming that you are migrating ownership from root to a sudoer user. If not, you might be required to elevate privileges as sudo** where required. For example, sudo systemctl stop lightning.

Clear the .lightning data

Run the following command to clear the /root/.lightning/data, as it can be quite large, and we don't need to move it.

sudo rm -rf /root/.lightning/data

Create a user

We recommend creating a non-root user with administrative privileges. It'll allow us to install any system requirements.

You can create a new user and add to the sudo group by running:

tip

For our example, we'll be using the name lgtn but you can pick whichever you'd like. If you already have a sudoer account, you can skip this step.

sudo adduser lgtn

After completing the adduser steps, execute the usermod to add the user to the sudo group, as follows:

sudo usermod -aG sudo lgtn

Switch to the new user by using the command:

su lgtn

Change the directory to the new user's home, as follows:

cd /home/lgtn

Move lightning system and source code directory to user's home

A user should've been created, added the user to the sudo group, switched to the user, and changed the directory to the user's home.

Run the command pwd:

pwd

The output would look like:

/home/<USERNAME>

Given the username lgtn:

/home/lgtn

You'll then move two directories:

  • The /root/.lightning
  • The source code under the parent /root/fleek-network

1) Move the /root/.lightning directory from one user to the other

For our demo, we have assumed root user to sudoer user named lgtn, thus that'll look like this:

sudo mv /root/.lightning /home/lgtn/

2) Move the /root/fleek-network directory from one user to the other

sudo mv /root/fleek-network /home/lgtn/

3) Confirm move by finding both directories

In the user $HOME directory, you should be able to list the content of the directory and find the .lightning and fleek-network directory.

ls -la

The output should be similar to the following.

drwxr-x--- 6 lgtn lgtn  4096 Sep 12 13:51 .
drwxr-xr-x 3 root root 4096 Sep 11 12:28 ..
drwxrwxr-x 5 root root 4096 Sep 11 15:25 .lightning
drwxrwxr-x 3 root root 4096 Sep 11 12:28 fleek-network

Change ownership of files

Once the directories and files are moved, they should have the wrong ownership, which should be set to root:root. We'll now have to change the ownership of the directories and files recursively.

Change the ownership of /home/lgtn/.lightning to the user lgtn as follows:

sudo chown -R lgtn:lgtn .lightning
tip

Make sure that you use the -R flag to have the ownership changes applied to the parent, the child directories and all the files.

Change the ownership of /home/lgtn/fleek-network to the user lgtn as follows:

sudo chown -R lgtn:lgtn fleek-network

Once completed, if you list the content of the directory the ownership should have changed from root:root to lgtn:lgtn.

ls -la

The output should be similar to the following.

drwxr-x--- 6 lgtn lgtn  4096 Sep 12 13:51 .
drwxr-xr-x 3 root root 4096 Sep 11 12:28 ..
drwxrwxr-x 5 lgtn lgtn 4096 Sep 11 15:25 .lightning
drwxrwxr-x 3 lgtn lgtn 4096 Sep 11 12:28 fleek-network
tip

Remember that we are using lgtn for our demo. If you have opted for a different username, make sure you use the correct username. To find the username you are logged in with run the command:

whoami

For our demo, we'll assume that you understand that lgtn is the user we opted in for our demo.

We have the symbolic link that links the binary built from the source code, to the alias lgtn that's set under the /usr/local/bin/lgtn pathname.

For example, you can find where that is linked to by running:

ls -la $(which lgtn)

On the output below, we can see that the /usr/local/bin/lgtn points to /root/fleek-network/lightning/target/release/lightning-node.

lrwxrwxrwx 1 root root 64 Sep 11 15:48 /usr/local/bin/lgtn -> /root/fleek-network/lightning/target/release/lightning-node

The target base path is /root, and we know that we've moved the source code directory to the user home /home/lgtn. For this reason, we need to create a new symlink with the updated location of the binary file.

Unlink the symlink:

sudo unlink /usr/local/bin/lgtn

Create the symlink:

sudo ln -s "/home/lgtn/fleek-network/lightning/target/release/lightning-node" /usr/local/bin/lgtn

If successful, you should be able to execute the command:

lgtn help

The output should look similar to:

Usage: lgtn [OPTIONS] <COMMAND>

Commands:
run Start the node
keys Handle keys
print-config Print the loaded configuration
help Print this message or the help of the given subcommand(s)

Options:
-c, --config <CONFIG> Path to the toml configuration file [default: ~/.lightning/config.toml]
--with-mock-consensus Determines that we should be using the mock consensus backend
-v... Increases the level of verbosity (the max level is -vvv)
--log-location Print code location on console logs
-h, --help Print help
-V, --version Print version

Update the Systemd service unit

Open the file, its settings should be similar to the following:

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/<USERNAME>/.lightning/config.toml run
ExecStop=killall lgtn
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp

[Install]
WantedBy=multi-user.target

Since we opted in for the username lgtn for our demo, replaced <USERNAME> with lgtn, and it would look like:

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/lgtn/.lightning/config.toml run
ExecStop=killall lgtn
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp

[Install]
WantedBy=multi-user.target
tip

Notice the ExecStart= which includes the flag -c where the location of the user files is declared. Learn how to update the config.toml to include the user-preferred file paths, e.g. declare the keystore pathname.

Complete the step by reloading the daemon, to apply the newly created changes. You can do this by executing:

sudo systemctl daemon-reload

Update the config.toml with user-preferred file locations

Open the /home/lgtn/.lightning/config.toml file in your favorite text editor.

Replace every instance of ~ (tilde) with the user's home path. We do this to ensure that every time we control the service via systemctl, the configuration file that tells which keystore to use is declared upfront regardless of running it as user or delegating to root with sudo. Learn more about file permissions and ownership by reading the reference document.

In the /home/<USERNAME>/.lightning/config.toml you'll find some and more of the following:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
tip

The configuration properties and values presented above are a shorter version of what you'll find on your configuration.toml. We keep it short to make it easier to follow, do not copy and paste.

Find and replace all instances of ~ in the config file /home/<USERNAME>/.lightning/config.toml.

Here's an example of how to do it using sed:

sed -i "s|~/.lightning|/home/<USERNAME>/.lightning|g" "/home/<USERNAME>/.lightning/config.toml"
tip

Replace the <USERNAME> with your username. For example, if you have followed the recommendation to create a user it would look like /home/lgtn/.lightning/config.toml for the username lgtn.

For example, if your username is lgtn that'd look like this:

sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"

Once modified, you can run a cat to see the content of the files to confirm it has been updated.

cat /home/lgtn/.lightning/config.toml

For our example where we opted in for the username lgtn that would look like:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
Warning

Bear in mind that we are keeping the content of the file short to make it easier to read and follow. The content of your configuration file should look slightly different, amongst these it should contain other properties and values. You should not copy and replace the content of your files with the ones presented here.

Start the service

At this stage, you should have migrated the essential files to the user home.

Ideally, you would now manage the service as the user (as described in the user service reference). To keep our guide wider to all users, we'll prefix the commands with sudo, which elevates the permissions to root. But since we have provided the configuration file the -c in our systemd service, we'll have the user-preferred configuration options ruling.

Start the service by running the command:

sudo systemctl start lightning.service
tip

Find the timeline of events for the Lightning service by checking the log files. Learn about it in the section Log Messages.

To learn more, visit the section Use Systemctl to manage the Lightning Service

Conclusion

We started by giving a brief introduction to ownership of the Lightning CLI files.

Jumped through topics of Systemd service that helps the user manage the service in the Linux environment, which helps keep track of all the processes and threads that are spawned.

We've gone through the step-by-step process to migrate the Fleek Network CLI and Systemd service setup from one user to the other. To keep it short, we decided to go with the use-case of where the migration happens between a root user and a sudoer.

Discover more about the project by watching/contributing on GitHub, following us on Twitter, and joining our community Discord for any updates.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +

Transfering setup ownership

TL;DR

tip

The step-by-step instructions provided in the guide should be simple to follow, but the process is also available as an automated script from our familiar get.fleek.network tool.

To use the automated script execute the following command in your server terminal and follow the instructions:

curl -sS https://get.fleek.network/transfer_system_user_setup_ownership | bash

We try to make the auomated scripts as useful as possible, but it's impossible to fit every single use-case. So, if you find any isses or have feedback to help us improve message us through our Discord.

Introduction

Our Lightning CLI and Node process is run by a user, that has some sort of permissions–some users run it as a super user (root) which is questionable as root privileges are not a necessary good. We'll look into how to create a user to manage and control the Fleek Network Lightning CLI and Systemd unit service. Also, presents the concept of file permissions and ownership which is crucial in preventing private or sensitive data from being exposed to dodgy actors.

Let's discuss the topic and open up a few ideas to help us improve the security of our server.

Pre-requisites

To follow the guide, you will need the following:

  • Familiarity with the command-line interface
  • Have installed and set up the Lightning CLI and service

Ownership of Lightning CLI files

The user who installs the Lightning CLI and sets the Service takes an important role that determines the location of the configuration files, the setup, and how the Systemd service is managed or controlled.

Our install document recommends creating a user and switching to the user to set up the service. You shouldn't want installed applications to run with elevated privileges. Applications are meant to be run with non-administrative privileges. If an application requires higher privileges, the administrator, such as a sudoer should be able to elevate it. An application that has full access and control of a system can modify it in harmful ways, e.g. compromise the private keys.

For our guide, we'll illustrate the process of migration from a super user (root) to another user (sudo). The knowledge should be easily appliable for any other user-to-user migration. We stick with root user for simplicity and because that's the most common use case.

tip

A reference document about File permissions and ownership is available that explains how it works practically, by showcasing how the process can be started, how the node process locates the Keystore, etc.

Systemd Service

In systemd, a unit refers to any resource that the system knows how to operate on and manage. This is the primary object that the systemd tools know how to deal with. These resources are defined using configuration files called unit files.

The recommended installation process features a systemd.service which is a resource that the system knows how to operate and manage by an administrator user.

tip

When using a Systemd service to run a process, it operates comparably to running it directly. The key difference is that Systemd keeps track of all the processes and threads that are spawned. This means that when a service is stopped using systemctl, such as the Fleek Network Lightning Node service, all the child processes that were started by the service are also terminated. Additionally, by utilizing Systemd, a user can run the process in the background and configure it to start automatically on system startup.

If you have followed the installation recommendations, find the systemd service unit in the location /etc/systemd/system/lightning.service (we are using Ubuntu Linux as an example to keep it short).

Make sure that you have set up a Systemd unit service, as recommended during the installation as this guide assumes you have one setup.

Stop the service

Before we proceed with any changes required for the migration, you'll have to stop the lightning.service.

systemctl stop lightning
note

For this guide, we are assuming that you are migrating ownership from root to a sudoer user. If not, you might be required to elevate privileges as sudo** where required. For example, sudo systemctl stop lightning.

Clear the .lightning data

Run the following command to clear the /root/.lightning/data, as it can be quite large, and we don't need to move it.

sudo rm -rf /root/.lightning/data

Create a user

We recommend creating a non-root user with administrative privileges. It'll allow us to install any system requirements.

You can create a new user and add to the sudo group by running:

tip

For our example, we'll be using the name lgtn but you can pick whichever you'd like. If you already have a sudoer account, you can skip this step.

sudo adduser lgtn

After completing the adduser steps, execute the usermod to add the user to the sudo group, as follows:

sudo usermod -aG sudo lgtn

Switch to the new user by using the command:

su lgtn

Change the directory to the new user's home, as follows:

cd /home/lgtn

Move lightning system and source code directory to user's home

A user should've been created, added the user to the sudo group, switched to the user, and changed the directory to the user's home.

Run the command pwd:

pwd

The output would look like:

/home/<USERNAME>

Given the username lgtn:

/home/lgtn

You'll then move two directories:

  • The /root/.lightning
  • The source code under the parent /root/fleek-network

1) Move the /root/.lightning directory from one user to the other

For our demo, we have assumed root user to sudoer user named lgtn, thus that'll look like this:

sudo mv /root/.lightning /home/lgtn/

2) Move the /root/fleek-network directory from one user to the other

sudo mv /root/fleek-network /home/lgtn/

3) Confirm move by finding both directories

In the user $HOME directory, you should be able to list the content of the directory and find the .lightning and fleek-network directory.

ls -la

The output should be similar to the following.

drwxr-x--- 6 lgtn lgtn  4096 Sep 12 13:51 .
drwxr-xr-x 3 root root 4096 Sep 11 12:28 ..
drwxrwxr-x 5 root root 4096 Sep 11 15:25 .lightning
drwxrwxr-x 3 root root 4096 Sep 11 12:28 fleek-network

Change ownership of files

Once the directories and files are moved, they should have the wrong ownership, which should be set to root:root. We'll now have to change the ownership of the directories and files recursively.

Change the ownership of /home/lgtn/.lightning to the user lgtn as follows:

sudo chown -R lgtn:lgtn .lightning
tip

Make sure that you use the -R flag to have the ownership changes applied to the parent, the child directories and all the files.

Change the ownership of /home/lgtn/fleek-network to the user lgtn as follows:

sudo chown -R lgtn:lgtn fleek-network

Once completed, if you list the content of the directory the ownership should have changed from root:root to lgtn:lgtn.

ls -la

The output should be similar to the following.

drwxr-x--- 6 lgtn lgtn  4096 Sep 12 13:51 .
drwxr-xr-x 3 root root 4096 Sep 11 12:28 ..
drwxrwxr-x 5 lgtn lgtn 4096 Sep 11 15:25 .lightning
drwxrwxr-x 3 lgtn lgtn 4096 Sep 11 12:28 fleek-network
tip

Remember that we are using lgtn for our demo. If you have opted for a different username, make sure you use the correct username. To find the username you are logged in with run the command:

whoami

For our demo, we'll assume that you understand that lgtn is the user we opted in for our demo.

We have the symbolic link that links the binary built from the source code, to the alias lgtn that's set under the /usr/local/bin/lgtn pathname.

For example, you can find where that is linked to by running:

ls -la $(which lgtn)

On the output below, we can see that the /usr/local/bin/lgtn points to /root/fleek-network/lightning/target/release/lightning-node.

lrwxrwxrwx 1 root root 64 Sep 11 15:48 /usr/local/bin/lgtn -> /root/fleek-network/lightning/target/release/lightning-node

The target base path is /root, and we know that we've moved the source code directory to the user home /home/lgtn. For this reason, we need to create a new symlink with the updated location of the binary file.

Unlink the symlink:

sudo unlink /usr/local/bin/lgtn

Create the symlink:

sudo ln -s "/home/lgtn/fleek-network/lightning/target/release/lightning-node" /usr/local/bin/lgtn

If successful, you should be able to execute the command:

lgtn help

The output should look similar to:

Usage: lgtn [OPTIONS] <COMMAND>

Commands:
run Start the node
keys Handle keys
print-config Print the loaded configuration
help Print this message or the help of the given subcommand(s)

Options:
-c, --config <CONFIG> Path to the toml configuration file [default: ~/.lightning/config.toml]
--with-mock-consensus Determines that we should be using the mock consensus backend
-v... Increases the level of verbosity (the max level is -vvv)
--log-location Print code location on console logs
-h, --help Print help
-V, --version Print version

Update the Systemd service unit

Open the file, its settings should be similar to the following:

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/<USERNAME>/.lightning/config.toml run
ExecStop=killall lgtn
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp

[Install]
WantedBy=multi-user.target

Since we opted in for the username lgtn for our demo, replaced <USERNAME> with lgtn, and it would look like:

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/lgtn/.lightning/config.toml run
ExecStop=killall lgtn
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp

[Install]
WantedBy=multi-user.target
tip

Notice the ExecStart= which includes the flag -c where the location of the user files is declared. Learn how to update the config.toml to include the user-preferred file paths, e.g. declare the keystore pathname.

Complete the step by reloading the daemon, to apply the newly created changes. You can do this by executing:

sudo systemctl daemon-reload

Update the config.toml with user-preferred file locations

Open the /home/lgtn/.lightning/config.toml file in your favorite text editor.

Replace every instance of ~ (tilde) with the user's home path. We do this to ensure that every time we control the service via systemctl, the configuration file that tells which keystore to use is declared upfront regardless of running it as user or delegating to root with sudo. Learn more about file permissions and ownership by reading the reference document.

In the /home/<USERNAME>/.lightning/config.toml you'll find some and more of the following:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
tip

The configuration properties and values presented above are a shorter version of what you'll find on your configuration.toml. We keep it short to make it easier to follow, do not copy and paste.

Find and replace all instances of ~ in the config file /home/<USERNAME>/.lightning/config.toml.

Here's an example of how to do it using sed:

sed -i "s|~/.lightning|/home/<USERNAME>/.lightning|g" "/home/<USERNAME>/.lightning/config.toml"
tip

Replace the <USERNAME> with your username. For example, if you have followed the recommendation to create a user it would look like /home/lgtn/.lightning/config.toml for the username lgtn.

For example, if your username is lgtn that'd look like this:

sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"

Once modified, you can run a cat to see the content of the files to confirm it has been updated.

cat /home/lgtn/.lightning/config.toml

For our example where we opted in for the username lgtn that would look like:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
Warning

Bear in mind that we are keeping the content of the file short to make it easier to read and follow. The content of your configuration file should look slightly different, amongst these it should contain other properties and values. You should not copy and replace the content of your files with the ones presented here.

Start the service

At this stage, you should have migrated the essential files to the user home.

Ideally, you would now manage the service as the user (as described in the user service reference). To keep our guide wider to all users, we'll prefix the commands with sudo, which elevates the permissions to root. But since we have provided the configuration file the -c in our systemd service, we'll have the user-preferred configuration options ruling.

Start the service by running the command:

sudo systemctl start lightning.service
tip

Find the timeline of events for the Lightning service by checking the log files. Learn about it in the section Log Messages.

To learn more, visit the section Use Systemctl to manage the Lightning Service

Conclusion

We started by giving a brief introduction to ownership of the Lightning CLI files.

Jumped through topics of Systemd service that helps the user manage the service in the Linux environment, which helps keep track of all the processes and threads that are spawned.

We've gone through the step-by-step process to migrate the Fleek Network CLI and Systemd service setup from one user to the other. To keep it short, we decided to go with the use-case of where the migration happens between a root user and a sudoer.

Discover more about the project by watching/contributing on GitHub, following us on Twitter, and joining our community Discord for any updates.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/guides/Node Operators/updating-lightning/index.html b/guides/Node Operators/updating-lightning/index.html index 95bbd8d3a..97efa3f3f 100644 --- a/guides/Node Operators/updating-lightning/index.html +++ b/guides/Node Operators/updating-lightning/index.html @@ -13,15 +13,15 @@ - +
-

Update Lightning

Introduction

Fleek Network's Lightning source code is updated frequently and thus keeping up with changes can be a bit of a chore and especially difficult for users who are trying to have it compiled for the first time, or updating the Lightning CLI binary for their operating systems. While we should have stable releases in the future, at the current phase of development, there's a requirement to follow the contributions directly in the repository: checking in and out, the commits you're interested in running.

In the following guide, we’ll have a simple look into how to pull changes and update Lightning CLI on Linux, which we stick with Ubuntu for simplicity but should be easily transferrable to your supported OS.

Pre-requisites

To follow the guide, you will need the following:

  • Familiarity with the command-line interface
  • Some experience with Git
  • Have installed and set up the Lightning CLI and service

Pulling the latest changes

Check the latest contributions pushed to the Lightning CLI main branch, it'll give you clarity on what's been committed into the source code. Therefore, find out about new features, fixes, improvements, etc by looking directly into the repository history.

Switch to installer username

First, switch to the username you've used to install and setup Fleek Network Lightning.

To switch to the username you've used throughout the installation process do:

su <USERNAME>

For example, if you used the username lgtn it'll look like the following command:

su lgtn

Change directory to the source code

Next, change directory to the Lightning directory in your file system.

tip

The tild ~ means user $HOME, thus you have to be logged in with the correct user as requested in the installer username step.

cd <PATH-TO-LIGHTNING-SOURCE-CODE>

If you have installed it via the recommended instructions, then the default location where the source code is stored should be ~/fleek-network/lightning. Otherwise, if you opted-in for a custom location then look into your notes before proceeding.

For example, it'd look like the following command:

cd ~/fleek-network/lightning

Checkout to branch

Make sure that you are checked in to the correct branch. For example, if that'd be the first testnet phase it'd be called testnet-alpha-1.

git checkout <BRANCH-NAME>

Here's an example of how the command would look like for the main default branch with corresponding name main.

git checkout main
danger

During testnet phase, you have to checkout to the testnet branch. For example, the first testnet branch name was testnet-alpha-1 that you would have to be checked in order to run a node successfully. A list of the active branches can be found at anytime in the GitHub repository active branches. While we try our best to update documentation, guides, instructions or any other written content during development, there might be breaking changes that might take some time to reflect in our documents. To avoid disappointment, check into the correct branch or contribute by getting in touch with us, or sending a PR in the relevant context, thank you!

Here's an example of how the command would look like for the branch name testnet-alpha-1.

git checkout testnet-alpha-1

Pull the latest changes

The syntax to pull the latest commits is the following:

git pull <REPOSITORY-NAME> <BRANCH-NAME>

The git pull command is used to fetch and merge changes from the remote repository to the local repository. Here we're pulling from remote named origin and branch main.

git pull origin main
tip

If you've made any changes in the local repository directory, clear them to prevent being blocked. As git is a version control program that looks for changes and will ask you to do something about it to prevent losing data. Most readers can disregard changes if not contributing to the development by simply stashing or resetting the changes.

A quick way to clean is to stash the changes, for example:

git stash 

You can check yourself, as follows:

git remote -v

Our output clearly describes what origin is tracking.

origin  git@github.com:fleek-network/lightning.git (fetch)
origin git@github.com:fleek-network/lightning.git (push)

Alternatively, you can stash and pull, to reset the repository to the origin.

git fetch origin <BRANCH-NAME>
git reset --hard origin/<BRANCH-NAME>
git clean -f
tip

With git you can point to any point in the repository history, there might be lots of reasons you'd want to check into a certain commit or branch, e.g. if you encounter bugs and need to revert to a previous commit or version. That being said, we welcome all kinds of contributions, such as simply reporting bugs. To report issues in our repository visit the issues page to help us improve.

Here's the output we got after the git pull:

remote: Enumerating objects: 437, done.
remote: Counting objects: 100% (437/437), done.
remote: Compressing objects: 100% (205/205), done.
remote: Total 397 (delta 242), reused 334 (delta 181), pack-reused 0
Receiving objects: 100% (397/397), 214.68 KiB | 4.77 MiB/s, done.
Resolving deltas: 100% (242/242), completed with 29 local objects.
From https://github.com/fleek-network/lightning
* branch main -> FETCH_HEAD
12b2647..998108d main -> origin/main
Updating 12b2647..998108d
Fast-forward
.dockerignore | 6 -
.gitignore | 2 +
Cargo.lock | 782 +++++++----------------
Cargo.toml | 2 +-
core/application/src/state.rs | 12 +-
core/cli/Cargo.toml | 47 ++
core/cli/readme.md | 59 ++
core/cli/src/args.rs | 63 ++
core/cli/src/cli.rs | 136 ++++
core/cli/src/commands/dev.rs | 112 ++++
core/cli/src/commands/key.rs | 92 +++

...

When your local version of the repository, is up-to-date with the remote repository, you'd get:

From https://github.com/fleek-network/lightning
* branch main -> FETCH_HEAD
Already up to date.

A "already up to date" message means that you have the latest version of the source code and can proceed with compiling the binary process from the source code to override the Lightning CLI version you're on. You can also make any other setup changes that might find necessary. Some changes might be related to the recommended setup of Systemd Service that helps control the Fleek Network Lightning Node binary process, etc.

Build the binary from the source code

We're assuming that your system setup hasn't changed, such as Rust toolchain still being installed and setup correctly in the system and any other required dependencies. If you have made changes to your system and need to revisit the setup instructions, check our install document here.

First, switch the user and change directory to the Lightning directory in your file system as described in switch to installer username change directory to the source code sections.

Recall the command from our install document or getting started guide? As you probably guessed, you need to execute the rust cargo build command. But firstly, we are going to clean and update the Rust package manager, as follows:

cargo clean
cargo update

Next, execute the build command to compile the Fleek Network Lightning CLI binary.

cargo +stable build --release
tip

The build command uses the Rust compiler, which might take a while depending on how speedy the host machine is capable.

Once the Rust compiler completes, the generated binary will be available in the source code project directory.

If you have stick with the default recommendation, that'll be at ~/fleek-network/lightning/target/release/lightning-node.

During the original install and setup process, a symbolic link (symlink) was created linking the generated binary file located in ~/fleek-network/lightning/target/release/lightning-node to /usr/local/bin/lgtn. By placing the symlink in the the default installation location of the user, the executable application is available globally as lgtn.

You can see the full absolute path of the symlink and verify if setup correctly by running:

readlink -f <SYMLINK-NAME>

If you have followed the recommended name, the symbolic link should be called lgtn, short version for lightning.

readlink -f lgtn

Here's an example where we find the symlink lgtn pointing to the absolute path where our source code and originated built binary is located, as described in the build the binary from the source code section.

/home/<USERNAME>/fleek-network/lightning/target/release/lightning-node

Alternatively, you can use the ls command to identify the symlink.

ls -la $(which lgtn)

If you find an error, it's very likely that a symlink is not setup. You can revisit the installation to learn, or execute the command to link the build binary to the user default install location:

sudo ln -s "~/fleek-network/lightning/target/release/lightning-node" /usr/local/bin/lgtn
tip

Make sure that the paths provided to the command ln are correct. If you are using customized pathnames or switched to a different username other than the one used for installation it has to change accordingly.

Systemd service

It's highly recommended to use systemd to manage the Fleek Network service for node operators. Systemd is a system and service manager for Linux operating systems that provides a consistent way to manage system services across various distributions.

Verify the setup

The recommended setup is to wrap the Lightning binary process as a Systemd service, as instructed in the install section.

If you have followed the recommendations, you should have the service file called ligthning.service in the path /etc/systemd/system/lightning.service.

The content of lightning.service should have some or more of the following properties and values:

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/lgtn/.lightning/config.toml run
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp

[Install]
WantedBy=multi-user.target

Every time the file is modified, the Systemd process should be reloaded. You can do this by executing:

sudo systemctl daemon-reload

To learn more about how to create a Systemd service read the manual installation document that illustrates the steps required in greater detail.

Launching the node as a systemd service

After completing all the steps and checkups mentioned throughout the guide, you should have the Fleek Network Lightning Service ready to go.

To launch the service, execute the following command:

sudo systemctl start lightning.service

To learn more about how to use Systemctl to manage the Lightning service, read the document here.

Health check

First, complete all the steps and checkups mentioned throught the guide and once the Node process is running perform a health check.

To run a quick health checkup, send a GET request to /health endpoint of the RPC on port 4230.

curl -w "\p" localhost:4230/health

If successful, you should get the response running and staked, as follows:

running and staked

If you'd like to learn more about health check, visit the section health check of our documentation.

Conclusion

The Fleek Network's Ursa CLI is in constant development, there are frequent changes that can introduce features, fixes, and performance improvements, but also breaking changes that in some cases require you to add, including new libraries or packages in your operating system.

In the current phase of development, a proper software release cycle for the updates is still in development, thus we pick changes from the source repository to build the Lightning application.

We have looked into how to pull the changes via Git, and discussed that contributions can introduce new requirements to the host operating system that leads to updates or changes in the documentation–mentioning how hard it is to keep in sync. Explained how to look into the contributions to understand the nature of the change and get hints about new features.

To complete, provided a step-by-step walkthrough the installation and setup process for the Fleek Network Lightning CLI and Systemd service.

Discover more about the project by watching/contributing on GitHub, following us on Twitter, and joining our community Discord for any updates.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +

Update Lightning

Introduction

Fleek Network's Lightning source code is updated frequently and thus keeping up with changes can be a bit of a chore and especially difficult for users who are trying to have it compiled for the first time, or updating the Lightning CLI binary for their operating systems. While we should have stable releases in the future, at the current phase of development, there's a requirement to follow the contributions directly in the repository: checking in and out, the commits you're interested in running.

In the following guide, we’ll have a simple look into how to pull changes and update Lightning CLI on Linux, which we stick with Ubuntu for simplicity but should be easily transferrable to your supported OS.

Pre-requisites

To follow the guide, you will need the following:

  • Familiarity with the command-line interface
  • Some experience with Git
  • Have installed and set up the Lightning CLI and service

Pulling the latest changes

Check the latest contributions pushed to the Lightning CLI main branch, it'll give you clarity on what's been committed into the source code. Therefore, find out about new features, fixes, improvements, etc by looking directly into the repository history.

Switch to installer username

First, switch to the username you've used to install and setup Fleek Network Lightning.

To switch to the username you've used throughout the installation process do:

su <USERNAME>

For example, if you used the username lgtn it'll look like the following command:

su lgtn

Change directory to the source code

Next, change directory to the Lightning directory in your file system.

tip

The tild ~ means user $HOME, thus you have to be logged in with the correct user as requested in the installer username step.

cd <PATH-TO-LIGHTNING-SOURCE-CODE>

If you have installed it via the recommended instructions, then the default location where the source code is stored should be ~/fleek-network/lightning. Otherwise, if you opted-in for a custom location then look into your notes before proceeding.

For example, it'd look like the following command:

cd ~/fleek-network/lightning

Checkout to branch

Make sure that you are checked in to the correct branch. For example, if that'd be the first testnet phase it'd be called testnet-alpha-1.

git checkout <BRANCH-NAME>

Here's an example of how the command would look like for the main default branch with corresponding name main.

git checkout main
danger

During testnet phase, you have to checkout to the testnet branch. For example, the first testnet branch name was testnet-alpha-1 that you would have to be checked in order to run a node successfully. A list of the active branches can be found at anytime in the GitHub repository active branches. While we try our best to update documentation, guides, instructions or any other written content during development, there might be breaking changes that might take some time to reflect in our documents. To avoid disappointment, check into the correct branch or contribute by getting in touch with us, or sending a PR in the relevant context, thank you!

Here's an example of how the command would look like for the branch name testnet-alpha-1.

git checkout testnet-alpha-1

Pull the latest changes

The syntax to pull the latest commits is the following:

git pull <REPOSITORY-NAME> <BRANCH-NAME>

The git pull command is used to fetch and merge changes from the remote repository to the local repository. Here we're pulling from remote named origin and branch main.

git pull origin main
tip

If you've made any changes in the local repository directory, clear them to prevent being blocked. As git is a version control program that looks for changes and will ask you to do something about it to prevent losing data. Most readers can disregard changes if not contributing to the development by simply stashing or resetting the changes.

A quick way to clean is to stash the changes, for example:

git stash 

You can check yourself, as follows:

git remote -v

Our output clearly describes what origin is tracking.

origin  git@github.com:fleek-network/lightning.git (fetch)
origin git@github.com:fleek-network/lightning.git (push)

Alternatively, you can stash and pull, to reset the repository to the origin.

git fetch origin <BRANCH-NAME>
git reset --hard origin/<BRANCH-NAME>
git clean -f
tip

With git you can point to any point in the repository history, there might be lots of reasons you'd want to check into a certain commit or branch, e.g. if you encounter bugs and need to revert to a previous commit or version. That being said, we welcome all kinds of contributions, such as simply reporting bugs. To report issues in our repository visit the issues page to help us improve.

Here's the output we got after the git pull:

remote: Enumerating objects: 437, done.
remote: Counting objects: 100% (437/437), done.
remote: Compressing objects: 100% (205/205), done.
remote: Total 397 (delta 242), reused 334 (delta 181), pack-reused 0
Receiving objects: 100% (397/397), 214.68 KiB | 4.77 MiB/s, done.
Resolving deltas: 100% (242/242), completed with 29 local objects.
From https://github.com/fleek-network/lightning
* branch main -> FETCH_HEAD
12b2647..998108d main -> origin/main
Updating 12b2647..998108d
Fast-forward
.dockerignore | 6 -
.gitignore | 2 +
Cargo.lock | 782 +++++++----------------
Cargo.toml | 2 +-
core/application/src/state.rs | 12 +-
core/cli/Cargo.toml | 47 ++
core/cli/readme.md | 59 ++
core/cli/src/args.rs | 63 ++
core/cli/src/cli.rs | 136 ++++
core/cli/src/commands/dev.rs | 112 ++++
core/cli/src/commands/key.rs | 92 +++

...

When your local version of the repository, is up-to-date with the remote repository, you'd get:

From https://github.com/fleek-network/lightning
* branch main -> FETCH_HEAD
Already up to date.

A "already up to date" message means that you have the latest version of the source code and can proceed with compiling the binary process from the source code to override the Lightning CLI version you're on. You can also make any other setup changes that might find necessary. Some changes might be related to the recommended setup of Systemd Service that helps control the Fleek Network Lightning Node binary process, etc.

Build the binary from the source code

We're assuming that your system setup hasn't changed, such as Rust toolchain still being installed and setup correctly in the system and any other required dependencies. If you have made changes to your system and need to revisit the setup instructions, check our install document here.

First, switch the user and change directory to the Lightning directory in your file system as described in switch to installer username change directory to the source code sections.

Recall the command from our install document or getting started guide? As you probably guessed, you need to execute the rust cargo build command. But firstly, we are going to clean and update the Rust package manager, as follows:

cargo clean
cargo update

Next, execute the build command to compile the Fleek Network Lightning CLI binary.

cargo +stable build --release
tip

The build command uses the Rust compiler, which might take a while depending on how speedy the host machine is capable.

Once the Rust compiler completes, the generated binary will be available in the source code project directory.

If you have stick with the default recommendation, that'll be at ~/fleek-network/lightning/target/release/lightning-node.

During the original install and setup process, a symbolic link (symlink) was created linking the generated binary file located in ~/fleek-network/lightning/target/release/lightning-node to /usr/local/bin/lgtn. By placing the symlink in the the default installation location of the user, the executable application is available globally as lgtn.

You can see the full absolute path of the symlink and verify if setup correctly by running:

readlink -f <SYMLINK-NAME>

If you have followed the recommended name, the symbolic link should be called lgtn, short version for lightning.

readlink -f lgtn

Here's an example where we find the symlink lgtn pointing to the absolute path where our source code and originated built binary is located, as described in the build the binary from the source code section.

/home/<USERNAME>/fleek-network/lightning/target/release/lightning-node

Alternatively, you can use the ls command to identify the symlink.

ls -la $(which lgtn)

If you find an error, it's very likely that a symlink is not setup. You can revisit the installation to learn, or execute the command to link the build binary to the user default install location:

sudo ln -s "~/fleek-network/lightning/target/release/lightning-node" /usr/local/bin/lgtn
tip

Make sure that the paths provided to the command ln are correct. If you are using customized pathnames or switched to a different username other than the one used for installation it has to change accordingly.

Systemd service

It's highly recommended to use systemd to manage the Fleek Network service for node operators. Systemd is a system and service manager for Linux operating systems that provides a consistent way to manage system services across various distributions.

Verify the setup

The recommended setup is to wrap the Lightning binary process as a Systemd service, as instructed in the install section.

If you have followed the recommendations, you should have the service file called ligthning.service in the path /etc/systemd/system/lightning.service.

The content of lightning.service should have some or more of the following properties and values:

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/lgtn/.lightning/config.toml run
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp

[Install]
WantedBy=multi-user.target

Every time the file is modified, the Systemd process should be reloaded. You can do this by executing:

sudo systemctl daemon-reload

To learn more about how to create a Systemd service read the manual installation document that illustrates the steps required in greater detail.

Launching the node as a systemd service

After completing all the steps and checkups mentioned throughout the guide, you should have the Fleek Network Lightning Service ready to go.

To launch the service, execute the following command:

sudo systemctl start lightning.service

To learn more about how to use Systemctl to manage the Lightning service, read the document here.

Health check

First, complete all the steps and checkups mentioned throught the guide and once the Node process is running perform a health check.

To run a quick health checkup, send a GET request to /health endpoint of the RPC on port 4230.

curl -w "\p" localhost:4230/health

If successful, you should get the response running and staked, as follows:

running and staked

If you'd like to learn more about health check, visit the section health check of our documentation.

Conclusion

The Fleek Network's Ursa CLI is in constant development, there are frequent changes that can introduce features, fixes, and performance improvements, but also breaking changes that in some cases require you to add, including new libraries or packages in your operating system.

In the current phase of development, a proper software release cycle for the updates is still in development, thus we pick changes from the source repository to build the Lightning application.

We have looked into how to pull the changes via Git, and discussed that contributions can introduce new requirements to the host operating system that leads to updates or changes in the documentation–mentioning how hard it is to keep in sync. Explained how to look into the contributions to understand the nature of the change and get hints about new features.

To complete, provided a step-by-step walkthrough the installation and setup process for the Fleek Network Lightning CLI and Systemd service.

Discover more about the project by watching/contributing on GitHub, following us on Twitter, and joining our community Discord for any updates.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/guides/index.html b/guides/index.html index 2102336b3..442b5cec0 100644 --- a/guides/index.html +++ b/guides/index.html @@ -13,15 +13,15 @@ - +
-

The guides provide step-by-step instructions and descriptions to help understand how and why you'd have to do or execute certain commands or processes.

It differs from the references documentation which serves as a quick direct breakdown of commands and processes without much explanation, as the name implies.

To start, find guides by consulting the available categories to locate the content on the sidebar. Our guides are also available as a result when using the search feature located at the very top of the documentation site.

- +

The guides provide step-by-step instructions and descriptions to help understand how and why you'd have to do or execute certain commands or processes.

It differs from the references documentation which serves as a quick direct breakdown of commands and processes without much explanation, as the name implies.

To start, find guides by consulting the available categories to locate the content on the sidebar. Our guides are also available as a result when using the search feature located at the very top of the documentation site.

+ \ No newline at end of file diff --git a/guides/tags/configuration/index.html b/guides/tags/configuration/index.html index b7c3f410d..6561d6ce0 100644 --- a/guides/tags/configuration/index.html +++ b/guides/tags/configuration/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

2 docs tagged with "configuration"

View All Tags

Updating Lightning

A step-by-step guide to update the Lightning CLI from source code and Service setup

- + \ No newline at end of file diff --git a/guides/tags/container/index.html b/guides/tags/container/index.html index fda3e2a74..5f423c39c 100644 --- a/guides/tags/container/index.html +++ b/guides/tags/container/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "container"

View All Tags
- + \ No newline at end of file diff --git a/guides/tags/docker/index.html b/guides/tags/docker/index.html index a20c8139c..c99bc02e3 100644 --- a/guides/tags/docker/index.html +++ b/guides/tags/docker/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "docker"

View All Tags
- + \ No newline at end of file diff --git a/guides/tags/edge-computing/index.html b/guides/tags/edge-computing/index.html index 6c4788c52..ada7bdf7f 100644 --- a/guides/tags/edge-computing/index.html +++ b/guides/tags/edge-computing/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "Edge computing"

View All Tags

Getting Started

A first look at what Fleek Network is, why it's important, and a simple tutorial of running and interacting with a node on your local machine!

- + \ No newline at end of file diff --git a/guides/tags/fleek-network/index.html b/guides/tags/fleek-network/index.html index 8ece5e169..96f6be54d 100644 --- a/guides/tags/fleek-network/index.html +++ b/guides/tags/fleek-network/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "Fleek Network"

View All Tags

About guides

The guides provide step-by-step instructions and descriptions to help understand how and why you'd have to do or execute certain commands or processes.

- + \ No newline at end of file diff --git a/guides/tags/getting-started/index.html b/guides/tags/getting-started/index.html index 65f099b1f..449739307 100644 --- a/guides/tags/getting-started/index.html +++ b/guides/tags/getting-started/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "Getting Started"

View All Tags

Getting Started

A first look at what Fleek Network is, why it's important, and a simple tutorial of running and interacting with a node on your local machine!

- + \ No newline at end of file diff --git a/guides/tags/guide/index.html b/guides/tags/guide/index.html index fdaf6639d..33bc93422 100644 --- a/guides/tags/guide/index.html +++ b/guides/tags/guide/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

5 docs tagged with "Guide"

View All Tags

Getting Started

A first look at what Fleek Network is, why it's important, and a simple tutorial of running and interacting with a node on your local machine!

Managing the keystore

The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you’re migrating to

Updating Lightning

A step-by-step guide to update the Lightning CLI from source code and Service setup

- + \ No newline at end of file diff --git a/guides/tags/guides/index.html b/guides/tags/guides/index.html index 6f1b3c56c..a6d14a3b0 100644 --- a/guides/tags/guides/index.html +++ b/guides/tags/guides/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "Guides"

View All Tags

About guides

The guides provide step-by-step instructions and descriptions to help understand how and why you'd have to do or execute certain commands or processes.

- + \ No newline at end of file diff --git a/guides/tags/help/index.html b/guides/tags/help/index.html index 6c333660f..4186b68bd 100644 --- a/guides/tags/help/index.html +++ b/guides/tags/help/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "Help"

View All Tags

About guides

The guides provide step-by-step instructions and descriptions to help understand how and why you'd have to do or execute certain commands or processes.

- + \ No newline at end of file diff --git a/guides/tags/index.html b/guides/tags/index.html index c065e4b51..659a9e45e 100644 --- a/guides/tags/index.html +++ b/guides/tags/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/guides/tags/keys/index.html b/guides/tags/keys/index.html index 32cba19f5..60635b24c 100644 --- a/guides/tags/keys/index.html +++ b/guides/tags/keys/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "keys"

View All Tags

Managing the keystore

The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you’re migrating to

- + \ No newline at end of file diff --git a/guides/tags/keystore/index.html b/guides/tags/keystore/index.html index 87ab4973b..01bbe739f 100644 --- a/guides/tags/keystore/index.html +++ b/guides/tags/keystore/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "keystore"

View All Tags

Managing the keystore

The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you’re migrating to

- + \ No newline at end of file diff --git a/guides/tags/ownership/index.html b/guides/tags/ownership/index.html index 085413690..81e173354 100644 --- a/guides/tags/ownership/index.html +++ b/guides/tags/ownership/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "ownership"

View All Tags
- + \ No newline at end of file diff --git a/guides/tags/private-keys/index.html b/guides/tags/private-keys/index.html index 07a830435..5998292d8 100644 --- a/guides/tags/private-keys/index.html +++ b/guides/tags/private-keys/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "private keys"

View All Tags

Managing the keystore

The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you’re migrating to

- + \ No newline at end of file diff --git a/guides/tags/public-keys/index.html b/guides/tags/public-keys/index.html index c06c90e82..9c52f0d1a 100644 --- a/guides/tags/public-keys/index.html +++ b/guides/tags/public-keys/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "public keys"

View All Tags

Managing the keystore

The following will guide you through some of the fundamentals to help understand how to manage the key store at the very basics, and help you persist the key store identity, in any supported system you’re migrating to

- + \ No newline at end of file diff --git a/guides/tags/rebuild/index.html b/guides/tags/rebuild/index.html index b0b280068..552d3777d 100644 --- a/guides/tags/rebuild/index.html +++ b/guides/tags/rebuild/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "rebuild"

View All Tags

Updating Lightning

A step-by-step guide to update the Lightning CLI from source code and Service setup

- + \ No newline at end of file diff --git a/guides/tags/setup/index.html b/guides/tags/setup/index.html index bc3a56a8a..d5b31f3fc 100644 --- a/guides/tags/setup/index.html +++ b/guides/tags/setup/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

2 docs tagged with "setup"

View All Tags

Updating Lightning

A step-by-step guide to update the Lightning CLI from source code and Service setup

- + \ No newline at end of file diff --git a/guides/tags/transfer/index.html b/guides/tags/transfer/index.html index c5e13e2be..69b98bd4d 100644 --- a/guides/tags/transfer/index.html +++ b/guides/tags/transfer/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "transfer"

View All Tags
- + \ No newline at end of file diff --git a/guides/tags/update/index.html b/guides/tags/update/index.html index 5a9e9661d..216920856 100644 --- a/guides/tags/update/index.html +++ b/guides/tags/update/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "update"

View All Tags

Updating Lightning

A step-by-step guide to update the Lightning CLI from source code and Service setup

- + \ No newline at end of file diff --git a/index.html b/index.html index 0cea1ad4d..bd7ac9b18 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@
- + \ No newline at end of file diff --git a/references/Docker/build-and-run-in-docker/index.html b/references/Docker/build-and-run-in-docker/index.html index 165b26518..e35fb26b6 100644 --- a/references/Docker/build-and-run-in-docker/index.html +++ b/references/Docker/build-and-run-in-docker/index.html @@ -13,7 +13,7 @@ - + @@ -22,8 +22,8 @@

Clone the source code locally

tip

You have several ways of doing this:

  • Clone via HTTPS
  • Clone via SSH
  • Download via Github CLI
  • Download the zip package from the repository

We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this. Although, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it here.

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git <DIRECTORY-NAME>

At time of writing, we are checking the branch name testnet-alpha-1 that corresponds to the testnet phase. -Here's an example of what it'd look like when sticking to the recommended path location:

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning

Change directory to Lightning source code

cd ~/fleek-network/lightning

Install Docker

tip

We're using Ubuntu Linux. You'll have to make the required tweaks for your preferred Linux Distro. Find the list of support operating systems here.

sudo apt update

Next, install the required packages to let apt use packages over HTTPS:

sudo apt install \
apt-transport-https \
ca-certificates \
software-properties-common

Add the GPG key for the official Docker repository to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the Docker repository to apt sources and update the package database with the Docker packages from the new added repository:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable"

Set to install from the Docker repo instead of the default Ubuntu repo:

apt-cache policy docker-ce

Finally, install Docker:

sudo apt install docker-ce

Once complete you should be able to run it via the CLI, as such:

docker -v

Here's the output (versions might differ a bit from the time of writing):

Docker version 24.0.6, build ed223bc

Docker setup verification

The following command's output will indicate if Docker's working correctly:

sudo docker run hello-world

You should get a "Hello from Docker!".

Check the Dockerfile

You should have changed directory to the projecto directory.

If you run a cat Dockerfile, you should have content similar to:

FROM rust:latest as builder
ARG PROFILE=release
WORKDIR /lightning

RUN apt-get update
RUN apt-get install -y \
build-essential \
cmake \
clang \
pkg-config \
libssl-dev \
gcc \
protobuf-compiler

...

Build the Docker image

Build the image named as lightning from our Dockerfile:

sudo docker build -t lightning -f ./Dockerfile .

Generate keys

sudo docker exec -it lightning-node lgtn keys generate

Docker Container

sudo docker run \
-p 4230:4230 \
-p 4200:4200 \
-p 6969:6969 \
-p 18000:18000 \
-p 18101:18101 \
-p 18102:18102 \
-v $HOME/.lightning/:/root/.lightning/:rw \
--name lightning-node \
-it lightning

View logs

To view the logs of a Docker container in real time, use the following command:

sudo docker logs -f lightning-node
Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +Here's an example of what it'd look like when sticking to the recommended path location:

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning

Change directory to Lightning source code

cd ~/fleek-network/lightning

Install Docker

tip

We're using Ubuntu Linux. You'll have to make the required tweaks for your preferred Linux Distro. Find the list of support operating systems here.

sudo apt update

Next, install the required packages to let apt use packages over HTTPS:

sudo apt install \
apt-transport-https \
ca-certificates \
software-properties-common

Add the GPG key for the official Docker repository to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the Docker repository to apt sources and update the package database with the Docker packages from the new added repository:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable"

Set to install from the Docker repo instead of the default Ubuntu repo:

apt-cache policy docker-ce

Finally, install Docker:

sudo apt install docker-ce

Once complete you should be able to run it via the CLI, as such:

docker -v

Here's the output (versions might differ a bit from the time of writing):

Docker version 24.0.6, build ed223bc

Docker setup verification

The following command's output will indicate if Docker's working correctly:

sudo docker run hello-world

You should get a "Hello from Docker!".

Check the Dockerfile

You should have changed directory to the projecto directory.

If you run a cat Dockerfile, you should have content similar to:

FROM rust:latest as builder
ARG PROFILE=release
WORKDIR /lightning

RUN apt-get update
RUN apt-get install -y \
build-essential \
cmake \
clang \
pkg-config \
libssl-dev \
gcc \
protobuf-compiler

...

Build the Docker image

Build the image named as lightning from our Dockerfile:

sudo docker build -t lightning -f ./Dockerfile .

Generate keys

sudo docker exec -it lightning-node lgtn keys generate

Docker Container

sudo docker run \
-p 4230:4230 \
-p 4200:4200 \
-p 6969:6969 \
-p 18000:18000 \
-p 18101:18101 \
-p 18102:18102 \
-v $HOME/.lightning/:/root/.lightning/:rw \
--name lightning-node \
-it lightning

View logs

To view the logs of a Docker container in real time, use the following command:

sudo docker logs -f lightning-node
Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/references/Lightning CLI/backing-up-the-keystore/index.html b/references/Lightning CLI/backing-up-the-keystore/index.html index 41ed68313..d471e1d55 100644 --- a/references/Lightning CLI/backing-up-the-keystore/index.html +++ b/references/Lightning CLI/backing-up-the-keystore/index.html @@ -13,15 +13,15 @@ - +
-
caution

The security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.

Keystore pathname

The default location for the keystore is in the user home. The $HOME or ~ refers to the user home, as such consider the logged-in username.

To Check the user you are logged in with:

whoami

The default location for the keystore is:

$HOME/.lightning/keystore

Configuration file settings

The config.toml should have some and more of the following properties and values that are used to locate crucial files, such as the consensus and node keys of the keystore.

Here's an incomplete example of how the config.toml looks like:

[BLANK]
...

[application]
db_path = "~/.lightning/data/app_db"
...

[consensus]
store_path = "~/.lightning/data/narwhal_store"
...

[fsstore]
root = "~/.lightning/blockstore"
...

[resolver]
store_path = "~/.lightning/data/resolver_store"
...

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
...

If you've followed the installation recommendations, it's very likely that you'll have the username path defined at the base of the pathnames declared in the properties, such as the following except instead of <USERNAME> you'll have your username:

[signer]
consensus_key_path = "/home/<USERNAME>/.lightning/keystore/consensus.pem"
node_key_path = "/home/<USERNAME>/.lightning/keystore/node.pem"

The config.toml if loaded on Lightning node process runtime, will pick the desired paths declared in the file.

Loading the configuration file on runtime

Use the configuration flag -c to pass the configuration config.toml path:

lgtn -c /home/<USERNAME>/.lightning/config.toml run

Replace the <USERNAME> with the correct username, where the config is located.

Executing the subcommand run without the configuration flag -c, doesn't mean that it'll locate the desired config.toml, as it'll default to $HOME/.lightning/config.toml, e.g. if you were logged in with root, that'd be /root/.lightning/config.toml.

Low security backup

To zip and encrypt the $HOME/.lightning/keystore directory run:

# It'll prompt for password (remember)
zip --encrypt -r keystore.zip.enc $HOME/.lightning/keystore

To unzip and decrypt the keystore.zip.enc, you'd run:

# It'll prompt for password (recall)
unzip keystore.zip.enc -d $HOME/.lightning/keystore

Higher security

Create a tarbar by executing:

tar -cf "keystore.tar" $HOME/.lightning/keystore

The encryption command is:

sudo gpg -a --symmetric --cipher-algo AES256 keystore.tar

To decrypt the keystore.tar.asc file, enter:

sudo gpg -a --output keystore.tar --decrypt keystore.tar.asc

Create a temporary directory to extract the tar archive with the original full pathname.

mkdir $HOME/tar_keystore_extract

Now, run the command to extract to the target directory, as follows:

tar -xf keystore.tar -C $HOME/tar_keystore_extract

Locate the extracted files in $HOME/tar_keystore_extract, which should look like $HOME/tar_keystore/home/<USERNAME>/.lightning/keystore

For a more in depth or step-by-step instructions read the guide managing the keystore.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +
caution

The security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.

Keystore pathname

The default location for the keystore is in the user home. The $HOME or ~ refers to the user home, as such consider the logged-in username.

To Check the user you are logged in with:

whoami

The default location for the keystore is:

$HOME/.lightning/keystore

Configuration file settings

The config.toml should have some and more of the following properties and values that are used to locate crucial files, such as the consensus and node keys of the keystore.

Here's an incomplete example of how the config.toml looks like:

[BLANK]
...

[application]
db_path = "~/.lightning/data/app_db"
...

[consensus]
store_path = "~/.lightning/data/narwhal_store"
...

[fsstore]
root = "~/.lightning/blockstore"
...

[resolver]
store_path = "~/.lightning/data/resolver_store"
...

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
...

If you've followed the installation recommendations, it's very likely that you'll have the username path defined at the base of the pathnames declared in the properties, such as the following except instead of <USERNAME> you'll have your username:

[signer]
consensus_key_path = "/home/<USERNAME>/.lightning/keystore/consensus.pem"
node_key_path = "/home/<USERNAME>/.lightning/keystore/node.pem"

The config.toml if loaded on Lightning node process runtime, will pick the desired paths declared in the file.

Loading the configuration file on runtime

Use the configuration flag -c to pass the configuration config.toml path:

lgtn -c /home/<USERNAME>/.lightning/config.toml run

Replace the <USERNAME> with the correct username, where the config is located.

Executing the subcommand run without the configuration flag -c, doesn't mean that it'll locate the desired config.toml, as it'll default to $HOME/.lightning/config.toml, e.g. if you were logged in with root, that'd be /root/.lightning/config.toml.

Low security backup

To zip and encrypt the $HOME/.lightning/keystore directory run:

# It'll prompt for password (remember)
zip --encrypt -r keystore.zip.enc $HOME/.lightning/keystore

To unzip and decrypt the keystore.zip.enc, you'd run:

# It'll prompt for password (recall)
unzip keystore.zip.enc -d $HOME/.lightning/keystore

Higher security

Create a tarbar by executing:

tar -cf "keystore.tar" $HOME/.lightning/keystore

The encryption command is:

sudo gpg -a --symmetric --cipher-algo AES256 keystore.tar

To decrypt the keystore.tar.asc file, enter:

sudo gpg -a --output keystore.tar --decrypt keystore.tar.asc

Create a temporary directory to extract the tar archive with the original full pathname.

mkdir $HOME/tar_keystore_extract

Now, run the command to extract to the target directory, as follows:

tar -xf keystore.tar -C $HOME/tar_keystore_extract

Locate the extracted files in $HOME/tar_keystore_extract, which should look like $HOME/tar_keystore/home/<USERNAME>/.lightning/keystore

For a more in depth or step-by-step instructions read the guide managing the keystore.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/references/Lightning CLI/error-building-on-arm64/index.html b/references/Lightning CLI/error-building-on-arm64/index.html index 17488bbf6..27d719c5a 100644 --- a/references/Lightning CLI/error-building-on-arm64/index.html +++ b/references/Lightning CLI/error-building-on-arm64/index.html @@ -13,15 +13,15 @@ - +
-

Building on the ARM64 (aarch64)

ARM64 platform has its own specifics, and currently consists of requiring gcc:

sudo apt install gcc

On cargo build, the error error: linking with cc failed: exit status: 1 occurs, as demonstrated in the output below:

error: linking with `cc` failed: exit status: 1
# ... wall of text
# ... the key error is ↴
= note: /usr/bin/ld: /home/ubuntu/fleek-network/lightning/target/release/deps/libblake3-a927e9b36d695ff0.rlib(blake3-a927e9b36d695ff0.blake3.91a53ea05847a7a5-cgu.0.rcgu.o): in function `blake3_compress_in_place_portable':
/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/blake3-1.4.1/src/ffi_neon.rs:45: multiple definition of `blake3_compress_in_place_portable'; /home/ubuntu/fleek-network/lightning/target/release/deps/libfleek_blake3-990c4c0cfb4eaa87.rlib(fleek_blake3-990c4c0cfb4eaa87.fleek_blake3.4f11e9370af31773-cgu.0.rcgu.o):/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fleek-blake3-1.4.1/src/ffi_neon.rs:45: first defined here

As a result of the research by the community member ryssroad, the following solution was shared.

Open the cargo.toml file in ~/fleek-network/lightning/Cargo.toml and find the lto key.

lto = true

Change the lto key value from true to thin:

...
[profile.release]
# currently enabled, may increase build time, but runtime faster, can set to `"thin"`.
lto = "thin"

Set RUSTFLAGS on build, as follows:

RUSTFLAGS="-Clink-arg=-Wl,--allow-multiple-definition" cargo +stable build --release 

Once the build completes, you should find the generated binary lightning-node under the directory ~/fleek-network/lightning/target/release/lightning-node.

As an example, execute:

~/fleek-network/lightning/target/release/lightning-node help

To find the help output:

Usage: lightning-node [OPTIONS] <COMMAND>

Commands:
run Start the node
keys Handle keys
print-config Print the loaded configuration
help Print this message or the help of the given subcommand(s)

Options:
-c, --config <CONFIG> Path to the toml configuration file [default: ~/.lightning/config.toml]
--with-mock-consensus Determines that we should be using the mock consensus backend
-v... Increases the level of verbosity (the max level is -vvv)
--log-location Print code location on console logs
-h, --help Print help
-V, --version Print version
Road aka @road
Road aka @roadCommunity memberJoin our community on discord!
- +

Building on the ARM64 (aarch64)

ARM64 platform has its own specifics, and currently consists of requiring gcc:

sudo apt install gcc

On cargo build, the error error: linking with cc failed: exit status: 1 occurs, as demonstrated in the output below:

error: linking with `cc` failed: exit status: 1
# ... wall of text
# ... the key error is ↴
= note: /usr/bin/ld: /home/ubuntu/fleek-network/lightning/target/release/deps/libblake3-a927e9b36d695ff0.rlib(blake3-a927e9b36d695ff0.blake3.91a53ea05847a7a5-cgu.0.rcgu.o): in function `blake3_compress_in_place_portable':
/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/blake3-1.4.1/src/ffi_neon.rs:45: multiple definition of `blake3_compress_in_place_portable'; /home/ubuntu/fleek-network/lightning/target/release/deps/libfleek_blake3-990c4c0cfb4eaa87.rlib(fleek_blake3-990c4c0cfb4eaa87.fleek_blake3.4f11e9370af31773-cgu.0.rcgu.o):/home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fleek-blake3-1.4.1/src/ffi_neon.rs:45: first defined here

As a result of the research by the community member ryssroad, the following solution was shared.

Open the cargo.toml file in ~/fleek-network/lightning/Cargo.toml and find the lto key.

lto = true

Change the lto key value from true to thin:

...
[profile.release]
# currently enabled, may increase build time, but runtime faster, can set to `"thin"`.
lto = "thin"

Set RUSTFLAGS on build, as follows:

RUSTFLAGS="-Clink-arg=-Wl,--allow-multiple-definition" cargo +stable build --release 

Once the build completes, you should find the generated binary lightning-node under the directory ~/fleek-network/lightning/target/release/lightning-node.

As an example, execute:

~/fleek-network/lightning/target/release/lightning-node help

To find the help output:

Usage: lightning-node [OPTIONS] <COMMAND>

Commands:
run Start the node
keys Handle keys
print-config Print the loaded configuration
help Print this message or the help of the given subcommand(s)

Options:
-c, --config <CONFIG> Path to the toml configuration file [default: ~/.lightning/config.toml]
--with-mock-consensus Determines that we should be using the mock consensus backend
-v... Increases the level of verbosity (the max level is -vvv)
--log-location Print code location on console logs
-h, --help Print help
-V, --version Print version
Road aka @road
Road aka @roadCommunity memberJoin our community on discord!
+ \ No newline at end of file diff --git a/references/Lightning CLI/error-linking-with-cc-failed-exist-status-1/index.html b/references/Lightning CLI/error-linking-with-cc-failed-exist-status-1/index.html index 0708be5f4..e899fcd9c 100644 --- a/references/Lightning CLI/error-linking-with-cc-failed-exist-status-1/index.html +++ b/references/Lightning CLI/error-linking-with-cc-failed-exist-status-1/index.html @@ -13,15 +13,15 @@ - +
-

Check if CPU is supported

uname -i
WARNING

Given the CPU requirements, currently we're mainly supporting GenuineIntel and there have been reports of failure to build the binary on AMD. The ARM64 is a different architecture, thus not supported, but there has been some community contributions in that regard, find it in the reference error building on ARM64.

Any contribution or feedback to provide support is appreciated. Feel free to let us know on our Discord channel.

Linking with cc error

A user who finds the error linking with cc failed, will have to install the required dependencies.

error: linking with `cc` failed: exit status: 1
error: could not compile `fleek-service-ping-example` (lib) due to previous error

Update

sudo apt-get update

Install gcc:

sudo apt-get install gcc

Remove previous installation files

You can re-run the installation process. If you are using the assisted installer, it'll complain that the source code directory already exists. Since you've probably cloned the source code repository locally, you'll have to remove it manually. If you need help, find the instructions in the reference.

Run the installation script

curl https://get.fleek.network | bash

Alternatively, read the manual installation instructions for more information.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +

Check if CPU is supported

uname -i
WARNING

Given the CPU requirements, currently we're mainly supporting GenuineIntel and there have been reports of failure to build the binary on AMD. The ARM64 is a different architecture, thus not supported, but there has been some community contributions in that regard, find it in the reference error building on ARM64.

Any contribution or feedback to provide support is appreciated. Feel free to let us know on our Discord channel.

Linking with cc error

A user who finds the error linking with cc failed, will have to install the required dependencies.

error: linking with `cc` failed: exit status: 1
error: could not compile `fleek-service-ping-example` (lib) due to previous error

Update

sudo apt-get update

Install gcc:

sudo apt-get install gcc

Remove previous installation files

You can re-run the installation process. If you are using the assisted installer, it'll complain that the source code directory already exists. Since you've probably cloned the source code repository locally, you'll have to remove it manually. If you need help, find the instructions in the reference.

Run the installation script

curl https://get.fleek.network | bash

Alternatively, read the manual installation instructions for more information.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/references/Lightning CLI/file-permissions-and-ownership/index.html b/references/Lightning CLI/file-permissions-and-ownership/index.html index a93688ce4..b83ac72f5 100644 --- a/references/Lightning CLI/file-permissions-and-ownership/index.html +++ b/references/Lightning CLI/file-permissions-and-ownership/index.html @@ -13,15 +13,15 @@ - +
-

Ownership

The user who installs the Fleek Network Lightning CLI matters, as it can own or delegate ownership of the dependencies and applications being installed.

For example, if you have followed the install document recommendations and have:

  • Created a user lgtn
  • Switched to the user lgtn
  • Executed the installation process as lgtn
note

The username can be anything, we are using the term lgtn as the example provided throughout our documentation. Select your username in accordance to your preferences.

You'll find that it owns the following directories under the user home (/home/lgtn):

drwxr-x--- 6 lgtn lgtn  4096 Sep 12 10:27 .
drwxr-xr-x 3 root root 4096 Sep 11 12:28 ..
drwxrwxr-x 5 lgtn lgtn 4096 Sep 11 12:29 .cargo
drwxrwxr-x 5 lgtn lgtn 4096 Sep 11 15:25 .lightning
drwxrwxr-x 6 lgtn lgtn 4096 Sep 11 12:29 .rustup
drwxrwxr-x 3 lgtn lgtn 4096 Sep 11 12:28 fleek-network

Above, we have the listing properties set as drwxrwxr-x and the ownership lgtn:lgtn.

On the other hand, if you have done the installation process as root superuser, you'll find that:

  • The location of the directories and files goes under the /root pathname
  • The ownership is set to root:root

Learn more about file permissions from the Linux Foundation.

To learn more about file permission on Linux, read the Understanding Linux File Permissions.

Using sudo to delegate permissions

Consider file ownership and permissions to understand where the keystore is located. Take close attention when executing commands as an admin–with or without super user (root) or sudo.

If a command is executed without sudo then the generated output goes onto the user home.

lgtn keys generate

Resulting in having the keystore saved onto /home/username/.lightning/keystore.

On the other hand, if a command is executed with sudo then the generated output is delegated to root directory.

sudo lgtn keys generate

Resulting in having the keystore saved onto /root/.lightning/keystore.

User $HOME directory

The home directory is a directory that contains the personal files of a particular user of the system. On Linux, the $HOME environment variable is set by the login program, which sets the user `$HOME`` accordingly. A user's home goes by the username, the user who's logged in.

For this reason, a user can change to the home directory by executing:

cd $HOME

A shorthand allows a user to refer to their home directory simply as ~ (tilde), as follows:

cd ~
tip

We can find that the HOME or ~ (tilde) is highly dependent on the user who's logged in. Since we know that the user might delegate to root by the usage of sudo, this can help troubleshoot and explain the location of our files e.g. the keystore. In the section Set the locations of the user paths, we learn how to define the location of our user configuration paths to avoid confusion. By doing it we ensure that when running the service, the service picks the correct configuration paths for our user.

To learn more about the user $HOME directory read the wikipedia Home directory document.

Set the locations of the user paths

In the /home/<USERNAME>/.lightning/config.toml you'll find some and more of the following:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
tip

The configuration properties and values presented above are a shorter version of what you'll find on your configuration.toml. We keep it short to make it easier to follow, do not copy and paste.

Find and replace all instances of ~ in the config file /home/<USERNAME>/.lightning/config.toml.

Here's an example of how to do it using sed:

sed -i "s|~/.lightning|/home/<USERNAME>/.lightning|g" "/home/<USERNAME>/.lightning/config.toml"
tip

Replace the <USERNAME> with your username. For example, if you have followed the recommendation to create a user it would look like /home/lgtn/.lightning/config.toml for the username lgtn.

For example, if your username is lgtn that'd look like this:

sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"

Once modified, you can run a cat to see the content of the files to confirm it has been updated.

cat /home/lgtn/.lightning/config.toml

For our example where we opted in for the username lgtn that would look like:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
Warning

Bear in mind that we are keeping the content of the file short to make it easier to read and follow. The content of your configuration file should look slightly different, amongst these it should contain other properties and values. You should not copy and replace the content of your files with the ones presented here.

Set the configuration flag -c on the service unit file

The following section assumes that a System service unit has been declared, and you're using systemctl to control the service, as described in our Systemd Service Setup install section.

Open and edit the /etc/systemd/system/lightning.service file.

1) Replace <USERNAME> with YOUR username. For example, in the documentation we use the username lgtn, which means we'd replace <USERNAME> with lgtn.

2) Make sure that the ExecStart is set correctly, including the -c

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/<USERNAME>/.lightning/config.toml run
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp

[Install]
WantedBy=multi-user.target

For our example, as the username lgtn it would look like:

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/lgtn/.lightning/config.toml run
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=/var/tmp

[Install]
WantedBy=multi-user.target

When complete make sure the file is saved and the systemctl daemon is reloaded, as follows:

sudo systemctl daemon-reload

Consequently, when a user manages the service via the systemctl, the Lightning CLI process will read the configuration file settings provided above. It includes the location of the user preferences, such as the keystore location amongst others, preventing confusion regardless of root delegation.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +

Ownership

The user who installs the Fleek Network Lightning CLI matters, as it can own or delegate ownership of the dependencies and applications being installed.

For example, if you have followed the install document recommendations and have:

  • Created a user lgtn
  • Switched to the user lgtn
  • Executed the installation process as lgtn
note

The username can be anything, we are using the term lgtn as the example provided throughout our documentation. Select your username in accordance to your preferences.

You'll find that it owns the following directories under the user home (/home/lgtn):

drwxr-x--- 6 lgtn lgtn  4096 Sep 12 10:27 .
drwxr-xr-x 3 root root 4096 Sep 11 12:28 ..
drwxrwxr-x 5 lgtn lgtn 4096 Sep 11 12:29 .cargo
drwxrwxr-x 5 lgtn lgtn 4096 Sep 11 15:25 .lightning
drwxrwxr-x 6 lgtn lgtn 4096 Sep 11 12:29 .rustup
drwxrwxr-x 3 lgtn lgtn 4096 Sep 11 12:28 fleek-network

Above, we have the listing properties set as drwxrwxr-x and the ownership lgtn:lgtn.

On the other hand, if you have done the installation process as root superuser, you'll find that:

  • The location of the directories and files goes under the /root pathname
  • The ownership is set to root:root

Learn more about file permissions from the Linux Foundation.

To learn more about file permission on Linux, read the Understanding Linux File Permissions.

Using sudo to delegate permissions

Consider file ownership and permissions to understand where the keystore is located. Take close attention when executing commands as an admin–with or without super user (root) or sudo.

If a command is executed without sudo then the generated output goes onto the user home.

lgtn keys generate

Resulting in having the keystore saved onto /home/username/.lightning/keystore.

On the other hand, if a command is executed with sudo then the generated output is delegated to root directory.

sudo lgtn keys generate

Resulting in having the keystore saved onto /root/.lightning/keystore.

User $HOME directory

The home directory is a directory that contains the personal files of a particular user of the system. On Linux, the $HOME environment variable is set by the login program, which sets the user `$HOME`` accordingly. A user's home goes by the username, the user who's logged in.

For this reason, a user can change to the home directory by executing:

cd $HOME

A shorthand allows a user to refer to their home directory simply as ~ (tilde), as follows:

cd ~
tip

We can find that the HOME or ~ (tilde) is highly dependent on the user who's logged in. Since we know that the user might delegate to root by the usage of sudo, this can help troubleshoot and explain the location of our files e.g. the keystore. In the section Set the locations of the user paths, we learn how to define the location of our user configuration paths to avoid confusion. By doing it we ensure that when running the service, the service picks the correct configuration paths for our user.

To learn more about the user $HOME directory read the wikipedia Home directory document.

Set the locations of the user paths

In the /home/<USERNAME>/.lightning/config.toml you'll find some and more of the following:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
tip

The configuration properties and values presented above are a shorter version of what you'll find on your configuration.toml. We keep it short to make it easier to follow, do not copy and paste.

Find and replace all instances of ~ in the config file /home/<USERNAME>/.lightning/config.toml.

Here's an example of how to do it using sed:

sed -i "s|~/.lightning|/home/<USERNAME>/.lightning|g" "/home/<USERNAME>/.lightning/config.toml"
tip

Replace the <USERNAME> with your username. For example, if you have followed the recommendation to create a user it would look like /home/lgtn/.lightning/config.toml for the username lgtn.

For example, if your username is lgtn that'd look like this:

sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"

Once modified, you can run a cat to see the content of the files to confirm it has been updated.

cat /home/lgtn/.lightning/config.toml

For our example where we opted in for the username lgtn that would look like:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
Warning

Bear in mind that we are keeping the content of the file short to make it easier to read and follow. The content of your configuration file should look slightly different, amongst these it should contain other properties and values. You should not copy and replace the content of your files with the ones presented here.

Set the configuration flag -c on the service unit file

The following section assumes that a System service unit has been declared, and you're using systemctl to control the service, as described in our Systemd Service Setup install section.

Open and edit the /etc/systemd/system/lightning.service file.

1) Replace <USERNAME> with YOUR username. For example, in the documentation we use the username lgtn, which means we'd replace <USERNAME> with lgtn.

2) Make sure that the ExecStart is set correctly, including the -c

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/<USERNAME>/.lightning/config.toml run
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp

[Install]
WantedBy=multi-user.target

For our example, as the username lgtn it would look like:

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/lgtn/.lightning/config.toml run
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=/var/tmp

[Install]
WantedBy=multi-user.target

When complete make sure the file is saved and the systemctl daemon is reloaded, as follows:

sudo systemctl daemon-reload

Consequently, when a user manages the service via the systemctl, the Lightning CLI process will read the configuration file settings provided above. It includes the location of the user preferences, such as the keystore location amongst others, preventing confusion regardless of root delegation.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/references/Lightning CLI/keys-not-found/index.html b/references/Lightning CLI/keys-not-found/index.html index dfd5c6bf4..f68ea7266 100644 --- a/references/Lightning CLI/keys-not-found/index.html +++ b/references/Lightning CLI/keys-not-found/index.html @@ -13,15 +13,15 @@ - +
-

Node key does not exist

When watching the Fleek Network Lightning service log output, you find the "Node key does not exist" message placed recursively. As follows:

thread 'main' panicked at 'Node key does not exist. Use CLI to generate keys.', core/node/src/testnet_sync.rs:126:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'Node key does not exist. Use CLI to generate keys.', core/node/src/testnet_sync.rs:126:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

If you haven't deleted the keystore and can locate it, it's due to how the service is being run. As a user can delegate (sudo) the execution of the process to root, the location of the keystore differs on runtime.

To learn more about how file permissions and ownership work, you're advised to read the reference document here.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +

Node key does not exist

When watching the Fleek Network Lightning service log output, you find the "Node key does not exist" message placed recursively. As follows:

thread 'main' panicked at 'Node key does not exist. Use CLI to generate keys.', core/node/src/testnet_sync.rs:126:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'Node key does not exist. Use CLI to generate keys.', core/node/src/testnet_sync.rs:126:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

If you haven't deleted the keystore and can locate it, it's due to how the service is being run. As a user can delegate (sudo) the execution of the process to root, the location of the keystore differs on runtime.

To learn more about how file permissions and ownership work, you're advised to read the reference document here.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/references/Lightning CLI/node-secret-key-does-not-exist/index.html b/references/Lightning CLI/node-secret-key-does-not-exist/index.html index 29cf9613e..91354abef 100644 --- a/references/Lightning CLI/node-secret-key-does-not-exist/index.html +++ b/references/Lightning CLI/node-secret-key-does-not-exist/index.html @@ -13,15 +13,15 @@ - +
-

Node secret key does not exist

When watching the Fleek Network Lightning service log output, you find the "Node secret key does not exist" message as follows:

Error: Could not start the node.

Caused by:
Node Initialization failed: InitializationFailed(Tag<lightning_signer::Signer<lightning_node::FinalTypes> as SignerInterface>, Node secret key does not exist. Use the CLI to generate keys.)

Edit the ~/.lightning/config.toml to include the full location for the PEM files. For example, let's say that it's located under /home/skywalker that'd look like:

[signer]
consensus_key_path = "/home/skywalker/.lightning/keystore/consensus.pem"
node_key_path = "/home/skywalker/.lightning/keystore/node.pem"

To learn more about how file permissions and ownership work, you're advised to read the reference document here.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +

Node secret key does not exist

When watching the Fleek Network Lightning service log output, you find the "Node secret key does not exist" message as follows:

Error: Could not start the node.

Caused by:
Node Initialization failed: InitializationFailed(Tag<lightning_signer::Signer<lightning_node::FinalTypes> as SignerInterface>, Node secret key does not exist. Use the CLI to generate keys.)

Edit the ~/.lightning/config.toml to include the full location for the PEM files. For example, let's say that it's located under /home/skywalker that'd look like:

[signer]
consensus_key_path = "/home/skywalker/.lightning/keystore/consensus.pem"
node_key_path = "/home/skywalker/.lightning/keystore/node.pem"

To learn more about how file permissions and ownership work, you're advised to read the reference document here.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/references/Lightning CLI/permission-denied-os-error-13/index.html b/references/Lightning CLI/permission-denied-os-error-13/index.html index ed72c4c19..6b056cb38 100644 --- a/references/Lightning CLI/permission-denied-os-error-13/index.html +++ b/references/Lightning CLI/permission-denied-os-error-13/index.html @@ -13,15 +13,15 @@ - +
-

Ownership and file permissions

When running the Lightning CLI, the user who's in control can delegate to root via sudo. Depending on how the Fleek Networking Lightning CLI was installed, this might cause some confusion, which is better explained by reading the reference Keys not found, which illustrates a situation where a user gets an error message about the wrong location of a system path (keystore).

Some reasons why the Permission denied (os error 13) might occur are related to:

  • The Fleek Network Lightning CLI process trying to write to a .lightning stored in a non permitted location
  • The Fleek Network Lightning CLI process trying to write to /tmp

The most common issue can be fixed by reading the section Override the TMPDIR.

Override the TMPDIR

The Fleek Network Lightning process requires writing to a temporary directory. As the process requires permissions, this might fail as demonstrated by some of the output logs we have below.

a) A permission denied error message

Permission denied (os error 13)

b) Rust panic error message which includes a permission denied

thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', core/node/src/cli.rs:181:18
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', core/node/src/cli.rs:181:18
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', core/node/src/cli.rs:181:18
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', core/node/src/cli.rs:181:18
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', core/node/src/cli.rs:181:18
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

c) A trace showing the path where this has failed

[00007fcbe168e764] openat(AT_FDCWD, "/tmp/lightning.log", O_WRONLY|O_CREAT|O_APPEND|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)
[00007fcbe168ea6f] write(2, "thread '", 8thread ') = 8
[00007fcbe168ea6f] write(2, "main", 4main) = 4
[00007fcbe168ea6f] write(2, "' panicked at '", 15' panicked at ') = 15
[00007fcbe168ea6f] write(2, "called `Result::unwrap()` on an "..., 114called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }) = 114
[00007fcbe168ea6f] write(2, "', ", 3', ) = 3
tip

The /tmp directory should have wide permissions for all applications, but to mitigate any permission issues the user can override the system environment TMPDIR. For example, the installer and update scripts override TMPDIR environment variable to /var/tmp setting it in the service unit Environment=.

The Lightning CLI process is aware of the environment variable TMPDIR, which the operators can override as discussed in the reference for Update the System service unit.

In short, it requires you to include a Environment= value of TMPDIR=/var/tmp as follows:

[Service]
...
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp
attention

The /etc/systemd/system/lightning.service service unit file presented here is a shorter version for simplicity. Do not replace your service unit file with the shorter content version presented here.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +

Ownership and file permissions

When running the Lightning CLI, the user who's in control can delegate to root via sudo. Depending on how the Fleek Networking Lightning CLI was installed, this might cause some confusion, which is better explained by reading the reference Keys not found, which illustrates a situation where a user gets an error message about the wrong location of a system path (keystore).

Some reasons why the Permission denied (os error 13) might occur are related to:

  • The Fleek Network Lightning CLI process trying to write to a .lightning stored in a non permitted location
  • The Fleek Network Lightning CLI process trying to write to /tmp

The most common issue can be fixed by reading the section Override the TMPDIR.

Override the TMPDIR

The Fleek Network Lightning process requires writing to a temporary directory. As the process requires permissions, this might fail as demonstrated by some of the output logs we have below.

a) A permission denied error message

Permission denied (os error 13)

b) Rust panic error message which includes a permission denied

thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', core/node/src/cli.rs:181:18
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', core/node/src/cli.rs:181:18
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', core/node/src/cli.rs:181:18
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', core/node/src/cli.rs:181:18
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', core/node/src/cli.rs:181:18
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

c) A trace showing the path where this has failed

[00007fcbe168e764] openat(AT_FDCWD, "/tmp/lightning.log", O_WRONLY|O_CREAT|O_APPEND|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)
[00007fcbe168ea6f] write(2, "thread '", 8thread ') = 8
[00007fcbe168ea6f] write(2, "main", 4main) = 4
[00007fcbe168ea6f] write(2, "' panicked at '", 15' panicked at ') = 15
[00007fcbe168ea6f] write(2, "called `Result::unwrap()` on an "..., 114called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }) = 114
[00007fcbe168ea6f] write(2, "', ", 3', ) = 3
tip

The /tmp directory should have wide permissions for all applications, but to mitigate any permission issues the user can override the system environment TMPDIR. For example, the installer and update scripts override TMPDIR environment variable to /var/tmp setting it in the service unit Environment=.

The Lightning CLI process is aware of the environment variable TMPDIR, which the operators can override as discussed in the reference for Update the System service unit.

In short, it requires you to include a Environment= value of TMPDIR=/var/tmp as follows:

[Service]
...
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp
attention

The /etc/systemd/system/lightning.service service unit file presented here is a shorter version for simplicity. Do not replace your service unit file with the shorter content version presented here.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/references/Lightning CLI/uninstall-lightning-node/index.html b/references/Lightning CLI/uninstall-lightning-node/index.html index 111b9de79..58cf9011b 100644 --- a/references/Lightning CLI/uninstall-lightning-node/index.html +++ b/references/Lightning CLI/uninstall-lightning-node/index.html @@ -13,15 +13,15 @@ - +
-

To remove a symbolic link, use either the rm or unlink command followed by the name of the symlink as an argument. Here's an example with unlink:

unlink /usr/local/bin/lgtn

Delete the local source code

Delete the local source code which was copied from the remote repository. You can delete it recursively by:

rm -r ~/fleek-network/lightning

💡 Use the flag f to force remove by skipping any prompts, e.g. rm -rf <PATHNAME>

note

The default install location is $HOME/fleek-network/lightning. If you have selected a different location to store the repository, change the target path.

Disable the systemd service

To disable the Fleek Network Lightning Systemd's service, start by stopping the service.

sudo systemctl stop lightning.service
tip

You can replace lightning.service by lightning.

Disable the lightning service

sudo systemctl disable lightning.service

If you have used the recommended procedures in the install documentation you'll have to remove the Systemd unit (file that defines the service).

rm /etc/systemd/system/lightning.service

Reload the Systemd service daemon

sudo systemctl daemon-reload

Clear the lightning config directory

The Fleek Network lightning config directory is where the configuration, keystore–the location where your private key is hosted–and other system files are stored.

WARNING

Make sure to back up any sensitive data, such as the keystore (private keys), as you won't be able to recover the keys by any other means. If you have any funds associated with it, it'll be lost forever. The Fleek Network team or anyone else will not be able to help recover keys. Your keys, your responsibility.

Alternatively, instead of deleting you can move the files to a custom directory name such as.lightning.backupDATESTAMP, e.g. the example below we've used the date 2023-09-06-1205 as that was the time this text was written:

mv ~/.lightning ~/.lightning.backup202309061205

To clear the lightning config directory remove any files recursively by running the following command:

rm -r ~/.lightning/*

💡 Use the flag f to force remove by skipping any prompts, e.g. rm -rf <PATHNAME>/*

Alternatively, delete the ~/.lightning directory:

rm -r ~/.lightning

Uninstall Cargo and Rust

To uninstall rustc, rustup and cargo run the following command:

rustup self uninstall
Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +

To remove a symbolic link, use either the rm or unlink command followed by the name of the symlink as an argument. Here's an example with unlink:

unlink /usr/local/bin/lgtn

Delete the local source code

Delete the local source code which was copied from the remote repository. You can delete it recursively by:

rm -r ~/fleek-network/lightning

💡 Use the flag f to force remove by skipping any prompts, e.g. rm -rf <PATHNAME>

note

The default install location is $HOME/fleek-network/lightning. If you have selected a different location to store the repository, change the target path.

Disable the systemd service

To disable the Fleek Network Lightning Systemd's service, start by stopping the service.

sudo systemctl stop lightning.service
tip

You can replace lightning.service by lightning.

Disable the lightning service

sudo systemctl disable lightning.service

If you have used the recommended procedures in the install documentation you'll have to remove the Systemd unit (file that defines the service).

rm /etc/systemd/system/lightning.service

Reload the Systemd service daemon

sudo systemctl daemon-reload

Clear the lightning config directory

The Fleek Network lightning config directory is where the configuration, keystore–the location where your private key is hosted–and other system files are stored.

WARNING

Make sure to back up any sensitive data, such as the keystore (private keys), as you won't be able to recover the keys by any other means. If you have any funds associated with it, it'll be lost forever. The Fleek Network team or anyone else will not be able to help recover keys. Your keys, your responsibility.

Alternatively, instead of deleting you can move the files to a custom directory name such as.lightning.backupDATESTAMP, e.g. the example below we've used the date 2023-09-06-1205 as that was the time this text was written:

mv ~/.lightning ~/.lightning.backup202309061205

To clear the lightning config directory remove any files recursively by running the following command:

rm -r ~/.lightning/*

💡 Use the flag f to force remove by skipping any prompts, e.g. rm -rf <PATHNAME>/*

Alternatively, delete the ~/.lightning directory:

rm -r ~/.lightning

Uninstall Cargo and Rust

To uninstall rustc, rustup and cargo run the following command:

rustup self uninstall
Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/references/Lightning CLI/update-cli-from-source-code/index.html b/references/Lightning CLI/update-cli-from-source-code/index.html index 7c74bec6d..4bf139cad 100644 --- a/references/Lightning CLI/update-cli-from-source-code/index.html +++ b/references/Lightning CLI/update-cli-from-source-code/index.html @@ -13,15 +13,15 @@ - +
-
tip

Although the step-by-step instructions described here are simple to follow, this process is available as an automated script. To use it execute the following command in your server terminal and follow the instructions:

curl -sS https://get.fleek.network/update | bash

Switch to the installation user

Switch to the username you've used throughout the installation process.

su <USERNAME>

For example, if you used the username lgtn it'll look like the following command:

su lgtn

Change directory to the source code

If you have installed it via the recommended process or instructions, then the default location where the source code is stored is ~/fleek-network/lightning.

cd ~/fleek-network/lightning
tip

Notice that we use ~, which refers to $HOME. You must use the username used for the installation process. For example, on Ubuntu if you use the username lgtn, the pathname for $HOME is /home/lgtn.

Checkout to branch

Make sure that you are checked in to the correct branch. For the current testnet phase that'd be testnet-alpha-1. If you use any other branch name, your node will not function correctly. Use the branch name testnet-alpha-1.

git checkout testnet-alpha-1
tip

We try to update our documentation promptly but sometimes are a bit behind on any changes we might make in real-time. If you find any typos, such as the wrong branch name, help us by letting us know! Find us in Fleek Network section of our Discord.

Pull the latest changes

Before make sure that you stash or clear any changes you may have in the working directory, as otherwise, git will let you know about local changes–if you'd like to learn more about it read the git stash document.

A quick way to clean is to stash the changes, for example:

git stash 

To pull the latest changes use the git pull command, as follows:

git pull origin testnet-alpha-1

Alternatively, to have to stash and pull, you can reset the repository to the origin.

git fetch origin testnet-alpha-1
git reset --hard origin/testnet-alpha-1
git clean -f
tip

We are using the branch named testnet-alpha-1, which is specific to the early testnet launch. Change to the correct branch name according to needs. For example, in the future the mainnet version will go on branch name main.

Build binary from the source

To build the binary from the source code, we execute the cargo build command:

cargo +stable build --release

Start by removing the existing one:

sudo rm -f "/usr/local/bin/lgtn"

Create a new symlink that links the new build binary to /usr/local/bin/lgtn, as follows:

sudo ln -s ~/fleek-network/lightning/target/release/lightning-node /usr/local/bin/lgtn

Set user path in config.toml

You should be following the create a user recommendation. For our example, we have the username lgtn.

tip

If you have chosen a different username, replace lgtn by the correct username you have selected.

In the config.toml you'll find some and more of the following:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"

Find and replace all instances of ~ in the config file /home/lgtn/.lightning/config.toml. Here's an example using sed:

sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"
caution

The config.toml example below is a shorter version of what you'll encounter, yours might look different. We do this to keep the guide simple to read. Do not copy and replace with the version demonstrated here.

Once changed, all the instances of ~/ should be replaced by your user path e.g. /home/lgtn/. For our example, the output would look like the following:

[BLANK]

[application]
db_path = "/home/lgtn/.lightning/data/app_db"

[consensus]
store_path = "/home/lgtn/.lightning/data/narwhal_store"

[fsstore]
root = "/home/lgtn/.lightning/blockstore"

[resolver]
store_path = "/home/lgtn/.lightning/data/resolver_store"

[signer]
consensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"
node_key_path = "/home/lgtn/.lightning/keystore/node.pem"

Update the systemd service unit

Open and edit the /etc/systemd/system/lightning.service file.

1) Replace <YOUR-USERNAME> with the username. For example, in the documentation we use the username lgtn.

2) Make sure that the ExecStart is set correctly

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/<YOUR-USERNAME>/.lightning/config.toml run
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp

[Install]
WantedBy=multi-user.target
note

The flag -c in the lightning.service ExecStart, is to provide the toml configuration file path e.g. defaults to ~/.lightning/config.toml. This is to avoid the path being determined dynamically (given path base ~ or $HOME), as users might control the systemctl service as a user or sudoer. For example, a sudoer would have the configuration set to /root/.lightning/config.toml or /home/username/.lightning/config.toml depending on using sudo which might cause some confusion to some users.

When complete make sure the file is saved. Followed by a systemctl daemon reload:

sudo systemctl daemon-reload

Clear the data

rm -rf ~/.lightning/data

Depending on how you control the system, this might need sudo.

sudo rm -rf ~/.lightning/data

Update the config.toml

Remove the ~/.lightning/config.toml.

rm ~/.lightning/config.toml

Create a new config.toml

lgtn print-config --default > ~/.lightning/config.toml

Update the config.toml with user home path

In the /home/<USERNAME>/.lightning/config.toml you'll find some and more of the following:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
tip

The configuration properties and values presented above are a shorter version of what you'll find on your configuration.toml. We keep it short to make it easier to follow, do not copy and paste.

Find and replace all instances of ~ in the config file /home/<USERNAME>/.lightning/config.toml.

Here's an example of how to do it using sed:

sed -i "s|~/.lightning|/home/<USERNAME>/.lightning|g" "/home/<USERNAME>/.lightning/config.toml"
tip

Replace the <USERNAME> with your username. For example, if you have followed the recommendation to create a user it would look like /home/lgtn/.lightning/config.toml for the username lgtn.

For example, if your username is lgtn that'd look like this:

sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"

Once modified, you can run a cat to see the content of the files to confirm it has been updated.

cat /home/lgtn/.lightning/config.toml

For our example where we opted in for the username lgtn that would look like:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
Warning

Bear in mind that we are keeping the content of the file short to make it easier to read and follow. The content of your configuration file should look slightly different, amongst these it should contain other properties and values. You should not copy and replace the content of your files with the ones presented here.

Restart the service

Once the cargo build process is completed, you have to restart the service. We're assuming you are using non-root user as recommended, you won't use sudo to start the service. The command will look as follows:

sudo systemctl restart lightning
tip

If you have installed the Fleek Network lightning manually, the installation instructions recommended setting up a systemd service for the Fleek Network process. If you haven't, you're advised to check the instructions provided.

Health checkup

Do a quick health check by running:

curl -w "\p" localhost:4230/health

If successful, you should get the response running and staked, as follows:

running and staked
Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +
tip

Although the step-by-step instructions described here are simple to follow, this process is available as an automated script. To use it execute the following command in your server terminal and follow the instructions:

curl -sS https://get.fleek.network/update | bash

Switch to the installation user

Switch to the username you've used throughout the installation process.

su <USERNAME>

For example, if you used the username lgtn it'll look like the following command:

su lgtn

Change directory to the source code

If you have installed it via the recommended process or instructions, then the default location where the source code is stored is ~/fleek-network/lightning.

cd ~/fleek-network/lightning
tip

Notice that we use ~, which refers to $HOME. You must use the username used for the installation process. For example, on Ubuntu if you use the username lgtn, the pathname for $HOME is /home/lgtn.

Checkout to branch

Make sure that you are checked in to the correct branch. For the current testnet phase that'd be testnet-alpha-1. If you use any other branch name, your node will not function correctly. Use the branch name testnet-alpha-1.

git checkout testnet-alpha-1
tip

We try to update our documentation promptly but sometimes are a bit behind on any changes we might make in real-time. If you find any typos, such as the wrong branch name, help us by letting us know! Find us in Fleek Network section of our Discord.

Pull the latest changes

Before make sure that you stash or clear any changes you may have in the working directory, as otherwise, git will let you know about local changes–if you'd like to learn more about it read the git stash document.

A quick way to clean is to stash the changes, for example:

git stash 

To pull the latest changes use the git pull command, as follows:

git pull origin testnet-alpha-1

Alternatively, to have to stash and pull, you can reset the repository to the origin.

git fetch origin testnet-alpha-1
git reset --hard origin/testnet-alpha-1
git clean -f
tip

We are using the branch named testnet-alpha-1, which is specific to the early testnet launch. Change to the correct branch name according to needs. For example, in the future the mainnet version will go on branch name main.

Build binary from the source

To build the binary from the source code, we execute the cargo build command:

cargo +stable build --release

Start by removing the existing one:

sudo rm -f "/usr/local/bin/lgtn"

Create a new symlink that links the new build binary to /usr/local/bin/lgtn, as follows:

sudo ln -s ~/fleek-network/lightning/target/release/lightning-node /usr/local/bin/lgtn

Set user path in config.toml

You should be following the create a user recommendation. For our example, we have the username lgtn.

tip

If you have chosen a different username, replace lgtn by the correct username you have selected.

In the config.toml you'll find some and more of the following:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"

Find and replace all instances of ~ in the config file /home/lgtn/.lightning/config.toml. Here's an example using sed:

sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"
caution

The config.toml example below is a shorter version of what you'll encounter, yours might look different. We do this to keep the guide simple to read. Do not copy and replace with the version demonstrated here.

Once changed, all the instances of ~/ should be replaced by your user path e.g. /home/lgtn/. For our example, the output would look like the following:

[BLANK]

[application]
db_path = "/home/lgtn/.lightning/data/app_db"

[consensus]
store_path = "/home/lgtn/.lightning/data/narwhal_store"

[fsstore]
root = "/home/lgtn/.lightning/blockstore"

[resolver]
store_path = "/home/lgtn/.lightning/data/resolver_store"

[signer]
consensus_key_path = "/home/lgtn/.lightning/keystore/consensus.pem"
node_key_path = "/home/lgtn/.lightning/keystore/node.pem"

Update the systemd service unit

Open and edit the /etc/systemd/system/lightning.service file.

1) Replace <YOUR-USERNAME> with the username. For example, in the documentation we use the username lgtn.

2) Make sure that the ExecStart is set correctly

[Unit]
Description=Fleek Network Node lightning service

[Service]
Type=simple
MemoryHigh=32G
RestartSec=15s
Restart=always
ExecStart=lgtn -c /home/<YOUR-USERNAME>/.lightning/config.toml run
StandardOutput=append:/var/log/lightning/output.log
StandardError=append:/var/log/lightning/diagnostic.log
Environment=TMPDIR=/var/tmp

[Install]
WantedBy=multi-user.target
note

The flag -c in the lightning.service ExecStart, is to provide the toml configuration file path e.g. defaults to ~/.lightning/config.toml. This is to avoid the path being determined dynamically (given path base ~ or $HOME), as users might control the systemctl service as a user or sudoer. For example, a sudoer would have the configuration set to /root/.lightning/config.toml or /home/username/.lightning/config.toml depending on using sudo which might cause some confusion to some users.

When complete make sure the file is saved. Followed by a systemctl daemon reload:

sudo systemctl daemon-reload

Clear the data

rm -rf ~/.lightning/data

Depending on how you control the system, this might need sudo.

sudo rm -rf ~/.lightning/data

Update the config.toml

Remove the ~/.lightning/config.toml.

rm ~/.lightning/config.toml

Create a new config.toml

lgtn print-config --default > ~/.lightning/config.toml

Update the config.toml with user home path

In the /home/<USERNAME>/.lightning/config.toml you'll find some and more of the following:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
tip

The configuration properties and values presented above are a shorter version of what you'll find on your configuration.toml. We keep it short to make it easier to follow, do not copy and paste.

Find and replace all instances of ~ in the config file /home/<USERNAME>/.lightning/config.toml.

Here's an example of how to do it using sed:

sed -i "s|~/.lightning|/home/<USERNAME>/.lightning|g" "/home/<USERNAME>/.lightning/config.toml"
tip

Replace the <USERNAME> with your username. For example, if you have followed the recommendation to create a user it would look like /home/lgtn/.lightning/config.toml for the username lgtn.

For example, if your username is lgtn that'd look like this:

sed -i "s|~/.lightning|/home/lgtn/.lightning|g" "/home/lgtn/.lightning/config.toml"

Once modified, you can run a cat to see the content of the files to confirm it has been updated.

cat /home/lgtn/.lightning/config.toml

For our example where we opted in for the username lgtn that would look like:

[BLANK]

[application]
db_path = "~/.lightning/data/app_db"

[consensus]
store_path = "~/.lightning/data/narwhal_store"

[fsstore]
root = "~/.lightning/blockstore"

[resolver]
store_path = "~/.lightning/data/resolver_store"

[signer]
consensus_key_path = "~/.lightning/keystore/consensus.pem"
node_key_path = "~/.lightning/keystore/node.pem"
Warning

Bear in mind that we are keeping the content of the file short to make it easier to read and follow. The content of your configuration file should look slightly different, amongst these it should contain other properties and values. You should not copy and replace the content of your files with the ones presented here.

Restart the service

Once the cargo build process is completed, you have to restart the service. We're assuming you are using non-root user as recommended, you won't use sudo to start the service. The command will look as follows:

sudo systemctl restart lightning
tip

If you have installed the Fleek Network lightning manually, the installation instructions recommended setting up a systemd service for the Fleek Network process. If you haven't, you're advised to check the instructions provided.

Health checkup

Do a quick health check by running:

curl -w "\p" localhost:4230/health

If successful, you should get the response running and staked, as follows:

running and staked
Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/references/Systemd/service-keeps-running-after-shutdown/index.html b/references/Systemd/service-keeps-running-after-shutdown/index.html index c8ff71d8b..31b3bb488 100644 --- a/references/Systemd/service-keeps-running-after-shutdown/index.html +++ b/references/Systemd/service-keeps-running-after-shutdown/index.html @@ -13,15 +13,15 @@ - +
-

Stop the service

The Systemd service section tells how to stop the service, as follows:

sudo systemctl stop lightning

Although, the service is set to restart on failure after a few seconds.

Kill the process by name

Force stop a process by name with the command pkill.

pkill -f <PROCESS NAME>

If you've followed the recommended settings, or used the assisted installer the process should be called lgtn.

A Systemd service is managed by Systemctl, to start, stop, to get status or restart. The service controls the Lightning CLI service, that for our convenience named as lgtn–short for lightning. If you haven't followed the recommended settings and have a custom set up, you need to use the custom details you have defined.

To force stop the service lgtn execute the command:

sudo killall lgtn
Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +

Stop the service

The Systemd service section tells how to stop the service, as follows:

sudo systemctl stop lightning

Although, the service is set to restart on failure after a few seconds.

Kill the process by name

Force stop a process by name with the command pkill.

pkill -f <PROCESS NAME>

If you've followed the recommended settings, or used the assisted installer the process should be called lgtn.

A Systemd service is managed by Systemctl, to start, stop, to get status or restart. The service controls the Lightning CLI service, that for our convenience named as lgtn–short for lightning. If you haven't followed the recommended settings and have a custom set up, you need to use the custom details you have defined.

To force stop the service lgtn execute the command:

sudo killall lgtn
Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/references/Systemd/shutting-down-persistance/index.html b/references/Systemd/shutting-down-persistance/index.html index 382ce122f..7e2490871 100644 --- a/references/Systemd/shutting-down-persistance/index.html +++ b/references/Systemd/shutting-down-persistance/index.html @@ -13,15 +13,15 @@ - +
-

Systemd Service as frozen or idle

If you have a Shutting node down message on the service log, the process is likely failing to respond to Systemd shut down command by failing to terminate all the child processes that were started by the service.

The logs should be similar to the following:

2023-09-11 18:02:07 | ERROR | lightning_consensus::consensus - core/consensus/src/consensus.rs:371 - node: XsE9KtedDRUGv22MLHvy8qcc52QsWGWJYY1LBnWhglg=
2023-09-11 18:02:07 | ERROR | lightning_consensus::consensus - core/consensus/src/consensus.rs:371 - node: zBmZaycvQsdFRfe0p5Rig/KgyYPD4yNKQTPDo7JrugM=
2023-09-11 18:02:07 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:373 - ##################
2023-09-11 18:02:07 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:374 - ********************************
RPC server starting up
listening on 0.0.0.0:4230
Shutting node down.
Shutting node down.
Shutting node down.
Shutting node down.
Shutting node down.

To resolve this issue, start by executing a new shutdown command as follows:

systemctl stop lightning

If you need to delegate to root, then use the sudo keyword, as follows:

sudo systemctl stop lightning

Once completed, clear the logs to avoid confusion as the log aggregates messages past and current.

Delete all the log files (output.log and diagnostic.log) by running:

sudo rm -f /var/log/lightning/*.log

Launch the service:

systemctl start lightning

If you need to delegate to root, then use the sudo keyword, as follows:

sudo systemctl start lightning

You can watch the log output of the service by running:

tail -f /var/log/lightning/output.log

The output should be similar to:

2023-09-12 13:53:51 | WARN  | lightning_consensus::consensus - core/consensus/src/consensus.rs:373 - ##################
2023-09-12 13:53:51 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:374 - ********************************

Alternatively, you can watch the diagnostic.log

tail -f /var/log/lightning/diagnostic.log
Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +

Systemd Service as frozen or idle

If you have a Shutting node down message on the service log, the process is likely failing to respond to Systemd shut down command by failing to terminate all the child processes that were started by the service.

The logs should be similar to the following:

2023-09-11 18:02:07 | ERROR | lightning_consensus::consensus - core/consensus/src/consensus.rs:371 - node: XsE9KtedDRUGv22MLHvy8qcc52QsWGWJYY1LBnWhglg=
2023-09-11 18:02:07 | ERROR | lightning_consensus::consensus - core/consensus/src/consensus.rs:371 - node: zBmZaycvQsdFRfe0p5Rig/KgyYPD4yNKQTPDo7JrugM=
2023-09-11 18:02:07 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:373 - ##################
2023-09-11 18:02:07 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:374 - ********************************
RPC server starting up
listening on 0.0.0.0:4230
Shutting node down.
Shutting node down.
Shutting node down.
Shutting node down.
Shutting node down.

To resolve this issue, start by executing a new shutdown command as follows:

systemctl stop lightning

If you need to delegate to root, then use the sudo keyword, as follows:

sudo systemctl stop lightning

Once completed, clear the logs to avoid confusion as the log aggregates messages past and current.

Delete all the log files (output.log and diagnostic.log) by running:

sudo rm -f /var/log/lightning/*.log

Launch the service:

systemctl start lightning

If you need to delegate to root, then use the sudo keyword, as follows:

sudo systemctl start lightning

You can watch the log output of the service by running:

tail -f /var/log/lightning/output.log

The output should be similar to:

2023-09-12 13:53:51 | WARN  | lightning_consensus::consensus - core/consensus/src/consensus.rs:373 - ##################
2023-09-12 13:53:51 | WARN | lightning_consensus::consensus - core/consensus/src/consensus.rs:374 - ********************************

Alternatively, you can watch the diagnostic.log

tail -f /var/log/lightning/diagnostic.log
Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/references/Systemd/user-service/index.html b/references/Systemd/user-service/index.html index 9b44511e3..c18ca31a9 100644 --- a/references/Systemd/user-service/index.html +++ b/references/Systemd/user-service/index.html @@ -13,15 +13,15 @@ - +
-

A user should have the ability to run a Systemd user service unit without having to use sudo to control it.

Check --user support

Use the --user flag when getting the list of unit files.

systemctl --user list-unit-files

It should return a list of unit files.

Put the service unit in the user service

Create the Systemd user units directory:

sudo mkdir -p /etc/systemd/system/user

Move the lightning.service to the system user unit service directory:

mv /etc/systemd/system/lightning.service /etc/systemd/system/user/lightning.service

Check the Load path when running in user mode (--user) in Systemd unit for other alternative user paths, or to understand how it works to customize your server accordingly.

## Reload daemon

sudo systemctl daemon-reload

Systemd service control as --user

Reload the Systemctl daemon by executing the command:

systemctl --user daemon-reload

Enable the service for starting up on system boot:

systemctl --user enable lightning.service

Start the service by:

systemctl --user start lightning

Stop the service by:

systemctl --user stop lightning

Restart the service by:

systemctl --user restart lightning

Check the service status by:

systemctl --user status lightning.service

Problem statement

On tests done in a DigitalOcean Ubuntu 22.x, we had set up user-level services which were operated with --user. When the commands were executed as --user it failed with:

Failed to connect to bus: Operation not permitted (consider using --machine=<user>@.host --user to connect to bus of other user)

The user should be able to operate as user, it shouldn't be required to connect on behalf of other users. This means that even for a simple command, such as to retrieve the list of unit files:

systemctl --user list-unit-files

We'd get the error:

Failed to connect to bus: Operation not permitted (consider using --machine=<user>@.host --user to connect to bus of other user)

For any of the supported user unit locations e.g. $HOME/.config/systemd/user as documented in Systemd unit documentation, the result is the error above.

This is related to the load paths when running in user mode (--user), as described in the discussion here.

User-dependent

$XDG_CONFIG_HOME/systemd/user User configuration (only used when $XDG_CONFIG_HOME is set)

$HOME/.config/systemd/user User configuration (only used when $XDG_CONFIG_HOME is not set)

$XDG_RUNTIME_DIR/systemd/user Runtime units (only used when $XDG_RUNTIME_DIR is set)

$XDG_DATA_HOME/systemd/user Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is set)

$HOME/.local/share/systemd/user Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is not set)

For example, if we check the $XDG_RUNTIME_DIR in a DigitalOcean box, we get the following output:

/run/user/0

For this reason and to provide support for a wider audience of users and systems, we've stuck to sudo to execute the service, but this should not be a requirement and is not recommended.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
- +

A user should have the ability to run a Systemd user service unit without having to use sudo to control it.

Check --user support

Use the --user flag when getting the list of unit files.

systemctl --user list-unit-files

It should return a list of unit files.

Put the service unit in the user service

Create the Systemd user units directory:

sudo mkdir -p /etc/systemd/system/user

Move the lightning.service to the system user unit service directory:

mv /etc/systemd/system/lightning.service /etc/systemd/system/user/lightning.service

Check the Load path when running in user mode (--user) in Systemd unit for other alternative user paths, or to understand how it works to customize your server accordingly.

## Reload daemon

sudo systemctl daemon-reload

Systemd service control as --user

Reload the Systemctl daemon by executing the command:

systemctl --user daemon-reload

Enable the service for starting up on system boot:

systemctl --user enable lightning.service

Start the service by:

systemctl --user start lightning

Stop the service by:

systemctl --user stop lightning

Restart the service by:

systemctl --user restart lightning

Check the service status by:

systemctl --user status lightning.service

Problem statement

On tests done in a DigitalOcean Ubuntu 22.x, we had set up user-level services which were operated with --user. When the commands were executed as --user it failed with:

Failed to connect to bus: Operation not permitted (consider using --machine=<user>@.host --user to connect to bus of other user)

The user should be able to operate as user, it shouldn't be required to connect on behalf of other users. This means that even for a simple command, such as to retrieve the list of unit files:

systemctl --user list-unit-files

We'd get the error:

Failed to connect to bus: Operation not permitted (consider using --machine=<user>@.host --user to connect to bus of other user)

For any of the supported user unit locations e.g. $HOME/.config/systemd/user as documented in Systemd unit documentation, the result is the error above.

This is related to the load paths when running in user mode (--user), as described in the discussion here.

User-dependent

$XDG_CONFIG_HOME/systemd/user User configuration (only used when $XDG_CONFIG_HOME is set)

$HOME/.config/systemd/user User configuration (only used when $XDG_CONFIG_HOME is not set)

$XDG_RUNTIME_DIR/systemd/user Runtime units (only used when $XDG_RUNTIME_DIR is set)

$XDG_DATA_HOME/systemd/user Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is set)

$HOME/.local/share/systemd/user Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is not set)

For example, if we check the $XDG_RUNTIME_DIR in a DigitalOcean box, we get the following output:

/run/user/0

For this reason and to provide support for a wider audience of users and systems, we've stuck to sudo to execute the service, but this should not be a requirement and is not recommended.

Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!
+ \ No newline at end of file diff --git a/references/index.html b/references/index.html index c0b5b3d77..01c739931 100644 --- a/references/index.html +++ b/references/index.html @@ -13,15 +13,15 @@ - +
-

The references provide concise instructions to interface with the system, broken down into commands or small pieces for quick reference.

It differs from Guides which is more descriptive or verbose when providing instructions and how-to's.

To start, find references by consulting the available categories to locate the appropriate content on the sidebar. Our references are also available as a result when using the search feature located at the very top of the documentation site.

- +

The references provide concise instructions to interface with the system, broken down into commands or small pieces for quick reference.

It differs from Guides which is more descriptive or verbose when providing instructions and how-to's.

To start, find references by consulting the available categories to locate the appropriate content on the sidebar. Our references are also available as a result when using the search feature located at the very top of the documentation site.

+ \ No newline at end of file diff --git a/references/tags/backup/index.html b/references/tags/backup/index.html index de030e5f4..b9ec16af5 100644 --- a/references/tags/backup/index.html +++ b/references/tags/backup/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "backup"

View All Tags

Backing up the keystore

The security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.

- + \ No newline at end of file diff --git a/references/tags/build/index.html b/references/tags/build/index.html index f60b730a7..8a744b254 100644 --- a/references/tags/build/index.html +++ b/references/tags/build/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/clean/index.html b/references/tags/clean/index.html index aac4f821f..7880fdefa 100644 --- a/references/tags/clean/index.html +++ b/references/tags/clean/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/clear/index.html b/references/tags/clear/index.html index 894a8c70e..cbe79fe2a 100644 --- a/references/tags/clear/index.html +++ b/references/tags/clear/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/container/index.html b/references/tags/container/index.html index 61f55d09c..f753b3794 100644 --- a/references/tags/container/index.html +++ b/references/tags/container/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/delete/index.html b/references/tags/delete/index.html index 74f3e0f55..33caf8583 100644 --- a/references/tags/delete/index.html +++ b/references/tags/delete/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/docker/index.html b/references/tags/docker/index.html index bceb4fbe2..21ebbf81b 100644 --- a/references/tags/docker/index.html +++ b/references/tags/docker/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/file-permissions/index.html b/references/tags/file-permissions/index.html index 2b9a50af1..13159be64 100644 --- a/references/tags/file-permissions/index.html +++ b/references/tags/file-permissions/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/fix/index.html b/references/tags/fix/index.html index 60266335a..330a1ee70 100644 --- a/references/tags/fix/index.html +++ b/references/tags/fix/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

3 docs tagged with "fix"

View All Tags

Update CLI from source code

Although the step-by-step instructions described here are simple to follow, this process is available as an automated script. To use it execute the following command in your server terminal and follow the instructions:

- + \ No newline at end of file diff --git a/references/tags/frozen/index.html b/references/tags/frozen/index.html index 6cc0e6b7d..a379214a9 100644 --- a/references/tags/frozen/index.html +++ b/references/tags/frozen/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/help/index.html b/references/tags/help/index.html index d076d081e..1b9ca0994 100644 --- a/references/tags/help/index.html +++ b/references/tags/help/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

8 docs tagged with "help"

View All Tags

About references

The references provide concise instructions to interface with the system, broken down into commands or small pieces for quick reference.

Backing up the keystore

The security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.

Update CLI from source code

Although the step-by-step instructions described here are simple to follow, this process is available as an automated script. To use it execute the following command in your server terminal and follow the instructions:

User service

A user should have the ability to run a Systemd user service unit without having to use sudo to control it.

- + \ No newline at end of file diff --git a/references/tags/idle/index.html b/references/tags/idle/index.html index df6d10b11..5ff01808e 100644 --- a/references/tags/idle/index.html +++ b/references/tags/idle/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/image/index.html b/references/tags/image/index.html index 76a757ac5..59fcc4b01 100644 --- a/references/tags/image/index.html +++ b/references/tags/image/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/index.html b/references/tags/index.html index 927975fac..65e2ed892 100644 --- a/references/tags/index.html +++ b/references/tags/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/keystore/index.html b/references/tags/keystore/index.html index c5bb095e8..66d5a32a0 100644 --- a/references/tags/keystore/index.html +++ b/references/tags/keystore/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

3 docs tagged with "keystore"

View All Tags

Backing up the keystore

The security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.

- + \ No newline at end of file diff --git a/references/tags/lost-keys/index.html b/references/tags/lost-keys/index.html index bf8cbdf03..bc935fbb2 100644 --- a/references/tags/lost-keys/index.html +++ b/references/tags/lost-keys/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/ownership/index.html b/references/tags/ownership/index.html index cb53d1669..2d400341c 100644 --- a/references/tags/ownership/index.html +++ b/references/tags/ownership/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/permissions/index.html b/references/tags/permissions/index.html index 4517003a4..6e1acc8e2 100644 --- a/references/tags/permissions/index.html +++ b/references/tags/permissions/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/pkill/index.html b/references/tags/pkill/index.html index 937bdc9dc..e5ef7d674 100644 --- a/references/tags/pkill/index.html +++ b/references/tags/pkill/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/process/index.html b/references/tags/process/index.html index a77640b29..273f7c7e6 100644 --- a/references/tags/process/index.html +++ b/references/tags/process/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/reference/index.html b/references/tags/reference/index.html index 36829885e..8497c1c1e 100644 --- a/references/tags/reference/index.html +++ b/references/tags/reference/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/references/index.html b/references/tags/references/index.html index 95544beb6..3ec3df485 100644 --- a/references/tags/references/index.html +++ b/references/tags/references/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

8 docs tagged with "references"

View All Tags

About references

The references provide concise instructions to interface with the system, broken down into commands or small pieces for quick reference.

Backing up the keystore

The security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.

Update CLI from source code

Although the step-by-step instructions described here are simple to follow, this process is available as an automated script. To use it execute the following command in your server terminal and follow the instructions:

User service

A user should have the ability to run a Systemd user service unit without having to use sudo to control it.

- + \ No newline at end of file diff --git a/references/tags/remove/index.html b/references/tags/remove/index.html index c3c92d502..10908d898 100644 --- a/references/tags/remove/index.html +++ b/references/tags/remove/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/restore/index.html b/references/tags/restore/index.html index 699f9b40c..417f21524 100644 --- a/references/tags/restore/index.html +++ b/references/tags/restore/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "restore"

View All Tags

Backing up the keystore

The security of the private key is the responsibility of the user. Unfortunately, the Fleek Network team and any others are unable to help regain access to private key if lost or failed to secure them. The private keys are the user responsibility. The Fleek Network team doesn't endorse any methods of encryption and storage, the methods described here are for educational purposes only.

- + \ No newline at end of file diff --git a/references/tags/root/index.html b/references/tags/root/index.html index eaa28d23e..14ab579ff 100644 --- a/references/tags/root/index.html +++ b/references/tags/root/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/service-error/index.html b/references/tags/service-error/index.html index 554f6515d..b99cd4575 100644 --- a/references/tags/service-error/index.html +++ b/references/tags/service-error/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/shutdown/index.html b/references/tags/shutdown/index.html index fd991fb0d..6c347f686 100644 --- a/references/tags/shutdown/index.html +++ b/references/tags/shutdown/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/sudoer/index.html b/references/tags/sudoer/index.html index 356a0dd97..ddf294917 100644 --- a/references/tags/sudoer/index.html +++ b/references/tags/sudoer/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/systemctl/index.html b/references/tags/systemctl/index.html index dbb26ce53..97f2f3b8f 100644 --- a/references/tags/systemctl/index.html +++ b/references/tags/systemctl/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

3 docs tagged with "systemctl"

View All Tags

User service

A user should have the ability to run a Systemd user service unit without having to use sudo to control it.

- + \ No newline at end of file diff --git a/references/tags/systemd/index.html b/references/tags/systemd/index.html index 966b6c24a..267ba215f 100644 --- a/references/tags/systemd/index.html +++ b/references/tags/systemd/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

3 docs tagged with "systemd"

View All Tags

User service

A user should have the ability to run a Systemd user service unit without having to use sudo to control it.

- + \ No newline at end of file diff --git a/references/tags/uninstall/index.html b/references/tags/uninstall/index.html index 2ced47fd5..c49820f3d 100644 --- a/references/tags/uninstall/index.html +++ b/references/tags/uninstall/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/references/tags/unit/index.html b/references/tags/unit/index.html index 6d0d65db1..b93773455 100644 --- a/references/tags/unit/index.html +++ b/references/tags/unit/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "unit"

View All Tags

User service

A user should have the ability to run a Systemd user service unit without having to use sudo to control it.

- + \ No newline at end of file diff --git a/references/tags/update/index.html b/references/tags/update/index.html index 97f2060be..3b7726b2f 100644 --- a/references/tags/update/index.html +++ b/references/tags/update/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

2 docs tagged with "update"

View All Tags

Update CLI from source code

Although the step-by-step instructions described here are simple to follow, this process is available as an automated script. To use it execute the following command in your server terminal and follow the instructions:

- + \ No newline at end of file diff --git a/references/tags/upgrade/index.html b/references/tags/upgrade/index.html index 0aeeeb43d..8d0db1477 100644 --- a/references/tags/upgrade/index.html +++ b/references/tags/upgrade/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

2 docs tagged with "upgrade"

View All Tags

Update CLI from source code

Although the step-by-step instructions described here are simple to follow, this process is available as an automated script. To use it execute the following command in your server terminal and follow the instructions:

- + \ No newline at end of file diff --git a/references/tags/user-service/index.html b/references/tags/user-service/index.html index dc8d692dd..43281f94d 100644 --- a/references/tags/user-service/index.html +++ b/references/tags/user-service/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

One doc tagged with "user service"

View All Tags

User service

A user should have the ability to run a Systemd user service unit without having to use sudo to control it.

- + \ No newline at end of file diff --git a/search/index.html b/search/index.html index feafefb1c..425ab4cf8 100644 --- a/search/index.html +++ b/search/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + \ No newline at end of file