Skip to content

Buccaneer/lc-docker

Repository files navigation

Dockerize Linked Connections

Repository with resources to dockerize Linked Connections.

1. Setup

1.1 MongoDB

Build the MongoDB image and run it in a container

docker build --tag buccaneer/lc-mongodb ./lc-mongodb
docker run -p 28001:27017 --name lc-mongodb-container buccaneer/lc-mongodb

Import the connections into the database

Linux
gunzip -c belgianrailconnectionsOct2015.mongojsonstream.gz | mongoimport --db lc --collection connections --port 28001
Windows

!! Make sure the host is that of your docker machine.

gunzip -c belgianrailconnectionsOct2015.mongojsonstream.gz | mongoimport --db lc --collection connections --host 192.168.99.100 --port 28001

Ensure there is an index on departureTime

Linux
mongo lc --port 28001
Windows

!! Make sure the host is that of your docker machine.

mongo 192.168.99.100:28001/lc
Mongo shell
db.connections.ensureIndex({departureTime:1});
quit();

1.2 Query server

Build the query server image and run it in a container

docker build --tag buccaneer/lc-query-server ./lc-query-server
docker run -p 8082:8082 --name lc-query-server-container --link lc-mongodb-container buccaneer/lc-query-server

1.3 Linked Connections server

Build the lc server image and run it in a container

docker build --tag buccaneer/lc-server ./lc-server
docker run -p 8084:8084 --name lc-server-container --link lc-mongodb-container buccaneer/lc-server

1.4 NGINX Cache

!! Copy lc-cache/conf-linux or lc-cache/conf-windows folder as lc-cache/conf to use the correct configuration.

Build the nginx cache image and run it in a container.

docker build --tag buccaneer/lc-cache ./lc-cache
docker run -p 8081:8081 --name lc-cache-container --link lc-query-server-container buccaneer/lc-cache

1.5 Query mix generator & executor

Change directory to lc-query-mix then install dependencies.

cd lc-query-mix
npm install

Generate a query mix then execute it.

node ./bin/querymixgenerator.js > result.jsonstream
node ./bin/querymixexecutor.js < result.jsonstream

2. Monitoring

For additional instructions check:

https://www.brianchristner.io/how-to-setup-docker-monitoring/

2.1 InfluxDB

Run InfluxDB container

docker run -d -p 8083:8083 -p 8086:8086 --expose 8090 --expose 8099 --name lc-influx tutum/influxdb

Create an account with username 'root' and password 'root'.

2.2 cAdvisor

Run cAdvisor container

docker run --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --publish=8080:8080 --detach=true --link lc-influx:lc-influx --name=cadvisor google/cadvisor:latest -storage_driver=influxdb -storage_driver_db=cadvisor -storage_driver_host=192.168.99.100:8086

2.3 Grafana

Run Grafana container

docker run -d -p 3000:3000 -e INFLUXDB_HOST=192.168.99.100 -e INFLUXDB_PORT=8086 -e INFLUXDB_NAME=cadvisor -e INFLUXDB_USER=root -e INFLUXDB_PASS=root --link lc-influx:lc-influx --name grafana grafana/grafana

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages