This will get open-source Kadira
running on a dedicated host, almost fully automatically using docker-compose.
Specifically, it includes the following dockers:
- MongoDB server:
storing data in
/opt/kadira-mongo, and accessible via port 27017 - nginx-proxy: maps ports 80, 443 (SSL), and 22022 (SSL) to kadira-engine's 11011
- letsencrypt-nginx-proxy-companion: Acquires Let's Encrypt SSL certificate to support https access.
- kadira-engine: This is where Meteor apps send their data.
Accessible via
http://HOST:11011orhttps://HOST:22022. - kadira-rma: This computes statistics every minute as needed by kadira-ui.
- kadira-ui: Meteor app to present Kadira user interface,
accessible via
http://HOST:4000.
The Dockerification of open-source Kadira was originally done by Vlad Holubiev, as described in this Meteor forum post. What I've added here is:
httpsaccess to kadira-engine (via nginx-proxy)- built-in Mongo server instead of relying on an external service like mlab.com
- cron job to clear out old database entries (see below)
Unfortunately, because of the way letsencrypt-nginx-proxy-companion works, I need ports 80 and 443 to point to kadira-engine instead of kadira-ui. So you need to access the UI via http port 4000.
-
Expose the following ports on your host:
- 22 (if you want to ssh in)
- 80 & 443 (for letsencrypt to work)
- 4000 (for Kadira UI)
- 11011 (if your Meteor app uses
http) - 22022 (if your Meteor app uses
https)
-
Do not expose port 27017, or else your MongoDB will be vulnerable.
-
Install/download docker-compose
-
Clone this repo.
-
Edit
.envto changeHOSTandEMAILenvironment variables. -
If you want to clear out database of old entries (as recommended here for long-term performance), add the included
crontabto your existing crontab, or if you don't have one, just runcrontab crontab(on Linux). You may need to edit the path to the includedflush-mongoscript.
-
Launch dockers, and initialize Mongo replica set:
./docker-compose up -d mongo ./docker-compose exec mongo mongo --eval 'rs.initiate({_id:"kadira", members: [{_id: 0, host: "mongo:27017"}]})' ./docker-compose up -d -
Open
http://HOST:4000and login with emailadmin@gmail.com(initial passwordadmin-- change it immediately in the UI) -
Create your apps
-
Upgrade apps to business plan:
./docker-compose exec mongo mongo kadira --eval 'db.apps.update({},{$set:{plan:"business"}},{multi:true})' -
Visit
http://HOST:4000to monitor your apps.
If your server is running on https, use the port-22022 endpoint
to kadira-engine. For example, add the following line to server/kadira.js:
Kadira.connect(APP_ID, APP_SECRET, {endpoint: 'https://HOST:22022'})If your server is running on http, use the port-11011 endpoint:
Kadira.connect(APP_ID, APP_SECRET, {endpoint: 'http://HOST:11011'})