A to Z guide: How to setup your own Kadira instance on a VPS like DigitalOcean

https://sergiotapia.me/how-to-setup-your-own-kadira-instance-on-a-vps-like-digitalocean-75ef1458adbd


I had a real tough time getting this up and running but with this forums help, blog posts, random tweets and old github issues, I finally figured it out.

I hope this guide helps you save some time. Leave a :heart: on the Medium post if it helped you, thanks!

9 Likes

Is there anyway to get the endpoint to have SSL? Getting a lot of errors since all my apps are on SSL and the endpoint isn’t

The guide I mention in my article has SSL configured, it’s somewhat involved but take a look. I removed it because even though my app didn’t need it.

Just tried this on a Droplet and I can’t for the life of me get it going. The latest error I’m encountering is along these lines:

npm WARN kadira-ui@1.0.0 No repository field.
npm ERR! Linux 4.4.0-81-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! bcrypt@0.8.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bcrypt@0.8.7 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls bcrypt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/kadira-server/kadira-ui/npm-debug.log

Make sure you have the latest version of node and npm installed. It looks like you have version 4.2.6? Shouldn’t that be like 8.1.3 or at least 6.x?

With 8.0.0 I get this:

root@kadira:~/kadira-server/kadira-ui# ./run.sh 

Even with METEOR_ALLOW_SUPERUSER or --allow-superuser, permissions in your app directory will be incorrect if you ever attempt to perform any Meteor tasks as a normal user. If you need to fix your permissions, run the following command
from the root of your project:

  sudo chown -Rh <username> .meteor/local

/root/.meteor/packages/meteor-tool/.1.5.0.utbu0o++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:218
      throw error;
      ^

RangeError: Invalid array buffer length
    at new ArrayBuffer (native)
    at new Uint8Array (native)
    at createBuffer (buffer.js:25:17)
    at allocate (buffer.js:166:12)
    at new Buffer (buffer.js:56:12)
    at Function.Buffer.concat (buffer.js:294:16)
    at ConcatStream.getBuffer (/tools/utils/http-helpers.js:34:31)
    at Object._.extend.getUrlWithResuming (/tools/utils/http-helpers.js:508:25)
    at /tools/packaging/tropohouse.js:483:34
    at /tools/utils/buildmessage.js:359:18
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:352:34
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:350:23
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at Object.enterJob (/tools/utils/buildmessage.js:324:26)
    at /tools/packaging/tropohouse.js:470:47
    at Array.forEach (native)
    at Function._.each._.forEach (/root/.meteor/packages/meteor-tool/.1.5.0.utbu0o++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
    at /tools/packaging/tropohouse.js:469:11
    at /tools/utils/buildmessage.js:359:18
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:352:34
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:350:23
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at Object.enterJob (/tools/utils/buildmessage.js:324:26)
    at Object.download (/tools/packaging/tropohouse.js:427:20)
    at /tools/packaging/tropohouse.js:600:22
    at /tools/utils/buildmessage.js:359:18
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:352:34
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:350:23
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at Object.enterJob (/tools/utils/buildmessage.js:324:26)
    at [object Object]._.extend.downloadPackagesMissingFromMap (/tools/packaging/tropohouse.js:597:20)
    at /tools/cli/main.js:462:30
    at /tools/packaging/catalog/catalog.js:100:5
    at /tools/utils/buildmessage.js:271:13
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:264:29
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:262:18
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:253:23
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at Object.capture (/tools/utils/buildmessage.js:252:19)
    at Object.catalog.runAndRetryWithRefreshIfHelpful (/tools/packaging/catalog/catalog.js:99:31)
    at /tools/cli/main.js:461:17
    at /tools/utils/buildmessage.js:271:13
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:264:29
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:262:18
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:253:23
    at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:89:14)
    at Object.capture (/tools/utils/buildmessage.js:252:19)
    at /tools/cli/main.js:459:33
    at [object Object]._.extend.withProgressDisplayVisible (/tools/console/console.js:639:14)
    at springboard (/tools/cli/main.js:458:11)
    at /tools/cli/main.js:1126:5

I don’t understand that error. :thinking:

Just wondering if its possible to skip the S3 bucket requirement. What kind of data is kadira storing in S3 buckets?

@dax The Kadira app uses S3 buckets to save CPU performance data. You can’t change it to use something else unless you modify the Kadira source code; to my knowledge.

@sergiotapia thanks. just did a quick grep and it seems AWS related logic is located at kadira-ui/packages/jobs/lib/server/methods.js

4.2.6 is the latest stable version. Kadira works with version 4.2.6

Invalid array buffer = exactly what it says, buffer(memory) is invalid. Try increase the memory of your server instance and try again.

@sergiotapia if you had collaborated on the guide with me, you would know about this too :stuck_out_tongue:

Use nginx with certbot, then the certbot will automatically take care of the ssl for you.

Alternatively, you can also try playing around with the CORS to get this to work without implementing the ssl.

@sergiotapia The kadira setup in the tutorial relies on nginx as a proxy, so the port 4000 and port 11011 on your firewall shouldn’t be exposed to “anywhere”. The default mongodb port 27017 need to be exposed locally. Additionally, the followings are required to work properly.

sudo ufw allow http
sudo ufw allow https

That’s not correct. If I didn’t explicitly allow those ports on my firewall, the Kadira endpoint and Kadira UI didn’t work properly.

That’s because the endpoint should have been :543 instead of :11011 all along, and the ui is ready to receive directed traffic from https (:443). You can give it a try.

What you have works but incorrect because the incoming traffic to kadira bypasses the proxy. Why did we do all the hard work to setup the proxy and end up not using any of it?

1 Like

wow, I think you solved my problem after 2 days of fighting, thanks!