Quellcode durchsuchen

Backend mongodb

Guillermo Espinoza vor 8 Jahren
Ursprung
Commit
44e900a5cb

+ 2 - 12
docker-compose.yml

@@ -188,22 +188,11 @@ services:
     links:
       - mongodb:mongo
 
-  backend_mongodb: 
-    image: backend_mongodb
-    build:
-      context: statsd/backend/mongodb
-    volumes:
-      - ./statsd/backend/mongodb:/opt/config
-      - ./statsd/backend/mongodb/mongodb.js:/opt/statsd/backends/mongodb.js
-    links:
-      - mongodb:mongodb
-
   mongodb:
     volumes: 
       - ./mongodb:/data/db 
     image: mongo:3.4
 
-
   statsd:
     restart: always
     image: fd3-statsd-mysql-backend
@@ -212,10 +201,11 @@ services:
     ports:
       - "8125:8125/udp"
     links:
+      - mongodb:mongodb
       - mysql:mysql
-      - backend_mongodb:backend_mongodb
     volumes:
       - ./statsd/statsd/:/opt/config
+      - ./statsd/backend/mongodb/mongodb.js:/opt/statsd/backends/mongodb.js
  
   supervisord:
     restart: always

+ 0 - 15
statsd/backend/mongodb/Dockerfile

@@ -1,15 +0,0 @@
-FROM debian:8
-run apt-get update && apt-get install -yq git nodejs npm
-
-RUN npm install -g n
-
-run apt-get install -yq wget
-RUN n stable
-
-RUN git clone https://github.com/etsy/statsd /opt/statsd
-RUN wget https://raw.githubusercontent.com/dynmeth/mongo-statsd-backend/master/lib/index.js -O /opt/statsd/backends/mongodb.js
-
-RUN cd /opt/statsd ; npm install --save mongodb
-RUN cd /opt/statsd ; npm install --save async
-
-CMD node /opt/statsd/stats.js /opt/config/statsd.config.js

+ 0 - 20
statsd/backend/mongodb/statsd.config.js

@@ -1,20 +0,0 @@
-{
-	"backends" : [ 
-	//	"./backends/console" ,
-		"./backends/mongodb"
-		],
-	"server" : "./servers/udp",
-	"address" : "0.0.0.0",
-	"port": 8125,
-		"debug" : false,
-	"deleteGauges":   true,
-	"deleteTimers":   true,
-	"deleteSets" :    true,
-	"deleteCounters": true,
-
-	"mongoHost": 'mongodb',
-	"mongoPort": 27017,
-	"mongoMax": 2160, 
-	"mongoPrefix": false, 
-	"mongoName": 'statsd'
-}

+ 5 - 0
statsd/statsd/Dockerfile

@@ -14,4 +14,9 @@ RUN cd /opt/nodejs-statsd-mysql-backend ; npm install sequence
 RUN git clone https://github.com/etsy/statsd /opt/statsd
 RUN apt-get install -yq wget 
 
+RUN wget https://raw.githubusercontent.com/dynmeth/mongo-statsd-backend/master/lib/index.js -O /opt/statsd/backends/mongodb.js
+
+RUN cd /opt/statsd ; npm install --save mongodb
+RUN cd /opt/statsd ; npm install --save async
+
 CMD node /opt/statsd/stats.js /opt/config/statsd.config.js

+ 33 - 25
statsd/statsd/statsd.config.js

@@ -1,28 +1,36 @@
 {
-	"backends" : [ 
-		"./backends/console","/opt/nodejs-statsd-mysql-backend/mysql-backend"
-		],
-	"server" : "./servers/udp",
-	"address" : "0.0.0.0",
-	"port": 8125,
-	"debug" : true,
-	"deleteGauges":   true,
-	"deleteTimers":   true,
-	"deleteSets" :    true,
-	"deleteCounters": true,
-
-	mysql: { 
-	     host: "mysql", 
-	     port: 3306, 
-	     user: "root", 
-             password: "235r2342gtfsw", 
-	     database: "statsd_db",
-	     backendPath : "/opt/nodejs-statsd-mysql-backend/", 
-	     engines : {
-		    counters: ["engines/countersEngine.js"],
-		    gauges:   ["engines/gaugesEngine.js"],
-		    timers:   ["engines/timersEngine.js"],
-		    sets:     ["engines/setsEngine.js"]
-	     }
+    "backends": [
+        "./backends/console",
+        "/opt/nodejs-statsd-mysql-backend/mysql-backend",
+        "./backends/mongodb"
+    ],
+    "server": "./servers/udp",
+    "address": "0.0.0.0",
+    "port": 8125,
+    "debug": true,
+    "deleteGauges": true,
+    "deleteTimers": true,
+    "deleteSets": true,
+    "deleteCounters": true,
+    
+    mysql: {
+        host: "mysql",
+        port: 3306,
+        user: "root",
+        password: "235r2342gtfsw",
+        database: "statsd_db",
+        backendPath: "/opt/nodejs-statsd-mysql-backend/",
+        engines: {
+            counters: ["engines/countersEngine.js"],
+            gauges:   ["engines/gaugesEngine.js"],
+            timers:   ["engines/timersEngine.js"],
+            sets:     ["engines/setsEngine.js"]
         }
+    },
+    
+    "mongoHost": 'mongodb',
+    "mongoPort": 27017,
+    "mongoMax": 2160, 
+    "mongoPrefix": false, 
+    "mongoName": 'statsd'
 }