codius / codiusd

Codius host server-side reference implementation
https://codius.org
Apache License 2.0
81 stars 10 forks source link

Codiusd requires CODIUS_PUBLIC_URI to be set #115

Open ghost opened 6 years ago

ghost commented 6 years ago

Hello, I've installed my host, and it seems to be running but Codiusd is still showing problems:

/usr/lib/node_modules/codiusd/src/services/Config.ts:58 throw new Error('Codiusd requires CODIUS_PUBLIC_URI to be set') ^ Error: Codiusd requires CODIUS_PUBLIC_URI to be set at new Config (/usr/lib/node_modules/codiusd/src/services/Config.ts:58:13) at construct (/usr/lib/node_modules/codiusd/node_modules/reduct/index.ts:34:12) at reduct (/usr/lib/node_modules/codiusd/node_modules/reduct/index.ts:59:7) at new App (/usr/lib/node_modules/codiusd/src/services/App.ts:26:19) at construct (/usr/lib/node_modules/codiusd/node_modules/reduct/index.ts:34:12) at reduct (/usr/lib/node_modules/codiusd/node_modules/reduct/index.ts:59:7) at Object.<anonymous> (/usr/lib/node_modules/codiusd/src/index.ts:8:23) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32)

This is my codiusd.serivce:

[Unit] Description=Codiusd After=network.target nss-lookup.target [Service] ExecStart=/usr/bin/npm start WorkingDirectory=/usr/lib/node_modules/codiusd Environment=DEBUG=* Environment=CODIUS_PUBLIC_URI=https://zodius.gaetanoherman.be Environment=CODIUS_XRP_PER_MONTH=10 Environment=CODIUS_MAX_MEMORY_FRACTION=0.97 Environment=CODIUS_ADDITIONAL_HOST_INFO=true Restart=always StandardOutput=syslog StandardError=syslog SyslogIdentifier=codiusd User=root Group=root [Install] WantedBy=multi-user.target

njlie commented 6 years ago

Try enclosing your environment variables in quotes, like this: Environment="CODIUS_XRP_PER_MONTH=10"

ghost commented 6 years ago

That's how it originally was... I changed it to match my other working host.

I did systemctl daemon-reload && systemctl restart codiusd and it's still giving me the same issues after the above change.

My host seems to be running thought... I have no idea what's wrong.

traviscrist commented 6 years ago

Interesting, thanks for the update! Seems this issue is resolved for now so I'm closing it if it occurs again please reopen the issue.

ghost commented 6 years ago

I'm getting this issue again, I did a complete re-install following the Medium guide by @justmoon and I'm back to zero... I cannot re-open this issue as I didn't close it before...

traviscrist commented 6 years ago

@GaetanoH reopened, is it the same exact error?

ghost commented 6 years ago

Yes, still the same. My host seems to be running but I haven't received any XRP or contracts in that time... When debugging the same error message from above pops up again. All the other instances seems to be running perfect.

traviscrist commented 6 years ago

Oh its the same error, very odd, I tried a contract at https://zodius.gaetanoherman.be but get a 502 error which indicates its something with that public uri not being set correctly.

ghost commented 6 years ago

I've checked that file 20+ times, and copied the file from the tutorial and everything seems the same except the domain itself, which is normal...

traviscrist commented 6 years ago

Can you post your current codius.service file?

ghost commented 6 years ago

I now get this: Unit codius.service could not be found.

This is the current file:

[Unit]
Description=Codiusd
After=network.target nss-lookup.target
[Service]
ExecStart=/usr/bin/npm start
Environment="DEBUG=*"
Environment="CODIUS_PUBLIC_URI=https://zodius.gaetanoherman.be"
Environment="CODIUS_XRP_PER_MONTH=10"
WorkingDirectory=/usr/lib/node_modules/codiusd
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=codiusd
User=root
Group=root
[Install]
WantedBy=multi-user.target
traviscrist commented 6 years ago

Are you running the command systemctl start codiusd when getting Unit codius.service not found?

ghost commented 6 years ago

Yes, now I did, it executes but I still get the Codiusd requires CODIUS_PUBLIC_URI to be set .

njlie commented 6 years ago

Can you navigate to /usr/lib/node_modules/codiusd, then run DEBUG=codius*,ilp* CODIUS_PUBLIC_URI=https://zodius.gaetanoherman.be npm start and post the complete output it sends before it exits?

ghost commented 6 years ago

`

codiusd@1.1.3 start /usr/lib/node_modules/codiusd node src/index.js 2018-07-30T17:43:22.655Z codiusd:App info [ 'starting codiusd...' ] (node:20822) UnhandledPromiseRejectionWarning: OpenError: IO error: lock /var/li b/codius/codius.db/LOCK: Resource temporarily unavailable at /usr/lib/node_modules/codiusd/node_modules/levelup/lib/levelup.js:87:23 at /usr/lib/node_modules/codiusd/node_modules/abstract-leveldown/abstract-le veldown.js:41:14 at /usr/lib/node_modules/codiusd/node_modules/levelup/node_modules/deferred- leveldown/deferred-leveldown.js:20:21 at /usr/lib/node_modules/codiusd/node_modules/abstract-leveldown/abstract-le veldown.js:41:14 at /usr/lib/node_modules/codiusd/node_modules/abstract-leveldown/abstract-le veldown.js:41:14 (node:20822) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejectio n id: 1) (node:20822) [DEP0018] DeprecationWarning: Unhandled promise rejections are depr ecated. In the future, promise rejections that are not handled will terminate th e Node.js process with a non-zero exit code. 2018-07-30T17:43:22.672Z codiusd:Secret debug [ 'reading secret from file. file= /var/lib/codius/secret' ] 2018-07-30T17:43:22.675Z codiusd:Money debug [ 'fetching dcp information' ] 2018-07-30T17:43:22.676Z ilp-plugin debug creating plugin with module ilp-plugin -btp 2018-07-30T17:43:22.676Z ilp-plugin debug creating plugin with credentials { ser ver: 'btp+ws://:c41cb83be8bf04baf182fd52c51abf17@localhost:7768' } 2018-07-30T17:43:22.734Z ilp-plugin-btp:trace debug connected to server 2018-07-30T17:43:22.746Z ilp-plugin-btp:trace debug processing btp packet {"type ":1,"requestId":1814069267,"data":{"protocolData":[]}} 2018-07-30T17:43:22.749Z ilp-plugin-btp:trace debug received BTP packet (TYPE_RE SPONSE, RequestId: 1814069267): {"protocolData":[]} 2018-07-30T17:43:22.757Z ilp-plugin-btp:trace debug processing btp packet {"type ":1,"requestId":140381990,"data":{"protocolData":[{"protocolName":"ilp","content Type":0,"data":{"type":"Buffer","data":[13,129,146,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,113,107,103,46,97,102,114,105,99,97,46,111,11 2,101,110,46,120,72,82,66,72,77,72,98,50,72,71,116,85,88,116,65,95,90,112,86,111 ,121,108,102,100,101,82,122,120,80,73,116,112,111,70,45,88,66,74,101,101,80,99,4 6,108,111,99,97,108,46,79,89,90,107,66,57,55,51,89,80,90,98,97,83,80,110,107,72, 67,117,72,85,80,51,121,65,54,111,72,98,95,119,45,89,48,87,77,97,108,52,57,71,111 ,6,3,88,82,80]}}]}} 2018-07-30T17:43:22.757Z ilp-plugin-btp:trace debug received BTP packet (TYPE_RE SPONSE, RequestId: 140381990): {"protocolData":[{"protocolName":"ilp","contentTy pe":0,"data":{"type":"Buffer","data":[13,129,146,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,113,107,103,46,97,102,114,105,99,97,46,111,112, 101,110,46,120,72,82,66,72,77,72,98,50,72,71,116,85,88,116,65,95,90,112,86,111,1 21,108,102,100,101,82,122,120,80,73,116,112,111,70,45,88,66,74,101,101,80,99,46, 108,111,99,97,108,46,79,89,90,107,66,57,55,51,89,80,90,98,97,83,80,110,107,72,67 ,117,72,85,80,51,121,65,54,111,72,98,95,119,45,89,48,87,77,97,108,52,57,71,111,6 ,3,88,82,80]}}]} 2018-07-30T17:43:22.758Z ilp-protocol-ildcp debug received client info. clientAd dress=g.africa.open.xHRBHMHb2HGtUXtA_ZpVoylfdeRzxPItpoF-XBJeePc.local.OYZkB973YP ZbaSPnkHCuHUP3yA6oHb_w-Y0WMal49Go assetScale=6 assetCode=XRP 2018-07-30T17:43:22.815Z connector:leveldown-store info initialize database. pat h=/var/lib/codius/connector.db 2018-07-30T17:43:22.819Z connector:route-broadcaster info generated random routi ng secret. 2018-07-30T17:43:22.828Z connector:accounts info add account. accountId=parent 2018-07-30T17:43:22.830Z connector:accounts info add account. accountId=child 2018-07-30T17:43:22.837Z connector:accounts warn DEPRECATED: plugin accessed dep recated _store property. accountId=child 2018-07-30T17:43:22.838Z connector:accounts warn DEPRECATED: plugin accessed dep recated _store property. accountId=child 2018-07-30T17:43:22.840Z codiusd:Money debug [ 'establishing network interface f or codius' ] 2018-07-30T17:43:22.841Z codiusd:Money:trace debug [ 'creating codius0 bridge de vice' ] (node:20822) UnhandledPromiseRejectionWarning: OpenError: IO error: lock /var/li b/codius/connector.db/LOCK: Resource temporarily unavailable at /usr/lib/node_modules/codiusd/node_modules/ilp-connector/node_modules/lev elup/lib/levelup.js:91:23 at /usr/lib/node_modules/codiusd/node_modules/deferred-leveldown/node_module s/abstract-leveldown/abstract-leveldown.js:41:14 at /usr/lib/node_modules/codiusd/node_modules/deferred-leveldown/deferred-le veldown.js:20:21 at /usr/lib/node_modules/codiusd/node_modules/ilp-connector/node_modules/abs tract-leveldown/abstract-leveldown.js:41:14 (node:20822) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejectio n id: 2) RTNETLINK answers: File exists 2018-07-30T17:43:22.853Z codiusd:Money:trace debug [ 'bringing up codius0 bridge device' ] 2018-07-30T17:43:22.861Z codiusd:Money:trace debug [ 'assigning addr to codius0. ip=169.254.77.68' ] RTNETLINK answers: File exists 2018-07-30T17:43:22.868Z codiusd:Money debug [ 'starting connector' ] 2018-07-30T17:43:22.871Z connector:balance-middleware warn (!!!) balance middlew are NOT enabled for account, this account can spend UNLIMITED funds. accountId=p arent 2018-07-30T17:43:22.874Z connector:balance-middleware warn (!!!) balance middlew are NOT enabled for account, this account can spend UNLIMITED funds. accountId=c hild 2018-07-30T17:43:22.874Z ilp-plugin-mini-accounts:trace debug registering data h andler 2018-07-30T17:43:22.875Z ilp-plugin-mini-accounts:trace debug registering money handler 2018-07-30T17:43:22.887Z ilp-protocol-ildcp debug received client info. clientAd dress=g.africa.open.xHRBHMHb2HGtUXtA_ZpVoylfdeRzxPItpoF-XBJeePc.local.rgtMWQEwcx HNNgKmTaP8ysG9VcSlo-YMn_c7v0DodOA assetScale=6 assetCode=XRP 2018-07-30T17:43:22.888Z connector:accounts info setting ilp address. oldAddress =unknown newAddress=g.africa.open.xHRBHMHb2HGtUXtA_ZpVoylfdeRzxPItpoF-XBJeePc.lo cal.rgtMWQEwcxHNNgKmTaP8ysG9VcSlo-YMn_c7v0DodOA 2018-07-30T17:43:22.904Z ilp-protocol-ildcp debug received client info. clientAd dress=g.africa.open.xHRBHMHb2HGtUXtA_ZpVoylfdeRzxPItpoF-XBJeePc.local.rgtMWQEwcx HNNgKmTaP8ysG9VcSlo-YMn_c7v0DodOA.child assetScale=6 assetCode=XRP 2018-07-30T17:43:22.905Z ilp-plugin-mini-accounts:info debug listening on port 7 768 2018-07-30T17:43:22.908Z connector:admin-api info listen called 2018-07-30T17:43:22.908Z connector:app info connector ready (republic attitude). address=g.africa.open.xHRBHMHb2HGtUXtA_ZpVoylfdeRzxPItpoF-XBJeePc.local.rgtMWQE wcxHNNgKmTaP8ysG9VcSlo-YMn_c7v0DodOA 2018-07-30T17:43:22.921Z ilp-cog-hapi debug connecting listener 2018-07-30T17:43:22.922Z ilp-plugin debug creating plugin with module ilp-plugin -btp 2018-07-30T17:43:22.922Z ilp-plugin debug creating plugin with credentials { ser ver: 'btp+ws://:404171cc696d064114be5c15b09f19c3@localhost:7768' } 2018-07-30T17:43:22.923Z ilp-cog-listener debug registering payment handler 2018-07-30T17:43:22.924Z ilp-plugin-btp:trace debug registering data handler Error: listen EADDRINUSE 169.254.77.68:7768 at Server.setupListenHandle [as _listen2] (net.js:1336:14) at listenInCluster (net.js:1384:12) at doListen (net.js:1510:7) at process._tickCallback (internal/process/next_tick.js:63:19) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! codiusd@1.1.3 start: node src/index.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the codiusd@1.1.3 start script. npm ERR! This is probably not a problem with npm. There is likely additional log ging output above. npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2018-07-30T17_43_22_947Z-debug.log`

ghost commented 6 years ago

This is what the log file said: 0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ] 2 info using npm@6.1.0 3 info using node@v10.7.0 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle codiusd@1.1.3~prestart: codiusd@1.1.3 6 info lifecycle codiusd@1.1.3~start: codiusd@1.1.3 7 verbose lifecycle codiusd@1.1.3~start: unsafe-perm in lifecycle true 8 verbose lifecycle codiusd@1.1.3~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/lib/node_modules/codiusd/node_modules/.bin:/usr/lib/node_modules/.bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin 9 verbose lifecycle codiusd@1.1.3~start: CWD: /usr/lib/node_modules/codiusd 10 silly lifecycle codiusd@1.1.3~start: Args: [ '-c', 'node src/index.js' ] 11 silly lifecycle codiusd@1.1.3~start: Returned: code: 1 signal: null 12 info lifecycle codiusd@1.1.3~start: Failed to exec start script 13 verbose stack Error: codiusd@1.1.3 start:node src/index.js 13 verbose stack Exit status 1 13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:304:16) 13 verbose stack at EventEmitter.emit (events.js:182:13) 13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:182:13) 13 verbose stack at maybeClose (internal/child_process.js:961:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5) 14 verbose pkgid codiusd@1.1.3 15 verbose cwd /usr/lib/node_modules/codiusd 16 verbose Linux 3.10.0-862.2.3.el7.x86_64 17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start" 18 verbose node v10.7.0 19 verbose npm v6.1.0 20 error code ELIFECYCLE 21 error errno 1 22 error codiusd@1.1.3 start:node src/index.js 22 error Exit status 1 23 error Failed at the codiusd@1.1.3 start script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]

jmannanc commented 6 years ago

Just got this error as well. I installed using the community script and ran debug with it as well. Got the same "Public URI not set" error and the same quotation marks not around environment variables. I've added them and still nothing.

Ran the commands above the @njlie gave, and here is a hastebin with the output of it and a bunch of info: https://hastebin.com/nilidaxiqo.coffeescript

njlie commented 6 years ago

@GaetanoH @SneakyFish5 Looks like the codiusd process being run by systemd is still running, hence the EADDRINUSE error. Can you both run systemctl stop codiusd and then try again?

jmannanc commented 6 years ago

This is what I got: https://hastebin.com/bigejopule.coffeescript

jmannanc commented 6 years ago

Stopped it after a little bit but if you want me to run it for longer I can

ghost commented 6 years ago

This is what mine said: https://hastebin.com/iwanubocin.js

njlie commented 6 years ago

@SneakyFish5 It looks like it's performing normally at that point. At that point it's just pinging other hosts and outputting the results. If you want to suppress that output I'd amend the startup command to DEBUG=codius*,ilp*,-*Peer* CODIUS_PUBLIC_URI=https://example.uri.com npm start.

Try leaving it on and uploading to your host while running it. If it works there then it'd be a problem with the service file and we can start looking at that.

Also, did you install Codius using the community install script?

njlie commented 6 years ago

@GaetanoH Can you do the same as what I suggested in my previous post? It looks like yours is running normally too, so I'd like to see if uploads to your Codius host work while in that state.

jmannanc commented 6 years ago

@njlie yes I did use the community install script made by baltazar. I just tried uploading from the test upload tool (https://upload.host1.codius.live/) and I got this error: request to https://codius.sneakyfish5.xyz/pods?duration=300 failed, reason: connect ETIMEDOUT 104.196.166.193:443

My debug log is here: https://hastebin.com/cuyuvofara.cs

njlie commented 6 years ago

@SneakyFish5 I think you used the example URI I put in the command. Replace it with yours and try it again.

ghost commented 6 years ago

Mine did a succesful load: { URL: https://l2xvchk27rbrnh3mc3y4p3iaeoonjzur2u24qxuod2iaqd5mlioa.codius.gaetanoherman.be/, Manifest Hash: l2xvchk27rbrnh3mc3y4p3iaeoonjzur2u24qxuod2iaqd5mlioa, Host: https://codius.gaetanoherman.be, Expiry: 2018-07-30T18:19:53.007Z, Expiration Date: 07-30-2018 6:19:53 +0000, Expires: in 5 minutes, Price Paid: 1178, }

Debug log is: https://hastebin.com/aquseqorag.http

jmannanc commented 6 years ago

Oh yea my bad. I retried it with my correct URI and got this output from debug: https://hastebin.com/dopotivosu.cs

I got the same error message from the upload tool though.

njlie commented 6 years ago

@GaetanoH @SneakyFish5 If you can, can you each DM me on Gitter? I'd like to try and debug this in real time with the two of you.