APM
This project reduces the original Kadira APM to a single Meteor project and includes template MUP configuration to let you deploy to any remote server.
Most of the original features are working (like Slack alerts), but there is still a lot of work. Feel free to contribute!
Get up and running with MUP
The easiest way to get this server up and running is to use the recommended configuration with MUP, see below.
Setup steps using Docker
You can also use docker to spin up an instance pretty quick:
docker run -d --name meteor-apm-server \
-p 4000:80 \
-p 7007:7007 \
-p 11011:11011 \
-e PORT=80 \
-e MONGO_URL=mongodb://[your mongodb url] \
-e MONGO_OPLOG_URL=mongodb://[your mongodb oplog url] \
-e ROOT_URL=[e.g. monitoring.yourdomain.com] \
strictlyskyler/meteor-apm-server:1.1.0
This can be useful for running an instance quickly in your own environment with orchestration.
Setup steps using MUP
Keep in mind when using MUP: your user account on the server must be sudoer without password
-
Clone this repo and run
meteor npm install
. -
Copy
mup-placeholder.js
tomup.js
. Replace the placeholder entries in the configuration with your configuration. -
Copy
settings-placeholder.json
tosettings.json
. Change any settings as it suits your project (see Meteor apm settings section below) -
Server configuration steps you need to verify prior to deployment:
a) This setup was tested using a server with at least 512MB of RAM.
b) Allow public access to your server on the following ports: 22, 80, 443, 7007, 11011.
c) In order for SSL configuration to succeed, you must set setup your DNS to point to your server IP address prior to deployment. Make sure to point both
apm.YOUR_DOMAIN.com
andapm-engine.YOUR_DOMAIN.com
to the same server IP address. -
Run
npm run mup-deploy
. -
Visit your APM UI page at
https://apm.YOUR_DOMAIN.com
. Login with usernameadmin@admin.com
, passwordadmin
. CHANGE YOUR PASSWORD FROM THIS DEFAULT. -
In the APM web UI, create a new app and pass the settings to your Meteor app (you can copy paste from the UI):
settings.json
{
...
"kadira": {
"appId": "YOUR_APM_APP_ID",
"appSecret": "YOUR_APM_APP_SECRET",
"options": {
"endpoint": "https://apm-engine.YOUR_DOMAIN.com"
}
},
}
- Re-deploy your Meteor app, and you should see data populating in your APM UI in seconds.
Server Restarts
The custom nginx proxy configuration does not persist through a server restart. There is no current way to hook this into MUP easily, so you will need to run npx mup deploy
again if you need to restart the server. This should not be a problem with normal operation.
Meteor apm settings
metricsLifetime
sets the maximum lifetime of the metrics. Old metrics are removed after each aggregation. The default value is 604800000 (1000 * 60 * 60 * 24 * 7 ^= 7 days).
As a baseline, a current Meteor application with ~500 DAL uses 0.7 GB for 7 days of APM data.
public.apmEngineUrl
refers to the endpoint URL of your application (this allows to display good hints when creating the application)
Configuration details:
If you want to do custom configuration and server setup, here are items to be aware of:
-
A mongo replica set is required. This is set up automatically for you when using the template MUP configuration script.
-
If you are not getting APM data and see a No 'Access-Control-Allow-Origin' header is present console error in your Meteor app, this is due to incorrect nginx proxy configuration. To confirm the issue, ssh into your server (
npx mup ssh
) and rundocker exec mup-nginx-proxy cat /etc/nginx/conf.d/default.conf
. Look for the upstream block forapm-engine.YOUR_DOMAIN.com
, the entry should look like
upstream apm-engine.YOUR_DOMAIN.com {
# YOUR_APP
server SOME_IP:11011;
}
If you see port 80 for that setting, the MUP hook that tries to update this port may be failing.
Changes to original Kadira
- Reduce to one project
- Added MongoDB indexes
- Removed MongoDB shards
- Remove raw data after processed
- Use Meteor 1.6 (Node v8)
- Removed premium packages
ToDo
- Direct db access of alertsman (apm/server/alertsman/server.js) and remove api (apm/server/api/server.js)
- Replace invalid links to old kadira docs