匿名用户2021年12月24日
35阅读
开发技术Python
所属分类Web3、开源货币/比特币
授权协议View license

作品详情

PoolDesign/Theory

Thenodejs-poolisbuiltaroundasmallseriesofcoredaemonsthatshareaccesstoasingleLMDBtablefortrackingofshares,withMySQLbeingusedtocentralizeconfigurationsandensuresimpleaccessfromlocal/remotenodes.Thecoredaemonsfollow:

api-MainAPIforthefrontendtouseandpulldatafrom.Expectstobehostedat/remoteShare-MainAPIforconsumingsharesfromremote/localpools.Expectstobehostedat/leafApipool-Wheretheminersconnectto.longRunner-Databasesharecleanup.payments-Handlesallpaymentstoworkers.blockManager-UnlocksblocksanddistributespaymentsintoMySQLworker-Doesregularprocessingofstatisticsandsendsstatuse-mailsfornon-activeminers.

APIlistensonport8001,remoteSharelistenson8000

moneroocean.stream(Thereferenceimplementation)usesthefollowingsetup:

https://moneroocean.streamishostedonitsownserver,asthemainwebsiteisastaticfrontendhttps://api.moneroocean.streamhostsapi,remoteShare,longRunner,payments,blockManager,worker,asthesemustallbehostedwithaccesstothesameLMDBdatabase.

SampleCaddyfileforAPI:

https://api.moneroocean.stream{proxy/leafApi127.0.0.1:8000proxy/127.0.0.1:8001corsgzip}

Itiscriticallyimportantthatyourwebserverdoesnottruncatethe/leafApiportionoftheURLfortheremoteSharedaemon,oritwillnotfunction!LocalpoolserversDOusetheremoteSharedaemon,asthisprovidesabufferincaseofanerrorwithLMDBoranotherbugwithinthesystem,allowingsharesandblockstoqueueforsubmissionassoonastheleafApi/remoteSharedaemonsarebackupandrespondingwith200's.

SetupInstructionsServerRequirements4GbRam2CPUCores(withAES_NI)60GbSSD-BackedStorage-Ifyou'redoingamulti-serverinstall,theleafnodesdonotneedthismuchstorage.Theyjustneedenoughstoragetoholdtheblockchainforyournode.Thepoolcomesconfiguredtouseupto24GbofstorageforLMDB.AssumingyouhavethelongRunnerworkerrunning,itshouldnevergetnearthissize,butbeawarethatit/can/bloatreadilyifthingserror,sobereadyforthis!Notably,thishappenstobeapproximatelythesizeofa4Gblinodeinstance,whichiswherethemajorityofautomateddeploymenttestinghappened!Pre-DeployIfyou'replanningonusinge-mail,you'llwanttosetupanaccountathttps://mailgun.com(It'sfreefor10ke-mails/month!),soyoucannotifyminers.Thisalsoservesasthebackendforpasswordresetemails,alongwithothersortsofe-mailsfromthepool,includingpoolstartup,poolMoneroddaemonlags,etcsoit'shighlysuggested!Pre-Generatethewallets,ordon't,it'suptoyou!You'llneedtheaddressesaftertheinstalliscomplete,soI'dsuggestmakingsureyouhavethemavailable.Informationonsuggestedsetupsarefoundbelow.Ifyou'regoingtobeofferingPPS,PLEASEmakesureyouloadthepoolwalletwithXMRbeforeyougettoofaralong.YourpoolwilltriggerPPSpaymentsonitsown,andfairlyreadily,soyouneedsomefloatinthere!Makeanon-rootuser,andruntheinstallerfromthere!DeploymentviaInstallerAddyouruserto/etc/sudoers,thismustbedonesothescriptcansudoupanddoit'sjob.Wesuggestpasswordlesssudo.Suggestedline:<USER>ALL=(ALL)NOPASSWD:ALL.Oursamplebuildsuse:pooldaemonALL=(ALL)NOPASSWD:ALLRunthedeployscriptasaNON-ROOTUSER.Thisisveryimportant!Thisscriptwillinstallthepooltowhateveruserit'srunningunder!Also.Gogetacoffee,thissuckerbootstrapsthemoneroinstallation.Onceit'scomplete,changeasconfig.jsonappropriate.Itispre-loadedforalocalinstallofeverything,runningon127.0.0.1.Thiswillworkperfectlyfineifyou'reusingasinglenodesetup.You'llalsowanttosetbind_iptotheexternalIPofthepoolserver,andhostnametotheresolvablehostnameforthepoolserver.pool_idismostlyusedformulti-serverinstallationstoprovideuniqueidentifiersinthebackend.Youwillalsowanttorun:source~/.bashrcThiswillactivateNVMandgetthingsworkingforthefollowingpm2steps.You'llneedtochangetheAPIendpointforthefrontendcodeinthepoolui/build/globals.jsandpoolui/build/globals.default.js--Thiswillusuallybehttp(s)://<yourserverFQDN>/apiunlessyoutweakcaddy!Thedefaultdatabasedirectory/home/<username>/pool_db/isalreadybeencreatedduringstartup.Ifyouchangethedb_storage_pathjustmakesureyouruserhaswritepermissionsfornewpath.Run:pm2restartapitoreloadtheAPIforusage.Hopintothewebinterface(Shouldbeathttps://<yourserverIP>/admin.html),thenloginwithAdministrator/Password123,MAKESURETOCHANGETHISPASSWORDONCEYOULOGIN.<-Thisstepiscurrentlynotactive,we'rewaitingforthefrontendtocatchup!HeaddowntotheManualSQLConfigurationtotakealookatwhatneedstobedonebyhandfornow.Fromtheadminpanel,youcanconfigureallofyourpool'ssettingsforaddresses,paymentthresholds,etc.Onceyou'rehappywiththesettings,goaheadandstartallthepooldaemons,commandsfollow.
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论