Kadira APM Setup
Short guide on how to get Kadira APM setup with Docker.
- Setup at least on instance with 1.7GB RAM.
- Open up firewall ports for inbound TCP port 443. Also open up 11011 & 4000 for debugging. Port 11011 is kadira-engine, port 4000 is the kadira-ui.
- Setup a Mongo database, and have the connection string ready (with username and password).
- Install Docker https://docs.docker.com/engine/installation/linux/docker-ce/debian/ , run
sudo usermod -aG docker your-user
, then install Docker Compose https://docs.docker.com/compose/install/ on the instance. - Verify that you have docker and docker compose installed correctly and can use it.
- Setup A-records to point your kadira-ip to kadira-engine.domain.com and kadira-ui.domain.com.
- Setup a new file named
.env
with the contents:
MONGO_URL=mongodb://user:pass@host:27017/db
NGINX_FILES_PATH=/home/your-username/nginx
- Download this file to use as a template:
curl https://gist.githubusercontent.com/markoshust/46a0acad8f828328786b3a6396de0617/raw/68c8232a1b80885b151c5bfb82d4e126d32a2f9c/docker-compose.yml > docker-compose.yml
- Download the nginx template file:
curl https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl > nginx.tmpl
- Run
docker-compose run nginx-letsencrypt
to generate an SSL secret. This step may take a few minutes to complete. - Run
docker-compose up
to start. This will also generate any needed SSL certs at runtime. - Check for errors in the console output, there shouldn't be any. It may take a little bit to initially startup the containers. When complete you can access your kadira-ui at https://kadira-ui.domain.com.
- Login with username
admin@gmail.com
and passwordadmin
. Change your admin password. Setup a new project for the domain you want to monitor to get your API keys. - To connect your meteor app with a custom endpoint, set these env vars (change kadira-engine.domain.com to your kadira instance url):
KADIRA_APP_ID=your-app-id
KADIRA_APP_SECRET=your-app-secret
KADIRA_OPTIONS_ENDPOINT=https://kadira-engine.domain.com
or with Meteor settings:
{
"kadira": {
"appId": "your-app-id",
"appSecret": "your-app-secret",
"options": {
"endpoint": "https://kadira-engine.domain.com"
}
}
}
- Connect to the database and open the
apps
table. Update your app account to"plan": "business"
to unlock all features for that account. Also add"plan": "business"
to your record in theusers
table. - Kadira uses quite a bit of disk space, so it's a good idea to have a pruning script to remove stale records. For example, prune out everything before August 15, 2017, use the following queries:
db.getCollection('prodStats').remove({"time": {"$lte": new ISODate("2017-08-15T00:00:00.000Z")}})
db.getCollection('pubMetrics').remove({"_id.time": {"$lte": new ISODate("2017-08-15T00:00:00.000Z")}})
db.getCollection('pubTraces').remove({"startTime": {"$lte": new ISODate("2017-08-15T00:00:00.000Z")}})
db.getCollection('rawErrorMetrics').remove({"value.startTime": {"$lte": new ISODate("2017-08-15T00:00:00.000Z")}})
db.getCollection('rawMethodsMetrics').remove({"value.startTime": {"$lte": new ISODate("2017-08-15T00:00:00.000Z")}})
db.getCollection('rawPubMetrics').remove({"value.startTime": {"$lte": new ISODate("2017-08-15T00:00:00.000Z")}})
db.getCollection('rawSystemMetrics').remove({"value.startTime": {"$lte": new ISODate("2017-08-15T00:00:00.000Z")}})
db.getCollection('rmaLogs').remove({"startedAt": {"$lte": new ISODate("2017-08-15T00:00:00.000Z")}})
db.getCollection('systemMetrics').remove({"_id.time": {"$lte": new ISODate("2017-08-15T00:00:00.000Z")}})
I've been encountering the disk issue you reference in #15 -- causing my instance to basically choke up. Any tips on how to implement that as a cronjob script on linux?