Running a own Kadira instance Update: now with a guide!

That is just hilarious to me :smile:
Like those arcade game ports where you have to press a button to add coins

Kadira seems to start fine fine for me, and is connecting to mlab, but for some reason I just get ā€œThis site canā€™t be reachedā€ when I connect with my browser. I know the port is open, as I just tried hosting a meteor app on it, which worked.

it will be meaningful if you explain which part is hilarious to you :slight_smile:

About the ā€œthis site canā€™t be reachedā€ you may want to check env var.

1 Like

see ā€œUpdating to the business planā€ on https://medium.com/@foodfitnesscode/setting-up-kadira-on-a-ubuntu-16-04-server-part-3-f147859fa749 -kudos @lampe .

By the way can you get your App to connect to Kadira-engine? I am getting Chrome console error;

XMLHttpRequest cannot load https://kadira-engine.<KADIRA_OPTIONS_ENDPOINT>/simplentp/sync. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://<ROOT_URL>' is therefore not allowed access.

1 Like

You may want to check out our fork https://github.com/meteor-factory/kadira-server. I made it work with docker-compose. You need to create stripe and meteor apps to obtain your api keys. Only configuration step is making these changes in meteor settings:

  • replace stripe apiKey and publishableKey (if you provide test keys then you can use credit card number 424242424xxx to avoid real charges :slight_smile: )
  • add "meteorDevelopers": { "clientId": "your client id", "secret": "your secret" }

In the future we are going to remove SaaS features so you can run it as self hosted version.

I got it working :smiley:
The problem was I that I was already using port 4000, and I foolishly thought I could just change the port Kadira used in docker-compose.yml
I now instead changed the port of the other process, and let Kadira use its default, which worked!

I got my apps connecting to it now too! Pretty smooth setup with the docker image, other than the port issue :slight_smile:

Kadira process are running fine.

kadiradocker_kad npm run start Up 0.0.0.0:11011->1
ira-engine_1 1011/tcp
kadiradocker_kad npm run start Up
ira-rma_1
kadiradocker_kad su -c /usr/bin/e Up 0.0.0.0:4000->40
ira-ui_1 ntrypoint. ā€¦ 00/tcp, 80/tcp

I am using the nginx conf for kadira-ui and kadira-engine as in the link below.

But, i am not able to access the url i specified in server_name.

am i missing something ?

1 Like

Here are some ideas If all processes are running properly.

  1. By looking at your server name (assumed first part of the string is server name), I would look into network settings(e.g. iptables) for docker containers. My understanding about docker is each container creates virtual interface.
  2. Another idea would be mongoDB being not reachable, but this usually lead to Meteor landing page complains about it.

If you have some log, please post it.

Hope this help :slight_smile:

Did you solve this? I got the same issue, but it was because of wrong port in the app ENV var. I used :4000, but it should be :11011. Then it worked. :slight_smile:

I have now successfully installed Kadira APM on a Amazon EC2 instance running Ubuntu. Is it necessary to write a short guide how to successfully make that work? If someone is interested, let me know.

yes, a guide to setup kadira will be wonderful. I may be missing some of the config steps after the docker compose command to make it work.

MongoDb looked fineā€¦I see it connect successfully

I believe there are some more steps after docker compose that I am missing to make it work on hosting space like Amazon. It would be great to have those details.

I will write a short guide using the Docker images on Amazon EC2.

In the meantime, doublecheck that you do not have any other running processes on the ports 4000 or 11011. If you do, kill them before running docker-compose up.

Then when all is running, open up your public DNS in your browser: (like ec2-x-x-x-x.compute-1.amazonaws.com:4000) with the port 4000.

can you say how you solved it?

I checked the ports are not in use. I started the process and then tried to access the app.
I have setup nginx and tried with the domain configured there.

We have already mapped the machine to the domain, but still it does not work.

Hi folks,

When trying to use @vladgolubevā€™s Docker images, I had the same problem as @antoineschaller in kadira-rma "Error: couldn't initialize connection to host undefined, address is invalid"and realized that it was due to the kadira-rma/start.sh script requiring a Mongo replica set.

To allow it to work without a replica set, first create a directory structure as follows:

PROJECT_ROOT
- docker-compose.yml
- kadira-rma
  - Dockerfile
  - start.sh

Then copy the contents of https://github.com/kadira-open/kadira-server/blob/master/kadira-rma/start.sh into your local start.sh file above and update it as follows:

  1. Replace this: $(pick-mongo-primary $MONGO_URL)
    with this: $MONGO_URL

  2. Replace this: $(pick-mongo-primary $MONGO_METRICS_URL)
    with this: $MONGO_URL

Next, create a Dockerfile under your kadira-rma directory above to use your updated start.sh file as follows:

FROM vladgolubev/kadira-rma:latest

WORKDIR /app

ADD start.sh /app

CMD [ "npm", "run", "start" ]

And then copy @vladgolubevā€™s docker-compose.yml file into your PROJECT_ROOT directory and update it to build your own kadira-rma image from your Dockerfile rather than using his kadira-rma image as follows:

...

  kadira-rma:
    #image: vladgolubev/kadira-rma
    build:
      context: ./kadira-rma
    environment:
      - MONGO_URL=$KADIRA_MONGO_URL
...

After making those changes, I was able to start up Kadira successfully by following @vladgolubevā€™s 3 steps and the connection error in kadira-rma was fixed:

  1. Create MongoDB deployment on https://mlab.com/
  2. export KADIRA_MONGO_URL="mongodb://....."
  3. docker-compose up
2 Likes

I have runned Kadira over the weekend for 1 live app, and 1 staging app. Now the mlab.com account is already maxed with the free tier (500MB storage). That was really fast buildup, so I wonder if that is correct or if there is some misconfiguration?

If the app uses 500MB over 3-4 days, this will require a big volume which will be really expensive for just 1 appā€¦

Any ideas, suggestions etc?

Regarding the Amazon EC2 writeup/guide, i will work on it today. :slight_smile:

I tried following you instruction on a new digital ocean droplet and got the below error.
Have you seen this error at your end ?

kadira-engine_1 | Killed
kadira-engine_1 |
kadira-engine_1 | npm ERR! Linux 4.4.0-78-generic
kadira-engine_1 | npm ERR! argv ā€œ/usr/bin/nodeā€ ā€œ/usr/bin/npmā€ ā€œrunā€ "start"
kadira-engine_1 | npm ERR! node v0.12.10
kadira-engine_1 | npm ERR! npm v2.14.9
kadira-engine_1 | npm ERR! code ELIFECYCLE
kadira-engine_1 | npm ERR! kadira-engine@ start: node server.js
kadira-engine_1 | npm ERR! Exit status 137
kadira-engine_1 | npm ERR!
kadira-engine_1 | npm ERR! Failed at the kadira-engine@ start script ā€˜node server.jsā€™.
kadira-engine_1 | npm ERR! This is most likely a problem with the kadira-engine package,
kadira-engine_1 | npm ERR! not with npm itself.
kadira-engine_1 | npm ERR! Tell the author that this fails on your system:
kadira-engine_1 | npm ERR! node server.js

waiting for the guideā€¦

on our kadira instance we see that mongodb eats more RAM everyday.

So we have a cronjob were we restart kadira once a week

How is the space useage for your mongo DB? Are you over 500MB in total?

Kadira on Amazon EC2

Short guide on how to get this setup, by using the Docker images from vladgolubev and mlab.com

    1. Setup a Ubuntu EC2 instance on Amazon. You can use the smallest plan youā€™d like. I am using t2.micro.
    1. After this is done, open up the security group allocated to the new instance, and add inbound TCP ports 11011 and 4000
      Port 11011 is the kadira engine, and port 4000 is the kadira dashboard. Both must be open.
    1. Setup a mongo database on mlab.com, and have the connection string ready (with username and password)
    1. Start the Ubuntu instance, and install Docker Compose. Use this guide: https://docs.docker.com/compose/install/
    1. Verify that you got docker compose installed correctly and can use it.
    1. Check if some processes are using the ports 4000 or 11011, and if some is, kill them.
  • 7.Create a file named docker-compose.yml with nano, and insert this as a template (this is the exact same as earlier in this thread):
version: '2'

services:
  kadira-engine:
    image: vladgolubev/kadira-engine
    ports:
      - "11011:11011"
    environment:
      - PORT=11011
      - MONGO_URL=$KADIRA_MONGO_URL
      - MONGO_SHARD_URL_one=$KADIRA_MONGO_URL

  kadira-rma:
    image: vladgolubev/kadira-rma
    environment:
      - MONGO_URL=$KADIRA_MONGO_URL

  kadira-ui:
    image: vladgolubev/kadira-ui
    ports:
      - "4000:4000"
    environment:
      - MONGO_URL=$KADIRA_MONGO_URL
      - MONGO_SHARD_URL_one=$KADIRA_MONGO_URL
    1. I had trouble using the export $KADIRA_MONGO_URL variable, so I had to hardcode the string in each place instead. So I changed ā€œ$KADIRA_MONGO_URLā€ with the connection string.
  • 9.The connection string should not have any " wrapping around it. Example:
MONGO_SHARD_URL_one=mongodb://username:password@mlab.com:port/dbname
    1. Run docker-compose up to start
    1. Check for errors in the console output. There should not be any if I have remembered everything here now.
    1. Open your instance public URL with port :4000 to see if you got kadira login. Example: x-x-x-x-x.compute-1.amazonaws.com:4000
    1. Login with admin@gmail.com and pw admin
  • 14.To connect your meteor app with a custom endpoint, use this in your settings.json (obviosly change host.com to your EC2 instance url):
"kadira": { 
            "appId": "<>", 
            "appSecret": "<>",
            "options": {
                "endpoint":"http://host.com:11011"
            }
    },

Things that is not working 100%:

  • Error reporting, since my app is on SSL, and my kadira instance not, this will not work. Struggling a bit to activate SSL on my instance (not very used to Amazon servers etc)
  • Kadira seems to use a lot of space on mlab, after 3-4 days of use the DB is at 500MB. Need to solve this somehow.
2 Likes