From d8df1be7b697fbd23abab134450ff92a3f4f5dd1 Mon Sep 17 00:00:00 2001 From: Alex Thomae Date: Sun, 26 Jan 2020 15:44:05 +0100 Subject: [PATCH] Minor improvements. Prepares v0.4.1 --- .gitignore | 2 ++ .gitlab-ci.yml | 14 +------------- Dockerfile | 2 +- README.md | 3 +-- src/requirements.txt | 4 ++-- src/stellar-exporter.py | 6 ++++-- test.sh | 3 +++ 7 files changed, 14 insertions(+), 20 deletions(-) create mode 100644 .gitignore create mode 100644 test.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..31ad649 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__ +.local diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 793a8ea..8d4bfed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,21 +1,9 @@ variables: - DOCKER_DRIVER: overlay2 - DOCKERHUB_REPO_PREFIX: ixdotai DOCKERHUB_REPO_NAME: stellar-exporter ENABLE_ARM64: 'true' ENABLE_ARMv7: 'true' + ENABLE_ARMv6: 'true' include: - project: 'ix.ai/ci-templates' file: '/python-project.yml' - -test: - extends: - - .tags-template - stage: test - image: python:latest - variables: - TEST: 'true' - script: - - pip3 install --no-cache-dir -r src/requirements.txt - - python3 src/${CI_PROJECT_NAME}.py diff --git a/Dockerfile b/Dockerfile index 48b141a..75b1064 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ WORKDIR /app COPY src/ /app RUN apk --no-cache upgrade && \ - apk add --no-cache python3 py3-toml py3-numpy py3-prometheus-client py3-pynacl py3-urllib3 && \ + apk add --no-cache python3 py3-toml py3-numpy py3-prometheus-client py3-pynacl py3-urllib3 py3-yarl && \ apk add --no-cache python3-dev gcc musl-dev libffi-dev make && \ pip3 install --no-cache-dir -r requirements.txt && \ apk del --no-cache --purge python3-dev gcc musl-dev libffi-dev make diff --git a/README.md b/README.md index 5d82be6..ef88968 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,9 @@ docker run --rm -it -p 9308:9308 \ ## Tags and Arch -Starting with version v0.4.0, the images are multi-arch, with builds for amd64, arm64 and armv7. +Starting with version v0.4.1, the images are multi-arch, with builds for amd64, arm64, armv7 and armv6. * `vN.N.N` - for example v0.4.0 * `latest` - always pointing to the latest version -* `dev-branch` - the last build on a feature/development branch * `dev-master` - the last build on the master branch ## Resources: diff --git a/src/requirements.txt b/src/requirements.txt index 87f1009..3b4e600 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -1,6 +1,6 @@ -pbkdf2 prometheus_client>=0.7.1 -pygelf stellar-base==1.1.2.0 stellar-sdk==2.1.0 toml>=0.10.0 +pygelf==0.3.6 +pbkdf2 diff --git a/src/stellar-exporter.py b/src/stellar-exporter.py index c3c8ff1..06e5092 100644 --- a/src/stellar-exporter.py +++ b/src/stellar-exporter.py @@ -18,6 +18,8 @@ datefmt='%Y-%m-%d %H:%M:%S' ) +FILENAME = os.path.splitext(sys.modules['__main__'].__file__)[0] + def configure_logging(): """ Configures the logging """ @@ -29,7 +31,7 @@ def configure_logging(): port=int(os.environ.get('GELF_PORT', 12201)), debug=True, include_extra_fields=True, - _ix_id=os.path.splitext(sys.modules['__main__'].__file__)[0][1:], # sets it to 'stellar-exporter' + _ix_id=FILENAME ) LOG.addHandler(GELF) gelf_enabled = True @@ -102,7 +104,7 @@ def collect(self): configure_logging() PORT = int(os.environ.get('PORT', 9188)) # pylint: disable=no-member - LOG.info("Starting stellar-exporter {} on port {}".format(constants.VERSION, PORT)) + LOG.info("Starting {} {} on port {}".format(FILENAME, constants.VERSION, PORT)) REGISTRY.register(StellarCollector()) TEST = os.environ.get('TEST', False) if not TEST: diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..13d0c0c --- /dev/null +++ b/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +TEST=true python3 src/${CI_PROJECT_NAME}.py