diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..6e1e55022765e408790898be1586f880b9ef4906 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.3-slim +MAINTAINER Allan Tribe <atribe13@gmail.com> + +ADD . /src +WORKDIR /src + +RUN pip install -r requirements.txt + +CMD ["python", "/src/InfluxdbSpeedtest.py"] diff --git a/README.md b/README.md index 6244232aa55589674e0ea35dbf5883707f2dcaa8..619ab3cd7dd37d961558045001f2ee643c2dd92b 100644 --- a/README.md +++ b/README.md @@ -43,3 +43,38 @@ Python 3+ You will need the influxdb library installed to use this - [Found Here](https://github.com/influxdata/influxdb-python) You will need the speedtest-cli library installed to use this - [Found Here](https://github.com/sivel/speedtest-cli) +## Docker Setup + +1. Install [Docker](https://www.docker.com/) + +2. Make a directory to hold the config.ini file. Navigate to that directory and download the sample config.ini in this repo. +```bash +mkdir speedtest +curl -O https://raw.githubusercontent.com/barrycarey/Speedtest-for-InfluxDB-and-Grafana/blob/master/config.ini speedtest/config.ini +cd speedtest +``` + +3. Modify the config file with your influxdb settings. +```bash +nano config.ini +``` +Modify the 'Address =' line include the ip or hostname of your influxdb instance. +Example: +```bash +Address = 10.13.14.200 +``` + +4. Run the container, pointing to the directory with the config file. This should now pull the image from Docker hub. You can do this by either running docker run or by using docker-compose. + 1. The docker run option. +```bash +docker run -d \ +--name="speedtest" \ +-v config.ini:/src/config.ini \ +--restart="always" \ +atribe/speedtest-for-influxdb-and-grafana +``` + 2. The docker-compose option + ```bash + curl -O https://raw.githubusercontent.com/barrycarey/Speedtest-for-InfluxDB-and-Grafana/blob/master/ddocker-compose.yml docker-compose.yml + docker-compose up -d + ``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..483e05d548bcefb1aecf54728e9eb6ca428cbf28 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '2' +services: + speedtest: + image: atribe/Speedtest-for-InfluxDB-and-Grafana + container_name: speedtest + volumes: + - ./config.ini:/src/config.ini + restart: always