diff --git a/.travis.yml b/.travis.yml index 0c1436a..0dd0518 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,12 @@ addons: apt: packages: - docker-ce -branches: - only: - - master deploy: - provider: script script: bash deploy.sh on: branch: master + - provider: script + script: bash deploy.sh + on: + branch: develop \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ae09124..0756b42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,20 @@ # Change Log -## [v1.6.3](https://github.com/Boerderij/Varken/tree/v1.6.3) (2019-01-16) -[Full Changelog](https://github.com/Boerderij/Varken/compare/v1.6.2...v1.6.3) +## [v1.6.4](https://github.com/Boerderij/Varken/tree/v1.6.4) (2019-02-03) +[Full Changelog](https://github.com/Boerderij/Varken/compare/1.6.3...v1.6.4) + +**Fixed bugs:** + +- \[BUG\] fstring in Varken.py Doesnt allow py version check [\#102](https://github.com/Boerderij/Varken/issues/102) +- \[BUG\] Unifi loadavg is str instead of float [\#101](https://github.com/Boerderij/Varken/issues/101) +- \[BUG\] requestedByAlias to added to Ombi structures [\#97](https://github.com/Boerderij/Varken/issues/97) + +**Merged pull requests:** + +- v1.6.4 Merge [\#100](https://github.com/Boerderij/Varken/pull/100) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) + +## [1.6.3](https://github.com/Boerderij/Varken/tree/1.6.3) (2019-01-16) +[Full Changelog](https://github.com/Boerderij/Varken/compare/v1.6.2...1.6.3) **Implemented enhancements:** @@ -13,7 +26,9 @@ **Merged pull requests:** -- v1.6.3 Merge [\#94](https://github.com/Boerderij/Varken/pull/92) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) +- double typo [\#96](https://github.com/Boerderij/Varken/pull/96) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) +- tweaks [\#95](https://github.com/Boerderij/Varken/pull/95) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) +- v1.6.3 Merge [\#94](https://github.com/Boerderij/Varken/pull/94) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) ## [v1.6.2](https://github.com/Boerderij/Varken/tree/v1.6.2) (2019-01-12) [Full Changelog](https://github.com/Boerderij/Varken/compare/v1.6.1...v1.6.2) @@ -68,7 +83,6 @@ **Implemented enhancements:** - \[Feature Request\] Add issues from Ombi [\#70](https://github.com/Boerderij/Varken/issues/70) -- \[Feature Request\] Allow DNS Hostnames [\#66](https://github.com/Boerderij/Varken/issues/66) - Replace static grafana configs with a Public Example [\#32](https://github.com/Boerderij/Varken/issues/32) **Fixed bugs:** @@ -123,7 +137,6 @@ **Closed issues:** - Initial startup requires admin access to InfluxDB [\#53](https://github.com/Boerderij/Varken/issues/53) -- Ability to add custom tautulli port [\#49](https://github.com/Boerderij/Varken/issues/49) **Merged pull requests:** @@ -151,12 +164,7 @@ - use a config.ini instead of command-line flags [\#33](https://github.com/Boerderij/Varken/issues/33) - Migrate crontab to python schedule package [\#31](https://github.com/Boerderij/Varken/issues/31) - Consolidate missing and missing\_days in sonarr.py [\#30](https://github.com/Boerderij/Varken/issues/30) -- Database Withou any scripts [\#29](https://github.com/Boerderij/Varken/issues/29) -- Grafana dashboard json doesn't match format of readme screenshot? [\#28](https://github.com/Boerderij/Varken/issues/28) - Ombi something new \[Request\] [\#26](https://github.com/Boerderij/Varken/issues/26) -- Users Online not populating [\#24](https://github.com/Boerderij/Varken/issues/24) -- Missing dashboard [\#23](https://github.com/Boerderij/Varken/issues/23) -- Is there a Docker Image available for these scripts? [\#22](https://github.com/Boerderij/Varken/issues/22) - Support for Linux without ASA [\#21](https://github.com/Boerderij/Varken/issues/21) **Merged pull requests:** @@ -173,7 +181,6 @@ **Closed issues:** -- Tautulli.py not working. [\#18](https://github.com/Boerderij/Varken/issues/18) - Issues with scripts [\#12](https://github.com/Boerderij/Varken/issues/12) - issue with new tautulli.py [\#10](https://github.com/Boerderij/Varken/issues/10) - ombi.py fails when attempting to update influxdb [\#9](https://github.com/Boerderij/Varken/issues/9) diff --git a/Dockerfile b/Dockerfile index 04e8806..8c84f9c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,12 +4,16 @@ LABEL maintainers="dirtycajunrice,samwiseg0" ENV DEBUG="False" -COPY / /app +WORKDIR /app + +COPY /requirements.txt /Varken.py /app/ + +COPY /varken /app/varken + +COPY /data /app/data RUN python3 -m pip install -r /app/requirements.txt -WORKDIR /app - CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config VOLUME /config diff --git a/Dockerfile.arm b/Dockerfile.arm index 5d5624e..3bcad32 100644 --- a/Dockerfile.arm +++ b/Dockerfile.arm @@ -4,14 +4,18 @@ LABEL maintainers="dirtycajunrice,samwiseg0" ENV DEBUG="False" -COPY / /app +WORKDIR /app -COPY /tmp/qemu-arm-static /usr/bin/qemu-arm-static +COPY /qemu-arm-static /usr/bin/qemu-arm-static + +COPY /requirements.txt /Varken.py /app/ + +COPY /varken /app/varken + +COPY /data /app/data RUN python3 -m pip install -r /app/requirements.txt -WORKDIR /app - CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config VOLUME /config \ No newline at end of file diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index 5922d9a..d18a154 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -4,14 +4,18 @@ LABEL maintainers="dirtycajunrice,samwiseg0" ENV DEBUG="False" -COPY / /app +WORKDIR /app -COPY /tmp/qemu-aarch64-static /usr/bin/qemu-aarch64-static +COPY /qemu-aarch64-static /usr/bin/qemu-aarch64-static + +COPY /requirements.txt /Varken.py /app/ + +COPY /varken /app/varken + +COPY /data /app/data RUN python3 -m pip install -r /app/requirements.txt -WORKDIR /app - CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config VOLUME /config \ No newline at end of file diff --git a/Dockerfile.armhf b/Dockerfile.armhf deleted file mode 100644 index 4ed529a..0000000 --- a/Dockerfile.armhf +++ /dev/null @@ -1,17 +0,0 @@ -FROM arm32v7/python:3.7.2-slim - -LABEL maintainers="dirtycajunrice,samwiseg0" - -ENV DEBUG="False" - -COPY / /app - -COPY /tmp/qemu-arm-static /usr/bin/qemu-arm-static - -RUN python3 -m pip install -r /app/requirements.txt - -WORKDIR /app - -CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config - -VOLUME /config \ No newline at end of file diff --git a/README.md b/README.md index 6bc4cbf..105a180 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ -# Varken +
+
+
diff --git a/Varken.py b/Varken.py
index bd06a89..cd83c34 100644
--- a/Varken.py
+++ b/Varken.py
@@ -98,13 +98,13 @@ if __name__ == "__main__":
SONARR = SonarrAPI(server, DBMANAGER)
if server.queue:
at_time = schedule.every(server.queue_run_seconds).seconds
- at_time.do(QUEUE.put, SONARR.get_queue).tag(f"sonarr-{server.id}-get_queue")
+ at_time.do(QUEUE.put, SONARR.get_queue).tag("sonarr-{}-get_queue".format(server.id))
if server.missing_days > 0:
at_time = schedule.every(server.missing_days_run_seconds).seconds
- at_time.do(QUEUE.put, SONARR.get_missing).tag(f"sonarr-{server.id}-get_missing")
+ at_time.do(QUEUE.put, SONARR.get_missing).tag("sonarr-{}-get_missing".format(server.id))
if server.future_days > 0:
at_time = schedule.every(server.future_days_run_seconds).seconds
- at_time.do(QUEUE.put, SONARR.get_future).tag(f"sonarr-{server.id}-get_future")
+ at_time.do(QUEUE.put, SONARR.get_future).tag("sonarr-{}-get_future".format(server.id))
if CONFIG.tautulli_enabled:
GEOIPHANDLER = GeoIPHandler(DATA_FOLDER)
@@ -113,46 +113,46 @@ if __name__ == "__main__":
TAUTULLI = TautulliAPI(server, DBMANAGER, GEOIPHANDLER)
if server.get_activity:
at_time = schedule.every(server.get_activity_run_seconds).seconds
- at_time.do(QUEUE.put, TAUTULLI.get_activity).tag(f"tautulli-{server.id}-get_activity")
+ at_time.do(QUEUE.put, TAUTULLI.get_activity).tag("tautulli-{}-get_activity".format(server.id))
if server.get_stats:
at_time = schedule.every(server.get_stats_run_seconds).seconds
- at_time.do(QUEUE.put, TAUTULLI.get_stats).tag(f"tautulli-{server.id}-get_stats")
+ at_time.do(QUEUE.put, TAUTULLI.get_stats).tag("tautulli-{}-get_stats".format(server.id))
if CONFIG.radarr_enabled:
for server in CONFIG.radarr_servers:
RADARR = RadarrAPI(server, DBMANAGER)
if server.get_missing:
at_time = schedule.every(server.get_missing_run_seconds).seconds
- at_time.do(QUEUE.put, RADARR.get_missing).tag(f"radarr-{server.id}-get_missing")
+ at_time.do(QUEUE.put, RADARR.get_missing).tag("radarr-{}-get_missing".format(server.id))
if server.queue:
at_time = schedule.every(server.queue_run_seconds).seconds
- at_time.do(QUEUE.put, RADARR.get_queue).tag(f"radarr-{server.id}-get_queue")
+ at_time.do(QUEUE.put, RADARR.get_queue).tag("radarr-{}-get_queue".format(server.id))
if CONFIG.ombi_enabled:
for server in CONFIG.ombi_servers:
OMBI = OmbiAPI(server, DBMANAGER)
if server.request_type_counts:
at_time = schedule.every(server.request_type_run_seconds).seconds
- at_time.do(QUEUE.put, OMBI.get_request_counts).tag(f"ombi-{server.id}-get_request_counts")
+ at_time.do(QUEUE.put, OMBI.get_request_counts).tag("ombi-{}-get_request_counts".format(server.id))
if server.request_total_counts:
at_time = schedule.every(server.request_total_run_seconds).seconds
- at_time.do(QUEUE.put, OMBI.get_all_requests).tag(f"ombi-{server.id}-get_all_requests")
+ at_time.do(QUEUE.put, OMBI.get_all_requests).tag("ombi-{}-get_all_requests".format(server.id))
if server.issue_status_counts:
at_time = schedule.every(server.issue_status_run_seconds).seconds
- at_time.do(QUEUE.put, OMBI.get_issue_counts).tag(f"ombi-{server.id}-get_issue_counts")
+ at_time.do(QUEUE.put, OMBI.get_issue_counts).tag("ombi-{}-get_issue_counts".format(server.id))
if CONFIG.sickchill_enabled:
for server in CONFIG.sickchill_servers:
SICKCHILL = SickChillAPI(server, DBMANAGER)
if server.get_missing:
at_time = schedule.every(server.get_missing_run_seconds).seconds
- at_time.do(QUEUE.put, SICKCHILL.get_missing).tag(f"sickchill-{server.id}-get_missing")
+ at_time.do(QUEUE.put, SICKCHILL.get_missing).tag("sickchill-{}-get_missing".format(server.id))
if CONFIG.unifi_enabled:
for server in CONFIG.unifi_servers:
UNIFI = UniFiAPI(server, DBMANAGER)
at_time = schedule.every(server.get_usg_stats_run_seconds).seconds
- at_time.do(QUEUE.put, UNIFI.get_usg_stats).tag(f"unifi-{server.id}-get_usg_stats")
+ at_time.do(QUEUE.put, UNIFI.get_usg_stats).tag("unifi-{}-get_usg_stats".format(server.id))
# Run all on startup
SERVICES_ENABLED = [CONFIG.ombi_enabled, CONFIG.radarr_enabled, CONFIG.tautulli_enabled, CONFIG.unifi_enabled,
diff --git a/deploy.sh b/deploy.sh
index 6944546..d2feb82 100644
--- a/deploy.sh
+++ b/deploy.sh
@@ -1,11 +1,24 @@
#!/usr/bin/env bash
+# Travis-ci convenience environment vars used:
+# TRAVIS_BRANCH | branch name
+# $TRAVIS_REPO_SLUG | organization/project (GitHub Capitalization)
+# Travis-ci manual environment vars used:
+# GITHUB_USER | github username
+# GITHUB_TOKEN | $GITHUB_USER's token
+# DOCKER_USER | docker username
+# DOCKER_PASSWORD | $DOCKER_USER's password
+
VERSION="$(grep -i version varken/__init__.py | cut -d' ' -f3 | tr -d \")"
-# Docker
-GITHUB_USER='dirtycajunrice'
-DOCKER_USER='dirtycajunrice'
-PROJECT='varken'
-NAMESPACE="boerderij/${PROJECT}"
+# Set branch to latest if master, else keep the same
+if [[ "$TRAVIS_BRANCH" == "master" ]]; then
+ BRANCH="latest"
+else
+ BRANCH="$TRAVIS_BRANCH"
+fi
+
+# get the docker lowercase variant of the repo_name
+REPOSITORY="$(echo $TRAVIS_REPO_SLUG | tr '[:upper:]' '[:lower:]')"
# Docker experimental config
echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
@@ -15,40 +28,52 @@ echo '{"experimental":"enabled"}' | sudo tee ~/.docker/config.json
sudo service docker restart
# Auth
-echo "$DOCKER_PASSWORD" | docker login -u="$DOCKER_USER" --password-stdin
+echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin
-# Latest x64
-docker build -t "${NAMESPACE}:latest" . && \
-docker push "${NAMESPACE}:latest" && \
-# Versioned x64
-docker tag "${NAMESPACE}:latest" "${NAMESPACE}:${VERSION}" && \
-docker push "${NAMESPACE}:${VERSION}" && \
-# x64 Arch
-docker tag "${NAMESPACE}:latest" "${NAMESPACE}:latest-amd64" && \
-docker push "${NAMESPACE}:latest-amd64"
-
-# Prepare qemu for ARM builds
+# Prepare QEMU for ARM builds
docker run --rm --privileged multiarch/qemu-user-static:register --reset
-wget -P tmp/ "https://github.com/multiarch/qemu-user-static/releases/download/v3.1.0-2/qemu-aarch64-static"
-wget -P tmp/ "https://github.com/multiarch/qemu-user-static/releases/download/v3.1.0-2/qemu-arm-static"
-chmod +x tmp/qemu-aarch64-static tmp/qemu-arm-static
+bash prebuild.sh
+chmod +x qemu-aarch64-static qemu-arm-static
-# ARM images
+# Set tag based off of branch
+if [[ "$BRANCH" == "latest" ]]; then
+ TAG="$VERSION"
+else
+ TAG="$BRANCH"
+fi
+
+# AMDx64
+docker build -t "${REPOSITORY}:${TAG}-amd64" . && \
+docker push "${REPOSITORY}:${TAG}-amd64"
+
+# Create Initial Manifests
+docker manifest create "${REPOSITORY}:${TAG}" "${REPOSITORY}:${TAG}-amd64"
+if [[ "$BRANCH" == "latest" ]]; then
+ docker manifest create "${REPOSITORY}:${BRANCH}" "${REPOSITORY}:${TAG}-amd64"
+fi
+
+# ARM variants
for i in $(ls *arm*); do
- arch="$(echo ${i} | cut -d. -f2)"
- # Latest
- docker build -f "./Dockerfile.${arch}" -t "${NAMESPACE}:latest-${arch}" . && \
- docker push "${NAMESPACE}:latest-${arch}" && \
- # Versioned
- docker tag "${NAMESPACE}:latest-${arch}" "${NAMESPACE}:${VERSION}-${arch}" && \
- docker push "${NAMESPACE}:${VERSION}-${arch}"
+ ARCH="$(echo ${i} | cut -d. -f2)"
+ docker build -f "Dockerfile.${ARCH}" -t "${REPOSITORY}:${TAG}-${ARCH}" . && \
+ docker push "${REPOSITORY}:${TAG}-${ARCH}"
+ # Add variant to manifest
+ docker manifest create -a "${REPOSITORY}:${TAG}" "${REPOSITORY}:${TAG}-${ARCH}"
+ if [[ "$BRANCH" == "latest" ]]; then
+ docker manifest create -a "${REPOSITORY}:${BRANCH}" "${REPOSITORY}:${TAG}-${ARCH}"
+ fi
done
-wget -O manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.9.0/manifest-tool-linux-amd64 && \
-chmod +x manifest-tool && \
-python3 manifest_generator.py && \
-./manifest-tool --username "$DOCKER_USER" --password "$DOCKER_PASSWORD" push from-spec ".manifest.yaml"
+docker manifest inspect "${REPOSITORY}:${TAG}" && \
+docker manifest push "${REPOSITORY}:${TAG}"
+if [[ "$BRANCH" == "latest" ]]; then
+ docker manifest inspect "${REPOSITORY}:${BRANCH}" && \
+ docker manifest push "${REPOSITORY}:${BRANCH}"
+fi
+
# Git tags
-git remote set-url origin "https://${GITHUB_USER}:${GITHUB_API_KEY}@github.com/${NAMESPACE}.git" && \
-git tag "${VERSION}" && \
-git push --tags
\ No newline at end of file
+if [[ "$BRANCH" == "latest" ]]; then
+ git remote set-url origin "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${REPOSITORY}.git" && \
+ git tag "${VERSION}" && \
+ git push --tags
+fi
\ No newline at end of file
diff --git a/manifest_generator.py b/manifest_generator.py
deleted file mode 100644
index db200db..0000000
--- a/manifest_generator.py
+++ /dev/null
@@ -1,37 +0,0 @@
-import yaml
-
-from varken import VERSION
-
-org = 'boerderij'
-project = 'varken'
-namespace = f"{org}/{project}"
-
-yaml_arr = []
-tags = ['latest', VERSION]
-
-# Docker image, arch, variant, os
-arch_list = [('arm', 'arm', 'v6', 'linux'),
- ('armhf', 'arm', 'v7', 'linux'),
- ('arm64', 'arm64', 'v8', 'linux'),
- ('amd64', 'amd64', None, 'linux')]
-
-for tag in tags:
- yaml_doc = {
- 'image': f'{namespace}:{tag}',
- 'manifests': []
- }
- for arch in arch_list:
- info = {
- 'image': f"{namespace}:{tag}-{arch[0]}",
- 'platform': {
- 'architecture': arch[1],
- 'os': arch[3]
- }
- }
- if arch[2]:
- info['platform']['variant'] = arch[2]
- yaml_doc['manifests'].append(info)
- yaml_arr.append(yaml_doc)
-
-with open(f".manifest.yaml", 'w') as file:
- yaml.dump_all(yaml_arr, file, default_flow_style=False)
diff --git a/prebuild.sh b/prebuild.sh
new file mode 100644
index 0000000..8d12fd7
--- /dev/null
+++ b/prebuild.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+wget -q "https://github.com/multiarch/qemu-user-static/releases/download/v3.1.0-2/qemu-aarch64-static"
+wget -q "https://github.com/multiarch/qemu-user-static/releases/download/v3.1.0-2/qemu-arm-static"
\ No newline at end of file
diff --git a/varken.xml b/varken.xml
new file mode 100644
index 0000000..b846c57
--- /dev/null
+++ b/varken.xml
@@ -0,0 +1,55 @@
+
+
+