From bf0ff4c30cb4ad839d4e4d2f1416a45a53c2a37d Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Sun, 30 Dec 2018 16:49:35 -0500 Subject: [PATCH 01/24] Handle invalid config a bit better --- varken/iniparser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/varken/iniparser.py b/varken/iniparser.py index 3569503..c47d021 100644 --- a/varken/iniparser.py +++ b/varken/iniparser.py @@ -1,7 +1,7 @@ from logging import getLogger from os.path import join, exists from re import match, compile, IGNORECASE -from configparser import ConfigParser, NoOptionError +from configparser import ConfigParser, NoOptionError, NoSectionError from varken.helpers import clean_sid_check from varken.structures import SickChillServer @@ -22,7 +22,11 @@ class INIParser(object): self.influx_server = InfluxServer() - self.parse_opts() + try: + self.parse_opts() + except NoSectionError as e: + self.logger.error('Invalid config in (varken.ini): %s',e) + exit(1) self.filtered_strings = None From 1c81be71ae7f9df1978066d8632c062ec79b5185 Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Sun, 30 Dec 2018 17:19:47 -0600 Subject: [PATCH 02/24] nightly version bump --- varken/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/varken/__init__.py b/varken/__init__.py index fba0206..f055e02 100644 --- a/varken/__init__.py +++ b/varken/__init__.py @@ -1,2 +1,2 @@ -VERSION = 1.5 -BRANCH = 'master' +VERSION = 1.6 +BRANCH = 'pre-nightly' From f0f9a3af86343c6d0fba9a2725ff5bcf51d2e0a4 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Sun, 30 Dec 2018 23:51:23 -0500 Subject: [PATCH 03/24] Another day another image --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 544f703..d31afcd 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Requirements:

Example Dashboard - +

Supported Modules: @@ -107,12 +107,12 @@ named `varken` [Official Example Dashboards](https://grafana.com/dashboards?search=Varken%20%5BOfficial%5D) Grafana is used in our examples but not required, nor packaged as part of -Varken. Panel examples now exist in both nightly and tagged releases hosted -on grafana.com (link above). +Varken. Panel examples now exist in both nightly and tagged releases hosted +on grafana.com (link above). 1. Use the link above, then click on your desired dashboard version 2. Click `Copy ID to Clipboard` 3. In grafana, click your dashboards menu dropdown, and then click `Import dashboard` 4. Paste the ID into the `Grafana.com Dashboard` field and then click into empty space on the screen. (This should change the screen to show `Importing Dashboard from Grafana.com` 5. Select your varken datasource name in the dropdown labeled `Varken` -6. Click Import! \ No newline at end of file +6. Click Import! From 847ed69cc67770a5eb67af1befe7aad7e0c7c324 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Mon, 31 Dec 2018 01:00:07 -0500 Subject: [PATCH 04/24] Update the README to reflect wiki changes --- README.md | 67 ++++++------------------------------------------------- 1 file changed, 7 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index d31afcd..73107ef 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ [![Build Status](https://travis-ci.org/Boerderij/Varken.svg?branch=master)](https://travis-ci.org/Boerderij/Varken) [![Discord](https://img.shields.io/badge/Discord-Varken-7289DA.svg?logo=discord&style=flat-square)](https://discord.gg/AGTG44H) [![BuyMeACoffee](https://img.shields.io/badge/BuyMeACoffee-Donate-ff813f.svg?logo=CoffeeScript&style=flat-square)](https://www.buymeacoffee.com/varken) +[![Docker-Layers](https://images.microbadger.com/badges/image/boerderij/varken.svg)](https://microbadger.com/images/boerderij/varken) +[![Docker-Version](https://images.microbadger.com/badges/version/boerderij/varken.svg)](https://microbadger.com/images/boerderij/varken) +[![Docker Pulls](https://img.shields.io/docker/pulls/boerderij/varken.svg)](https://hub.docker.com/r/boerderij/varken/) +[![Docker Stars](https://img.shields.io/docker/stars/boerderij/varken.svg)](https://hub.docker.com/r/boerderij/varken/) Dutch for PIG. PIG is an Acronym for Plex/InfluxDB/Grafana @@ -10,7 +14,7 @@ from the Plex ecosystem into InfluxDB. Examples use Grafana for a frontend Requirements: -* Python3.6.7+ +* [Python 3.6.7+](https://www.python.org/downloads/release/python-367/) * Python3-pip * [InfluxDB](https://www.influxdata.com/) @@ -34,65 +38,8 @@ Key features: * Grafana [Worldmap Panel](https://grafana.com/plugins/grafana-worldmap-panel/installation) support -## Quick Setup (Git Clone) -``` -# Clone the repository -git clone https://github.com/Boerderij/Varken.git /opt/Varken - -# Follow the systemd install instructions located in varken.systemd -cp /opt/Varken/varken.systemd /etc/systemd/system/varken.service -nano /etc/systemd/system/varken.service - -# Create venv in project -/usr/bin/python3 -m venv /opt/Varken/varken-venv - -# Install requirements -/opt/Varken/varken-venv/bin/python -m pip install -r requirements.txt - -# Make a copy of varken.example.ini to varken.ini in the data folder -cp /opt/Varken/data/varken.example.ini /opt/Varken/data/varken.ini - -# Make the appropriate changes to varken.ini -nano /opt/Varken/data/varken.ini - -# Make sure all the files have the appropriate permissions -chown $USER:$USER -R /opt/Varken - -# Start the service and enable it -systemctl start varken -systemctl enable varken -``` -### Docker - -[![Docker-Layers](https://images.microbadger.com/badges/image/boerderij/varken.svg)](https://microbadger.com/images/boerderij/varken) -[![Docker-Version](https://images.microbadger.com/badges/version/boerderij/varken.svg)](https://microbadger.com/images/boerderij/varken) -[![Docker Pulls](https://img.shields.io/docker/pulls/boerderij/varken.svg)](https://hub.docker.com/r/boerderij/varken/) -[![Docker Stars](https://img.shields.io/docker/stars/boerderij/varken.svg)](https://hub.docker.com/r/boerderij/varken/) -
Example -

- -``` -docker run -d \ - --name=varken \ - -v :/config \ - -e PGID= -e PUID= \ - -e TZ=America/Chicago \ - boerderij/varken -``` -

-
- -#### Tags -* **latest** -* **nightly** -* **release-tag** e.g. v1.0 - -#### Upgrading with docker -```sh -docker stop varken -docker rm varken -# Run deploy command above -``` +## Installation Guides +* Installation guides can be found in the [wiki](https://github.com/Boerderij/Varken/wiki/Installation). ### InfluxDB [InfluxDB Installation Documentation](https://docs.influxdata.com/influxdb/v1.7/introduction/installation/) From 8b0e271610a1a847fd8a543f7b73aaa251428cf1 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Mon, 31 Dec 2018 01:40:23 -0500 Subject: [PATCH 05/24] Move grafana dashboard info to the wiki --- README.md | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/README.md b/README.md index 73107ef..af64520 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Key features: ## Installation Guides -* Installation guides can be found in the [wiki](https://github.com/Boerderij/Varken/wiki/Installation). +Installation guides can be found in the [wiki](https://github.com/Boerderij/Varken/wiki/Installation). ### InfluxDB [InfluxDB Installation Documentation](https://docs.influxdata.com/influxdb/v1.7/introduction/installation/) @@ -51,15 +51,3 @@ named `varken` ### Grafana [Grafana Installation Documentation](http://docs.grafana.org/installation/) -[Official Example Dashboards](https://grafana.com/dashboards?search=Varken%20%5BOfficial%5D) - -Grafana is used in our examples but not required, nor packaged as part of -Varken. Panel examples now exist in both nightly and tagged releases hosted -on grafana.com (link above). - -1. Use the link above, then click on your desired dashboard version -2. Click `Copy ID to Clipboard` -3. In grafana, click your dashboards menu dropdown, and then click `Import dashboard` -4. Paste the ID into the `Grafana.com Dashboard` field and then click into empty space on the screen. (This should change the screen to show `Importing Dashboard from Grafana.com` -5. Select your varken datasource name in the dropdown labeled `Varken` -6. Click Import! From 8206708853d7d8cd1c2b5ba9a166e02b1d5df3fb Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Mon, 31 Dec 2018 01:43:09 -0500 Subject: [PATCH 06/24] Add link to wiki for grafana --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index af64520..73d70a7 100644 --- a/README.md +++ b/README.md @@ -51,3 +51,5 @@ named `varken` ### Grafana [Grafana Installation Documentation](http://docs.grafana.org/installation/) + +Official dashboard installation steps can be found in the [wiki](https://github.com/Boerderij/Varken/wiki/Installation#grafana) From da5c47e54777c88f8551ea2c2c2e5cdf658dd1b6 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Mon, 31 Dec 2018 01:59:36 -0500 Subject: [PATCH 07/24] README formatting --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 73d70a7..81da53b 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Key features: ## Installation Guides -Installation guides can be found in the [wiki](https://github.com/Boerderij/Varken/wiki/Installation). +Varken Installation guides can be found in the [wiki](https://github.com/Boerderij/Varken/wiki/Installation). ### InfluxDB [InfluxDB Installation Documentation](https://docs.influxdata.com/influxdb/v1.7/introduction/installation/) @@ -51,5 +51,4 @@ named `varken` ### Grafana [Grafana Installation Documentation](http://docs.grafana.org/installation/) - -Official dashboard installation steps can be found in the [wiki](https://github.com/Boerderij/Varken/wiki/Installation#grafana) +Official dashboard installation instructions can be found in the [wiki](https://github.com/Boerderij/Varken/wiki/Installation#grafana) From abf4e4d8be1dbf913feb94c5862e8a7476fcca97 Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Mon, 31 Dec 2018 16:48:32 -0600 Subject: [PATCH 08/24] changed logic to add varken rectify --- varken/iniparser.py | 71 +++++++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 19 deletions(-) diff --git a/varken/iniparser.py b/varken/iniparser.py index c47d021..0e08129 100644 --- a/varken/iniparser.py +++ b/varken/iniparser.py @@ -11,24 +11,19 @@ from varken.structures import SonarrServer, RadarrServer, OmbiServer, TautulliSe class INIParser(object): def __init__(self, data_folder): - self.config = ConfigParser(interpolation=None) + self.config = None self.data_folder = data_folder - + self.filtered_strings = None self.services = ['sonarr', 'radarr', 'ombi', 'tautulli', 'sickchill', 'ciscoasa'] - for service in self.services: - setattr(self, f'{service}_servers', []) self.logger = getLogger() - self.influx_server = InfluxServer() try: - self.parse_opts() + self.parse_opts(read_file=True) except NoSectionError as e: - self.logger.error('Invalid config in (varken.ini): %s',e) - exit(1) - - self.filtered_strings = None + self.logger.error('Missing section in (varken.ini): %s', e) + self.rectify_ini() def config_blacklist(self): filtered_strings = [section.get(k) for key, section in self.config.items() @@ -53,14 +48,28 @@ class INIParser(object): except NoOptionError as e: self.logger.error(e) - def read_file(self): - file_path = join(self.data_folder, 'varken.ini') + def read_file(self, inifile): + config = ConfigParser(interpolation=None) + ini = inifile + file_path = join(self.data_folder, ini) if exists(file_path): + self.logger.debug('Reading from %s', inifile) with open(file_path) as config_ini: - self.config.read_file(config_ini) - self.config_blacklist() + config.read_file(config_ini) + return config else: - self.logger.error('Config file missing (varken.ini) in %s', self.data_folder) + self.logger.error('File missing (%s) in %s', ini, self.data_folder) + exit(1) + + def write_file(self, inifile): + ini = inifile + file_path = join(self.data_folder, ini) + if exists(file_path): + self.logger.debug('Writing to %s', inifile) + with open(file_path, 'w') as config_ini: + self.config.write(config_ini) + else: + self.logger.error('File missing (%s) in %s', ini, self.data_folder) exit(1) def url_check(self, url=None, include_port=True, section=None): @@ -95,8 +104,31 @@ class INIParser(object): self.logger.debug('%s is a valid URL in module [%s].', url_check, module) return url_check - def parse_opts(self): - self.read_file() + def rectify_ini(self): + self.logger.debug('Rectifying varken.ini with varken.example.ini') + current_ini = self.config + example_ini = self.read_file('varken.example.ini') + + for name, section in example_ini.items(): + if name not in current_ini: + self.logger.debug('Section %s missing. Adding...', name) + current_ini[name] = {} + for key, value in section.items(): + if not current_ini[name].get(key): + self.logger.debug('%s is missing in %s. Adding defaults...', key, name) + current_ini[name][key] = value + + self.config = current_ini + self.write_file('varken.ini') + self.parse_opts() + + def parse_opts(self, read_file=False): + for service in self.services: + setattr(self, f'{service}_servers', []) + + if read_file: + self.config = self.read_file('varken.ini') + self.config_blacklist() # Parse InfluxDB options url = self.url_check(self.config.get('influxdb', 'url'), include_port=False, section='influxdb') @@ -226,5 +258,6 @@ class INIParser(object): getattr(self, f'{service}_servers').append(server) except NoOptionError as e: - setattr(self, f'{service}_enabled', False) - self.logger.error('%s disabled. Error: %s', section, e) + self.logger.error('Missing key in %s. Error: %s', section, e) + self.rectify_ini() + return From ea18e818038098642ad7af6a86fa57c625c19f4d Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Mon, 31 Dec 2018 17:56:48 -0600 Subject: [PATCH 09/24] add globals to writer check --- varken/iniparser.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/varken/iniparser.py b/varken/iniparser.py index 0e08129..2596593 100644 --- a/varken/iniparser.py +++ b/varken/iniparser.py @@ -38,15 +38,12 @@ class INIParser(object): def enable_check(self, server_type=None): t = server_type - try: - global_server_ids = self.config.get('global', t) - if global_server_ids.lower() in ['false', 'no', '0']: - self.logger.info('%s disabled.', t.upper()) - else: - sids = clean_sid_check(global_server_ids, t) - return sids - except NoOptionError as e: - self.logger.error(e) + global_server_ids = self.config.get('global', t) + if global_server_ids.lower() in ['false', 'no', '0']: + self.logger.info('%s disabled.', t.upper()) + else: + sids = clean_sid_check(global_server_ids, t) + return sids def read_file(self, inifile): config = ConfigParser(interpolation=None) @@ -141,7 +138,12 @@ class INIParser(object): # Check for all enabled services for service in self.services: - setattr(self, f'{service}_enabled', self.enable_check(f'{service}_server_ids')) + try: + setattr(self, f'{service}_enabled', self.enable_check(f'{service}_server_ids')) + except NoOptionError as e: + self.logger.error('Missing global %s. Error: %s', f'{service}_server_ids', e) + self.rectify_ini() + return service_enabled = getattr(self, f'{service}_enabled') if service_enabled: From 548866271f23bbed51ed2d6675559e5189c8ae67 Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Mon, 31 Dec 2018 18:25:03 -0600 Subject: [PATCH 10/24] added varken.ini creation if it doesnt exist --- varken/iniparser.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/varken/iniparser.py b/varken/iniparser.py index 2596593..d97d3cf 100644 --- a/varken/iniparser.py +++ b/varken/iniparser.py @@ -1,3 +1,4 @@ +from shutil import copyfile from logging import getLogger from os.path import join, exists from re import match, compile, IGNORECASE @@ -49,14 +50,23 @@ class INIParser(object): config = ConfigParser(interpolation=None) ini = inifile file_path = join(self.data_folder, ini) - if exists(file_path): - self.logger.debug('Reading from %s', inifile) - with open(file_path) as config_ini: - config.read_file(config_ini) - return config - else: + + if not exists(file_path): self.logger.error('File missing (%s) in %s', ini, self.data_folder) - exit(1) + if inifile == 'varken.ini': + try: + self.logger.debug('Creating varken.ini from varken.example.ini') + copyfile(join(self.data_folder, 'varken.example.ini'), file_path) + except IOError as e: + self.logger.error("Varken does not have permission to write to %s. Error: %s - Exiting.", e, + self.data_folder) + exit(1) + + self.logger.debug('Reading from %s', inifile) + with open(file_path) as config_ini: + config.read_file(config_ini) + + return config def write_file(self, inifile): ini = inifile From 28f8402b5a2ed012f52fa82d9559915be17789a5 Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Mon, 31 Dec 2018 18:29:01 -0600 Subject: [PATCH 11/24] fixed early fstring --- Varken.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Varken.py b/Varken.py index c157646..1951088 100644 --- a/Varken.py +++ b/Varken.py @@ -77,7 +77,7 @@ if __name__ == "__main__": vl.logger.info('Data folder is "%s"', DATA_FOLDER) vl.logger.info(u"%s %s (%s%s)", platform.system(), platform.release(), platform.version(), - f' - {PLATFORM_LINUX_DISTRO}' if PLATFORM_LINUX_DISTRO else '') + ' - ' + PLATFORM_LINUX_DISTRO if PLATFORM_LINUX_DISTRO else '') vl.logger.info(u"Python %s", version) From 210e2d19c1fdffe2a5d4a15fba866ff05bf58d18 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Tue, 1 Jan 2019 13:57:21 -0500 Subject: [PATCH 12/24] Remove notes as they have been migrated to the wiki --- data/varken.example.ini | 9 --------- 1 file changed, 9 deletions(-) diff --git a/data/varken.example.ini b/data/varken.example.ini index bbb2ceb..6a8f67a 100644 --- a/data/varken.example.ini +++ b/data/varken.example.ini @@ -1,12 +1,3 @@ -# Notes: -# - Sonarr + Radarr scripts support multiple servers. You can remove the second -# server by putting a # in front of the lines and section name, and removing -# that number from your server_ids list -# - fallback_ip, This is used when there is no IP listed in Tautulli. -# This can happen when you are streaming locally. Set this to your public IP. -# You do not need to change this value if your IP changes. This is only for -# location lookups when there is a failure. - [global] sonarr_server_ids = 1,2 radarr_server_ids = 1,2 From bf20f84224dc9ecb2f8f7fcbdb8806efdf7642e1 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Tue, 1 Jan 2019 23:41:23 -0500 Subject: [PATCH 13/24] Better error checking for failback_ip --- varken/helpers.py | 7 +++++++ varken/iniparser.py | 9 ++++++++- varken/tautulli.py | 11 +++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/varken/helpers.py b/varken/helpers.py index 648eb5a..784a5fa 100644 --- a/varken/helpers.py +++ b/varken/helpers.py @@ -11,6 +11,7 @@ from json.decoder import JSONDecodeError from os.path import abspath, join, basename, isdir from urllib3.exceptions import InsecureRequestWarning from requests.exceptions import InvalidSchema, SSLError, ConnectionError +from ipaddress import IPv4Address logger = getLogger() @@ -83,6 +84,12 @@ def hashit(string): return hashed +def rfc1918_ip_check(ip): + rfc1918_ip = IPv4Address(ip).is_private + + return rfc1918_ip + + def connection_handler(session, request, verify): s = session r = request diff --git a/varken/iniparser.py b/varken/iniparser.py index d97d3cf..08020fe 100644 --- a/varken/iniparser.py +++ b/varken/iniparser.py @@ -4,7 +4,7 @@ from os.path import join, exists from re import match, compile, IGNORECASE from configparser import ConfigParser, NoOptionError, NoSectionError -from varken.helpers import clean_sid_check +from varken.helpers import clean_sid_check, rfc1918_ip_check from varken.structures import SickChillServer from varken.varkenlogger import BlacklistFilter from varken.structures import SonarrServer, RadarrServer, OmbiServer, TautulliServer, InfluxServer, CiscoASAFirewall @@ -217,6 +217,13 @@ class INIParser(object): get_stats_run_seconds = self.config.getint(section, 'get_stats_run_seconds') + invalid_wan_ip = rfc1918_ip_check(fallback_ip) + + if invalid_wan_ip: + self.logger.error('Invalid failback_ip [%s] set for %s-%s!', fallback_ip, service, server_id) + exit(1) + + server = TautulliServer(id=server_id, url=scheme + url, api_key=apikey, verify_ssl=verify_ssl, get_activity=get_activity, fallback_ip=fallback_ip, get_stats=get_stats, diff --git a/varken/tautulli.py b/varken/tautulli.py index 336bba9..7d5ec78 100644 --- a/varken/tautulli.py +++ b/varken/tautulli.py @@ -1,3 +1,4 @@ +from os import _exit from logging import getLogger from requests import Session, Request from datetime import datetime, timezone @@ -45,13 +46,19 @@ class TautulliAPI(object): getattr(session, 'ip_address_public') except AttributeError: self.logger.error('Public IP attribute missing!!! Do you have an old version of Tautulli (v1)?') - exit(1) + _exit(1) try: geodata = self.geoiphandler.lookup(session.ip_address_public) except (ValueError, AddressNotFoundError): if self.server.fallback_ip: - geodata = self.geoiphandler.lookup(self.server.fallback_ip) + # Try the failback ip in the config file + try: + geodata = self.geoiphandler.lookup(self.server.fallback_ip) + except AddressNotFoundError as e: + self.logger.error('%s', e) + _exit(1) + else: my_ip = self.session.get('http://ip.42.pl/raw').text geodata = self.geoiphandler.lookup(my_ip) From 4467810dd893a4e4703c6c044d60569cdae83346 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Tue, 1 Jan 2019 23:44:36 -0500 Subject: [PATCH 14/24] Fix extra space --- varken/iniparser.py | 1 - 1 file changed, 1 deletion(-) diff --git a/varken/iniparser.py b/varken/iniparser.py index 08020fe..d4a197d 100644 --- a/varken/iniparser.py +++ b/varken/iniparser.py @@ -223,7 +223,6 @@ class INIParser(object): self.logger.error('Invalid failback_ip [%s] set for %s-%s!', fallback_ip, service, server_id) exit(1) - server = TautulliServer(id=server_id, url=scheme + url, api_key=apikey, verify_ssl=verify_ssl, get_activity=get_activity, fallback_ip=fallback_ip, get_stats=get_stats, From eb2b8ac127a6ee4b6cd0a3096aeb3361bac06ae9 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Wed, 2 Jan 2019 17:19:44 -0500 Subject: [PATCH 15/24] Update Discord URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 81da53b..6953942 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Varken [![Build Status](https://travis-ci.org/Boerderij/Varken.svg?branch=master)](https://travis-ci.org/Boerderij/Varken) -[![Discord](https://img.shields.io/badge/Discord-Varken-7289DA.svg?logo=discord&style=flat-square)](https://discord.gg/AGTG44H) +[![Discord](https://img.shields.io/badge/Discord-Varken-7289DA.svg?logo=discord&style=flat-square)](https://discord.gg/VjZ6qSM) [![BuyMeACoffee](https://img.shields.io/badge/BuyMeACoffee-Donate-ff813f.svg?logo=CoffeeScript&style=flat-square)](https://www.buymeacoffee.com/varken) [![Docker-Layers](https://images.microbadger.com/badges/image/boerderij/varken.svg)](https://microbadger.com/images/boerderij/varken) [![Docker-Version](https://images.microbadger.com/badges/version/boerderij/varken.svg)](https://microbadger.com/images/boerderij/varken) From 5508fc79b487f82d2e8ac283e614a9efb5102831 Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Wed, 2 Jan 2019 23:15:12 -0600 Subject: [PATCH 16/24] add workdir for exec --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 33fe8b1..f64f619 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,8 @@ RUN \ /config \ /app +WORKDIR /app + CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config VOLUME /config From a51afbc82a33cbe150990774cd56f42d776371ab Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Wed, 2 Jan 2019 23:18:47 -0600 Subject: [PATCH 17/24] changelog + version bump --- CHANGELOG.md | 10 +++++++++- varken/__init__.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ad9ec5..f3e6ed3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## [v1.6-nightly](https://github.com/Boerderij/Varken/tree/v1.6-nightly) (2019-01-02) +[Full Changelog](https://github.com/Boerderij/Varken/compare/v1.5...v1.6-nightly) + +**Implemented enhancements:** + +- Fix missing variables in varken.ini automatically [\#81](https://github.com/Boerderij/Varken/issues/81) +- Create Wiki for FAQ and help docs [\#80](https://github.com/Boerderij/Varken/issues/80) + ## [v1.5](https://github.com/Boerderij/Varken/tree/v1.5) (2018-12-30) [Full Changelog](https://github.com/Boerderij/Varken/compare/v1.4...v1.5) @@ -158,4 +166,4 @@ - Create crontabs [\#6](https://github.com/Boerderij/Varken/pull/6) ([ghost](https://github.com/ghost)) - update plex\_dashboard.json [\#5](https://github.com/Boerderij/Varken/pull/5) ([ghost](https://github.com/ghost)) - Update README.md [\#4](https://github.com/Boerderij/Varken/pull/4) ([ghost](https://github.com/ghost)) -- added sickrage portion [\#3](https://github.com/Boerderij/Varken/pull/3) ([ghost](https://github.com/ghost)) +- added sickrage portion [\#3](https://github.com/Boerderij/Varken/pull/3) ([ghost](https://github.com/ghost)) \ No newline at end of file diff --git a/varken/__init__.py b/varken/__init__.py index f055e02..334a91d 100644 --- a/varken/__init__.py +++ b/varken/__init__.py @@ -1,2 +1,2 @@ VERSION = 1.6 -BRANCH = 'pre-nightly' +BRANCH = 'nightly' From bf9918d69c9dff271001e7f732b1086a3b1129b6 Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Wed, 2 Jan 2019 23:27:07 -0600 Subject: [PATCH 18/24] fixed output of lat/long helper + version bump --- varken/__init__.py | 4 ++-- varken/helpers.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/varken/__init__.py b/varken/__init__.py index 334a91d..90e1972 100644 --- a/varken/__init__.py +++ b/varken/__init__.py @@ -1,2 +1,2 @@ -VERSION = 1.6 -BRANCH = 'nightly' +VERSION = 1.7 +BRANCH = 'pre-nightly' diff --git a/varken/helpers.py b/varken/helpers.py index 784a5fa..5d693c1 100644 --- a/varken/helpers.py +++ b/varken/helpers.py @@ -29,7 +29,7 @@ class GeoIPHandler(object): def lookup(self, ipaddress): ip = ipaddress self.logger.debug('Getting lat/long for Tautulli stream using ip with last octet ending in %s', - ip.split('.')[-1:]) + ip.split('.')[-1:][0]) return self.reader.city(ip) def update(self): From d26ffddb4b5bee2b5eb37761742f30271eb01161 Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Wed, 2 Jan 2019 23:35:29 -0600 Subject: [PATCH 19/24] fixed bug where url:port would not be masked --- varken/iniparser.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/varken/iniparser.py b/varken/iniparser.py index d4a197d..4ad040b 100644 --- a/varken/iniparser.py +++ b/varken/iniparser.py @@ -33,6 +33,9 @@ class INIParser(object): # Added matching for domains that use /locations. ConnectionPool ignores the location in logs domains_only = [string.split('/')[0] for string in filtered_strings if '/' in string] self.filtered_strings.extend(domains_only) + # Added matching for domains that use :port. ConnectionPool splits the domain/ip from the port + without_port = [string.split(':')[0] for string in filtered_strings if ':' in string] + self.filtered_strings.extend(without_port) for handler in self.logger.handlers: handler.addFilter(BlacklistFilter(set(self.filtered_strings))) From 6905a709a7eab2cc69705048142bf6163ed72ecf Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Thu, 3 Jan 2019 14:48:51 -0600 Subject: [PATCH 20/24] add docker-compose stack install option. fixes #84 --- docker-compose.yml | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f7a84e3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,51 @@ +version: '3' +networks: + internal: + driver: bridge +services: + influxdb: + container_name: influxdb + hostname: influxdb + user: 911 + image: influxdb + networks: + - internal + volumes: + - /path/to/docker-influxdb/config-folder:/var/lib/influxdb + - /path/to/docker-influxdb/config-folder/influxdb.conf:/etc/influxdb/influxdb.conf:ro + restart: unless-stopped + command: -config /etc/influxdb/influxdb.conf + varken: + container_name: varken + hostname: varken + image: boerderij/varken + networks: + - internal + volumes: + - /path/to/docker-varken/config-folder:/config + environment: + - PGID=911 + - PUID=911 + - TZ=America/Chicago + depends_on: + - influxdb + restart: unless-stopped + grafana: + container_name: grafana + hostname: grafana + user: 911 + image: grafana/grafana + networks: + - internal + ports: + - 3000:3000 + volumes: + - /path/to/docker-grafana/config-folder:/config + environment: + - GF_PATHS_DATA=/config/data + - GF_PATHS_LOGS=/config/logs + - GF_PATHS_PLUGINS=/config/data/plugins + - GF_INSTALL_PLUGINS=grafana-piechart-panel,grafana-worldmap-panel + depends_on: + - influxdb + restart: unless-stopped \ No newline at end of file From 056f5669a812ba6e9c749182ca190cd1956c9c41 Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Thu, 3 Jan 2019 15:25:48 -0600 Subject: [PATCH 21/24] move grafana plugins folder up 1 --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index f7a84e3..ad1eb3b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -44,7 +44,7 @@ services: environment: - GF_PATHS_DATA=/config/data - GF_PATHS_LOGS=/config/logs - - GF_PATHS_PLUGINS=/config/data/plugins + - GF_PATHS_PLUGINS=/config/plugins - GF_INSTALL_PLUGINS=grafana-piechart-panel,grafana-worldmap-panel depends_on: - influxdb From 02cda5deb16aa1f3e05bd78bce4a81f306130c6e Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Thu, 3 Jan 2019 22:05:15 -0600 Subject: [PATCH 22/24] fixed docker-compose to specify username and removed need for influx.conf --- docker-compose.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ad1eb3b..58a4f6b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,15 +6,13 @@ services: influxdb: container_name: influxdb hostname: influxdb - user: 911 + user: auser image: influxdb networks: - internal volumes: - /path/to/docker-influxdb/config-folder:/var/lib/influxdb - - /path/to/docker-influxdb/config-folder/influxdb.conf:/etc/influxdb/influxdb.conf:ro restart: unless-stopped - command: -config /etc/influxdb/influxdb.conf varken: container_name: varken hostname: varken @@ -33,7 +31,7 @@ services: grafana: container_name: grafana hostname: grafana - user: 911 + user: auser image: grafana/grafana networks: - internal From 6fbf2391b04f7fcdc95b43054db615c023670411 Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Fri, 4 Jan 2019 00:01:14 -0600 Subject: [PATCH 23/24] removed container name to be safe --- docker-compose.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 58a4f6b..d4ea334 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,6 @@ networks: driver: bridge services: influxdb: - container_name: influxdb hostname: influxdb user: auser image: influxdb @@ -14,7 +13,6 @@ services: - /path/to/docker-influxdb/config-folder:/var/lib/influxdb restart: unless-stopped varken: - container_name: varken hostname: varken image: boerderij/varken networks: @@ -29,7 +27,6 @@ services: - influxdb restart: unless-stopped grafana: - container_name: grafana hostname: grafana user: auser image: grafana/grafana From 17d06a954589c6467b4731b9bbcdc33e1aac0f05 Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Fri, 4 Jan 2019 00:26:35 -0600 Subject: [PATCH 24/24] version bump 1.6 + changelog --- CHANGELOG.md | 61 +++++++++++++++++----------------------------------- 1 file changed, 20 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3e6ed3..e95b7cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,22 @@ # Change Log -## [v1.6-nightly](https://github.com/Boerderij/Varken/tree/v1.6-nightly) (2019-01-02) -[Full Changelog](https://github.com/Boerderij/Varken/compare/v1.5...v1.6-nightly) +## [v1.6](https://github.com/Boerderij/Varken/tree/v1.6) (2019-01-04) +[Full Changelog](https://github.com/Boerderij/Varken/compare/v1.5...v1.6) **Implemented enhancements:** +- \[Feature Request\] docker-compose stack install option [\#84](https://github.com/Boerderij/Varken/issues/84) - Fix missing variables in varken.ini automatically [\#81](https://github.com/Boerderij/Varken/issues/81) - Create Wiki for FAQ and help docs [\#80](https://github.com/Boerderij/Varken/issues/80) +**Fixed bugs:** + +- \[BUG\] url:port does not filter [\#82](https://github.com/Boerderij/Varken/issues/82) + +**Merged pull requests:** + +- v1.6 Merge [\#75](https://github.com/Boerderij/Varken/pull/85) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) + ## [v1.5](https://github.com/Boerderij/Varken/tree/v1.5) (2018-12-30) [Full Changelog](https://github.com/Boerderij/Varken/compare/v1.4...v1.5) @@ -28,43 +37,28 @@ - Add Ombi Issues [\#74](https://github.com/Boerderij/Varken/pull/74) ([anderssonoscar0](https://github.com/anderssonoscar0)) ## [v1.4](https://github.com/Boerderij/Varken/tree/v1.4) (2018-12-19) -[Full Changelog](https://github.com/Boerderij/Varken/compare/v1.3-nightly...v1.4) +[Full Changelog](https://github.com/Boerderij/Varken/compare/v1.1...v1.4) **Implemented enhancements:** - \[Feature Request\] Add tautulli request for library stats [\#64](https://github.com/Boerderij/Varken/issues/64) +- Create randomized 12-24 hour checks to update GeoLite DB after the first wednesday of the month [\#60](https://github.com/Boerderij/Varken/issues/60) +- \[Feature Request\]: Pull list of requests \(instead of just counts\) [\#58](https://github.com/Boerderij/Varken/issues/58) +- Feature Request , Add Sickchill [\#48](https://github.com/Boerderij/Varken/issues/48) **Fixed bugs:** - \[BUG\] Ombi all requests missing half of "pending" option [\#63](https://github.com/Boerderij/Varken/issues/63) - \[BUG\] asa bug with checking for apikey [\#62](https://github.com/Boerderij/Varken/issues/62) - -**Merged pull requests:** - -- v1.4 Merge [\#65](https://github.com/Boerderij/Varken/pull/65) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) - -## [v1.3-nightly](https://github.com/Boerderij/Varken/tree/v1.3-nightly) (2018-12-18) -[Full Changelog](https://github.com/Boerderij/Varken/compare/v1.2-nightly...v1.3-nightly) - -**Implemented enhancements:** - -- Create randomized 12-24 hour checks to update GeoLite DB after the first wednesday of the month [\#60](https://github.com/Boerderij/Varken/issues/60) - -**Fixed bugs:** - - \[BUG\] Add Catchall to ombi requests [\#59](https://github.com/Boerderij/Varken/issues/59) **Closed issues:** - Unify naming and cleanup duplication in iniparser [\#61](https://github.com/Boerderij/Varken/issues/61) -## [v1.2-nightly](https://github.com/Boerderij/Varken/tree/v1.2-nightly) (2018-12-16) -[Full Changelog](https://github.com/Boerderij/Varken/compare/v1.1...v1.2-nightly) +**Merged pull requests:** -**Implemented enhancements:** - -- \[Feature Request\]: Pull list of requests \(instead of just counts\) [\#58](https://github.com/Boerderij/Varken/issues/58) -- Feature Request , Add Sickchill [\#48](https://github.com/Boerderij/Varken/issues/48) +- v1.4 Merge [\#65](https://github.com/Boerderij/Varken/pull/65) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) ## [v1.1](https://github.com/Boerderij/Varken/tree/v1.1) (2018-12-11) [Full Changelog](https://github.com/Boerderij/Varken/compare/v1.0...v1.1) @@ -92,22 +86,12 @@ - Update issue templates [\#55](https://github.com/Boerderij/Varken/pull/55) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) ## [v1.0](https://github.com/Boerderij/Varken/tree/v1.0) (2018-12-10) -[Full Changelog](https://github.com/Boerderij/Varken/compare/v0.3-nightly...v1.0) +[Full Changelog](https://github.com/Boerderij/Varken/compare/v0.1...v1.0) **Implemented enhancements:** - Add cisco asa from legacy [\#44](https://github.com/Boerderij/Varken/issues/44) - Add server ID to ombi to differenciate [\#43](https://github.com/Boerderij/Varken/issues/43) - -**Merged pull requests:** - -- v1.0 Merge [\#45](https://github.com/Boerderij/Varken/pull/45) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) - -## [v0.3-nightly](https://github.com/Boerderij/Varken/tree/v0.3-nightly) (2018-12-07) -[Full Changelog](https://github.com/Boerderij/Varken/compare/v0.2-nightly...v0.3-nightly) - -**Implemented enhancements:** - - Create Changelog for nightly release [\#39](https://github.com/Boerderij/Varken/issues/39) - Create proper logging [\#34](https://github.com/Boerderij/Varken/issues/34) @@ -115,12 +99,6 @@ - Remove "dashboard" folder and subfolders [\#42](https://github.com/Boerderij/Varken/issues/42) - Remove "Legacy" folder [\#41](https://github.com/Boerderij/Varken/issues/41) - -## [v0.2-nightly](https://github.com/Boerderij/Varken/tree/v0.2-nightly) (2018-12-06) -[Full Changelog](https://github.com/Boerderij/Varken/compare/v0.1...v0.2-nightly) - -**Closed issues:** - - Create the DB if it does not exist. [\#38](https://github.com/Boerderij/Varken/issues/38) - create systemd examples [\#37](https://github.com/Boerderij/Varken/issues/37) - Create a GeoIP db downloader and refresher [\#36](https://github.com/Boerderij/Varken/issues/36) @@ -138,6 +116,7 @@ **Merged pull requests:** +- v1.0 Merge [\#45](https://github.com/Boerderij/Varken/pull/45) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) - varken to nightly [\#40](https://github.com/Boerderij/Varken/pull/40) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) ## [v0.1](https://github.com/Boerderij/Varken/tree/v0.1) (2018-10-20) @@ -166,4 +145,4 @@ - Create crontabs [\#6](https://github.com/Boerderij/Varken/pull/6) ([ghost](https://github.com/ghost)) - update plex\_dashboard.json [\#5](https://github.com/Boerderij/Varken/pull/5) ([ghost](https://github.com/ghost)) - Update README.md [\#4](https://github.com/Boerderij/Varken/pull/4) ([ghost](https://github.com/ghost)) -- added sickrage portion [\#3](https://github.com/Boerderij/Varken/pull/3) ([ghost](https://github.com/ghost)) \ No newline at end of file +- added sickrage portion [\#3](https://github.com/Boerderij/Varken/pull/3) ([ghost](https://github.com/ghost))