monerod-node-vps

我要开发同款
匿名用户2021年11月30日
40阅读
所属分类、Web3、区块链
授权协议Readme

作品详情

Ansibletooltocreate/managepublicMoneronodes.

ThepurposeofthisprojectistosimplifythecreationandmaintenanceofpublicMoneronodes;speciallyonvirtualprivateservers,butingeneralonanylinuxmachinewhereyouhaveaccess.Wheremaintenanceinvolvesthefollowingtasks:

UpgradingMoneroversion.Enabling,disablingandupdatingflagspassedtomonerod.Extendingdiskspaceallocatedtostoretheblockchain.

Theprojectaimsto:

Beassimpleaspossible.Bydefault,produceanodethatseedstheblockchain(publicnode).Produceasecureandstablesetup.Produceaninexpensivesetupbydefault.Makemaintenanceaseasyasposible.Allowcreatingmainnet,stagenetortestnetnodes.

Theprojectdoesn'tintendtoproduceasetupoptimizedformining.

RequirementsPythonAnsibleAnsiblecollectionsdefinedinrequirements.yml.Installwiththefollowingcommand:ansible-galaxyinstall-rrequirements.yml

YoualsoneedtheappropriateAPIKeysfortheVPSprovider(Hetzner,DigitalOceanandVultronly,forthetimebeing),andpublicSSHkeytosetupintheserver.

LongtermgoalsExtendtobeabletosetupnodesinotherVPSproviders,besidesHetzner,DigitalOceanandVultrTorsetup.MaybeincludeautomatedCIsetup.Usage

Setupthefollowingenvironmentvariables

HETZNER_API_KEY,ifyouintendtocreate/managenodesonHetznercloud(bydefault,thisprojectattemptstocreate1nodeonHetzner)DO_API_KEY,ifyouintendtocreate/managenodesonDigitalOceanVULTR_API_KEY,ifyouintendtocreate/managenodesonVultrPUBLIC_SSH_KEY_NAMEPUBLIC_SSH_KEY

Run

ansible-playbook-ihosts.ymlsetup-nodes.ymltosetupyourconfigurednodes

Thatshouldcreate:

1publicMoneromainnetnode,onHetznercloud.Runningonthesmallestservertype(cx11:1vcpu,2gbram)Witha50GBvolumeattachedKeepingaprunedblockchainIt'dexposeport22forssh,port18080forp2p,andport18089forrestrictedRPC

Theestimatedcostofthissetupislessthan6€/month

Furtherconfigurationcanbeachievedviaotherenvironmentvariables(they'relistedbelow),andthroughhosts.ymlfile(seeEXAMPLES.mdforreference)

Environmentvariablesreference

HETZNER_API_KEY:YourAPIkeyforHetzner.It'snecessaryifyouconfiguredthecreation/maintenanceofnodesonHetznercloud(whichisthecase,bydefault).ItshouldbeanAPIkeywithreadandwritepermissions.

DO_API_KEY:YourAPIkeyforDigitalOcean.It'snecessaryifyouconfiguredthecreation/maintenanceofnodesonDigitalOceancloud.ItshouldbeanAPIkeywithreadandwritepermissions.

VULTR_API_KEY:YourAPIkeyforVultr.It'snecessaryifyouconfiguredthecreation/maintenanceofnodesonVultrcloud.

PUBLIC_SSH_KEY_NAME:AnameforyourpublicSSHkeyinHetzner

PUBLIC_SSH_KEY:YourpublicSSHkey.It'dbecreatedinHetznerandembeddedinyournode;tobeabletosetupthenode,andaccessitingeneral.

NETWORK_FLAG:

Emptybydefault,whichindicatesmainnet--stagenet--testnet

HETZNER_REGION:TheHetznerdatacenterwherethenodeshouldbecreated.Defaultstofsn1.Seethisforcontext

HETZNER_SERVER_TYPE:ThetypeofHetznerservertocreateforthenode.Defaultstocx11,whichisthesmallestavailable.SeePricesSectionhere

HETZNER_IMAGE:TheHetznermachineimagetouseontheserver.Defaultstoubuntu-20.04.

HETZNER_VOLUME_GB_SIZE:Thesizeofhevolumethatwillholdtheblochain,expressedingb.Defaultsto50

DO_REGION:TheDigitalOceandatacenterwherethenodeshouldbecreated.Defaultstonyc1.Seethisforcontext

DO_SERVER_TYPE:ThetypeofDigitalOceandroplettocreateforthenode.Defaultstos-1vcpu-2gb,whichisthesmallestavailablewith2gbRAM.Seepricessectionhere

DO_IMAGE:TheDigitalOceanmachineimagetouseontheserver.Defaultstoubuntu-20-04-x64

DO_VOLUME_GB_SIZE:Thesizeofthevolumethatwillholdtheblockchain,expressedingb.Defaultsto50

VULTR_REGION:TheVultrregionwherethenodeshouldbecreated.DefaultstoNewJersey,becausethat'stheonlyVultrregionthatsupportsvolumes.

VULTR_SERVER_TYPE:ThetypeofVultrservertocreateforthenode.Defaultsto2048MBRAM,55GBSSD,2.00TBBW.ChecktheservertypesofferedbyVultrhere

VULTR_IMAGE:TheVultrmachineimagetouseontheserver.DefaultstoUbuntu20.04x64.Othersavailablelistedhere

VULTR_VOLUME_GB_SIZE:Thesizeofthevolumethatwillholdtheblockchain,expressedingb.Defaultsto50

MONERO_DESIRED_VERSION:TheversionofMonerothatthenodeshouldberunning.Defaultstov0.17.1.9atthemoment.

MONERO_DOWNLOAD_URL:TheURLwhereMoneroshouldbedownloadedfrom.Defaultstohttps://downloads.getmonero.org/cli/linux64

MONERO_DOWNLOAD_CHECKSUM:ThechecksumoftheMonerodownload,toverifyitsintegrity.DefaultstothechecksumofMonerov0.17.1.9atthemoment:sha256:0fb6f53b7b9b3b205151c652b6c9ca7e735f80bfe78427d1061f042723ee6381

PRUNED_NODE:Whetherthenodeshouldrunaprunedblockchain,tosavediskspace.DefaultstoTrue

ENABLE_DNS_BLOCKLIST:Whetherthenodeshouldrunwith--enabled-dns-blocklist.DefaultstoTrue.Seethisforcontext

LIMIT_RATE_UPandLIMIT_RATE_DOWN:LimittheuploadspeedavailabletotheMoneronode.Defaultstoempty,whichmeansthatthedefaultlimitsconfiguredbyMoneroapply.

OUT_PEERSandIN_PEERS:Limitthenumberofp2pconnections.Defaultstoempty,whichappliesthedefaultlimitsconfiguredbyMonero.

MEMORY_MAX:PreventsthenodefromusingmorethanthisamountofRAM.Otherwiseitgetsrestarted.Defaultsto1536M.Seesystemd'sdocsforcontext

MONERO_BAN_LIST_URL:Ifprovided,downloadsalistofIPsofMoneronodestoban.Defaultstoempty.

ANSIBLE_HOST_KEY_CHECKING:SettoFalsetoavoidhavingtomanuallyconfirmtheauthenticityofhostsshkeys.SeethisStackOverflowthreadforcontext

UpgradingMoneroVersion

TheenvvarMONERO_DESIRED_VERSIONgovernstheversionofMonerowewantinstalledonthenode.Iftheversiondoesn'tmatch,thisprojectdownloadsMoneroagainfromMONERO_DOWNLOAD_URL.So,theprocessofupgradingyournodetothelatestversionwouldlooklike:

SetMONERO_DESIRED_VERSIONtothelatestversionSetMONERO_DOWNLOAD_CHECKSUMtothechecksumoftheversionyou'redownloading.ThisisprovidedonMonero'swebsiteRunthisprojectExtendingthevolumeallocatedtostoretheblockchain

SimplyincreasingHETZNER_VOLUME_GB_SIZE,VULTR_VOLUME_GB_SIZEorDO_VOLUME_GB_SIZEshouldtakecareofextendingthevolumeandthefilesystem,fornodeshostedonHetzner,VultrandDigitalOcean,respectively.

Allocatingmorenetworkresources

ThisRedditthreadsuggeststhatincreasingOUT_PEERS,IN_PEERS,LIMIT_RATE_UP,LIMIT_RATE_DOWNwouldincreasethenode'scontributiontothenetwork,byconnectingtomorepeers,acceptingconcurrentconnectionsfrommorepeers,andallocatingmoreup/downbandwithtothenode.

Thesetupsuggestedinthatthreadcanbeachivedwith:

OUT_PEERS=512IN_PEERS=512LIMIT_RATE_UP=92160LIMIT_RATE_DOWN=92160

Theextratrafficmightgenerateadditionalcoststhough.CheckPricingsectionof:

https://www.hetzner.com/cloudhttps://www.digitalocean.com/docs/billing/bandwidth/https://www.vultr.com/resources/faq/#bandwidthoveragerate
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论